From d80c7605a0892ae401953da4b889543598292986 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Tue, 7 Jan 2014 21:37:29 +0100 Subject: GNAP: Initial commit --- engines/gnap/datarchive.cpp | 121 ++ engines/gnap/datarchive.h | 80 ++ engines/gnap/detection.cpp | 195 +++ engines/gnap/fontdata.h | 851 +++++++++++++ engines/gnap/gamesys.cpp | 1303 ++++++++++++++++++++ engines/gnap/gamesys.h | 216 ++++ engines/gnap/gnap.cpp | 2404 +++++++++++++++++++++++++++++++++++++ engines/gnap/gnap.h | 1117 +++++++++++++++++ engines/gnap/grid.cpp | 1392 +++++++++++++++++++++ engines/gnap/menu.cpp | 811 +++++++++++++ engines/gnap/module.mk | 70 ++ engines/gnap/resource.cpp | 118 ++ engines/gnap/resource.h | 196 +++ engines/gnap/scenes/scene01.cpp | 373 ++++++ engines/gnap/scenes/scene02.cpp | 539 +++++++++ engines/gnap/scenes/scene03.cpp | 517 ++++++++ engines/gnap/scenes/scene04.cpp | 571 +++++++++ engines/gnap/scenes/scene05.cpp | 467 +++++++ engines/gnap/scenes/scene06.cpp | 446 +++++++ engines/gnap/scenes/scene07.cpp | 275 +++++ engines/gnap/scenes/scene08.cpp | 527 ++++++++ engines/gnap/scenes/scene09.cpp | 241 ++++ engines/gnap/scenes/scene10.cpp | 500 ++++++++ engines/gnap/scenes/scene11.cpp | 488 ++++++++ engines/gnap/scenes/scene12.cpp | 564 +++++++++ engines/gnap/scenes/scene13.cpp | 455 +++++++ engines/gnap/scenes/scene14.cpp | 194 +++ engines/gnap/scenes/scene15.cpp | 343 ++++++ engines/gnap/scenes/scene16.cpp | 82 ++ engines/gnap/scenes/scene17.cpp | 846 +++++++++++++ engines/gnap/scenes/scene18.cpp | 1026 ++++++++++++++++ engines/gnap/scenes/scene19.cpp | 470 ++++++++ engines/gnap/scenes/scene20.cpp | 736 ++++++++++++ engines/gnap/scenes/scene21.cpp | 345 ++++++ engines/gnap/scenes/scene22.cpp | 294 +++++ engines/gnap/scenes/scene23.cpp | 297 +++++ engines/gnap/scenes/scene24.cpp | 261 ++++ engines/gnap/scenes/scene25.cpp | 401 +++++++ engines/gnap/scenes/scene26.cpp | 256 ++++ engines/gnap/scenes/scene27.cpp | 423 +++++++ engines/gnap/scenes/scene28.cpp | 435 +++++++ engines/gnap/scenes/scene29.cpp | 352 ++++++ engines/gnap/scenes/scene30.cpp | 281 +++++ engines/gnap/scenes/scene31.cpp | 398 ++++++ engines/gnap/scenes/scene32.cpp | 201 ++++ engines/gnap/scenes/scene33.cpp | 327 +++++ engines/gnap/scenes/scene38.cpp | 355 ++++++ engines/gnap/scenes/scene39.cpp | 237 ++++ engines/gnap/scenes/scene40.cpp | 193 +++ engines/gnap/scenes/scene41.cpp | 577 +++++++++ engines/gnap/scenes/scene42.cpp | 494 ++++++++ engines/gnap/scenes/scene43.cpp | 484 ++++++++ engines/gnap/scenes/scene44.cpp | 529 ++++++++ engines/gnap/scenes/scene45.cpp | 430 +++++++ engines/gnap/scenes/scene46.cpp | 378 ++++++ engines/gnap/scenes/scene47.cpp | 171 +++ engines/gnap/scenes/scene48.cpp | 85 ++ engines/gnap/scenes/scene49.cpp | 513 ++++++++ engines/gnap/scenes/scene50.cpp | 479 ++++++++ engines/gnap/scenes/scene51.cpp | 880 ++++++++++++++ engines/gnap/scenes/scene52.cpp | 907 ++++++++++++++ engines/gnap/scenes/scene53.cpp | 383 ++++++ engines/gnap/scenes/scene54.cpp | 127 ++ engines/gnap/scenes/scenecore.cpp | 658 ++++++++++ engines/gnap/sound.cpp | 91 ++ engines/gnap/sound.h | 56 + 66 files changed, 30832 insertions(+) create mode 100644 engines/gnap/datarchive.cpp create mode 100644 engines/gnap/datarchive.h create mode 100644 engines/gnap/detection.cpp create mode 100644 engines/gnap/fontdata.h create mode 100644 engines/gnap/gamesys.cpp create mode 100644 engines/gnap/gamesys.h create mode 100644 engines/gnap/gnap.cpp create mode 100644 engines/gnap/gnap.h create mode 100644 engines/gnap/grid.cpp create mode 100644 engines/gnap/menu.cpp create mode 100644 engines/gnap/module.mk create mode 100644 engines/gnap/resource.cpp create mode 100644 engines/gnap/resource.h create mode 100644 engines/gnap/scenes/scene01.cpp create mode 100644 engines/gnap/scenes/scene02.cpp create mode 100644 engines/gnap/scenes/scene03.cpp create mode 100644 engines/gnap/scenes/scene04.cpp create mode 100644 engines/gnap/scenes/scene05.cpp create mode 100644 engines/gnap/scenes/scene06.cpp create mode 100644 engines/gnap/scenes/scene07.cpp create mode 100644 engines/gnap/scenes/scene08.cpp create mode 100644 engines/gnap/scenes/scene09.cpp create mode 100644 engines/gnap/scenes/scene10.cpp create mode 100644 engines/gnap/scenes/scene11.cpp create mode 100644 engines/gnap/scenes/scene12.cpp create mode 100644 engines/gnap/scenes/scene13.cpp create mode 100644 engines/gnap/scenes/scene14.cpp create mode 100644 engines/gnap/scenes/scene15.cpp create mode 100644 engines/gnap/scenes/scene16.cpp create mode 100644 engines/gnap/scenes/scene17.cpp create mode 100644 engines/gnap/scenes/scene18.cpp create mode 100644 engines/gnap/scenes/scene19.cpp create mode 100644 engines/gnap/scenes/scene20.cpp create mode 100644 engines/gnap/scenes/scene21.cpp create mode 100644 engines/gnap/scenes/scene22.cpp create mode 100644 engines/gnap/scenes/scene23.cpp create mode 100644 engines/gnap/scenes/scene24.cpp create mode 100644 engines/gnap/scenes/scene25.cpp create mode 100644 engines/gnap/scenes/scene26.cpp create mode 100644 engines/gnap/scenes/scene27.cpp create mode 100644 engines/gnap/scenes/scene28.cpp create mode 100644 engines/gnap/scenes/scene29.cpp create mode 100644 engines/gnap/scenes/scene30.cpp create mode 100644 engines/gnap/scenes/scene31.cpp create mode 100644 engines/gnap/scenes/scene32.cpp create mode 100644 engines/gnap/scenes/scene33.cpp create mode 100644 engines/gnap/scenes/scene38.cpp create mode 100644 engines/gnap/scenes/scene39.cpp create mode 100644 engines/gnap/scenes/scene40.cpp create mode 100644 engines/gnap/scenes/scene41.cpp create mode 100644 engines/gnap/scenes/scene42.cpp create mode 100644 engines/gnap/scenes/scene43.cpp create mode 100644 engines/gnap/scenes/scene44.cpp create mode 100644 engines/gnap/scenes/scene45.cpp create mode 100644 engines/gnap/scenes/scene46.cpp create mode 100644 engines/gnap/scenes/scene47.cpp create mode 100644 engines/gnap/scenes/scene48.cpp create mode 100644 engines/gnap/scenes/scene49.cpp create mode 100644 engines/gnap/scenes/scene50.cpp create mode 100644 engines/gnap/scenes/scene51.cpp create mode 100644 engines/gnap/scenes/scene52.cpp create mode 100644 engines/gnap/scenes/scene53.cpp create mode 100644 engines/gnap/scenes/scene54.cpp create mode 100644 engines/gnap/scenes/scenecore.cpp create mode 100644 engines/gnap/sound.cpp create mode 100644 engines/gnap/sound.h diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp new file mode 100644 index 0000000000..d480d31e67 --- /dev/null +++ b/engines/gnap/datarchive.cpp @@ -0,0 +1,121 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/dcl.h" +#include "common/file.h" +#include "common/stream.h" +#include "common/substream.h" +#include "gnap/datarchive.h" + +#include "engines/util.h" + +namespace Gnap { + +// DatArchive + +DatArchive::DatArchive(const char *filename) { + _fd = new Common::File(); + if (!_fd->open(filename)) + error("DatArchive::DatArchive() Could not open %s", filename); + _fd->skip(8); // Skip signature + _fd->skip(2); // Skip unknown + _fd->skip(2); // Skip unknown + _entriesCount = _fd->readUint32LE(); + debug(1, "_entriesCount: %d", _entriesCount); + _fd->skip(4); // Skip unknown + _entries = new DatEntry[_entriesCount]; + for (int i = 0; i < _entriesCount; ++i) { + _entries[i].ofs = _fd->readUint32LE(); + _entries[i].outSize1 = _fd->readUint32LE(); + _entries[i].type = _fd->readUint32LE(); + _entries[i].outSize2 = _fd->readUint32LE(); + } +} + +DatArchive::~DatArchive() { + _fd->close(); + delete _fd; + delete[] _entries; +} + +byte *DatArchive::load(int index) { + _fd->seek(_entries[index].ofs); + debug(1, "_entries[index].outSize2: %d; _entries[index].outSize1: %d", _entries[index].outSize2, _entries[index].outSize1); + byte *buffer = new byte[_entries[index].outSize1]; + if (!Common::decompressDCL(_fd, buffer, 0, _entries[index].outSize1)) + error("DatArchive::load() Error during decompression of entry %d", index); + return buffer; +} + +// DatManager + +DatManager::DatManager() { + for (int i = 0; i < kMaxDatArchives; ++i) + _datArchives[i] = 0; +} + +DatManager::~DatManager() { + for (int i = 0; i < kMaxDatArchives; ++i) + delete _datArchives[i]; +} + +void DatManager::open(int index, const char *filename) { + close(index); + _datArchives[index] = new DatArchive(filename); +} + +void DatManager::close(int index) { + delete _datArchives[index]; + _datArchives[index] = 0; +} + +byte *DatManager::loadResource(int resourceId) { + const int datIndex = ridToDatIndex(resourceId); + const int entryIndex = ridToEntryIndex(resourceId); + return _datArchives[datIndex] ? _datArchives[datIndex]->load(entryIndex) : 0; +} + +uint32 DatManager::getResourceType(int resourceId) { + const int datIndex = ridToDatIndex(resourceId); + const int entryIndex = ridToEntryIndex(resourceId); + return _datArchives[datIndex] ? _datArchives[datIndex]->getEntryType(entryIndex) : 0; +} + +uint32 DatManager::getResourceSize(int resourceId) { + const int datIndex = ridToDatIndex(resourceId); + const int entryIndex = ridToEntryIndex(resourceId); + return _datArchives[datIndex] ? _datArchives[datIndex]->getEntrySize(entryIndex) : 0; +} + +int ridToDatIndex(int resourceId) { + return (resourceId & 0xFFFF0000) >> 16; +} + +int ridToEntryIndex(int resourceId) { + return resourceId & 0xFFFF; +} + +int makeRid(int datIndex, int entryIndex) { + return (datIndex << 16) | entryIndex; +} + +} // End of namespace Gnap diff --git a/engines/gnap/datarchive.h b/engines/gnap/datarchive.h new file mode 100644 index 0000000000..2fd431bf70 --- /dev/null +++ b/engines/gnap/datarchive.h @@ -0,0 +1,80 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_DATARCHIVE_H +#define GNAP_DATARCHIVE_H + +#include "common/array.h" +#include "common/events.h" +#include "common/file.h" +#include "common/memstream.h" +#include "common/random.h" +#include "common/str.h" +#include "common/substream.h" +#include "common/system.h" +#include "engines/engine.h" + +namespace Gnap { + +struct DatEntry { + uint32 ofs; + uint32 outSize1; + uint32 type; + uint32 outSize2; +}; + +class DatArchive { +public: + DatArchive(const char *filename); + ~DatArchive(); + byte *load(int index); + int getCount() const { return _entriesCount; } + uint32 getEntryType(int index) { return _entries[index].type; } + uint32 getEntrySize(int index) { return _entries[index].outSize1; } +protected: + Common::File *_fd; + int _entriesCount; + DatEntry *_entries; +}; + +const int kMaxDatArchives = 2; + +class DatManager { +public: + DatManager(); + ~DatManager(); + void open(int index, const char *filename); + void close(int index); + byte *loadResource(int resourceId); + uint32 getResourceType(int resourceId); + uint32 getResourceSize(int resourceId); +protected: + DatArchive *_datArchives[kMaxDatArchives]; +}; + +int ridToDatIndex(int resourceId); +int ridToEntryIndex(int resourceId); +int makeRid(int datIndex, int entryIndex); + +} // End of namespace Gnap + +#endif // GNAP_DATARCHIVE_H diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp new file mode 100644 index 0000000000..8898d9069a --- /dev/null +++ b/engines/gnap/detection.cpp @@ -0,0 +1,195 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" + +#include "common/config-manager.h" +#include "engines/advancedDetector.h" +#include "common/savefile.h" +#include "common/system.h" +#include "base/plugins.h" +#include "graphics/thumbnail.h" + +static const PlainGameDescriptor gnapGames[] = { + { "gnap", "Gnap" }, + { 0, 0 } +}; + +namespace Gnap { + +static const ADGameDescription gameDescriptions[] = { + { + "gnap", "", + { + {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12515823}, + AD_LISTEND + }, + Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() + }, + + AD_TABLE_END_MARKER +}; + +} // End of namespace Gnap + +class GnapMetaEngine : public AdvancedMetaEngine { +public: + GnapMetaEngine() : AdvancedMetaEngine(Gnap::gameDescriptions, sizeof(ADGameDescription), gnapGames) { + _singleid = "gnap"; + _maxScanDepth = 3; + } + + virtual const char *getName() const { + return "Gnap"; + } + + virtual const char *getOriginalCopyright() const { + return "Gnap (C) 1999"; + } + + virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + virtual int getMaximumSaveSlot() const; + virtual SaveStateList listSaves(const char *target) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; + virtual void removeSaveState(const char *target, int slot) const; +}; + +bool GnapMetaEngine::hasFeature(MetaEngineFeature f) const { + return + false; +#if 0 + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate); +#endif +} + +void GnapMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String fileName = Common::String::format("%s.%03d", target, slot); + g_system->getSavefileManager()->removeSavefile(fileName); +} + +int GnapMetaEngine::getMaximumSaveSlot() const { return 99; } + +SaveStateList GnapMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String pattern = target; + pattern += ".???"; + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + SaveStateList saveList; +#if 0 + int slotNum = 0; + for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + slotNum = atoi(filename->c_str() + filename->size() - 3); + + if (slotNum >= 0 && slotNum <= 99) { + Common::InSaveFile *file = saveFileMan->openForLoading(*filename); + if (file) { + int32 version = file->readSint32BE(); + if (version != GNAP_SAVEGAME_VERSION) { + delete file; + continue; + } + + // read name + uint16 nameSize = file->readUint16BE(); + if (nameSize >= 255) { + delete file; + continue; + } + char name[256]; + file->read(name, nameSize); + name[nameSize] = 0; + + saveList.push_back(SaveStateDescriptor(slotNum, name)); + delete file; + } + } + } +#endif + return saveList; +} + +SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int slot) const { +#if 0 + Common::String fileName = Common::String::format("%s.%03d", target, slot); + Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); + if (file) { + + int32 version = file->readSint32BE(); + if (version != GNAP_SAVEGAME_VERSION) { + delete file; + return SaveStateDescriptor(); + } + + uint32 saveNameLength = file->readUint16BE(); + char saveName[256]; + file->read(saveName, saveNameLength); + saveName[saveNameLength] = 0; + + SaveStateDescriptor desc(slot, saveName); + + Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); + desc.setThumbnail(thumbnail); + + uint32 saveDate = file->readUint32BE(); + uint16 saveTime = file->readUint16BE(); + + int day = (saveDate >> 24) & 0xFF; + int month = (saveDate >> 16) & 0xFF; + int year = saveDate & 0xFFFF; + + desc.setSaveDate(year, month, day); + + int hour = (saveTime >> 8) & 0xFF; + int minutes = saveTime & 0xFF; + + desc.setSaveTime(hour, minutes); + + delete file; + return desc; + } +#endif + return SaveStateDescriptor(); +} + +bool GnapMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + if (desc) { + *engine = new Gnap::GnapEngine(syst, desc); + } + return desc != 0; +} + +#if PLUGIN_ENABLED_DYNAMIC(GNAP) + REGISTER_PLUGIN_DYNAMIC(GNAP, PLUGIN_TYPE_ENGINE, GnapMetaEngine); +#else + REGISTER_PLUGIN_STATIC(GNAP, PLUGIN_TYPE_ENGINE, GnapMetaEngine); +#endif diff --git a/engines/gnap/fontdata.h b/engines/gnap/fontdata.h new file mode 100644 index 0000000000..9ad0d23ae8 --- /dev/null +++ b/engines/gnap/fontdata.h @@ -0,0 +1,851 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_FONTDATA_H +#define GNAP_FONTDATA_H + +namespace Gnap { + +struct FONT_CHAR_INFO { + const byte width; // width, in bits (or pixels), of the character + const uint16 offset; // offset of the character's bitmap, in bytes, into the the FONT_INFO's data array +}; + +/* +** Font data for DejaVu Sans 9pt +*/ + +/* Character bitmaps for DejaVu Sans 9pt */ +const byte dejaVuSans9ptCharBitmaps[] = +{ + /* @0 ' ' (5 pixels wide) */ + 0x00, 0x00, /* */ + 0x00, 0x00, /* */ + 0x00, 0x00, /* */ + 0x00, 0x00, /* */ + 0x00, 0x00, /* */ + + /* @10 '!' (1 pixels wide) */ + 0x1B, 0xF0, /* ## ###### */ + + /* @12 '"' (3 pixels wide) */ + 0x00, 0x70, /* ### */ + 0x00, 0x00, /* */ + 0x00, 0x70, /* ### */ + + /* @18 '#' (8 pixels wide) */ + 0x04, 0x00, /* # */ + 0x14, 0x80, /* # # # */ + 0x0F, 0x80, /* ##### */ + 0x04, 0xE0, /* # ### */ + 0x1C, 0x80, /* ### # */ + 0x07, 0xC0, /* ##### */ + 0x04, 0xA0, /* # # # */ + 0x00, 0x80, /* # */ + + /* @34 '$' (5 pixels wide) */ + 0x09, 0xC0, /* # ### */ + 0x11, 0x20, /* # # # */ + 0x7F, 0xF0, /* ########### */ + 0x12, 0x20, /* # # # */ + 0x0E, 0x40, /* ### # */ + + /* @44 '%' (10 pixels wide) */ + 0x00, 0xE0, /* ### */ + 0x01, 0x10, /* # # */ + 0x11, 0x10, /* # # # */ + 0x0C, 0xE0, /* ## ### */ + 0x03, 0x00, /* ## */ + 0x01, 0x80, /* ## */ + 0x0E, 0x60, /* ### ## */ + 0x11, 0x10, /* # # # */ + 0x11, 0x00, /* # # */ + 0x0E, 0x00, /* ### */ + + /* @64 '&' (8 pixels wide) */ + 0x0E, 0x00, /* ### */ + 0x19, 0xE0, /* ## #### */ + 0x10, 0x90, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x12, 0x20, /* # # # */ + 0x0C, 0x00, /* ## */ + 0x14, 0x00, /* # # */ + 0x13, 0x00, /* # ## */ + + /* @80 ''' (1 pixels wide) */ + 0x00, 0x70, /* ### */ + + /* @82 '(' (3 pixels wide) */ + 0x07, 0xC0, /* ##### */ + 0x38, 0x38, /* ### ### */ + 0x20, 0x08, /* # # */ + + /* @88 ')' (3 pixels wide) */ + 0x20, 0x08, /* # # */ + 0x38, 0x38, /* ### ### */ + 0x07, 0xC0, /* ##### */ + + /* @94 '*' (5 pixels wide) */ + 0x01, 0x20, /* # # */ + 0x00, 0xC0, /* ## */ + 0x03, 0xF0, /* ###### */ + 0x00, 0xC0, /* ## */ + 0x01, 0x20, /* # # */ + + /* @104 '+' (7 pixels wide) */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x1F, 0xC0, /* ####### */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + + /* @118 ',' (1 pixels wide) */ + 0x38, 0x00, /* ### */ + + /* @120 '-' (3 pixels wide) */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + + /* @126 '.' (1 pixels wide) */ + 0x18, 0x00, /* ## */ + + /* @128 '/' (4 pixels wide) */ + 0x30, 0x00, /* ## */ + 0x0E, 0x00, /* ### */ + 0x01, 0xC0, /* ### */ + 0x00, 0x30, /* ## */ + + /* @136 '0' (6 pixels wide) */ + 0x07, 0xC0, /* ##### */ + 0x18, 0x30, /* ## ## */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x18, 0x30, /* ## ## */ + 0x07, 0xC0, /* ##### */ + + /* @148 '1' (5 pixels wide) */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x1F, 0xF0, /* ######### */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + + /* @158 '2' (6 pixels wide) */ + 0x10, 0x20, /* # # */ + 0x18, 0x10, /* ## # */ + 0x14, 0x10, /* # # # */ + 0x12, 0x10, /* # # # */ + 0x11, 0x30, /* # # ## */ + 0x10, 0xE0, /* # ### */ + + /* @170 '3' (6 pixels wide) */ + 0x08, 0x20, /* # # */ + 0x10, 0x10, /* # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x0E, 0xE0, /* ### ### */ + + /* @182 '4' (6 pixels wide) */ + 0x06, 0x00, /* ## */ + 0x05, 0x80, /* # ## */ + 0x04, 0x40, /* # # */ + 0x04, 0x30, /* # ## */ + 0x1F, 0xF0, /* ######### */ + 0x04, 0x00, /* # */ + + /* @194 '5' (6 pixels wide) */ + 0x08, 0xF0, /* # #### */ + 0x10, 0x90, /* # # # */ + 0x10, 0x90, /* # # # */ + 0x10, 0x90, /* # # # */ + 0x19, 0x90, /* ## ## # */ + 0x0F, 0x00, /* #### */ + + /* @206 '6' (6 pixels wide) */ + 0x07, 0xC0, /* ##### */ + 0x19, 0x20, /* ## # # */ + 0x10, 0x90, /* # # # */ + 0x10, 0x90, /* # # # */ + 0x19, 0x90, /* ## ## # */ + 0x0F, 0x20, /* #### # */ + + /* @218 '7' (6 pixels wide) */ + 0x00, 0x10, /* # */ + 0x10, 0x10, /* # # */ + 0x0C, 0x10, /* ## # */ + 0x03, 0x10, /* ## # */ + 0x00, 0xD0, /* ## # */ + 0x00, 0x30, /* ## */ + + /* @230 '8' (6 pixels wide) */ + 0x0E, 0xE0, /* ### ### */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x0E, 0xE0, /* ### ### */ + + /* @242 '9' (6 pixels wide) */ + 0x09, 0xE0, /* # #### */ + 0x13, 0x30, /* # ## ## */ + 0x12, 0x10, /* # # # */ + 0x12, 0x10, /* # # # */ + 0x09, 0x30, /* # # ## */ + 0x07, 0xC0, /* ##### */ + + /* @254 ':' (1 pixels wide) */ + 0x19, 0x80, /* ## ## */ + + /* @256 ';' (1 pixels wide) */ + 0x39, 0x80, /* ### ## */ + + /* @258 '<' (8 pixels wide) */ + 0x03, 0x00, /* ## */ + 0x03, 0x00, /* ## */ + 0x03, 0x00, /* ## */ + 0x04, 0x80, /* # # */ + 0x04, 0x80, /* # # */ + 0x04, 0x80, /* # # */ + 0x0C, 0xC0, /* ## ## */ + 0x08, 0x40, /* # # */ + + /* @274 '=' (8 pixels wide) */ + 0x05, 0x00, /* # # */ + 0x05, 0x00, /* # # */ + 0x05, 0x00, /* # # */ + 0x05, 0x00, /* # # */ + 0x05, 0x00, /* # # */ + 0x05, 0x00, /* # # */ + 0x05, 0x00, /* # # */ + 0x05, 0x00, /* # # */ + + /* @290 '>' (8 pixels wide) */ + 0x08, 0x40, /* # # */ + 0x0C, 0xC0, /* ## ## */ + 0x04, 0x80, /* # # */ + 0x04, 0x80, /* # # */ + 0x04, 0x80, /* # # */ + 0x03, 0x00, /* ## */ + 0x03, 0x00, /* ## */ + 0x03, 0x00, /* ## */ + + /* @306 '?' (5 pixels wide) */ + 0x00, 0x20, /* # */ + 0x00, 0x10, /* # */ + 0x1B, 0x10, /* ## ## # */ + 0x00, 0x90, /* # # */ + 0x00, 0x60, /* ## */ + + /* @316 '@' (11 pixels wide) */ + 0x0F, 0x80, /* ##### */ + 0x10, 0x40, /* # # */ + 0x20, 0x20, /* # # */ + 0x47, 0x10, /* # ### # */ + 0x48, 0x90, /* # # # # */ + 0x48, 0x90, /* # # # # */ + 0x48, 0x90, /* # # # # */ + 0x4F, 0x90, /* # ##### # */ + 0x28, 0x20, /* # # # */ + 0x04, 0x60, /* # ## */ + 0x03, 0x80, /* ### */ + + /* @338 'A' (8 pixels wide) */ + 0x10, 0x00, /* # */ + 0x0E, 0x00, /* ### */ + 0x05, 0xC0, /* # ### */ + 0x04, 0x30, /* # ## */ + 0x04, 0x30, /* # ## */ + 0x05, 0xC0, /* # ### */ + 0x0E, 0x00, /* ### */ + 0x10, 0x00, /* # */ + + /* @354 'B' (6 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x0E, 0xE0, /* ### ### */ + + /* @366 'C' (6 pixels wide) */ + 0x07, 0xC0, /* ##### */ + 0x08, 0x20, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x08, 0x20, /* # # */ + + /* @378 'D' (7 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x08, 0x20, /* # # */ + 0x07, 0xC0, /* ##### */ + + /* @392 'E' (6 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + + /* @404 'F' (5 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + + /* @414 'G' (7 pixels wide) */ + 0x07, 0xC0, /* ##### */ + 0x08, 0x20, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x0F, 0x20, /* #### # */ + + /* @428 'H' (7 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x01, 0x00, /* # */ + 0x01, 0x00, /* # */ + 0x01, 0x00, /* # */ + 0x01, 0x00, /* # */ + 0x01, 0x00, /* # */ + 0x1F, 0xF0, /* ######### */ + + /* @442 'I' (1 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + + /* @444 'J' (3 pixels wide) */ + 0x40, 0x00, /* # */ + 0x40, 0x00, /* # */ + 0x3F, 0xF0, /* ########## */ + + /* @450 'K' (6 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x01, 0x00, /* # */ + 0x02, 0x80, /* # # */ + 0x04, 0x40, /* # # */ + 0x08, 0x20, /* # # */ + 0x10, 0x10, /* # # */ + + /* @462 'L' (5 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + + /* @472 'M' (8 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x00, 0x60, /* ## */ + 0x01, 0x80, /* ## */ + 0x06, 0x00, /* ## */ + 0x06, 0x00, /* ## */ + 0x01, 0x80, /* ## */ + 0x00, 0x60, /* ## */ + 0x1F, 0xF0, /* ######### */ + + /* @488 'N' (7 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x00, 0x30, /* ## */ + 0x00, 0xC0, /* ## */ + 0x01, 0x00, /* # */ + 0x06, 0x00, /* ## */ + 0x18, 0x00, /* ## */ + 0x1F, 0xF0, /* ######### */ + + /* @502 'O' (7 pixels wide) */ + 0x07, 0xC0, /* ##### */ + 0x08, 0x20, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x08, 0x20, /* # # */ + 0x07, 0xC0, /* ##### */ + + /* @516 'P' (6 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + 0x00, 0xE0, /* ### */ + + /* @528 'Q' (7 pixels wide) */ + 0x07, 0xC0, /* ##### */ + 0x08, 0x20, /* # # */ + 0x10, 0x10, /* # # */ + 0x10, 0x10, /* # # */ + 0x30, 0x10, /* ## # */ + 0x48, 0x20, /* # # # */ + 0x07, 0xC0, /* ##### */ + + /* @542 'R' (7 pixels wide) */ + 0x1F, 0xF0, /* ######### */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + 0x01, 0x10, /* # # */ + 0x03, 0x10, /* ## # */ + 0x0C, 0xE0, /* ## ### */ + 0x10, 0x00, /* # */ + + /* @556 'S' (6 pixels wide) */ + 0x08, 0xE0, /* # ### */ + 0x11, 0x90, /* # ## # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x0E, 0x20, /* ### # */ + + /* @568 'T' (7 pixels wide) */ + 0x00, 0x10, /* # */ + 0x00, 0x10, /* # */ + 0x00, 0x10, /* # */ + 0x1F, 0xF0, /* ######### */ + 0x00, 0x10, /* # */ + 0x00, 0x10, /* # */ + 0x00, 0x10, /* # */ + + /* @582 'U' (7 pixels wide) */ + 0x0F, 0xF0, /* ######## */ + 0x18, 0x00, /* ## */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + 0x18, 0x00, /* ## */ + 0x0F, 0xF0, /* ######## */ + + /* @596 'V' (8 pixels wide) */ + 0x00, 0x30, /* ## */ + 0x01, 0xC0, /* ### */ + 0x06, 0x00, /* ## */ + 0x18, 0x00, /* ## */ + 0x18, 0x00, /* ## */ + 0x06, 0x00, /* ## */ + 0x01, 0xC0, /* ### */ + 0x00, 0x30, /* ## */ + + /* @612 'W' (11 pixels wide) */ + 0x00, 0x10, /* # */ + 0x00, 0xE0, /* ### */ + 0x07, 0x00, /* ### */ + 0x18, 0x00, /* ## */ + 0x07, 0x80, /* #### */ + 0x00, 0x70, /* ### */ + 0x07, 0x80, /* #### */ + 0x18, 0x00, /* ## */ + 0x07, 0x00, /* ### */ + 0x00, 0xE0, /* ### */ + 0x00, 0x10, /* # */ + + /* @634 'X' (7 pixels wide) */ + 0x10, 0x10, /* # # */ + 0x08, 0x30, /* # ## */ + 0x06, 0xC0, /* ## ## */ + 0x01, 0x00, /* # */ + 0x06, 0xC0, /* ## ## */ + 0x08, 0x30, /* # ## */ + 0x10, 0x10, /* # # */ + + /* @648 'Y' (7 pixels wide) */ + 0x00, 0x10, /* # */ + 0x00, 0x60, /* ## */ + 0x01, 0x80, /* ## */ + 0x1E, 0x00, /* #### */ + 0x01, 0x80, /* ## */ + 0x00, 0x60, /* ## */ + 0x00, 0x10, /* # */ + + /* @662 'Z' (7 pixels wide) */ + 0x18, 0x10, /* ## # */ + 0x14, 0x10, /* # # # */ + 0x12, 0x10, /* # # # */ + 0x11, 0x10, /* # # # */ + 0x10, 0x90, /* # # # */ + 0x10, 0x50, /* # # # */ + 0x10, 0x30, /* # ## */ + + /* @676 '[' (2 pixels wide) */ + 0x7F, 0xF0, /* ########### */ + 0x40, 0x10, /* # # */ + + /* @680 '\' (4 pixels wide) */ + 0x00, 0x30, /* ## */ + 0x01, 0xC0, /* ### */ + 0x0E, 0x00, /* ### */ + 0x30, 0x00, /* ## */ + + /* @688 ']' (2 pixels wide) */ + 0x40, 0x10, /* # # */ + 0x7F, 0xF0, /* ########### */ + + /* @692 '^' (6 pixels wide) */ + 0x00, 0x40, /* # */ + 0x00, 0x20, /* # */ + 0x00, 0x10, /* # */ + 0x00, 0x10, /* # */ + 0x00, 0x20, /* # */ + 0x00, 0x40, /* # */ + + /* @704 '_' (6 pixels wide) */ + 0x80, 0x00, /* # */ + 0x80, 0x00, /* # */ + 0x80, 0x00, /* # */ + 0x80, 0x00, /* # */ + 0x80, 0x00, /* # */ + 0x80, 0x00, /* # */ + + /* @716 '`' (2 pixels wide) */ + 0x00, 0x08, /* # */ + 0x00, 0x10, /* # */ + + /* @720 'a' (6 pixels wide) */ + 0x0C, 0x80, /* ## # */ + 0x12, 0x40, /* # # # */ + 0x12, 0x40, /* # # # */ + 0x12, 0x40, /* # # # */ + 0x0A, 0x40, /* # # # */ + 0x1F, 0x80, /* ###### */ + + /* @732 'b' (6 pixels wide) */ + 0x1F, 0xF8, /* ########## */ + 0x18, 0xC0, /* ## ## */ + 0x10, 0x40, /* # # */ + 0x10, 0x40, /* # # */ + 0x18, 0xC0, /* ## ## */ + 0x0F, 0x80, /* ##### */ + + /* @744 'c' (5 pixels wide) */ + 0x0F, 0x80, /* ##### */ + 0x18, 0xC0, /* ## ## */ + 0x10, 0x40, /* # # */ + 0x10, 0x40, /* # # */ + 0x08, 0x80, /* # # */ + + /* @754 'd' (6 pixels wide) */ + 0x0F, 0x80, /* ##### */ + 0x18, 0xC0, /* ## ## */ + 0x10, 0x40, /* # # */ + 0x10, 0x40, /* # # */ + 0x18, 0xC0, /* ## ## */ + 0x1F, 0xF8, /* ########## */ + + /* @766 'e' (6 pixels wide) */ + 0x0F, 0x80, /* ##### */ + 0x0A, 0xC0, /* # # ## */ + 0x12, 0x40, /* # # # */ + 0x12, 0x40, /* # # # */ + 0x12, 0xC0, /* # # ## */ + 0x0B, 0x80, /* # ### */ + + /* @778 'f' (4 pixels wide) */ + 0x00, 0x40, /* # */ + 0x1F, 0xF0, /* ######### */ + 0x00, 0x48, /* # # */ + 0x00, 0x48, /* # # */ + + /* @786 'g' (6 pixels wide) */ + 0x0F, 0x80, /* ##### */ + 0x58, 0xC0, /* # ## ## */ + 0x90, 0x40, /* # # # */ + 0x90, 0x40, /* # # # */ + 0xD8, 0xC0, /* ## ## ## */ + 0x7F, 0xC0, /* ######### */ + + /* @798 'h' (6 pixels wide) */ + 0x1F, 0xF8, /* ########## */ + 0x00, 0x80, /* # */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x1F, 0x80, /* ###### */ + + /* @810 'i' (1 pixels wide) */ + 0x1F, 0xD0, /* ####### # */ + + /* @812 'j' (2 pixels wide) */ + 0x80, 0x00, /* # */ + 0xFF, 0xD0, /* ########## # */ + + /* @816 'k' (5 pixels wide) */ + 0x1F, 0xF8, /* ########## */ + 0x02, 0x00, /* # */ + 0x05, 0x00, /* # # */ + 0x08, 0x80, /* # # */ + 0x10, 0x40, /* # # */ + + /* @826 'l' (1 pixels wide) */ + 0x1F, 0xF8, /* ########## */ + + /* @828 'm' (9 pixels wide) */ + 0x1F, 0xC0, /* ####### */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x1F, 0x80, /* ###### */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x1F, 0x80, /* ###### */ + + /* @846 'n' (6 pixels wide) */ + 0x1F, 0xC0, /* ####### */ + 0x00, 0x80, /* # */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + 0x1F, 0x80, /* ###### */ + + /* @858 'o' (6 pixels wide) */ + 0x0F, 0x80, /* ##### */ + 0x18, 0xC0, /* ## ## */ + 0x10, 0x40, /* # # */ + 0x10, 0x40, /* # # */ + 0x18, 0xC0, /* ## ## */ + 0x0F, 0x80, /* ##### */ + + /* @870 'p' (6 pixels wide) */ + 0xFF, 0xC0, /* ########## */ + 0x18, 0xC0, /* ## ## */ + 0x10, 0x40, /* # # */ + 0x10, 0x40, /* # # */ + 0x18, 0xC0, /* ## ## */ + 0x0F, 0x80, /* ##### */ + + /* @882 'q' (6 pixels wide) */ + 0x0F, 0x80, /* ##### */ + 0x18, 0xC0, /* ## ## */ + 0x10, 0x40, /* # # */ + 0x10, 0x40, /* # # */ + 0x18, 0xC0, /* ## ## */ + 0xFF, 0xC0, /* ########## */ + + /* @894 'r' (4 pixels wide) */ + 0x1F, 0xC0, /* ####### */ + 0x00, 0x80, /* # */ + 0x00, 0x40, /* # */ + 0x00, 0x40, /* # */ + + /* @902 's' (5 pixels wide) */ + 0x09, 0x80, /* # ## */ + 0x12, 0x40, /* # # # */ + 0x12, 0x40, /* # # # */ + 0x12, 0x40, /* # # # */ + 0x0C, 0x80, /* ## # */ + + /* @912 't' (4 pixels wide) */ + 0x00, 0x40, /* # */ + 0x1F, 0xF0, /* ######### */ + 0x10, 0x40, /* # # */ + 0x10, 0x40, /* # # */ + + /* @920 'u' (6 pixels wide) */ + 0x0F, 0xC0, /* ###### */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + 0x10, 0x00, /* # */ + 0x08, 0x00, /* # */ + 0x1F, 0xC0, /* ####### */ + + /* @932 'v' (6 pixels wide) */ + 0x00, 0xC0, /* ## */ + 0x07, 0x00, /* ### */ + 0x18, 0x00, /* ## */ + 0x18, 0x00, /* ## */ + 0x07, 0x00, /* ### */ + 0x00, 0xC0, /* ## */ + + /* @944 'w' (9 pixels wide) */ + 0x00, 0xC0, /* ## */ + 0x07, 0x00, /* ### */ + 0x18, 0x00, /* ## */ + 0x07, 0x00, /* ### */ + 0x00, 0xC0, /* ## */ + 0x07, 0x00, /* ### */ + 0x18, 0x00, /* ## */ + 0x07, 0x00, /* ### */ + 0x00, 0xC0, /* ## */ + + /* @962 'x' (6 pixels wide) */ + 0x10, 0x40, /* # # */ + 0x0D, 0x80, /* ## ## */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x0D, 0x80, /* ## ## */ + 0x10, 0x40, /* # # */ + + /* @974 'y' (6 pixels wide) */ + 0x80, 0xC0, /* # ## */ + 0x83, 0x00, /* # ## */ + 0x4C, 0x00, /* # ## */ + 0x38, 0x00, /* ### */ + 0x07, 0x00, /* ### */ + 0x00, 0xC0, /* ## */ + + /* @986 'z' (5 pixels wide) */ + 0x18, 0x40, /* ## # */ + 0x14, 0x40, /* # # # */ + 0x12, 0x40, /* # # # */ + 0x11, 0x40, /* # # # */ + 0x10, 0xC0, /* # ## */ + + /* @996 '{' (5 pixels wide) */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x7D, 0xF0, /* ##### ##### */ + 0x40, 0x10, /* # # */ + 0x40, 0x10, /* # # */ + + /* @1006 '|' (1 pixels wide) */ + 0xFF, 0xF0, /* ############ */ + + /* @1008 '}' (5 pixels wide) */ + 0x40, 0x10, /* # # */ + 0x40, 0x10, /* # # */ + 0x7D, 0xF0, /* ##### ##### */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + + /* @1018 '~' (8 pixels wide) */ + 0x02, 0x00, /* # */ + 0x01, 0x00, /* # */ + 0x01, 0x00, /* # */ + 0x01, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x02, 0x00, /* # */ + 0x01, 0x00, /* # */ +}; + +/* Character descriptors for DejaVu Sans 9pt */ +/* { [Char width in bits], [Offset into dejaVuSans9ptCharBitmaps in bytes] } */ +const FONT_CHAR_INFO dejaVuSans9ptCharDescriptors[] = +{ + {5, 0}, /* */ + {1, 10}, /* ! */ + {3, 12}, /* " */ + {8, 18}, /* # */ + {5, 34}, /* $ */ + {10, 44}, /* % */ + {8, 64}, /* & */ + {1, 80}, /* ' */ + {3, 82}, /* ( */ + {3, 88}, /* ) */ + {5, 94}, /* * */ + {7, 104}, /* + */ + {1, 118}, /* , */ + {3, 120}, /* - */ + {1, 126}, /* . */ + {4, 128}, /* / */ + {6, 136}, /* 0 */ + {5, 148}, /* 1 */ + {6, 158}, /* 2 */ + {6, 170}, /* 3 */ + {6, 182}, /* 4 */ + {6, 194}, /* 5 */ + {6, 206}, /* 6 */ + {6, 218}, /* 7 */ + {6, 230}, /* 8 */ + {6, 242}, /* 9 */ + {1, 254}, /* : */ + {1, 256}, /* ; */ + {8, 258}, /* < */ + {8, 274}, /* = */ + {8, 290}, /* > */ + {5, 306}, /* ? */ + {11, 316}, /* @ */ + {8, 338}, /* A */ + {6, 354}, /* B */ + {6, 366}, /* C */ + {7, 378}, /* D */ + {6, 392}, /* E */ + {5, 404}, /* F */ + {7, 414}, /* G */ + {7, 428}, /* H */ + {1, 442}, /* I */ + {3, 444}, /* J */ + {6, 450}, /* K */ + {5, 462}, /* L */ + {8, 472}, /* M */ + {7, 488}, /* N */ + {7, 502}, /* O */ + {6, 516}, /* P */ + {7, 528}, /* Q */ + {7, 542}, /* R */ + {6, 556}, /* S */ + {7, 568}, /* T */ + {7, 582}, /* U */ + {8, 596}, /* V */ + {11, 612}, /* W */ + {7, 634}, /* X */ + {7, 648}, /* Y */ + {7, 662}, /* Z */ + {2, 676}, /* [ */ + {4, 680}, /* \ */ + {2, 688}, /* ] */ + {6, 692}, /* ^ */ + {6, 704}, /* _ */ + {2, 716}, /* ` */ + {6, 720}, /* a */ + {6, 732}, /* b */ + {5, 744}, /* c */ + {6, 754}, /* d */ + {6, 766}, /* e */ + {4, 778}, /* f */ + {6, 786}, /* g */ + {6, 798}, /* h */ + {1, 810}, /* i */ + {2, 812}, /* j */ + {5, 816}, /* k */ + {1, 826}, /* l */ + {9, 828}, /* m */ + {6, 846}, /* n */ + {6, 858}, /* o */ + {6, 870}, /* p */ + {6, 882}, /* q */ + {4, 894}, /* r */ + {5, 902}, /* s */ + {4, 912}, /* t */ + {6, 920}, /* u */ + {6, 932}, /* v */ + {9, 944}, /* w */ + {6, 962}, /* x */ + {6, 974}, /* y */ + {5, 986}, /* z */ + {5, 996}, /* { */ + {1, 1006}, /* | */ + {5, 1008}, /* } */ + {8, 1018}, /* ~ */ +}; + +} // End of namespace Gnap + +#endif // GNAP_RESOURCE_H diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp new file mode 100644 index 0000000000..d6f8db8c7a --- /dev/null +++ b/engines/gnap/gamesys.cpp @@ -0,0 +1,1303 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gamesys.h" +#include "gnap/fontdata.h" +#include "graphics/fontman.h" +#include "graphics/font.h" +#include "graphics/decoders/bmp.h" + +namespace Gnap { + +void GfxItem::testUpdRect(const Common::Rect &updRect) { + Common::Rect intersectingRect; + if (!updFlag && prevFrame.spriteId != -1 && + updRectsCount < 20 && intersectRect(intersectingRect, prevFrame.rect, updRect)) + updRects[updRectsCount++] = intersectingRect; +} + +// GameSys + +GameSys::GameSys(GnapEngine *vm) + : _vm(vm) { + + _newSpriteDrawItemsCount = 0; + _removeSequenceItemsCount = 0; + _removeSpriteDrawItemsCount = 0; + _grabSpriteId = -1; + _grabSpriteChanged = false; + _reqRemoveSequenceItem = false; + _removeSequenceItemSequenceId = -1; + _removeSequenceItemValue = 0; + _gfxItemsCount = 0; + _animationsCount = 0; + _backgroundImageValue3 = 0; + _backgroundImageValue1 = 0; + _backgroundImageValue4 = 0; + _backgroundImageValue2 = 0; + _backgroundImageError = true; + _gameSysClock = 0; + _lastUpdateClock = 0; + _backgroundSurface = 0; + _frontSurface = 0; + for (int i = 0; i < kMaxAnimations; ++i) { + _animations[i].sequenceId = -1; + _animations[i].id = 0; + _animations[i].status = 0; + } + _screenRect = Common::Rect(0, 0, 800, 600); +} + +GameSys::~GameSys() { +} + +void GameSys::insertSequence(int sequenceId, int a2, int sequenceId2, int a4, int flags, int totalDuration, int16 x, int16 y) { + debug(0, "GameSys::insertSequence() [%08X, %d] -> [%08X, %d] (%d, %d)", sequenceId, a2, sequenceId2, a4, x, y); + Sequence sequence; + SequenceResource *sequenceResource = _vm->_sequenceCache->get(sequenceId); + sequenceResource->_sequenceId = sequenceId; + sequence.sequenceId = sequenceId; + sequence.id = a2 != -1 ? a2 : sequenceResource->_field_8; + sequence.sequenceId2 = sequenceId2 != (int32)0x80000000 ? sequenceId2 : sequenceResource->_sequenceId2; + sequence.id2 = a4 != -1 ? a4 : sequenceResource->_field_10; + sequence.flags = flags != -1 ? flags : sequenceResource->_flags; + sequence.totalDuration = totalDuration != -1 ? totalDuration : sequenceResource->_totalDuration; + sequence.x = (x < 10000 && x > -10000) ? x : sequenceResource->_xOffs; + sequence.y = (y < 10000 && y > -10000) ? y : sequenceResource->_yOffs; + _fatSequenceItems.push_back(sequence); +} + +void GameSys::insertDirtyRect(const Common::Rect &rect) { + _dirtyRects.push_back(rect); +} + +void GameSys::removeSequence(int sequenceId, int a2, int a3) { + //WaitForSingleObject(removeSequence2Mutex, INFINITE); + if (_removeSequenceItemsCount < kMaxSequenceItems) { + _removeSequenceItems[_removeSequenceItemsCount].sequenceId = sequenceId; + _removeSequenceItems[_removeSequenceItemsCount].id = a2; + _removeSequenceItems[_removeSequenceItemsCount].a3 = a3; + ++_removeSequenceItemsCount; + //ResetEvent(removeSequenceItemsEvent); + //ReleaseMutex(removeSequence2Mutex); + //WaitForSingleObject(removeSequenceItemsEvent, INFINITE); + } +} + +void GameSys::invalidateGrabCursorSprite(int id, Common::Rect &rect, Graphics::Surface *surface1, Graphics::Surface *surface2) { + //WaitForSingleObject(grabSpriteMutex, INFINITE); + _grabSpriteId = id; + _grabSpriteRect = rect; + _grabSpriteSurface2 = surface2; + _grabSpriteSurface1 = surface1; + //ResetEvent(grabSpriteEvent); + _grabSpriteChanged = true; + //ReleaseMutex(grabSpriteMutex); + //WaitForSingleObject(grabSpriteEvent, INFINITE); +} + +void GameSys::requestClear2(int a1) { + _fatSequenceItems.clear(); + _seqItems.clear(); + for (int i = 0; i < _gfxItemsCount; ++i) { + GfxItem *gfxItem = &_gfxItems[i]; + gfxItem->sequenceId = -1; + gfxItem->animation = 0; + gfxItem->soundValue = 0; + if (a1) { + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.spriteId = -1; + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + gfxItem->updFlag = true; + } else { + gfxItem->updFlag = false; + } + } + _lastUpdateClock = 0; + _gameSysClock = 0; +} + +void GameSys::requestClear1() { + _gfxItemsCount = 0; + _fatSequenceItems.clear(); + _seqItems.clear(); + _lastUpdateClock = 0; + _gameSysClock = 0; +} + +void GameSys::requestRemoveSequence(int sequenceId, int a2) { + //WaitForSingleObject(removeSequence2Mutex, INFINITE); + _reqRemoveSequenceItem = true; + _removeSequenceItemSequenceId = sequenceId; + _removeSequenceItemValue = a2; + + handleReqRemoveSequenceItem();//CHECKME? + + //ResetEvent(reqClearEvent); + //ReleaseMutex(removeSequence2Mutex); + //WaitForSingleObject(reqClearEvent, INFINITE); +} + +void GameSys::waitForUpdate() { + //ResetEvent(updateEvent); + //WaitForSingleObject(updateEvent, INFINITE); +} + +int GameSys::isSequenceActive(int sequenceId, int a2) { + for (uint i = 0; i < _seqItems.size(); ++i) + if (_seqItems[i].sequenceId == sequenceId && _seqItems[i].id == a2) + return true; + return false; +} + +void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, int a6, int a7) { + + debug(1, "GameSys::setBackgroundSurface() Setting background image"); + + _backgroundSurface = surface; + if (!_backgroundSurface) { + _backgroundImageError = true; + return; + } + + if (!_frontSurface || _frontSurface->w != surface->w || _frontSurface->h != surface->h) { + debug(1, "GameSys::setBackgroundSurface() Creating background working surface"); + if (_frontSurface) + _frontSurface->free(); + delete _frontSurface; + _frontSurface = new Graphics::Surface(); + _frontSurface->create(surface->w, surface->h, surface->format); + } + + memcpy(_frontSurface->getPixels(), surface->getPixels(), surface->pitch * surface->h); + + _vm->_system->copyRectToScreen(_frontSurface->getPixels(), _frontSurface->pitch, 0, 0, _frontSurface->w, _frontSurface->h); + + _backgroundImageError = false; + _backgroundImageValue1 = a4; + _backgroundImageValue3 = a6; + _backgroundImageValue2 = a5; + _backgroundImageValue4 = a7; + _lastUpdateClock = 0; + _gameSysClock = 0; + +} + +void GameSys::setScaleValues(int a1, int a2, int a3, int a4) { + _backgroundImageValue1 = a1; + _backgroundImageValue3 = a3; + _backgroundImageValue2 = a2; + _backgroundImageValue4 = a4; +} + +void GameSys::insertSpriteDrawItem(Graphics::Surface *surface, int x, int y, int id) { + if (surface && _newSpriteDrawItemsCount < kMaxSpriteDrawItems) { + _newSpriteDrawItems[_newSpriteDrawItemsCount].id = id; + _newSpriteDrawItems[_newSpriteDrawItemsCount].rect = Common::Rect(x, y, x + surface->w, y + surface->h); + _newSpriteDrawItems[_newSpriteDrawItemsCount].surface = surface; + ++_newSpriteDrawItemsCount; + } +} + +void GameSys::removeSpriteDrawItem(Graphics::Surface *surface, int a2) { + if (surface && _removeSpriteDrawItemsCount < kMaxSpriteDrawItems) { + _removeSpriteDrawItems[_removeSpriteDrawItemsCount].id = a2; + _removeSpriteDrawItems[_removeSpriteDrawItemsCount].surface = surface; + ++_removeSpriteDrawItemsCount; + } +} + +void GameSys::drawSpriteToBackground(int x, int y, int resourceId) { + + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + uint32 *sourcePalette = spriteResource->_palette; + byte *sourcePixels = spriteResource->_pixels; + int spriteWidth = spriteResource->_width; + int spriteHeight = spriteResource->_height; + Common::Rect dstRect(0, 0, spriteWidth, spriteHeight); + blitSprite32(_backgroundSurface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, true);//spriteResource->_transparent != 0); + _vm->_spriteCache->release(resourceId); + + // Add dirty rect so the modified background is redrawn + insertDirtyRect(Common::Rect(x, y, x + spriteWidth, y + spriteHeight)); +} + +Graphics::Surface *GameSys::allocSurface(int width, int height) { + Graphics::Surface *surface = new Graphics::Surface(); + surface->create(width, height, _backgroundSurface->format); + surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), 0xFFFF00FF); + return surface; +} + +Graphics::Surface *GameSys::createSurface(int resourceId) { + debug(0, "GameSys::createSurface() resourceId: %08X", resourceId); + + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + Graphics::Surface *surface = allocSurface(spriteResource->_width, spriteResource->_height); + _vm->_spriteCache->release(resourceId); + + drawSpriteToSurface(surface, 0, 0, resourceId); + + return surface; +} + +void GameSys::drawSpriteToSurface(Graphics::Surface *surface, int x, int y, int resourceId) { + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + uint32 *sourcePalette = spriteResource->_palette; + byte *sourcePixels = spriteResource->_pixels; + Common::Rect dstRect(0, 0, spriteResource->_width, spriteResource->_height); + blitSprite32(surface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, true);//spriteResource->_transparent != 0); + _vm->_spriteCache->release(resourceId); +} + +void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r, byte g, byte b, const char *text) { + + // NOTE Not that nice but will have to do for now + + bool doDirty = false; + + if (!surface) { + surface = _backgroundSurface; + doDirty = true; + } + + uint32 color = surface->format.RGBToColor(r, g, b); + + for (const char *cp = text; *cp != 0; ++cp) { + byte c = *cp; + if (c < 32 || c > 127) + c = (byte)'_'; + c -= 32; + int w = dejaVuSans9ptCharDescriptors[c].width; + const byte *data = dejaVuSans9ptCharBitmaps + dejaVuSans9ptCharDescriptors[c].offset; + for (int xc = 0; xc < w; ++xc) { + for (int yc = 15; yc >= 0; --yc) { + byte *dst = (byte*)surface->getBasePtr(x + xc, y + yc); + if (data[1 - (yc >> 3)] & (1 << (yc & 7))) + WRITE_LE_UINT32(dst, color); + } + data += 2; + } + x += w + 1; + } + + if (doDirty) { + insertDirtyRect(Common::Rect(x, y, x + getTextWidth(text), y + 16)); + } + +} + +int GameSys::getTextWidth(const char *text) { + int width = 0; + for (const char *cp = text; *cp != 0; ++cp) { + byte c = *cp; + if (c < 32 || c > 127) + c = (byte)'_'; + c -= 32; + width += dejaVuSans9ptCharDescriptors[c].width + 1; + } + return width; +} + +void GameSys::fillSurface(Graphics::Surface *surface, int x, int y, int width, int height, byte r, byte g, byte b) { + Common::Rect rect(x, y, x + width, y + height); + if (!surface) { + _backgroundSurface->fillRect(rect, _backgroundSurface->format.RGBToColor(r, g, b)); + insertDirtyRect(rect); + } else { + surface->fillRect(rect, surface->format.RGBToColor(r, g, b)); + } +} + +void GameSys::setAnimation(int sequenceId, int id, int animationIndex) { + if (animationIndex < kMaxAnimations) { + _animations[animationIndex].sequenceId = sequenceId; + _animations[animationIndex].id = id; + _animations[animationIndex].status = 0; + } +} + +int GameSys::getAnimationStatus(int animationIndex) { + int result = -1; + if (animationIndex < kMaxAnimations) + result = _animations[animationIndex].status; + return result; +} + +int GameSys::getSpriteWidthById(int resourceId) { + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + const int width = spriteResource->_width; + _vm->_spriteCache->release(resourceId); + return width; +} + +int GameSys::getSpriteHeightById(int resourceId) { + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + const int height = spriteResource->_height; + _vm->_spriteCache->release(resourceId); + return height; +} + +Graphics::Surface *GameSys::loadBitmap(int resourceId) { + debug("GameSys::loadBitmap() resourceId: %08X", resourceId); + if (_vm->_dat->getResourceType(resourceId) != 1) + return 0; + byte *resourceData = _vm->_dat->loadResource(resourceId); + uint32 resourceSize = _vm->_dat->getResourceSize(resourceId); + Common::MemoryReadStream stream(resourceData, resourceSize, DisposeAfterUse::NO); + Graphics::Surface *bmpSurface; + Graphics::BitmapDecoder bmp; + if (!bmp.loadStream(stream)) + error("GameSys::loadBitmap() Could not load bitmap resource %08X", resourceId); + bmpSurface = bmp.getSurface()->convertTo(_vm->_system->getScreenFormat()); + delete[] resourceData; + return bmpSurface; +} + +void GameSys::drawBitmap(int resourceId) { + Graphics::Surface *bmpSurface = loadBitmap(resourceId); + if (!bmpSurface || !_backgroundSurface) { + debug("GameSys::drawBitmap() Error loading the bitmap"); + return; + } + if (bmpSurface->format != _backgroundSurface->format || + bmpSurface->w != _backgroundSurface->w || bmpSurface->h != _backgroundSurface->h) { + debug("GameSys::drawBitmap() Different bitmap properties than current background"); + } else { + byte *src = (byte*)bmpSurface->getPixels(); + byte *dst = (byte*)_backgroundSurface->getPixels(); + const int pitch = bmpSurface->pitch; + int height = bmpSurface->h; + while (height--) { + memcpy(dst, src, pitch); + src += pitch; + dst += pitch; + } + } + bmpSurface->free(); + delete bmpSurface; + + insertDirtyRect(Common::Rect(0, 0, 800, 600)); +} + +Sequence *GameSys::seqFind(int sequenceId, int a2, int *outIndex) { + for (uint i = 0; i < _seqItems.size(); ++i) + if (_seqItems[i].sequenceId == sequenceId && _seqItems[i].id == a2) { + if (outIndex) + *outIndex = i; + return &_seqItems[i]; + } + return 0; +} + +int GameSys::seqLocateGfx(int sequenceId, int id, int *outGfxIndex) { + for (int i = 0; i < _gfxItemsCount; ++i) { + GfxItem *gfxItem = &_gfxItems[i]; + if (gfxItem->sequenceId == sequenceId && gfxItem->id == id) { + if (outGfxIndex) + *outGfxIndex = i; + return gfxItem->sequenceId; + } + if (gfxItem->id > id) { + if (outGfxIndex) + *outGfxIndex = i; + return 0; + } + } + if (outGfxIndex) + *outGfxIndex = _gfxItemsCount; + return 0; +} + +void GameSys::seqInsertGfx(int index, int duration) { + + Sequence *seqItem = &_seqItems[index]; + SequenceResource *sequenceResource = _vm->_sequenceCache->get(seqItem->sequenceId); + + if (sequenceResource->_animationsCount > 50 - _gfxItemsCount) + return; + + int gfxIndex; + seqLocateGfx(seqItem->sequenceId, seqItem->id, &gfxIndex); + + if (gfxIndex != _gfxItemsCount) + memcpy(&_gfxItems[gfxIndex + sequenceResource->_animationsCount], &_gfxItems[gfxIndex], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); + _gfxItemsCount += sequenceResource->_animationsCount; + + for (int i = 0; i < sequenceResource->_animationsCount; ++i) { + int totalDuration; + GfxItem *gfxItem = &_gfxItems[i + gfxIndex]; + SequenceAnimation *animation = &sequenceResource->_animations[i]; + + debug(0, "GameSys::seqInsertGfx() seqItem->sequenceId: %08X", seqItem->sequenceId); + + gfxItem->sequenceId = seqItem->sequenceId; + gfxItem->id = seqItem->id; + gfxItem->animation = animation; + gfxItem->currFrameNum = 0; + gfxItem->flags = 0; + gfxItem->delayTicks = seqItem->totalDuration + animation->field_4; + gfxItem->updFlag = false; + gfxItem->updRectsCount = 0; + gfxItem->prevFrame.duration = 0; + gfxItem->prevFrame.spriteId = -1; + gfxItem->prevFrame.soundId = -1; + gfxItem->prevFrame.unkValue = -1; + totalDuration = duration; + if ((seqItem->flags & 4) && totalDuration > 0) { + gfxItem->prevFrame.duration = 1; + if (gfxItem->delayTicks <= totalDuration) + gfxItem->delayTicks = 0; + else + gfxItem->delayTicks -= totalDuration + 1; + gfxItem->updFlag = false; + } else if (gfxItem->delayTicks <= totalDuration) { + int j; + totalDuration -= gfxItem->delayTicks; + gfxItem->delayTicks = 0; + for (j = gfxItem->currFrameNum; j < animation->framesCount && animation->frames[j].duration <= totalDuration; ++j) { + if (animation->frames[j].soundId != -1) + _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | animation->frames[j].soundId); + totalDuration -= animation->frames[j].duration; + } + if (animation->framesCount > j) + gfxItem->currFrame = animation->frames[j++]; + else + gfxItem->currFrame = animation->frames[j - 1]; + if (gfxItem->currFrame.spriteId != -1 && (seqItem->x != 0 || seqItem->y != 0)) + gfxItem->currFrame.rect.translate(seqItem->x, seqItem->y); + // Update sprite scaling + if ((seqItem->flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { + int v2 = _backgroundImageValue2 + (gfxItem->currFrame.rect.bottom - _backgroundImageValue1) * + (_backgroundImageValue4 - _backgroundImageValue2) / + (_backgroundImageValue3 - _backgroundImageValue1); + gfxItem->currFrame.rect.top = gfxItem->currFrame.rect.bottom - v2 * (gfxItem->currFrame.rect.bottom - gfxItem->currFrame.rect.top) / 1000; + gfxItem->currFrame.rect.right = v2 * (gfxItem->currFrame.rect.right - gfxItem->currFrame.rect.left) / 1000 + gfxItem->currFrame.rect.left; + gfxItem->currFrame.isScaled = 1; + } + gfxItem->currFrame.duration -= totalDuration; + if (gfxItem->currFrame.soundId != -1) + _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | gfxItem->currFrame.soundId); + gfxItem->currFrameNum = j; + gfxItem->updFlag = true; + } else { + gfxItem->delayTicks -= totalDuration + 1; + gfxItem->updFlag = false; + } + } + + for (int k = 0; k < kMaxAnimations; ++k) { + if (_animations[k].sequenceId != -1 && _animations[k].sequenceId == seqItem->sequenceId && _animations[k].id == seqItem->id) { + _animations[k].status = 1; + break; + } + } + +} + +void GameSys::seqRemoveGfx(int sequenceId, int id) { + int gfxIndex; + if (seqLocateGfx(sequenceId, id, &gfxIndex)) { + GfxItem *gfxItem = &_gfxItems[gfxIndex]; + while (gfxIndex < _gfxItemsCount && gfxItem->sequenceId == sequenceId && gfxItem->id == id) { + if (gfxItem->prevFrame.spriteId == -1) { + --_gfxItemsCount; + if (gfxIndex != _gfxItemsCount) + memcpy(&_gfxItems[gfxIndex], &_gfxItems[gfxIndex + 1], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); + } else { + gfxItem->sequenceId = -1; + gfxItem->animation = 0; + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.spriteId = -1; + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + gfxItem->updFlag = true; + ++gfxIndex; + gfxItem = &_gfxItems[gfxIndex]; + } + } + } +} + +bool GameSys::updateSequenceDuration(int sequenceId, int id, int *outDuration) { + bool found = false; + int duration = 0x7FFFFFFF; + for (int i = 0; i < _gfxItemsCount; ++i) { + GfxItem *gfxItem = &_gfxItems[i]; + if (gfxItem->sequenceId == sequenceId && gfxItem->id == id) { + found = true; + SequenceAnimation *animation = gfxItem->animation; + if (animation) { + if (gfxItem->currFrameNum < animation->framesCount) + return false; + if (gfxItem->updFlag) { + if (gfxItem->currFrame.duration > 0) + return false; + if (-gfxItem->currFrame.duration < duration) + duration = -gfxItem->currFrame.duration; + } else { + if (gfxItem->prevFrame.duration > 0) + return false; + if (-gfxItem->prevFrame.duration < duration) + duration = -gfxItem->prevFrame.duration; + } + } + } + } + if (found) + *outDuration = duration; + return found; +} + +void GameSys::updateAnimationsStatus(int sequenceId, int a2) { + + Animation *foundAnimation = 0; + for (int animationIndex = 0; animationIndex < kMaxAnimations; ++animationIndex) { + Animation *animation = &_animations[animationIndex]; + if (animation->sequenceId != -1 && animation->sequenceId == sequenceId && animation->id == a2) { + foundAnimation = animation; + break; + } + } + + if (!foundAnimation) + return; + + bool foundSequence = false; + for (int i = 0; i < _gfxItemsCount; ++i) { + GfxItem *gfxItem = &_gfxItems[i]; + SequenceAnimation *animation = gfxItem->animation; + if (gfxItem->sequenceId == sequenceId && gfxItem->id == a2 && animation) { + foundSequence = true; + if (animation->framesCount > gfxItem->currFrameNum || + (gfxItem->updFlag && gfxItem->currFrame.duration > 1) || + gfxItem->prevFrame.duration > 1) + foundSequence = false; + break; + } + } + + if (foundSequence) { + foundAnimation->sequenceId = -1; + foundAnimation->status = 2; + } + +} + +void GameSys::restoreBackgroundRect(const Common::Rect &rect) { + Common::Rect clipRect; + if (!intersectRect(clipRect, rect, _screenRect)) + return; + byte *src = (byte*)_backgroundSurface->getBasePtr(clipRect.left, clipRect.top); + byte *dst = (byte*)_frontSurface->getBasePtr(clipRect.left, clipRect.top); + const int bytes = _backgroundSurface->format.bytesPerPixel * clipRect.width(); + int height = clipRect.height(); + while (height--) { + memcpy(dst, src, bytes); + src += _backgroundSurface->pitch; + dst += _frontSurface->pitch; + } +} + +void GameSys::blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphics::Surface *sourceSurface, + Common::Rect &sourceRect, bool transparent) { + + const int sourcePitch = sourceSurface->pitch; + byte *dst = (byte*)destSurface->getBasePtr(x, y); + byte *src = (byte*)sourceSurface->getBasePtr(sourceRect.left, sourceRect.top); + int width = sourceRect.width(); + int height = sourceRect.height(); + while (height--) { + byte *rsrc = src; + byte *rdst = dst; + for (int xc = 0; xc < width; ++xc) { + uint32 pixel = READ_LE_UINT32(rsrc); + if (!transparent || pixel != 0xFFFF00FF) + WRITE_LE_UINT32(rdst, pixel); + rsrc += 4; + rdst += 4; + } + dst += destSurface->pitch; + src += sourcePitch; + } +} + +void GameSys::blitSprite32(Graphics::Surface *destSurface, int x, int y, byte *sourcePixels, + int sourceWidth, Common::Rect &sourceRect, uint32 *sourcePalette, bool transparent) { + + const int sourcePitch = (sourceWidth + 3) & 0xFFFFFFFC; + byte *dst = (byte*)destSurface->getBasePtr(x, y); + byte *src = sourcePixels + sourceRect.left + sourcePitch * sourceRect.top; + int width = sourceRect.width(); + int height = sourceRect.height(); + while (height--) { + byte *rdst = dst; + for (int xc = 0; xc < width; ++xc) { + byte srcPixel = src[xc]; + if (!transparent || srcPixel) { + uint32 rgb = sourcePalette[srcPixel]; + rdst[0] = rgb & 0x000000FF; + rdst[1] = (rgb & 0x0000FF00) >> 8; + rdst[2] = (rgb & 0x00FF0000) >> 16; + } + rdst += 4; + } + dst += destSurface->pitch; + src += sourcePitch; + } +} + +void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &frameRect, + Common::Rect &destRect, byte *sourcePixels, int sourceWidth, Common::Rect &sourceRect, uint32 *sourcePalette) { + + if (frameRect.height() <= 0 || frameRect.width() <= 0) + return; + + const int ys = ((sourceRect.bottom - sourceRect.top - 1) << 16) / (frameRect.bottom - frameRect.top - 1); + const int xs = ((sourceRect.right - sourceRect.left - 1) << 16) / (frameRect.right - frameRect.left - 1); + const int destPitch = destSurface->pitch; + const int sourcePitch = (sourceWidth + 3) & 0xFFFFFFFC; + + if (!frameRect.equals(destRect)) { + byte *dst = (byte*)destSurface->getBasePtr(destRect.left, destRect.top); + byte *src = sourcePixels + sourcePitch * sourceRect.top + sourceRect.left; + const int height = destRect.bottom - destRect.top; + const int width = destRect.right - destRect.left; + int yi = ys * (destRect.top - frameRect.top); + byte *hsrc = src + sourcePitch * ((yi + 0x8000) >> 16); + for (int i = 0; i < height; ++i) { + byte *wdst = dst; + int xi = xs * (destRect.left - frameRect.left); + byte *wsrc = hsrc + ((xi + 0x8000) >> 16); + for (int j = 0; j < width; ++j) { + byte srcPixel = *wsrc; + if (srcPixel) { + uint32 rgb = sourcePalette[srcPixel]; + wdst[0] = rgb & 0x000000FF; + wdst[1] = (rgb & 0x0000FF00) >> 8; + wdst[2] = (rgb & 0x00FF0000) >> 16; + } + wdst += 4; + xi += xs; + wsrc = hsrc + ((xi + 0x8000) >> 16); + } + dst += destPitch; + yi += ys; + hsrc = src + sourcePitch * ((yi + 0x8000) >> 16); + } + } else { + byte *dst = (byte*)destSurface->getBasePtr(frameRect.left, frameRect.top); + byte *src = sourcePixels + sourcePitch * sourceRect.top + sourceRect.left; + const int height = frameRect.bottom - frameRect.top; + const int width = frameRect.right - frameRect.left; + byte *hsrc = sourcePixels + sourcePitch * sourceRect.top + sourceRect.left; + int yi = 0; + for (int i = 0; i < height; ++i) { + byte *wdst = dst; + byte *wsrc = hsrc; + int xi = 0; + for (int j = 0; j < width; ++j) { + byte srcPixel = *wsrc; + if (srcPixel) { + uint32 rgb = sourcePalette[srcPixel]; + wdst[0] = rgb & 0x000000FF; + wdst[1] = (rgb & 0x0000FF00) >> 8; + wdst[2] = (rgb & 0x00FF0000) >> 16; + } + wdst += 4; + xi += xs; + wsrc = hsrc + ((xi + 0x8000) >> 16); + } + dst += destPitch; + yi += ys; + hsrc = src + sourcePitch * ((yi + 0x8000) >> 16); + } + } + +} + +void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &frame, Common::Rect *subRect) { + debug(1, "GameSys::seqDrawStaticFrame() rect: (%d, %d, %d, %d)", + frame.rect.left, frame.rect.top, frame.rect.right, frame.rect.bottom); + + Common::Rect srcRect = subRect ? *subRect : frame.rect; + Common::Rect clipRect; + + if (!intersectRect(clipRect, srcRect, _screenRect)) { + debug(1, "GameSys::seqDrawStaticFrame() Surface not inside screen"); + return; + } + + const int x = clipRect.left, y = clipRect.top; + + clipRect.translate(-frame.rect.left, -frame.rect.top); + + // TODO Save transparent flag somewhere + blitSurface32(_frontSurface, x, y, surface, clipRect, true); + +} + +void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame &frame, Common::Rect *subRect) { + debug(1, "GameSys::seqDrawSpriteFrame() spriteId: %04X; rect: (%d, %d, %d, %d)", + frame.spriteId, frame.rect.left, frame.rect.top, frame.rect.right, frame.rect.bottom); + + Common::Rect srcRect = subRect ? *subRect : frame.rect; + Common::Rect clipRect; + + if (!intersectRect(clipRect, srcRect, _screenRect)) { + debug(1, "GameSys::seqDrawSpriteFrame() Sprite not inside screen"); + return; + } + + uint32 *sourcePalette = spriteResource->_palette; + byte *sourcePixels = spriteResource->_pixels; + + const int x = clipRect.left, y = clipRect.top; + + debug(1, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame.isScaled); + + // 32bit sprite drawing + if (frame.isScaled) { + Common::Rect sourceRect(0, 0, spriteResource->_width, spriteResource->_height); + blitSpriteScaled32(_frontSurface, frame.rect, clipRect, sourcePixels, spriteResource->_width, sourceRect, sourcePalette); + } else { + clipRect.translate(-frame.rect.left, -frame.rect.top); + blitSprite32(_frontSurface, x, y, sourcePixels, spriteResource->_width, clipRect, sourcePalette, true);//spriteResource->_transparent != 0); + } + +} + +void GameSys::drawSprites() { + + debug(1, "GameSys::drawSprites() _gfxItemsCount: %d", _gfxItemsCount); + + // TODO Split into multiple functions for clarity + + // Restore dirty background and collect rects to be redrawn for all sprites + // which aren't marked to be redrawn yet + Common::Rect intersectingRect; + for (uint i = 0; i < _dirtyRects.size(); ++i) { + restoreBackgroundRect(_dirtyRects[i]); + for (int j = 0; j < _gfxItemsCount; ++j) + _gfxItems[j].testUpdRect(_dirtyRects[i]); + } + + for (int k = 0; k < _gfxItemsCount; ++k) { + GfxItem *gfxItem2 = &_gfxItems[k]; + + if (!gfxItem2->updFlag) + continue; + + if (gfxItem2->prevFrame.spriteId != -1) { + int transparent = 0; + if (gfxItem2->currFrame.spriteId != -1 && !(gfxItem2->flags & 2)) { + if (gfxItem2->flags & 1) { + transparent = 1; + } else { + int resourceId = (gfxItem2->sequenceId & 0xFFFF0000) | gfxItem2->currFrame.spriteId; + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + transparent = spriteResource->_transparent; + _vm->_spriteCache->release(resourceId); + } + } + if ((gfxItem2->flags & 8) || gfxItem2->currFrame.spriteId == -1 || + (!(gfxItem2->flags & 2) && (!gfxItem2->prevFrame.rect.equals(gfxItem2->currFrame.rect) || !transparent))) { + restoreBackgroundRect(gfxItem2->prevFrame.rect); + for (int l = 0; l < _gfxItemsCount; ++l) + _gfxItems[l].testUpdRect(gfxItem2->prevFrame.rect); + } + } + + if (gfxItem2->currFrame.spriteId != -1) { + int transparent = 0; + if (gfxItem2->flags & 1) { + transparent = 1; + } else if (!(gfxItem2->flags & 2)) { + int resourceId = (gfxItem2->sequenceId & 0xFFFF0000) | gfxItem2->currFrame.spriteId; + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + transparent = spriteResource->_transparent; + _vm->_spriteCache->release(resourceId); + } + if (((gfxItem2->flags & 2) && !(gfxItem2->flags & 8)) || + gfxItem2->prevFrame.spriteId == -1 || + !gfxItem2->prevFrame.rect.equals(gfxItem2->currFrame.rect) || transparent) { + for (int l = k; l < _gfxItemsCount; ++l) + _gfxItems[l].testUpdRect(gfxItem2->currFrame.rect); + } + } + + } + + for (int m = 0; m < _gfxItemsCount; ++m) { + GfxItem *gfxItem5 = &_gfxItems[m]; + + debug(0, "DrawGfxItem(%d) updFlag: %d; currFrame.spriteId: %04X; updRectsCount: %d; flags: %04X; sequenceId: %08X", + m, gfxItem5->updFlag, gfxItem5->currFrame.spriteId, gfxItem5->updRectsCount, gfxItem5->flags, gfxItem5->sequenceId); + + if (gfxItem5->updFlag) { + if (gfxItem5->currFrame.spriteId != -1) { + if (gfxItem5->flags & 1) { + seqDrawStaticFrame(gfxItem5->surface, gfxItem5->currFrame, 0); + //debug("seqDrawStaticFrame"); + } else if (gfxItem5->flags & 2) { + // TODO seqDrawAviFrame(gfxItem5->currFrame.spriteId, &gfxItem5->currFrame, 0, gfxItem5->flags & 8); + } else { + int resourceId = (gfxItem5->sequenceId & 0xFFFF0000) | gfxItem5->currFrame.spriteId; + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + seqDrawSpriteFrame(spriteResource, gfxItem5->currFrame, 0); + _vm->_spriteCache->release(resourceId); + } + } + } else if (gfxItem5->updRectsCount > 0) { + if (gfxItem5->flags & 1) { + for (int n = 0; n < gfxItem5->updRectsCount; ++n) + seqDrawStaticFrame(gfxItem5->surface, gfxItem5->prevFrame, &gfxItem5->updRects[n]); + } else if (gfxItem5->flags & 2) { + /* TODO + spriteData4 = gfxItem5->prevFrame.spriteId; + for (int n = 0; n < gfxItem5->updRectsCount; ++n) + seqDrawAviFrame(spriteData4, &gfxItem5->prevFrame, &gfxItem5->updRects[n], gfxItem5->flags & 8); + */ + } else { + int resourceId = (gfxItem5->sequenceId & 0xFFFF0000) | gfxItem5->prevFrame.spriteId; + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); + for (int n = 0; n < gfxItem5->updRectsCount; ++n) + seqDrawSpriteFrame(spriteResource, gfxItem5->prevFrame, &gfxItem5->updRects[n]); + _vm->_spriteCache->release(resourceId); + } + } + } + + debug(1, "GameSys::drawSprites() OK"); + +} + +void GameSys::updateRect(const Common::Rect &r) { + debug(1, "GameSys::updateRect() %d, %d, %d, %d [%d, %d]", r.left, r.top, r.right, r.bottom, r.width(), r.height()); + if (r.width() > 0 && r.height() > 0) { + byte *pixels = (byte*)_frontSurface->getBasePtr(r.left, r.top); + _vm->_system->copyRectToScreen(pixels, _frontSurface->pitch, r.left, r.top, + r.width(), r.height()); + } +} + +void GameSys::updateScreen() { + + debug(1, "GameSys::updateScreen()"); + + for (uint i = 0; i < _dirtyRects.size(); ++i) + updateRect(_dirtyRects[i]); + + if (_dirtyRects.size() > 0) { + _dirtyRects.clear(); + _lastUpdateClock = 0; + _gameSysClock = 0; + } + + Common::Rect dstRect, srcRect, rcSrc2; + + for (int j = 0; j < _gfxItemsCount; ++j) { + + GfxItem *gfxItem = &_gfxItems[j]; + + if (!gfxItem->updFlag) + continue; + + if (gfxItem->prevFrame.spriteId == -1 || + !intersectRect(srcRect, _screenRect, gfxItem->prevFrame.rect)) { + if (gfxItem->currFrame.spriteId != -1 && intersectRect(rcSrc2, _screenRect, gfxItem->currFrame.rect)) + updateRect(rcSrc2); + } else if (gfxItem->currFrame.spriteId != -1 && + intersectRect(rcSrc2, _screenRect, gfxItem->currFrame.rect)) { + updateRect(srcRect); + updateRect(rcSrc2); + } + gfxItem->prevFrame = gfxItem->currFrame; + } + + updateRect(Common::Rect(0, 0, 800, 600)); + + debug(1, "GameSys::updateScreen() OK"); + +} + +void GameSys::handleReqRemoveSequenceItem() { + if (_reqRemoveSequenceItem) { + int gfxIndex2; + _reqRemoveSequenceItem = false; + if (seqFind(_removeSequenceItemSequenceId, _removeSequenceItemValue, &gfxIndex2)) + _seqItems.remove_at(gfxIndex2); + if (seqLocateGfx(_removeSequenceItemSequenceId, _removeSequenceItemValue, &gfxIndex2)) { + int gfxIndex2a = gfxIndex2; + for (GfxItem *gfxItem = &_gfxItems[gfxIndex2a]; + gfxIndex2a < _gfxItemsCount && gfxItem->sequenceId == _removeSequenceItemSequenceId && gfxItem->id == _removeSequenceItemValue; + gfxItem = &_gfxItems[gfxIndex2a]) + ++gfxIndex2a; + _gfxItemsCount -= gfxIndex2a - gfxIndex2; + if (_gfxItemsCount != gfxIndex2) + memcpy(&_gfxItems[gfxIndex2], &_gfxItems[gfxIndex2a], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex2)); + } + } +} + +void GameSys::handleReqRemoveSequenceItems() { + if (_removeSequenceItemsCount > 0) { + for (int i = 0; i < _removeSequenceItemsCount; ++i) { + int gfxIndex; + if (seqFind(_removeSequenceItems[i].sequenceId, _removeSequenceItems[i].id, &gfxIndex)) + _seqItems.remove_at(gfxIndex); + seqLocateGfx(_removeSequenceItems[i].sequenceId, _removeSequenceItems[i].id, &gfxIndex); + for (GfxItem *gfxItem = &_gfxItems[gfxIndex]; + gfxIndex < _gfxItemsCount && gfxItem->sequenceId == _removeSequenceItems[i].sequenceId && gfxItem->id == _removeSequenceItems[i].id; + gfxItem = &_gfxItems[gfxIndex]) { + gfxItem->sequenceId = -1; + gfxItem->animation = 0; + gfxItem->soundValue = 0; + if (_removeSequenceItems[i].a3) { + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.spriteId = -1; + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + gfxItem->updFlag = true; + } else { + gfxItem->updFlag = false; + } + ++gfxIndex; + } + } + _removeSequenceItemsCount = 0; + } +} + +void GameSys::handleReqRemoveSpriteDrawItems() { + if (_removeSpriteDrawItemsCount > 0) { + for (int j = 0; j < _removeSpriteDrawItemsCount; ++j) { + for (int i = 0; i < _gfxItemsCount; ++i) { + GfxItem *gfxItem = &_gfxItems[i]; + if (gfxItem->sequenceId == -1 && !gfxItem->animation && (gfxItem->flags & 1) && + gfxItem->id == _removeSpriteDrawItems[j].id && _removeSpriteDrawItems[j].surface == gfxItem->surface) { + gfxItem->flags = 0; + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.spriteId = -1; + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + gfxItem->updFlag = true; + } + } + } + _removeSpriteDrawItemsCount = 0; + } +} + +void GameSys::fatUpdateFrame() { + + debug(1, "GameSys::fatUpdateFrame()"); + + int32 clockDelta = _gameSysClock - _lastUpdateClock; + _lastUpdateClock = _gameSysClock; + + debug(1, "GameSys::fatUpdateFrame() clockDelta: %d", clockDelta); + + if (clockDelta <= 0) + return; + + bool updFlag = true; + int duration, v20, currFrameNum; + + // NOTE Skipped avi code (reqAviStart) + + for (int i = 0; i < _gfxItemsCount; ++i) { + GfxItem *gfxItem = &_gfxItems[i]; + SequenceAnimation *animation = gfxItem->animation; + if ((gfxItem->sequenceId != -1 && animation) || (gfxItem->flags & 2) || + gfxItem->prevFrame.spriteId != -1 || gfxItem->prevFrame.duration > 0) { + if (gfxItem->sequenceId == -1 || gfxItem->updFlag) { + if ((gfxItem->flags & 2) && !gfxItem->updFlag) { + // NOTE Skipped avi code + } + } else { + Sequence *seqItem = seqFind(gfxItem->sequenceId, gfxItem->id, 0); + if (!animation) { + updFlag = false; + gfxItem->sequenceId = -1; + gfxItem->animation = 0; + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.spriteId = -1; + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + gfxItem->updFlag = true; + } else if (!seqItem) { + updFlag = false; + gfxItem->animation = 0; + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.spriteId = -1; + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + gfxItem->updFlag = true; + } else if ((seqItem->flags & 4) && clockDelta > 1) { + updFlag = false; + if (gfxItem->delayTicks < clockDelta) { + duration = clockDelta - gfxItem->delayTicks; + gfxItem->delayTicks = 0; + if (gfxItem->prevFrame.duration <= duration) + gfxItem->prevFrame.duration = 1; + else + gfxItem->prevFrame.duration -= duration; + } else { + gfxItem->delayTicks -= clockDelta; + } + gfxItem->updFlag = false; + } else if (gfxItem->delayTicks < clockDelta) { + duration = clockDelta - gfxItem->delayTicks; + gfxItem->delayTicks = 0; + if (gfxItem->prevFrame.duration <= duration) { + v20 = 0; + if (gfxItem->prevFrame.duration > 0) { + duration -= gfxItem->prevFrame.duration; + gfxItem->prevFrame.duration = -duration; + } else { + gfxItem->prevFrame.duration = 0; + v20 = 1; + } + currFrameNum = gfxItem->currFrameNum; + if (animation->framesCount > currFrameNum) { + updFlag = false; + while (animation->framesCount > currFrameNum && + animation->frames[currFrameNum].duration <= duration) { + if (animation->frames[currFrameNum].soundId != -1) + _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | animation->frames[currFrameNum].soundId); + duration -= animation->frames[currFrameNum].duration; + ++currFrameNum; + } + if (animation->framesCount > currFrameNum) + gfxItem->currFrame = animation->frames[currFrameNum++]; + else + gfxItem->currFrame = animation->frames[currFrameNum - 1]; + if (gfxItem->currFrame.spriteId != -1 && (seqItem->x != 0 || seqItem->y != 0)) + gfxItem->currFrame.rect.translate(seqItem->x, seqItem->y); + // Update sprite scaling + if ((seqItem->flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { + int v17 = _backgroundImageValue2 + (gfxItem->currFrame.rect.bottom - _backgroundImageValue1) * + (_backgroundImageValue4 - _backgroundImageValue2) / + (_backgroundImageValue3 - _backgroundImageValue1); + gfxItem->currFrame.rect.top = gfxItem->currFrame.rect.bottom - v17 * (gfxItem->currFrame.rect.bottom - gfxItem->currFrame.rect.top) / 1000; + gfxItem->currFrame.rect.right = v17 * (gfxItem->currFrame.rect.right - gfxItem->currFrame.rect.left) / 1000 + gfxItem->currFrame.rect.left; + gfxItem->currFrame.isScaled = 1; + } + gfxItem->currFrame.duration -= duration; + if (gfxItem->currFrame.soundId != -1) + _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | gfxItem->currFrame.soundId); + gfxItem->currFrameNum = currFrameNum; + gfxItem->updFlag = true; + } else if (v20 && gfxItem->prevFrame.spriteId == -1) { + --_gfxItemsCount; + if (_gfxItemsCount != i) + memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); + --i; + } else { + gfxItem->updFlag = false; + } + } else { + updFlag = false; + gfxItem->prevFrame.duration -= duration; + gfxItem->updFlag = false; + } + } else { + updFlag = false; + gfxItem->delayTicks -= clockDelta; + gfxItem->updFlag = false; + } + } + } else { + --_gfxItemsCount; + if (_gfxItemsCount != i) + memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); + --i; + } + } + + if (_newSpriteDrawItemsCount > 0) { + debug(0, "_newSpriteDrawItemsCount: %d", _newSpriteDrawItemsCount); + for (int k = 0; k < _newSpriteDrawItemsCount; ++k) { + if (_gfxItemsCount < 50) { + int insertIndex; + seqLocateGfx(-1, _newSpriteDrawItems[k].id, &insertIndex); + if (_gfxItemsCount != insertIndex) + memcpy(&_gfxItems[insertIndex + 1], &_gfxItems[insertIndex], sizeof(GfxItem) * (_gfxItemsCount - insertIndex)); + ++_gfxItemsCount; + GfxItem *gfxItem = &_gfxItems[insertIndex]; + gfxItem->sequenceId = -1; + gfxItem->id = _newSpriteDrawItems[k].id; + gfxItem->animation = 0; + gfxItem->currFrameNum = 0; + gfxItem->flags = 1; + gfxItem->delayTicks = 0; + gfxItem->updFlag = true; + gfxItem->updRectsCount = 0; + gfxItem->surface = _newSpriteDrawItems[k].surface; + gfxItem->prevFrame.duration = 0; + gfxItem->prevFrame.spriteId = -1; + gfxItem->prevFrame.soundId = -1; + gfxItem->prevFrame.unkValue = -1; + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.isScaled = 0; + gfxItem->currFrame.rect = _newSpriteDrawItems[k].rect; + gfxItem->currFrame.spriteId = _newSpriteDrawItems[k].surface ? 0xCAFEBABE : -1;// TODO + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + } + } + _newSpriteDrawItemsCount = 0; + } + + if (_grabSpriteChanged) { + for (int i = 0; i < _gfxItemsCount; ++i) { + GfxItem *gfxItem = &_gfxItems[i]; + if (gfxItem->sequenceId == -1 && !gfxItem->animation && (gfxItem->flags & 1) && + gfxItem->id == _grabSpriteId && gfxItem->surface == _grabSpriteSurface1) { + gfxItem->currFrame.duration = 0; + gfxItem->currFrame.isScaled = 0; + gfxItem->currFrame.rect = _grabSpriteRect; + gfxItem->currFrame.spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO + gfxItem->currFrame.soundId = -1; + gfxItem->currFrame.unkValue = -1; + gfxItem->updFlag = true; + gfxItem->surface = _grabSpriteSurface2; + break; + } + } + _grabSpriteChanged = false; + } + + // NOTE Skipped avi code (reqAviStart) + + debug(1, "GameSys::fatUpdateFrame() _fatSequenceItems.size(): %d", _fatSequenceItems.size()); + + for (uint i = 0; i < _fatSequenceItems.size(); ++i) { + Sequence *seqItem = &_fatSequenceItems[i]; + if (((seqItem->flags & 8) || (seqItem->flags & 0x20)) && seqItem->sequenceId2 != -1) { + duration = 0; + if (((seqItem->flags & 0x20) && seqLocateGfx(seqItem->sequenceId2, seqItem->id2, 0)) || + updateSequenceDuration(seqItem->sequenceId2, seqItem->id2, &duration)) { + int index; + bool found = false; + if (seqItem->sequenceId2 == seqItem->sequenceId && seqItem->id == seqItem->id2 && + seqFind(seqItem->sequenceId, seqItem->id, &index)) { + _seqItems[index] = *seqItem; + found = true; + } else if (_seqItems.size() < 50) { + index = _seqItems.size(); + _seqItems.push_back(*seqItem); + found = true; + } + if (found) { + updFlag = false; + seqRemoveGfx(seqItem->sequenceId2, seqItem->id2); + seqRemoveGfx(seqItem->sequenceId, seqItem->id); + _fatSequenceItems.remove_at(i); + --i; + seqInsertGfx(index, duration); + } + } + } else { + updFlag = false; + if (seqItem->totalDuration < clockDelta) { + int index; + bool found = false; + duration = clockDelta - seqItem->totalDuration; + seqItem->totalDuration = 0; + if (seqFind(seqItem->sequenceId, seqItem->id, &index)) { + _seqItems[index] = *seqItem; + found = true; + } else if (_seqItems.size() < 50) { + index = _seqItems.size(); + _seqItems.push_back(*seqItem); + found = true; + } + if (found) { + seqRemoveGfx(seqItem->sequenceId, seqItem->id); + _fatSequenceItems.remove_at(i); + --i; + seqInsertGfx(index, duration - 1); + } + } else { + seqItem->totalDuration -= clockDelta; + } + } + } + + debug(1, "GameSys::fatUpdateFrame() _seqItems.size(): %d", _seqItems.size()); + + for (uint i = 0; i < _seqItems.size(); ++i) { + Sequence *seqItem = &_seqItems[i]; + if (seqLocateGfx(seqItem->sequenceId, seqItem->id, 0)) { + updateAnimationsStatus(seqItem->sequenceId, seqItem->id); + if (seqItem->flags & 2) { + int gfxDuration; + updFlag = false; + if (updateSequenceDuration(seqItem->sequenceId, seqItem->id, &gfxDuration)) { + seqRemoveGfx(seqItem->sequenceId, seqItem->id); + seqInsertGfx(i, gfxDuration); + } + } + } else { + _seqItems.remove_at(i); + --i; + } + } + +} + +void GameSys::fatUpdate() { + + debug(1, "GameSys::fatUpdate() _gfxItemsCount: %d", _gfxItemsCount); + + for (int i = 0; i < _gfxItemsCount; ++i) { + _gfxItems[i].updFlag = false; + _gfxItems[i].updRectsCount = 0; + } + + handleReqRemoveSequenceItem(); + handleReqRemoveSequenceItems(); + handleReqRemoveSpriteDrawItems(); + // NOTE Skipped avi stuff (reqAviStop) + + fatUpdateFrame(); + +} + +void GameSys::updatePlaySounds() { + for (uint i = 0; i < _soundIds.size(); ++i) + _vm->playSound(_soundIds[i], false); + _soundIds.clear(); +} + +bool intersectRect(Common::Rect &intersectingRect, const Common::Rect &r1, const Common::Rect &r2) { + if (r1.intersects(r2)) { + intersectingRect = r1.findIntersectingRect(r2); + return true; + } else + return false; +} + +} // End of namespace Gnap diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h new file mode 100644 index 0000000000..5e996bf844 --- /dev/null +++ b/engines/gnap/gamesys.h @@ -0,0 +1,216 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GAMESYS_H +#define GNAP_GAMESYS_H + +#include "gnap/gnap.h" +#include "gnap/resource.h" +#include "common/array.h" +#include "common/rect.h" +#include "graphics/surface.h" + +namespace Gnap { + +const int kMaxSequenceItems = 40; +const int kMaxSpriteDrawItems = 30; +const int kMaxSoundIds = 50; +const int kMaxSeqItems = 50; +const int kMaxUpdRects = 20; +const int kMaxGfxItems = 50; +const int kMaxAnimations = 12; + +enum { + kSeqNone = 0x00, + kSeqScale = 0x01, // Enable scaling + kSeqLoop = 0x02, // Loop + kSeqUnk = 0x04, // Unknown + kSeqSyncWait = 0x08, // Start if other sequence is done + kSeqSyncExists = 0x20 // Start if other sequence exists +}; + +struct Sequence { + int32 sequenceId; + int32 id; + int32 sequenceId2; + int32 id2; + uint32 flags; + int32 totalDuration; + int16 x, y; +}; + +struct SpriteDrawItem { + int id; + Common::Rect rect; + Graphics::Surface *surface; +}; + +struct RemoveSequenceItem { + int sequenceId; + int id; + int a3; +}; + +struct RemoveSpriteDrawItem { + int id; + Graphics::Surface *surface; +}; + +struct GfxItem { + int sequenceId; + int id; + int flags; + SequenceAnimation *animation; + int soundValue; + int field_18; + int field_1C; + int currFrameNum; + int delayTicks; + bool updFlag; + int updRectsCount; + Graphics::Surface *surface; + Common::Rect updRects[kMaxUpdRects]; + SequenceFrame prevFrame; + SequenceFrame currFrame; + void testUpdRect(const Common::Rect &updRect); +}; + +struct Animation { + int sequenceId; + int id; + int status; +}; + +class GameSys { +public: + GameSys(GnapEngine *vm); + ~GameSys(); + void insertSequence(int sequenceId, int a2, int sequenceId2, int a4, int flags, int totalDuration, int16 x, int16 y); + void insertDirtyRect(const Common::Rect &rect); + void removeSequence(int sequenceId, int a2, int a3); + void invalidateGrabCursorSprite(int id, Common::Rect &rect, Graphics::Surface *surface1, Graphics::Surface *surface2); + void requestClear2(int a1); + void requestClear1(); + void requestRemoveSequence(int sequenceId, int a2); + void waitForUpdate(); + int isSequenceActive(int sequenceId, int a2); + void setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, int a6, int a7); + void setScaleValues(int a1, int a2, int a3, int a4); + void insertSpriteDrawItem(Graphics::Surface *surface, int x, int y, int id); + void removeSpriteDrawItem(Graphics::Surface *surface, int a2); + void drawSpriteToBackground(int x, int y, int resourceId); + Graphics::Surface *allocSurface(int width, int height); + Graphics::Surface *createSurface(int resourceId); + void drawSpriteToSurface(Graphics::Surface *surface, int x, int y, int resourceId); + void drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r, byte g, byte b, const char *text); + int getTextWidth(const char *text); + void fillSurface(Graphics::Surface *surface, int x, int y, int width, int height, byte r, byte g, byte b); + void setAnimation(int sequenceId, int id, int animationIndex); + int getAnimationStatus(int animationIndex); + int getSpriteWidthById(int resourceId); + int getSpriteHeightById(int resourceId); + Graphics::Surface *loadBitmap(int resourceId); + void drawBitmap(int resourceId); +public: + GnapEngine *_vm; + + Common::Array _dirtyRects; + + SpriteDrawItem _newSpriteDrawItems[kMaxSpriteDrawItems]; + int _newSpriteDrawItemsCount; + + bool _spriteDrawItems1Changed; + + RemoveSequenceItem _removeSequenceItems[kMaxSequenceItems]; + int _removeSequenceItemsCount; + + RemoveSpriteDrawItem _removeSpriteDrawItems[kMaxSpriteDrawItems]; + int _removeSpriteDrawItemsCount; + + int _grabSpriteId; + Common::Rect _grabSpriteRect; + bool _grabSpriteChanged; + Graphics::Surface *_grabSpriteSurface1, *_grabSpriteSurface2; + + bool _reqRemoveSequenceItem; + int _removeSequenceItemSequenceId, _removeSequenceItemValue; + + Common::Array _soundIds; + + //////////////////////////////////////////////////////////////////////////// + + Common::Array _seqItems; + Common::Array _fatSequenceItems; + + GfxItem _gfxItems[kMaxGfxItems]; + int _gfxItemsCount; + + Animation _animations[kMaxAnimations]; + int _animationsCount; + + int _backgroundImageValue3, _backgroundImageValue1; + int _backgroundImageValue4, _backgroundImageValue2; + bool _backgroundImageError; + + int32 _gameSysClock, _lastUpdateClock; + + Graphics::Surface *_backgroundSurface; + Graphics::Surface *_frontSurface; + Common::Rect _screenRect; + + Sequence *seqFind(int sequenceId, int a2, int *outIndex); + int seqLocateGfx(int sequenceId, int id, int *outGfxIndex); + void seqInsertGfx(int index, int duration); + void seqRemoveGfx(int sequenceId, int id); + bool updateSequenceDuration(int sequenceId, int id, int *outDuration); + void updateAnimationsStatus(int sequenceId, int a2); + + void restoreBackgroundRect(const Common::Rect &rect); + + void blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphics::Surface *sourceSurface, + Common::Rect &sourceRect, bool transparent); + void blitSprite32(Graphics::Surface *destSurface, int x, int y, byte *sourcePixels, + int sourceWidth, Common::Rect &sourceRect, uint32 *sourcePalette, bool transparent); + void blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &frameRect, + Common::Rect &destRect, byte *sourcePixels, int sourceWidth, Common::Rect &sourceRect, uint32 *sourcePalette); + + void seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &frame, Common::Rect *subRect); + void seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame &frame, Common::Rect *subRect); + + void drawSprites(); + void updateRect(const Common::Rect &r); + void updateScreen(); + + void handleReqRemoveSequenceItem(); + void handleReqRemoveSequenceItems(); + void handleReqRemoveSpriteDrawItems(); + void fatUpdateFrame(); + void fatUpdate(); + void updatePlaySounds(); + +}; + +bool intersectRect(Common::Rect &intersectingRect, const Common::Rect &r1, const Common::Rect &r2); + +} // End of namespace Gnap + +#endif // GNAP_GAMESYS_H diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp new file mode 100644 index 0000000000..08f598551e --- /dev/null +++ b/engines/gnap/gnap.cpp @@ -0,0 +1,2404 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/datarchive.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/sound.h" + +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "common/error.h" +#include "common/fs.h" +#include "common/timer.h" + +#include "engines/util.h" + +#include "graphics/cursorman.h" + +namespace Gnap { + +static const int kCursors[] = { + LOOK_CURSOR, + GRAB_CURSOR, + TALK_CURSOR, + PLAT_CURSOR +}; + +static const int kDisabledCursors[] = { + NOLOOK_CURSOR, + NOGRAB_CURSOR, + NOTALK_CURSOR, + NOPLAT_CURSOR +}; + +static const char *kCursorNames[] = { + "LOOK_CURSOR", + "GRAB_CURSOR", + "TALK_CURSOR", + "PLAT_CURSOR", + "NOLOOK_CURSOR", + "NOGRAB_CURSOR", + "NOTALK_CURSOR", + "NOPLAT_CURSOR", + "EXIT_L_CURSOR", + "EXIT_R_CURSOR", + "EXIT_U_CURSOR", + "EXIT_D_CURSOR", + "EXIT_NE_CURSOR", + "EXIT_NW_CURSOR", + "EXIT_SE_CURSOR", + "EXIT_SW_CURSOR", + "WAIT_CURSOR" +}; + + +static const int kCursorSpriteIds[30] = { + 0x005, 0x008, 0x00A, 0x004, 0x009, 0x003, + 0x006, 0x007, 0x00D, 0x00F, 0x00B, 0x00C, + 0x019, 0x01C, 0x015, 0x014, 0x010, 0x01A, + 0x018, 0x013, 0x011, 0x012, 0x01B, 0x016, + 0x017, 0x01D, 0x01E, 0x01F, 0x76A, 0x76B +}; + +static const char *kSceneNames[] = { + "open", "pigpn", "truck", "creek", "mafrm", "frbrn", "inbrn", "crash", + "porch", "barbk", "kitch", "bar", "juke", "wash", "john", "jkbox", + "brawl", "stret", "frtoy", "intoy", "frgro", "park", "cash", "ingro", + "frcir", "booth", "circ", "outcl", "incln", "monk", "elcir", "beer", + "pig2", "trk2", "creek", "frbrn", "inbrn", "mafrm", "infrm", "efair", + "fair", "souv", "chick", "ship", "kiss", "disco", "boot", "can", + "can2", "drive", "tung", "puss", "space", "phone", "can3" +}; + +GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : + Engine(syst), _gameDescription(gd) { + + _random = new Common::RandomSource("gnap"); + + Engine::syncSoundSettings(); + +} + +GnapEngine::~GnapEngine() { + + delete _random; + +} + +Common::Error GnapEngine::run() { + // Initialize the graphics mode to ARGB8888 + Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24); + initGraphics(800, 600, true, &format); + + // We do not support color conversion yet + if (_system->getScreenFormat() != format) + return Common::kUnsupportedColorMode; + + _lastUpdateClock = 0; + + // >>>>> Variable initialization + _cursorIndex = -1; + _verbCursor = 1; + invClear(); + clearFlags(); + _grabCursorSprite = 0; + _newGrabCursorSpriteIndex = -1; + _backgroundSurface = 0; + _isStockDatLoaded = false; + _gameDone = false; + _isPaused = false; + _pauseSprite = 0; + + //////////////////////////////////////////////////////////////////////////// + + _exe = new Common::PEResources(); + if (!_exe->loadFromEXE("ufos.exe")) + error("Could not load ufos.exe"); + + _dat = new DatManager(); + _spriteCache = new SpriteCache(_dat); + _soundCache = new SoundCache(_dat); + _sequenceCache = new SequenceCache(_dat); + _gameSys = new GameSys(this); + _soundMan = new SoundMan(this); + + _menuBackgroundSurface = 0; + + initGlobalSceneVars(); + +#if 1 + + mainLoop(); + +#else + + Graphics::Surface *testBack = new Graphics::Surface(); + testBack->create(800, 600, _system->getScreenFormat()); + //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); + testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); + + _currentSceneNum = 26; + + Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); + _dat->open(0, datFilename.c_str()); + + _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); + + _gameSys->insertSequence(0x5b, 100, -1, -1, 0, 0, 0, 0); + + CursorMan.showMouse(true); + + while (!shouldQuit()) { + Common::Event event; + + while (_eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + break; + case Common::EVENT_LBUTTONUP: + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONUP: + case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_MOUSEMOVE: + break; + case Common::EVENT_QUIT: + quitGame(); + break; + default: + break; + } + } + + _gameSys->fatUpdate(); + _gameSys->drawSprites(); + _gameSys->updateScreen(); + _gameSys->_gameSysClock++; + updateTimers(); + + _system->updateScreen(); + _system->delayMillis(100); + + } + + _dat->close(0); + + testBack->free(); + delete testBack; + + return Common::kNoError; + +#endif + + delete _soundMan; + delete _gameSys; + delete _sequenceCache; + delete _soundCache; + delete _spriteCache; + delete _dat; + + delete _exe; + + debug("run() done"); + + return Common::kNoError; +} + +bool GnapEngine::hasFeature(EngineFeature f) const { + return + false; +} + +void GnapEngine::updateEvents() { + Common::Event event; + + while (_eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + _keyPressState[event.kbd.keycode] = 1; + _keyDownState[event.kbd.keycode] = 1; + break; + case Common::EVENT_KEYUP: + _keyDownState[event.kbd.keycode] = 0; + break; + case Common::EVENT_MOUSEMOVE: + _mouseX = event.mouse.x; + _mouseY = event.mouse.y; + break; + case Common::EVENT_LBUTTONUP: + _mouseButtonState.left = false; + break; + case Common::EVENT_LBUTTONDOWN: + _leftClickMouseX = event.mouse.x; + _leftClickMouseY = event.mouse.y; + _mouseButtonState.left = true; + _mouseClickState.left = true; + break; + case Common::EVENT_RBUTTONUP: + _mouseButtonState.right = false; + break; + case Common::EVENT_RBUTTONDOWN: + _mouseButtonState.right = true; + _mouseClickState.right = true; + break; + case Common::EVENT_QUIT: + quitGame(); + break; + default: + break; + } + } +} + +void GnapEngine::gameUpdateTick() { + updateEvents(); + + // TODO Check _gameDone in the various game loops + if (shouldQuit()) { + _gameDone = true; + _sceneDone = true; + } + + // TODO Improve this (variable frame delay to keep ~15fps) + int currClock = _system->getMillis(); + if (currClock >= _lastUpdateClock + 66) { + _gameSys->fatUpdate(); + _gameSys->drawSprites(); + _gameSys->updateScreen(); + _gameSys->updatePlaySounds(); + _gameSys->_gameSysClock++; + updateTimers(); + _lastUpdateClock = currClock; + } + + _soundMan->update(); + _system->updateScreen(); + _system->delayMillis(5); + +} + +void GnapEngine::saveTimers() { + for (int i = 0; i < kMaxTimers; ++i ) + _savedTimers[i] = _timers[i]; +} + +void GnapEngine::restoreTimers() { + for (int i = 0; i < kMaxTimers; ++i ) + _timers[i] = _savedTimers[i]; +} + +void GnapEngine::pauseGame() { + if (!_isPaused) { + saveTimers(); + hideCursor(); + setGrabCursorSprite(-1); + _pauseSprite = _gameSys->createSurface(0x1076C); + _gameSys->insertSpriteDrawItem(_pauseSprite, (800 - _pauseSprite->w) / 2, (600 - _pauseSprite->h) / 2, 356); + _lastUpdateClock = 0; + gameUpdateTick(); + // TODO playMidi("pause.mid"); + _isPaused = true; + } +} + +void GnapEngine::resumeGame() { + if (_isPaused) { + restoreTimers(); + _gameSys->removeSpriteDrawItem(_pauseSprite, 356); + _lastUpdateClock = 0; + gameUpdateTick(); + deleteSurface(&_pauseSprite); + // TODO stopMidi(); + _isPaused = false; + clearAllKeyStatus1(); + _mouseClickState.left = false; + _mouseClickState.right = false; + showCursor(); + _gameSys->_gameSysClock = 0; + _gameSys->_lastUpdateClock = 0; + } +} + +void GnapEngine::updatePause() { + while (_isPaused) { + gameUpdateTick(); + if (isKeyStatus1(Common::KEYCODE_p)) { + clearKeyStatus1(Common::KEYCODE_p); + resumeGame(); + } + //_system->delayMillis(100); + } +} + +int GnapEngine::getRandom(int max) { + return _random->getRandomNumber(max - 1); +} + +int GnapEngine::readSavegameDescription(int savegameNum, Common::String &description) { + description = Common::String::format("Savegame %d", savegameNum); + return 0; +} + +int GnapEngine::loadSavegame(int savegameNum) { + return 1; +} + +void GnapEngine::delayTicks(int a1) { + // TODO + gameUpdateTick(); +} + +void GnapEngine::delayTicksCursor(int a1) { + // TODO + gameUpdateTick(); +} + +void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags, + int16 walkX, int16 walkY) { + _hotspots[index].x1 = x1; + _hotspots[index].y1 = y1; + _hotspots[index].x2 = x2; + _hotspots[index].y2 = y2; + _hotspots[index].flags = flags; + _hotspots[index].id = index; + _hotspotsWalkPos[index].x = walkX; + _hotspotsWalkPos[index].y = walkY; +} + +int GnapEngine::getHotspotIndexAtPos(int16 x, int16 y) { + for (int i = 0; i < _hotspotsCount; ++i) + if (!_hotspots[i].isFlag(SF_DISABLED) && _hotspots[i].isPointInside(x, y)) + return i; + return -1; +} + +void GnapEngine::updateCursorByHotspot() { + if (!_isWaiting) { + int hotspotIndex = getHotspotIndexAtPos(_mouseX, _mouseY); + +#if 1 + // NOTE This causes some display glitches so don't worry + char t[256]; + sprintf(t, "hotspot = %d", hotspotIndex); + _gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0); + _gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t); +#endif + + if (hotspotIndex < 0) + setCursor(kDisabledCursors[_verbCursor]); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_L_CURSOR) + setCursor(EXIT_L_CURSOR); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_R_CURSOR) + setCursor(EXIT_R_CURSOR); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_U_CURSOR) + setCursor(EXIT_U_CURSOR); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_D_CURSOR) + setCursor(EXIT_D_CURSOR); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_NE_CURSOR) + setCursor(EXIT_NE_CURSOR); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_NW_CURSOR) + setCursor(EXIT_NW_CURSOR); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_SE_CURSOR) + setCursor(EXIT_SE_CURSOR); + else if (_hotspots[hotspotIndex].flags & SF_EXIT_SW_CURSOR) + setCursor(EXIT_SW_CURSOR); + else if (_hotspots[hotspotIndex].flags & (1 << _verbCursor)) + setCursor(kCursors[_verbCursor]); + else + setCursor(kDisabledCursors[_verbCursor]); + } + // Update platypus hotspot + _hotspots[0].x1 = _gridMinX + 75 * _platX - 30; + _hotspots[0].y1 = _gridMinY + 48 * _platY - 100; + _hotspots[0].x2 = _gridMinX + 75 * _platX + 30; + _hotspots[0].y2 = _gridMinY + 48 * _platY; +} + +int GnapEngine::getClickedHotspotId() { + int result = -1; + if (_isWaiting) + _mouseClickState.left = false; + else if (_mouseClickState.left) { + int hotspotIndex = getHotspotIndexAtPos(_leftClickMouseX, _leftClickMouseY); + if (hotspotIndex >= 0) { + _mouseClickState.left = false; + _timers[3] = 300; + result = _hotspots[hotspotIndex].id; + } + } + return result; +} + +int GnapEngine::getInventoryItemSpriteNum(int index) { + return kCursorSpriteIds[index]; +} + +void GnapEngine::updateMouseCursor() { + if (_mouseClickState.right) { + // Switch through the verb cursors + _mouseClickState.right = false; + _timers[3] = 300; + _verbCursor = (_verbCursor + 1) % 4; + if (!isFlag(0) && _verbCursor == PLAT_CURSOR && _cursorValue == 1) + _verbCursor = (_verbCursor + 1) % 4; + if (!_isWaiting) + setCursor(kDisabledCursors[_verbCursor]); + setGrabCursorSprite(-1); + } + if (_isWaiting && ((_gnapActionStatus < 0 && _beaverActionStatus < 0) || _sceneWaiting)) { + setCursor(kDisabledCursors[_verbCursor]); + _isWaiting = false; + } else if (!_isWaiting && (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) && !_sceneWaiting) { + setCursor(WAIT_CURSOR); + _isWaiting = true; + } +} + +void GnapEngine::setVerbCursor(int verbCursor) { + _verbCursor = verbCursor; + if (!_isWaiting) + setCursor(kDisabledCursors[_verbCursor]); +} + +void GnapEngine::setCursor(int cursorIndex) { + if (_cursorIndex != cursorIndex) { + const char *cursorName = kCursorNames[cursorIndex]; + Graphics::WinCursorGroup *cursorGroup = Graphics::WinCursorGroup::createCursorGroup(*_exe, Common::WinResourceID(cursorName)); + if (cursorGroup) { + Graphics::Cursor *cursor = cursorGroup->cursors[0].cursor; + CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), + cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor()); + CursorMan.replaceCursorPalette(cursor->getPalette(), 0, 256); + delete cursorGroup; + } + _cursorIndex = cursorIndex; + } +} + +void GnapEngine::showCursor() { + CursorMan.showMouse(true); +} + +void GnapEngine::hideCursor() { + CursorMan.showMouse(false); +} + +void GnapEngine::setGrabCursorSprite(int index) { + freeGrabCursorSprite(); + if (index >= 0) { + createGrabCursorSprite(makeRid(1, kCursorSpriteIds[index])); + setVerbCursor(GRAB_CURSOR); + } + _grabCursorSpriteIndex = index; +} + +void GnapEngine::createGrabCursorSprite(int spriteId) { + _grabCursorSprite = _gameSys->createSurface(spriteId); + _gameSys->insertSpriteDrawItem(_grabCursorSprite, + _mouseX - (_grabCursorSprite->w / 2), + _mouseY - (_grabCursorSprite->h / 2), + 300); + delayTicks(5); +} + +void GnapEngine::freeGrabCursorSprite() { + if (_grabCursorSprite) { + _gameSys->removeSpriteDrawItem(_grabCursorSprite, 300); + _gameSys->removeSpriteDrawItem(_grabCursorSprite, 301); + delayTicks(5); + deleteSurface(&_grabCursorSprite); + } +} + +void GnapEngine::updateGrabCursorSprite(int x, int y) { + if (_grabCursorSprite) { + int newGrabCursorX = _mouseX - (_grabCursorSprite->w / 2) - x; + int newGrabCursorY = _mouseY - (_grabCursorSprite->h / 2) - y; + if (_currGrabCursorX != newGrabCursorX || _currGrabCursorY != newGrabCursorY) { + _currGrabCursorX = newGrabCursorX; + _currGrabCursorY = newGrabCursorY; + Common::Rect rect(newGrabCursorX, newGrabCursorY, + newGrabCursorX + _grabCursorSprite->w, newGrabCursorY + _grabCursorSprite->h); + _gameSys->invalidateGrabCursorSprite(300, rect, _grabCursorSprite, _grabCursorSprite); + } + } +} + +void GnapEngine::invClear() { + _inventory = 0; +} + +void GnapEngine::invAdd(int itemId) { + _inventory |= (1 << itemId); +} + +void GnapEngine::invRemove(int itemId) { + _inventory &= ~(1 << itemId); +} + +bool GnapEngine::invHas(int itemId) { + return (_inventory & (1 << itemId)) != 0; +} + +void GnapEngine::clearFlags() { + _gameFlags = 0; +} + +void GnapEngine::setFlag(int num) { + _gameFlags |= (1 << num); +} + +void GnapEngine::clearFlag(int num) { + _gameFlags &= ~(1 << num); +} + +bool GnapEngine::isFlag(int num) { + return (_gameFlags & (1 << num)) != 0; +} + +Graphics::Surface *GnapEngine::addFullScreenSprite(int resourceId, int id) { + _fullScreenSpriteId = id; + _fullScreenSprite = _gameSys->createSurface(resourceId); + _gameSys->insertSpriteDrawItem(_fullScreenSprite, 0, 0, id); + return _fullScreenSprite; +} + +void GnapEngine::removeFullScreenSprite() { + _gameSys->removeSpriteDrawItem(_fullScreenSprite, _fullScreenSpriteId); + deleteSurface(&_fullScreenSprite); +} + +void GnapEngine::showFullScreenSprite(int resourceId) { + hideCursor(); + setGrabCursorSprite(-1); + addFullScreenSprite(resourceId, 256); + while (!_mouseClickState.left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && + !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29)) { + gameUpdateTick(); + } + _mouseClickState.left = false; + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(29); + clearKeyStatus1(Common::KEYCODE_SPACE); + removeFullScreenSprite(); + showCursor(); +} + +void GnapEngine::queueInsertDeviceIcon() { + _gameSys->insertSequence(0x10849, 20, 0, 0, kSeqNone, 0, _deviceX1, _deviceY1); +} + +void GnapEngine::insertDeviceIconActive() { + _gameSys->insertSequence(0x1084A, 21, 0, 0, kSeqNone, 0, _deviceX1, _deviceY1); +} + +void GnapEngine::removeDeviceIconActive() { + _gameSys->removeSequence(0x1084A, 21, 1); +} + +void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int y2) { + _deviceX1 = x1; + _deviceX2 = x2; + _deviceY1 = y1; + _deviceY2 = y2; + if (x1 == -1) + _deviceX1 = 730; + if (x2 == -1) + _deviceX2 = 780; + if (y1 == -1) + _deviceY1 = 14; + if (y2 == -1) + _deviceY2 = 79; + _hotspots[hotspotIndex].x1 = _deviceX1; + _hotspots[hotspotIndex].y1 = _deviceY1; + _hotspots[hotspotIndex].x2 = _deviceX2; + _hotspots[hotspotIndex].y2 = _deviceY2; + _hotspots[hotspotIndex].flags = SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[hotspotIndex].id = hotspotIndex; +} + +int GnapEngine::getSequenceTotalDuration(int resourceId) { + SequenceResource *sequenceResource = _sequenceCache->get(resourceId); + int maxValue = 0; + for (int i = 0; i < sequenceResource->_animationsCount; ++i) { + SequenceAnimation *animation = &sequenceResource->_animations[i]; + if (animation->field_4 + animation->field_A > maxValue) + maxValue = animation->field_4 + animation->field_A; + } + int totalDuration = maxValue + sequenceResource->_totalDuration; + _sequenceCache->release(resourceId); + return totalDuration; +} + +bool GnapEngine::isSoundPlaying(int resourceId) { + return _soundMan->isSoundPlaying(resourceId); +} + +void GnapEngine::playSound(int resourceId, bool looping) { + debug(0, "playSound(%08X, %d)", resourceId, looping); + _soundMan->playSound(resourceId, looping); +} + +void GnapEngine::stopSound(int resourceId) { + _soundMan->stopSound(resourceId); +} + +void GnapEngine::setSoundVolume(int resourceId, int volume) { + _soundMan->setSoundVolume(resourceId, volume); +} + +void GnapEngine::updateTimers() { + for (int i = 0; i < kMaxTimers; ++i) + if (_timers[i] > 0) + --_timers[i]; +} + +void GnapEngine::initGameFlags(int num) { + invClear(); + invAdd(kItemMagazine); + switch (num) { + case 1: + setFlag(26); + break; + case 2: + clearFlags(); + break; + case 3: + invAdd(kItemDiceQuarterHole); + clearFlags(); + break; + case 4: + invAdd(kItemDiceQuarterHole); + invAdd(kItemHorn); + invAdd(kItemLightbulb); + clearFlags(); + setFlag(0); + setFlag(1); + setFlag(2); + setFlag(3); + setFlag(4); + setFlag(5); + setFlag(6); + setFlag(7); + break; + } + + //DEBUG! +// setFlag(0); // Enable platypus + setFlag(25); + invClear(); + invAdd(kItemMagazine); +#if 0 + invAdd(kItemDisguise); +#endif +#if 1 + //invAdd(kItemGas); + invAdd(kItemJoint); + //invAdd(kItemKeys); + invAdd(kItemWrench); + //invAdd(kItemTongs); + invAdd(kItemDiceQuarterHole); + //invAdd(kItemPill); + invAdd(kItemBucketWithBeer); + invAdd(kItemChickenBucket); + invAdd(kItemGum); + invAdd(kItemPicture); +#endif +} + +void GnapEngine::loadStockDat() { + if (!_isStockDatLoaded) { + _isStockDatLoaded = true; + _dat->open(1, "stock_n.dat"); + //createMenuSprite(); + // NOTE Skipped preloading of data + } +} + +void GnapEngine::mainLoop() { + + _newCursorValue = 1; + _cursorValue = -1; + _newSceneNum = 0; + _currentSceneNum = 55; + _prevSceneNum = 55; + invClear(); + clearFlags(); + _grabCursorSpriteIndex = -1; + _grabCursorSprite = 0; + + debug("MainLoop #1"); + + // > DEBUG BEGIN + _currentSceneNum = 53; + _newSceneNum = 27; + _newCursorValue = 3; + // < DEBUG END + + loadStockDat(); + + while (!_gameDone) { + + debug("New scene: %d", _newSceneNum); + + _prevSceneNum = _currentSceneNum; + _currentSceneNum = _newSceneNum; + + debug("GnapEngine::mainLoop() _prevSceneNum: %d; _currentSceneNum: %d", _prevSceneNum, _currentSceneNum); + + if (_newCursorValue != _cursorValue) { + debug("_newCursorValue: %d", _newCursorValue); + _cursorValue = _newCursorValue; + if (!_wasSavegameLoaded) + initGameFlags(_cursorValue); + } + + _sceneSavegameLoaded = _wasSavegameLoaded; + _wasSavegameLoaded = false; + + initScene(); + + runSceneLogic(); + afterScene(); + + _soundMan->stopAll(); + + // Force purge all resources + _sequenceCache->purge(true); + _soundCache->purge(true); + _spriteCache->purge(true); + + if (isKeyStatus1(28)) { + clearKeyStatus1(28); + if (_debugLevel == 4) + _gameDone = true; + } + + } + + if (_backgroundSurface) + deleteSurface(&_backgroundSurface); + + _dat->close(1); + // TODO freeMenuSprite(); + // TODO freeFont(); + + debug("MainLoop #XXX2"); + +} + +void GnapEngine::initScene() { + + Common::String datFilename; + + _isLeavingScene = false; + _sceneDone = false; + _newSceneNum = 55; + _gnapActionStatus = -1; + _beaverActionStatus = -1; + gnapInitBrainPulseRndValue(); + hideCursor(); + clearAllKeyStatus1(); + _mouseClickState.left = false; + _mouseClickState.right = false; + _sceneClickedHotspot = -1; + + datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); + + debug("GnapEngine::initScene() datFilename: %s", datFilename.c_str()); + + _dat->open(0, datFilename.c_str()); + + int backgroundId = initSceneLogic(); + + if (!_backgroundSurface) { + if (_currentSceneNum != 0) + _backgroundSurface = _gameSys->loadBitmap(makeRid(1, 0x8AA)); + else + _backgroundSurface = _gameSys->loadBitmap(makeRid(0, backgroundId)); + _gameSys->setBackgroundSurface(_backgroundSurface, 0, 500, 1, 1000); + } + + if (_currentSceneNum != 0 && _currentSceneNum != 16 && _currentSceneNum != 47 && + _currentSceneNum != 48 && _currentSceneNum != 54) { + _gameSys->drawBitmap(backgroundId); + } + + if ((_cursorValue == 4 && isFlag(12)) || _currentSceneNum == 41) + playSound(makeRid(1, 0x8F6), true); + +} + +void GnapEngine::endSceneInit() { + showCursor(); + if (_newGrabCursorSpriteIndex >= 0) + setGrabCursorSprite(_newGrabCursorSpriteIndex); +} + +void GnapEngine::afterScene() { + + if (_gameDone) + return; + + if (_newCursorValue == _cursorValue && _newSceneNum != 0 && _newSceneNum != 16 && + _newSceneNum != 47 && _newSceneNum != 48 && _newSceneNum != 54 && _newSceneNum != 49 && + _newSceneNum != 50 && _newSceneNum != 51 && _newSceneNum != 52) + _newGrabCursorSpriteIndex = _grabCursorSpriteIndex; + else + _newGrabCursorSpriteIndex = -1; + + setGrabCursorSprite(-1); + + _gameSys->requestClear2(0); + _gameSys->requestClear1(); + _gameSys->waitForUpdate(); + + _gameSys->requestClear2(0); + _gameSys->requestClear1(); + _gameSys->waitForUpdate(); + + screenEffect(0, 0, 0, 0); + + _dat->close(0); + + for (int animationIndex = 0; animationIndex < 12; ++animationIndex) + _gameSys->setAnimation(0, 0, animationIndex); + + clearKeyStatus1(Common::KEYCODE_p); + + _mouseClickState.left = false; + _mouseClickState.right = false; + +} + +void GnapEngine::checkGameKeys() { + if (isKeyStatus1(Common::KEYCODE_p)) { + clearKeyStatus1(Common::KEYCODE_p); + pauseGame(); + updatePause(); + } + // TODO? Debug input +} + +void GnapEngine::startSoundTimerA(int timerIndex) { + _soundTimerIndexA = timerIndex; + _timers[timerIndex] = getRandom(50) + 100; +} + +int GnapEngine::playSoundA() { + + static const int kSoundIdsA[] = { + 0x93E, 0x93F, 0x941, 0x942, 0x943, 0x944, + 0x945, 0x946, 0x947, 0x948, 0x949 + }; + + int soundId = -1; + + if (!_timers[_soundTimerIndexA]) { + _timers[_soundTimerIndexA] = getRandom(50) + 100; + soundId = kSoundIdsA[getRandom(11)]; + playSound(soundId | 0x10000, 0); + } + return soundId; +} + +void GnapEngine::startSoundTimerB(int timerIndex) { + _soundTimerIndexB = timerIndex; + _timers[timerIndex] = getRandom(50) + 150; +} + +int GnapEngine::playSoundB() { + + static const int kSoundIdsB[] = { + 0x93D, 0x929, 0x92A, 0x92B, 0x92C, 0x92D, + 0x92E, 0x92F, 0x930, 0x931, 0x932, 0x933, + 0x934, 0x935, 0x936, 0x937, 0x938, 0x939, + 0x93A + }; + + int soundId = -1; + + if (!_timers[_soundTimerIndexB]) { + _timers[_soundTimerIndexB] = getRandom(50) + 150; + soundId = kSoundIdsB[getRandom(19)]; + playSound(soundId | 0x10000, 0); + } + return soundId; +} + +void GnapEngine::startSoundTimerC(int timerIndex) { + _soundTimerIndexC = timerIndex; + _timers[timerIndex] = getRandom(50) + 150; +} + +int GnapEngine::playSoundC() { + + static const int kSoundIdsC[] = { + 0x918, 0x91F, 0x920, 0x922, 0x923, 0x924, + 0x926 + }; + + int soundId = -1; + + if (!_timers[_soundTimerIndexC]) { + _timers[_soundTimerIndexC] = getRandom(50) + 150; + soundId = kSoundIdsC[getRandom(7)] ; + playSound(soundId | 0x10000, 0); + } + return soundId; +} + +void GnapEngine::startIdleTimer(int timerIndex) { + _idleTimerIndex = timerIndex; + _timers[timerIndex] = 3000; +} + +void GnapEngine::updateIdleTimer() { + if (!_timers[_idleTimerIndex]) { + _timers[_idleTimerIndex] = 3000; + _gameSys->insertSequence(0x1088B, 255, 0, 0, kSeqNone, 0, 0, 75); + } +} + +void GnapEngine::screenEffect(int dir, byte r, byte g, byte b) { + if (dir == 1) { + for (int y = 300; y < 600; y += 50) { + _gameSys->fillSurface(0, 0, y, 800, 50, r, g, b); + _gameSys->fillSurface(0, 0, 549 - y + 1, 800, 50, r, g, b); + gameUpdateTick(); + _system->delayMillis(50); + } + } else { + for (int y = 0; y < 300; y += 50) { + _gameSys->fillSurface(0, 0, y, 800, 50, r, g, b); + _gameSys->fillSurface(0, 0, 549 - y + 1, 800, 50, r, g, b); + gameUpdateTick(); + _system->delayMillis(50); + } + } +} + +bool GnapEngine::isKeyStatus1(int key) { + return _keyPressState[key] != 0;; +} + +bool GnapEngine::isKeyStatus2(int key) { + return _keyDownState[key] != 0;; +} + +void GnapEngine::clearKeyStatus1(int key) { + _keyPressState[key] = 0; + _keyDownState[key] = 0; +} + +void GnapEngine::clearAllKeyStatus1() { + _keyStatus1[0] = 0; + _keyStatus1[1] = 0; + memset(_keyPressState, 0, sizeof(_keyPressState)); + memset(_keyDownState, 0, sizeof(_keyDownState)); +} + +void GnapEngine::deleteSurface(Graphics::Surface **surface) { + if (surface && *surface) { + (*surface)->free(); + delete *surface; + *surface = 0; + } +} + +int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { + int sequenceId = 0; + + switch (kind) { + + case gskPullOutDevice: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x83F; + _gnapIdleFacing = 5; + } else { + sequenceId = 0x83D; + _gnapIdleFacing = 7; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x83B; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x839; + _gnapIdleFacing = 1; + } + } + } else { + switch (_gnapIdleFacing) { + case 1: + sequenceId = 0x839; + break; + case 3: + sequenceId = 0x83B; + break; + case 7: + sequenceId = 0x83D; + break; + default: + sequenceId = 0x83F; + break; + } + } + break; + + case gskPullOutDeviceNonWorking: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x829; + _gnapIdleFacing = 5; + } else { + sequenceId = 0x828; + _gnapIdleFacing = 7; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x827; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x826; + _gnapIdleFacing = 1; + } + } + } else { + switch (_gnapIdleFacing) { + case 1: + sequenceId = 0x826; + break; + case 3: + sequenceId = 0x827; + break; + case 7: + sequenceId = 0x828; + break; + default: + sequenceId = 0x829; + break; + } + } + break; + + case gskScratchingHead: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x834; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x885; + _gnapIdleFacing = 7; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x834; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x833; + _gnapIdleFacing = 1; + } + } + } else { + switch (_gnapIdleFacing) { + case 1: + sequenceId = 0x833; + _gnapIdleFacing = 1; + break; + case 3: + sequenceId = 0x834; + _gnapIdleFacing = 3; + break; + case 7: + sequenceId = 0x885; + _gnapIdleFacing = 7; + break; + default: + sequenceId = 0x834; + _gnapIdleFacing = 3; + break; + } + } + break; + + case gskIdle: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x7BC; + _gnapIdleFacing = 5; + } else { + sequenceId = 0x7BB; + _gnapIdleFacing = 7; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x7BA; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7B9; + _gnapIdleFacing = 1; + } + } + } else { + switch (_gnapIdleFacing) { + case 1: + sequenceId = 0x7B9; + break; + case 3: + sequenceId = 0x7BA; + break; + case 7: + sequenceId = 0x7BB; + break; + default: + sequenceId = 0x7BC; + break; + } + } + break; + + case gskBrainPulsating: + _gnapBrainPulseNum = (_gnapBrainPulseNum + 1) & 1; + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; + _gnapIdleFacing = 5; + } else { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; + _gnapIdleFacing = 7; + } + } else { + if (_gnapX > gridX) { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; + _gnapIdleFacing = 3; + } else { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; + _gnapIdleFacing = 1; + } + } + } else { + switch (_gnapIdleFacing) { + case 1: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; + break; + case 3: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; + break; + case 7: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; + break; + default: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; + break; + } + } + break; + + case gskImpossible: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x831; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7A8; + _gnapIdleFacing = 1; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x831; + _gnapIdleFacing = 3; + } else { + if (_gnapX % 2) + sequenceId = 0x7A8; + else + sequenceId = 0x89A; + _gnapIdleFacing = 1; + } + } + } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + sequenceId = 0x831; + _gnapIdleFacing = 3; + } else { + if (_currentSceneNum % 2) + sequenceId = 0x7A8; + else + sequenceId = 0x89A; + _gnapIdleFacing = 1; + } + break; + + case gskDeflect: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x830; + _gnapIdleFacing = 5; + } else { + sequenceId = 0x82F; + _gnapIdleFacing = 7; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x82E; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7A7; + _gnapIdleFacing = 1; + } + } + } else { + switch (_gnapIdleFacing) { + case 1: + sequenceId = 0x7A7; + break; + case 3: + sequenceId = 0x82E; + break; + case 5: + sequenceId = 0x830; + break; + case 7: + sequenceId = 0x82F; + break; + } + } + break; + + case gskUseDevice: + switch (_gnapIdleFacing) { + case 1: + sequenceId = 0x83A; + break; + case 3: + sequenceId = 0x83C; + break; + case 5: + sequenceId = 0x840; + break; + case 7: + sequenceId = 0x83E; + break; + } + break; + + case gskMoan1: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x832; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7AA; + _gnapIdleFacing = 1; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x832; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7AA; + _gnapIdleFacing = 1; + } + } + } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + sequenceId = 0x832; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7AA; + _gnapIdleFacing = 1; + } + break; + + case gskMoan2: + if (gridX > 0 && gridY > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) { + sequenceId = 0x832; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7AA; + _gnapIdleFacing = 1; + } + } else { + if (_gnapX > gridX) { + sequenceId = 0x832; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7AA; + _gnapIdleFacing = 1; + } + } + } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + sequenceId = 0x832; + _gnapIdleFacing = 3; + } else { + sequenceId = 0x7AA; + _gnapIdleFacing = 1; + } + break; + + } + + return sequenceId | 0x10000; +} + +int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { + + int sequenceId; + int facing = _gnapIdleFacing; + + if (gridY > 0 && gridX > 0) { + if (_gnapY > gridY) { + if (_gnapX > gridX) + _gnapIdleFacing = 5; + else + _gnapIdleFacing = 7; + } else { + if (_gnapX > gridX) + _gnapIdleFacing = 5; + else + _gnapIdleFacing = 7; + } + } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + _gnapIdleFacing = 5; + } else { + _gnapIdleFacing = 7; + } + + switch (index) { + case 0: + if (_gnapIdleFacing == 7) + sequenceId = 0x8A0; + else + sequenceId = 0x8A1; + break; + case 1: + if (_gnapIdleFacing == 7) + sequenceId = 0x880; + else + sequenceId = 0x895; + break; + case 2: + if (_gnapIdleFacing == 7) + sequenceId = 0x884; + else + sequenceId = 0x899; + break; + //Skip 3 + case 4: + if (_gnapIdleFacing == 7) + sequenceId = 0x881; + else + sequenceId = 0x896; + break; + case 5: + if (_gnapIdleFacing == 7) + sequenceId = 0x883; + else + sequenceId = 0x898; + break; + case 6: + if (_gnapIdleFacing == 7) + sequenceId = 0x87E; + else + sequenceId = 0x893; + break; + case 7: + if (_gnapIdleFacing == 7) + sequenceId = 0x848; + else + sequenceId = 0x890; + break; + case 8: + if (_gnapIdleFacing == 7) + sequenceId = 0x87D; + else + sequenceId = 0x892; + break; + case 9: + if (_gnapIdleFacing == 7) + sequenceId = 0x882; + else + sequenceId = 0x897; + break; + case 10: + if (_gnapIdleFacing == 7) + sequenceId = 0x87C; + else + sequenceId = 0x891; + break; + case 11: + if (_gnapIdleFacing == 7) + sequenceId = 0x87C; + else + sequenceId = 0x891; + break; + case 12: + if (_gnapIdleFacing == 7) + sequenceId = 0x87D; + else + sequenceId = 0x892; + break; + case 13: + if (_gnapIdleFacing == 7) + sequenceId = 0x888; + else + sequenceId = 0x89D; + break; + case 14: + if (_gnapIdleFacing == 7) + sequenceId = 0x87F; + else + sequenceId = 0x894; + break; + case 15: + if (_gnapIdleFacing == 7) + sequenceId = 0x87B; + else + sequenceId = 0x8A3; + break; + case 16: + if (_gnapIdleFacing == 7) + sequenceId = 0x877; + else + sequenceId = 0x88C; + break; + //Skip 17 + case 18: + sequenceId = 0x887; + break; + case 19: + if (_gnapIdleFacing == 7) + sequenceId = 0x87A; + else + sequenceId = 0x88F; + break; + case 20: + if (_gnapIdleFacing == 7) + sequenceId = 0x878; + else + sequenceId = 0x88D; + break; + case 21: + if (_gnapIdleFacing == 7) + sequenceId = 0x879; + else + sequenceId = 0x88E; + break; + case 22: + if (_gnapIdleFacing == 7) + sequenceId = 0x88A; + else + sequenceId = 0x89F; + break; + case 23: + if (_gnapIdleFacing == 7) + sequenceId = 0x889; + else + sequenceId = 0x89E; + break; + case 24: + if (_gnapIdleFacing == 7) + sequenceId = 0x886; + else + sequenceId = 0x89B; + break; + case 25: + if (_gnapIdleFacing == 7) + sequenceId = 0x87A; + else + sequenceId = 0x88F; + break; + //Skip 26 + //Skip 27 + //Skip 28 + //Skip 29 + default: + _gnapIdleFacing = facing; + sequenceId = getGnapSequenceId(gskImpossible, 0, 0); + break; + } + return sequenceId; +} + +void GnapEngine::gnapIdle() { + if (_gnapSequenceId != -1 && _gnapSequenceDatNum == 1 && + (_gnapSequenceId == 0x7A6 || _gnapSequenceId == 0x7AA || + _gnapSequenceId == 0x832 || _gnapSequenceId == 0x841 || + _gnapSequenceId == 0x842 || _gnapSequenceId == 0x8A2 || + _gnapSequenceId == 0x833 || _gnapSequenceId == 0x834 || + _gnapSequenceId == 0x885 || _gnapSequenceId == 0x7A8 || + _gnapSequenceId == 0x831 || _gnapSequenceId == 0x89A)) { + _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 32, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); + _gnapSequenceDatNum = 1; + } +} + +void GnapEngine::gnapActionIdle(int sequenceId) { + if (_gnapSequenceId != -1 && ridToDatIndex(sequenceId) == _gnapSequenceDatNum && + ridToEntryIndex(sequenceId) == _gnapSequenceId) { + _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 32, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); + _gnapSequenceDatNum = 1; + } +} + +void GnapEngine::playGnapSequence(int sequenceId) { + _timers[2] = getRandom(30) + 20; + _timers[3] = 300; + gnapIdle(); + _gameSys->insertSequence(sequenceId, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 9, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = ridToEntryIndex(sequenceId); + _gnapSequenceDatNum = ridToDatIndex(sequenceId); +} + +void GnapEngine::playGnapImpossible(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskImpossible, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapScratchingHead(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapMoan1(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskMoan1, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapMoan2(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskMoan2, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapBrainPulsating(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapPullOutDevice(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapPullOutDeviceNonWorking(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapUseDevice(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskUseDevice, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapIdle(int gridX, int gridY) { + playGnapSequence(getGnapSequenceId(gskIdle, gridX, gridY) | 0x10000); +} + +void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { + playGnapSequence(getGnapShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); +} + +void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { + if (_platX == gridX && _platY == gridY) + beaverMakeRoom(); + gnapWalkTo(gridX, gridY, -1, -1, 1); + playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); +} + +void GnapEngine::updateGnapIdleSequence() { + if (_gnapActionStatus < 0) { + if (_timers[2] > 0) { + if (_timers[3] == 0) { + _timers[2] = 60; + _timers[3] = 300; + _gnapRandomValue = getRandom(5); + if (_gnapIdleFacing == 1) { + switch (_gnapRandomValue) { + case 0: + playGnapSequence(0x107A6); + break; + case 1: + playGnapSequence(0x107AA); + break; + case 2: + playGnapSequence(0x10841); + break; + default: + playGnapSequence(0x108A2); + break; + } + } else if (_gnapIdleFacing == 3) { + if (_gnapRandomValue > 2) + playGnapSequence(0x10832); + else + playGnapSequence(0x10842); + } + } + } else { + _timers[2] = getRandom(30) + 20; + if (_gnapIdleFacing == 1) { + _gameSys->insertSequence(0x107BD, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7BD; + _gnapSequenceDatNum = 1; + } else if (_gnapIdleFacing == 3) { + _gameSys->insertSequence(0x107BE, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7BE; + _gnapSequenceDatNum = 1; + } + } + } else { + _timers[2] = getRandom(30) + 20; + _timers[3] = 300; + } +} + +void GnapEngine::updateGnapIdleSequence2() { + if (_gnapActionStatus < 0) { + if (_timers[2] > 0) { + if (_timers[3] == 0) { + _timers[2] = 60; + _timers[3] = 300; + if (_gnapIdleFacing == 1) { + playGnapSequence(0x107AA); + } else if (_gnapIdleFacing == 3) { + playGnapSequence(0x10832); + } + } + } else { + _timers[2] = getRandom(30) + 20; + if (_gnapIdleFacing == 1) { + _gameSys->insertSequence(0x107BD, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7BD; + _gnapSequenceDatNum = 1; + } else if (_gnapIdleFacing == 3) { + _gameSys->insertSequence(0x107BE, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7BE; + _gnapSequenceDatNum = 1; + } + } + } else { + _timers[2] = getRandom(30) + 20; + _timers[3] = 300; + } +} + +bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2) { + if (_mouseClickState.left && someStatus == _gnapActionStatus) { + _isLeavingScene = false; + _gameSys->setAnimation(0, 0, animationIndex); + _gnapActionStatus = -1; + _beaverActionStatus = -1; + gnapWalkTo(gridX1, gridY1, -1, -1, 1); + platypusWalkTo(gridX2, gridY2, -1, -1, 1); + _mouseClickState.left = false; + return true; + } + return false; +} + +void GnapEngine::initGnapPos(int gridX, int gridY, int facing) { + _timers[2] = 30; + _timers[3] = 300; + _gnapX = gridX; + _gnapY = gridY; + if (facing <= 0) + _gnapIdleFacing = 1; + else + _gnapIdleFacing = facing; + if (_gnapIdleFacing == 3) { + _gnapSequenceId = 0x7B8; + } else { + _gnapSequenceId = 0x7B5; + _gnapIdleFacing = 1; + } + _gnapId = 20 * _gnapY; + _gnapSequenceDatNum = 1; + _gameSys->insertSequence(makeRid(1, _gnapSequenceId), 20 * _gnapY, + 0, 0, + 1, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); +} + +void GnapEngine::gnapInitBrainPulseRndValue() { + _gnapBrainPulseRndValue = 2 * getRandom(10); +} + +void GnapEngine::gnapUseDeviceOnBeaver() { + + playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _platX, _platY))); + + if (_beaverFacing != 0) { + _gameSys->insertSequence(makeRid(1, 0x7D5), _beaverId, + makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + 8, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + _beaverSequenceId = 0x7D5; + _beaverSequenceDatNum = 1; + } else { + _gameSys->insertSequence(makeRid(1, 0x7D4), _beaverId, + makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + 8, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + _beaverSequenceId = 0x7D4; + _beaverSequenceDatNum = 1; + } + + int newSequenceId = getGnapSequenceId(gskUseDevice, 0, 0); + _gameSys->insertSequence(makeRid(1, newSequenceId), _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = newSequenceId; + _gnapSequenceDatNum = 1; + +} + +void GnapEngine::doCallback(int callback) { + switch (callback) { + case 8: + scene08_updateAnimationsCb(); + break; + case 10: + scene10_updateAnimationsCb(); + break; + case 20: + scene20_updateAnimationsCb(); + break; + } +} + +bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) { + bool result = false; + + if (_gnapActionStatus <= -1 && _beaverActionStatus <= -1) { + _gnapActionStatus = 100; + if (isPointBlocked(_platX + gridX, _platY + gridY) && (_platX + gridX != _gnapX || _platY + gridY != _gnapY)) + platypusWalkStep(); + if (!isPointBlocked(_platX + gridX, _platY + gridY) && (_platX + gridX != _gnapX || _platY + gridY != _gnapY)) { + gnapWalkTo(_platX + gridX, _platY + gridY, 0, 0x107B9, 1); + while (_gameSys->getAnimationStatus(0) != 2) { + updateMouseCursor(); + doCallback(callback); + gameUpdateTick(); + } + _gameSys->setAnimation(0, 0, 0); + if (_platX + gridX == _gnapX && _platY + gridY == _gnapY) { + _gameSys->setAnimation(platSequenceId, _beaverId, 1); + playBeaverSequence(platSequenceId); + while (_gameSys->getAnimationStatus(1) != 2) { + updateMouseCursor(); + doCallback(callback); + gameUpdateTick(); + } + result = true; + } + } + _gnapActionStatus = -1; + } + return result; +} + +void GnapEngine::gnapKissPlatypus(int callback) { + if (gnapPlatypusAction(-1, 0, 0x107D1, callback)) { + _gnapActionStatus = 100; + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0x10847, _gnapId, 0); + _gameSys->insertSequence(0x10847, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 15 * (5 * _gnapX - 20) - (21 - _gridMinX), 48 * (_gnapY - 6) - (146 - _gridMinY)); + _gnapSequenceDatNum = 1; + _gnapSequenceId = 0x847; + _gameSys->insertSequence(0x107CB, _beaverId, + makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + 8, getSequenceTotalDuration(0x10847), 75 * _platX - _platGridX, 48 * _platY - _platGridY); + _beaverSequenceDatNum = 1; + _beaverSequenceId = 0x7CB; + _beaverFacing = 0; + playGnapSequence(0x107B5); + while (_gameSys->getAnimationStatus(0) != 2) { + updateMouseCursor(); + doCallback(callback); + gameUpdateTick(); + } + _gameSys->setAnimation(0, 0, 0); + _gnapActionStatus = -1; + } else { + playGnapSequence(getGnapSequenceId(gskScratchingHead, _platX, _platY) | 0x10000); + } +} + +void GnapEngine::gnapUseJointOnPlatypus() { + setGrabCursorSprite(-1); + if (gnapPlatypusAction(1, 0, 0x107C1, 0)) { + _gnapActionStatus = 100; + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0x10876, _beaverId, 0); + _gameSys->insertSequence(0x10875, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 15 * (5 * _gnapX - 30), 48 * (_gnapY - 7)); + _gnapSequenceDatNum = 1; + _gnapSequenceId = 0x875; + _gameSys->insertSequence(0x10876, _beaverId, + _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + 8, 0, 15 * (5 * _platX - 25), 48 * (_platY - 7)); + _beaverSequenceDatNum = 1; + _beaverSequenceId = 0x876; + _beaverFacing = 0; + playGnapSequence(0x107B5); + gnapWalkStep(); + while (_gameSys->getAnimationStatus(0) != 2) { + updateMouseCursor(); + gameUpdateTick(); + } + _gameSys->setAnimation(0, 0, 0); + _gnapActionStatus = -1; + } else { + playGnapSequence(getGnapSequenceId(gskScratchingHead, _platX, _platY) | 0x10000); + } +} + +void GnapEngine::gnapUseDisguiseOnPlatypus() { + _gameSys->setAnimation(0x10846, _gnapId, 0); + playGnapSequence(0x10846); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + _newSceneNum = 47; + _isLeavingScene = true; + _sceneDone = true; + setFlag(10); +} + +int GnapEngine::getBeaverSequenceId(int kind, int gridX, int gridY) { + int sequenceId; + + // TODO kind is always 0, remove that parameter + if (kind != 0) + return 0; + + if (gridX > 0 && gridY > 0) { + if (gridX < _platX) { + sequenceId = 0x7CC; + _beaverFacing = 4; + } else { + sequenceId = 0x7CB; + _beaverFacing = 0; + } + } else if (_beaverFacing != 0) { + sequenceId = 0x7CC; + _beaverFacing = 4; + } else { + sequenceId = 0x7CB; + _beaverFacing = 0; + } + return sequenceId | 0x10000; +} + +void GnapEngine::playBeaverSequence(int sequenceId) { + _gameSys->insertSequence(sequenceId, _beaverId, + makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + 9, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + _beaverSequenceId = ridToEntryIndex(sequenceId); + _beaverSequenceDatNum = ridToDatIndex(sequenceId); +} + +void GnapEngine::updateBeaverIdleSequence() { + if (_beaverActionStatus < 0 && _gnapActionStatus < 0) { + if (_timers[0] > 0) { + if (_timers[1] == 0) { + _timers[1] = getRandom(20) + 30; + _gnapRandomValue = getRandom(10); + if (_beaverFacing != 0) { + if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7CA) { + if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7CA) + playBeaverSequence(0x107CA); + else + playBeaverSequence(0x10845); + } else { + playBeaverSequence(0x107CC); + } + } else if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7C9) { + if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7C9) { + if (_gnapRandomValue != 2 || _beaverSequenceId != 0x7C9) + playBeaverSequence(0x107C9); + else + playBeaverSequence(0x108A4); + } else { + playBeaverSequence(0x10844); + } + } else { + playBeaverSequence(0x107CB); + } + } + } else { + _timers[0] = getRandom(75) + 75; + beaverMakeRoom(); + } + } else { + _timers[0] = 100; + _timers[1] = 35; + } +} + +void GnapEngine::beaverSub426234() { + if (_beaverActionStatus < 0 && _gnapActionStatus < 0) { + if (_timers[0]) { + if (!_timers[1]) { + _timers[1] = getRandom(20) + 30; + _gnapRandomValue = getRandom(10); + if (_beaverFacing != 0) { + if (_gnapRandomValue >= 2 || _beaverSequenceId != 0x7CA) + playBeaverSequence(0x107CA); + else + playBeaverSequence(0x107CC); + } else { + if (_gnapRandomValue >= 2 || _beaverSequenceId != 0x7C9) { + playBeaverSequence(0x107C9); + } else { + playBeaverSequence(0x107CB); + } + } + } + } else { + _timers[0] = getRandom(75) + 75; + beaverMakeRoom(); + } + } else { + _timers[0] = 100; + _timers[1] = 35; + } +} + +void GnapEngine::initBeaverPos(int gridX, int gridY, int facing) { + _timers[0] = 50; + _timers[1] = 20; + _platX = gridX; + _platY = gridY; + if (facing <= 0) + _beaverFacing = 0; + else + _beaverFacing = facing; + if (_beaverFacing == 4) { + _beaverSequenceId = 0x7D1; + } else { + _beaverSequenceId = 0x7C1; + _beaverFacing = 0; + } + _beaverId = 20 * _platY; + _beaverSequenceDatNum = 1; + _gameSys->insertSequence(makeRid(1, _beaverSequenceId), 20 * _platY, + 0, 0, + 1, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); +} + +//////////////////////////////////////////////////////////////////////////////// + +void GnapEngine::initGlobalSceneVars() { + + // Scene 1 + _s01_pigsIdCtr = 0; + _s01_smokeIdCtr = 0; + _s01_spaceshipSurface = 0; + + // Scene 2 + _s02_truckGrillCtr = 0; + + // Scene 3 + _s03_nextPlatSequenceId = -1; + _s03_platypusScared = false; + _s03_platypusHypnotized = false; + + // Scene 4 + _s04_dogIdCtr = 0; + //_s04_triedWindow = true;//?? + _s04_triedWindow = false; + + // Scene 5 + _s05_nextChickenSequenceId = -1; + + // Scene 6 + _s06_nextPlatSequenceId = -1; + + // Scene 11 + _s11_billardBallCtr = 0; + + // Scene 13 + _s13_backToiletCtr = -1; + + // Scene 17 + _s17_platTryGetWrenchCtr = 0; + _s17_wrenchCtr = 2; + _s17_nextCarWindowSequenceId = -1; + _s17_nextWrenchSequenceId = -1; + _s17_canTryGetWrench = true; + _s17_platPhoneCtr = 0; + _s17_nextPhoneSequenceId = -1; + _s17_currPhoneSequenceId = -1; + + // Scene 18 + _s18_garbageCanPos = 8; + _s18_platPhoneCtr = 0; + _s18_platPhoneIter = 0; + _s18_nextPhoneSequenceId = -1; + _s18_currPhoneSequenceId = -1; + + // Scene 19 + _s19_toyGrabCtr = 0; + _s19_pictureSurface = 0; + _s19_shopAssistantCtr = 0; + + // Scene 20 + _s20_stonerGuyCtr = 3; + _s20_stonerGuyShowingJoint = false; + _s20_groceryStoreGuyCtr = 0; + + // Scene 22 + _s22_caughtBefore = false; + _s22_cashierCtr = 3; + + // Scene 50 + _s50_timesPlayed = 0; + _s50_timesPlayedModifier = 0; + _s50_attackCounter = 0; + _s50_leftTongueEnergyBarPos = 10; + _s50_leftTongueNextIdCtr = 0; + _s50_rightTongueEnergyBarPos = 10; + _s50_rightTongueNextIdCtr = 0; + + // Scene 52 + _s52_gameScore = 0; + _s52_aliensInitialized = false; + _s52_alienDirection = 0; + _s52_soundToggle = false; + + // Scene 53 + _s53_callsMadeCtr = 0; + _s53_callsRndUsed = 0; + + // Toy UFO + _toyUfoId = 0; + _toyUfoActionStatus = -1; + _toyUfoX = 0; + _toyUfoY = 50; + +} + +bool GnapEngine::sceneXX_sub_4466B1() { + + if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(Common::KEYCODE_UP); + clearKeyStatus1(Common::KEYCODE_RIGHT); + clearKeyStatus1(Common::KEYCODE_LEFT); + clearKeyStatus1(Common::KEYCODE_p); + return true; + } + + if (isKeyStatus1(Common::KEYCODE_p)) { + clearKeyStatus1(Common::KEYCODE_p); + pauseGame(); + updatePause(); + } + return false; + +} + +void GnapEngine::sceneXX_playRandomSound(int timerIndex) { + if (!_timers[timerIndex]) { + _timers[timerIndex] = getRandom(40) + 50; + _gnapRandomValue = getRandom(4); + switch (_gnapRandomValue) { + case 0: + playSound(0x1091B, 0); + break; + case 1: + playSound(0x10921, 0); + break; + case 2: + playSound(0x10927, 0); + break; + case 3: + playSound(0x1091D, 0); + break; + } + } +} + +void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3) { + setGrabCursorSprite(-1); + _gameSys->setAnimation(sequenceId2, _gnapId, 0); + _gameSys->insertSequence(sequenceId2, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); + _gnapSequenceId = sequenceId2; + _gnapSequenceDatNum = 0; + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + hideCursor(); + addFullScreenSprite(fullScreenSpriteId, 255); + _gameSys->setAnimation(sequenceId1, 256, 0); + _gameSys->insertSequence(sequenceId1, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + _gameSys->setAnimation(sequenceId3, _gnapId, 0); + _gameSys->insertSequence(sequenceId3, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 8, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); + removeFullScreenSprite(); + showCursor(); + _gnapSequenceId = sequenceId3; +} + +// Scene 0 + +int GnapEngine::scene00_init() { + return 0x37C; +} + +void GnapEngine::toyUfoSetStatus(int a1) { + clearFlag(16); + clearFlag(17); + clearFlag(18); + clearFlag(19); + setFlag(a1); +} + +int GnapEngine::toyUfoGetSequenceId() { + if (isFlag(16)) + return 0x84E; + if (isFlag(17)) + return 0x84B; + if (isFlag(18)) + return 0x84D; + if (isFlag(19)) + return 0x84C; + return 0x84E; +} + +bool GnapEngine::toyUfoCheckTimer() { + if (!isFlag(12) || isFlag(18) || _timers[9] || + _toyUfoSequenceId == 0x870 || _toyUfoSequenceId == 0x871 || _toyUfoSequenceId == 0x872 || _toyUfoSequenceId == 0x873) + return false; + _sceneDone = true; + _newSceneNum = 41; + return true; +} + +void GnapEngine::toyUfoFlyTo(int destX, int destY, int a3, int a4, int a5, int a6, int animationIndex) { + int v21 = 0; + int v14 = 0; + int v17 = 36; + int v15 = 32; + int i = 0; + GridStruct v16[34]; + + if (destX == -1) + destX = _leftClickMouseX; + + if (destY == -1) + destY = _leftClickMouseY; + + //CHECKME + + int v25 = CLIP(destX, a3, a4); + int v26 = CLIP(destY, a5, a6); + int v24, v23; + int v13, v20; + + if (v25 == _toyUfoX) + v24 = 0; + else + v24 = (v25 - _toyUfoX) / ABS(v25 - _toyUfoX); + + if (v26 == _toyUfoY) + v23 = 0; + else + v23 = (v26 - _toyUfoY) / ABS(v26 - _toyUfoY); + + v13 = ABS(v25 - _toyUfoX); + v20 = ABS(v26 - _toyUfoY); + + if (v20 > v13) { + int v22 = v20 / v15; + while (v14 < v20 && i < 34) { + if (v22 - 5 >= i) { + v15 = MIN(36, 8 * i + 8); + } else { + v15 = MAX(6, v15 - 3); + } + v14 += v15; + v16[i].gridX1 = _toyUfoX + v24 * v13 * v14 / v20; + v16[i].gridY1 = _toyUfoY + v23 * v14; + ++i; + } + } else { + int v22 = v13 / v17; + while (v14 < v13 && i < 34) { + if (v22 - 5 >= i) { + v17 = MIN(38, 8 * i + 8); + } else { + v17 = MAX(6, v17 - 3); + } + v14 += v17; + v16[i].gridX1 = _toyUfoX + v24 * v14; + v16[i].gridY1 = _toyUfoY + v23 * v20 * v14 / v13; + ++i; + } + } + + v21 = i - 1; + + _toyUfoX = v25; + _toyUfoY = v26; + + debug("v21: %d", v21); + + if (i - 1 > 0) { + int v18; + if (isFlag(16)) + v18 = 0x867; + else if (isFlag(17)) + v18 = 0x84F; + else if (isFlag(18)) + v18 = 0x85F; + else if (isFlag(19)) + v18 = 0x857; + v16[0].sequenceId = v18; + v16[0].id = 0; + _gameSys->insertSequence(v18 | 0x10000, 0, + _toyUfoSequenceId | 0x10000, _toyUfoId, + 8, 0, v16[0].gridX1 - 365, v16[0].gridY1 - 128); + for (i = 1; i < v21; ++i) { + v16[i].sequenceId = v18 + (i % 8); + v16[i].id = i; + _gameSys->insertSequence(v16[i].sequenceId | 0x10000, v16[i].id, + v16[i - 1].sequenceId | 0x10000, v16[i - 1].id, + 8, 0, + v16[i].gridX1 - 365, v16[i].gridY1 - 128); + } + + _toyUfoSequenceId = v16[v21 - 1].sequenceId; + _toyUfoId = v16[v21 - 1].id; + + if (animationIndex >= 0) + _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, animationIndex); + + } + +} + +// Scene 99 + +int GnapEngine::cutscene_init() { + return -1; +} + +void GnapEngine::cutscene_run() { + + int itemIndex = 0; + int soundId = -1; + int volume = 100; + int duration = 0; + bool skip = false; + + int v1 = 0; + + if (_prevSceneNum == 2) { + soundId = 0x36B; + duration = MAX(1, 300 / getSequenceTotalDuration(_s99_dword_47F370[_s99_itemsCount - 1]));//CHECKME + _timers[0] = 0; + } + + if (soundId != -1) + playSound(soundId, 0); + + hideCursor(); + + _gameSys->drawSpriteToBackground(0, 0, _s99_dword_47F2F0[0]); + + for (int j = 0; j < _s99_dword_47F330[0]; ++j) + _gameSys->insertSequence(_s99_dword_47F370[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(_s99_dword_47F370[0], 2, 0); + + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(Common::KEYCODE_SPACE); + clearKeyStatus1(29); + + _mouseClickState.left = false; + + while (!_sceneDone) { + + gameUpdateTick(); + + if (_gameSys->getAnimationStatus(0) == 2 || skip) { + skip = 0; + _gameSys->requestClear2(0); + _gameSys->requestClear1(); + _gameSys->setAnimation(0, 0, 0); + v1 += _s99_dword_47F330[itemIndex++]; + if (itemIndex >= _s99_itemsCount) { + _sceneDone = true; + } else { + for (int m = 0; m < _s99_dword_47F330[itemIndex]; ++m) + _gameSys->insertSequence(_s99_dword_47F370[v1 + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->drawSpriteToBackground(0, 0, _s99_dword_47F2F0[itemIndex]); + _gameSys->setAnimation(_s99_dword_47F370[v1], 2, 0); + } + } + + if (isKeyStatus1(Common::KEYCODE_ESCAPE) || isKeyStatus1(Common::KEYCODE_SPACE) || isKeyStatus1(29)) { + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(Common::KEYCODE_SPACE); + clearKeyStatus1(29); + if (_s99_canSkip[itemIndex] & 1) + skip = true; + else + _sceneDone = true; + } + + if (!_timers[0] && itemIndex == _s99_itemsCount - 1) { + _timers[0] = 2; + volume = MAX(1, volume - duration); + setSoundVolume(soundId, volume); + } + + } + + if (soundId != -1) + stopSound(soundId); + +} + +} // End of namespace Gnap diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h new file mode 100644 index 0000000000..e1d13eca41 --- /dev/null +++ b/engines/gnap/gnap.h @@ -0,0 +1,1117 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_H +#define GNAP_H + +#include "common/array.h" +#include "common/events.h" +#include "common/file.h" +#include "common/memstream.h" +#include "common/random.h" +#include "common/str.h" +#include "common/substream.h" +#include "common/system.h" +#include "common/winexe.h" +#include "common/winexe_pe.h" +#include "engines/engine.h" +#include "graphics/pixelformat.h" +#include "graphics/wincursor.h" + +#include "gnap/resource.h" + +struct ADGameDescription; + +namespace Gnap { + +class DatManager; +class SequenceResource; +class SpriteResource; +class GameSys; +class SoundMan; + +struct MouseButtonState { + bool left; + bool right; + bool middle; + MouseButtonState() : left(false), right(false), middle(false) { + } +}; + +struct Hotspot { + int16 x1, y1, x2, y2; + int16 field_10; + int16 field_12; + uint16 flags; + int id; + bool isPointInside(int16 x, int16 y) const { + return x >= x1 && x <= x2 && y >= y1 && y <= y2; + } + bool isFlag(uint16 flag) const { + return (flags & flag) != 0; + } +}; + +struct GridStruct { + int deltaX, deltaY; + int gridX1, gridY1; + int sequenceId; + int id; +}; + +const int kMaxGridStructs = 30; +const int kMaxTimers = 10; + +enum { + SF_LOOK_CURSOR = 0x0001, + SF_GRAB_CURSOR = 0x0002, + SF_TALK_CURSOR = 0x0004, + SF_PLAT_CURSOR = 0x0008, + SF_DISABLED = 0x0010, + SF_WALKABLE = 0x0020, + SF_EXIT_L_CURSOR = 0x0040, + SF_EXIT_R_CURSOR = 0x0080, + SF_EXIT_U_CURSOR = 0x0100, + SF_EXIT_D_CURSOR = 0x0200, + SF_EXIT_NW_CURSOR = 0x0400, + SF_EXIT_NE_CURSOR = 0x0800, + SF_EXIT_SW_CURSOR = 0x1000, + SF_EXIT_SE_CURSOR = 0x2000 +}; + +enum { + LOOK_CURSOR = 0, + GRAB_CURSOR = 1, + TALK_CURSOR = 2, + PLAT_CURSOR = 3, + NOLOOK_CURSOR = 4, + NOGRAB_CURSOR = 5, + NOTALK_CURSOR = 6, + NOPLAT_CURSOR = 7, + EXIT_L_CURSOR = 8, + EXIT_R_CURSOR = 9, + EXIT_U_CURSOR = 10, + EXIT_D_CURSOR = 11, + EXIT_NE_CURSOR = 12, + EXIT_NW_CURSOR = 13, + EXIT_SE_CURSOR = 14, + EXIT_SW_CURSOR = 15, + WAIT_CURSOR = 16 +}; + +enum { + gskPullOutDevice = 0, + gskPullOutDeviceNonWorking = 1, + gskIdle = 2, + gskBrainPulsating = 3, + gskImpossible = 4, + gskScratchingHead = 5, + gskDeflect = 6, + gskUseDevice = 7, + gskMoan1 = 8, + gskMoan2 = 9 +}; + +enum { + kItemMagazine = 0, + kItemMud = 1, + kItemGrass = 2, + kItemDisguise = 3, + kItemNeedle = 4, + kItemTwig = 5, + kItemGas = 6, + kItemKeys = 7, + kItemDice = 8, + kItemTongs = 9, + kItemQuarter = 10, + kItemQuarterWithHole = 11, + kItemDiceQuarterHole = 12, + kItemWrench = 13, + kItemCowboyHat = 14, + kItemGroceryStoreHat = 15, + kItemBanana = 16, + kItemTickets = 17, + kItemPicture = 18, + kItemEmptyBucket = 19, + kItemBucketWithBeer = 20, + kItemBucketWithPill = 21, + kItemPill = 22, + kItemHorn = 23, + kItemJoint = 24, + kItemChickenBucket = 25, + kItemGum = 26, + kItemSpring = 27, + kItemLightbulb = 28, + kItemCereals = 29 +}; + +enum { + kGFPlatypus = 0, + kGFMudTaken = 1, + + + kGFEnd +}; + +/* + Game flags + 0 1 With Platypus + 1 2 Mud taken + 2 4 Needle taken + 3 8 Twig taken + 4 0x10 + 5 0x20 Keys taken + 6 0x40 Grass taken + 7 0x80 Barn padlock open + 8 0x100 Truck filled with gas + 9 0x200 Truck keys used + 10 0x400 Platypus disguised + 11 0x800 Scene flag 1 + 12 0x1000 Gnap controls toy ufo + 13 0x2000 + 14 0x4000 + 15 0x8000 Spring taken + 16 0x10000 + 17 0x20000 Joint taken + 18 0x40000 + 19 0x80000 Grocery store hat taken + 20 0x100000 Picture taken + 21 0x200000 + 22 0x400000 + 23 0x800000 + 24 0x1000000 + 25 0x2000000 + 26 0x4000000 Platypus talking with toy shop assistant + 27 0x8000000 + 28 0x10000000 + 29 0x20000000 Gas taken + 30 0x40000000 + 31 0x80000000 + + +*/ + + // 0x7AB Gnap walks to the right 1 + // 0x7AC Gnap walks to the right 2 + // 0x7AF Gnap walks to the left 1 + // 0x7B0 Gnap walks to the left 2 + +struct Scene49Obstacle { + int currSequenceId; + int closerSequenceId; + int passedSequenceId; + int splashSequenceId; + int collisionSequenceId; + int prevId; + int currId; + int laneNum; +}; + +struct Scene51Item { + int currSequenceId; + int droppedSequenceId; + int x, y; + int collisionX; + int canCatch; + int isCollision; + int x2; + int id; +}; + +class GnapEngine : public Engine { +protected: + Common::Error run(); + virtual bool hasFeature(EngineFeature f) const; +public: + GnapEngine(OSystem *syst, const ADGameDescription *gd); + ~GnapEngine(); +private: + const ADGameDescription *_gameDescription; + Graphics::PixelFormat _pixelFormat; +public: + Common::RandomSource *_random; + + Common::PEResources *_exe; + + DatManager *_dat; + SpriteCache *_spriteCache; + SoundCache *_soundCache; + SequenceCache *_sequenceCache; + GameSys *_gameSys; + SoundMan *_soundMan; + + int _lastUpdateClock; + + int _debugLevel; + bool _gameDone; + + byte _keyPressState[512]; + byte _keyDownState[512]; + + bool _isPaused; + Graphics::Surface *_pauseSprite; + int _timers[kMaxTimers], _savedTimers[kMaxTimers]; + + MouseButtonState _mouseButtonState; + MouseButtonState _mouseClickState; + + uint32 _keyStatus1[2]; + + bool _sceneSavegameLoaded, _wasSavegameLoaded; + + Graphics::Surface *_backgroundSurface; + int _prevSceneNum, _currentSceneNum, _newSceneNum; + bool _sceneDone, _sceneWaiting; + + uint32 _inventory, _gameFlags; + + Hotspot _hotspots[20]; + Common::Point _hotspotsWalkPos[20]; + int _hotspotsCount; + int _sceneClickedHotspot; + + bool _isWaiting; + bool _isLeavingScene; + + bool _isStockDatLoaded; + + int _newCursorValue, _cursorValue; + + int _verbCursor, _cursorIndex; + int _mouseX, _mouseY; + int _leftClickMouseX, _leftClickMouseY; + + Graphics::Surface *_grabCursorSprite; + int _currGrabCursorX, _currGrabCursorY; + int _grabCursorSpriteIndex, _newGrabCursorSpriteIndex; + + Graphics::Surface *_fullScreenSprite; + int _fullScreenSpriteId; + + int _deviceX1, _deviceY1, _deviceX2, _deviceY2; + + int _soundTimerIndexA; + int _soundTimerIndexB; + int _soundTimerIndexC; + int _idleTimerIndex; + + void updateEvents(); + void gameUpdateTick(); + void saveTimers(); + void restoreTimers(); + + void pauseGame(); + void resumeGame(); + void updatePause(); + + int getRandom(int max); + + int readSavegameDescription(int savegameNum, Common::String &description); + int loadSavegame(int savegameNum); + + void delayTicks(int a1); + void delayTicksCursor(int a1); + + void setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags = 0, + int16 walkX = -1, int16 walkY = -1); + int getHotspotIndexAtPos(int16 x, int16 y); + void updateCursorByHotspot(); + int getClickedHotspotId(); + + int getInventoryItemSpriteNum(int index); + + void updateMouseCursor(); + void setVerbCursor(int verbCursor); + void setCursor(int cursorIndex); + void showCursor(); + void hideCursor(); + + void setGrabCursorSprite(int index); + void createGrabCursorSprite(int spriteId); + void freeGrabCursorSprite(); + void updateGrabCursorSprite(int x, int y); + + void invClear(); + void invAdd(int itemId); + void invRemove(int itemId); + bool invHas(int itemId); + + void clearFlags(); + void setFlag(int num); + void clearFlag(int num); + bool isFlag(int num); + + Graphics::Surface *addFullScreenSprite(int resourceId, int id); + void removeFullScreenSprite(); + void showFullScreenSprite(int resourceId); + + void queueInsertDeviceIcon(); + void insertDeviceIconActive(); + void removeDeviceIconActive(); + void setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int y2); + + int getSequenceTotalDuration(int resourceId); + + bool isSoundPlaying(int resourceId); + void playSound(int resourceId, bool looping); + void stopSound(int resourceId); + void setSoundVolume(int resourceId, int volume); + + void updateTimers(); + + void initGameFlags(int num); + void loadStockDat(); + + void mainLoop(); + void initScene(); + void endSceneInit(); + void afterScene(); + + int initSceneLogic(); + void runSceneLogic(); + + void checkGameKeys(); + + void startSoundTimerA(int timerIndex); + int playSoundA(); + void startSoundTimerB(int timerIndex); + int playSoundB(); + void startSoundTimerC(int timerIndex); + int playSoundC(); + void startIdleTimer(int timerIndex); + void updateIdleTimer(); + + void screenEffect(int dir, byte r, byte g, byte b); + + bool isKeyStatus1(int key); + bool isKeyStatus2(int key); + void clearKeyStatus1(int key); + void clearAllKeyStatus1(); + + void deleteSurface(Graphics::Surface **surface); + + // Menu + int _menuStatus; + int _menuSpritesIndex; + bool _menuDone; + Graphics::Surface *_menuBackgroundSurface; + Graphics::Surface *_menuQuitQuerySprite; + Graphics::Surface *_largeSprite; + Graphics::Surface *_menuSaveLoadSprite; + Graphics::Surface *_menuSprite2; + Graphics::Surface *_menuSprite1; + char _savegameFilenames[7][30]; + Graphics::Surface *_savegameSprites[7]; + Graphics::Surface *_spriteHandle; + Graphics::Surface *_cursorSprite; + int _menuInventoryIndices[30]; + Graphics::Surface *_menuInventorySprites[30]; + int _savegameIndex; + void createMenuSprite(); + void freeMenuSprite(); + void initMenuHotspots1(); + void initMenuHotspots2(); + void initMenuQuitQueryHotspots(); + void initSaveLoadHotspots(); + void drawInventoryFrames(); + void insertInventorySprites(); + void removeInventorySprites(); + void runMenu(); + void updateMenuStatusInventory(); + void updateMenuStatusMainMenu(); + void updateMenuStatusSaveGame(); + void updateMenuStatusLoadGame(); + void updateMenuStatusQueryQuit(); + + // Grid common + int _gnapGridX, _gnapGridY; + int _platGridX, _platGridY; + int _gridMinX, _gridMinY; + int _gridMaxX, _gridMaxY; + bool isPointBlocked(int gridX, int gridY); + void initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gridMaxY); + bool testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2); + + // Gnap walking + int _gnapWalkNodesCount; + GridStruct _gnapWalkNodes[kMaxGridStructs]; + int _gnapX, _gnapY; + int _gnapWalkDestX, _gnapWalkDestY; + int _gnapWalkDeltaX, _gnapWalkDeltaY, _gnapWalkDirX, _gnapWalkDirY, _gnapWalkDirXIncr, _gnapWalkDirYIncr; + + int getGnapWalkSequenceId(int deltaX, int deltaY); + int getGnapWalkStopSequenceId(int deltaX, int deltaY); + int getGnapWalkFacing(int deltaX, int deltaY); + bool gridSub41F08B(int gridX, int gridY); + bool gridSub41F5FC(int gridX, int gridY, int index); + bool gridSub41FAD5(int gridX, int gridY, int index); + bool gnapFindPath3(int gridX, int gridY); + bool gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); + void gnapWalkStep(); + + // Beaver walking + int _platWalkNodesCount; + GridStruct _platWalkNodes[kMaxGridStructs]; + int _platX, _platY; + int _platWalkDestX, _platWalkDestY; + int _platWalkDeltaX, _platWalkDeltaY, _platWalkDirX, _platWalkDirY, _platWalkDirXIncr, _platWalkDirYIncr; + + int getBeaverWalkSequenceId(int deltaX, int deltaY); + bool gridSub423750(int gridX, int gridY); + bool gridSub423CC1(int gridX, int gridY, int index); + bool gridSub42419A(int gridX, int gridY, int index); + bool platFindPath3(int gridX, int gridY); + bool platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); + void platypusWalkStep(); + void beaverMakeRoom(); + + // Gnap + int _gnapIdleFacing; + int _gnapActionStatus; + int _gnapBrainPulseNum, _gnapBrainPulseRndValue; + int _gnapSequenceId, _gnapSequenceDatNum, _gnapId; + int _gnapRandomValue; + + int getGnapSequenceId(int kind, int gridX, int gridY); + int getGnapShowSequenceId(int index, int gridX, int gridY); + void gnapIdle(); + void gnapActionIdle(int sequenceId); + void playGnapSequence(int sequenceId); + void playGnapImpossible(int gridX, int gridY); + void playGnapScratchingHead(int gridX, int gridY); + void playGnapMoan1(int gridX, int gridY); + void playGnapMoan2(int gridX, int gridY); + void playGnapBrainPulsating(int gridX, int gridY); + void playGnapPullOutDevice(int gridX, int gridY); + void playGnapPullOutDeviceNonWorking(int gridX, int gridY); + void playGnapUseDevice(int gridX, int gridY); + void playGnapIdle(int gridX, int gridY); + void playGnapShowItem(int itemIndex, int gridLookX, int gridLookY); + void playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); + void updateGnapIdleSequence(); + void updateGnapIdleSequence2(); + void initGnapPos(int gridX, int gridY, int facing); + void gnapInitBrainPulseRndValue(); + void gnapUseDeviceOnBeaver(); + void doCallback(int callback); + bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); + void gnapKissPlatypus(int callback); + void gnapUseJointOnPlatypus(); + void gnapUseDisguiseOnPlatypus(); + + // Beaver + int _beaverFacing; + int _beaverActionStatus; + int _beaverSequenceId, _beaverSequenceDatNum, _beaverId; + int getBeaverSequenceId(int kind, int gridX, int gridY); + void playBeaverSequence(int sequenceId); + void updateBeaverIdleSequence(); + void beaverSub426234(); + void initBeaverPos(int gridX, int gridY, int facing); + + // Scenes + + int _toyUfoNextSequenceId, _toyUfoSequenceId; + int _toyUfoId; + int _toyUfoActionStatus; + int _toyUfoX; + int _toyUfoY; + + void initGlobalSceneVars(); + + bool sceneXX_sub_4466B1(); + void sceneXX_playRandomSound(int timerIndex); + void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); + + // Scene 0 + int scene00_init(); + + // Scene 1 + int _s01_pigsIdCtr, _s01_smokeIdCtr; + Graphics::Surface *_s01_spaceshipSurface; + int scene01_init(); + void scene01_updateHotspots(); + void scene01_run(); + void scene01_updateAnimations(); + + // Scene 2 + int _s02_truckGrillCtr; + int _s02_nextChickenSequenceId, _s02_currChickenSequenceId; + int _s02_gnapTruckSequenceId; + int scene02_init(); + void scene02_updateHotspots(); + void scene02_run(); + void scene02_updateAnimations(); + + // Scene 3 + bool _s03_platypusHypnotized; + bool _s03_platypusScared; + int _s03_nextPlatSequenceId; + int _s03_nextFrogSequenceId, _s03_currFrogSequenceId; + int scene03_init(); + void scene03_updateHotspots(); + void scene03_run(); + void scene03_updateAnimations(); + + // Scene 4 + bool _s04_triedWindow; + int _s04_dogIdCtr; + int _s04_nextDogSequenceId, _s04_currDogSequenceId; + int scene04_init(); + void scene04_updateHotspots(); + void scene04_run(); + void scene04_updateAnimations(); + + // Scene 5 + int _s05_nextChickenSequenceId, _s05_currChickenSequenceId; + int scene05_init(); + void scene05_updateHotspots(); + void scene05_run(); + void scene05_updateAnimations(); + + // Scene 6 + bool _s06_horseTurnedBack; + int _s06_nextPlatSequenceId; + int _s06_nextHorseSequenceId, _s06_currHorseSequenceId; + int scene06_init(); + void scene06_updateHotspots(); + void scene06_run(); + void scene06_updateAnimations(); + + // Scene 7 + int scene07_init(); + void scene07_updateHotspots(); + void scene07_run(); + void scene07_updateAnimations(); + + // Scene 8 + int _s08_nextDogSequenceId, _s08_currDogSequenceId; + int _s08_nextManSequenceId, _s08_currManSequenceId; + int scene08_init(); + void scene08_updateHotspots(); + void scene08_updateAnimationsCb(); + void scene08_run(); + void scene08_updateAnimations(); + + // Scene 9 + int scene09_init(); + void scene09_updateHotspots(); + void scene09_run(); + void scene09_updateAnimations(); + + // Scene 10 + int _s10_nextCookSequenceId, _s10_currCookSequenceId; + int scene10_init(); + void scene10_updateHotspots(); + void scene10_run(); + void scene10_updateAnimations(); + void scene10_updateAnimationsCb(); + + // Scene 11 + int _s11_billardBallCtr; + int _s11_nextHookGuySequenceId, _s11_currHookGuySequenceId; + int _s11_nextGoggleGuySequenceId, _s11_currGoggleGuySequenceId; + int scene11_init(); + void scene11_updateHotspots(); + void scene11_run(); + void scene11_updateAnimations(); + + // Scene 12 + int _s12_nextBeardGuySequenceId, _s12_currBeardGuySequenceId; + int _s12_nextToothGuySequenceId, _s12_currToothGuySequenceId; + int _s12_nextBarkeeperSequenceId, _s12_currBarkeeperSequenceId; + int scene12_init(); + void scene12_updateHotspots(); + void scene12_run(); + void scene12_updateAnimations(); + + // Scene 13 + int _s13_backToiletCtr; + int scene13_init(); + void scene13_updateHotspots(); + void scene13_showScribble(); + void scene13_run(); + void scene13_updateAnimations(); + + // Scene 14 + int scene14_init(); + void scene14_updateHotspots(); + void scene14_run(); + void scene14_updateAnimations(); + + // Scene 15 + int _s15_nextRecordSequenceId, _s15_currRecordSequenceId; + int _s15_nextSlotSequenceId, _s15_currSlotSequenceId; + int _s15_nextUpperButtonSequenceId, _s15_currUpperButtonSequenceId; + int _s15_nextLowerButtonSequenceId, _s15_currLowerButtonSequenceId; + int scene15_init(); + void scene15_updateHotspots(); + void scene15_run(); + void scene15_updateAnimations(); + + // Scene 16 + void scene16_initCutscene(); + + // Scene 17 + bool _s17_canTryGetWrench; + int _s17_wrenchCtr, _s17_platPhoneCtr, _s17_platTryGetWrenchCtr; + int _s17_nextPhoneSequenceId, _s17_currPhoneSequenceId; + int _s17_nextWrenchSequenceId, _s17_currWrenchSequenceId; + int _s17_nextCarWindowSequenceId, _s17_currCarWindowSequenceId; + int scene17_init(); + void scene17_updateHotspots(); + void scene17_update(); + void scene17_platHangUpPhone(); + void scene17_run(); + void scene17_updateAnimations(); + + // Scene 18 + int _s18_garbageCanPos; + int _s18_platPhoneCtr; + int _s18_platPhoneIter; + int _s18_nextPhoneSequenceId, _s18_currPhoneSequenceId; + Graphics::Surface *_s18_cowboyHatSurface; + int scene18_init(); + void scene18_updateHotspots(); + void scene18_gnapCarryGarbageCanTo(int a1, int arg4, int animationIndex, int argC, int a5); + void scene18_putDownGarbageCan(int animationIndex); + void scene18_platEndPhoning(int a1); + void scene18_closeHydrantValve(); + void scene18_waitForGnapAction(); + void scene18_run(); + void scene18_updateAnimations(); + + // Scene 19 + int _s19_currShopAssistantSequenceId, _s19_nextShopAssistantSequenceId; + int _s19_toyGrabCtr; + int _s19_shopAssistantCtr; + Graphics::Surface *_s19_pictureSurface; + int scene19_init(); + void scene19_updateHotspots(); + void scene19_run(); + void scene19_updateAnimations(); + + // Scene 20 + int _s20_currStonerGuySequenceId, _s20_nextStonerGuySequenceId; + int _s20_currGroceryStoreGuySequenceId, _s20_nextGroceryStoreGuySequenceId; + int _s20_stonerGuyCtr; + bool _s20_stonerGuyShowingJoint; + int _s20_groceryStoreGuyCtr; + int scene20_init(); + void scene20_updateHotspots(); + void scene20_updateAnimationsCb(); + void scene20_stopSounds(); + void scene20_run(); + void scene20_updateAnimations(); + + // Scene 21 + int _s21_currOldLadySequenceId, _s21_nextOldLadySequenceId; + int scene21_init(); + void scene21_updateHotspots(); + void scene21_run(); + void scene21_updateAnimations(); + + // Scene 22 + int _s22_currCashierSequenceId, _s22_nextCashierSequenceId; + bool _s22_caughtBefore; + int _s22_cashierCtr; + int scene22_init(); + void scene22_updateHotspots(); + void scene22_run(); + void scene22_updateAnimations(); + + // Scene 23 + int _s23_currStoreClerkSequenceId, _s23_nextStoreClerkSequenceId; + int scene23_init(); + void scene23_updateHotspots(); + void scene23_run(); + void scene23_updateAnimations(); + + // Scene 24 + int _s24_currWomanSequenceId, _s24_nextWomanSequenceId; + int _s24_boySequenceId; + int _s24_girlSequenceId; + int scene24_init(); + void scene24_updateHotspots(); + void scene24_run(); + void scene24_updateAnimations(); + + // Scene 25 + int _s25_currTicketVendorSequenceId, _s25_nextTicketVendorSequenceId; + int scene25_init(); + void scene25_updateHotspots(); + void scene25_playAnims(int index); + void scene25_run(); + void scene25_updateAnimations(); + + // Scene 26 + int _s26_currKidSequenceId, _s26_nextKidSequenceId; + int scene26_init(); + void scene26_updateHotspots(); + void scene26_run(); + void scene26_updateAnimations(); + + // Scene 27 + int _s27_nextJanitorSequenceId; + int _s27_currJanitorSequenceId; + int scene27_init(); + void scene27_updateHotspots(); + void scene27_run(); + void scene27_updateAnimations(); + + // Scene 28 + int _s28_dword_47EA5C; + int _s28_dword_47EA60; + int _s28_dword_474938; + int scene28_init(); + void scene28_updateHotspots(); + void scene28_run(); + void scene28_updateAnimations(); + + // Scene 29 + int _s29_dword_47EA74; + int _s29_dword_47EA78; + int _s29_dword_47EA7C; + int _s29_dword_47EA80; + int scene29_init(); + void scene29_updateHotspots(); + void scene29_run(); + void scene29_updateAnimations(); + + // Scene 30 + int _s30_dword_47EA88; + int _s30_dword_47EA8C; + int scene30_init(); + void scene30_updateHotspots(); + void scene30_run(); + void scene30_updateAnimations(); + + // Scene 31 + int _s31_dword_47EAA8; + int _s31_dword_47EAAC; + int _s31_dword_47EAB0; + bool _s31_beerGuyDistracted; + int _s31_dword_474940; + int _s31_dword_47EAB4; + int scene31_init(); + void scene31_updateHotspots(); + void scene31_run(); + void scene31_updateAnimations(); + + // Scene 32 + int _s32_dword_47EADC; + int scene32_init(); + void scene32_updateHotspots(); + void scene32_run(); + void scene32_updateAnimations(); + + int _s33_dword_47EAE4; + int _s33_dword_47EAE8; + int _s33_dword_47EAEC; + int scene33_init(); + void scene33_updateHotspots(); + void scene33_run(); + void scene33_updateAnimations(); + + // Scene 38 + int scene38_init(); + void scene38_updateHotspots(); + void scene38_run(); + void scene38_updateAnimations(); + + // Scene 39 + int _s39_dword_47EAF8; + int _s39_dword_47EAFC; + int scene39_init(); + void scene39_updateHotspots(); + void scene39_run(); + void scene39_updateAnimations(); + + // Scene 40 + int scene40_init(); + void scene40_updateHotspots(); + void scene40_run(); + void scene40_updateAnimations(); + + // Scene 4x + void toyUfoSetStatus(int a1); + int toyUfoGetSequenceId(); + bool toyUfoCheckTimer(); + void toyUfoFlyTo(int destX, int destY, int a3, int a4, int a5, int a6, int animationIndex); + + // Scene 41 + int _s41_dword_47F2C0; + int _s41_dword_47F2C4; + int _s41_dword_47F2C8; + int _s41_dword_47F2CC; + int scene41_init(); + void scene41_updateHotspots(); + void scene41_run(); + void scene41_updateAnimations(); + + // Scene 42 + int _s42_dword_47F2B8; + int _s42_dword_47F2BC; + int scene42_init(); + void scene42_updateHotspots(); + void scene42_run(); + void scene42_updateAnimations(); + + // Scene 43 + int _s43_dword_47F2B0; + int _s43_dword_47F2B4; + int scene43_init(); + void scene43_updateHotspots(); + void scene43_run(); + void scene43_updateAnimations(); + + // Scene 44 + int _s44_dword_47EB04; + int _s44_dword_47EB08; + int _s44_dword_47EB0C; + int _s44_dword_47EB10; + int scene44_init(); + void scene44_updateHotspots(); + void scene44_run(); + void scene44_updateAnimations(); + + // Scene 45 + int _s45_dword_4749BC; + int _s45_dword_4749C0; + int scene45_init(); + void scene45_updateHotspots(); + void scene45_run(); + void scene45_updateAnimations(); + + // Scene 46 + int _s46_dword_47EB18; + int _s46_dword_47EB1C; + int _s46_dword_47EB20; + int _s46_dword_47EB24; + int scene46_init(); + void scene46_updateHotspots(); + void scene46_run(); + void scene46_updateAnimations(); + + // Scene 47 + void scene47_initCutscene1(); + void scene47_initCutscene2(); + void scene47_initCutscene3(); + void scene47_initCutscene4(); + void scene47_initCutscene5(); + void scene47_initCutscene6(); + void scene47_initCutscene7(); + + // Scene 48 + void scene48_initCutscene(); + + // Scene 49 + int _s49_scoreBarPos, _s49_scoreLevel, _s49_scoreBarFlash; + int _s49_obstacleIndex; + Scene49Obstacle _s49_obstacles[5]; + int _s49_truckSequenceId, _s49_truckId, _s49_truckLaneNum; + int scene49_init(); + void scene49_updateHotspots(); + void scene49_checkObstacles(); + void scene49_updateObstacle(int i); + void scene49_increaseScore(int amount); + void scene49_decreaseScore(int amount); + void scene49_refreshScoreBar(); + void scene49_clearObstacle(int index); + void scene49_run(); + void scene49_updateAnimations(); + + // Scene 50 + bool _s50_fightDone; + int _s50_timesPlayed, _s50_timesPlayedModifier; + int _s50_attackCounter; + int _s50_roundNum, _s50_timeRemaining; + int _s50_leftTongueRoundsWon, _s50_rightTongueRoundsWon; + int _s50_leftTongueEnergyBarPos, _s50_rightTongueEnergyBarPos; + int _s50_leftTongueSequenceId, _s50_leftTongueId; + int _s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueNextIdCtr; + int _s50_rightTongueSequenceId, _s50_rightTongueId; + int _s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueNextIdCtr; + int _s50_leftTongueEnergy, _s50_rightTongueEnergy; + int scene50_init(); + void scene50_updateHotspots(); + bool scene50_tongueWinsRound(int tongueNum); + void scene50_playWinAnim(int tongueNum, bool fightOver); + void scene50_delayTicks(); + void scene50_initRound(); + bool scene50_updateCountdown(); + void scene50_drawCountdown(int value); + void scene50_playTonguesIdle(); + void scene50_playRoundAnim(int roundNum); + bool scene50_updateEnergyBars(int newLeftBarPos, int newRightBarPos); + void scene50_waitForAnim(int animationIndex); + int scene50_checkInput(); + int scene50_getRightTongueAction(); + void scene50_updateAnimations(); + int scene50_getRightTongueActionTicks(); + int scene50_getLeftTongueNextId(); + int scene50_getRightTongueNextId(); + void scene50_playWinBadgeAnim(int tongueNum); + void scene50_run(); + + // Scene 51 + int _s51_cashAmount; + int _s51_digits[4]; + int _s51_digitSequenceIds[4]; + int _s51_guySequenceId, _s51_guyNextSequenceId; + int _s51_itemsCaughtCtr; + int _s51_dropSpeedTicks; + int _s51_nextDropItemKind, _s51_itemInsertX, _s51_itemInsertDirection; + int _s51_platypusSequenceId, _s51_platypusNextSequenceId, _s51_platypusJumpSequenceId; + bool _s51_dropLoseCash; + int _s51_itemsCtr,_s51_itemsCtr1, _s51_itemsCtr2; + Scene51Item _s51_items[6]; + + int scene51_init(); + void scene51_updateHotspots(); + void scene51_clearItem(Scene51Item *item); + void scene51_dropNextItem(); + void scene51_updateItemAnimations(); + int scene51_checkCollision(int sequenceId); + void scene51_updateItemAnimation(Scene51Item *item, int index); + void scene51_removeCollidedItems(); + int scene51_itemIsCaught(Scene51Item *item); + bool scene51_isJumpingRight(int sequenceId); + bool scene51_isJumpingLeft(int sequenceId); + bool scene51_isJumping(int sequenceId); + void scene51_waitForAnim(int animationIndex); + int scene51_getPosRight(int sequenceId); + int scene51_getPosLeft(int sequenceId); + void scene51_playIntroAnim(); + void scene51_updateGuyAnimation(); + int scene51_incCashAmount(int sequenceId); + void scene51_winMinigame(); + void scene51_playCashAppearAnim(); + void scene51_updateCash(int amount); + void scene51_drawDigit(int digit, int position); + void scene51_initCashDisplay(); + void scene51_run(); + + // Scene 52 + int _s52_liveAlienRows; + int _s52_gameScore; + bool _s52_soundToggle; + int _s52_arcadeScreenLeft; + int _s52_arcadeScreenRight; + int _s52_arcadeScreenBottom; + int _s52_shipsLeft; + int _s52_shieldSpriteIds[3]; + int _s52_shieldPosX[3]; + int _s52_shipPosX; + int _s52_shipCannonFired, _s52_shipCannonPosX, _s52_shipCannonPosY; + int _s52_shipCannonFiring; + int _s52_shipCannonWidth, _s52_shipCannonHeight; + int _s52_shipCannonTopY; + int _s52_shipMidX, _s52_shipMidY; + bool _s52_shipFlag; + bool _s52_aliensInitialized; + int _s52_alienSpeed, _s52_alienDirection; + int _s52_alienWidth, _s52_alienHeight; + int _s52_alienLeftX, _s52_alienTopY; + int _s52_alienRowDownCtr; + int _s52_alienRowKind[7]; + int _s52_alienRowAnims[7]; + int _s52_alienRowIds[7]; + int _s52_alienRowXOfs[7]; + int _s52_alienCannonFired[3]; + int _s52_alienCannonPosX[3]; + int _s52_alienCannonPosY[3]; + int _s52_alienCannonSequenceIds[3]; + int _s52_alienCannonIds[3]; + bool _s52_alienWave, _s52_alienSingle; + int _s52_alienCounter; + bool _s52_bottomAlienFlag; + int _s52_aliensCount; + int _s52_items[8][5]; + int _s52_nextUfoSequenceId, _s52_ufoSequenceId; + int scene52_init(); + void scene52_updateHotspots(); + void scene52_update(); + void scene52_initShipCannon(int bottomY); + void scene52_initAlienCannons(); + void scene52_fireShipCannon(int posX); + void scene52_fireAlienCannon(); + int scene52_getFreeShipCannon(); + int scene52_getFreeAlienCannon(); + void scene52_updateShipCannon(); + void scene52_updateAlienCannons(); + void scene52_initAliens(); + void scene52_initAlienRowKind(int rowNum, int alienKind); + void scene52_insertAlienRow(int rowNum); + void scene52_insertAlienRowAliens(int rowNum); + void scene52_updateAlienRow(int rowNum); + void scene52_moveDownAlienRow(); + int scene52_updateHitAlien(); + int scene52_getHitAlienNum(int rowNum); + int scene52_alienCannonHitShip(int cannonNum); + int scene52_alienCannonHitShield(int cannonNum); + int scene52_shipCannonHitShield(int cannonNum); + int scene52_shipCannonHitAlien(); + void scene52_shipExplode(); + int scene52_checkAlienRow(int a1); + void scene52_updateAlienRowXOfs(); + void scene52_initAlienSize(); + void scene52_playSound(); + void scene52_updateAliens(); + void scene52_updateAlien(int rowNum); + void scene52_loseShip(); + void scene52_initShields(); + void scene52_initAnims(); + void scene52_drawScore(int a1); + void scene52_run(); + + // Scene 53 + int _s53_currHandSequenceId; + bool _s53_isGnapPhoning; + int _s53_callsMadeCtr; + uint _s53_callsRndUsed; + int scene53_init(); + void scene53_updateHotspots(); + int scene53_pressPhoneNumberButton(int phoneNumber, int buttonNum); + int scene53_getRandomCallIndex(); + void scene53_runRandomCall(); + void scene53_runChitChatLine(); + void scene53_run(); + + // Scene 54 + void scene54_initCutscene1(); + void scene54_initCutscene2(); + + // Scene 99 + int _s99_itemsCount; + int _s99_dword_47F2F0[16]; + int _s99_dword_47F330[16]; + int _s99_dword_47F370[50]; + byte _s99_canSkip[16]; + int cutscene_init(); + void cutscene_run(); + +}; + +} // End of namespace Gnap + +#endif // GNAP_H diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp new file mode 100644 index 0000000000..522c72c491 --- /dev/null +++ b/engines/gnap/grid.cpp @@ -0,0 +1,1392 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/datarchive.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +void GnapEngine::initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gridMaxY) { + _gridMinX = gridMinX; + _gridMinY = gridMinY; + _gridMaxX = gridMaxX; + _gridMaxY = gridMaxY; + _gnapGridX = 410 - gridMinX; + _gnapGridY = 450 - gridMinY; + _platGridX = 396 - gridMinX; + _platGridY = 347 - gridMinY; +} + +int GnapEngine::getGnapWalkSequenceId(int deltaX, int deltaY) { + static const int _gnapWalkSequenceIds[9] = { + 0x7B2, 0x000, 0x7B4, + 0x7AD, 0x000, 0x7AE, + 0x7B1, 0x000, 0x7B3 + }; + // CHECKME This is a little weird + return _gnapWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + +int GnapEngine::getGnapWalkStopSequenceId(int deltaX, int deltaY) { + static const int _gnapWalkStopSequenceIds[9] = { + 0x7BC, 0x7BA, 0x7BA, + 0x7BC, 0x000, 0x7BA, + 0x7BB, 0x7B9, 0x7B9 + }; + // CHECKME This is a little weird + return _gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + +int GnapEngine::getGnapWalkFacing(int deltaX, int deltaY) { + static const int _gnapWalkFacings[9] = { + 5, 3, 3, + 5, 0, 3, + 7, 1, 1 + }; + // CHECKME This is a little weird + return _gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; +} + +bool GnapEngine::isPointBlocked(int gridX, int gridY) { + + if (gridX < 0 || gridX >= _gridMaxX || gridY < 0 || gridY >= _gridMaxY) + return true; + + if ((gridX == _gnapX && gridY == _gnapY) || (gridX == _platX && gridY == _platY)) + return true; + + const int x = _gridMinX + 75 * gridX; + const int y = _gridMinY + 48 * gridY; + + for (int i = 0; i < _hotspotsCount; ++i) { + if (x >= _hotspots[i].x1 && x <= _hotspots[i].x2 && + y >= _hotspots[i].y1 && y <= _hotspots[i].y2 && + !(_hotspots[i].flags & SF_WALKABLE)) + return true; + } + + return false; + +} + +bool GnapEngine::gridSub41F08B(int gridX, int gridY) { + bool result = false; + + _gnapWalkNodesCount = 0; + _gnapWalkDirXIncr = 0; + _gnapWalkDirYIncr = 0; + _gnapWalkDeltaX = ABS(_gnapWalkDestX - gridX); + _gnapWalkDeltaY = ABS(_gnapWalkDestY - gridY); + + if (_gnapWalkDeltaX) + _gnapWalkDirX = (_gnapWalkDestX - gridX) / _gnapWalkDeltaX; + else + _gnapWalkDirX = 0; + + if (_gnapWalkDeltaY) + _gnapWalkDirY = (_gnapWalkDestY - gridY) / _gnapWalkDeltaY; + else + _gnapWalkDirY = 0; + + while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirXIncr; + ++_gnapWalkDirYIncr; + } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { + if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + } else { + _gnapWalkDeltaX = _gnapWalkDirXIncr; + _gnapWalkDeltaY = _gnapWalkDirYIncr; + --_gnapWalkNodesCount; + } + } else { + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + } else { + _gnapWalkDeltaX = _gnapWalkDirXIncr; + _gnapWalkDeltaY = _gnapWalkDirYIncr; + --_gnapWalkNodesCount; + } + } + ++_gnapWalkNodesCount; + } + + while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = _gnapWalkDestY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDestY)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + ++_gnapWalkNodesCount; + } else { + _gnapWalkDeltaX = _gnapWalkDirXIncr; + } + } + + while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = _gnapWalkDestX; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + ++_gnapWalkNodesCount; + } else { + _gnapWalkDeltaY = _gnapWalkDirYIncr; + } + } + + if (gridX + _gnapWalkDirX * _gnapWalkDirXIncr != _gnapWalkDestX || gridY + _gnapWalkDirY * _gnapWalkDirYIncr != _gnapWalkDestY) { + _gnapWalkDestX = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkDestY = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + result = false; + } else { + result = true; + } + + return result; +} + +bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { + _gnapWalkNodesCount = index; + _gnapWalkDirXIncr = 0; + _gnapWalkDirYIncr = 0; + _gnapWalkDeltaX = ABS(_gnapWalkDestX - gridX); + _gnapWalkDeltaY = ABS(_gnapWalkDestY - gridY); + + if (_gnapWalkDeltaX) + _gnapWalkDirX = (_gnapWalkDestX - gridX) / _gnapWalkDeltaX; + else + _gnapWalkDirX = 0; + + if (_gnapWalkDeltaY) + _gnapWalkDirY = (_gnapWalkDestY - gridY) / _gnapWalkDeltaY; + else + _gnapWalkDirY = 0; + + while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirXIncr; + ++_gnapWalkDirYIncr; + } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { + if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + } else + return false; + } else { + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + } else + return false; + } + ++_gnapWalkNodesCount; + } + + while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = _gnapWalkDestY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDestY)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + ++_gnapWalkNodesCount; + } else + return false; + } + + while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = _gnapWalkDestX; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + ++_gnapWalkNodesCount; + } else + return false; + } + + return true; +} + +bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { + _gnapWalkNodesCount = index; + _gnapWalkDirXIncr = 0; + _gnapWalkDirYIncr = 0; + _gnapWalkDeltaX = ABS(_gnapWalkDestX - gridX); + _gnapWalkDeltaY = ABS(_gnapWalkDestY - gridY); + + if (_gnapWalkDeltaX) + _gnapWalkDirX = (_gnapWalkDestX - gridX) / _gnapWalkDeltaX; + else + _gnapWalkDirX = 0; + + if (_gnapWalkDeltaY) + _gnapWalkDirY = (_gnapWalkDestY - gridY) / _gnapWalkDeltaY; + else + _gnapWalkDirY = 0; + + while (_gnapWalkDeltaY < _gnapWalkDeltaX - _gnapWalkDirXIncr) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, gridY)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + ++_gnapWalkNodesCount; + } else + return false; + } + + while (_gnapWalkDeltaX < _gnapWalkDeltaY - _gnapWalkDirYIncr) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(gridX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + ++_gnapWalkNodesCount; + } else + return false; + } + + while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirXIncr; + ++_gnapWalkDirYIncr; + } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { + if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + } else + return false; + } else { + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + } else + return false; + } + ++_gnapWalkNodesCount; + } + + while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = _gnapWalkDestY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDestY)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + ++_gnapWalkDirXIncr; + ++_gnapWalkNodesCount; + } else + return false; + } + + while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { + _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = _gnapWalkDestX; + _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + ++_gnapWalkDirYIncr; + ++_gnapWalkNodesCount; + } else + return false; + } + + return true; +} + +bool GnapEngine::gnapFindPath3(int gridX, int gridY) { + int gridIncr = 1; + bool done = false; + + while (!done && gridIncr < _gridMaxX) { + if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41F5FC(gridX + gridIncr, gridY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX + i; + _gnapWalkNodes[i].gridY1 = gridY; + _gnapWalkNodes[i].deltaX = 1; + _gnapWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41F5FC(gridX - gridIncr, gridY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX - i; + _gnapWalkNodes[i].gridY1 = gridY; + _gnapWalkNodes[i].deltaX = -1; + _gnapWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41F5FC(gridX, gridY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX; + _gnapWalkNodes[i].gridY1 = gridY + i; + _gnapWalkNodes[i].deltaX = 0; + _gnapWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41F5FC(gridX, gridY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX; + _gnapWalkNodes[i].gridY1 = gridY - i; + _gnapWalkNodes[i].deltaX = 0; + _gnapWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX + i; + _gnapWalkNodes[i].gridY1 = gridY + i; + _gnapWalkNodes[i].deltaX = 1; + _gnapWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX - i; + _gnapWalkNodes[i].gridY1 = gridY + i; + _gnapWalkNodes[i].deltaX = -1; + _gnapWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX + i; + _gnapWalkNodes[i].gridY1 = gridY - i; + _gnapWalkNodes[i].deltaX = 1; + _gnapWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX - i; + _gnapWalkNodes[i].gridY1 = gridY - i; + _gnapWalkNodes[i].deltaX = -1; + _gnapWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41FAD5(gridX + gridIncr, gridY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX + i; + _gnapWalkNodes[i].gridY1 = gridY; + _gnapWalkNodes[i].deltaX = 1; + _gnapWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41FAD5(gridX - gridIncr, gridY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX - i; + _gnapWalkNodes[i].gridY1 = gridY; + _gnapWalkNodes[i].deltaX = -1; + _gnapWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41FAD5(gridX, gridY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX; + _gnapWalkNodes[i].gridY1 = gridY + i; + _gnapWalkNodes[i].deltaX = 0; + _gnapWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41FAD5(gridX, gridY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX; + _gnapWalkNodes[i].gridY1 = gridY - i; + _gnapWalkNodes[i].deltaX = 0; + _gnapWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX + i; + _gnapWalkNodes[i].gridY1 = gridY + i; + _gnapWalkNodes[i].deltaX = 1; + _gnapWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX - i; + _gnapWalkNodes[i].gridY1 = gridY + i; + _gnapWalkNodes[i].deltaX = -1; + _gnapWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX + i; + _gnapWalkNodes[i].gridY1 = gridY - i; + _gnapWalkNodes[i].deltaX = 1; + _gnapWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _gnapWalkNodes[i].gridX1 = gridX - i; + _gnapWalkNodes[i].gridY1 = gridY - i; + _gnapWalkNodes[i].deltaX = -1; + _gnapWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + ++gridIncr; + } + + return done; +} + +bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { + + int datNum = flags & 3; + bool done = false; + + _timers[2] = 200; + _timers[3] = 300; + + if (gridX < 0) + gridX = (_leftClickMouseX - _gridMinX + 37) / 75; + + if (gridY < 0) + gridY = (_leftClickMouseY - _gridMinY + 24) / 48; + + _gnapWalkDestX = CLIP(gridX, 0, _gridMaxX - 1); + _gnapWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); + + if (animationIndex >= 0 && _gnapWalkDestX == _platX && _gnapWalkDestY == _platY) + beaverMakeRoom(); + + if (gridSub41F5FC(_gnapX, _gnapY, 0)) + done = true; + + if (!done && gridSub41FAD5(_gnapX, _gnapY, 0)) + done = true; + + if (!done && gnapFindPath3(_gnapX, _gnapY)) + done = true; + + if (!done && gridSub41F08B(_gnapX, _gnapY)) + done = true; + + gnapIdle(); + + int gnapSequenceId = _gnapSequenceId; + int gnapId = _gnapId; + int gnapSequenceDatNum = _gnapSequenceDatNum; + + debug(0, "_gnapWalkNodesCount: %d", _gnapWalkNodesCount); + + for (int index = 0; index < _gnapWalkNodesCount; ++index) { + _gnapWalkNodes[index].id = index + 20 * _gnapWalkNodes[index].gridY1; + if (_gnapWalkNodes[index].deltaX == 1 && _gnapWalkNodes[index].deltaY == 0) { + if (index % 2) { + _gameSys->insertSequence(makeRid(datNum, 0x7AB), _gnapWalkNodes[index].id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + _gnapWalkNodes[index].sequenceId = 0x7AB; + gnapSequenceId = 0x7AB; + } else { + _gameSys->insertSequence(makeRid(datNum, 0x7AC), _gnapWalkNodes[index].id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + _gnapWalkNodes[index].sequenceId = 0x7AC; + gnapSequenceId = 0x7AC; + } + } else if (_gnapWalkNodes[index].deltaX == -1 && _gnapWalkNodes[index].deltaY == 0) { + if (index % 2) { + _gameSys->insertSequence(makeRid(datNum, 0x7AF), _gnapWalkNodes[index].id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + _gnapWalkNodes[index].sequenceId = 0x7AF; + gnapSequenceId = 0x7AF; + } else { + _gameSys->insertSequence(makeRid(datNum, 0x7B0), _gnapWalkNodes[index].id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + _gnapWalkNodes[index].sequenceId = 0x7B0; + gnapSequenceId = 0x7B0; + } + } else { + if (_gnapWalkNodes[index].deltaY == -1) + _gnapWalkNodes[index].id -= 10; + else + _gnapWalkNodes[index].id += 10; + int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index].deltaX, _gnapWalkNodes[index].deltaY); + _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index].id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + _gnapWalkNodes[index].sequenceId = newSequenceId; + gnapSequenceId = newSequenceId; + } + gnapId = _gnapWalkNodes[index].id; + gnapSequenceDatNum = datNum; + } + + if (flags & 8) { + if (_gnapWalkNodesCount > 0) { + _gnapSequenceId = gnapSequenceId; + _gnapId = gnapId; + _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1].deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1].deltaY); + _gnapSequenceDatNum = datNum; + if (animationIndex >= 0) + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); + } else if (animationIndex >= 0) { + _gameSys->setAnimation(0x107D3, 1, animationIndex); + _gameSys->insertSequence(0x107D3, 1, 0, 0, 0, 0, 0, 0); + } + } else { + if (sequenceId >= 0 && sequenceId != -1) { + _gnapSequenceId = ridToEntryIndex(sequenceId); + _gnapSequenceDatNum = ridToDatIndex(sequenceId); + if (_gnapSequenceId == 0x7B9) { + _gnapIdleFacing = 1; + } else { + switch (_gnapSequenceId) { + case 0x7BA: + _gnapIdleFacing = 3; + break; + case 0x7BB: + _gnapIdleFacing = 7; + break; + case 0x7BC: + _gnapIdleFacing = 5; + break; + } + } + } else { + if (_gnapWalkNodesCount > 0) { + _gnapSequenceId = getGnapWalkStopSequenceId(_gnapWalkNodes[_gnapWalkNodesCount - 1].deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1].deltaY); + _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1].deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1].deltaY); + } else if (gridX >= 0 || gridY >= 0) { + switch (_gnapIdleFacing) { + case 1: + _gnapSequenceId = 0x7B9; + break; + case 3: + _gnapSequenceId = 0x7BA; + break; + case 7: + _gnapSequenceId = 0x7BB; + break; + default: + _gnapSequenceId = 0x7BC; + break; + } + } else { + int v10 = _leftClickMouseX - (_gridMinX + 75 * _gnapX); + int v11 = _leftClickMouseY - (_gridMinY + 48 * _gnapY); + if (_leftClickMouseX == _gridMinX + 75 * _gnapX) + ++v10; + if (_leftClickMouseY == _gridMinY + 48 * _gnapY) + v11 = 1; + _gnapSequenceId = getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); + _gnapIdleFacing = getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11)); + } + _gnapSequenceDatNum = datNum; + } + + if (animationIndex < 0) { + _gnapId = 20 * _gnapWalkDestY + 1; + } else { + _gnapId = _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY; + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY, animationIndex); + } + + if (flags & 4) { + _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + 9, 0, 0, 0); + } else { + _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + 9, 0, 75 * _gnapWalkDestX - _gnapGridX, 48 * _gnapWalkDestY - _gnapGridY); + } + + } + + _gnapX = _gnapWalkDestX; + _gnapY = _gnapWalkDestY; + + return done; +} + +void GnapEngine::gnapWalkStep() { + bool done = false; + for (int i = 1; i < _gridMaxX && !done; ++i) { + done = true; + if (!isPointBlocked(_gnapX + i, _gnapY)) + gnapWalkTo(_gnapX + i, _gnapY, -1, -1, 1); + else if (!isPointBlocked(_gnapX - i, _gnapY)) + gnapWalkTo(_gnapX - i, _gnapY, -1, -1, 1); + else if (!isPointBlocked(_gnapX, _gnapY + 1)) + gnapWalkTo(_gnapX, _gnapY + 1, -1, -1, 1); + else if (!isPointBlocked(_gnapX, _gnapY - 1)) + gnapWalkTo(_gnapX, _gnapY - 1, -1, -1, 1); + else if (!isPointBlocked(_gnapX + 1, _gnapY + 1)) + gnapWalkTo(_gnapX + 1, _gnapY + 1, -1, -1, 1); + else if (!isPointBlocked(_gnapX - 1, _gnapY + 1)) + gnapWalkTo(_gnapX - 1, _gnapY + 1, -1, -1, 1); + else if (!isPointBlocked(_gnapX + 1, _gnapY - 1)) + gnapWalkTo(_gnapX + 1, _gnapY - 1, -1, -1, 1); + else if (!isPointBlocked(_gnapX - 1, _gnapY - 1)) + gnapWalkTo(_gnapX - 1, _gnapY - 1, -1, -1, 1); + else + done = false; + } +} + +//////////////////////////////////////////////////////////////////////////////// + +int GnapEngine::getBeaverWalkSequenceId(int deltaX, int deltaY) { + static const int _beaverWalkSequenceIds[9] = { + 0x7C5, 0x000, 0x7C8, + 0x7C4, 0x000, 0x7C7, + 0x7C3, 0x000, 0x7C6 + }; + // CHECKME This is a little weird + return _beaverWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + +bool GnapEngine::gridSub423750(int gridX, int gridY) { + bool result = false; + + _platWalkNodesCount = 0; + _platWalkDirXIncr = 0; + _platWalkDirYIncr = 0; + _platWalkDeltaX = ABS(_platWalkDestX - gridX); + _platWalkDeltaY = ABS(_platWalkDestY - gridY); + + if (_platWalkDeltaX) + _platWalkDirX = (_platWalkDestX - gridX) / _platWalkDeltaX; + else + _platWalkDirX = 0; + + if (_platWalkDeltaY) + _platWalkDirY = (_platWalkDestY - gridY) / _platWalkDeltaY; + else + _platWalkDirY = 0; + + while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirXIncr; + ++_platWalkDirYIncr; + } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { + if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + } else { + _platWalkDeltaX = _platWalkDirXIncr; + _platWalkDeltaY = _platWalkDirYIncr; + --_platWalkNodesCount; + } + } else { + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + } else { + _platWalkDeltaX = _platWalkDirXIncr; + _platWalkDeltaY = _platWalkDirYIncr; + --_platWalkNodesCount; + } + } + ++_platWalkNodesCount; + } + + while (_platWalkDirXIncr < _platWalkDeltaX) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount].gridY1 = _platWalkDestY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDestY)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + ++_platWalkNodesCount; + } else { + _platWalkDeltaX = _platWalkDirXIncr; + } + } + + while (_platWalkDirYIncr < _platWalkDeltaY) { + _platWalkNodes[_platWalkNodesCount].gridX1 = _platWalkDestX; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + ++_platWalkNodesCount; + } else { + _platWalkDeltaY = _platWalkDirYIncr; + } + } + + if (gridX + _platWalkDirX * _platWalkDirXIncr != _platWalkDestX || gridY + _platWalkDirY * _platWalkDirYIncr != _platWalkDestY) { + _platWalkDestX = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkDestY = gridY + _platWalkDirY * _platWalkDirYIncr; + result = false; + } else { + result = true; + } + + return result; +} + +bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { + _platWalkNodesCount = index; + _platWalkDirXIncr = 0; + _platWalkDirYIncr = 0; + _platWalkDeltaX = ABS(_platWalkDestX - gridX); + _platWalkDeltaY = ABS(_platWalkDestY - gridY); + + if (_platWalkDeltaX) + _platWalkDirX = (_platWalkDestX - gridX) / _platWalkDeltaX; + else + _platWalkDirX = 0; + + if (_platWalkDeltaY) + _platWalkDirY = (_platWalkDestY - gridY) / _platWalkDeltaY; + else + _platWalkDirY = 0; + + while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirXIncr; + ++_platWalkDirYIncr; + } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { + if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + } else + return false; + } else { + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + } else + return false; + } + ++_platWalkNodesCount; + } + + while (_platWalkDirXIncr < _platWalkDeltaX) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount].gridY1 = _platWalkDestY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDestY)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + ++_platWalkNodesCount; + } else + return false; + } + + while (_platWalkDirYIncr < _platWalkDeltaY) { + _platWalkNodes[_platWalkNodesCount].gridX1 = _platWalkDestX; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + ++_platWalkNodesCount; + } else + return false; + } + + return true; +} + +bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { + _platWalkNodesCount = index; + _platWalkDirXIncr = 0; + _platWalkDirYIncr = 0; + _platWalkDeltaX = ABS(_platWalkDestX - gridX); + _platWalkDeltaY = ABS(_platWalkDestY - gridY); + + if (_platWalkDeltaX) + _platWalkDirX = (_platWalkDestX - gridX) / _platWalkDeltaX; + else + _platWalkDirX = 0; + + if (_platWalkDeltaY) + _platWalkDirY = (_platWalkDestY - gridY) / _platWalkDeltaY; + else + _platWalkDirY = 0; + + while (_platWalkDeltaY < _platWalkDeltaX - _platWalkDirXIncr) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, gridY)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + ++_platWalkNodesCount; + } else + return false; + } + + while (_platWalkDeltaX < _platWalkDeltaY - _platWalkDirYIncr) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(gridX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + ++_platWalkNodesCount; + } else + return false; + } + + while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirXIncr; + ++_platWalkDirYIncr; + } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { + if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + } else + return false; + } else { + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + } else + return false; + } + ++_platWalkNodesCount; + } + + while (_platWalkDirXIncr < _platWalkDeltaX) { + _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount].gridY1 = _platWalkDestY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDestY)) { + _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount].deltaY = 0; + ++_platWalkDirXIncr; + ++_platWalkNodesCount; + } else + return false; + } + + while (_platWalkDirYIncr < _platWalkDeltaY) { + _platWalkNodes[_platWalkNodesCount].gridX1 = _platWalkDestX; + _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { + _platWalkNodes[_platWalkNodesCount].deltaX = 0; + _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + ++_platWalkDirYIncr; + ++_platWalkNodesCount; + } else + return false; + } + + return true; +} + +bool GnapEngine::platFindPath3(int gridX, int gridY) { + int gridIncr = 1; + bool done = false; + + while (!done && gridIncr < _gridMaxX) { + if (!isPointBlocked(_platX + gridIncr, _platY) && gridSub423CC1(_platX + gridIncr, _platY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX + i; + _platWalkNodes[i].gridY1 = _platY; + _platWalkNodes[i].deltaX = 1; + _platWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(_platX - gridIncr, _platY) && gridSub423CC1(_platX - gridIncr, _platY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX - i; + _platWalkNodes[i].gridY1 = _platY; + _platWalkNodes[i].deltaX = -1; + _platWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(_platX, _platY + gridIncr) && gridSub423CC1(_platX, _platY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX; + _platWalkNodes[i].gridY1 = _platY + i; + _platWalkNodes[i].deltaX = 0; + _platWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(_platX, _platY - gridIncr) && gridSub423CC1(_platX, _platY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX; + _platWalkNodes[i].gridY1 = _platY - i; + _platWalkNodes[i].deltaX = 0; + _platWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(_platX + gridIncr, _platY + gridIncr) && gridSub423CC1(_platX + gridIncr, _platY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX + i; + _platWalkNodes[i].gridY1 = _platY + i; + _platWalkNodes[i].deltaX = 1; + _platWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(_platX - gridIncr, _platY + gridIncr) && gridSub423CC1(_platX - gridIncr, _platY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX - i; + _platWalkNodes[i].gridY1 = _platY + i; + _platWalkNodes[i].deltaX = -1; + _platWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(_platX + gridIncr, _platY - gridIncr) && gridSub423CC1(_platX + gridIncr, _platY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX + i; + _platWalkNodes[i].gridY1 = _platY - i; + _platWalkNodes[i].deltaX = 1; + _platWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(_platX - gridIncr, _platY - gridIncr) && gridSub423CC1(_platX - gridIncr, _platY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX - i; + _platWalkNodes[i].gridY1 = _platY - i; + _platWalkNodes[i].deltaX = -1; + _platWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(_platX + gridIncr, _platY) && gridSub42419A(_platX + gridIncr, _platY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX + i; + _platWalkNodes[i].gridY1 = _platY; + _platWalkNodes[i].deltaX = 1; + _platWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(_platX - gridIncr, _platY) && gridSub42419A(_platX - gridIncr, _platY, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX - i; + _platWalkNodes[i].gridY1 = _platY; + _platWalkNodes[i].deltaX = -1; + _platWalkNodes[i].deltaY = 0; + } + done = true; + break; + } + if (!isPointBlocked(_platX, _platY + gridIncr) && gridSub42419A(_platX, _platY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX; + _platWalkNodes[i].gridY1 = _platY + i; + _platWalkNodes[i].deltaX = 0; + _platWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(_platX, _platY - gridIncr) && gridSub42419A(_platX, _platY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX; + _platWalkNodes[i].gridY1 = _platY - i; + _platWalkNodes[i].deltaX = 0; + _platWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(_platX + gridIncr, _platY + gridIncr) && gridSub42419A(_platX + gridIncr, _platY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX + i; + _platWalkNodes[i].gridY1 = _platY + i; + _platWalkNodes[i].deltaX = 1; + _platWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(_platX - gridIncr, _platY + gridIncr) && gridSub42419A(_platX - gridIncr, _platY + gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX - i; + _platWalkNodes[i].gridY1 = _platY + i; + _platWalkNodes[i].deltaX = -1; + _platWalkNodes[i].deltaY = 1; + } + done = true; + break; + } + if (!isPointBlocked(_platX + gridIncr, _platY - gridIncr) && gridSub42419A(_platX + gridIncr, _platY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX + i; + _platWalkNodes[i].gridY1 = _platY - i; + _platWalkNodes[i].deltaX = 1; + _platWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + if (!isPointBlocked(_platX - gridIncr, _platY - gridIncr) && gridSub42419A(_platX - gridIncr, _platY - gridIncr, gridIncr)) { + for (int i = 0; i < gridIncr; ++i) { + _platWalkNodes[i].gridX1 = _platX - i; + _platWalkNodes[i].gridY1 = _platY - i; + _platWalkNodes[i].deltaX = -1; + _platWalkNodes[i].deltaY = -1; + } + done = true; + break; + } + ++gridIncr; + } + + return done; +} + +bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { + + int datNum = flags & 3; + bool done = false; + + _timers[1] = 60; + + if (gridX < 0) + gridX = (_leftClickMouseX - _gridMinX + 37) / 75; + + if (gridY < 0) + gridY = (_leftClickMouseY - _gridMinY + 24) / 48; + + _platWalkDestX = CLIP(gridX, 0, _gridMaxX - 1); + _platWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); + + if (animationIndex >= 0 && _platWalkDestX == _gnapX && _platWalkDestY == _gnapY) + gnapWalkStep(); + + if (gridSub423CC1(_platX, _platY, 0)) + done = true; + + if (!done && gridSub42419A(_platX, _platY, 0)) + done = true; + + if (!done && platFindPath3(_platX, _platY)) + done = true; + + if (!done) + gridSub423750(_platX, _platY); + + int platSequenceId = _beaverSequenceId; + int platId = _beaverId; + int platSequenceDatNum = _beaverSequenceDatNum; + + for (int index = 0; index < _platWalkNodesCount; ++index) { + _platWalkNodes[index].id = index + 20 * _platWalkNodes[index].gridY1; + if (_platWalkNodes[index].deltaX == 1 && _platWalkNodes[index].deltaY == 0) { + if (index % 2) { + _gameSys->insertSequence(makeRid(datNum, 0x7CD), _platWalkNodes[index].id, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + _platWalkNodes[index].sequenceId = 0x7CD; + platSequenceId = 0x7CD; + } else { + _gameSys->insertSequence(makeRid(datNum, 0x7CE), _platWalkNodes[index].id, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + _platWalkNodes[index].sequenceId = 0x7CE; + platSequenceId = 0x7CE; + } + } else if (_platWalkNodes[index].deltaX == -1 && _platWalkNodes[index].deltaY == 0) { + if (index % 2) { + _gameSys->insertSequence(makeRid(datNum, 0x7CF), _platWalkNodes[index].id, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + _platWalkNodes[index].sequenceId = 0x7CF; + platSequenceId = 0x7CF; + } else { + _gameSys->insertSequence(makeRid(datNum, 0x7D0), _platWalkNodes[index].id, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + _platWalkNodes[index].sequenceId = 0x7D0; + platSequenceId = 0x7D0; + } + } else { + if (_platWalkNodes[index].deltaY == -1) + _platWalkNodes[index].id -= 10; + else + _platWalkNodes[index].id += 10; + int newSequenceId = getBeaverWalkSequenceId(_platWalkNodes[index].deltaX, _platWalkNodes[index].deltaY); + _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index].id, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + _platWalkNodes[index].sequenceId = newSequenceId; + platSequenceId = newSequenceId; + } + platId = _platWalkNodes[index].id; + platSequenceDatNum = datNum; + } + + if (flags & 8) { + if (_platWalkNodesCount > 0) { + _beaverSequenceId = platSequenceId; + _beaverId = platId; + _beaverSequenceDatNum = datNum; + // CHECKME Not sure if this is correct... + if (_platWalkNodes[_platWalkNodesCount - 1].deltaX > 0) + _beaverFacing = 0; + else if (_platWalkNodes[_platWalkNodesCount - 1].deltaX < 0) + _beaverFacing = 4; + else if (_platWalkNodes[_platWalkNodesCount - 1].gridX1 % 2) + _beaverFacing = 4; + else + _beaverFacing = 0; + if (animationIndex >= 0) + _gameSys->setAnimation(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, animationIndex); + } else if (animationIndex >= 0) { + _gameSys->setAnimation(0x107D3, 1, animationIndex); + _gameSys->insertSequence(0x107D3, 1, 0, 0, 0, 0, 0, 0); + } + } else { + if (sequenceId >= 0 && sequenceId != -1) { + _beaverSequenceId = ridToEntryIndex(sequenceId); + _beaverSequenceDatNum = ridToDatIndex(sequenceId); + if (_beaverSequenceId == 0x7C2) { + _beaverFacing = 0; + } else if (_beaverSequenceId == 0x7D2) { + _beaverFacing = 4; + } + } else { + if (_platWalkNodesCount > 0) { + if (_platWalkNodes[_platWalkNodesCount - 1].deltaX > 0) { + _beaverSequenceId = 0x7C2; + _beaverFacing = 0; + } else if (_platWalkNodes[_platWalkNodesCount - 1].deltaX < 0) { + _beaverSequenceId = 0x7D2; + _beaverFacing = 4; + } else if (_platWalkNodes[0].deltaX > 0) { + _beaverSequenceId = 0x7C2; + _beaverFacing = 0; + } else if (_platWalkNodes[0].deltaX < 0) { + _beaverSequenceId = 0x7D2; + _beaverFacing = 4; + } else { + _beaverSequenceId = 0x7D2; + _beaverFacing = 4; + } + } else if (_beaverFacing > 0) { + _beaverSequenceId = 0x7D2; + } else { + _beaverSequenceId = 0x7C2; + } + _beaverSequenceDatNum = datNum; + } + + if (animationIndex < 0) { + _beaverId = 20 * _platWalkDestY; + } else { + _beaverId = animationIndex + 20 * _platWalkDestY; + _gameSys->setAnimation(makeRid(_beaverSequenceDatNum, _beaverSequenceId), animationIndex + 20 * _platWalkDestY, animationIndex); + } + + if (flags & 4) + _gameSys->insertSequence(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 0, 0); + else + _gameSys->insertSequence(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 75 * _platWalkDestX - _platGridX, 48 * _platWalkDestY - _platGridY); + } + + _platX = _platWalkDestX; + _platY = _platWalkDestY; + + return done; +} + +void GnapEngine::platypusWalkStep() { + bool done = false; + for (int i = 1; !done && i < _gridMaxX; ++i) { + done = true; + if (!isPointBlocked(_platX + i, _platY)) + platypusWalkTo(_platX + i, _platY, -1, -1, 1); + else if (!isPointBlocked(_platX - i, _platY)) + platypusWalkTo(_platX - i, _platY, -1, -1, 1); + else if (!isPointBlocked(_platX, _platY + 1)) + platypusWalkTo(_platX, _platY + 1, -1, -1, 1); + else if (!isPointBlocked(_platX, _platY - 1)) + platypusWalkTo(_platX, _platY - 1, -1, -1, 1); + else if (!isPointBlocked(_platX + 1, _platY + 1)) + platypusWalkTo(_platX + 1, _platY + 1, -1, -1, 1); + else if (!isPointBlocked(_platX - 1, _platY + 1)) + platypusWalkTo(_platX - 1, _platY + 1, -1, -1, 1); + else if (!isPointBlocked(_platX + 1, _platY - 1)) + platypusWalkTo(_platX + 1, _platY - 1, -1, -1, 1); + else if (!isPointBlocked(_platX - 1, _platY - 1)) + platypusWalkTo(_platX - 1, _platY - 1, -1, -1, 1); + else + done = false; + } +} + +void GnapEngine::beaverMakeRoom() { + int rndGridX, rndGridY; + do { + rndGridY = getRandom(_gridMaxY); + rndGridX = getRandom(_gridMaxX); + } while (ABS(rndGridX - _platX) > 4 || ABS(rndGridY - _platY) > 3 || + isPointBlocked(rndGridX, rndGridY)); + platypusWalkTo(rndGridX, rndGridY, -1, -1, 1); +} + +} // End of namespace Gnap diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp new file mode 100644 index 0000000000..e6fc073c53 --- /dev/null +++ b/engines/gnap/menu.cpp @@ -0,0 +1,811 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/datarchive.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +void GnapEngine::createMenuSprite() { + _menuBackgroundSurface = _gameSys->createSurface(0x10002); +} + +void GnapEngine::freeMenuSprite() { + _gameSys->removeSpriteDrawItem(_menuBackgroundSurface, 260); + delayTicksCursor(5); + deleteSurface(&_menuBackgroundSurface); +} + +void GnapEngine::initMenuHotspots1() { + + int v0, v2 = 0; + + for (int i = 0; i < 3; ++i) { + int v1 = 0; + while (v1 < 3) { + _hotspots[v2].x1 = 87 * v1 + 262; + _hotspots[v2].y1 = 74 * i + 69; + _hotspots[v2].x2 = _hotspots[v2].x1 + 79; + _hotspots[v2].y2 = _hotspots[v2].y1 + 66; + _hotspots[v2].flags = 0; + _hotspots[v2].id = v2; + ++v1; + ++v2; + } + } + + _hotspots[v2].x1 = 330; + _hotspots[v2].y1 = 350; + _hotspots[v2].x2 = 430; + _hotspots[v2].y2 = 460; + _hotspots[v2].flags = 2; + _hotspots[v2].id = v2; + + v0 = v2 + 1; + _hotspots[v0].x1 = 180; + _hotspots[v0].y1 = 15; + _hotspots[v0].x2 = 620; + _hotspots[v0].y2 = 580; + _hotspots[v0].flags = 0; + _hotspots[v0].id = v0; + + ++v0; + _hotspots[v0].x1 = 0; + _hotspots[v0].y1 = 0; + _hotspots[v0].x2 = 799; + _hotspots[v0].y2 = 599; + _hotspots[v0].flags = 0; + _hotspots[v0].id = v0; + + _hotspotsCount = v0 + 1; +} + +void GnapEngine::initMenuHotspots2() { + int i, v0; + + for (i = 0; i < 4; ++i) { + _hotspots[i].x1 = 312; + _hotspots[i].y1 = 48 * i + 85; + _hotspots[i].x2 = _hotspots[i].x1 + 153; + _hotspots[i].y2 = _hotspots[i].y1 + 37; + _hotspots[i].flags = SF_GRAB_CURSOR; + _hotspots[i].id = i; + } + _hotspots[i].x1 = 500; + _hotspots[i].y1 = 72; + _hotspots[i].x2 = 527; + _hotspots[i].y2 = 99; + _hotspots[i].flags = SF_DISABLED; + _hotspots[i].id = i; + v0 = i + 1; + _hotspots[v0].x1 = 330; + _hotspots[v0].y1 = 350; + _hotspots[v0].x2 = 430; + _hotspots[v0].y2 = 460; + _hotspots[v0].flags = SF_GRAB_CURSOR; + _hotspots[v0].id = v0; + ++v0; + _hotspots[v0].x1 = 180; + _hotspots[v0].y1 = 15; + _hotspots[v0].x2 = 620; + _hotspots[v0].y2 = 580; + _hotspots[v0].flags = 0; + _hotspots[v0].id = v0; + ++v0; + _hotspots[v0].x1 = 0; + _hotspots[v0].y1 = 0; + _hotspots[v0].x2 = 799; + _hotspots[v0].y2 = 599; + _hotspots[v0].flags = 0; + _hotspots[v0].id = v0; + _hotspotsCount = v0 + 1; +} + +void GnapEngine::initMenuQuitQueryHotspots() { + _hotspots[0].x1 = 311; + _hotspots[0].y1 = 197; + _hotspots[0].x2 = 377; + _hotspots[0].y2 = 237; + _hotspots[0].flags = SF_GRAB_CURSOR; + _hotspots[0].id = 0; + _hotspots[1].x1 = 403; + _hotspots[1].y1 = 197; + _hotspots[1].x2 = 469; + _hotspots[1].y2 = 237; + _hotspots[1].flags = SF_GRAB_CURSOR; + _hotspots[1].id = 1; + _hotspots[2].x1 = 330; + _hotspots[2].y1 = 350; + _hotspots[2].x2 = 430; + _hotspots[2].y2 = 460; + _hotspots[2].flags = SF_GRAB_CURSOR; + _hotspots[2].id = 2; + _hotspots[3].x1 = 180; + _hotspots[3].y1 = 15; + _hotspots[3].x2 = 620; + _hotspots[3].y2 = 580; + _hotspots[3].flags = 0; + _hotspots[3].id = 3; + _hotspots[4].x1 = 0; + _hotspots[4].y1 = 0; + _hotspots[4].x2 = 799; + _hotspots[4].y2 = 599; + _hotspots[4].flags = 0; + _hotspots[4].id = 4; + _hotspotsCount = 5; +} + +void GnapEngine::initSaveLoadHotspots() { + int i, v0; + for (i = 0; i < 7; ++i ) { + _hotspots[i].x1 = 288; + _hotspots[i].y1 = 31 * i + 74; + _hotspots[i].x2 = _hotspots[i].x1 + 91; + _hotspots[i].y2 = _hotspots[i].y1 + 22; + _hotspots[i].flags = SF_GRAB_CURSOR; + _hotspots[i].id = i; + } + if (_menuStatus == 2) { + _hotspots[i].x1 = 416; + _hotspots[i].y1 = 160; + _hotspots[i].x2 = 499; + _hotspots[i].y2 = 188; + _hotspots[i].flags = SF_GRAB_CURSOR; + _hotspots[i].id = i; + ++i; + } + _hotspots[i].x1 = 416; + _hotspots[i].y1 = 213; + _hotspots[i].x2 = 499; + _hotspots[i].y2 = 241; + _hotspots[i].flags = SF_GRAB_CURSOR; + _hotspots[i].id = i; + v0 = i + 1; + _hotspots[v0].x1 = 330; + _hotspots[v0].y1 = 350; + _hotspots[v0].x2 = 430; + _hotspots[v0].y2 = 460; + _hotspots[v0].flags = SF_GRAB_CURSOR; + _hotspots[v0].id = v0; + ++v0; + _hotspots[v0].x1 = 180; + _hotspots[v0].y1 = 15; + _hotspots[v0].x2 = 620; + _hotspots[v0].y2 = 580; + _hotspots[v0].flags = 0; + _hotspots[v0].id = v0; + ++v0; + _hotspots[v0].x1 = 0; + _hotspots[v0].y1 = 0; + _hotspots[v0].x2 = 799; + _hotspots[v0].y2 = 599; + _hotspots[v0].flags = 0; + _hotspots[v0].id = v0; + _hotspotsCount = v0 + 1; +} + +void GnapEngine::drawInventoryFrames() { + for (int i = 0; i < 9; ++i) + _gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i].x1 - 93, _hotspots[i].y1, 0x10001); +} + +void GnapEngine::insertInventorySprites() { + + for (int i = 0; i < 9; ++i) { + _menuInventoryIndices[i] = -1; + _gameSys->removeSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], 261); + _menuInventorySprites[i] = 0; + } + + _menuSpritesIndex = 0; + + for (int index = 0; index < 30 && _menuSpritesIndex < 9; ++index) { + if (invHas(index)) { + _gameSys->drawSpriteToSurface(_menuBackgroundSurface, + _hotspots[_menuSpritesIndex].x1 - 93, _hotspots[_menuSpritesIndex].y1, 0x10000); + _menuInventorySprites[_menuSpritesIndex] = _gameSys->createSurface(getInventoryItemSpriteNum(index) | 0x10000); + if (index != _grabCursorSpriteIndex) { + _menuInventoryIndices[_menuSpritesIndex] = index; + _gameSys->insertSpriteDrawItem(_menuInventorySprites[_menuSpritesIndex], + _hotspots[_menuSpritesIndex].x1 + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2), + _hotspots[_menuSpritesIndex].y1 + ((66 - _menuInventorySprites[_menuSpritesIndex]->h) / 2), + 261); + } + _hotspots[_menuSpritesIndex].flags = SF_GRAB_CURSOR; + ++_menuSpritesIndex; + } + } + +} + +void GnapEngine::removeInventorySprites() { + for (int i = 0; i < _menuSpritesIndex; ++i) + if (_menuInventorySprites[i]) + _gameSys->removeSpriteDrawItem(_menuInventorySprites[i], 261); + delayTicksCursor(5); + for (int j = 0; j < _menuSpritesIndex; ++j) { + if (_menuInventorySprites[j]) { + deleteSurface(&_menuInventorySprites[j]); + _menuInventorySprites[j] = 0; + _menuInventoryIndices[j] = -1; + } + } + _menuSpritesIndex = 0; +} + +void GnapEngine::runMenu() { + + int v43; + + _spriteHandle = 0; + _cursorSprite = 0; + _menuSprite1 = 0; + _menuSprite2 = 0; + _menuSaveLoadSprite = 0; + _menuQuitQuerySprite = 0; + + _menuStatus = 0; + _menuDone = false; + + createMenuSprite();//??? CHECKME Crashes when done in loadStockDat() find out why + + insertDeviceIconActive(); + + for (int i = 0; i < 7; ++i) { + _savegameFilenames[i][0] = 0; + _savegameSprites[i] = 0; + } + + v43 = 0; + + if (_menuStatus == 0) { + invAdd(kItemMagazine); + setGrabCursorSprite(-1); + hideCursor(); + initMenuHotspots1(); + drawInventoryFrames(); + insertInventorySprites(); + _gameSys->insertSpriteDrawItem(_menuBackgroundSurface, 93, 0, 260); + showCursor(); + // SetCursorPos(400, 300); + setVerbCursor(GRAB_CURSOR); + // pollMessages(); + } + + _timers[2] = 10; + + while (!isKeyStatus1(8) && !isKeyStatus1(28) && !_sceneDone && !_menuDone) { + + updateCursorByHotspot(); + + switch (_menuStatus) { + case 0: + updateMenuStatusInventory(); + break; + case 1: + updateMenuStatusMainMenu(); + break; + case 2: + updateMenuStatusSaveGame(); + break; + case 3: + updateMenuStatusLoadGame(); + break; + case 4: + updateMenuStatusQueryQuit(); + break; + } + + gameUpdateTick(); + + } + + removeInventorySprites(); + if (_spriteHandle) + _gameSys->removeSpriteDrawItem(_spriteHandle, 261); + if (_menuSprite1) + _gameSys->removeSpriteDrawItem(_menuSprite1, 262); + if (_menuSprite2) + _gameSys->removeSpriteDrawItem(_menuSprite2, 262); + for (int i = 0; i < 7; ++i) + if (_savegameSprites[i]) + _gameSys->removeSpriteDrawItem(_savegameSprites[i], 263); + if (_cursorSprite) + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + if (_menuSaveLoadSprite) + _gameSys->removeSpriteDrawItem(_menuSaveLoadSprite, 262); + if (_menuQuitQuerySprite) + _gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262); + if (_menuBackgroundSurface) + _gameSys->removeSpriteDrawItem(_menuBackgroundSurface, 260); + + delayTicksCursor(5); + + deleteSurface(&_spriteHandle); + deleteSurface(&_menuSprite1); + deleteSurface(&_menuSprite2); + for (int i = 0; i < 7; ++i) + deleteSurface(&_savegameSprites[i]); + deleteSurface(&_cursorSprite); + deleteSurface(&_menuSaveLoadSprite); + deleteSurface(&_menuQuitQuerySprite); + + _sceneClickedHotspot = -1; + + _timers[2] = getRandom(20) + 30; + _timers[3] = getRandom(200) + 50; + _timers[0] = getRandom(75) + 75; + _timers[1] = getRandom(20) + 30; + + clearAllKeyStatus1(); + + _mouseClickState.left = false; + + removeDeviceIconActive(); + + freeMenuSprite();//??? CHECKME +} + +void GnapEngine::updateMenuStatusInventory() { + + static const struct { + int item1, item2, resultItem; + } kCombineItems[] = { + {kItemGrass, kItemMud, kItemDisguise}, + {kItemDice, kItemQuarterWithHole, kItemDiceQuarterHole}, + {kItemPill, kItemBucketWithBeer, kItemBucketWithPill} + }; + + updateGrabCursorSprite(0, 0); + _hotspots[0].x1 = 262; + _hotspots[0].y1 = 69; + _hotspots[0].x2 = 341; + _hotspots[0].y2 = 135; + _sceneClickedHotspot = -1; + if (_timers[2] == 0) + _sceneClickedHotspot = getClickedHotspotId(); + if (_sceneClickedHotspot == -1 || _sceneClickedHotspot >= _menuSpritesIndex) { + if (_sceneClickedHotspot == _hotspotsCount - 3) { + if (_grabCursorSpriteIndex == -1) { + _timers[2] = 10; + playSound(0x108F4, 0); + _menuStatus = 1; + Common::Rect dirtyRect(_hotspots[0].x1, _hotspots[0].y1, _hotspots[2].x2, _hotspots[_hotspotsCount - 4].y2); + drawInventoryFrames(); + initMenuHotspots2(); + removeInventorySprites(); + if (!_menuSprite1) + _menuSprite1 = _gameSys->createSurface(0x104F8); + _gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262); + _gameSys->insertDirtyRect(dirtyRect); + } else { + playSound(0x108F5, 0); + } + } else if (_sceneClickedHotspot == _hotspotsCount - 1) { + _timers[2] = 10; + playSound(0x108F5, 0); + _menuDone = true; + } + } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] != -1 && _grabCursorSpriteIndex == -1) { + _gameSys->removeSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], 261); + setGrabCursorSprite(_menuInventoryIndices[_sceneClickedHotspot]); + _menuInventoryIndices[_sceneClickedHotspot] = -1; + } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] == -1 && _grabCursorSpriteIndex != -1) { + _menuInventoryIndices[_sceneClickedHotspot] = _grabCursorSpriteIndex; + _gameSys->insertSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], + _hotspots[_sceneClickedHotspot].x1 + ((79 - _menuInventorySprites[_sceneClickedHotspot]->w) / 2), + _hotspots[_sceneClickedHotspot].y1 + (66 - _menuInventorySprites[_sceneClickedHotspot]->h) / 2, + 261); + setGrabCursorSprite(-1); + } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] != -1 && _grabCursorSpriteIndex != -1) { + int combineIndex = -1; + for (int i = 0; i < ARRAYSIZE(kCombineItems); ++i) { + if ((_grabCursorSpriteIndex == kCombineItems[i].item1 && _menuInventoryIndices[_sceneClickedHotspot] == kCombineItems[i].item2) || + (_grabCursorSpriteIndex == kCombineItems[i].item2 && _menuInventoryIndices[_sceneClickedHotspot] == kCombineItems[i].item1)) { + combineIndex = i; + break; + } + } + if (combineIndex >= 0) { + invRemove(kCombineItems[combineIndex].item1); + invRemove(kCombineItems[combineIndex].item2); + invAdd(kCombineItems[combineIndex].resultItem); + playSound(0x108AE, 0); + deleteSurface(&_spriteHandle); // CHECKME + _spriteHandle = _gameSys->createSurface(0x10001); + _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1].x1, _hotspots[_menuSpritesIndex - 1].y1, 261); + setGrabCursorSprite(kCombineItems[combineIndex].resultItem); + removeInventorySprites(); + insertInventorySprites(); + delayTicksCursor(5); + } else { + playSound(0x108F5, 0); + } + } +} + +void GnapEngine::updateMenuStatusMainMenu() { + _hotspots[0].x1 = 312; + _hotspots[0].y1 = 85; + _hotspots[0].x2 = 465; + _hotspots[0].y2 = 122; + _sceneClickedHotspot = -1; + if (!_timers[2]) + _sceneClickedHotspot = getClickedHotspotId(); + + if (_sceneClickedHotspot != 1 && _sceneClickedHotspot != 0) { + if (_sceneClickedHotspot != 2 && _hotspotsCount - 1 != _sceneClickedHotspot) { + if (_sceneClickedHotspot == 3) { + _timers[2] = 10; + playSound(0x108F4, 0); + _gameSys->removeSpriteDrawItem(_menuSprite1, 262); + initMenuQuitQueryHotspots(); + _menuStatus = 4; + if (!_menuQuitQuerySprite) + _menuQuitQuerySprite = _gameSys->createSurface(0x104FC); + _gameSys->insertSpriteDrawItem(_menuQuitQuerySprite, 254, 93, 262); + } else if (_sceneClickedHotspot == 4) { + playSound(0x108F4, 0); + Common::Rect dirtyRect(0, 0, 799, 599); + hideCursor(); + _largeSprite = _gameSys->allocSurface(800, 600); + + for (int i = 0; i < 3; ++i) { + + _timers[2] = 10; + + if (i == 0) { + _gameSys->drawSpriteToSurface(_largeSprite, 0, 0, 0x1078D); + _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); + /* TODO + if (_midiFlag) { + playMidi("pause.mid", 0); + } + */ + } else if (i == 1) { + _gameSys->drawSpriteToSurface(_largeSprite, 0, 0, 0x1078E); + _gameSys->insertDirtyRect(dirtyRect); + } else if (i == 2) { + _gameSys->drawSpriteToSurface(_largeSprite, 0, 0, 0x1078F); + _gameSys->insertDirtyRect(dirtyRect); + } + + while (!_mouseClickState.left && !isKeyStatus1(28) && !isKeyStatus1(30) && !isKeyStatus1(29) && !_timers[2]) { + gameUpdateTick(); + } + + playSound(0x108F5, 0); + _mouseClickState.left = false; + clearKeyStatus1(28); + clearKeyStatus1(29); + clearKeyStatus1(30); + } + + _gameSys->removeSpriteDrawItem(_largeSprite, 300); + delayTicksCursor(5); + deleteSurface(&_largeSprite); + showCursor(); + } else if (_hotspotsCount - 3 == _sceneClickedHotspot) { + _timers[2] = 10; + playSound(0x108F4, 0); + initMenuHotspots1(); + /* TODO + if (_mouseX < 93 || _mouseX > 638 || _mouseY < 0 || _mouseY > 600) + SetCursorPos(400, 300); + */ + _menuStatus = 0; + if (_menuSprite1) + _gameSys->removeSpriteDrawItem(_menuSprite1, 262); + insertInventorySprites(); + Common::Rect dirtyRect(_hotspots[0].x1, _hotspots[0].y1, _hotspots[2].x2, _hotspots[_hotspotsCount - 4].y2); + _gameSys->insertDirtyRect(dirtyRect); + } + } else { + playSound(0x108F5, 0); + _menuDone = true; + } + } else { + _timers[2] = 10; + playSound(0x108F4, 0); + _gameSys->removeSpriteDrawItem(_menuSprite1, 262); + if (_menuSaveLoadSprite) + deleteSurface(&_menuSaveLoadSprite); + if (_sceneClickedHotspot == 1) { + _menuStatus = 2; + initSaveLoadHotspots(); + _menuSaveLoadSprite = _gameSys->createSurface(0x104FB); + } else { + _menuStatus = 3; + initSaveLoadHotspots(); + _menuSaveLoadSprite = _gameSys->createSurface(0x104FA); + } + _gameSys->insertSpriteDrawItem(_menuSaveLoadSprite, 403, 72, 262); + if (!_menuSprite2) + _menuSprite2 = _gameSys->createSurface(0x104F9); + _gameSys->insertSpriteDrawItem(_menuSprite2, 277, 66, 262); + for (int i = 0; i < 7; ++i) { + Common::String savegameDescription; + if (!_savegameSprites[i]) + _savegameSprites[i] = _gameSys->allocSurface(111, 40); + if (readSavegameDescription(i + 1, savegameDescription) == 0) + strncpy(_savegameFilenames[i], savegameDescription.c_str(), 40); + _gameSys->drawTextToSurface(_savegameSprites[i], 0, 0, 255, 0, 0, _savegameFilenames[i]); + _gameSys->insertSpriteDrawItem(_savegameSprites[i], 288, _hotspots[i].y1, 263); + } + _savegameIndex = -1; + } +} + +void GnapEngine::updateMenuStatusSaveGame() { +#if 0 // TODO + _hotspots[0].x1 = 288; + _hotspots[0].y1 = 74; + _hotspots[0].x2 = 379; + _hotspots[0].y2 = 96; + _sceneClickedHotspot = -1; + if (!_timers[2]) + _sceneClickedHotspot = getClickedHotspotId(); + if (_hotspotsCount - 3 == _sceneClickedHotspot) + { + _timers[2] = 10; + playSound(0x108F4, 0); + _menuStatus = 1; + writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1); + } + else if (_hotspotsCount - 4 == _sceneClickedHotspot) + { + _timers[2] = 10; + playSound(0x108F5, 0); + _menuStatus = 1; + if (strcmp(&v43, &_savegameFilenames[30 * _savegameIndex]) && _savegameIndex != -1) + { + strcpy((char *)&_savegameFilenames[30 * _savegameIndex], &v43); + if (_savegameSprites[_savegameIndex] != -1) + { + _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); + delayTicksCursor(5); + memFreeHandle(_savegameSprites[_savegameIndex]); + } + v16 = getSpriteWidthById(0x104F9); + _savegameSprites[_savegameIndex] = allocSprite(v16, 40, 128, 0); + } + } + else if (_hotspotsCount - 5 == _sceneClickedHotspot) + { + _timers[2] = 10; + playSound(0x108F4, 0); + if ((signed int)_savegameIndex > -1) + writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1); + _menuStatus = 1; + } + else if (_hotspotsCount - 1 == _sceneClickedHotspot) + { + _menuDone = true; + } + else if (_sceneClickedHotspot != -1 && _hotspotsCount - 2 != _sceneClickedHotspot) + { + _timers[2] = 10; + playSound(0x108F4, 0); + v17 = strcmp(&v43, &_savegameFilenames[30 * _savegameIndex]); + if (!v17) + LOBYTE(v17) = 0; + if ((unsigned int8)v17 & (_savegameIndex < 0xFFFFFFFF)) + { + strcpy((char *)&_savegameFilenames[30 * _savegameIndex], &v43); + if (_savegameSprites[_savegameIndex] != -1) + { + _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); + delayTicksCursor(5); + memFreeHandle(_savegameSprites[_savegameIndex]); + } + v18 = getSpriteWidthById(0x104F9); + _savegameSprites[_savegameIndex] = allocSprite(v18, 40, 128, 0); + drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, &_savegameFilenames[30 * _savegameIndex]); + insertSpriteDrawItem(_savegameSprites[_savegameIndex], 288, _hotspots[_savegameIndex].y1, 263); + } + _savegameIndex = _sceneClickedHotspot; + v46 = strlen(&_savegameFilenames[30 * _sceneClickedHotspot]); + strcpy(&v43, &_savegameFilenames[30 * _sceneClickedHotspot]); + if (_cursorSprite == -1) + { + v19 = getTextHeight("_"); + v20 = getTextWidth("_"); + _cursorSprite = allocSprite(v20, v19, 128, 0); + drawTextToSurface(_cursorSprite, 0, 0, 255, 0, 0, "_"); + } + else + { + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + } + v21 = _hotspots[_savegameIndex].x2; + v22 = v21 - getTextWidth("_"); + if (v22 > getTextWidth(&_savegameFilenames[30 * _savegameIndex]) + 288) + { + v25 = getTextWidth(&_savegameFilenames[30 * _savegameIndex]) + 288; + insertSpriteDrawItem(_cursorSprite, v25, _hotspots[_savegameIndex].y1, 264); + } + else + { + v23 = _hotspots[_savegameIndex].x2; + v24 = v23 - getTextWidth("_"); + insertSpriteDrawItem(_cursorSprite, v24, _hotspots[_savegameIndex].y1, 264); + } + } + if ((signed int)_savegameIndex > -1 && keybChar) + { + if ((keybChar < 'A' || keybChar > 'Z') && (keybChar < '0' || keybChar > '9') && keybChar != ' ') + { + if (keybChar == 8) + { + if ((signed int)v46 > 0) + --v46; + *(&_savegameFilenames[30 * _savegameIndex] + v46) = 0; + if (_savegameSprites[_savegameIndex] != -1) + { + _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); + memFreeHandle(_savegameSprites[_savegameIndex]); + } + v32 = getSpriteWidthById(0x104F9); + _savegameSprites[_savegameIndex] = allocSprite(v32, 40, 128, 0); + drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, &_savegameFilenames[30 * _savegameIndex]); + insertSpriteDrawItem(_savegameSprites[_savegameIndex], 288, _hotspots[_savegameIndex].y1, 263); + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + v33 = _hotspots[_savegameIndex].y1; + v34 = getTextWidth(&_savegameFilenames[30 * _savegameIndex]); + insertSpriteDrawItem(_cursorSprite, LOWORD(_hotspots[_savegameIndex].x1) + v34, v33, 264); + } + else if (keybChar == 13) + { + _menuStatus = 1; + writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1); + } + } + else + { + *(&_savegameFilenames[30 * _savegameIndex] + v46) = keybChar; + if ((signed int)v46 < 28) + ++v46; + *(&_savegameFilenames[30 * _savegameIndex] + v46) = 0; + if (getTextWidth(&_savegameFilenames[30 * _savegameIndex]) > 91) + { + --v46; + *(&_savegameFilenames[30 * _savegameIndex] + v46) = 0; + } + drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, &_savegameFilenames[30 * _savegameIndex]); + v26 = getTextWidth(&_savegameFilenames[30 * _savegameIndex]); + rect.right = _hotspots[_savegameIndex].x1 + v26; + v27 = rect.right; + rect.left = v27 - 2 * getTextWidth("W"); + rect.top = _hotspots[_savegameIndex].y1; + rect.bottom = _hotspots[_savegameIndex].y2; + insertDirtyRect(&rect); + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + v28 = _hotspots[_savegameIndex].x2; + v29 = getTextWidth("_"); + if (v28 - v29 > rect.right) + { + insertSpriteDrawItem(_cursorSprite, SLOWORD(rect.right), SLOWORD(rect.top), 264); + } + else + { + v30 = _hotspots[_savegameIndex].x2; + v31 = v30 - getTextWidth("_"); + insertSpriteDrawItem(_cursorSprite, v31, SLOWORD(rect.top), 264); + } + clearKeyStatus1(8); + } + } + keybChar = 0; + if (_menuStatus == 1 || _menuDone) + { + _gameSys->removeSpriteDrawItem(_menuSprite2, 262); + _gameSys->removeSpriteDrawItem(_menuSaveLoadSprite, 262); + for (i = 0; i < 7; ++i) + _gameSys->removeSpriteDrawItem(_savegameSprites[i], 263); + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + if (!_menuDone) + { + initMenuHotspots2(); + insertSpriteDrawItem(_menuSprite1, 288, 79, 262); + } + } +#endif +} + +void GnapEngine::updateMenuStatusLoadGame() { + _hotspots[0].x1 = 288; + _hotspots[0].y1 = 74; + _hotspots[0].x2 = 379; + _hotspots[0].y2 = 96; + _sceneClickedHotspot = -1; + if (!_timers[2]) + _sceneClickedHotspot = getClickedHotspotId(); + if (_sceneClickedHotspot != -1 && _hotspotsCount - 2 != _sceneClickedHotspot) { + _timers[2] = 10; + if (_hotspotsCount - 4 <= _sceneClickedHotspot) { + playSound(0x108F5, 0); + _gameSys->removeSpriteDrawItem(_menuSprite2, 262); + _gameSys->removeSpriteDrawItem(_menuSaveLoadSprite, 262); + for (int i = 0; i < 7; ++i) + _gameSys->removeSpriteDrawItem(_savegameSprites[i], 263); + if (_hotspotsCount - 1 == _sceneClickedHotspot) { + _menuDone = true; + } else { + _menuStatus = 1; + initMenuHotspots2(); + _gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262); + } + } else if (loadSavegame(_sceneClickedHotspot + 1)) { + playSound(0x108F5, 0); + } else { + playSound(0x108F4, 0); + _sceneDone = true; + } + } +} + +void GnapEngine::updateMenuStatusQueryQuit() { + + _hotspots[0].x1 = 311; + _hotspots[0].y1 = 197; + _hotspots[0].x2 = 377; + _hotspots[0].y2 = 237; + + _sceneClickedHotspot = -1; + + if (!_timers[2]) + _sceneClickedHotspot = getClickedHotspotId(); + + /* _sceneClickedHotspot + 0 Yes + 1 No + 2 Button + 3 Display + 4 Background + */ + + if (_sceneClickedHotspot == 0) { + // Quit the game + playSound(0x108F5, 0); + _gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262); + _sceneDone = true; + _gameDone = true; + } else if (_sceneClickedHotspot == 4) { + // Exit the device + playSound(0x108F4, 0); + _gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262); + _menuDone = true; + } else if (_sceneClickedHotspot != -1) { + // Return to the main menu + playSound(0x108F4, 0); + _gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262); + _timers[2] = 10; + _menuStatus = 1; + initMenuHotspots2(); + _gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262); + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk new file mode 100644 index 0000000000..78e2cce736 --- /dev/null +++ b/engines/gnap/module.mk @@ -0,0 +1,70 @@ +MODULE := engines/gnap + +MODULE_OBJS := \ + datarchive.o \ + detection.o \ + gamesys.o \ + gnap.o \ + grid.o \ + menu.o \ + resource.o \ + sound.o \ + scenes/scene01.o \ + scenes/scene02.o \ + scenes/scene03.o \ + scenes/scene04.o \ + scenes/scene05.o \ + scenes/scene06.o \ + scenes/scene07.o \ + scenes/scene08.o \ + scenes/scene09.o \ + scenes/scene10.o \ + scenes/scene11.o \ + scenes/scene12.o \ + scenes/scene13.o \ + scenes/scene14.o \ + scenes/scene15.o \ + scenes/scene16.o \ + scenes/scene17.o \ + scenes/scene18.o \ + scenes/scene19.o \ + scenes/scene20.o \ + scenes/scene21.o \ + scenes/scene22.o \ + scenes/scene23.o \ + scenes/scene24.o \ + scenes/scene25.o \ + scenes/scene26.o \ + scenes/scene27.o \ + scenes/scene28.o \ + scenes/scene29.o \ + scenes/scene30.o \ + scenes/scene31.o \ + scenes/scene32.o \ + scenes/scene33.o \ + scenes/scene38.o \ + scenes/scene39.o \ + scenes/scene40.o \ + scenes/scene41.o \ + scenes/scene42.o \ + scenes/scene43.o \ + scenes/scene44.o \ + scenes/scene45.o \ + scenes/scene46.o \ + scenes/scene47.o \ + scenes/scene48.o \ + scenes/scene49.o \ + scenes/scene50.o \ + scenes/scene51.o \ + scenes/scene52.o \ + scenes/scene53.o \ + scenes/scene54.o \ + scenes/scenecore.o + +# This module can be built as a plugin +ifeq ($(ENABLE_GNAP), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp new file mode 100644 index 0000000000..ab83b1376b --- /dev/null +++ b/engines/gnap/resource.cpp @@ -0,0 +1,118 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/resource.h" + +namespace Gnap { + +// SequenceFrame + +void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) { + duration = stream.readUint16LE(); + isScaled = stream.readUint16LE(); + rect.left = stream.readUint32LE(); + rect.top = stream.readUint32LE(); + rect.right = stream.readUint32LE(); + rect.bottom = stream.readUint32LE(); + spriteId = stream.readUint32LE(); + soundId = stream.readUint32LE(); + unkValue = stream.readUint32LE(); + //isScaled = 0;//DEBUG + debug(1, "SequenceFrame() spriteId: %d; soundId: %d", spriteId, soundId); +} + +// SequenceAnimation + +void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) { + field_0 = stream.readUint16LE(); + field_2 = stream.readUint16LE(); + field_4 = stream.readUint32LE(); + framesCount = stream.readUint16LE(); + field_A = stream.readUint16LE(); + debug(1, "SequenceAnimation() framesCount: %d", framesCount); + frames = new SequenceFrame[framesCount]; + for (int i = 0; i < framesCount; ++i) + frames[i].loadFromStream(stream); +} + +// SequenceResource + +SequenceResource::SequenceResource(int resourceId, byte *data, uint32 size) { + Common::MemoryReadStream stream(data, size, DisposeAfterUse::NO); + _field_0 = stream.readUint32LE(); + _sequenceId = stream.readUint32LE(); + _field_8 = stream.readUint32LE(); + _sequenceId2 = stream.readUint32LE(); + _field_10 = stream.readUint32LE(); + _flags = stream.readUint32LE(); + _totalDuration = stream.readUint32LE(); + _xOffs = stream.readUint16LE(); + _yOffs = stream.readUint16LE(); + _animationsCount = stream.readUint32LE(); + _animations = new SequenceAnimation[_animationsCount]; + debug(1, "SequenceResource() _animationsCount: %d", _animationsCount); + for (int i = 0; i < _animationsCount; ++i) { + uint32 animationOffs = stream.readUint32LE(); + debug(1, "animationOffs: %08X", animationOffs); + uint32 oldOffs = stream.pos(); + stream.seek(animationOffs); + _animations[i].loadFromStream(stream); + stream.seek(oldOffs); + } + // TODO Convert resourceIds +} + +SequenceResource::~SequenceResource() { + delete[] _animations; +} + +// SpriteResource + +SpriteResource::SpriteResource(int resourceId, byte *data, uint32 size) { + _data = data; + _width = READ_LE_UINT16(_data); + _height = READ_LE_UINT16(_data + 2); + _unk1 = READ_LE_UINT16(_data + 4); + _unk2 = READ_LE_UINT16(_data + 6); + _transparent = READ_LE_UINT16(_data + 8); + _colorsCount = READ_LE_UINT16(_data + 10); + _palette = (uint32*)(_data + 12); + _pixels = _data + 12 + _colorsCount * 4; + debug(1, "SpriteResource() width: %d; height: %d; colorsCount: %d", _width, _height, _colorsCount); +} + +SpriteResource::~SpriteResource() { + delete[] _data; +} + +// SoundResource + +SoundResource::SoundResource(int resourceId, byte *data, uint32 size) { + _data = data; + _size = size; +} + +SoundResource::~SoundResource() { + delete[] _data; +} + +} // End of namespace Gnap diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h new file mode 100644 index 0000000000..b0f6a6169b --- /dev/null +++ b/engines/gnap/resource.h @@ -0,0 +1,196 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_RESOURCE_H +#define GNAP_RESOURCE_H + +#include "common/array.h" +#include "common/events.h" +#include "common/file.h" +#include "common/memstream.h" +#include "common/str.h" +#include "common/stream.h" +#include "common/substream.h" +#include "common/system.h" + +#include "graphics/surface.h" + +#include "gnap/datarchive.h" + +namespace Gnap { + +enum { + kResTypeSprite = 0, + kResTypeBitmap = 1, + kResTypeSound = 2, + kResTypeSequence = 3 +}; + +struct SequenceFrame { + int16 duration; + int16 isScaled; + Common::Rect rect; + int32 spriteId; + int32 soundId; + int32 unkValue; + void loadFromStream(Common::MemoryReadStream &stream); +}; + +struct SequenceAnimation { + int16 field_0; + int16 field_2; + int32 field_4; + int16 framesCount; + int16 field_A; + SequenceFrame *frames; + SequenceAnimation() : frames(0) {} + ~SequenceAnimation() { delete[] frames; } + void loadFromStream(Common::MemoryReadStream &stream); +}; + +class SequenceResource { +public: + SequenceResource(int resourceId, byte *data, uint32 size); + ~SequenceResource(); +public: + uint32 _field_0; + int32 _sequenceId; + int32 _field_8; + int32 _sequenceId2; + uint32 _field_10; + uint32 _flags; + int32 _totalDuration; + int16 _xOffs; + int16 _yOffs; + int32 _animationsCount; + SequenceAnimation *_animations; +}; + +class SpriteResource { +public: + SpriteResource(int resourceId, byte *data, uint32 size); + ~SpriteResource(); +public: + byte *_data; + byte *_pixels; + uint32 *_palette; + int16 _width, _height; + uint16 _unk1; + uint16 _unk2; + uint16 _transparent; + uint16 _colorsCount; +}; + +class SoundResource { +public: + SoundResource(int resourceId, byte *data, uint32 size); + ~SoundResource(); +public: + byte *_data; + uint32 _size; +}; + +template +class ResourceCacheTemplate { +public: + + ResourceCacheTemplate(DatManager *dat) : _dat(dat) { + } + + ~ResourceCacheTemplate() { + } + + ResourceClass *get(int resourceId) { + Resource *resource = find(resourceId); + if (!resource) { + debug(1, "Loading resource type %d with ID %08X from disk", ResourceType, resourceId); + resource = new Resource(load(resourceId)); + _cache[resourceId] = resource; + } else { + debug(1, "Resource type %d with ID %08X was in cache", ResourceType, resourceId); + } + resource->_isLocked = true; + return resource->_obj; + } + + void release(int resourceId) { + Resource *resource = find(resourceId); + if (resource) + resource->_isLocked = false; + } + + void purge(bool force = false) { + debug("Count before purge: %d", _cache.size()); + for (CacheMapIterator it = _cache.begin(); it != _cache.end(); ++it) { + Resource *resource = it->_value; + if (force || !resource->_isLocked) { + delete resource; + _cache.erase(it); + } + } + debug("Count after purge: %d", _cache.size()); + } + +protected: + + struct Resource { + ResourceClass *_obj; + bool _isLocked; + Resource(ResourceClass *obj) : _obj(obj), _isLocked(false) {} + ~Resource() { delete _obj; } + }; + + typedef Common::HashMap CacheMap; + typedef typename CacheMap::iterator CacheMapIterator; + + DatManager *_dat; + CacheMap _cache; + + Resource *find(int resourceId) { + CacheMapIterator it = _cache.find(resourceId); + if (it != _cache.end()) + return it->_value; + return 0; + } + + ResourceClass *load(int resourceId) { + if (_dat->getResourceType(resourceId) != ResourceType) { + error("ResourceCache::load() Wrong resource type: Expected %d, got %d", ResourceType, _dat->getResourceType(resourceId)); + return 0; + } + byte *resourceData = _dat->loadResource(resourceId); + uint32 resourceSize = _dat->getResourceSize(resourceId); + ResourceClass *obj = new ResourceClass(resourceId, resourceData, resourceSize); + if (FreeAfterLoad) + delete[] resourceData; + return obj; + } + +}; + +typedef ResourceCacheTemplate SpriteCache; +typedef ResourceCacheTemplate SoundCache; +typedef ResourceCacheTemplate SequenceCache; + +} // End of namespace Gnap + +#endif // GNAP_RESOURCE_H diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp new file mode 100644 index 0000000000..0e4695c619 --- /dev/null +++ b/engines/gnap/scenes/scene01.cpp @@ -0,0 +1,373 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitTruck = 1, + kHSMud = 2, + kHSPigs = 3, + kHSSpaceship = 4, + kHSDevice = 5, + kHSWalkArea1 = 6, + kHSWalkArea2 = 7, + kHSWalkArea3 = 8, + kHSWalkArea4 = 9, + kHSWalkArea5 = 10, + kHSWalkArea6 = 11, + kHSWalkArea7 = 12, + kHSWalkArea8 = 13 +}; + +enum { + kASLookSpaceship = 1, + kASLookSpaceshipDone = 2, + kASLeaveScene = 3, + kASTakeMud = 5, + kASLookPigs = 6, + kASUsePigs = 7 +}; + +int GnapEngine::scene01_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 3); + return 0x88; +} + +void GnapEngine::scene01_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + setHotspot(kHSMud, 138, 282, 204, 318, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + setHotspot(kHSPigs, 408, 234, 578, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 4); + setHotspot(kHSSpaceship, 0, 200, 94, 292, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + setHotspot(kHSWalkArea1, 0, 0, 162, 426); + setHotspot(kHSWalkArea2, 162, 0, 237, 396); + setHotspot(kHSWalkArea3, 237, 0, 319, 363); + setHotspot(kHSWalkArea4, 520, 0, 800, 404); + setHotspot(kHSWalkArea5, 300, 447, 800, 600); + setHotspot(kHSWalkArea6, 678, 0, 800, 404); + setHotspot(kHSWalkArea7, 0, 0, 520, 351); + setHotspot(kHSWalkArea8, 0, 546, 300, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(0)) + _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (isFlag(1)) + _hotspots[kHSMud].flags = SF_WALKABLE | SF_DISABLED; + _hotspotsCount = 14; +} + +void GnapEngine::scene01_run() { + + // NOTE Removed _s01_dword_474380 which was set when the mud was taken + // which is also set in the global game flags. + + playSound(0x1091C, 1); + startSoundTimerC(5); + + _gameSys->setAnimation(134, 20, 4); + _gameSys->insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); + + _gameSys->setAnimation(0x7F, 40, 2); + _gameSys->insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); + + _timers[4] = getRandom(100) + 300; + + if (!isFlag(1)) + _gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + if (_prevSceneNum == 2) { + initGnapPos(11, 6, 3); + if (isFlag(0)) + initBeaverPos(12, 6, 4); + endSceneInit(); + if (isFlag(0)) + platypusWalkTo(9, 6, -1, 0x107C2, 1); + gnapWalkTo(8, 6, -1, 0x107B9, 1); + } else { + initGnapPos(1, 6, 1); + if (isFlag(0)) + initBeaverPos(1, 7, 0); + endSceneInit(); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + testWalk(0, 3, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene01_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0 && isFlag(0)) { + if (_grabCursorSpriteIndex == kItemDisguise) { + gnapUseDisguiseOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(5)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSSpaceship: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + _gnapIdleFacing = 5; + if (gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _gnapActionStatus = kASLookSpaceship; + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSMud: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 2, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(3, 3); + break; + case GRAB_CURSOR: + gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); + _gnapActionStatus = kASTakeMud; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSPigs: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 7, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _gnapActionStatus = kASLookPigs; + break; + case GRAB_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _gnapActionStatus = kASUsePigs; + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); + _gnapActionStatus = kASLookPigs; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitTruck: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); + _newSceneNum = 2; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + case kHSWalkArea5: + case kHSWalkArea6: + case kHSWalkArea7: + case kHSWalkArea8: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene01_updateAnimations(); + + if (!isSoundPlaying(0x1091C)) + playSound(0x1091C, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && isFlag(0)) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (_timers[4] == 0) { + // Update bird animation + _timers[4] = getRandom(100) + 300; + if (getRandom(1) == 0) + _gameSys->insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); + } + playSoundC(); + } + + checkGameKeys(); + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene01_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene01_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLookSpaceship: + _s01_spaceshipSurface = _gameSys->createSurface(47); + _gameSys->insertSpriteDrawItem(_s01_spaceshipSurface, 0, 0, 255); + _gameSys->setAnimation(133, 256, 0); + _gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); + _gnapActionStatus = kASLookSpaceshipDone; + break; + case kASLookSpaceshipDone: + _gameSys->removeSequence(133, 256, 1); + _gameSys->removeSpriteDrawItem(_s01_spaceshipSurface, 255); + deleteSurface(&_s01_spaceshipSurface); + _gnapActionStatus = -1; + break; + case kASLeaveScene: + _sceneDone = true; + break; + case kASTakeMud: + playGnapPullOutDevice(2, 3); + playGnapUseDevice(0, 0); + _gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(128, 40, 3); + _gnapActionStatus = -1; + break; + case kASLookPigs: + playSound(138, 0); + playSound(139, 0); + playSound(140, 0); + _gnapActionStatus = -1; + break; + case kASUsePigs: + playGnapPullOutDevice(7, 2); + playGnapUseDevice(0, 0); + _gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, getRandom(140) - 40, 0); + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + _gameSys->setAnimation(0, 0, 3); + invAdd(kItemMud); + setGrabCursorSprite(kItemMud); + setFlag(1); + scene01_updateHotspots(); + } + + if (_gameSys->getAnimationStatus(4) == 2) { + _s01_smokeIdCtr = (_s01_smokeIdCtr + 1) % 2; + _gameSys->setAnimation(0x86, _s01_smokeIdCtr + 20, 4); + _gameSys->insertSequence(0x86, _s01_smokeIdCtr + 20, + 0x86, (_s01_smokeIdCtr + 1) % 2 + 20, + kSeqSyncWait, 0, 0, 0); + } + + if (_gameSys->getAnimationStatus(2) == 2) { + _s01_pigsIdCtr = (_s01_pigsIdCtr + 1) % 2; + _gameSys->setAnimation(0x7F, _s01_pigsIdCtr + 40, 2); + _gameSys->insertSequence(0x7F, _s01_pigsIdCtr + 40, + 0x7F, (_s01_pigsIdCtr + 1) % 2 + 40, + kSeqSyncWait, 0, 0, 0); + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp new file mode 100644 index 0000000000..5d740b906f --- /dev/null +++ b/engines/gnap/scenes/scene02.cpp @@ -0,0 +1,539 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSChicken = 1, + kHSTruck1 = 2, + kHSTruck2 = 3, + kHSTruckGrill = 4, + kHSDevice = 5, + kHSExitHouse = 6, + kHSExitBarn = 7, + kHSExitCreek = 8, + kHSExitPigpen = 9, + kHSWalkArea1 = 10, + kHSWalkArea2 = 11, + kHSWalkArea3 = 12, + kHSWalkArea4 = 13 +}; + +enum { + kASUseTruckNoKeys = 0, + kASUseGasWithTruck = 1, + kASUseTruckGas = 2, + kASUseTruckNoGas = 3, + kASGrabTruckGrill = 5, + kASLeaveScene = 6, + kASTalkChicken = 7, + kASGrabChicken = 8, + kASGrabChickenDone = 9, + kASUseTruckNoKeysDone = 11, + kASUseGasWithTruckDone = 12, + kASUseTwigWithChicken = 16 +}; + +int GnapEngine::scene02_init() { + _gameSys->setAnimation(0, 0, 0); + return isFlag(9) ? 0x15A : 0x15B; +} + +void GnapEngine::scene02_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE); + setHotspot(kHSChicken, 606, 455, 702, 568, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + setHotspot(kHSTruck1, 385, 258, 464, 304, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 5); + setHotspot(kHSTruck2, 316, 224, 390, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 6); + setHotspot(kHSTruckGrill, 156, 318, 246, 390, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 7); + setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 5); + setHotspot(kHSExitBarn, 610, 0, 800, 164, SF_EXIT_U_CURSOR, 10, 5); + setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + setHotspot(kHSWalkArea1, 92, 140, 304, 430, 0, 3, 1); + setHotspot(kHSWalkArea2, 0, 0, 800, 380); + setHotspot(kHSWalkArea3, 0, 0, 386, 445); + setHotspot(kHSWalkArea4, 386, 0, 509, 410); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(0)) + _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspotsCount = 14; +} + +void GnapEngine::scene02_run() { + + playSound(0x1091C, 1); + startSoundTimerC(6); + + _s02_currChickenSequenceId = 0x14B; + _gameSys->setAnimation(0x14B, 179, 2); + _gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); + + _s02_nextChickenSequenceId = -1; + _timers[5] = getRandom(20) + 30; + _timers[4] = getRandom(100) + 300; + + queueInsertDeviceIcon(); + + switch (_prevSceneNum) { + case 3: + initGnapPos(11, 6, 3); + if (isFlag(0)) + initBeaverPos(12, 6, 4); + endSceneInit(); + if (isFlag(0)) + platypusWalkTo(9, 6, -1, 0x107C2, 1); + gnapWalkTo(8, 6, -1, 0x107BA, 1); + break; + case 4: + initGnapPos(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 3); + if (isFlag(0)) + initBeaverPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 4); + endSceneInit(); + gnapWalkTo(7, 6, 0, 0x107B9, 1); + if (isFlag(0)) + platypusWalkTo(8, 6, 1, 0x107C2, 1); + scene02_updateHotspots(); + _gameSys->waitForUpdate(); + break; + case 47: + clearFlag(25); + initGnapPos(5, 6, 3); + initBeaverPos(6, 7, 4); + endSceneInit(); + break; + case 49: + initGnapPos(5, 6, 1); + if (isFlag(0)) + initBeaverPos(6, 7, 0); + endSceneInit(); + break; + default: + initGnapPos(-1, 6, 1); + if (isFlag(0)) + initBeaverPos(-1, 7, 0); + endSceneInit(); + if (isFlag(0)) + platypusWalkTo(2, 7, -1, 0x107C2, 1); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + break; + } + + while (!_sceneDone) { + + updateMouseCursor(); + + updateCursorByHotspot(); + + testWalk(0, 6, 7, 6, 8, 6); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene02_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0 && isFlag(0)) { + if (_grabCursorSpriteIndex == kItemDisguise) { + gnapUseDisguiseOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(5)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSChicken: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemTwig) { + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, + 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASUseTwigWithChicken; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y + 1, 9, 8); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(9, 8); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 1; + if (gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _gnapActionStatus = kASGrabChicken; + else + _gnapActionStatus = -1; + break; + case TALK_CURSOR: + _gnapIdleFacing = 1; + gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkChicken; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSTruck1: + case kHSTruck2: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemKeys) { + if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + setGrabCursorSprite(-1); + invRemove(kItemKeys); + if (isFlag(8)) + _gnapActionStatus = kASUseTruckGas; + else + _gnapActionStatus = kASUseTruckNoGas; + } + } else if (_grabCursorSpriteIndex == kItemGas) { + _hotspots[kHSWalkArea4].flags |= SF_WALKABLE; + if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + _gnapActionStatus = kASUseGasWithTruck; + _hotspots[kHSWalkArea4].flags &= ~SF_WALKABLE; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 2, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(2, 2); + break; + case GRAB_CURSOR: + if (isFlag(9)) { + if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (isFlag(8)) + _gnapActionStatus = kASUseTruckGas; + else + _gnapActionStatus = kASUseTruckNoGas; + } + } else { + _gnapIdleFacing = 4; + if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + _gnapActionStatus = kASUseTruckNoKeys; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSTruckGrill: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 2, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(2, 4); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGrabTruckGrill; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitHouse: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 0, 0x107AD, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, -1, 0x107C1, 1); + scene02_updateHotspots(); + _newSceneNum = 4; + } + break; + + case kHSExitBarn: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y, 0, 0x107AD, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[7].x + 1, _hotspotsWalkPos[7].y, -1, 0x107C1, 1); + scene02_updateHotspots(); + _newSceneNum = 5; + } + break; + + case kHSExitCreek: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, -1, 0x107CD, 1); + _newSceneNum = 3; + } + break; + + case kHSExitPigpen: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[9].x, _hotspotsWalkPos[9].y, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[9].x, _hotspotsWalkPos[9].y, -1, 0x107CF, 1); + _newSceneNum = 1; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene02_updateAnimations(); + + if (!isSoundPlaying(0x1091C)) + playSound(0x1091C, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && isFlag(0)) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[4]) { + // Update bird animation + _timers[4] = getRandom(100) + 300; + if (getRandom(2) != 0) + _gameSys->insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_timers[5] && _s02_nextChickenSequenceId == -1 && _gnapActionStatus != 7 && _gnapActionStatus != 8) { + if (getRandom(6) != 0) { + _s02_nextChickenSequenceId = 0x14B; + _timers[5] = getRandom(20) + 30; + } else { + _s02_nextChickenSequenceId = 0x14D; + _timers[5] = getRandom(20) + 50; + } + } + playSoundC(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene02_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene02_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + switch (_gnapActionStatus) { + case kASUseTruckNoKeys: + _gameSys->insertSequence(0x14E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x14E, _gnapId, 0); + _gnapSequenceId = 0x14E; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASUseTruckNoKeysDone; + break; + case kASUseGasWithTruck: + _gameSys->insertSequence(0x151, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x151, _gnapId, 0); + _gnapSequenceId = 0x151; + _gnapSequenceDatNum = 0; + invRemove(kItemGas); + setGrabCursorSprite(-1); + setFlag(8); + _gnapActionStatus = kASUseGasWithTruckDone; + break; + case kASUseTruckGas: + _timers[5] = 9999; + _timers[4] = 9999; + hideCursor(); + setGrabCursorSprite(-1); + if (!isFlag(9)) { + _gameSys->insertSequence(0x14F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->waitForUpdate(); + setFlag(9); + _gnapSequenceId = 0x14F; + _gnapSequenceDatNum = 0; + invRemove(kItemKeys); + setGrabCursorSprite(-1); + } + _newSceneNum = 47; + _sceneDone = true; + break; + case kASUseTruckNoGas: + hideCursor(); + setGrabCursorSprite(-1); + _timers[4] = 250; + if (!isFlag(9)) { + _gameSys->insertSequence(0x14F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->waitForUpdate(); + setFlag(9); + _gnapSequenceId = 0x14F; + _gnapSequenceDatNum = 0; + invRemove(kItemKeys); + setGrabCursorSprite(-1); + } + _newSceneNum = 47; + _sceneDone = true; + setFlag(25); + break; + case kASGrabTruckGrill: + switch (_s02_truckGrillCtr) { + case 0: + _s02_gnapTruckSequenceId = 0x158; + break; + case 1: + _s02_gnapTruckSequenceId = 0x159; + break; + case 2: + _s02_gnapTruckSequenceId = 0x157; + break; + } + _s02_truckGrillCtr = (_s02_truckGrillCtr + 1) % 3; + _gameSys->insertSequence(_s02_gnapTruckSequenceId, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s02_gnapTruckSequenceId, _gnapId, 0); + _gnapSequenceId = _s02_gnapTruckSequenceId; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + break; + case kASLeaveScene: + _sceneDone = true; + break; + case kASTalkChicken: + _s02_nextChickenSequenceId = 0x14C; + break; + case kASGrabChicken: + _s02_nextChickenSequenceId = 0x150; + _timers[2] = 100; + break; + case kASGrabChickenDone: + _gameSys->insertSequence(0x107B5, _gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7B5; + _gnapSequenceDatNum = 1; + _s02_currChickenSequenceId = 0x14B; + _gameSys->setAnimation(0x14B, 179, 2); + _gameSys->insertSequence(_s02_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _gnapActionStatus = -1; + _timers[5] = 30; + break; + case kASUseTwigWithChicken: + playGnapShowItem(5, 0, 0); + _gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, 32, 0, 0, 0); + _s02_currChickenSequenceId = 0x155; + _s02_nextChickenSequenceId = -1; + _gnapActionStatus = -1; + break; + case kASUseTruckNoKeysDone: + case kASUseGasWithTruckDone: + default: + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + if (_s02_nextChickenSequenceId == 0x150) { + _gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 0); + _gameSys->insertSequence(_s02_nextChickenSequenceId, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(_s02_currChickenSequenceId, 179, 1); + _s02_nextChickenSequenceId = -1; + _s02_currChickenSequenceId = -1; + _gnapActionStatus = kASGrabChickenDone; + _timers[5] = 500; + } else if (_s02_nextChickenSequenceId == 0x14C) { + _gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); + _gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _s02_currChickenSequenceId = _s02_nextChickenSequenceId; + _s02_nextChickenSequenceId = -1; + _gnapActionStatus = -1; + } else if (_s02_nextChickenSequenceId != -1) { + _gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); + _gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _s02_currChickenSequenceId = _s02_nextChickenSequenceId; + _s02_nextChickenSequenceId = -1; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp new file mode 100644 index 0000000000..6f191dc6e3 --- /dev/null +++ b/engines/gnap/scenes/scene03.cpp @@ -0,0 +1,517 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSGrass = 1, + kHSExitTruck = 2, + kHSCreek = 3, + kHSTrappedPlatypus = 4, + kHSDevice = 5, + kHSWalkAreas1 = 6, + kHSWalkAreas2 = 7, + kHSPlatypusWalkArea = 8, + kHSWalkAreas3 = 9 +}; + +enum { + kASLeaveScene = 0, + kASFreePlatypus = 1, + kASHypnotizePlat = 2, + kASHypnotizeScaredPlat = 3, + kASFreePlatypusDone = 4, + kASGrabPlatypus = 5, + kASGrabCreek = 6, + kASGrabCreekDone = 7, + kASGrabScaredPlatypus = 8 +}; + +int GnapEngine::scene03_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 5); + return 0x1CC; +} + +void GnapEngine::scene03_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSGrass, 646, 408, 722, 458, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + setHotspot(kHSExitTruck, 218, 64, 371, 224, SF_EXIT_U_CURSOR | SF_WALKABLE, 4, 4); + setHotspot(kHSCreek, 187, 499, 319, 587, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + setHotspot(kHSTrappedPlatypus, 450, 256, 661, 414, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 5); + setHotspot(kHSWalkAreas1, 0, 500, 300, 600); + setHotspot(kHSWalkAreas2, 300, 447, 800, 600); + setHotspot(kHSPlatypusWalkArea, 235, 0, 800, 600); + setHotspot(kHSWalkAreas3, 0, 0, 800, 354); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(0)) + _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (isFlag(6)) + _hotspots[kHSGrass].flags = SF_WALKABLE | SF_DISABLED; + if (isFlag(0)) + _hotspots[kHSTrappedPlatypus].flags = SF_DISABLED; + if (isFlag(0) || _s03_platypusHypnotized) + _hotspots[kHSPlatypusWalkArea].flags |= SF_WALKABLE; + _hotspotsCount = 10; +} + +void GnapEngine::scene03_run() { + + playSound(0x10925, 1); + + startSoundTimerC(7); + + _gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); + + _s03_platypusHypnotized = false; + + initGnapPos(3, 4, 1); + + _gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); + + _s03_currFrogSequenceId = 0x1C6; + _s03_nextFrogSequenceId = -1; + _gameSys->setAnimation(0x1C6, 253, 2); + + _timers[6] = getRandom(20) + 30; + _timers[4] = getRandom(100) + 300; + _timers[5] = getRandom(100) + 200; + + if (isFlag(0)) { + initBeaverPos(5, 4, 0); + } else { + _timers[1] = getRandom(40) + 20; + _gameSys->setAnimation(0x1C2, 99, 1); + _gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); + _beaverSequenceId = 0x1C2; + _beaverSequenceDatNum = 0; + } + + _gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); + + if (!isFlag(6)) + _gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + endSceneInit(); + + if (isFlag(0)) + platypusWalkTo(4, 7, -1, 0x107C2, 1); + gnapWalkTo(3, 6, -1, 0x107B9, 1); + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSPlatypus: + if (_gnapActionStatus < 0 && isFlag(0)) { + if (_grabCursorSpriteIndex == kItemDisguise) { + gnapUseDisguiseOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(5)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSGrass: + if (_gnapActionStatus < 0) { + if (isFlag(6)) { + gnapWalkTo(-1, -1, -1, -1, 1); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, 9, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(9, 6); + break; + case GRAB_CURSOR: + playGnapPullOutDevice(9, 6); + playGnapUseDevice(0, 0); + _gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x1B3, 253, 5); + _hotspots[kHSGrass].flags |= SF_WALKABLE | SF_DISABLED; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitTruck: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _hotspots[kHSPlatypusWalkArea].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107AD, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, -1, 0x107C2, 1); + _hotspots[kHSPlatypusWalkArea].flags &= ~SF_WALKABLE; + if (_cursorValue == 1) + _newSceneNum = 2; + else + _newSceneNum = 33; + } + break; + + case kHSCreek: + if (_gnapActionStatus == -1) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(2, 8); + break; + case GRAB_CURSOR: + if (!isFlag(0)) + _hotspots[kHSPlatypusWalkArea].flags |= SF_WALKABLE; + if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y + 1) | 0x10000, 1)) + _gnapActionStatus = kASGrabCreek; + if (!isFlag(0)) + _hotspots[kHSPlatypusWalkArea].flags &= ~SF_WALKABLE; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSTrappedPlatypus: + if (_gnapActionStatus < 0) { + if (isFlag(0)) { + gnapWalkTo(-1, -1, -1, -1, 1); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, 8, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(8, 4); + break; + case GRAB_CURSOR: + if (_s03_platypusHypnotized) { + gnapWalkTo(7, 6, 0, 0x107B5, 1); + _gnapActionStatus = kASFreePlatypus; + } else { + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + if (_s03_platypusScared) + _gnapActionStatus = kASGrabScaredPlatypus; + else + _gnapActionStatus = kASGrabPlatypus; + } + break; + case TALK_CURSOR: + if (_s03_platypusHypnotized) { + playGnapBrainPulsating(8, 4); + } else { + _gnapIdleFacing = 1; + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + if (_s03_platypusScared) + _gnapActionStatus = kASHypnotizeScaredPlat; + else + _gnapActionStatus = kASHypnotizePlat; + } + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene03_updateHotspots(); + } + break; + + case kHSWalkAreas1: + case kHSWalkAreas2: + case kHSWalkAreas3: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHSPlatypusWalkArea: + if (_gnapActionStatus < 0) { + if (isFlag(0) || _s03_platypusHypnotized) { + gnapWalkTo(-1, -1, -1, -1, 1); + } else { + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107B5, 1); + if (_s03_platypusScared) + _gnapActionStatus = kASGrabScaredPlatypus; + else + _gnapActionStatus = kASGrabPlatypus; + } + } + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene03_updateAnimations(); + + if (!isSoundPlaying(0x10925)) + playSound(0x10925, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && isFlag(0)) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[1] && !_s03_platypusScared) { + _timers[1] = getRandom(40) + 20; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && !isFlag(0) && !_s03_platypusHypnotized) + _s03_nextPlatSequenceId = 450; + } + if (!_timers[6]) { + _timers[6] = getRandom(20) + 30; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s03_nextFrogSequenceId == -1) { + if (getRandom(5) == 1) + _s03_nextFrogSequenceId = 0x1C6; + else + _s03_nextFrogSequenceId = 0x1C7; + } + } + if (!_timers[4]) { + // Update bird animation + _timers[4] = getRandom(100) + 300; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0) + _gameSys->insertSequence(getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_timers[5]) { + _timers[5] = getRandom(100) + 200; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + _gameSys->setAnimation(0x1C5, 253, 4); + _gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); + } + } + playSoundC(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene03_updateHotspots(); + _timers[5] = getRandom(100) + 200; + _timers[4] = getRandom(100) + 300; + _timers[6] = getRandom(20) + 30; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene03_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + break; + case kASFreePlatypus: + _s03_nextPlatSequenceId = 0x1BC; + break; + case kASFreePlatypusDone: + _gnapActionStatus = -1; + _platX = 6; + _platY = 6; + _beaverFacing = 4; + _beaverId = 120; + _gameSys->insertSequence(0x107CA, _beaverId, 0x1BC, 99, + kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + _gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); + _beaverSequenceDatNum = 1; + _beaverSequenceId = 0x7CA; + setFlag(0); + _s03_nextPlatSequenceId = -1; + scene03_updateHotspots(); + break; + case kASHypnotizePlat: + playGnapBrainPulsating(0, 0); + addFullScreenSprite(0x106, 255); + _gameSys->setAnimation(0x1C9, 256, 1); + _gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(1) != 2) + gameUpdateTick(); + removeFullScreenSprite(); + _gameSys->setAnimation(0x1BA, 99, 1); + _gameSys->insertSequence(0x1BA, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, 32, 0, 0, 0); + _beaverSequenceDatNum = 0; + _beaverSequenceId = 0x1BA; + _gnapActionStatus = -1; + _s03_platypusHypnotized = true; + scene03_updateHotspots(); + break; + case kASHypnotizeScaredPlat: + playGnapBrainPulsating(0, 0); + _gameSys->insertSequence(0x1BF, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, 32, 0, 0, 0); + _gameSys->setAnimation(0x1BF, 99, 1); + while (_gameSys->getAnimationStatus(1) != 2) + gameUpdateTick(); + addFullScreenSprite(0x106, 255); + _gameSys->setAnimation(0x1C9, 256, 1); + _gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(1) != 2) + gameUpdateTick(); + removeFullScreenSprite(); + _gameSys->setAnimation(0x1BA, 99, 1); + _gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); + _beaverSequenceDatNum = 0; + _beaverSequenceId = 0x1BA; + _gnapActionStatus = -1; + _s03_platypusHypnotized = true; + scene03_updateHotspots(); + break; + case kASGrabPlatypus: + _s03_nextPlatSequenceId = 0x1BD; + _s03_platypusHypnotized = false; + break; + case kASGrabScaredPlatypus: + _s03_nextPlatSequenceId = 0x1C0; + _s03_platypusHypnotized = false; + break; + case kASGrabCreek: + _gameSys->insertSequence(0x1B4, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x1B4, _gnapId, 0); + _gnapSequenceId = 0x1B4; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASGrabCreekDone; + break; + default: + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + if (_s03_nextPlatSequenceId == 0x1BD || _s03_nextPlatSequenceId == 0x1C0) { + _gameSys->setAnimation(0, 0, 1); + _s03_platypusScared = true; + _gameSys->insertSequence(0x1B5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_s03_nextPlatSequenceId, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x1B5; + _gnapSequenceDatNum = 0; + _gnapIdleFacing = 0; + _beaverSequenceId = _s03_nextPlatSequenceId; + _beaverSequenceDatNum = 0; + _gameSys->setAnimation(_s03_nextPlatSequenceId, 99, 1); + _s03_nextPlatSequenceId = -1; + _gnapActionStatus = -1; + } else if (_s03_nextPlatSequenceId == 0x1BC) { + _gnapX = 3; + _gnapY = 6; + _gameSys->insertSequence(0x1B6, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x1BC, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x1BC, 99, 0); + _gnapId = 20 * _gnapY; + _gnapSequenceId = 0x1B6; + _gnapSequenceDatNum = 0; + _gnapIdleFacing = 0; + _gnapActionStatus = kASFreePlatypusDone; + _s03_nextPlatSequenceId = -1; + } else if (_s03_nextPlatSequenceId == 0x1C2 && !_s03_platypusScared) { + _gameSys->setAnimation(0, 0, 1); + _gameSys->insertSequence(0x1C2, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _beaverSequenceId = 0x1C2; + _beaverSequenceDatNum = 0; + _gameSys->setAnimation(0x1C2, 99, 1); + _s03_nextPlatSequenceId = -1; + } else if (_s03_nextPlatSequenceId == -1 && _s03_platypusScared && !_s03_platypusHypnotized) { + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0x1BE, 99, 1); + _gameSys->insertSequence(0x1BE, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _beaverSequenceId = 0x1BE; + _beaverSequenceDatNum = 0; + _s03_nextPlatSequenceId = -1; + } + } + + if (_gameSys->getAnimationStatus(2) == 2 && _s03_nextFrogSequenceId != -1) { + _gameSys->setAnimation(_s03_nextFrogSequenceId, 253, 2); + _gameSys->insertSequence(_s03_nextFrogSequenceId, 253, _s03_currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); + _s03_currFrogSequenceId = _s03_nextFrogSequenceId; + _s03_nextFrogSequenceId = -1; + } + + if (_gameSys->getAnimationStatus(5) == 2) { + _gameSys->setAnimation(0, 0, 5); + invAdd(kItemGrass); + setGrabCursorSprite(kItemGrass); + setFlag(6); + scene03_updateHotspots(); + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp new file mode 100644 index 0000000000..bc5ee855d3 --- /dev/null +++ b/engines/gnap/scenes/scene04.cpp @@ -0,0 +1,571 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSTwig = 1, + kHSDog = 2, + kHSAxe = 3, + kHSDoor = 4, + kHSExitTruck = 5, + kHSDevice = 6, + kHSWindow = 7, + kHSExitBarn = 8, + kHSWalkArea1 = 9, + kHSWalkArea2 = 10 +}; + +enum { + kASOpenDoor = 1, + kASGetKeyFirst = 2, + kASGetKeyAnother = 3, + kASLeaveScene = 4, + kASGetKeyFirstDone = 6, + kASGetKeyFirst2 = 7, + kASGetKeyAnother2 = 8, + kASGetKeyAnotherDone = 9, + kASOpenDoorDone = 10, + kASGrabDog = 12, + kASGrabAxe = 13 +}; + +int GnapEngine::scene04_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + return 0x214; +} + +void GnapEngine::scene04_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSTwig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + setHotspot(kHSDog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + setHotspot(kHSAxe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + setHotspot(kHSDoor, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + setHotspot(kHSExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSWindow, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + setHotspot(kHSExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); + setHotspot(kHSWalkArea1, 0, 0, 562, 461); + setHotspot(kHSWalkArea2, 562, 0, 800, 500); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(0)) + _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (isFlag(3)) + _hotspots[kHSTwig].flags = SF_WALKABLE | SF_DISABLED; + if (isFlag(26) || _cursorValue == 1) + _hotspots[kHSAxe].flags = SF_DISABLED; + _hotspotsCount = 11; +} + +void GnapEngine::scene04_run() { + + playSound(0x1091C, 1); + startSoundTimerC(4); + + _gameSys->insertSequence(0x210, 139 - _s04_dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); + + _s04_currDogSequenceId = 0x210; + _s04_nextDogSequenceId = -1; + + _gameSys->setAnimation(0x210, 139 - _s04_dogIdCtr, 3); + _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; + _timers[6] = getRandom(20) + 60; + _timers[5] = getRandom(150) + 300; + _timers[7] = getRandom(150) + 200; + _timers[8] = getRandom(150) + 400; + + if (!isFlag(26) && _cursorValue == 4) + _gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); + + if (!isFlag(3)) + _gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + if (isFlag(10)) { + _timers[3] = 300; + // TODO setCursor((LPCSTR)IDC_WAIT); + setGrabCursorSprite(kItemKeys); + _gnapX = 4; + _gnapY = 7; + _gnapId = 140; + _platX = 6; + _platY = 7; + _beaverId = 141; + _gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _gnapGridX, 336 - _gnapGridY); + _gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); + endSceneInit(); + invRemove(kItemDisguise); + invAdd(kItemKeys); + setFlag(5); + clearFlag(10); + _beaverSequenceId = 0x20C; + _beaverSequenceDatNum = 0; + _beaverFacing = 1; + _gnapSequenceId = 0x7B5; + _gnapSequenceDatNum = 1; + _gameSys->waitForUpdate(); + } else { + _gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); + if (_prevSceneNum == 2) { + initGnapPos(5, 11, 7); + if (isFlag(0)) + initBeaverPos(6, 11, 5); + endSceneInit(); + if (isFlag(0)) + platypusWalkTo(5, 8, -1, 0x107C2, 1); + gnapWalkTo(6, 9, -1, 0x107BA, 1); + } else if (_prevSceneNum == 38) { + initGnapPos(5, 7, 1); + initBeaverPos(4, 7, 0); + endSceneInit(); + } else { + initGnapPos(12, 9, 1); + if (isFlag(0)) + initBeaverPos(12, 8, 0); + endSceneInit(); + if (isFlag(0)) + platypusWalkTo(9, 8, -1, 0x107C2, 1); + gnapWalkTo(9, 9, -1, 0x107BA, 1); + } + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 4, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene04_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0 && isFlag(0)) { + if (_grabCursorSpriteIndex == kItemDisguise) { + gnapUseDisguiseOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(5)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + if (_cursorValue == 4) + gnapKissPlatypus(0); + else + playGnapMoan1(_platX, _platY); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSTwig: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, 9, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); + break; + case GRAB_CURSOR: + playGnapPullOutDevice(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); + playGnapUseDevice(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); + _gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x1FD, 100, 2); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSAxe: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 9, 5); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGrabAxe; + setFlag(26); + scene04_updateHotspots(); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSDog: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 9, 7); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (gnapWalkTo(_gnapX, _gnapY, 0, -1, 1)) { + playGnapMoan2(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y); + _s04_nextDogSequenceId = 0x20F; + } + break; + case GRAB_CURSOR: + _gnapIdleFacing = 1; + if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _gnapActionStatus = kASGrabDog; + break; + case TALK_CURSOR: + _gnapIdleFacing = 1; + if (gnapWalkTo(_gnapX, _gnapY, 0, -1, 1)) { + playGnapBrainPulsating(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y); + _s04_nextDogSequenceId = 0x20E; + } + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSDoor: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 4, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + case PLAT_CURSOR: + playGnapScratchingHead(4, 3); + break; + case GRAB_CURSOR: + if (_cursorValue == 1) { + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _gnapActionStatus = kASOpenDoor; + _timers[5] = 300; + _gnapIdleFacing = 5; + } else { + _isLeavingScene = true; + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _gnapActionStatus = kASLeaveScene; + _newSceneNum = 38; + } + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitTruck: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, -1, 0x107C7, 1); + if (_cursorValue == 1) + _newSceneNum = 2; + else + _newSceneNum = 33; + } + break; + + case kHSWindow: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 2, 3); + } else if (isFlag(5)) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (gnapWalkTo(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y, 0, getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_s04_triedWindow) { + _gnapActionStatus = kASGetKeyAnother; + } else { + _gnapActionStatus = kASGetKeyFirst; + _s04_triedWindow = true; + } + } + break; + case GRAB_CURSOR: + playGnapScratchingHead(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitBarn: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); + if (_cursorValue == 1) + _newSceneNum = 5; + else + _newSceneNum = 35; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene04_updateAnimations(); + + if (!isSoundPlaying(0x1091C)) + playSound(0x1091C, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && isFlag(0)) + beaverSub426234(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence2(); + if (!_timers[5]) { + _timers[5] = getRandom(150) + 300; + if (_gnapActionStatus < 0) + _gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_timers[7]) { + _timers[7] = getRandom(150) + 200; + _gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_timers[6]) { + _timers[6] = getRandom(20) + 60; + if (_s04_nextDogSequenceId == -1) + _s04_nextDogSequenceId = 0x210; + } + if (!_timers[8]) { + _timers[8] = getRandom(150) + 400; + _gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); + } + playSoundC(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene04_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene04_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + break; + case kASOpenDoor: + _gameSys->insertSequence(0x205, _gnapId, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); + _gnapX = 6; + _gnapY = 7; + _gameSys->insertSequence(0x107B5, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, getSequenceTotalDuration(0x205) - 1, 450 - _gnapGridX, 336 - _gnapGridY); + _gameSys->setAnimation(0x107B5, _gnapId, 0); + _gnapSequenceId = 0x7B5; + _gnapSequenceDatNum = 1; + _gnapActionStatus = kASOpenDoorDone; + break; + case kASOpenDoorDone: + _gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = -1; + break; + case kASGetKeyFirst: + _gameSys->insertSequence(0x204, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x204, _gnapId, 0); + _gnapSequenceId = 0x204; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASGetKeyFirst2; + break; + case kASGetKeyFirst2: + _gameSys->insertSequence(0x206, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(0x20B, 256, 0); + _gnapSequenceId = 0x206; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASGetKeyFirstDone; + break; + case kASGetKeyFirstDone: + _gameSys->requestRemoveSequence(0x1FF, 256); + _gameSys->requestRemoveSequence(0x20B, 256); + _gameSys->insertSequence(0x107B5, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapIdleFacing = 1; + _gnapSequenceId = 0x7B5; + _gnapSequenceDatNum = 1; + _gnapActionStatus = -1; + break; + case kASGetKeyAnother: + _gameSys->insertSequence(0x202, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x202, _gnapId, 0); + _gnapSequenceId = 0x202; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASGetKeyAnother2; + break; + case kASGetKeyAnother2: + _gameSys->insertSequence(0x203, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(0x20A, 256, 0); + _gnapSequenceId = 0x203; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASGetKeyAnotherDone; + break; + case kASGetKeyAnotherDone: + _gameSys->removeSequence(0x1FF, 256, 1); + _gameSys->removeSequence(0x20A, 256, 1); + _gameSys->insertSequence(0x107B5, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7B5; + _gnapSequenceDatNum = 1; + _gnapIdleFacing = 1; + _gnapActionStatus = -1; + break; + case kASGrabDog: + _s04_nextDogSequenceId = 0x201; + break; + case kASGrabAxe: + _gameSys->insertSequence(0x211, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->requestRemoveSequence(0x212, 100); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x211; + _gnapActionStatus = -1; + break; + default: + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + _gameSys->setAnimation(0, 0, 2); + invAdd(kItemTwig); + setGrabCursorSprite(kItemTwig); + setFlag(3); + scene04_updateHotspots(); + } + + if (_gameSys->getAnimationStatus(3) == 2) { + if (_s04_nextDogSequenceId == 0x201) { + _gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, + _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, + kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x200, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); + _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; + _s04_currDogSequenceId = 0x201; + _gnapSequenceId = 0x200; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + _timers[6] = getRandom(20) + 60; + _s04_nextDogSequenceId = -1; + } else if (_s04_nextDogSequenceId != -1) { + _gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, + _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, + kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); + _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; + _s04_currDogSequenceId = _s04_nextDogSequenceId; + _s04_nextDogSequenceId = -1; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp new file mode 100644 index 0000000000..fdc6ba16fe --- /dev/null +++ b/engines/gnap/scenes/scene05.cpp @@ -0,0 +1,467 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSHaystack = 1, + kHSPadlock = 2, + kHSLadder = 3, + kHSExitHouse = 4, + kHSChicken = 5, + kHSDevice = 6, + kHSWalkArea1 = 7, + kHSWalkArea2 = 8, + kHSWalkArea3 = 9 +}; + +enum { + kASPlatSearchHaystack = 0, + kASTryPickPadlock = 1, + kASPickPadlock = 2, + kASTalkChicken = 3, + kASGrabChicken = 4, + kASGrabLadder = 5, + kASEnterBarn = 6, + kASUseTwigWithChicken = 11, + kASLeaveScene = 12 +}; + +int GnapEngine::scene05_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 3); + return isFlag(7) ? 0x151 : 0x150; +} + +void GnapEngine::scene05_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSHaystack, 236, 366, 372, 442, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + setHotspot(kHSPadlock, 386, 230, 626, 481, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + setHotspot(kHSLadder, 108, 222, 207, 444, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + setHotspot(kHSExitHouse, 0, 395, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + setHotspot(kHSChicken, 612, 462, 722, 564, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + setHotspot(kHSWalkArea1, 104, 0, 421, 480); + setHotspot(kHSWalkArea2, 422, 0, 800, 487); + setHotspot(kHSWalkArea3, 0, 0, 104, 499); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(0)) + _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (isFlag(7)) + _hotspots[kHSPadlock].flags = SF_EXIT_U_CURSOR; + _hotspotsCount = 10; +} + +void GnapEngine::scene05_run() { + + playSound(0x1091C, 1); + startSoundTimerC(7); + + _s05_currChickenSequenceId = 0x142; + _gameSys->setAnimation(0x142, 100, 3); + _gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); + + _s05_nextChickenSequenceId = -1; + + _timers[5] = getRandom(10) + 30; + _timers[6] = getRandom(150) + 300; + + if (isFlag(7)) + _gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + if (_prevSceneNum != 6 && _prevSceneNum != 36) { + initGnapPos(-1, 8, 1); + if (isFlag(0)) + initBeaverPos(-1, 9, 0); + endSceneInit(); + if (isFlag(0)) + platypusWalkTo(2, 8, -1, 0x107C2, 1); + gnapWalkTo(2, 9, -1, 0x107B9, 1); + } else { + initGnapPos(6, 8, 1); + if (isFlag(0)) + initBeaverPos(7, 9, 0); + endSceneInit(); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 12, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene05_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0 && isFlag(0)) { + if (_grabCursorSpriteIndex == kItemDisguise) { + gnapUseDisguiseOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(5)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSHaystack: + if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[1].x - 2, _hotspotsWalkPos[1].y, 4, 5); + } else if (isFlag(2)) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y - 1); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (isFlag(0)) { + gnapUseDeviceOnBeaver(); + if (platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { + _beaverActionStatus = kASPlatSearchHaystack; + _beaverFacing = 4; + } + if (_gnapX == 4 && (_gnapY == 8 || _gnapY == 7)) + gnapWalkStep(); + playGnapIdle(_platX, _platY); + } + break; + } + } + } + break; + + case kHSChicken: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemTwig) { + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, + 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASUseTwigWithChicken; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, 9, 7); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(9, 7); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 1; + gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGrabChicken; + break; + case TALK_CURSOR: + _gnapIdleFacing = 1; + gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkChicken; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSLadder: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 2, 5); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(2, 4); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 3; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGrabLadder; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSPadlock: + if (isFlag(7)) { + _isLeavingScene = true; + gnapWalkTo(_hotspotsWalkPos[2].x - 1, _hotspotsWalkPos[2].y + 1, 0, -1, 1); + _gnapActionStatus = kASEnterBarn; + if (_cursorValue == 1) + _newSceneNum = 6; + else + _newSceneNum = 36; + } else if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemNeedle) { + if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, + getGnapSequenceId(gskIdle, _hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y) | 0x10000, 1)) + _gnapActionStatus = kASPickPadlock; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 7, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(7, 4); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, + 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTryPickPadlock; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitHouse: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(0)) + platypusWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); + if (_cursorValue == 1) + _newSceneNum = 4; + else + _newSceneNum = 37; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHSWalkArea3: + // Nothing + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene05_updateAnimations(); + + if (!isSoundPlaying(0x1091C)) + playSound(0x1091C, 1); + + if (!_isLeavingScene) { + if (isFlag(0)) + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[5]) { + _timers[5] = getRandom(20) + 30; + if (_gnapActionStatus != kASTalkChicken && _s05_nextChickenSequenceId == -1) { + if (getRandom(4) != 0) + _s05_nextChickenSequenceId = 0x142; + else + _s05_nextChickenSequenceId = 0x143; + } + } + if (!_timers[6]) { + _timers[6] = getRandom(150) + 300; + if (_gnapActionStatus < 0) + _gameSys->insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); + } + playSoundC(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene05_updateHotspots(); + _timers[5] = getRandom(20) + 30; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene05_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + _gnapActionStatus = -1; + break; + case kASTryPickPadlock: + _gameSys->insertSequence(0x148, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x148; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + break; + case kASPickPadlock: + _gameSys->setAnimation(0x147, _gnapId, 0); + _gameSys->insertSequence(0x147, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x147; + _gnapSequenceDatNum = 0; + setFlag(7); + setFlag(11); + setGrabCursorSprite(-1); + _newSceneNum = 6; + _timers[2] = 100; + invRemove(kItemNeedle); + _gnapActionStatus = kASLeaveScene; + break; + case kASTalkChicken: + _s05_nextChickenSequenceId = 0x144; + _gnapActionStatus = -1; + break; + case kASGrabChicken: + _s05_nextChickenSequenceId = 0x14B; + break; + case kASGrabLadder: + while (_gameSys->isSequenceActive(0x149, 39)) + gameUpdateTick(); + _gameSys->insertSequence(0x14E, _gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x14D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x14D; + _gnapSequenceDatNum = 0; + _timers[2] = 200; + _timers[6] = 300; + _gnapActionStatus = -1; + break; + case kASEnterBarn: + _gameSys->insertSequence(0x107B1, 1, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gameSys->setAnimation(0x107B1, 1, 0); + _gnapActionStatus = kASLeaveScene; + break; + case kASUseTwigWithChicken: + playGnapShowItem(5, 0, 0); + _s05_nextChickenSequenceId = 0x14F; + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + if (_beaverSequenceId == 0x146) { + _platX = 4; + _platY = 8; + _gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _platGridX, 384 - _platGridY); + _beaverSequenceId = 0x7C1; + _beaverSequenceDatNum = 1; + _beaverId = 20 * _platY; + invAdd(kItemNeedle); + setFlag(2); + setGrabCursorSprite(kItemNeedle); + showCursor(); + _timers[1] = 30; + _beaverActionStatus = -1; + } + if (_beaverActionStatus == kASPlatSearchHaystack) { + _gameSys->setAnimation(0, 0, 1); + _gameSys->insertSequence(0x145, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x146, 256, 0x145, _beaverId, kSeqSyncWait, 0, 0, 0); + hideCursor(); + setGrabCursorSprite(-1); + _beaverSequenceId = 0x146; + _beaverSequenceDatNum = 0; + _gameSys->setAnimation(0x146, 256, 1); + _timers[1] = 300; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + if (_s05_nextChickenSequenceId == 0x14B) { + _gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); + _gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x14C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x14C; + _s05_currChickenSequenceId = _s05_nextChickenSequenceId; + _s05_nextChickenSequenceId = -1; + _gnapActionStatus = -1; + } else if (_s05_nextChickenSequenceId != -1) { + _gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); + _gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _s05_currChickenSequenceId = _s05_nextChickenSequenceId; + _s05_nextChickenSequenceId = -1; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp new file mode 100644 index 0000000000..3878d3514e --- /dev/null +++ b/engines/gnap/scenes/scene06.cpp @@ -0,0 +1,446 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSGas = 1, + kHSLadder = 2, + kHSHorse = 3, + kHSExitOutsideBarn = 4, + kHSDevice = 5, + kHSWalkArea1 = 6, + kHSWalkArea2 = 7, + kHSWalkArea3 = 8, + kHSWalkArea4 = 9, + kHSWalkArea5 = 10 +}; + +enum { + kASTryToGetGas = 0, + kASTryToClimbLadder = 1, + kASTryToClimbLadderDone = 2, + kASTalkToHorse = 3, + kASUseTwigOnHorse = 4, + kASLeaveScene = 5 +}; + +int GnapEngine::scene06_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + if (isFlag(11)) { + playSound(0x11B, 0); + clearFlag(11); + } + return 0x101; +} + +void GnapEngine::scene06_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSGas, 300, 120, 440, 232, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + setHotspot(kHSLadder, 497, 222, 614, 492, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + setHotspot(kHSHorse, 90, 226, 259, 376, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + setHotspot(kHSExitOutsideBarn, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + setHotspot(kHSWalkArea1, 0, 0, 200, 515); + setHotspot(kHSWalkArea2, 200, 0, 285, 499); + setHotspot(kHSWalkArea3, 688, 0, 800, 499); + setHotspot(kHSWalkArea4, 475, 469, 800, 505); + setHotspot(kHSWalkArea5, 0, 0, 800, 504); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(29)) + _hotspots[kHSLadder].flags = SF_DISABLED; + if (_cursorValue == 4) { + _hotspots[kHSLadder].flags = SF_DISABLED; + _hotspots[kHSGas].flags = SF_DISABLED; + } + _hotspotsCount = 11; +} + +void GnapEngine::scene06_run() { + bool triedDeviceOnGas = false; + + startSoundTimerC(7); + + _s06_horseTurnedBack = false; + _gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); + + _s06_currHorseSequenceId = 0xF1; + _s06_nextHorseSequenceId = -1; + + _gameSys->setAnimation(0xF1, 120, 2); + + _timers[4] = getRandom(40) + 25; + + if (isFlag(4)) + _gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); + + if (!isFlag(29) && _cursorValue != 4) + _gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + initGnapPos(5, 12, 1); + initBeaverPos(6, 12, 0); + endSceneInit(); + + platypusWalkTo(6, 8, -1, 0x107C2, 1); + gnapWalkTo(5, 8, -1, 0x107B9, 1); + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 5, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene06_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemDisguise) { + gnapUseDisguiseOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(5)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSGas: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 5, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(5, 0); + break; + case GRAB_CURSOR: + if (isFlag(4)) { + playGnapImpossible(0, 0); + } else if (triedDeviceOnGas) { + _hotspots[kHSWalkArea5].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107BC, 1); + _hotspots[kHSWalkArea5].flags &= ~SF_WALKABLE; + _gnapActionStatus = kASTryToGetGas; + } else { + triedDeviceOnGas = true; + playGnapPullOutDeviceNonWorking(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + if (isFlag(4)) + playGnapImpossible(0, 0); + else + playGnapScratchingHead(5, 0); + break; + } + } + } + break; + + case kHSLadder: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 8, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(8, 4); + break; + case GRAB_CURSOR: + if (isFlag(29)) + playGnapImpossible(0, 0); + else { + gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107BB, 1); + _gnapActionStatus = kASTryToClimbLadder; + setFlag(29); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSHorse: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemTwig && _s06_horseTurnedBack) { + _hotspots[kHSWalkArea5].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _hotspots[kHSWalkArea5].flags &= ~SF_WALKABLE; + _gnapIdleFacing = 5; + platypusWalkTo(6, 8, 1, 0x107C2, 1); + _beaverFacing = 0; + _gnapActionStatus = kASUseTwigOnHorse; + setGrabCursorSprite(-1); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 3, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(3, 2); + break; + case TALK_CURSOR: + if (_s06_horseTurnedBack) { + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); + } else { + _gnapIdleFacing = 3; + _hotspots[kHSWalkArea5].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _hotspots[kHSWalkArea5].flags &= ~SF_WALKABLE; + _gnapActionStatus = kASTalkToHorse; + } + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitOutsideBarn: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + if (_cursorValue == 1) + _newSceneNum = 5; + else + _newSceneNum = 35; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + case kHSWalkArea5: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + + scene06_updateAnimations(); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(40) + 25; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s06_nextHorseSequenceId == -1) { + if (_s06_horseTurnedBack) { + _s06_nextHorseSequenceId = 0xF5; + } else { + switch (getRandom(5)) { + case 0: + case 1: + case 2: + _s06_nextHorseSequenceId = 0xF1; + break; + case 3: + _s06_nextHorseSequenceId = 0xF3; + break; + case 4: + _s06_nextHorseSequenceId = 0xF4; + break; + } + } + } + } + playSoundC(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene06_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene06_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + _gnapActionStatus = -1; + break; + case kASTryToGetGas: + _gameSys->insertSequence(0xFC, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0xFC; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + break; + case kASTryToClimbLadder: + _gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0xFD, _gnapId, 0); + _gameSys->insertSequence(0xFD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0xFD; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASTryToClimbLadderDone; + break; + case kASTryToClimbLadderDone: + _gnapX = 6; + _gnapY = 7; + _gnapActionStatus = -1; + break; + case kASTalkToHorse: + _s06_nextHorseSequenceId = 0xF6; + break; + case kASUseTwigOnHorse: + _s06_nextPlatSequenceId = 0xFB; + break; + default: + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + if (_beaverSequenceId == 0xFA) { + _gameSys->setAnimation(0, 0, 1); + invAdd(kItemGas); + setFlag(29); + _hotspots[kHSLadder].flags = SF_DISABLED; + setGrabCursorSprite(kItemGas); + _beaverActionStatus = -1; + _platX = 6; + _platY = 8; + _gameSys->insertSequence(0x107C1, _beaverId, 0, 0, kSeqNone, 0, 450 - _platGridX, 384 - _platGridY); + _beaverSequenceId = 0x7C1; + _beaverSequenceDatNum = 1; + setFlag(4); + _gnapActionStatus = -1; + showCursor(); + } + if (_s06_nextPlatSequenceId == 0xFB) { + _gameSys->setAnimation(0, 0, 1); + _s06_nextHorseSequenceId = 0xF2; + _beaverActionStatus = 6; + } + } + + if (_gameSys->getAnimationStatus(2) == 2 && _s06_nextHorseSequenceId != -1) { + switch (_s06_nextHorseSequenceId) { + case 0xF2: + setGrabCursorSprite(-1); + hideCursor(); + _gameSys->setAnimation(0xFA, 256, 1); + _gameSys->insertSequence(0xF2, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x100, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xFB, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xFA, 256, 0xFB, _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceId = 0xFA; + _beaverSequenceDatNum = 0; + _gameSys->insertSequence(0x107B7, _gnapId, 0x100, _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7B7; + _gnapSequenceDatNum = 1; + _s06_currHorseSequenceId = _s06_nextHorseSequenceId; + _s06_nextHorseSequenceId = -1; + _s06_nextPlatSequenceId = -1; + invRemove(kItemTwig); + break; + case 0xF6: + _gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); + _gameSys->insertSequence(0xF6, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _s06_horseTurnedBack = true; + _s06_currHorseSequenceId = _s06_nextHorseSequenceId; + _s06_nextHorseSequenceId = -1; + _gnapActionStatus = -1; + break; + default: + _gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); + _gameSys->insertSequence(_s06_nextHorseSequenceId, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _s06_currHorseSequenceId = _s06_nextHorseSequenceId; + _s06_nextHorseSequenceId = -1; + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp new file mode 100644 index 0000000000..9b8ee2975b --- /dev/null +++ b/engines/gnap/scenes/scene07.cpp @@ -0,0 +1,275 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitHouse = 1, + kHSDice = 2, + kHSDevice = 3, + kHSWalkArea1 = 4, + kHSWalkArea2 = 5, + kHSWalkArea3 = 6 +}; + +enum { + kASWait = 0, + kASLeaveScene = 1 +}; + +int GnapEngine::scene07_init() { + return 0x92; +} + +void GnapEngine::scene07_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); + setHotspot(kHSDice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 0, 0, 325, 445); + setHotspot(kHSWalkArea2, 325, 0, 799, 445, _isLeavingScene ? SF_WALKABLE : 0); + setHotspot(kHSWalkArea3, 160, 0, 325, 495); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(0)) + _hotspots[kHSDice].flags = SF_DISABLED; + _hotspotsCount = 7; +} + +void GnapEngine::scene07_run() { + + queueInsertDeviceIcon(); + _gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); + + invRemove(kItemGas); + invRemove(kItemNeedle); + + if (!isFlag(0)) + _gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_prevSceneNum == 8) { + initGnapPos(7, 7, 3); + initBeaverPos(9, 7, 4); + endSceneInit(); + } else { + _gnapX = 6; + _gnapY = 7; + _gnapId = 140; + _gnapSequenceId = 0x8F; + _gnapSequenceDatNum = 0; + _gnapIdleFacing = 1; + _gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); + _gnapActionStatus = kASWait; + _platX = 3; + _platY = 8; + _beaverId = 160; + _beaverSequenceId = 0x91; + _beaverSequenceDatNum = 0; + _beaverFacing = 0; + _gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + } + + _timers[3] = 600; + _timers[4] = getRandom(40) + 50; + + while (!_sceneDone) { + + if (!isSoundPlaying(0x10919)) + playSound(0x10919, 1); + + if (testWalk(0, 1, 8, 7, 6, 7)) + scene07_updateHotspots(); + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSPlatypus: + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHSExitHouse: + _isLeavingScene = true; + if (_gnapX > 8) + gnapWalkTo(_gnapX, 7, 0, 0x107AD, 1); + else + gnapWalkTo(8, 7, 0, 0x107AD, 1); + _gnapActionStatus = kASLeaveScene; + break; + + case kHSDice: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(4, 8, 3, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + break; + case GRAB_CURSOR: + setFlag(0); + invAdd(kItemDice); + scene07_updateHotspots(); + playGnapPullOutDevice(3, 3); + _gameSys->setAnimation(0x8E, 1, 2); + _gameSys->insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = getGnapSequenceId(gskUseDevice, 0, 0); + _gnapSequenceDatNum = 1; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene07_updateHotspots(); + _timers[4] = getRandom(40) + 50; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHSWalkArea3: + // Nothing + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene07_updateAnimations(); + + if (!_isLeavingScene) { + updateGnapIdleSequence(); + if (_beaverActionStatus < 0 && _gnapActionStatus < 0) { + if (_timers[0]) { + if (!_timers[1]) { + _timers[1] = getRandom(20) + 30; + _gnapRandomValue = getRandom(20); + // TODO Cleanup + if (_beaverFacing != 0) { + if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7CA) { + if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7CA) { + if (_platY == 9) + playBeaverSequence(0x107CA); + } else { + playBeaverSequence(0x10845); + } + } else { + playBeaverSequence(0x107CC); + } + } else if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7C9) { + if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7C9) { + if (_platY == 9) + playBeaverSequence(0x107C9); + } else { + playBeaverSequence(0x10844); + } + } else { + playBeaverSequence(0x107CB); + } + _gameSys->setAnimation(_beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, 1); + } + } else { + _timers[0] = getRandom(75) + 75; + beaverMakeRoom(); + } + } else { + _timers[0] = 100; + _timers[1] = 35; + } + sceneXX_playRandomSound(4); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene07_updateHotspots(); + _timers[4] = getRandom(40) + 50; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene07_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _newSceneNum = 8; + _sceneDone = true; + break; + } + _gnapActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(2) == 2) { + _gameSys->setAnimation(0, 0, 2); + setGrabCursorSprite(kItemDice); + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp new file mode 100644 index 0000000000..a4ebf92c71 --- /dev/null +++ b/engines/gnap/scenes/scene08.cpp @@ -0,0 +1,527 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitBackdoor = 1, + kHSExitCrash = 2, + kHSMan = 3, + kHSDoor = 4, + kHSMeat = 5, + kHSBone = 6, + kHSToy = 7, + kHSWalkArea1 = 8, + kHSDevice = 9, + kHSWalkArea2 = 10 +}; + +enum { + kASLeaveScene = 0, + kASTalkMan = 1, + kASLookMan = 2, + kASLookDog = 3, + kASGrabDog = 4, + kASTalkDog = 5, + kASPlatWithMan = 6, + kASPlatWithDog = 7 +}; + +int GnapEngine::scene08_init() { + return 0x150; +} + +void GnapEngine::scene08_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE); + setHotspot(kHSExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); + setHotspot(kHSMan, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSDoor, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSMeat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSBone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSToy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 290, 340, -1, -1); + setHotspot(kHSWalkArea2, 0, 0, 799, 420); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(7)) + _hotspots[kHSMeat].flags = SF_WALKABLE | SF_DISABLED; + if (isFlag(8)) + _hotspots[kHSBone].flags = SF_WALKABLE | SF_DISABLED; + if (isFlag(9)) + _hotspots[kHSToy].flags = SF_WALKABLE | SF_DISABLED; + _hotspotsCount = 11; +} + +void GnapEngine::scene08_updateAnimationsCb() { + if (_gameSys->getAnimationStatus(3) == 2) { + _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _s08_currDogSequenceId = _s08_nextDogSequenceId; + if ( _s08_nextDogSequenceId != 0x135 ) + _s08_nextDogSequenceId = 0x134; + } +} + +void GnapEngine::scene08_run() { + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); + + _s08_currDogSequenceId = 0x135; + _s08_nextDogSequenceId = 0x135; + + _gameSys->setAnimation(0x135, 100, 3); + _gameSys->insertSequence(_s08_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + + _s08_currManSequenceId = 0x140; + _s08_nextManSequenceId = -1; + + _gameSys->setAnimation(0x140, 100, 2); + _gameSys->insertSequence(_s08_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + + _timers[4] = getRandom(50) + 75; + + if (!isFlag(7)) + _gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (!isFlag(8)) + _gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (!isFlag(9)) + _gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); + + initGnapPos(-1, 8, 1); + initBeaverPos(-1, 7, 0); + + endSceneInit(); + + gnapWalkTo(1, 8, -1, 0x107B9, 1); + platypusWalkTo(1, 7, -1, 0x107C2, 1); + + _timers[5] = getRandom(40) + 50; + + while (!_sceneDone) { + + if (!isSoundPlaying(0x10919)) + playSound(0x10919, 1); + + testWalk(0, 0, -1, -1, -1, -1); + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene08_updateHotspots(); + _timers[4] = getRandom(50) + 75; + _timers[5] = getRandom(40) + 50; + } + break; + + case kHSPlatypus: + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(11)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapActionIdle(0x14D); + gnapKissPlatypus(8); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + break; + } + } + break; + + case kHSExitBackdoor: + _isLeavingScene = 1; + gnapActionIdle(0x14D); + gnapWalkTo(0, 6, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(0, 7, 1, 0x107CF, 1); + _newSceneNum = 9; + break; + + case kHSExitCrash: + _isLeavingScene = 1; + gnapActionIdle(0x14D); + gnapWalkTo(3, 9, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(4, 9, 1, 0x107C1, 1); + _newSceneNum = 7; + break; + + case kHSMan: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(6, 6, 7, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + gnapActionIdle(0x14D); + gnapWalkTo(6, 6, 0, 0x107BB, 1); + _gnapActionStatus = kASLookMan; + _gnapIdleFacing = 7; + break; + case GRAB_CURSOR: + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapActionIdle(0x14D); + gnapWalkTo(8, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkMan; + break; + case PLAT_CURSOR: + gnapActionIdle(0x14D); + gnapUseDeviceOnBeaver(); + platypusWalkTo(6, 6, 1, 0x107C2, 1); + _beaverActionStatus = kASPlatWithMan; + _beaverFacing = 0; + playGnapIdle(6, 6); + break; + } + } + break; + + case kHSDoor: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(4, 7, 5, 0); + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); + _gnapActionStatus = kASGrabDog; + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 0); + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); + _gnapActionStatus = kASLookDog; + break; + case GRAB_CURSOR: + gnapWalkTo(4, 7, 0, 0x107BB, 1); + _gnapActionStatus = kASGrabDog; + _gnapIdleFacing = 7; + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapActionIdle(0x14D); + gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkDog; + break; + case PLAT_CURSOR: + setFlag(11); + gnapActionIdle(0x14D); + gnapUseDeviceOnBeaver(); + platypusWalkTo(3, 7, 1, 0x107C2, 1); + _beaverActionStatus = kASPlatWithDog; + _beaverFacing = 0; + playGnapIdle(3, 7); + break; + } + } + break; + + case kHSMeat: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(6, 8, 5, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 7); + break; + case GRAB_CURSOR: + if (_s08_currDogSequenceId == 0x135) { + playGnapScratchingHead(6, 7); + } else { + gnapActionIdle(0x14D); + playGnapPullOutDevice(6, 7); + playGnapUseDevice(0, 0); + _s08_nextDogSequenceId = 0x149; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSBone: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(2, 7, 3, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(3, 6); + break; + case GRAB_CURSOR: + if (_s08_currDogSequenceId == 0x135) { + playGnapScratchingHead(3, 6); + } else { + gnapActionIdle(0x14D); + playGnapPullOutDevice(3, 6); + playGnapUseDevice(0, 0); + _s08_nextDogSequenceId = 0x14A; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSToy: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(8, 7, 7, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(7, 6); + break; + case GRAB_CURSOR: + if (_s08_currDogSequenceId == 0x135) { + playGnapScratchingHead(7, 6); + } else { + gnapActionIdle(0x14D); + playGnapPullOutDevice(7, 6); + playGnapUseDevice(0, 0); + _s08_nextDogSequenceId = 0x14B; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + gnapActionIdle(0x14D); + gnapWalkTo(-1, 6, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapActionIdle(0x14D); + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene08_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(50) + 125; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s08_nextManSequenceId == -1 && + (_s08_currDogSequenceId == 0x134 || _s08_currDogSequenceId == 0x135)) { + _gnapRandomValue = getRandom(4); + switch (_gnapRandomValue) { + case 0: + _s08_nextManSequenceId = 0x138; + break; + case 1: + _s08_nextManSequenceId = 0x136; + break; + case 2: + _s08_nextManSequenceId = 0x13B; + break; + case 3: + _s08_nextManSequenceId = 0x13A; + break; + } + } + } + sceneXX_playRandomSound(5); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene08_updateHotspots(); + _timers[4] = getRandom(50) + 75; + _timers[5] = getRandom(40) + 50; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene08_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + _gnapActionStatus = -1; + break; + case kASTalkMan: + _s08_nextManSequenceId = 0x13F; + _gnapActionStatus = -1; + break; + case kASLookMan: + _s08_nextManSequenceId = 0x140; + _gnapActionStatus = -1; + break; + case kASLookDog: + _s08_nextManSequenceId = 0x137; + _gnapActionStatus = -1; + break; + case kASGrabDog: + if (_s08_currDogSequenceId == 0x135) + _s08_nextDogSequenceId = 0x133; + else + _s08_nextDogSequenceId = 0x13C; + _gnapActionStatus = -1; + break; + case kASTalkDog: + if (_s08_currDogSequenceId == 0x135) + _s08_nextDogSequenceId = 0x133; + else + _s08_nextDogSequenceId = 0x13C; + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + switch (_beaverActionStatus) { + case kASPlatWithDog: + _s08_nextDogSequenceId = 0x147; + break; + case kASPlatWithMan: + _s08_nextManSequenceId = 0x140; + _beaverActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2 && _s08_nextManSequenceId != -1) { + _gameSys->setAnimation(_s08_nextManSequenceId, 100, 2); + _gameSys->insertSequence(_s08_nextManSequenceId, 100, _s08_currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _s08_currManSequenceId = _s08_nextManSequenceId; + _s08_nextManSequenceId = -1; + } + + if (_gameSys->getAnimationStatus(3) == 2) { + if (_s08_currDogSequenceId == 0x147) + _beaverActionStatus = -1; + if (_s08_currDogSequenceId == 0x149 || _s08_currDogSequenceId == 0x14A || _s08_currDogSequenceId == 0x14B) { + if (getRandom(2) != 0) + _s08_nextManSequenceId = 0x13D; + else + _s08_nextManSequenceId = 0x13E; + } else if (_s08_currDogSequenceId == 0x133) + _s08_nextManSequenceId = 0x139; + if (_s08_nextDogSequenceId == 0x149 || _s08_nextDogSequenceId == 0x14A || _s08_nextDogSequenceId == 0x14B) { + _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + switch (_s08_nextDogSequenceId) { + case 0x149: + setFlag(7); + _hotspots[kHSMeat].flags = SF_DISABLED | SF_WALKABLE; + _gameSys->removeSequence(0x144, 1, 1); + break; + case 0x14A: + setFlag(8); + _hotspots[kHSBone].flags = SF_DISABLED | SF_WALKABLE; + _gameSys->removeSequence(0x145, 1, 1); + break; + case 0x14B: + setFlag(9); + _hotspots[kHSToy].flags = SF_DISABLED | SF_WALKABLE; + _gameSys->removeSequence(0x146, 1, 1); + break; + } + _s08_currDogSequenceId = _s08_nextDogSequenceId; + _s08_nextDogSequenceId = 0x134; + } else if (_s08_nextDogSequenceId == 0x147) { + _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x148, 160, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _s08_currDogSequenceId = _s08_nextDogSequenceId; + _s08_nextDogSequenceId = 0x134; + _platX = 1; + _platY = 8; + _beaverId = 160; + _beaverSequenceId = 0x148; + _beaverFacing = 4; + _beaverSequenceDatNum = 0; + if (_gnapX == 1 && _gnapY == 8) + gnapWalkStep(); + } else if (_s08_nextDogSequenceId != -1) { + _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _s08_currDogSequenceId = _s08_nextDogSequenceId; + if (_s08_nextDogSequenceId != 0x135) + _s08_nextDogSequenceId = 0x134; + if (_s08_currDogSequenceId == 0x133) { + _timers[2] = getRandom(30) + 20; + _timers[3] = getRandom(50) + 200; + _gameSys->insertSequence(0x14D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x14D; + _gnapIdleFacing = 7; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + } + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp new file mode 100644 index 0000000000..4436d1e436 --- /dev/null +++ b/engines/gnap/scenes/scene09.cpp @@ -0,0 +1,241 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitKitchen = 1, + kHSExitHouse = 2, + kHSTrash = 3, + kHSDevice = 4, + kHSWalkArea1 = 5, + kHSWalkArea2 = 6, + kHSWalkArea3 = 7 +}; + +enum { + kASLeaveScene = 0, + kASSearchTrash = 1, + kASSearchTrashDone = 2 +}; + +int GnapEngine::scene09_init() { + return 0x4E; +} + +void GnapEngine::scene09_updateHotspots() { + setHotspot(kHSPlatypus, 0, 200, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitKitchen, 280, 200, 380, 400, SF_EXIT_U_CURSOR); + setHotspot(kHSExitHouse, 790, 200, 799, 450, SF_EXIT_R_CURSOR | SF_WALKABLE); + setHotspot(kHSTrash, 440, 310, 680, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 0, 0, 799, 400); + setHotspot(kHSWalkArea2, 0, 0, 630, 450); + setHotspot(kHSWalkArea2, 0, 0, 175, 495); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 8; +} + +void GnapEngine::scene09_run() { + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + + if (_prevSceneNum == 8) { + initGnapPos(11, 8, 3); + initBeaverPos(12, 7, 4); + endSceneInit(); + gnapWalkTo(9, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 7, -1, 0x107D2, 1); + } else { + initGnapPos(4, 7, 1); + initBeaverPos(5, 7, 0); + endSceneInit(); + } + + _timers[4] = getRandom(150) + 50; + _timers[5] = getRandom(40) + 50; + + while (!_sceneDone) { + + if (!isSoundPlaying(0x10919)) + playSound(0x10919, 1); + + testWalk(0, 0, -1, -1, -1, -1); + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene09_updateHotspots(); + _timers[4] = getRandom(150) + 50; + _timers[5] = getRandom(40) + 50; + } + break; + + case kHSPlatypus: + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHSExitKitchen: + _isLeavingScene = 1; + _newSceneNum = 10; + gnapWalkTo(4, 7, 0, 0x107BF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(4, 8, -1, 0x107D2, 1); + _beaverFacing = 4; + break; + + case kHSExitHouse: + _isLeavingScene = 1; + _newSceneNum = 8; + gnapWalkTo(10, -1, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(10, -1, -1, 0x107CD, 1); + _beaverFacing = 4; + break; + + case kHSTrash: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(9, 6, 8, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(8, 3); + break; + case GRAB_CURSOR: + _gnapActionStatus = kASSearchTrash; + gnapWalkTo(9, 6, 0, 0x107BC, 1); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene09_updateAnimations(); + + if (!_isLeavingScene && _gnapActionStatus != 1 && _gnapActionStatus != 2) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(150) + 100; + if (_timers[4] & 1) + _gameSys->insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); + } + sceneXX_playRandomSound(5); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene09_updateHotspots(); + _timers[4] = getRandom(150) + 50; + _timers[5] = getRandom(40) + 50; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene09_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + _gnapActionStatus = -1; + break; + case kASSearchTrash: + _gameSys->setAnimation(0x4C, 120, 0); + _gameSys->insertSequence(0x4C, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(0x4B, 2, 1); + _gnapSequenceId = 0x4C; + _gnapId = 120; + _gnapIdleFacing = 5; + _gnapSequenceDatNum = 0; + _gnapX = 9; + _gnapY = 6; + _gnapActionStatus = kASSearchTrashDone; + break; + case kASSearchTrashDone: + _gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + _timers[2] = 360; + _timers[4] = getRandom(150) + 100; + _gnapActionStatus = -1; + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp new file mode 100644 index 0000000000..c6faf5a0ca --- /dev/null +++ b/engines/gnap/scenes/scene10.cpp @@ -0,0 +1,500 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitBar = 1, + kHSExitBackdoor = 2, + kHSCook = 3, + kHSTongs = 4, + kHSBox = 5, + kHSOven = 6, + kHSWalkArea1 = 7, + kHSDevice = 8, + kHSWalkArea2 = 9, + kHSWalkArea3 = 10, + kHSWalkArea4 = 11 +}; + +enum { + kASLeaveScene = 0, + kASAnnoyCook = 1, + kASPlatWithBox = 4 +}; + +int GnapEngine::scene10_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + return 0x10F; +} + +void GnapEngine::scene10_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitBar, 0, 75, 85, 455, SF_EXIT_NW_CURSOR); + setHotspot(kHSExitBackdoor, 75, 590, 500, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); + setHotspot(kHSCook, 370, 205, 495, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSTongs, 250, 290, 350, 337, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSBox, 510, 275, 565, 330, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSOven, 690, 280, 799, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 59, 0, 495, 460); + setHotspot(kHSWalkArea2, 495, 0, 650, 420); + setHotspot(kHSWalkArea3, 651, 0, 725, 400); + setHotspot(kHSWalkArea4, 725, 0, 799, 441); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 12; +} + +void GnapEngine::scene10_run() { + + _s10_currCookSequenceId = 0x103; + + _gameSys->setAnimation(0x103, 100, 2); + _gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); + + _s10_nextCookSequenceId = 0x106; + if (!isFlag(1)) + _gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + if (_prevSceneNum == 9) { + initGnapPos(11, 8, 3); + initBeaverPos(12, 7, 4); + endSceneInit(); + gnapWalkTo(9, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 7, -1, 0x107D2, 1); + } else { + initGnapPos(-1, 7, 1); + initBeaverPos(-2, 8, 0); + endSceneInit(); + gnapWalkTo(1, 7, -1, 0x107B9, 1); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + } + + _timers[4] = getRandom(80) + 150; + _timers[5] = getRandom(100) + 100; + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1091E)) + playSound(0x1091E, 1); + + if (!isSoundPlaying(0x1091A)) + playSound(0x1091A, 1); + + updateMouseCursor(); + + testWalk(0, 0, -1, -1, -1, -1); + + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSPlatypus: + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(1)) + playGnapMoan1(_platX, _platY); + else + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(10); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + break; + } + } + break; + + case kHSExitBar: + _isLeavingScene = 1; + gnapActionIdle(0x10C); + gnapWalkTo(0, 7, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(0, 7, -1, 0x107CF, 1); + _newSceneNum = 11; + break; + + case kHSExitBackdoor: + _isLeavingScene = 1; + gnapActionIdle(0x10C); + gnapWalkTo(2, 9, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(3, 9, -1, 0x107C7, 1); + _newSceneNum = 9; + break; + + case kHSCook: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(4, 8, 6, 0); + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); + _gnapActionStatus = kASAnnoyCook; + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 0); + break; + case GRAB_CURSOR: + playGnapImpossible(0, 0); + _gnapIdleFacing = 1; + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapActionIdle(0x10C); + gnapWalkTo(4, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASAnnoyCook; + break; + case PLAT_CURSOR: + gnapActionIdle(0x10C); + gnapUseDeviceOnBeaver(); + platypusWalkTo(4, 6, -1, -1, 1); + gnapWalkTo(4, 8, 0, 0x107BB, 1); + _gnapActionStatus = kASAnnoyCook; + break; + } + } + break; + + case kHSTongs: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(3, 7, 4, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(1)) + playGnapMoan2(-1, -1); + else + playGnapScratchingHead(4, 3); + break; + case GRAB_CURSOR: + if (isFlag(1)) + playGnapMoan2(-1, -1); + else { + gnapActionIdle(0x10C); + gnapWalkTo(4, 8, 0, 0x107BB, 1); + _gnapActionStatus = kASAnnoyCook; + } + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (isFlag(1)) + playGnapMoan2(-1, -1); + else { + gnapActionIdle(0x10C); + gnapUseDeviceOnBeaver(); + platypusWalkTo(3, 7, -1, -1, 1); + gnapWalkTo(4, 8, 0, 0x107BB, 1); + _gnapActionStatus = kASAnnoyCook; + } + break; + } + } + break; + + case kHSBox: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(7, 6, 6, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(7, 3); + break; + case GRAB_CURSOR: + gnapActionIdle(0x10C); + gnapWalkTo(4, 8, 0, 0x107BB, 1); + _gnapActionStatus = kASAnnoyCook; + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (isFlag(1)) + playGnapMoan2(-1, -1); + else { + invAdd(kItemTongs); + setFlag(1); + gnapActionIdle(0x10C); + gnapUseDeviceOnBeaver(); + platypusWalkTo(7, 6, 1, 0x107D2, 1); + _beaverActionStatus = kASPlatWithBox; + _beaverFacing = 4; + _largeSprite = _gameSys->createSurface(0xC3); + playGnapIdle(7, 6); + } + break; + } + } + break; + + case kHSOven: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(9, 6, 10, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapSequence(getGnapSequenceId(gskDeflect, 10, 5) | 0x10000); + break; + case GRAB_CURSOR: + gnapActionIdle(0x10C); + gnapWalkTo(9, 6, 0, 0x107BB, 1); + _gameSys->insertSequence(0x10E, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x10E; + _gnapId = 120; + _gnapIdleFacing = 7; + _gnapSequenceDatNum = 0; + _gnapX = 9; + _gnapY = 6; + _timers[2] = 360; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + gnapActionIdle(0x10C); + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene10_updateHotspots(); + } + break; + + default: + if (_mouseClickState.left) { + gnapActionIdle(0x10C); + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene10_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(80) + 150; + playSound(0x12B, 0); + } + if (!_timers[5]) { + int sequenceId; + _timers[5] = getRandom(100) + 100; + _gnapRandomValue = getRandom(4); + if (_gnapRandomValue) { + if (_gnapRandomValue == 1) { + sequenceId = 0x8A5; + } else if (_gnapRandomValue == 2) { + sequenceId = 0x8A6; + } else { + sequenceId = 0x8A7; + } + _gameSys->insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene10_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene10_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + break; + case kASAnnoyCook: + _s10_nextCookSequenceId = 0x105; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + switch (_beaverActionStatus) { + case kASPlatWithBox: + _s10_nextCookSequenceId = 0x109; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2 && _s10_nextCookSequenceId != -1) { + + switch (_s10_nextCookSequenceId) { + case 0x109: + _platX = 4; + _platY = 8; + _gameSys->insertSequence(0x109, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x107C9, 160, + _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + kSeqSyncWait, getSequenceTotalDuration(0x109) + getSequenceTotalDuration(0x10A) + getSequenceTotalDuration(0x10843), + 75 * _platX - _platGridX, 48 * _platY - _platGridY); + _gameSys->removeSequence(0x107, 100, 1); + _s10_currCookSequenceId = 0x109; + _s10_nextCookSequenceId = 0x843; + _beaverSequenceId = 0x7C9; + _beaverId = 160; + _beaverFacing = 0; + _beaverSequenceDatNum = 1; + break; + case 0x843: + hideCursor(); + _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); + _gameSys->insertSequence(0x10843, 301, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _s10_currCookSequenceId = 0x843; + _s10_nextCookSequenceId = 0x10A; + break; + case 0x10A: + _gameSys->insertSequence(_s10_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); + _s10_currCookSequenceId = _s10_nextCookSequenceId; + _s10_nextCookSequenceId = 0x104; + showCursor(); + _gameSys->removeSpriteDrawItem(_largeSprite, 300); + delayTicksCursor(5); + deleteSurface(&_largeSprite); + setGrabCursorSprite(kItemTongs); + if (_beaverActionStatus == kASPlatWithBox) + _beaverActionStatus = -1; + if (_gnapX == 4 && _gnapY == 8) + gnapWalkStep(); + break; + default: + _gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _s10_currCookSequenceId = _s10_nextCookSequenceId; + break; + } + + switch (_s10_currCookSequenceId) { + case 0x106: + _gnapRandomValue = getRandom(7); + if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + _s10_nextCookSequenceId = 0x106; + else if (_gnapRandomValue == 0) + _s10_nextCookSequenceId = 0x104; + else if (_gnapRandomValue == 1) + _s10_nextCookSequenceId = 0x103; + else if (_gnapRandomValue == 2) { + _s10_nextCookSequenceId = 0x106; + _gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); + } else + _s10_nextCookSequenceId = 0x106; + break; + case 0x103: + _gnapRandomValue = getRandom(7); + if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + _s10_nextCookSequenceId = 0x106; + else if (_gnapRandomValue == 0) + _s10_nextCookSequenceId = 0x104; + else + _s10_nextCookSequenceId = 0x106; + break; + case 0x104: + _gnapRandomValue = getRandom(7); + if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + _s10_nextCookSequenceId = 0x106; + else if (_gnapRandomValue == 0) + _s10_nextCookSequenceId = 0x103; + else + _s10_nextCookSequenceId = 0x106; + break; + case 0x105: + _gnapRandomValue = getRandom(7); + if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + _s10_nextCookSequenceId = 0x106; + else if (_gnapRandomValue == 0) + _s10_nextCookSequenceId = 0x104; + else if (_gnapRandomValue == 1) + _s10_nextCookSequenceId = 0x103; + else + _s10_nextCookSequenceId = 0x106; + _timers[2] = getRandom(30) + 20; + _timers[3] = 300; + _gameSys->insertSequence(0x10C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x10C; + _gnapIdleFacing = 7; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + _beaverActionStatus = -1; + break; + } + if (_s10_currCookSequenceId == 0x843) + _gameSys->setAnimation(_s10_currCookSequenceId | 0x10000, 301, 2); + else + _gameSys->setAnimation(_s10_currCookSequenceId, 100, 2); + } + +} + +void GnapEngine::scene10_updateAnimationsCb() { + if (_gameSys->getAnimationStatus(2) == 2) { + _gameSys->setAnimation(_s10_nextCookSequenceId, 100, 2); + _gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _s10_currCookSequenceId = _s10_nextCookSequenceId; + _s10_nextCookSequenceId = 0x106; + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp new file mode 100644 index 0000000000..6bbc542e90 --- /dev/null +++ b/engines/gnap/scenes/scene11.cpp @@ -0,0 +1,488 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitKitchen = 1, + kHSExitToilet = 2, + kHSExitLeft = 3, + kHSGoggleGuy = 4, + kHSHookGuy = 5, + kHSBillard = 6, + kHSWalkArea1 = 7, + kHSDevice = 8, + kHSWalkArea2 = 9, + kHSWalkArea3 = 10, + kHSWalkArea4 = 11, + kHSWalkArea5 = 12 +}; + +enum { + kASLeaveScene = 0, + kASShowMagazineToGoggleGuy = 3, + kASTalkGoggleGuy = 4, + kASGrabHookGuy = 6, + kASShowItemToHookGuy = 8, + kASTalkHookGuy = 9, + kASGrabBillardBall = 11 +}; + +int GnapEngine::scene11_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 3); + _gameSys->setAnimation(0, 0, 2); + if (_prevSceneNum == 10 || _prevSceneNum == 13) { + playSound(0x108EC, 0); + playSound(0x10928, 0); + } + return 0x209; +} + +void GnapEngine::scene11_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitKitchen, 420, 140, 520, 345, SF_EXIT_U_CURSOR); + setHotspot(kHSExitToilet, 666, 130, 740, 364, SF_EXIT_R_CURSOR); + setHotspot(kHSExitLeft, 0, 350, 10, 599, SF_EXIT_L_CURSOR | SF_WALKABLE); + setHotspot(kHSGoggleGuy, 90, 185, 185, 340, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSHookGuy, 210, 240, 340, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSBillard, 640, 475, 700, 530, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 0, 0, 365, 453); + setHotspot(kHSWalkArea2, 0, 0, 629, 353); + setHotspot(kHSWalkArea3, 629, 0, 799, 364); + setHotspot(kHSWalkArea4, 735, 0, 799, 397); + setHotspot(kHSWalkArea5, 510, 540, 799, 599); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 13; +} + +void GnapEngine::scene11_run() { + bool flag = true; + + _timers[7] = 50; + + _hotspots[kHSBillard].flags |= SF_DISABLED; + + _s11_currGoggleGuySequenceId = 0x1F9; + + _s11_currHookGuySequenceId = 0x201; + + switch (_prevSceneNum) { + case 13: + initGnapPos(8, 5, 3); + initBeaverPos(9, 6, 4); + break; + case 47: + initGnapPos(8, 5, 3); + initBeaverPos(9, 5, 4); + _s11_currGoggleGuySequenceId = 0x1FA; + _s11_currHookGuySequenceId = 0x1FF; + _timers[7] = 180; + break; + case 12: + initGnapPos(-1, 9, 1); + initBeaverPos(-2, 8, 0); + break; + default: + initGnapPos(6, 6, 3); + initBeaverPos(6, 5, 4); + break; + } + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(_s11_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + + _s11_nextHookGuySequenceId = -1; + + _gameSys->setAnimation(_s11_currHookGuySequenceId, 120, 3); + _gameSys->insertSequence(_s11_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); + + _s11_nextGoggleGuySequenceId = -1; + + _gameSys->setAnimation(_s11_currGoggleGuySequenceId, 121, 2); + + _timers[5] = getRandom(100) + 75; + _timers[4] = getRandom(40) + 20; + _timers[6] = getRandom(100) + 100; + endSceneInit(); + + if (_prevSceneNum == 12) { + gnapWalkTo(2, 8, -1, 0x107B9, 1); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + } + + _gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); + + while (!_sceneDone) { + + testWalk(0, 0, -1, -1, -1, -1); + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSPlatypus: + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + break; + } + } + break; + + case kHSExitKitchen: + _isLeavingScene = true; + gnapWalkTo(6, 5, 0, 0x107BF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(6, 6, -1, -1, 1); + _newSceneNum = 10; + break; + + case kHSExitToilet: + _isLeavingScene = true; + gnapWalkTo(8, 5, 0, 0x107BF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(8, 6, -1, -1, 1); + _newSceneNum = 13; + break; + + case kHSExitLeft: + _isLeavingScene = true; + gnapWalkTo(-1, 8, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(-1, 9, -1, 0x107CF, 1); + _newSceneNum = 12; + break; + + case kHSGoggleGuy: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemMagazine) { + gnapWalkTo(3, 7, 0, 0x107BC, 1); + _gnapActionStatus = kASShowMagazineToGoggleGuy; + playGnapShowItem(_grabCursorSpriteIndex, 2, 0); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(3, 7, 2, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(1, 6); + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(3, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkGoggleGuy; + break; + } + } + } + break; + + case kHSHookGuy: + if (_gnapActionStatus < 0) { + _gnapIdleFacing = 7; + if (_grabCursorSpriteIndex >= 0) { + gnapWalkTo(5, 6, 0, 0x107BC, 9); + _gnapActionStatus = kASShowItemToHookGuy; + playGnapShowItem(_grabCursorSpriteIndex, 4, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapSequence(getGnapSequenceId(gskDeflect, 3, 6) | 0x10000); + break; + case GRAB_CURSOR: + gnapWalkTo(5, 6, 0, 0x107BC, 1); + _gnapActionStatus = kASGrabHookGuy; + break; + case TALK_CURSOR: + _gnapIdleFacing = 3; + gnapWalkTo(5, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkHookGuy; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSBillard: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(9, 8); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(9, 8); + break; + case GRAB_CURSOR: + gnapWalkTo(9, 8, 0, 0x107BA, 1); + _gnapActionStatus = kASGrabBillardBall; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(9, 8); + break; + } + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + case kHSWalkArea5: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene11_updateHotspots(); + } + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene11_updateAnimations(); + + if (!_isLeavingScene) { + if (flag && !_timers[7]) { + flag = false; + _gameSys->setAnimation(0x207, 257, 4); + _gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); + } + beaverSub426234(); + updateGnapIdleSequence2(); + if (!_timers[5]) { + _timers[5] = getRandom(100) + 75; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) { + _gnapRandomValue = getRandom(2); + if (_gnapRandomValue) + _s11_nextGoggleGuySequenceId = 0x1F6; + else + _s11_nextGoggleGuySequenceId = 0x1F9; + } + } + if (!_timers[4]) { + _timers[4] = getRandom(40) + 20; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s11_nextHookGuySequenceId == -1) { + if (_s11_currHookGuySequenceId == 0x201) { + _gnapRandomValue = getRandom(7); + switch (_gnapRandomValue) { + case 0: + _s11_nextHookGuySequenceId = 0x200; + break; + case 1: + _s11_nextHookGuySequenceId = 0x205; + break; + case 2: + _s11_nextHookGuySequenceId = 0x202; + break; + default: + _s11_nextHookGuySequenceId = 0x201; + break; + } + } else { + _s11_nextHookGuySequenceId = 0x201; + } + } + } + if (!_timers[6]) { + _timers[6] = getRandom(100) + 100; + _gnapRandomValue = getRandom(3); + switch (_gnapRandomValue) { + case 0: + _gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene11_updateHotspots(); + _timers[5] = getRandom(50) + 75; + _timers[4] = getRandom(40) + 20; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene11_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + if (_gnapActionStatus != kASGrabBillardBall) + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + break; + case kASShowMagazineToGoggleGuy: + _s11_nextGoggleGuySequenceId = 0x1F7; + break; + case kASTalkGoggleGuy: + _s11_nextGoggleGuySequenceId = 0x1FB; + break; + case kASGrabHookGuy: + _s11_nextHookGuySequenceId = 0x204; + break; + case kASShowItemToHookGuy: + _s11_nextHookGuySequenceId = 0x203; + break; + case kASTalkHookGuy: + _s11_nextHookGuySequenceId = 0x206; + break; + case kASGrabBillardBall: + if (_gameSys->getAnimationStatus(2) == 2 && _gameSys->getAnimationStatus(3) == 2) { + _gameSys->setAnimation(0, 0, 0); + _timers[2] = getRandom(30) + 20; + _timers[3] = getRandom(50) + 200; + _gameSys->insertSequence(0x1F4, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x1F4; + _gnapId = 255; + _gnapSequenceDatNum = 0; + _gameSys->removeSequence(0x207, 257, 1); + _gameSys->removeSequence(0x208, 256, 1); + _s11_nextGoggleGuySequenceId = 0x1F8; + _timers[5] = getRandom(100) + 75; + _gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); + _s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId; + _s11_nextGoggleGuySequenceId = -1; + switch (_s11_billardBallCtr) { + case 0: + _s11_nextHookGuySequenceId = 0x1FC; + break; + case 1: + _s11_nextHookGuySequenceId = 0x1FD; + break; + default: + _s11_nextHookGuySequenceId = 0x1FE; + break; + } + ++_s11_billardBallCtr; + _gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); + _s11_currHookGuySequenceId = _s11_nextHookGuySequenceId; + _s11_nextHookGuySequenceId = -1; + _timers[4] = getRandom(40) + 20; + _gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, getSequenceTotalDuration(0x1F4) - 5, 0, 0); + _hotspots[kHSBillard].flags |= SF_DISABLED; + _gameSys->setAnimation(0x207, 257, 4); + _gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, getSequenceTotalDuration(0x1FE), 0, 0); + _gnapActionStatus = -1; + } + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2 && _s11_nextGoggleGuySequenceId != -1) { + _timers[5] = getRandom(100) + 75; + _gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); + _s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId; + _s11_nextGoggleGuySequenceId = -1; + if (_gnapActionStatus >= 1 && _gnapActionStatus <= 4) + _gnapActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(3) == 2) { + if (_s11_nextHookGuySequenceId == 0x204) { + _gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); + _gameSys->insertSequence(0x204, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x1F5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _s11_currHookGuySequenceId = 0x204; + _s11_nextHookGuySequenceId = -1; + _gnapSequenceId = 0x1F5; + _gnapSequenceDatNum = 0; + _timers[4] = getRandom(40) + 20; + _timers[2] = getRandom(20) + 70; + _timers[3] = getRandom(50) + 200; + if (_gnapActionStatus == kASGrabHookGuy) + _gnapActionStatus = -1; + } else if (_s11_nextHookGuySequenceId != -1) { + _gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); + _s11_currHookGuySequenceId = _s11_nextHookGuySequenceId; + _s11_nextHookGuySequenceId = -1; + _timers[4] = getRandom(40) + 20; + if (_gnapActionStatus >= 6 && _gnapActionStatus <= 9) + _gnapActionStatus = -1; + } + } + + if (_gameSys->getAnimationStatus(4) == 2) { + _gameSys->setAnimation(0, 0, 4); + _hotspots[kHSBillard].flags &= ~SF_DISABLED; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp new file mode 100644 index 0000000000..076fa0408d --- /dev/null +++ b/engines/gnap/scenes/scene12.cpp @@ -0,0 +1,564 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitRight = 1, + kHSToothGuy = 2, + kHSBarkeeper = 3, + kHSBeardGuy = 4, + kHSJukebox = 5, + kHSWalkArea1 = 6, + kHSDevice = 7, + kHSWalkArea2 = 8, + kHSWalkArea3 = 9, + kHSWalkArea4 = 10 +}; + +enum { + kASLeaveScene = 0, + kASQuarterToToothGuyDone = 1, + kASTalkToothGuy = 2, + kASGrabToothGuy = 4, + kASShowItemToToothGuy = 5, + kASQuarterWithHoleToToothGuy = 6, + kASQuarterToToothGuy = 7, + kASTalkBeardGuy = 8, + kASLookBeardGuy = 9, + kASGrabBeardGuy = 10, + kASShowItemToBeardGuy = 11, + kASTalkBarkeeper = 12, + kASLookBarkeeper = 13, + kASShowItemToBarkeeper = 15, + kASQuarterWithBarkeeper = 16, + kASPlatWithBarkeeper = 17, + kASPlatWithToothGuy = 18, + kASPlatWithBeardGuy = 19 +}; + +int GnapEngine::scene12_init() { + return 0x209; +} + +void GnapEngine::scene12_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitRight, 790, 360, 799, 599, SF_EXIT_R_CURSOR); + setHotspot(kHSToothGuy, 80, 180, 160, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSBarkeeper, 490, 175, 580, 238, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSBeardGuy, 620, 215, 720, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSJukebox, 300, 170, 410, 355, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 0, 0, 260, 460); + setHotspot(kHSWalkArea2, 0, 0, 380, 410); + setHotspot(kHSWalkArea3, 0, 0, 799, 395); + setHotspot(kHSWalkArea4, 585, 0, 799, 455); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 11; +} + +void GnapEngine::scene12_run() { + int v18 = 1; + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); + + _s12_currToothGuySequenceId = 0x200; + _s12_nextToothGuySequenceId = -1; + + _gameSys->setAnimation(0x200, 50, 2); + _gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); + + _s12_currBeardGuySequenceId = 0x202; + _s12_nextBeardGuySequenceId = -1; + + _gameSys->setAnimation(0x202, 50, 4); + _gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); + + _s12_currBarkeeperSequenceId = 0x203; + _s12_nextBarkeeperSequenceId = -1; + + _gameSys->setAnimation(0x203, 50, 3); + + _timers[4] = 30; + _timers[6] = getRandom(30) + 20; + _timers[5] = getRandom(30) + 20; + _timers[7] = getRandom(100) + 100; + + if (_prevSceneNum == 15) { + initGnapPos(5, 6, 1); + initBeaverPos(3, 7, 0); + endSceneInit(); + } else { + initGnapPos(11, 8, 3); + initBeaverPos(12, 8, 4); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 8, -1, 0x107D2, 1); + } + + while (!_sceneDone) { + + testWalk(0, 0, -1, -1, -1, -1); + + updateMouseCursor(); + updateCursorByHotspot(); + updateGrabCursorSprite(0, 0); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene12_updateHotspots(); + } + break; + + case kHSPlatypus: + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHSExitRight: + _isLeavingScene = 1; + gnapWalkTo(10, -1, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(10, -1, -1, -1, 1); + _newSceneNum = 11; + break; + + case kHSToothGuy: + if (_grabCursorSpriteIndex == kItemQuarter) { + _largeSprite = _gameSys->createSurface(0x141); + gnapWalkTo(3, 7, 0, 0x107BC, 9); + _gnapIdleFacing = 5; + _gnapActionStatus = kASQuarterToToothGuy; + playGnapShowItem(_grabCursorSpriteIndex, 2, 0); + setGrabCursorSprite(-1); + } else if (_grabCursorSpriteIndex == kItemQuarterWithHole) { + gnapWalkTo(3, 7, 0, 0x107BC, 9); + _gnapIdleFacing = 5; + _gnapActionStatus = kASQuarterWithHoleToToothGuy; + playGnapShowItem(_grabCursorSpriteIndex, 2, 0); + } else if (_grabCursorSpriteIndex >= 0) { + gnapWalkTo(3, 7, 0, 0x107BC, 9); + _gnapIdleFacing = 5; + _gnapActionStatus = kASShowItemToToothGuy; + playGnapShowItem(_grabCursorSpriteIndex, 2, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(1, 2); + break; + case GRAB_CURSOR: + gnapWalkTo(3, 7, 0, 0x107BC, 1); + _gnapActionStatus = kASGrabToothGuy; + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(3, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkToothGuy; + break; + case PLAT_CURSOR: + gnapUseDeviceOnBeaver(); + platypusWalkTo(3, 7, 1, 0x107D2, 1); + _beaverActionStatus = kASPlatWithToothGuy; + _beaverFacing = 4; + playGnapIdle(2, 7); + break; + } + } + break; + + case kHSBarkeeper: + if (_grabCursorSpriteIndex == kItemQuarter || _grabCursorSpriteIndex == kItemQuarterWithHole) { + gnapWalkTo(6, 6, 0, 0x107BB, 9); + _gnapIdleFacing = 7; + _gnapActionStatus = kASQuarterWithBarkeeper; + playGnapShowItem(_grabCursorSpriteIndex, 7, 0); + } else if (_grabCursorSpriteIndex >= 0) { + gnapWalkTo(6, 6, 0, 0x107BB, 9); + _gnapIdleFacing = 7; + _gnapActionStatus = kASShowItemToBarkeeper; + playGnapShowItem(_grabCursorSpriteIndex, 7, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + gnapWalkTo(6, 6, 0, 0x107BB, 1); + _gnapIdleFacing = 7; + _gnapActionStatus = kASLookBarkeeper; + break; + case GRAB_CURSOR: + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(6, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkBarkeeper; + break; + case PLAT_CURSOR: + playGnapPullOutDevice(_platX, _platY); + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); + _gnapActionStatus = kASPlatWithBarkeeper; + break; + } + } + break; + + case kHSBeardGuy: + if (_grabCursorSpriteIndex >= 0) { + gnapWalkTo(7, 6, 0, 0x107BB, 9); + _gnapIdleFacing = 7; + _gnapActionStatus = kASShowItemToBeardGuy; + playGnapShowItem(_grabCursorSpriteIndex, 8, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + gnapWalkTo(7, 6, 0, 0x107BB, 1); + _gnapIdleFacing = 7; + _gnapActionStatus = kASLookBeardGuy; + break; + case GRAB_CURSOR: + // NOTE Bug in the original. It has 9 as flags which seems wrong here. + gnapWalkTo(7, 6, 0, 0x107BB, 1); + _gnapIdleFacing = 7; + _gnapActionStatus = kASGrabBeardGuy; + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(7, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkBeardGuy; + break; + case PLAT_CURSOR: + gnapUseDeviceOnBeaver(); + platypusWalkTo(7, 6, 1, 0x107C2, 1); + _beaverActionStatus = kASPlatWithBeardGuy; + _beaverFacing = 0; + playGnapIdle(7, 6); + break; + } + } + break; + + case kHSJukebox: + _newSceneNum = 15; + _isLeavingScene = 1; + gnapWalkTo(5, 6, 0, 0x107BC, 1); + _gnapActionStatus = kASLeaveScene; + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene12_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = 15; + if (_s12_nextToothGuySequenceId == -1) { + if (v18 == 0 && _s12_currBeardGuySequenceId == 0x202 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (getRandom(2) != 0) + _s12_nextToothGuySequenceId = 0x1EC; + else + _s12_nextToothGuySequenceId = 0x204; + } else if (_s12_currToothGuySequenceId != 0x200) + _s12_nextToothGuySequenceId = 0x200; + v18 = (v18 + 1) % 15; + } + } + if (!_timers[5]) { + _timers[5] = getRandom(30) + 20; + if (_s12_nextBarkeeperSequenceId == -1 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBeardGuySequenceId == 0x202 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (getRandom(2) != 0) + _s12_nextBarkeeperSequenceId = 0x208; + else + _s12_nextBarkeeperSequenceId = 0x1FB; + } else + _s12_nextBarkeeperSequenceId = 0x203; + v18 = (v18 + 1) % 15; + } + } + if (!_timers[6]) { + _timers[6] = getRandom(30) + 15; + if (_s12_nextBeardGuySequenceId == -1 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _beaverActionStatus < 0) + _s12_nextBeardGuySequenceId = 0x1F2; + else + _s12_nextBeardGuySequenceId = 0x202; + v18 = (v18 + 1) % 15; + } + } + if (!_timers[7]) { + _timers[7] = getRandom(100) + 100; + _gnapRandomValue = getRandom(3); + switch (_gnapRandomValue) { + case 0: + _gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene12_updateHotspots(); + _timers[4] = 30; + _timers[5] = getRandom(30) + 20; + _timers[6] = getRandom(30) + 20; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene12_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + break; + case kASTalkToothGuy: + if (isKeyStatus1(Common::KEYCODE_j)) { + // Easter egg + clearKeyStatus1(Common::KEYCODE_j); + _s12_nextToothGuySequenceId = 0x206; + } else { + _s12_nextToothGuySequenceId = 0x1EE; + } + break; + case 3: + break; + case kASGrabToothGuy: + if (isKeyStatus1(Common::KEYCODE_j)) { + clearKeyStatus1(Common::KEYCODE_j); + _s12_nextToothGuySequenceId = 0x206; + } else { + _s12_nextToothGuySequenceId = 0x1EF; + } + break; + case kASShowItemToToothGuy: + if (isKeyStatus1(Common::KEYCODE_j)) { + clearKeyStatus1(Common::KEYCODE_j); + _s12_nextToothGuySequenceId = 0x206; + } else { + _s12_nextToothGuySequenceId = 0x1ED; + } + break; + case kASQuarterWithHoleToToothGuy: + if (isKeyStatus1(Common::KEYCODE_j)) { + clearKeyStatus1(Common::KEYCODE_j); + _s12_nextToothGuySequenceId = 0x206; + } else { + _s12_nextToothGuySequenceId = 0x1EA; + } + break; + case kASQuarterToToothGuy: + if (isKeyStatus1(Common::KEYCODE_j)) { + clearKeyStatus1(Common::KEYCODE_j); + _s12_nextToothGuySequenceId = 0x206; + } else { + _s12_nextToothGuySequenceId = 0x1E9; + } + break; + case kASQuarterToToothGuyDone: + _gnapActionStatus = -1; + showCursor(); + _gameSys->removeSpriteDrawItem(_largeSprite, 300); + deleteSurface(&_largeSprite); + setGrabCursorSprite(kItemQuarterWithHole); + break; + case kASTalkBeardGuy: + _s12_nextBeardGuySequenceId = 0x1F4; + break; + case kASLookBeardGuy: + _s12_nextBeardGuySequenceId = 0x1F3; + break; + case kASGrabBeardGuy: + _s12_nextBeardGuySequenceId = 0x1F1; + break; + case kASShowItemToBeardGuy: + _s12_nextBeardGuySequenceId = 0x1F0; + break; + case kASTalkBarkeeper: + _gnapRandomValue = getRandom(2); + if (_gnapRandomValue != 0) + _s12_nextBarkeeperSequenceId = 0x1FD; + else + _s12_nextBarkeeperSequenceId = 0x1FF; + break; + case kASLookBarkeeper: + _s12_nextBarkeeperSequenceId = 0x1F8; + break; + case 14: + _s12_nextBarkeeperSequenceId = 0x1F6; + break; + case kASShowItemToBarkeeper: + _s12_nextBarkeeperSequenceId = 0x1F5; + break; + case kASQuarterWithBarkeeper: + _s12_nextBarkeeperSequenceId = 0x1FA; + break; + case kASPlatWithBarkeeper: + _s12_nextBarkeeperSequenceId = 0x1F9; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + switch (_beaverActionStatus) { + case kASPlatWithToothGuy: + _s12_nextToothGuySequenceId = 0x1EB; + break; + case kASPlatWithBeardGuy: + _s12_nextBeardGuySequenceId = 0x1F3; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + if (_s12_currToothGuySequenceId == 0x1E9) { + _gameSys->setAnimation(0, 0, 2); + hideCursor(); + _gameSys->setAnimation(0x10843, 301, 0); + _gnapActionStatus = kASQuarterToToothGuyDone; + _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); + _gameSys->insertSequence(0x10843, 301, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x107B7, _gnapId, 0x10843, 301, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7B7; + _gnapSequenceDatNum = 1; + setFlag(3); + invAdd(kItemQuarterWithHole); + invRemove(kItemQuarter); + } + if (_s12_nextToothGuySequenceId == 0x1EF) { + _gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); + _gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _s12_currToothGuySequenceId = _s12_nextToothGuySequenceId; + _s12_nextToothGuySequenceId = -1; + _gnapSequenceId = 0x205; + _gnapSequenceDatNum = 0; + _timers[4] = 40; + _timers[2] = getRandom(20) + 70; + _timers[3] = getRandom(50) + 200; + if (_gnapActionStatus == kASGrabToothGuy) + _gnapActionStatus = -1; + } else if (_s12_nextToothGuySequenceId != -1) { + _gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); + _s12_currToothGuySequenceId = _s12_nextToothGuySequenceId; + _s12_nextToothGuySequenceId = -1; + _timers[4] = 50; + if (_gnapActionStatus >= kASTalkToothGuy && _gnapActionStatus <= kASQuarterToToothGuy && _s12_currToothGuySequenceId != 0x1E9 && + _s12_currToothGuySequenceId != 0x1EC && _s12_currToothGuySequenceId != 0x200) + _gnapActionStatus = -1; + if (_beaverActionStatus == kASPlatWithToothGuy) + _beaverActionStatus = -1; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + if (_gnapActionStatus == kASPlatWithBarkeeper && _s12_currBarkeeperSequenceId == 0x1F9) { + _gnapActionStatus = -1; + playGnapIdle(7, 6); + _timers[5] = 0; + } + if (_s12_nextBarkeeperSequenceId != -1) { + _gameSys->insertSequence(_s12_nextBarkeeperSequenceId, 50, _s12_currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s12_nextBarkeeperSequenceId, 50, 3); + _s12_currBarkeeperSequenceId = _s12_nextBarkeeperSequenceId; + _s12_nextBarkeeperSequenceId = -1; + _timers[5] = getRandom(30) + 20; + if (_gnapActionStatus >= kASTalkBarkeeper && _gnapActionStatus <= kASQuarterWithBarkeeper && _s12_currBarkeeperSequenceId != 0x203 && + _s12_currBarkeeperSequenceId != 0x1FB && _s12_currBarkeeperSequenceId != 0x208) + _gnapActionStatus = -1; + } + } + + if (_gameSys->getAnimationStatus(4) == 2 && _s12_nextBeardGuySequenceId != -1) { + _gameSys->insertSequence(_s12_nextBeardGuySequenceId, 50, _s12_currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s12_nextBeardGuySequenceId, 50, 4); + _s12_currBeardGuySequenceId = _s12_nextBeardGuySequenceId; + _s12_nextBeardGuySequenceId = -1; + _timers[6] = getRandom(30) + 20; + if (_gnapActionStatus >= kASTalkBeardGuy && _gnapActionStatus <= kASShowItemToBeardGuy && _s12_currBeardGuySequenceId != 0x202 && _s12_currBeardGuySequenceId != 0x1F2) + _gnapActionStatus = -1; + if (_beaverActionStatus == kASPlatWithBeardGuy) + _beaverActionStatus = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp new file mode 100644 index 0000000000..c9b4d53917 --- /dev/null +++ b/engines/gnap/scenes/scene13.cpp @@ -0,0 +1,455 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitBar = 1, + kHSWalkArea1 = 2, + kHSBackToilet = 3, + kHSFrontToilet = 4, + kHSUrinal = 5, + kHSScribble = 6, + kHSSink = 7, + kHSWalkArea2 = 8, + kHSDevice = 9, + kHSWalkArea3 = 10, + kHSWalkArea4 = 11, + kHSWalkArea5 = 12, + kHSWalkArea6 = 13, + kHSWalkArea7 = 14, + kHSWalkArea8 = 15, + kHSWalkArea9 = 16 +}; + +enum { + kASLeaveScene = 0, + kASBackToilet = 1, + kASFrontToilet = 2, + kASLookScribble = 6, + kASGrabSink = 7, + kASGrabSinkDone = 8, + kASWait = 12, + kASGrabUrinal = 13 +}; + +int GnapEngine::scene13_init() { + playSound(0x108EC, 0); + return 0xAC; +} + +void GnapEngine::scene13_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitBar, 113, 160, 170, 455, SF_EXIT_L_CURSOR); + setHotspot(kHSBackToilet, 385, 195, 478, 367, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSFrontToilet, 497, 182, 545, 432, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSUrinal, 680, 265, 760, 445, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSScribble, 560, 270, 660, 370, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSSink, 310, 520, 560, 599, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 268, 270, 325, 385); + setHotspot(kHSWalkArea2, 0, 0, 52, 599); + setHotspot(kHSWalkArea3, 0, 0, 113, 550); + setHotspot(kHSWalkArea4, 0, 0, 226, 438); + setHotspot(kHSWalkArea5, 0, 0, 268, 400); + setHotspot(kHSWalkArea6, 0, 0, 799, 367); + setHotspot(kHSWalkArea7, 478, 0, 799, 401); + setHotspot(kHSWalkArea8, 545, 0, 799, 473); + setHotspot(kHSWalkArea9, 0, 549, 799, 599); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 17; +} + +void GnapEngine::scene13_showScribble() { + hideCursor(); + _largeSprite = _gameSys->createSurface(0x6F); + _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); + while (!_mouseClickState.left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && + !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29)) + gameUpdateTick(); + _mouseClickState.left = false; + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(29); + clearKeyStatus1(Common::KEYCODE_SPACE); + _gameSys->removeSpriteDrawItem(_largeSprite, 300); + deleteSurface(&_largeSprite); + showCursor(); +} + +void GnapEngine::scene13_run() { + int currSoundId = 0; + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + + if (_prevSceneNum == 14) { + initGnapPos(6, 6, 3); + initBeaverPos(9, 8, 0); + } else { + initGnapPos(3, 7, 1); + initBeaverPos(2, 7, 0); + } + + endSceneInit(); + + _timers[4] = getRandom(20) + 20; + _timers[5] = getRandom(50) + 50; + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1091A)) + playSound(0x1091A, 1); + + testWalk(0, 0, -1, -1, -1, -1); + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene13_updateHotspots(); + _timers[4] = getRandom(20) + 20; + _timers[5] = getRandom(50) + 50; + } + break; + + case kHSPlatypus: + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0)); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHSExitBar: + _isLeavingScene = 1; + gnapWalkTo(2, 7, 0, 0x107C0, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(2, 8, -1, -1, 1); + if (isFlag(14) || isFlag(15)) { + _newSceneNum = 11; + } else { + setFlag(15); + _newSceneNum = 47; + } + break; + + case kHSBackToilet: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(5, 5, 6, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + case TALK_CURSOR: + if (_gnapX == 5 && _gnapY == 5) { + _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); + _gameSys->setAnimation(_s13_backToiletCtr + 0xA3, _gnapId, 0); + _gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + 9, 0, 0, 0); + _gnapActionStatus = kASWait; + _gnapSequenceId = _s13_backToiletCtr + 0xA3; + _gnapIdleFacing = 7; + _gnapSequenceDatNum = 0; + } else { + gnapWalkTo(5, 5, 0, 0x107BB, 1); + _gnapActionStatus = kASBackToilet; + _gnapIdleFacing = 7; + } + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSFrontToilet: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(6, 7, 7, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + gnapWalkTo(6, 7, 0, 0xA9, 5); + _gnapActionStatus = kASFrontToilet; + _gnapIdleFacing = 1; + break; + } + } + break; + + case kHSScribble: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(7, 7, 8, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + gnapWalkTo(7, 7, 0, 0x107BB, 1); + _gnapActionStatus = kASLookScribble; + _gnapIdleFacing = 7; + break; + case GRAB_CURSOR: + playGnapScratchingHead(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(7, 7, -1, getGnapSequenceId(gskBrainPulsating, 0, 0), 1); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSUrinal: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(8, 7, 9, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapSequence(getGnapSequenceId(gskDeflect, 9, 6)); + gnapWalkTo(_gnapX, _gnapY, 0, -1, 1); + _gnapActionStatus = kASWait; + break; + case GRAB_CURSOR: + gnapWalkTo(8, 7, 0, -1, 1); + _gnapActionStatus = kASGrabUrinal; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSSink: + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapSequence(getGnapSequenceId(gskDeflect, 5, 9)); + gnapWalkTo(_gnapX, _gnapY, 0, -1, 1); + _gnapActionStatus = kASWait; + break; + case GRAB_CURSOR: + gnapWalkTo(4, 8, 0, 0x107B9, 1); + _gnapActionStatus = kASGrabSink; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + case kHSWalkArea5: + case kHSWalkArea6: + case kHSWalkArea7: + case kHSWalkArea8: + case kHSWalkArea9: + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHSWalkArea1: + // Nothing + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene13_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + if (_platY == 5 || _platY == 6) + platypusWalkTo(-1, 7, -1, -1, 1); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(20) + 20; + _gnapRandomValue = getRandom(5); + switch (_gnapRandomValue) { + case 0: + playSound(0xD2, 0); + break; + case 1: + playSound(0xD3, 0); + break; + case 2: + playSound(0xD4, 0); + break; + case 3: + playSound(0xD5, 0); + break; + case 4: + playSound(0xD6, 0); + break; + } + } + if (!_timers[5]) { + int newSoundId; + _timers[5] = getRandom(50) + 50; + _gnapRandomValue = getRandom(7); + switch (_gnapRandomValue) { + case 0: + newSoundId = 0xD7; + _timers[5] = 2 * getRandom(50) + 100; + break; + case 1: + case 2: + newSoundId = 0xCF; + break; + case 3: + case 4: + newSoundId = 0xD0; + break; + default: + newSoundId = 0xD1; + break; + } + if (newSoundId != currSoundId) { + playSound(newSoundId, 0); + currSoundId = newSoundId; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene13_updateHotspots(); + _timers[4] = getRandom(20) + 20; + _timers[5] = getRandom(50) + 50; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene13_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + _gnapActionStatus = -1; + break; + case kASBackToilet: + _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); + _gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 9, 0, 0, 0); + _gnapSequenceId = _s13_backToiletCtr + 0xA3; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + break; + case kASFrontToilet: + _sceneDone = true; + _newSceneNum = 14; + break; + case kASLookScribble: + _gnapActionStatus = -1; + scene13_showScribble(); + break; + case kASGrabSink: + _gameSys->setAnimation(0xAB, 160, 0); + _gameSys->insertSequence(0xAB, 160, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(0xAA, 256, 1); + _gnapSequenceId = 0xAB; + _gnapId = 160; + _gnapIdleFacing = 1; + _gnapSequenceDatNum = 0; + _gnapX = 4; + _gnapY = 8; + _timers[2] = 360; + _gnapActionStatus = kASGrabSinkDone; + break; + case kASGrabSinkDone: + _gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + _gnapActionStatus = -1; + break; + case kASWait: + _gnapActionStatus = -1; + break; + case kASGrabUrinal: + _gameSys->setAnimation(0xA2, 120, 0); + _gameSys->insertSequence(0xA2, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0xA2; + _gnapId = 120; + _gnapIdleFacing = 3; + _gnapSequenceDatNum = 0; + _gnapX = 4; + _gnapY = 6; + _timers[2] = 360; + _gnapActionStatus = kASWait; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + _beaverActionStatus = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp new file mode 100644 index 0000000000..4f799db977 --- /dev/null +++ b/engines/gnap/scenes/scene14.cpp @@ -0,0 +1,194 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExit = 1, + kHSCoin = 2, + kHSToilet = 3, + kHSDevice = 4 +}; + +int GnapEngine::scene14_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + return 0x27; +} + +void GnapEngine::scene14_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0); + setHotspot(kHSExit, 0, 590, 799, 599, SF_EXIT_D_CURSOR); + setHotspot(kHSCoin, 330, 390, 375, 440, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSToilet, 225, 250, 510, 500, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(2)) + _hotspots[kHSCoin].flags = SF_DISABLED; + _hotspotsCount = 5; +} + +void GnapEngine::scene14_run() { + + _largeSprite = 0; + + queueInsertDeviceIcon(); + + if (!isFlag(2)) + _gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); + + endSceneInit(); + + if (!isFlag(2) && invHas(kItemTongs)) + _largeSprite = _gameSys->createSurface(1); + + if (!isFlag(2)) { + _gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x24; + _timers[2] = getRandom(40) + 50; + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene14_updateHotspots(); + } + break; + + case kHSExit: + _sceneDone = true; + _newSceneNum = 13; + break; + + case kHSCoin: + if (_grabCursorSpriteIndex == kItemTongs) { + invAdd(kItemQuarter); + setFlag(2); + setGrabCursorSprite(-1); + hideCursor(); + _gameSys->setAnimation(0x26, 10, 0); + _gameSys->insertSequence(0x26, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + } else if (_grabCursorSpriteIndex >= 0) { + playSound(0x108E9, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playSound(0x108E9, 0); + break; + case GRAB_CURSOR: + _gameSys->insertSequence(0x25, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x23; + break; + case TALK_CURSOR: + playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + break; + case PLAT_CURSOR: + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + break; + } + } + break; + + case kHSToilet: + if (_grabCursorSpriteIndex >= 0) { + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + playSound(0x108B1, 0); + break; + case TALK_CURSOR: + playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + break; + case PLAT_CURSOR: + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + break; + } + } + break; + + default: + _mouseClickState.left = false; + break; + + } + + scene14_updateAnimations(); + + checkGameKeys(); + + if (!isFlag(2) && !_timers[2]) { + _gameSys->insertSequence(0x24, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x24; + _timers[2] = getRandom(40) + 50; + } + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene14_updateHotspots(); + } + + gameUpdateTick(); + + } + + if (_largeSprite) + deleteSurface(&_largeSprite); + +} + +void GnapEngine::scene14_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); + _gameSys->setAnimation(0x10843, 301, 1); + _gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + _sceneDone = true; + _newSceneNum = 13; + _grabCursorSpriteIndex = kItemQuarter; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp new file mode 100644 index 0000000000..54eb146fa5 --- /dev/null +++ b/engines/gnap/scenes/scene15.cpp @@ -0,0 +1,343 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExit = 1, + kHSButton1 = 2, + kHSButton2 = 3, + kHSButton3 = 4, + kHSButton4 = 5, + kHSButton5 = 6, + kHSButton6 = 7, + kHSButtonA = 8, + kHSButtonB = 9, + kHSButtonC = 10, + kHSButtonD = 11, + kHSButtonE = 12, + kHSButtonF = 13, + kHSCoinSlot = 14, + kHSPlayButton = 15, + kHSDevice = 16 +}; + +int GnapEngine::scene15_init() { + return 0xDD; +} + +void GnapEngine::scene15_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + setHotspot(kHSExit, 50, 590, 750, 599, SF_EXIT_D_CURSOR); + setHotspot(kHSButton1, 210, 425, 260, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButton2, 280, 425, 325, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButton3, 340, 425, 385, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButton4, 400, 425, 445, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButton5, 460, 425, 510, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButton6, 520, 425, 560, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButtonA, 205, 480, 250, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButtonB, 270, 480, 320, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButtonC, 335, 480, 380, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButtonD, 395, 480, 445, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButtonE, 460, 480, 505, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSButtonF, 515, 480, 560, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSCoinSlot, 585, 475, 620, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSPlayButton, 622, 431, 650, 482, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 17; +} + +void GnapEngine::scene15_run() { + + _s15_currSlotSequenceId = -1; + _s15_currUpperButtonSequenceId = -1; + _s15_currLowerButtonSequenceId = -1; + _s15_nextSlotSequenceId = -1; + _s15_nextUpperButtonSequenceId = -1; + _s15_nextLowerButtonSequenceId = -1; + _s15_currRecordSequenceId = 0xD5; + _s15_nextRecordSequenceId = -1; + + _gameSys->setAnimation(0xD5, 1, 0); + _gameSys->insertSequence(_s15_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + endSceneInit(); + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _hotspots[kHSPlatypus].x1 = 0; + _hotspots[kHSPlatypus].y1 = 0; + _hotspots[kHSPlatypus].x2 = 0; + _hotspots[kHSPlatypus].y2 = 0; + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (_sceneClickedHotspot >= 0) + debug("_sceneClickedHotspot: %d; _verbCursor: %d", _sceneClickedHotspot, _verbCursor); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene15_updateHotspots(); + } + break; + + case kHSExit: + _newSceneNum = 12; + _isLeavingScene = true; + break; + + case kHSCoinSlot: + if (_grabCursorSpriteIndex == kItemQuarter || _grabCursorSpriteIndex == kItemQuarterWithHole) { + _s15_nextSlotSequenceId = 0xDC; // Insert coin + } else if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _s15_nextSlotSequenceId = 0xDB; + } else if (_grabCursorSpriteIndex >= 0) { + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + playSound(0x108E9, 0); + break; + case TALK_CURSOR: + playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + break; + case PLAT_CURSOR: + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + break; + } + } + break; + + case kHSPlayButton: + if (_grabCursorSpriteIndex >= 0) { + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(12) || isFlag(13)) + playSound(0x108E9, 0); + else + _s15_nextSlotSequenceId = 0xDA; + break; + case GRAB_CURSOR: + if (isFlag(12) || isFlag(13)) + _s15_nextSlotSequenceId = 0xD9; + else + _s15_nextSlotSequenceId = 0xDA; + break; + case TALK_CURSOR: + playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + break; + case PLAT_CURSOR: + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + break; + } + } + break; + + case kHSButton1: + case kHSButton2: + case kHSButton3: + case kHSButton4: + case kHSButton5: + case kHSButton6: + if (_grabCursorSpriteIndex >= 0) { + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playSound(0x108E9, 0); + break; + case GRAB_CURSOR: + _s15_nextUpperButtonSequenceId = _sceneClickedHotspot + 0xC5; + break; + case TALK_CURSOR: + playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + break; + case PLAT_CURSOR: + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + break; + } + } + break; + + case kHSButtonA: + case kHSButtonB: + case kHSButtonC: + case kHSButtonD: + case kHSButtonE: + case kHSButtonF: + if (_grabCursorSpriteIndex >= 0) { + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playSound(0x108E9, 0); + break; + case GRAB_CURSOR: + _s15_nextLowerButtonSequenceId = _sceneClickedHotspot + 0xC5; + break; + case TALK_CURSOR: + playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + break; + case PLAT_CURSOR: + _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + break; + } + } + break; + + default: + _mouseClickState.left = false; + break; + + } + + scene15_updateAnimations(); + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene15_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene15_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + if (_isLeavingScene) { + _sceneDone = true; + } else if (_s15_nextSlotSequenceId != -1) { + _gameSys->setAnimation(_s15_nextSlotSequenceId, 1, 0); + _gameSys->insertSequence(_s15_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _s15_currSlotSequenceId = _s15_nextSlotSequenceId; + _s15_nextSlotSequenceId = -1; + switch (_s15_currSlotSequenceId) { + case 0xDC: + if (_grabCursorSpriteIndex == kItemQuarter) { + invRemove(kItemQuarter); + } else { + invRemove(kItemQuarterWithHole); + setFlag(13); + } + setGrabCursorSprite(-1); + break; + case 0xDB: + setFlag(14); + setGrabCursorSprite(-1); + _s15_nextSlotSequenceId = 0xD8; + break; + case 0xD9: + if (isFlag(12)) { + clearFlag(12); + invAdd(kItemQuarter); + _newGrabCursorSpriteIndex = kItemQuarter; + } else if (isFlag(13)) { + clearFlag(13); + invAdd(kItemQuarterWithHole); + _newGrabCursorSpriteIndex = kItemQuarterWithHole; + } + _newSceneNum = 12; + _isLeavingScene = true; + break; + case 0xD8: + case 0xDA: + if (_s15_currUpperButtonSequenceId != -1) { + _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, 1); + _s15_currUpperButtonSequenceId = -1; + } + if (_s15_currLowerButtonSequenceId != -1) { + _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, 1); + _s15_currLowerButtonSequenceId = -1; + } + break; + } + } else if (_s15_nextRecordSequenceId != -1) { + _gameSys->setAnimation(_s15_nextRecordSequenceId, 1, 0); + _gameSys->insertSequence(_s15_nextRecordSequenceId, 1, _s15_currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _s15_currRecordSequenceId = _s15_nextRecordSequenceId; + _s15_nextRecordSequenceId = -1; + if (_s15_currRecordSequenceId == 0xD3) { + invRemove(kItemDiceQuarterHole); + _newSceneNum = 16; + _isLeavingScene = true; + } + _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, 1); + _s15_currUpperButtonSequenceId = -1; + _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, 1); + _s15_currLowerButtonSequenceId = -1; + } else if (_s15_nextUpperButtonSequenceId != -1) { + _gameSys->setAnimation(_s15_nextUpperButtonSequenceId, 1, 0); + if (_s15_currUpperButtonSequenceId == -1) + _gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, _s15_currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _s15_currUpperButtonSequenceId = _s15_nextUpperButtonSequenceId; + _s15_nextUpperButtonSequenceId = -1; + if (_s15_currLowerButtonSequenceId != -1 && isFlag(14)) { + if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) + _s15_nextRecordSequenceId = 0xD3; + else + _s15_nextRecordSequenceId = 0xD4; + } + } else if (_s15_nextLowerButtonSequenceId != -1) { + _gameSys->setAnimation(_s15_nextLowerButtonSequenceId, 1, 0); + if (_s15_currLowerButtonSequenceId == -1) + _gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, _s15_currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _s15_currLowerButtonSequenceId = _s15_nextLowerButtonSequenceId; + _s15_nextLowerButtonSequenceId = -1; + if (_s15_currUpperButtonSequenceId != -1 && isFlag(14)) { + if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) + _s15_nextRecordSequenceId = 0xD3; + else + _s15_nextRecordSequenceId = 0xD4; + } + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene16.cpp b/engines/gnap/scenes/scene16.cpp new file mode 100644 index 0000000000..dfc852293e --- /dev/null +++ b/engines/gnap/scenes/scene16.cpp @@ -0,0 +1,82 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +void GnapEngine::scene16_initCutscene() { + _s99_dword_47F370[0] = 0x1F2; + _s99_dword_47F370[1] = 0x201; + _s99_dword_47F370[2] = 0x1FC; + _s99_dword_47F370[3] = 0x1F4; + _s99_dword_47F370[4] = 0x1FB; + _s99_dword_47F370[5] = 0x1F0; + _s99_dword_47F370[6] = 0x1FD; + _s99_dword_47F370[7] = 0x1FE; + _s99_dword_47F370[8] = 0x1F7; + _s99_dword_47F370[9] = 0x1F9; + _s99_dword_47F370[10] = 0x1F8; + _s99_dword_47F370[11] = 0x1F1; + _s99_dword_47F370[12] = 0x202; + _s99_dword_47F370[13] = 0x1F6; + _s99_dword_47F370[14] = 0x1F3; + _s99_dword_47F370[15] = 0x1FA; + _s99_dword_47F370[16] = 0x1FF; + _s99_dword_47F370[17] = 0x200; + _s99_dword_47F370[18] = 0x203; + _s99_dword_47F370[19] = 0x206; + _s99_dword_47F370[20] = 0x207; + _s99_dword_47F370[21] = 0x204; + _s99_dword_47F370[22] = 0x205; + _s99_dword_47F2F0[0] = 0x1C; + _s99_dword_47F2F0[1] = 2; + _s99_dword_47F2F0[2] = 0x1B; + _s99_dword_47F2F0[3] = 0; + _s99_dword_47F2F0[4] = 0x167; + _s99_dword_47F2F0[5] = 1; + _s99_dword_47F2F0[6] = 0x15B; + _s99_dword_47F2F0[7] = 0x15A; + _s99_dword_47F2F0[8] = 0x170; + _s99_dword_47F2F0[9] = 0x1EB; + _s99_dword_47F2F0[10] = 0x1EC; + _s99_dword_47F2F0[11] = 0x1BE; + _s99_dword_47F2F0[12] = 0x1BF; + _s99_dword_47F330[0] = 4; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = 1; + _s99_dword_47F330[3] = 6; + _s99_dword_47F330[4] = 1; + _s99_dword_47F330[5] = 3; + _s99_dword_47F330[6] = 1; + _s99_dword_47F330[7] = 1; + _s99_dword_47F330[8] = 1; + _s99_dword_47F330[9] = 1; + _s99_dword_47F330[10] = 1; + _s99_dword_47F330[11] = 1; + _s99_dword_47F330[12] = 1; + _s99_itemsCount = 13; +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp new file mode 100644 index 0000000000..5b7c54c0a8 --- /dev/null +++ b/engines/gnap/scenes/scene17.cpp @@ -0,0 +1,846 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSPhone1 = 1, + kHSPhone2 = 2, + kHSExitGrubCity = 3, + kHSDevice = 4, + kHSExitToyStore = 5, + kHSWrench = 6, + kHSWalkArea1 = 7, + kHSWalkArea2 = 8, + kHSWalkArea3 = 9 +}; + +enum { + kASTryGetWrench = 0, + kASGetWrench2 = 1, + kASGetWrenchDone = 2, + kASGetWrench1 = 3, + kASPlatUsePhone = 4, + kASPutCoinIntoPhone = 5, + kASGetCoinFromPhone = 6, + kASGetCoinFromPhoneDone = 7, + kASPutCoinIntoPhoneDone = 8, + kASGnapUsePhone = 9, + kASGetWrenchGnapReady = 10, + kASGnapHangUpPhone = 11, + kASPlatPhoningAssistant = 12, + kASPlatHangUpPhone = 14, + kASLeaveScene = 15 +}; + +int GnapEngine::scene17_init() { + return 0x263; +} + +void GnapEngine::scene17_updateHotspots() { + setHotspot(kHSPlatypus, 1, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSPhone1, 61, 280, 97, 322, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + setHotspot(kHSPhone2, 80, 204, 178, 468, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + setHotspot(kHSExitGrubCity, 196, 207, 280, 304, SF_EXIT_U_CURSOR, 3, 5); + setHotspot(kHSExitToyStore, 567, 211, 716, 322, SF_EXIT_U_CURSOR, 5, 6); + setHotspot(kHSWrench, 586, 455, 681, 547, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + setHotspot(kHSWalkArea1, 0, 0, 800, 434); + setHotspot(kHSWalkArea2, 541, 0, 800, 600); + setHotspot(kHSWalkArea3, 0, 204, 173, 468); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(6)) + _hotspots[kHSWrench].flags = 0; + if (isFlag(26)) { + _hotspots[kHSDevice].flags = SF_DISABLED; + _hotspots[kHSPlatypus].flags = SF_DISABLED; + } + _hotspotsCount = 10; +} + +void GnapEngine::scene17_update() { + gameUpdateTick(); + updateMouseCursor(); + updateGrabCursorSprite(0, 0); + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } +} + +void GnapEngine::scene17_platHangUpPhone() { + int savedGnapActionStatus = _gnapActionStatus; + + if (_beaverActionStatus == kASPlatPhoningAssistant) { + _gnapActionStatus = kASPlatHangUpPhone; + updateMouseCursor(); + _s17_platPhoneCtr = 0; + _beaverActionStatus = -1; + _gameSys->setAnimation(0x257, 254, 4); + _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, 32, 0, 0, 0); + while (_gameSys->getAnimationStatus(4) != 2) + gameUpdateTick(); + _gameSys->setAnimation(0x25B, _beaverId, 1); + _gameSys->insertSequence(0x25B, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceId = 0x25B; + _beaverSequenceDatNum = 0; + _s17_currPhoneSequenceId = -1; + _s17_nextPhoneSequenceId = -1; + clearFlag(26); + while (_gameSys->getAnimationStatus(1) != 2) + gameUpdateTick(); + _gnapActionStatus = savedGnapActionStatus; + updateMouseCursor(); + } + scene17_updateHotspots(); +} + +void GnapEngine::scene17_run() { + + playSound(0x10940, 1); + startSoundTimerA(8); + _sceneWaiting = false; + _timers[4] = getRandom(100) + 200; + _timers[3] = 200; + _timers[5] = getRandom(30) + 80; + _timers[6] = getRandom(30) + 200; + _timers[7] = getRandom(100) + 100; + + if (isFlag(9)) { + _gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); + } else { + if (_s18_garbageCanPos >= 8) { + _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); + } else if (_s18_garbageCanPos >= 6) { + _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); + } else if (_s18_garbageCanPos >= 5) { + _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); + } else if (_s18_garbageCanPos >= 4) { + _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); + } else { + _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); + } + } + + if (isFlag(19)) + _gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + if (isFlag(6)) + _s17_currWrenchSequenceId = 0x22D; + else + _s17_currWrenchSequenceId = 0x22F; + + _s17_currCarWindowSequenceId = 0x244; + + if (isFlag(14)) + _gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); + + _gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); + _gameSys->insertSequence(_s17_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(6)) { + _gameSys->setAnimation(0, 0, 3); + } else { + _gameSys->setAnimation(_s17_currCarWindowSequenceId, 40, 3); + _gameSys->insertSequence(_s17_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + } + + _s17_canTryGetWrench = true; + + if (isFlag(18)) + _gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + + if (_prevSceneNum == 53 || _prevSceneNum == 18 || _prevSceneNum == 20 || _prevSceneNum == 19) { + if (_prevSceneNum == 20) { + initGnapPos(4, 6, 1); + initBeaverPos(5, 6, 0); + endSceneInit(); + platypusWalkTo(5, 9, -1, 0x107C2, 1); + gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else if (isFlag(27)) { + initGnapPos(3, 9, 5); + _platX = _hotspotsWalkPos[2].x; + _platY = _hotspotsWalkPos[2].y; + _beaverId = 20 * _hotspotsWalkPos[2].y; + _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); + _beaverSequenceId = 0x25A; + _beaverSequenceDatNum = 0; + endSceneInit(); + clearFlag(15); + clearFlag(16); + _beaverActionStatus = kASPlatPhoningAssistant; + scene17_platHangUpPhone(); + _gameSys->setAnimation(0, 0, 4); + clearFlag(26); + clearFlag(27); + scene17_updateHotspots(); + } else if (isFlag(25)) { + clearFlag(15); + clearFlag(16); + initBeaverPos(7, 9, 0); + _gnapX = _hotspotsWalkPos[2].x; + _gnapY = _hotspotsWalkPos[2].y; + _gnapId = 20 * _hotspotsWalkPos[2].y; + _gameSys->insertSequence(601, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 601; + _gnapActionStatus = kASGnapHangUpPhone; + clearFlag(25); + _gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + _gameSys->setAnimation(0x257, 254, 0); + _gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); + } else if (isFlag(26)) { + clearFlag(15); + clearFlag(16); + _sceneWaiting = true; + initGnapPos(3, 9, 5); + _platX = _hotspotsWalkPos[2].x; + _platY = _hotspotsWalkPos[2].y; + _beaverId = 20 * _hotspotsWalkPos[2].y; + _s17_currPhoneSequenceId = 0x251; + _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s17_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + _beaverSequenceId = 0x25A; + _beaverSequenceDatNum = 0; + endSceneInit(); + _gameSys->setAnimation(_s17_currPhoneSequenceId, 254, 1); + _beaverActionStatus = kASPlatPhoningAssistant; + scene17_updateHotspots(); + } else if (_prevSceneNum == 18) { + initGnapPos(6, 6, 1); + initBeaverPos(5, 6, 0); + endSceneInit(); + platypusWalkTo(5, 9, -1, 0x107C2, 1); + gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else { + if (isFlag(15)) { + initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1); + initBeaverPos(1, 9, 0); + endSceneInit(); + } else { + initGnapPos(3, 7, 1); + initBeaverPos(1, 7, 0); + endSceneInit(); + } + clearFlag(15); + clearFlag(16); + endSceneInit(); + } + } else { + _gnapX = 3; + _gnapY = 6; + _gnapId = 120; + _gnapSequenceId = 0x23D; + _gnapSequenceDatNum = 0; + _gnapIdleFacing = 1; + _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0, 0, kSeqNone, 0, 0, 0); + _platX = -1; + _platY = 8; + _beaverId = 160; + _gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x107C1, _beaverId, 0x241, _beaverId, + 9, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + _gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); + // TODO delayTicksA(2, 9); + endSceneInit(); + _beaverSequenceId = 0x7C1; + _beaverSequenceDatNum = 1; + _beaverFacing = 1; + platypusWalkTo(2, 9, -1, 0x107C2, 1); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0 || _gnapActionStatus == 3) { + runMenu(); + scene17_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + if (isFlag(6)) { + gnapUseJointOnPlatypus(); + } else { + gnapUseDeviceOnBeaver(); + platypusWalkTo(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); + gnapWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 0, 0x107BA, 1); + _beaverActionStatus = kASGetWrench1; + _gnapActionStatus = kASGetWrench1; + _timers[5] = getRandom(30) + 80; + setGrabCursorSprite(-1); + invRemove(kItemJoint); + } + } else if (_grabCursorSpriteIndex >= 0) { + playGnapScratchingHead(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + playGnapScratchingHead(_platX, _platY); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSWrench: + if (_gnapActionStatus < 0) { + if (isFlag(6)) { + playGnapImpossible(0, 0); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 8, 7); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + playGnapScratchingHead(8, 7); + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (_s17_canTryGetWrench) { + scene17_platHangUpPhone(); + gnapUseDeviceOnBeaver(); + platypusWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _beaverActionStatus = kASTryGetWrench; + _gnapActionStatus = kASTryGetWrench; + _timers[5] = getRandom(30) + 80; + } else + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSPhone1: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { + gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASPutCoinIntoPhone; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(1, 3); + break; + case GRAB_CURSOR: + if (isFlag(18)) { + scene17_platHangUpPhone(); + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y) | 0x10000, 1); + _gnapActionStatus = kASGetCoinFromPhone; + } else + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (isFlag(18)) { + scene17_platHangUpPhone(); + _isLeavingScene = true; + gnapUseDeviceOnBeaver(); + _beaverFacing = 5; + platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); + setFlag(16); + _beaverActionStatus = kASPlatUsePhone; + _gnapActionStatus = kASPlatUsePhone; + } else + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSPhone2: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { + gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASPutCoinIntoPhone; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(1, 3); + break; + case GRAB_CURSOR: + if (isFlag(18)) { + scene17_platHangUpPhone(); + _isLeavingScene = true; + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGnapUsePhone; + setFlag(15); + } else + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (isFlag(18)) { + scene17_platHangUpPhone(); + _isLeavingScene = true; + gnapUseDeviceOnBeaver(); + _beaverFacing = 5; + platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); + setFlag(16); + _beaverActionStatus = kASPlatUsePhone; + _gnapActionStatus = kASPlatUsePhone; + } else + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitToyStore: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 18; + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107BB, 1); + _gnapActionStatus = kASLeaveScene; + if (_beaverActionStatus != kASPlatPhoningAssistant) + platypusWalkTo(_hotspotsWalkPos[5].x - 1, _hotspotsWalkPos[5].y, -1, 0x107C2, 1); + } + break; + + case kHSExitGrubCity: + if (_gnapActionStatus < 0) { + scene17_platHangUpPhone(); + _isLeavingScene = true; + _newSceneNum = 20; + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y, -1, 0x107C2, 1); + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = 0; + } + break; + } + + scene17_updateAnimations(); + + if (!isSoundPlaying(0x10940)) + playSound(0x10940, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) + beaverSub426234(); + updateGnapIdleSequence2(); + if (!_timers[4]) { + _timers[4] = getRandom(100) + 200; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0) + _gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_timers[7]) { + _timers[7] = getRandom(100) + 100; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + switch (getRandom(3)) { + case 0: + _gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + if (_beaverActionStatus < 0 && !_timers[5]) { + _timers[5] = getRandom(30) + 80; + if (isFlag(6) && _s17_nextWrenchSequenceId == -1) { + _s17_nextWrenchSequenceId = 0x236; + } else if (_s17_canTryGetWrench) { + switch (getRandom(6)) { + case 0: + _s17_nextWrenchSequenceId = 0x231; + break; + case 1: + _s17_nextWrenchSequenceId = 0x232; + break; + case 2: + case 3: + _s17_nextWrenchSequenceId = 0x23C; + break; + case 4: + case 5: + _s17_nextWrenchSequenceId = 0x22E; + break; + } + } else { + --_s17_wrenchCtr; + if (_s17_wrenchCtr) { + switch (getRandom(6)) { + case 0: + _s17_nextWrenchSequenceId = 0x237; + break; + case 1: + _s17_nextWrenchSequenceId = 0x238; + break; + case 2: + _s17_nextWrenchSequenceId = 0x239; + break; + case 3: + _s17_nextWrenchSequenceId = 0x23A; + break; + case 4: + _s17_nextWrenchSequenceId = 0x23B; + break; + case 5: + _s17_nextWrenchSequenceId = 0x235; + break; + } + } else { + _s17_wrenchCtr = 2; + _s17_nextWrenchSequenceId = 0x235; + } + } + } + if (!_timers[6]) { + _timers[6] = getRandom(30) + 200; + if (_s17_nextCarWindowSequenceId == -1 && !isFlag(6)) + _s17_nextCarWindowSequenceId = 0x246; + } + playSoundA(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene17_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene17_updateAnimations() { + + static const int kPlatPhoneSequenceIds[] = { + 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257 + }; + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASGetWrench1: + _gnapActionStatus = kASGetWrenchGnapReady; + break; + case kASGetCoinFromPhone: + playGnapPullOutDevice(1, 3); + playGnapUseDevice(0, 0); + _gameSys->setAnimation(0x250, 100, 0); + _gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); + invAdd(kItemDiceQuarterHole); + clearFlag(18); + _gnapActionStatus = kASGetCoinFromPhoneDone; + break; + case kASGetCoinFromPhoneDone: + setGrabCursorSprite(kItemDiceQuarterHole); + _gnapActionStatus = -1; + break; + case kASPutCoinIntoPhone: + _gameSys->setAnimation(0x24C, _gnapId, 0); + _gameSys->insertSequence(0x24C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x24C; + invRemove(kItemDiceQuarterHole); + setGrabCursorSprite(-1); + setFlag(18); + _gnapActionStatus = kASPutCoinIntoPhoneDone; + break; + case kASPutCoinIntoPhoneDone: + _gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + _gnapActionStatus = -1; + break; + case kASGnapUsePhone: + _gameSys->setAnimation(0x24D, _gnapId, 0); + _gameSys->insertSequence(0x24D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = kASLeaveScene; + _newSceneNum = 53; + break; + case kASGnapHangUpPhone: + _gameSys->insertSequence(0x258, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x258; + _gnapActionStatus = -1; + break; + case kASLeaveScene: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + switch (_beaverActionStatus) { + case kASTryGetWrench: + _beaverActionStatus = -1; + ++_s17_platTryGetWrenchCtr; + if (_s17_platTryGetWrenchCtr % 2 != 0) + _s17_nextWrenchSequenceId = 0x233; + else + _s17_nextWrenchSequenceId = 0x234; + _s17_canTryGetWrench = false; + break; + case kASGetWrench1: + _s17_nextWrenchSequenceId = 0x230; + break; + case kASGetWrench2: + _s17_nextCarWindowSequenceId = 0x249; + break; + case kASGetWrenchDone: + _beaverActionStatus = -1; + invAdd(kItemWrench); + setGrabCursorSprite(kItemWrench); + break; + case kASPlatUsePhone: + _gameSys->setAnimation(0x24E, _beaverId, 1); + _gameSys->insertSequence(0x24E, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceDatNum = 0; + _beaverSequenceId = 0x24E; + _beaverActionStatus = kASLeaveScene; + _newSceneNum = 53; + break; + case kASPlatPhoningAssistant: + ++_s17_platPhoneCtr; + if (_s17_platPhoneCtr >= 7) { + _s17_platPhoneCtr = 0; + _s17_nextPhoneSequenceId = -1; + _s17_currPhoneSequenceId = -1; + _gameSys->insertSequence(0x25B, _beaverId, 0x25A, _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceDatNum = 0; + _beaverSequenceId = 0x25B; + _beaverActionStatus = -1; + clearFlag(26); + _sceneWaiting = false; + scene17_updateHotspots(); + } else { + _s17_nextPhoneSequenceId = kPlatPhoneSequenceIds[_s17_platPhoneCtr]; + _gameSys->setAnimation(_s17_nextPhoneSequenceId, 254, 1); + _gameSys->insertSequence(_s17_nextPhoneSequenceId, 254, _s17_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x25A, _beaverId, 0x25A, _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceDatNum = 0; + _beaverSequenceId = 0x25A; + _s17_currPhoneSequenceId = _s17_nextPhoneSequenceId; + } + break; + case kASLeaveScene: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + switch (_s17_nextWrenchSequenceId) { + case 0x233: + _gnapActionStatus = -1; + _gameSys->insertSequence(0x243, _beaverId, + _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; + _s17_nextWrenchSequenceId = -1; + _beaverSequenceId = 0x243; + _beaverSequenceDatNum = 0; + _gameSys->setAnimation(0x243, _beaverId, 1); + break; + case 0x234: + _gnapActionStatus = -1; + _gameSys->insertSequence(0x242, _beaverId, + _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; + _s17_nextWrenchSequenceId = -1; + _beaverSequenceId = 0x242; + _beaverSequenceDatNum = 0; + _gameSys->setAnimation(0x242, _beaverId, 1); + break; + case 0x231: + if (getRandom(2) != 0) + _s17_nextCarWindowSequenceId = 0x245; + else + _s17_nextCarWindowSequenceId = 0x248; + _gameSys->setAnimation(0, 0, 2); + break; + case 0x232: + _s17_nextCarWindowSequenceId = 0x247; + _gameSys->setAnimation(0, 0, 2); + break; + case 0x22E: + case 0x235: + if (_s17_nextWrenchSequenceId == 0x235) + _hotspots[kHSWrench].flags &= ~SF_DISABLED; + else + _hotspots[kHSWrench].flags |= SF_DISABLED; + _s17_canTryGetWrench = !_s17_canTryGetWrench; + _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; + _s17_nextWrenchSequenceId = -1; + break; + case 0x230: + if (_gnapActionStatus == kASGetWrenchGnapReady) { + _gameSys->setAnimation(0, 0, 2); + if (_s17_canTryGetWrench) { + _gameSys->insertSequence(0x22E, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s17_currWrenchSequenceId = 0x22E; + _s17_canTryGetWrench = false; + } + _gameSys->setAnimation(0x23F, _beaverId, 1); + _gameSys->insertSequence(0x10875, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x23F, _beaverId, + _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 1; + _beaverSequenceDatNum = 0; + _gnapSequenceId = 0x875; + _beaverSequenceId = 0x23F; + gnapWalkTo(3, 8, -1, 0x107B9, 1); + _beaverActionStatus = kASGetWrench2; + } + break; + default: + if (_s17_nextWrenchSequenceId != -1) { + _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; + _s17_nextWrenchSequenceId = -1; + } + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_s17_nextCarWindowSequenceId) { + case 0x246: + _gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); + _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; + _s17_nextCarWindowSequenceId = -1; + break; + case 0x245: + case 0x247: + case 0x248: + _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_gameSys->getAnimationStatus(2) != 2) + scene17_update(); + _gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); + _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; + _s17_nextCarWindowSequenceId = -1; + _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; + _s17_nextWrenchSequenceId = -1; + break; + case 0x249: + _gameSys->setAnimation(0x230, 40, 2); + _gameSys->setAnimation(0x240, _beaverId, 1); + _gameSys->insertSequence(0x230, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x240, _beaverId, _beaverSequenceId, _beaverId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x23E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x23E; + _gnapSequenceDatNum = 0; + _beaverSequenceId = 0x240; + _beaverSequenceDatNum = 0; + _gameSys->setAnimation(0x24A, 40, 3); + _gameSys->insertSequence(0x24A, 40, _s17_nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_gameSys->getAnimationStatus(2) != 2) { + scene17_update(); + if (_gameSys->getAnimationStatus(3) == 2) { + _gameSys->setAnimation(0x24A, 40, 3); + _gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + } + } + _gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x24B, 40, 3); + _gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + _s17_currCarWindowSequenceId = 0x24B; + _s17_nextCarWindowSequenceId = -1; + _s17_currWrenchSequenceId = 0x22D; + _s17_nextWrenchSequenceId = -1; + setFlag(6); + _gnapActionStatus = -1; + _beaverActionStatus = 2; + scene17_updateHotspots(); + _timers[5] = getRandom(30) + 80; + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp new file mode 100644 index 0000000000..619d50f5e2 --- /dev/null +++ b/engines/gnap/scenes/scene18.cpp @@ -0,0 +1,1026 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +static const int kScene18SequenceIds[] = { + 0x219, 0x21A, 0x21B, 0x21C, 0x21D +}; + +enum { + kHSPlatypus = 0, + kHSGarbageCan = 1, + kHSDevice = 2, + kHSExitToyStore = 3, + kHSExitPhoneBooth = 4, + kHSExitGrubCity = 5, + kHSHydrantTopValve = 6, + kHSHydrantRightValve = 7, + kHSCowboyHat = 8, + kHSWalkArea1 = 9, + kHSWalkArea2 = 10 +}; + +enum { + kASOpenRightValveNoGarbageCanDone = 0, + kASOpenRightValveNoGarbageCan = 1, + kASCloseRightValveNoGarbageCan = 2, + kASOpenTopValveDone = 3, + kASOpenTopValve = 4, + kASCloseTopValve = 5, + kASGrabGarbageCanFromStreet = 6, + kASGrabCowboyHat = 7, + kASGrabGarbageCanFromHydrant = 8, + kASPutGarbageCanOnRunningHydrant = 9, + kASPutGarbageCanOnRunningHydrant2 = 10, + kASGrabCowboyHatDone = 11, + kASStandingOnHydrant = 12, + kASOpenRightValveWithGarbageCan = 13, + kASOpenRightValveWithGarbageCanDone = 14, + kASCloseRightValveWithGarbageCan = 15, + kASPutGarbageCanOnHydrant = 16, + kASPutGarbageCanOnHydrantDone = 17, + kASPlatComesHere = 18, + kASCloseRightValveWithGarbageCanDone = 19, + kASLeaveScene = 20 +}; + +int GnapEngine::scene18_init() { + _gameSys->setAnimation(0, 0, 3); + return 0x222; +} + +void GnapEngine::scene18_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSGarbageCan, _gridMinX + 75 * _s18_garbageCanPos - 35, _gridMinY + 230, _gridMinX + 75 * _s18_garbageCanPos + 35, _gridMinY + 318, + SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, _s18_garbageCanPos, 7); + setHotspot(kHSExitToyStore, 460, 238, 592, 442, SF_EXIT_U_CURSOR, 7, 7); + setHotspot(kHSExitPhoneBooth, 275, 585, 525, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + setHotspot(kHSExitGrubCity, 0, 350, 15, 600, SF_EXIT_L_CURSOR, 0, 9); + setHotspot(kHSHydrantTopValve, 100, 345, 182, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 8); + setHotspot(kHSHydrantRightValve, 168, 423, 224, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + setHotspot(kHSCowboyHat, 184, 63, 289, 171, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + setHotspot(kHSWalkArea1, 0, 0, 800, 448); + setHotspot(kHSWalkArea2, 0, 0, 214, 515); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(8)) { + if (isFlag(9)) { + _hotspots[kHSHydrantTopValve].flags = SF_DISABLED; + _hotspots[kHSHydrantRightValve].x1 = 148; + _hotspots[kHSHydrantRightValve].y1 = 403; + _hotspots[kHSGarbageCan].flags = SF_DISABLED; + _hotspotsWalkPos[kHSGarbageCan].x = 3; + _hotspotsWalkPos[kHSGarbageCan].y = 7; + } else { + _hotspots[kHSHydrantTopValve].y1 = 246; + } + } else if (isFlag(7)) { + _hotspots[kHSHydrantRightValve].flags = SF_DISABLED; + _hotspots[kHSHydrantTopValve].x1 = 105; + _hotspots[kHSHydrantTopValve].x2 = 192; + } else if (isFlag(9)) { + _hotspots[kHSGarbageCan].x1 = 115; + _hotspots[kHSGarbageCan].y1 = 365; + _hotspots[kHSGarbageCan].x2 = 168; + _hotspots[kHSGarbageCan].y2 = 470; + _hotspots[kHSGarbageCan].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspotsWalkPos[kHSGarbageCan].x = 3; + _hotspotsWalkPos[kHSGarbageCan].y = 7; + } + if (isFlag(10)) + _hotspots[kHSGarbageCan].flags = SF_DISABLED; + if (isFlag(26)) { + _hotspots[kHSDevice].flags = SF_DISABLED; + _hotspots[kHSHydrantTopValve].flags = SF_DISABLED; + _hotspots[kHSHydrantRightValve].flags = SF_DISABLED; + _hotspots[kHSPlatypus].flags = SF_DISABLED; + } + if (isFlag(14)) { + _hotspots[kHSHydrantTopValve].flags = SF_DISABLED; + _hotspots[kHSCowboyHat].flags = SF_DISABLED; + } + _hotspotsCount = 11; +} + +void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { + + // TODO Cleanup + + static const int kSequenceIds[] = { + 0x203, 0x204 + }; + + int gnapSeqId, gnapId, gnapDatNum, gnapGridX; + int v13, v12, v5, v10, v11, v15, v16, a2; + + if (x >= 0) + v13 = x; + else + v13 = (_leftClickMouseX - _gridMinX + 37) / 75; + if (v13 >= _gnapX) + v10 = v13 - 1; + else + v10 = v13 + 1; + + if (a5 < 0) + a5 = 4; + v5 = v10; + if (v10 <= a5) + v5 = a5; + v11 = v5; + v12 = _gridMaxX - 1; + if (_gridMaxX - 1 >= v11) + v12 = v11; + + if (v12 == _gnapX) { + gnapSeqId = _gnapSequenceId; + gnapId = _gnapId; + gnapDatNum = _gnapSequenceDatNum; + gnapGridX = _gnapX; + if (_gnapX <= v13) + v15 = 1; + else + v15 = -1; + } else { + if (_gnapY == _platY) { + if (v12 >= _gnapX) { + if (v12 >= _platX && _gnapX <= _platX) + beaverMakeRoom(); + } else if (v12 <= _platX && _gnapX >= _platX) { + beaverMakeRoom(); + } + } + gnapSeqId = _gnapSequenceId; + gnapId = _gnapId; + gnapDatNum = _gnapSequenceDatNum; + gnapGridX = _gnapX; + if (v12 < _gnapX) + v15 = -1; + else + v15 = 1; + v16 = v15 == -1; + a2 = 20 * _gnapY + 1; + do { + if (isPointBlocked(gnapGridX + v15, _gnapY)) + break; + a2 += v15; + _gameSys->insertSequence(kSequenceIds[v16], a2, + gnapSeqId | (gnapDatNum << 16), gnapId, + kSeqSyncWait, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); + gnapSeqId = kSequenceIds[v16]; + gnapId = a2; + gnapDatNum = 0; + gnapGridX += v15; + } while (v12 != gnapGridX); + } + + if (argC >= 0) { + _gnapSequenceId = ridToEntryIndex(argC); + _gnapSequenceDatNum = ridToDatIndex(argC); + } else { + if (v15 == 1) + _gnapSequenceId = 0x20A; + else + _gnapSequenceId = 0x209; + _gnapSequenceDatNum = 0; + } + + if (v15 == 1) + _gnapIdleFacing = 1; + else + _gnapIdleFacing = 3; + + _gnapId = 20 * _gnapY + 1; + + if (animationIndex >= 0) + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); + + _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + gnapSeqId | (gnapDatNum << 16), gnapId, + 9, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); + + _gnapX = gnapGridX; + +} + +void GnapEngine::scene18_putDownGarbageCan(int animationIndex) { + if (animationIndex >= 0) { + while (_gameSys->getAnimationStatus(animationIndex) != 2) + gameUpdateTick(); + } + if (_gnapIdleFacing != 0 && _gnapIdleFacing != 1 && _gnapIdleFacing != 7) + _s18_garbageCanPos = _gnapX - 1; + else + _s18_garbageCanPos = _gnapX + 1; + clearFlag(10); + scene18_updateHotspots(); + if (_gnapIdleFacing != 0 && _gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + _gameSys->insertSequence(0x107BA, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7BA; + } else { + _gameSys->insertSequence(0x107B9, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7B9; + } + _gnapSequenceDatNum = 1; + _gameSys->insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _s18_garbageCanPos - 40), 0); + _gameSys->setAnimation(0x1FA, 19, 4); + _gameSys->insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _s18_garbageCanPos - 40), 0); + while (_gameSys->getAnimationStatus(4) != 2) + gameUpdateTick(); +} + +void GnapEngine::scene18_platEndPhoning(int a1) { + if (isFlag(26)) { + _s18_platPhoneIter = 0; + _s18_platPhoneCtr = 0; + _beaverActionStatus = -1; + if (_s18_currPhoneSequenceId != -1) { + _gameSys->setAnimation(0x21E, 254, 3); + _gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, 32, 0, 0, 0); + while (_gameSys->getAnimationStatus(3) != 2) + gameUpdateTick(); + } + _gameSys->removeSequence(0x21F, 254, 1); + _gameSys->setAnimation(0, 0, 3); + clearFlag(26); + if (a1) { + _beaverActionStatus = kASPlatComesHere; + _timers[6] = 50; + _sceneWaiting = true; + } + _s18_currPhoneSequenceId = -1; + _s18_nextPhoneSequenceId = -1; + scene18_updateHotspots(); + } +} + +void GnapEngine::scene18_closeHydrantValve() { + _gnapActionStatus = kASLeaveScene; + updateMouseCursor(); + if (isFlag(8)) { + gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); + if (isFlag(9)) { + _gnapActionStatus = kASCloseRightValveWithGarbageCan; + scene18_waitForGnapAction(); + } else { + _gnapActionStatus = kASCloseRightValveNoGarbageCan; + scene18_waitForGnapAction(); + } + } else if (isFlag(7)) { + gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); + _gnapActionStatus = kASCloseTopValve; + scene18_waitForGnapAction(); + } +} + +void GnapEngine::scene18_waitForGnapAction() { + while (_gnapActionStatus >= 0) { + scene18_updateAnimations(); + gameUpdateTick(); + } +} + +void GnapEngine::scene18_run() { + + _s18_cowboyHatSurface = 0; + + playSound(0x10940, 1); + startSoundTimerA(4); + + _timers[5] = getRandom(100) + 100; + + queueInsertDeviceIcon(); + + clearFlag(10); + + if (!isFlag(14)) + _gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(9)) { + if (isFlag(8)) { + _gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + playSound(0x22B, true); + } else { + _gameSys->insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); + } + } else { + _gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _s18_garbageCanPos - 40), 0); + if (isFlag(8)) { + _gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + playSound(0x22B, true); + } else if (isFlag(7)) { + _gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); + playSound(0x22B, true); + } + } + + if (isFlag(26)) { + if (_prevSceneNum == 17) + initGnapPos(4, 11, 1); + else + initGnapPos(4, 7, 1); + _s18_platPhoneCtr = getRandom(5); + if (isFlag(27)) { + _gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + _s18_currPhoneSequenceId = -1; + scene18_platEndPhoning(1); + clearFlag(27); + } else { + _s18_currPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr]; + _s18_platPhoneIter = 0; + _gameSys->insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s18_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + } + if (isFlag(27)) { + scene18_platEndPhoning(1); + clearFlag(27); + } else { + _gameSys->setAnimation(_s18_currPhoneSequenceId, 254, 3); + } + gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else { + if (isFlag(12)) { + clearFlag(12); + setGrabCursorSprite(kItemCowboyHat); + _prevSceneNum = 19; + } + if (_prevSceneNum == 17) { + initGnapPos(4, 11, 1); + initBeaverPos(5, 11, 0); + endSceneInit(); + gnapWalkTo(4, 8, -1, 0x107B9, 1); + platypusWalkTo(5, 9, -1, 0x107C2, 1); + } else if (_prevSceneNum == 19) { + initGnapPos(7, 7, 1); + initBeaverPos(8, 7, 0); + endSceneInit(); + gnapWalkTo(7, 8, -1, 0x107B9, 1); + platypusWalkTo(8, 8, -1, 0x107C2, 1); + } else { + initGnapPos(-1, 10, 1); + initBeaverPos(-1, 10, 0); + endSceneInit(); + gnapWalkTo(3, 7, -1, 0x107B9, 1); + platypusWalkTo(3, 8, -1, 0x107C2, 1); + } + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 20, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (_sceneClickedHotspot >= 0) + debug("_sceneClickedHotspot: %d", _sceneClickedHotspot); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene18_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, _platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSCowboyHat: + if (_gnapActionStatus == kASStandingOnHydrant) { + _gnapActionStatus = kASGrabCowboyHat; + _sceneWaiting = 0; + } else if (_gnapActionStatus < 0) { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSCowboyHat].x, _hotspotsWalkPos[kHSCowboyHat].y, 3, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(3, 2); + break; + case GRAB_CURSOR: + gnapWalkTo(_hotspotsWalkPos[kHSCowboyHat].x, _hotspotsWalkPos[kHSCowboyHat].y, 0, getGnapSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSGarbageCan: + if (_gnapActionStatus < 0) { + if (isFlag(14)) { + if (_grabCursorSpriteIndex >= 0) + playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 1, 5); + else + playGnapImpossible(0, 0); + } else { + if (isFlag(26)) + scene18_platEndPhoning(1); + if (_grabCursorSpriteIndex >= 0) { + if (!isFlag(9)) + playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), + _hotspotsWalkPos[kHSGarbageCan].y, _hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y); + else + playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 2, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (!isFlag(9)) + playGnapScratchingHead(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), _hotspotsWalkPos[kHSGarbageCan].y); + else if (!isFlag(8)) + playGnapScratchingHead(2, 4); + break; + case GRAB_CURSOR: + if (!isFlag(9)) { + gnapWalkTo(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), _hotspotsWalkPos[kHSGarbageCan].y, + -1, -1, 1); + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _s18_garbageCanPos, _gnapY) | 0x10000, 1); + _gnapActionStatus = kASGrabGarbageCanFromStreet; + } else if (!isFlag(8)) { + if (gnapWalkTo(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 0, -1, 1)) + _gnapActionStatus = kASGrabGarbageCanFromHydrant; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + } + break; + + case kHSHydrantTopValve: + if (_gnapActionStatus < 0) { + if (isFlag(10)) { + // While carrying garbage can + if (_grabCursorSpriteIndex >= 0) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + playGnapShowItem(_grabCursorSpriteIndex, 0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + playGnapScratchingHead(0, 0); + break; + case GRAB_CURSOR: + if (isFlag(8)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + _gnapActionStatus = kASPutGarbageCanOnRunningHydrant; + } else if (!isFlag(7)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + _gnapActionStatus = kASPutGarbageCanOnHydrant; + } else { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + playGnapImpossible(0, 0); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + playGnapImpossible(0, 0); + break; + } + } + } else { + if (_grabCursorSpriteIndex == kItemWrench) { + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _gnapActionStatus = kASOpenTopValve; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 1, 5); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(1, 5); + break; + case GRAB_CURSOR: + if (isFlag(7)) { + _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); + _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _gnapActionStatus = kASCloseTopValve; + } else + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + } + break; + + case kHSHydrantRightValve: + if (_gnapActionStatus < 0) { + if (isFlag(14)) { + if (_grabCursorSpriteIndex == -1) { + playGnapImpossible(0, 0); + } else { + playGnapShowCurrItem(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); + } + } else { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } + if (_grabCursorSpriteIndex == kItemWrench) { + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + if (isFlag(9)) + _gnapActionStatus = kASOpenRightValveWithGarbageCan; + else + _gnapActionStatus = kASOpenRightValveNoGarbageCan; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(1, 5); + break; + case GRAB_CURSOR: + if (isFlag(8)) { + gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); + if (isFlag(9)) + _gnapActionStatus = kASCloseRightValveWithGarbageCan; + else + _gnapActionStatus = kASCloseRightValveNoGarbageCan; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + } + break; + + case kHSExitToyStore: + if (_gnapActionStatus < 0) { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } + if (isFlag(20)) { + playGnapImpossible(0, 0); + } else { + _isLeavingScene = 1; + _newSceneNum = 19; + gnapWalkTo(_hotspotsWalkPos[kHSExitToyStore].x, _hotspotsWalkPos[kHSExitToyStore].y, 0, 0x107C0, 1); + _gnapActionStatus = kASLeaveScene; + if (!isFlag(26)) + platypusWalkTo(_hotspotsWalkPos[kHSExitToyStore].x + 1, _hotspotsWalkPos[kHSExitToyStore].y, -1, 0x107C2, 1); + } + } + break; + + case kHSExitPhoneBooth: + if (_gnapActionStatus < 0) { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } + scene18_closeHydrantValve(); + _isLeavingScene = 1; + _newSceneNum = 17; + gnapWalkTo(_hotspotsWalkPos[kHSExitPhoneBooth].x, _hotspotsWalkPos[kHSExitPhoneBooth].y, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(26)) + setFlag(27); + else + platypusWalkTo(_hotspotsWalkPos[kHSExitPhoneBooth].x + 1, _hotspotsWalkPos[kHSExitPhoneBooth].y, -1, 0x107C2, 1); + } + break; + + case kHSExitGrubCity: + if (_gnapActionStatus < 0) { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } + scene18_closeHydrantValve(); + _isLeavingScene = 1; + _newSceneNum = 20; + _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(26)) + scene18_platEndPhoning(0); + else + platypusWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y - 1, -1, 0x107CF, 1); + _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + _mouseClickState.left = false; + } + break; + + default: + if (_gnapActionStatus != kASStandingOnHydrant && _mouseClickState.left) { + if (isFlag(10)) { + scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + scene18_putDownGarbageCan(0); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + _mouseClickState.left = false; + } + break; + + } + + scene18_updateAnimations(); + + if (!isSoundPlaying(0x10940)) + playSound(0x10940, true); + + if ((isFlag(8) || isFlag(7)) && !isSoundPlaying(0x22B) && + _gnapActionStatus != kASOpenRightValveNoGarbageCanDone && _gnapActionStatus != kASOpenRightValveNoGarbageCan && + _gnapActionStatus != kASOpenTopValve && _gnapActionStatus != kASOpenTopValveDone && + _gnapActionStatus != kASOpenRightValveWithGarbageCan && _gnapActionStatus != kASOpenRightValveWithGarbageCanDone) + playSound(0x22B, true); + + if (!_isLeavingScene) { + if (!isFlag(26)) { + if (_beaverActionStatus == kASPlatComesHere) { + if (!_timers[6]) { + _beaverActionStatus = -1; + _sceneWaiting = false; + initBeaverPos(-1, 10, 0); + platypusWalkTo(3, 9, -1, 0x107C2, 1); + clearFlag(26); + } + } else { + _hotspots[kHSWalkArea1].y2 += 48; + _hotspots[kHSWalkArea2].x1 += 75; + updateBeaverIdleSequence(); + _hotspots[kHSWalkArea2].x1 -= 75; + _hotspots[kHSWalkArea1].y2 -= 48; + } + if (!_timers[5]) { + _timers[5] = getRandom(100) + 100; + if (_gnapActionStatus < 0) { + if (getRandom(2) == 1) + _gameSys->insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); + } + } + playSoundA(); + } + if (!isFlag(10)) + updateGnapIdleSequence(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene18_updateHotspots(); + } + + gameUpdateTick(); + + } + + if (isFlag(12)) + deleteSurface(&_s18_cowboyHatSurface); + +} + +void GnapEngine::scene18_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASGrabGarbageCanFromStreet: + if (_gnapIdleFacing != 7 && _gnapIdleFacing != 1) { + _gameSys->insertSequence(0x1FC, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - 675, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x1FC; + } else { + _gameSys->insertSequence(0x1FD, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - 525, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x1FD; + } + _gameSys->removeSequence(0x1FA, 19, 1); + setFlag(10); + scene18_updateHotspots(); + _gnapActionStatus = -1; + break; + case kASGrabGarbageCanFromHydrant: + _gameSys->insertSequence(0x1FE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(0x1F9, 19, 1); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x1FE; + clearFlag(9); + setFlag(10); + scene18_updateHotspots(); + _gnapActionStatus = -1; + break; + case kASCloseRightValveNoGarbageCan: + _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(0x20D, 39, 1); + _gameSys->removeSequence(0x212, 39, 1); + _gameSys->removeSequence(0x211, 39, 1); + stopSound(0x22B); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x205; + clearFlag(8); + invAdd(kItemWrench); + setGrabCursorSprite(kItemWrench); + scene18_updateHotspots(); + _gnapActionStatus = -1; + break; + case kASOpenTopValve: + setFlag(7); + scene18_updateHotspots(); + playGnapPullOutDevice(2, 7); + playGnapUseDevice(0, 0); + _gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); + _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BB, 1); + _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _gnapActionStatus = kASOpenTopValveDone; + break; + case kASOpenTopValveDone: + setGrabCursorSprite(-1); + _gameSys->insertSequence(0x208, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); + _gameSys->removeSequence(0x20C, 19, 1); + _gameSys->setAnimation(0x217, 39, 5); + _gameSys->insertSequence(0x217, 39, 0x216, 39, 10, 0, 0, 0); + while (_gameSys->getAnimationStatus(5) != 2) + gameUpdateTick(); + playSound(0x22B, true); + _gameSys->insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x208; + invRemove(kItemWrench); + setGrabCursorSprite(-1); + _gnapActionStatus = -1; + break; + case kASCloseTopValve: + _gameSys->insertSequence(0x206, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(0x20E, 39, 1); + _gameSys->removeSequence(0x216, 39, 1); + _gameSys->removeSequence(0x217, 39, 1); + stopSound(0x22B); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x206; + clearFlag(7); + invAdd(kItemWrench); + setGrabCursorSprite(kItemWrench); + scene18_updateHotspots(); + _gnapActionStatus = -1; + break; + case kASGrabCowboyHat: + _gameSys->setAnimation(0x200, _gnapId, 0); + _gameSys->insertSequence(0x200, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x200; + _gnapActionStatus = kASGrabCowboyHatDone; + break; + case kASGrabCowboyHatDone: + hideCursor(); + setGrabCursorSprite(-1); + _s18_cowboyHatSurface = addFullScreenSprite(0x1D2, 255); + _gameSys->setAnimation(0x218, 256, 0); + _gameSys->insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + _newSceneNum = 18; + invAdd(kItemCowboyHat); + invAdd(kItemWrench); + setFlag(12); + setFlag(14); + clearFlag(8); + setFlag(9); + setFlag(14); + scene18_updateHotspots(); + _gnapActionStatus = kASLeaveScene; + break; + case kASLeaveScene: + _sceneDone = true; + _gnapActionStatus = -1; + break; + case kASPutGarbageCanOnRunningHydrant: + setFlag(9); + clearFlag(10); + _gameSys->requestRemoveSequence(0x211, 39); + _gameSys->requestRemoveSequence(0x212, 39); + _gameSys->insertSequence(0x210, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + stopSound(0x22B); + _gameSys->setAnimation(0x210, _gnapId, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x210; + _gnapActionStatus = kASPutGarbageCanOnRunningHydrant2; + break; + case kASPutGarbageCanOnRunningHydrant2: + playSound(0x22B, true); + _gameSys->setAnimation(0x1FF, _gnapId, 0); + _gameSys->insertSequence(0x1FF, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x1FF; + _sceneWaiting = true; + _gnapActionStatus = kASStandingOnHydrant; + break; + case kASStandingOnHydrant: + _gameSys->setAnimation(0x1FF, _gnapId, 0); + _gameSys->insertSequence(0x1FF, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + break; + case kASOpenRightValveNoGarbageCan: + case kASOpenRightValveWithGarbageCan: + setFlag(8); + scene18_updateHotspots(); + playGnapPullOutDevice(2, 7); + playGnapUseDevice(0, 0); + _gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); + _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); + _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + if (_gnapActionStatus == kASOpenRightValveNoGarbageCan) + _gnapActionStatus = kASOpenRightValveNoGarbageCanDone; + else + _gnapActionStatus = kASOpenRightValveWithGarbageCanDone; + break; + case kASOpenRightValveWithGarbageCanDone: + setGrabCursorSprite(-1); + _gameSys->insertSequence(0x207, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); + _gameSys->requestRemoveSequence(0x1F9, 19); + _gameSys->removeSequence(0x20B, 19, 1); + _gameSys->setAnimation(0x213, 39, 5); + _gameSys->insertSequence(0x214, 39, 0x213, 39, 10, 0, 0, 0); + while (_gameSys->getAnimationStatus(5) != 2) + gameUpdateTick(); + playSound(555, true); + _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x207; + invRemove(kItemWrench); + _gnapActionStatus = -1; + break; + case kASOpenRightValveNoGarbageCanDone: + setGrabCursorSprite(-1); + _gameSys->insertSequence(0x207, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); + _gameSys->removeSequence(0x20B, 19, 1); + _gameSys->setAnimation(0x211, 39, 5); + _gameSys->insertSequence(0x212, 39, 0x211, 39, 10, 0, 0, 0); + while (_gameSys->getAnimationStatus(5) != 2) + gameUpdateTick(); + playSound(0x22B, true); + _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x207; + invRemove(kItemWrench); + _gnapActionStatus = -1; + break; + case kASCloseRightValveWithGarbageCan: + _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(0x20D, 39, 1); + _gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); + stopSound(0x22B); + _gameSys->setAnimation(0x1F9, 19, 0); + _gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); + clearFlag(8); + invAdd(kItemWrench); + setGrabCursorSprite(kItemWrench); + _gameSys->insertSequence(0x107B5, _gnapId, 517, _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + scene18_updateHotspots(); + _gnapSequenceDatNum = 1; + _gnapSequenceId = 0x7B5; + _gnapActionStatus = kASCloseRightValveWithGarbageCanDone; + break; + case kASCloseRightValveWithGarbageCanDone: + _gnapActionStatus = -1; + break; + case kASPutGarbageCanOnHydrant: + setFlag(9); + clearFlag(10); + _gameSys->insertSequence(0x20F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x20F, _gnapId, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x20F; + _gnapActionStatus = kASPutGarbageCanOnHydrantDone; + break; + case kASPutGarbageCanOnHydrantDone: + _gameSys->insertSequence(0x1F9, 19, 0x20F, _gnapId, kSeqNone, 0, 0, 0); + scene18_updateHotspots(); + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + _gameSys->setAnimation(0, 0, 3); + ++_s18_platPhoneIter; + if (_s18_platPhoneIter <= 4) { + ++_s18_platPhoneCtr; + _s18_nextPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr % 5]; + _gameSys->setAnimation(_s18_nextPhoneSequenceId, 254, 3); + _gameSys->insertSequence(_s18_nextPhoneSequenceId, 254, _s18_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); + _s18_currPhoneSequenceId = _s18_nextPhoneSequenceId; + } else { + scene18_platEndPhoning(1); + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp new file mode 100644 index 0000000000..ebfdd728a1 --- /dev/null +++ b/engines/gnap/scenes/scene19.cpp @@ -0,0 +1,470 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +static const int kS19ShopAssistantSequenceIds[] = { + 0x6F, 0x70, 0x71, 0x72, 0x73 +}; + +enum { + kHSPlatypus = 0, + kHSExitOutsideToyStore = 1, + kHSDevice = 2, + kHSPicture = 3, + kHSShopAssistant = 4, + kHSToy1 = 5, + kHSToy2 = 6, + kHSToy3 = 7, + kHSPhone = 8, + kHSToy4 = 9, + kHSToy5 = 10, + kHSToy6 = 11, + kHSToy7 = 12, + kHSWalkArea1 = 13, + kHSWalkArea2 = 14, + kHSWalkArea3 = 15 +}; + +enum { + kASUsePhone = 0, + kASGrabToy = 1, + kASGrabPicture = 2, + kASGrabPictureDone = 3, + kASTalkShopAssistant = 4, + kASLeaveScene = 5 +}; + +int GnapEngine::scene19_init() { + playSound(0x79, 0); + return isFlag(26) ? 0x77 : 0x76; +} + +void GnapEngine::scene19_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitOutsideToyStore, 36, 154, 142, 338, SF_EXIT_NW_CURSOR, 4, 6); + setHotspot(kHSPicture, 471, 237, 525, 283, SF_DISABLED, 7, 2); + setHotspot(kHSShopAssistant, 411, 151, 575, 279, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + setHotspot(kHSPhone, 647, 166, 693, 234, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + setHotspot(kHSToy1, 181, 11, 319, 149, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 0); + setHotspot(kHSToy2, 284, 85, 611, 216, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 0); + setHotspot(kHSToy3, 666, 38, 755, 154, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + setHotspot(kHSToy4, 154, 206, 285, 327, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 3); + setHotspot(kHSToy5, 494, 301, 570, 448, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 5); + setHotspot(kHSToy6, 0, 320, 188, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + setHotspot(kHSToy7, 597, 434, 800, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 8); + setHotspot(kHSWalkArea1, 0, 0, 170, 600); + setHotspot(kHSWalkArea2, 622, 0, 800, 600); + setHotspot(kHSWalkArea3, 0, 0, 800, 437); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(26)) { + _hotspots[kHSToy1].flags = SF_DISABLED; + _hotspots[kHSToy2].flags = SF_DISABLED; + _hotspots[kHSToy3].flags = SF_DISABLED; + _hotspots[kHSToy4].flags = SF_DISABLED; + _hotspots[kHSToy5].flags = SF_DISABLED; + _hotspots[kHSToy6].flags = SF_DISABLED; + _hotspots[kHSToy7].flags = SF_DISABLED; + _hotspots[kHSShopAssistant].flags = SF_DISABLED; + _hotspots[kHSPhone].flags = SF_DISABLED; + _hotspots[kHSPlatypus].flags = SF_DISABLED; + _hotspots[kHSPicture].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + } + _hotspotsCount = 16; +} + +void GnapEngine::scene19_run() { + + queueInsertDeviceIcon(); + + _s19_toyGrabCtr = 0; + _s19_pictureSurface = 0; + + _gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); + + if (!isFlag(20)) + _gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(26)) { + initGnapPos(3, 6, 1); + _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[getRandom(5)]; + _s19_nextShopAssistantSequenceId = _s19_currShopAssistantSequenceId; + _gameSys->setAnimation(_s19_currShopAssistantSequenceId, 20, 4); + _gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _s19_shopAssistantCtr = 0; + endSceneInit(); + gnapWalkTo(4, 9, -1, 0x107B9, 1); + scene19_updateHotspots(); + } else { + _s19_currShopAssistantSequenceId = 0x6D; + _s19_nextShopAssistantSequenceId = -1; + _gameSys->setAnimation(0x6D, 20, 4); + _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _timers[6] = getRandom(40) + 50; + initGnapPos(3, 6, 1); + initBeaverPos(4, 6, 0); + endSceneInit(); + gnapWalkTo(4, 9, -1, 0x107B9, 1); + platypusWalkTo(5, 9, -1, 0x107C2, 1); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 5, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene19_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitOutsideToyStore: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 18; + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107B2, 1); + _gnapActionStatus = kASLeaveScene; + if (isFlag(26)) + setFlag(27); + else + platypusWalkTo(_hotspotsWalkPos[1].x + 1, _hotspotsWalkPos[1].y, -1, 0x107C5, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + } + break; + + case kHSPicture: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 6, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 2); + break; + case GRAB_CURSOR: + if (!isFlag(20)) { + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y) | 0x10000, 1); + _gnapActionStatus = kASGrabPicture; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSShopAssistant: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 6, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 2); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkShopAssistant; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSToy1: + case kHSToy2: + case kHSToy3: + case kHSToy4: + case kHSToy5: + case kHSToy6: + case kHSToy7: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); + break; + case GRAB_CURSOR: + gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, -1, 1); + playGnapIdle(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); + _gnapActionStatus = kASGrabToy; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSPhone: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 9, 1); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(9, 1); + break; + case GRAB_CURSOR: + gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, -1, 1); + playGnapIdle(8, 2); + _gnapActionStatus = kASUsePhone; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = 0; + } + } + + scene19_updateAnimations(); + + if (!_isLeavingScene) { + updateGnapIdleSequence(); + if (!isFlag(26)) { + updateBeaverIdleSequence(); + if (!_timers[6] && _s19_nextShopAssistantSequenceId == -1) { + _timers[6] = getRandom(40) + 50; + if (getRandom(4) != 0) { + _s19_nextShopAssistantSequenceId = 0x64; + } else if (isFlag(20)) { + _s19_nextShopAssistantSequenceId = 0x64; + } else { + _s19_nextShopAssistantSequenceId = 0x6C; + } + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene19_updateHotspots(); + } + + gameUpdateTick(); + + } + + if (_s19_pictureSurface) + deleteSurface(&_s19_pictureSurface); + +} + +void GnapEngine::scene19_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASUsePhone: + _s19_nextShopAssistantSequenceId = 0x67; + break; + case kASGrabToy: + ++_s19_toyGrabCtr; + switch (_s19_toyGrabCtr) { + case 1: + _s19_nextShopAssistantSequenceId = 0x62; + break; + case 2: + _s19_nextShopAssistantSequenceId = 0x6B; + break; + case 3: + _s19_nextShopAssistantSequenceId = 0x66; + break; + default: + _s19_nextShopAssistantSequenceId = 0x65; + break; + } + break; + case kASGrabPicture: + playGnapPullOutDevice(6, 2); + playGnapUseDevice(0, 0); + _gameSys->setAnimation(0x68, 19, 0); + _gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); + invAdd(kItemPicture); + setFlag(20); + scene19_updateHotspots(); + _gnapActionStatus = kASGrabPictureDone; + break; + case kASGrabPictureDone: + setGrabCursorSprite(-1); + hideCursor(); + _s19_pictureSurface = addFullScreenSprite(0xF, 255); + _gameSys->setAnimation(0x61, 256, 0); + _gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) { + // checkGameAppStatus(); + gameUpdateTick(); + } + setFlag(27); + showCursor(); + _newSceneNum = 17; + _isLeavingScene = true; + _sceneDone = true; + _s19_nextShopAssistantSequenceId = -1; + break; + case kASTalkShopAssistant: + _s19_nextShopAssistantSequenceId = 0x6D; + _gnapActionStatus = -1; + break; + case kASLeaveScene: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(4) == 2) { + switch (_s19_nextShopAssistantSequenceId) { + case 0x6F: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + _s19_shopAssistantCtr = (_s19_shopAssistantCtr + 1) % 5; + _s19_nextShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_s19_shopAssistantCtr]; + _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); + _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; + break; + case 0x62: + case 0x66: + case 0x6B: + _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; + _s19_nextShopAssistantSequenceId = -1; + _timers[5] = 10; + while (_timers[5]) { + gameUpdateTick(); + } + playGnapIdle(6, 2); + _gnapActionStatus = -1; + break; + case 0x67: + _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; + _s19_nextShopAssistantSequenceId = -1; + _gnapActionStatus = -1; + break; + case 0x65: + playGnapIdle(6, 2); + _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 0); + _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; + _s19_nextShopAssistantSequenceId = -1; + _newSceneNum = 18; + _gnapActionStatus = kASLeaveScene; + break; + case 0x6D: + _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, getSequenceTotalDuration(_s19_nextShopAssistantSequenceId), 0, 0); + _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; + _s19_nextShopAssistantSequenceId = -1; + break; + case 0x64: + case 0x6C: + _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; + _s19_nextShopAssistantSequenceId = -1; + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp new file mode 100644 index 0000000000..136f234bce --- /dev/null +++ b/engines/gnap/scenes/scene20.cpp @@ -0,0 +1,736 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSGroceryStoreHat = 1, + kHSExitParkingLot = 2, + kHSStonerGuy = 3, + kHSGroceryStoreGuy = 4, + kHSDevice = 5, + kHSExitInsideGrubCity = 6, + kHSExitOutsideCircusWorld = 7, + kHSExitOutsideToyStore = 8, + kHSExitPhone = 9, + kHSWalkArea1 = 10, + kHSWalkArea2 = 11 +}; + +enum { + kASLeaveScene = 0, + kASTalkStonerGuyNoJoint = 2, + kASTalkStonerGuyHasJoint = 3, + kASGrabJoint = 4, + kASActionDone = 5, + kASTalkGroceryStoreGuy = 6, + kASGrabGroceryStoreGuy = 9, + kASGrabGroceryStoreHat = 10, + kASSwitchGroceryStoreHat = 11, + kASSwitchGroceryStoreHatDone = 12, + kASGrabJointDone = 13 +}; + +int GnapEngine::scene20_init() { + return 0x186; +} + +void GnapEngine::scene20_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSGroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); + setHotspot(kHSExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + setHotspot(kHSStonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + setHotspot(kHSGroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + setHotspot(kHSExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); + setHotspot(kHSExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); + setHotspot(kHSExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); + setHotspot(kHSExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + setHotspot(kHSWalkArea1, 0, 0, 800, 468); + setHotspot(kHSWalkArea2, 605, 0, 800, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 12; +} + +void GnapEngine::scene20_updateAnimationsCb() { + + if (_gameSys->getAnimationStatus(2) == 2) { + switch (_s20_nextStonerGuySequenceId) { + case 0x16B: + if (!_timers[4]) { + _s20_stonerGuyShowingJoint = false; + _gameSys->insertSequence(0x16B, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s20_currStonerGuySequenceId = 0x16B; + _s20_nextStonerGuySequenceId = -1; + } + break; + case 0x16A: + // Grab joint + playGnapPullOutDevice(4, 4); + playGnapUseDevice(0, 0); + _gameSys->setAnimation(0x16A, 21, 0); + _gameSys->insertSequence(0x16A, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s20_currStonerGuySequenceId = 0x16A; + _s20_nextStonerGuySequenceId = -1; + invAdd(kItemJoint); + setFlag(17); + _s20_stonerGuyShowingJoint = false; + _gnapActionStatus = kASGrabJointDone; + break; + case 0x16E: + _gameSys->setAnimation(0x16E, 21, 2); + _gameSys->insertSequence(0x16E, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s20_currStonerGuySequenceId = 0x16E; + _s20_nextStonerGuySequenceId = -1; + _s20_nextGroceryStoreGuySequenceId = 0x175; + break; + case 0x16D: + _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 0); + _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; + _s20_nextStonerGuySequenceId = -1; + _gnapActionStatus = kASActionDone; + break; + case 0x16F: + _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _gameSys->setAnimation(0x17A, 20, 3); + _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x17A, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s20_currGroceryStoreGuySequenceId = 0x17A; + _s20_nextGroceryStoreGuySequenceId = -1; + _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; + _s20_nextStonerGuySequenceId = -1; + break; + case 0x171: + _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; + switch (_s20_stonerGuyCtr) { + case 1: + _s20_nextStonerGuySequenceId = 0x171; + break; + case 2: + _s20_nextStonerGuySequenceId = 0x172; + break; + case 3: + _s20_nextStonerGuySequenceId = 0x173; + break; + default: + _s20_nextStonerGuySequenceId = 0x171; + break; + } + _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x17C, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x17C, 20, 3); + _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _s20_currGroceryStoreGuySequenceId = 0x17C; + _s20_nextGroceryStoreGuySequenceId = -1; + _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; + _s20_nextStonerGuySequenceId = -1; + break; + default: + _s20_nextStonerGuySequenceId = 0x16C; + _gameSys->setAnimation(0x16C, 21, 2); + _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; + _s20_nextStonerGuySequenceId = -1; + break; + } + } + +} + +void GnapEngine::scene20_stopSounds() { + stopSound(0x18E); + stopSound(0x18F); + stopSound(0x190); + stopSound(0x191); + stopSound(0x194); + stopSound(0x195); + stopSound(0x192); + stopSound(0x193); + stopSound(0x196); + stopSound(0x197); + stopSound(0x198); + stopSound(0x199); + stopSound(0x19A); +} + +void GnapEngine::scene20_run() { + + playSound(0x10940, 1); + + startSoundTimerA(8); + + _s20_stonerGuyShowingJoint = false; + _timers[7] = getRandom(100) + 100; + + _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; + switch (_s20_stonerGuyCtr) { + case 1: + _s20_currStonerGuySequenceId = 0x171; + break; + case 2: + _s20_currStonerGuySequenceId = 0x172; + break; + case 3: + _s20_currStonerGuySequenceId = 0x173; + break; + } + + _s20_nextStonerGuySequenceId = -1; + _gameSys->setAnimation(_s20_currStonerGuySequenceId, 21, 2); + _gameSys->insertSequence(_s20_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + + _timers[6] = getRandom(20) + 30; + + _s20_currGroceryStoreGuySequenceId = 0x17C; + _s20_nextGroceryStoreGuySequenceId = -1; + _gameSys->setAnimation(0x17C, 20, 3); + _gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); + + _timers[5] = getRandom(50) + 130; + if (isFlag(19)) + _gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + if (isFlag(11)) { + clearFlag(11); + endSceneInit(); + _gameSys->setAnimation(0x182, 140, 0); + _gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) { + // checkGameAppStatus(); + gameUpdateTick(); + } + initGnapPos(11, 8, 3); + initBeaverPos(11, 9, 4); + gnapWalkTo(5, 8, -1, 0x107BA, 1); + platypusWalkTo(6, 9, -1, 0x107C2, 1); + } else { + switch (_prevSceneNum) { + case 17: + initGnapPos(5, 11, 1); + initBeaverPos(6, 11, 0); + endSceneInit(); + gnapWalkTo(5, 8, -1, 0x107B9, 1); + platypusWalkTo(6, 9, -1, 0x107C2, 1); + break; + case 18: + initGnapPos(11, 8, 3); + initBeaverPos(11, 9, 4); + endSceneInit(); + gnapWalkTo(5, 8, -1, 0x107BA, 1); + platypusWalkTo(6, 9, -1, 0x107C2, 1); + break; + case 21: + initGnapPos(-1, 8, 3); + initBeaverPos(-1, 9, 4); + endSceneInit(); + gnapWalkTo(3, 8, -1, 0x107B9, 1); + platypusWalkTo(3, 9, -1, 0x107C2, 1); + break; + case 22: + initGnapPos(7, 6, 1); + initBeaverPos(8, 6, 0); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107B9, 1); + platypusWalkTo(9, 9, -1, 0x107C2, 1); + break; + default: + initGnapPos(8, 6, 3); + initBeaverPos(9, 6, 4); + endSceneInit(); + _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + gnapWalkTo(8, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 9, -1, 0x107C2, 1); + _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + break; + } + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + testWalk(0, 1, 7, 9, 8, 9); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene20_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(20); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitParkingLot: + if (_gnapActionStatus < 0) { + if (_s20_stonerGuyShowingJoint) + _timers[4] = 0; + _isLeavingScene = 1; + _newSceneNum = 21; + gnapWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); + _beaverFacing = 4; + } + break; + + case kHSExitPhone: + if (_gnapActionStatus < 0) { + if (_s20_stonerGuyShowingJoint) + _timers[4] = 0; + _isLeavingScene = 1; + _newSceneNum = 17; + gnapWalkTo(_hotspotsWalkPos[kHSExitPhone].x, _hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitPhone].x + 1, _hotspotsWalkPos[kHSExitPhone].y, -1, 0x107C2, 1); + } + break; + + case kHSExitOutsideToyStore: + if (_gnapActionStatus < 0) { + if (_s20_stonerGuyShowingJoint) + _timers[4] = 0; + _isLeavingScene = 1; + _newSceneNum = 18; + _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); + _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + } + break; + + case kHSExitInsideGrubCity: + if (_gnapActionStatus < 0) { + if (_s20_stonerGuyShowingJoint) + _timers[4] = 0; + _isLeavingScene = 1; + _newSceneNum = 22; + gnapWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x, _hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); + _beaverFacing = 4; + } + break; + + case kHSExitOutsideCircusWorld: + if (_gnapActionStatus < 0) { + if (_s20_stonerGuyShowingJoint) + _timers[4] = 0; + _isLeavingScene = 1; + _newSceneNum = 24; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHSStonerGuy: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 5, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(5, 4); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + if (_s20_stonerGuyShowingJoint) + _gnapActionStatus = kASGrabJoint; + else + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + if (isFlag(17)) + _gnapActionStatus = kASTalkStonerGuyNoJoint; + else + _gnapActionStatus = kASTalkStonerGuyHasJoint; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSGroceryStoreGuy: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 2, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(2, 3); + break; + case GRAB_CURSOR: + _s20_stonerGuyShowingJoint = false; + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGrabGroceryStoreGuy; + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkGroceryStoreGuy; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSGroceryStoreHat: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemCowboyHat) { + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreHat].x, _hotspotsWalkPos[kHSGroceryStoreHat].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASSwitchGroceryStoreHat; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSGroceryStoreHat].x, _hotspotsWalkPos[kHSGroceryStoreHat].y, 1, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(1, 6); + break; + case GRAB_CURSOR: + _s20_stonerGuyShowingJoint = false; + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGrabGroceryStoreHat; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene20_updateAnimations(); + + if (!isSoundPlaying(0x10940)) + playSound(0x10940, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) { + _hotspots[kHSWalkArea1].y2 += 48; + updateBeaverIdleSequence(); + _hotspots[kHSWalkArea1].y2 -= 48; + } + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (_gnapActionStatus < 0 && !_timers[5] && _s20_nextGroceryStoreGuySequenceId == -1) { + _timers[5] = getRandom(50) + 130; + if (getRandom(4) != 0) + _s20_nextGroceryStoreGuySequenceId = 0x17C; + else + _s20_nextGroceryStoreGuySequenceId = 0x17A; + } + if (!_timers[7]) { + _timers[7] = getRandom(100) + 100; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + switch (getRandom(3)) { + case 0: + _gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + playSoundA(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene20_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene20_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + break; + case kASTalkStonerGuyNoJoint: + _gameSys->setAnimation(0x170, 21, 2); + _gameSys->setAnimation(0x17B, 20, 3); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + stopSound(0x1A1); + scene20_stopSounds(); + _s20_currGroceryStoreGuySequenceId = 0x17B; + _s20_currStonerGuySequenceId = 0x170; + _s20_nextGroceryStoreGuySequenceId = -1; + _s20_nextStonerGuySequenceId = 0x16E; + _timers[5] = 100; + _timers[6] = 100; + break; + case kASTalkStonerGuyHasJoint: + _gameSys->setAnimation(0x168, 21, 2); + _gameSys->setAnimation(379, 20, 3); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); + stopSound(0x1A1); + scene20_stopSounds(); + _s20_currGroceryStoreGuySequenceId = 0x17B; + _s20_currStonerGuySequenceId = 0x168; + _s20_nextGroceryStoreGuySequenceId = -1; + _s20_nextStonerGuySequenceId = 0x16B; + _timers[5] = 200; + _timers[6] = 200; + _timers[4] = 100; + _s20_stonerGuyShowingJoint = true; + _gnapActionStatus = -1; + break; + case kASGrabJoint: + _s20_nextStonerGuySequenceId = 0x16A; + break; + case kASActionDone: + _gnapActionStatus = -1; + break; + case kASTalkGroceryStoreGuy: + _gameSys->setAnimation(0x170, 21, 2); + _gameSys->setAnimation(0x17B, 20, 3); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + stopSound(0x1A1); + scene20_stopSounds(); + _s20_currGroceryStoreGuySequenceId = 0x17B; + _s20_currStonerGuySequenceId = 0x170; + _s20_groceryStoreGuyCtr = (_s20_groceryStoreGuyCtr + 1) % 2; + if (_s20_groceryStoreGuyCtr != 0) + _s20_nextGroceryStoreGuySequenceId = 0x176; + else + _s20_nextGroceryStoreGuySequenceId = 0x177; + _timers[5] = 100; + _timers[6] = 100; + break; + case kASGrabGroceryStoreGuy: + _gameSys->setAnimation(0x170, 21, 2); + _gameSys->setAnimation(0x17B, 20, 3); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); + stopSound(0x1A1); + scene20_stopSounds(); + _s20_currGroceryStoreGuySequenceId = 0x17B; + _s20_currStonerGuySequenceId = 0x170; + _timers[5] = 120; + _timers[6] = 120; + _s20_nextGroceryStoreGuySequenceId = 0x178; + break; + case kASGrabGroceryStoreHat: + _gameSys->setAnimation(0x170, 21, 2); + _gameSys->setAnimation(0x17B, 20, 3); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + stopSound(0x1A1); + scene20_stopSounds(); + _s20_currGroceryStoreGuySequenceId = 0x17B; + _s20_currStonerGuySequenceId = 0x170; + _s20_nextGroceryStoreGuySequenceId = 0x179; + break; + case kASSwitchGroceryStoreHat: + setGrabCursorSprite(-1); + _gameSys->setAnimation(0x180, _gnapId, 0); + _gameSys->insertSequence(0x180, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x180; + _gnapSequenceDatNum = 0; + invRemove(kItemCowboyHat); + invAdd(kItemGroceryStoreHat); + _gnapActionStatus = kASSwitchGroceryStoreHatDone; + break; + case kASSwitchGroceryStoreHatDone: + _gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); + setFlag(19); + hideCursor(); + setGrabCursorSprite(-1); + addFullScreenSprite(0x12C, 255); + _gameSys->setAnimation(0x181, 256, 0); + _gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + removeFullScreenSprite(); + showCursor(); + setGrabCursorSprite(kItemGroceryStoreHat); + _gnapIdleFacing = 1; + gnapWalkTo(3, 8, -1, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = -1; + break; + case kASGrabJointDone: + setGrabCursorSprite(kItemJoint); + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_s20_nextGroceryStoreGuySequenceId) { + case 0x176: + case 0x177: + _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; + _s20_nextGroceryStoreGuySequenceId = -1; + _s20_nextStonerGuySequenceId = 0x16D; + break; + case 0x178: + _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _gameSys->setAnimation(0x17D, _gnapId, 0); + _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x17D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x17D; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASActionDone; + _gameSys->setAnimation(0x16D, 21, 2); + _gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s20_currStonerGuySequenceId = 0x16D; + _s20_currGroceryStoreGuySequenceId = 0x178; + _s20_nextGroceryStoreGuySequenceId = -1; + _s20_nextStonerGuySequenceId = -1; + break; + case 0x179: + _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _gameSys->setAnimation(0x16D, 21, 0); + _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x17E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x17E; + _gnapSequenceDatNum = 0; + _gnapActionStatus = kASActionDone; + _gameSys->setAnimation(0x16D, 21, 2); + _gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s20_currStonerGuySequenceId = 0x16D; + _s20_currGroceryStoreGuySequenceId = 377; + _s20_nextGroceryStoreGuySequenceId = -1; + _s20_nextStonerGuySequenceId = -1; + gnapWalkTo(4, 8, -1, 0x107BB, 1); + break; + case 0x17C: + _gameSys->setAnimation(0, 0, 3); + _s20_nextStonerGuySequenceId = 0x171; + break; + case 0x17A: + _gameSys->setAnimation(0, 0, 3); + _s20_nextStonerGuySequenceId = 0x16F; + break; + case 0x175: + _gameSys->setAnimation(0x175, 20, 0); + _gameSys->setAnimation(0x175, 20, 3); + _gameSys->insertSequence(0x175, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s20_currGroceryStoreGuySequenceId = 0x175; + _s20_nextGroceryStoreGuySequenceId = -1; + _gnapActionStatus = kASActionDone; + break; + default: + if (_s20_nextGroceryStoreGuySequenceId != -1) { + _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; + _s20_nextGroceryStoreGuySequenceId = -1; + } + break; + } + } + + scene20_updateAnimationsCb(); + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp new file mode 100644 index 0000000000..56da904ce1 --- /dev/null +++ b/engines/gnap/scenes/scene21.cpp @@ -0,0 +1,345 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSBanana = 1, + kHSOldLady = 2, + kHSDevice = 3, + kHSExitOutsideGrubCity = 4, + kHSWalkArea1 = 5, + kHSWalkArea2 = 6 +}; + +enum { + kASTalkOldLady = 0, + kASGrabBanana = 1, + kASGrabBananaDone = 2, + kASGrabOldLady = 3, + kASUseHatWithOldLady = 4, + kASUseHatWithOldLadyDone = 5, + kASLeaveScene = 6 +}; + +int GnapEngine::scene21_init() { + _gameSys->setAnimation(0, 0, 3); + return isFlag(3) ? 0x94 : 0x93; +} + +void GnapEngine::scene21_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSBanana, 94, 394, 146, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 6); + setHotspot(kHSOldLady, 402, 220, 528, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + setHotspot(kHSExitOutsideGrubCity, 522, 498, 800, 600, SF_EXIT_SE_CURSOR | SF_WALKABLE, 5, 10); + setHotspot(kHSWalkArea1, 0, 0, 800, 440); + setHotspot(kHSWalkArea2, 698, 0, 800, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(4) || !isFlag(3)) + _hotspots[kHSBanana].flags = SF_WALKABLE | SF_DISABLED; + if (isFlag(3)) + _hotspots[kHSOldLady].flags = SF_DISABLED; + _hotspotsCount = 7; +} + +void GnapEngine::scene21_run() { + + playSound(0x10940, 1); + startSoundTimerA(6); + + _timers[5] = getRandom(100) + 100; + + queueInsertDeviceIcon(); + + if (isFlag(3)) { + if (isFlag(5)) { + initGnapPos(5, 8, 1); + initBeaverPos(6, 8, 0); + _gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); + if (!isFlag(4)) + _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + clearFlag(5); + } else { + initGnapPos(5, 11, 1); + initBeaverPos(6, 11, 0); + if (!isFlag(4)) + _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + gnapWalkTo(5, 8, -1, 0x107B9, 1); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + } else { + initGnapPos(5, 11, 1); + initBeaverPos(6, 11, 0); + _s21_currOldLadySequenceId = 0x89; + _gameSys->setAnimation(0x89, 79, 3); + _gameSys->insertSequence(_s21_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); + _s21_nextOldLadySequenceId = -1; + _timers[4] = getRandom(30) + 50; + endSceneInit(); + gnapWalkTo(5, 8, -1, 0x107B9, 1); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene21_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSBanana: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, 2, 5); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(2, 5); + break; + case GRAB_CURSOR: + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBanana].x, _hotspotsWalkPos[kHSBanana].y) | 0x10000, 1); + playGnapPullOutDevice(2, 5); + playGnapUseDevice(0, 0); + _gnapActionStatus = kASGrabBanana; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + break; + } + } + } + break; + + case kHSOldLady: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemGroceryStoreHat) { + _newSceneNum = 47; + gnapWalkTo(4, 6, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASUseHatWithOldLady; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(4, 6, 7, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(7, 4); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 5; + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(7, 6, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASGrabOldLady; + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSOldLady].x, _hotspotsWalkPos[kHSOldLady].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkOldLady; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitOutsideGrubCity: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 20; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107B3, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene21_updateAnimations(); + + if (!isSoundPlaying(0x10940)) + playSound(0x10940, 1); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!isFlag(3) && !_timers[4] && _s21_nextOldLadySequenceId == -1 && _gnapActionStatus == -1) { + _timers[4] = getRandom(30) + 50; + switch (getRandom(5)) { + case 0: + _s21_nextOldLadySequenceId = 0x88; + break; + case 1: + _s21_nextOldLadySequenceId = 0x8A; + break; + default: + _s21_nextOldLadySequenceId = 0x89; + break; + } + } + if (!_timers[5]) { + _timers[5] = getRandom(100) + 100; + _gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); + } + playSoundA(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene21_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene21_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASTalkOldLady: + _s21_nextOldLadySequenceId = 0x8B; + _gnapActionStatus = -1; + break; + case kASGrabBanana: + _gameSys->setAnimation(0x8C, 59, 0); + _gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); + setFlag(4); + invAdd(kItemBanana); + scene21_updateHotspots(); + _gnapActionStatus = kASGrabBananaDone; + break; + case kASGrabBananaDone: + setGrabCursorSprite(kItemBanana); + _gnapActionStatus = -1; + break; + case kASGrabOldLady: + _timers[4] = getRandom(30) + 50; + _s21_nextOldLadySequenceId = 0x87; + break; + case kASUseHatWithOldLady: + _gameSys->setAnimation(0x8F, _gnapId, 0); + _gameSys->insertSequence(0x8F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x8F; + _gnapActionStatus = kASUseHatWithOldLadyDone; + invAdd(kItemTickets); + invRemove(kItemGroceryStoreHat); + setGrabCursorSprite(-1); + break; + case kASUseHatWithOldLadyDone: + _s21_nextOldLadySequenceId = 0x91; + break; + case kASLeaveScene: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2 && _s21_nextOldLadySequenceId != -1) { + if (_s21_nextOldLadySequenceId == 0x87) { + _gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); + _gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x86, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x86; + _gnapSequenceDatNum = 0; + _gnapActionStatus = -1; + _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; + _s21_nextOldLadySequenceId = -1; + } else if (_s21_nextOldLadySequenceId == 0x91) { + _gameSys->setAnimation(0x91, 79, 0); + _gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = kASLeaveScene; + _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; + _s21_nextOldLadySequenceId = -1; + } else { + _gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); + _gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; + _s21_nextOldLadySequenceId = -1; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp new file mode 100644 index 0000000000..0290666daa --- /dev/null +++ b/engines/gnap/scenes/scene22.cpp @@ -0,0 +1,294 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitOutsideGrubCity = 1, + kHSExitBackGrubCity = 2, + kHSCashier = 3, + kHSDevice = 4, + kHSWalkArea1 = 5, + kHSWalkArea2 = 6 +}; + +enum { + kASLeaveScene = 0, + kASTalkCashier = 1 +}; + +int GnapEngine::scene22_init() { + return 0x5E; +} + +void GnapEngine::scene22_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitOutsideGrubCity, 0, 180, 184, 472, SF_EXIT_L_CURSOR, 3, 6); + setHotspot(kHSExitBackGrubCity, 785, 405, 800, 585, SF_EXIT_R_CURSOR, 11, 9); + setHotspot(kHSCashier, 578, 230, 660, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + setHotspot(kHSWalkArea1, 553, 0, 800, 542); + setHotspot(kHSWalkArea2, 0, 0, 552, 488); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 7; +} + +void GnapEngine::scene22_run() { + + _gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); + + _s22_currCashierSequenceId = 0x59; + _s22_nextCashierSequenceId = -1; + + _gameSys->setAnimation(0x59, 1, 3); + _gameSys->insertSequence(_s22_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _timers[6] = getRandom(30) + 20; + + queueInsertDeviceIcon(); + + if (_prevSceneNum == 20) { + initGnapPos(2, 8, 1); + initBeaverPos(1, 8, 0); + endSceneInit(); + } else { + initGnapPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y, 1); + initBeaverPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, 0); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107B9, 1); + platypusWalkTo(9, 8, -1, 0x107C2, 1); + } + + if (isFlag(11)) { + int storeDetectiveSeqId; + setGrabCursorSprite(-1); + invRemove(kItemCereals); + if (_s22_caughtBefore) { + switch (getRandom(3)) { + case 0: + storeDetectiveSeqId = 0x55; + break; + case 1: + storeDetectiveSeqId = 0x56; + break; + case 2: + storeDetectiveSeqId = 0x57; + break; + } + } else { + _s22_caughtBefore = true; + storeDetectiveSeqId = 0x54; + } + _gameSys->waitForUpdate(); + _gameSys->requestClear1(); + _gameSys->drawSpriteToBackground(0, 0, 0x44); + _gameSys->setAnimation(storeDetectiveSeqId, 256, 4); + _gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(4) != 2) { + gameUpdateTick(); + } + _sceneDone = true; + _newSceneNum = 20; + _s22_caughtBefore = true; + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene22_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitOutsideGrubCity: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 20; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); + } + break; + + case kHSExitBackGrubCity: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 23; + gnapWalkTo(_hotspotsWalkPos[kHSExitBackGrubCity].x, _hotspotsWalkPos[kHSExitBackGrubCity].y, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitBackGrubCity].x, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, -1, 0x107C2, 1); + } + break; + + case kHSCashier: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSCashier].x, _hotspotsWalkPos[kHSCashier].y, 8, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(8, 4); + break; + case GRAB_CURSOR: + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSCashier].x, _hotspotsWalkPos[kHSCashier].y, + 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkCashier; + break; + case PLAT_CURSOR: + gnapUseDeviceOnBeaver(); + break; + } + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene22_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[6] && _s22_nextCashierSequenceId == -1) { + _timers[6] = getRandom(30) + 20; + if (getRandom(8) != 0) { + _s22_nextCashierSequenceId = 0x59; + } else { + _s22_cashierCtr = (_s22_cashierCtr + 1) % 3; + switch (_s22_cashierCtr) { + case 1: + _s22_nextCashierSequenceId = 0x58; + break; + case 2: + _s22_nextCashierSequenceId = 0x5A; + break; + case 3: + _s22_nextCashierSequenceId = 0x5B; + break; + default: + _s22_nextCashierSequenceId = 0x58; + break; + } + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene22_updateHotspots(); + _timers[2] = getRandom(30) + 20; + _timers[3] = 400; + _timers[1] = getRandom(20) + 30; + _timers[0] = getRandom(75) + 75; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene22_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLeaveScene: + _sceneDone = true; + break; + case kASTalkCashier: + _s22_nextCashierSequenceId = 0x5C; + break; + } + _gnapActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(3) == 2 && _s22_nextCashierSequenceId != -1) { + _gameSys->setAnimation(_s22_nextCashierSequenceId, 1, 3); + _gameSys->insertSequence(_s22_nextCashierSequenceId, 1, _s22_currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _s22_currCashierSequenceId = _s22_nextCashierSequenceId; + _s22_nextCashierSequenceId = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp new file mode 100644 index 0000000000..cafeb71a56 --- /dev/null +++ b/engines/gnap/scenes/scene23.cpp @@ -0,0 +1,297 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitFrontGrubCity = 1, + kHSDevice = 2, + kHSCereals = 3, + kHSWalkArea1 = 4, + kHSWalkArea2 = 5 +}; + +enum { + kASLookCereals = 0, + kASGrabCereals = 1, + kASGrabCerealsDone = 2, + kASLeaveScene = 3 +}; + +int GnapEngine::scene23_init() { + return 0xC0; +} + +void GnapEngine::scene23_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitFrontGrubCity, 0, 250, 15, 550, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + setHotspot(kHSCereals, 366, 332, 414, 408, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + setHotspot(kHSWalkArea1, 0, 0, 340, 460); + setHotspot(kHSWalkArea2, 340, 0, 800, 501); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 6; +} + +void GnapEngine::scene23_run() { + + _timers[4] = getRandom(100) + 200; + _timers[5] = getRandom(100) + 200; + + _s23_currStoreClerkSequenceId = 0xB4; + _s23_nextStoreClerkSequenceId = -1; + + _gameSys->setAnimation(0xB4, 1, 4); + _gameSys->insertSequence(_s23_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + queueInsertDeviceIcon(); + + initGnapPos(-1, 7, 1); + initBeaverPos(-2, 7, 0); + _gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + + platypusWalkTo(1, 7, -1, 0x107C2, 1); + + if (isFlag(24)) { + gnapWalkTo(2, 7, -1, 0x107B9, 1); + } else { + gnapWalkTo(2, 7, 0, 0x107B9, 1); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + playSequences(0x48, 0xBA, 0xBB, 0xBC); + setFlag(24); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 3, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene23_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSCereals: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, 5, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(11)) + playGnapMoan2(0, 0); + else { + gnapWalkTo(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, + 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASLookCereals; + } + break; + case GRAB_CURSOR: + if (isFlag(11)) + playGnapImpossible(0, 0); + else { + _gnapIdleFacing = 1; + gnapWalkTo(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, + 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + setFlag(11); + _gnapActionStatus = kASGrabCereals; + invAdd(kItemCereals); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitFrontGrubCity: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 22; + gnapWalkTo(_hotspotsWalkPos[kHSExitFrontGrubCity].x, _hotspotsWalkPos[kHSExitFrontGrubCity].y, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitFrontGrubCity].x, _hotspotsWalkPos[kHSExitFrontGrubCity].y - 1, -1, 0x107C2, 1); + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene23_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4] && _gnapActionStatus == -1) { + _timers[4] = getRandom(100) + 200; + switch (getRandom(4)) { + case 0: + _gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + case 3: + _gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + if (!_timers[5]) { + _timers[5] = getRandom(100) + 200; + switch (getRandom(3)) { + case 0: + playSound(0xCE, 0); + break; + case 1: + playSound(0xD0, 0); + break; + case 2: + playSound(0xCF, 0); + break; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene23_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene23_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASLookCereals: + showFullScreenSprite(0x48); + _gnapActionStatus = -1; + break; + case kASGrabCereals: + _gameSys->setAnimation(0xBE, _gnapId, 0); + _gameSys->insertSequence(0xBE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->requestRemoveSequence(0xBF, 2); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0xBE; + _gnapActionStatus = kASGrabCerealsDone; + break; + case kASGrabCerealsDone: + setGrabCursorSprite(kItemCereals); + _gnapActionStatus = -1; + break; + case kASLeaveScene: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(4) == 2 && _s23_nextStoreClerkSequenceId == -1) { + switch (getRandom(8)) { + case 0: + case 1: + case 2: + _s23_nextStoreClerkSequenceId = 0xB4; + break; + case 3: + case 4: + case 5: + _s23_nextStoreClerkSequenceId = 0xB5; + break; + default: + _s23_nextStoreClerkSequenceId = 0xB6; + break; + } + _gameSys->setAnimation(_s23_nextStoreClerkSequenceId, 1, 4); + _gameSys->insertSequence(_s23_nextStoreClerkSequenceId, 1, _s23_currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _s23_currStoreClerkSequenceId = _s23_nextStoreClerkSequenceId; + _s23_nextStoreClerkSequenceId = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp new file mode 100644 index 0000000000..236ee7d30a --- /dev/null +++ b/engines/gnap/scenes/scene24.cpp @@ -0,0 +1,261 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitCircusWorld = 1, + kHSExitOutsideGrubCity = 2, + kHSDevice = 3, + kHSWalkArea1 = 4, + kHSWalkArea2 = 5, + kHSWalkArea3 = 6 +}; + +enum { + kASLeaveScene = 0 +}; + +int GnapEngine::scene24_init() { + return 0x3B; +} + +void GnapEngine::scene24_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitCircusWorld, 785, 128, 800, 600, SF_EXIT_R_CURSOR, 8, 7); + setHotspot(kHSExitOutsideGrubCity, 0, 213, 91, 600, SF_EXIT_NW_CURSOR, 1, 8); + setHotspot(kHSWalkArea1, 0, 0, 0, 0); + setHotspot(kHSWalkArea2, 530, 0, 800, 600); + setHotspot(kHSWalkArea3, 0, 0, 800, 517); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 7; +} + +void GnapEngine::scene24_run() { + int counter = 0; + + playSound(0x10940, 1); + + startSoundTimerA(9); + + _timers[7] = getRandom(100) + 100; + + _gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); + + _timers[4] = getRandom(20) + 50; + _timers[5] = getRandom(20) + 40; + _timers[6] = getRandom(50) + 30; + + _gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); + + _s24_currWomanSequenceId = 0x35; + _s24_girlSequenceId = 0x36; + _s24_boySequenceId = 0x30; + + if (_debugLevel == 4) + startIdleTimer(8); + + queueInsertDeviceIcon(); + + if (_prevSceneNum == 20) { + initGnapPos(1, 8, 1); + initBeaverPos(2, 8, 0); + endSceneInit(); + gnapWalkTo(1, 9, -1, 0x107B9, 1); + platypusWalkTo(2, 9, -1, 0x107C2, 1); + } else { + initGnapPos(8, 8, 3); + initBeaverPos(8, 8, 4); + endSceneInit(); + gnapWalkTo(2, 8, -1, 0x107BA, 1); + platypusWalkTo(3, 8, -1, 0x107C2, 1); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene24_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitCircusWorld: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 25; + gnapWalkTo(_hotspotsWalkPos[kHSExitCircusWorld].x, _hotspotsWalkPos[kHSExitCircusWorld].y, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitCircusWorld].x + 1, _hotspotsWalkPos[kHSExitCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHSExitOutsideGrubCity: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 20; + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + if (_gnapActionStatus == -1) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene24_updateAnimations(); + + if (!isSoundPlaying(0x10940)) + playSound(0x10940, 1); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(20) + 50; + _gameSys->insertSequence(0x37, 20, _s24_girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s24_girlSequenceId = 0x37; + } + if (!_timers[5]) { + _timers[5] = getRandom(20) + 40; + _gameSys->insertSequence(0x31, 20, _s24_boySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s24_boySequenceId = 0x31; + } + if (!_timers[6]) { + _timers[6] = getRandom(50) + 30; + counter = (counter + 1) % 3; + switch (counter) { + case 0: + _s24_nextWomanSequenceId = 0x32; + break; + case 1: + _s24_nextWomanSequenceId = 0x33; + break; + case 2: + _s24_nextWomanSequenceId = 0x34; + break; + } + _gameSys->insertSequence(_s24_nextWomanSequenceId, 20, _s24_currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _s24_currWomanSequenceId = _s24_nextWomanSequenceId; + } + if (!_timers[7]) { + _timers[7] = getRandom(100) + 100; + switch (getRandom(3)) { + case 0: + _gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + if (_debugLevel == 4) + updateIdleTimer(); + playSoundA(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene24_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene24_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + if (_gnapActionStatus == kASLeaveScene) + _sceneDone = true; + _gnapActionStatus = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp new file mode 100644 index 0000000000..cb82658cc2 --- /dev/null +++ b/engines/gnap/scenes/scene25.cpp @@ -0,0 +1,401 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSTicketVendor = 1, + kHSExitOutsideCircusWorld = 2, + kHSExitInsideCircusWorld = 3, + kHSDevice = 4, + kHSPosters1 = 5, + kHSPosters2 = 6, + kHSPosters3 = 7, + kHSPosters4 = 8, + kHSWalkArea1 = 9, + kHSWalkArea2 = 10 +}; + +enum { + kASTalkTicketVendor = 0, + kASEnterCircusWihoutTicket = 1, + kASShowTicketToVendor = 2, + kASShowTicketToVendorDone = 3, + kASEnterCircusWihoutTicketDone = 4, + kASLeaveScene = 5 +}; + +int GnapEngine::scene25_init() { + return 0x62; +} + +void GnapEngine::scene25_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSTicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5); + setHotspot(kHSExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10); + setHotspot(kHSExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6); + setHotspot(kHSPosters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + setHotspot(kHSPosters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + setHotspot(kHSPosters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7); + setHotspot(kHSPosters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + setHotspot(kHSWalkArea1, 0, 0, 800, 439); + setHotspot(kHSWalkArea2, 585, 0, 800, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 11; +} + +void GnapEngine::scene25_playAnims(int index) { + + if (index > 4) + return; + + hideCursor(); + setGrabCursorSprite(-1); + switch (index) { + case 1: + _largeSprite = _gameSys->createSurface(0x25); + break; + case 2: + _largeSprite = _gameSys->createSurface(0x26); + break; + case 3: + _largeSprite = _gameSys->createSurface(0x27); + break; + case 4: + _largeSprite = _gameSys->createSurface(0x28); + break; + } + _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); + delayTicksCursor(5); + while (!_mouseClickState.left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_SPACE) && + !isKeyStatus1(29)) { + gameUpdateTick(); + } + _mouseClickState.left = false; + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(29); + clearKeyStatus1(Common::KEYCODE_SPACE); + _gameSys->removeSpriteDrawItem(_largeSprite, 300); + delayTicksCursor(5); + deleteSurface(&_largeSprite); + showCursor(); +} + +void GnapEngine::scene25_run() { + + playSound(0x10940, 1); + + startSoundTimerA(5); + + _s25_currTicketVendorSequenceId = 0x52; + _gameSys->setAnimation(0x52, 39, 3); + _gameSys->insertSequence(_s25_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + + _s25_nextTicketVendorSequenceId = -1; + _timers[4] = getRandom(20) + 20; + + queueInsertDeviceIcon(); + + if (_prevSceneNum == 24) { + initGnapPos(5, 11, 5); + initBeaverPos(6, 11, 4); + endSceneInit(); + gnapWalkTo(5, 7, -1, 0x107BA, 1); + platypusWalkTo(6, 7, -1, 0x107C2, 1); + } else { + initGnapPos(5, 6, 1); + initBeaverPos(6, 6, 0); + endSceneInit(); + gnapWalkTo(5, 8, -1, 0x107B9, 1); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene25_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSTicketVendor: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemTickets) { + _gnapActionStatus = kASShowTicketToVendor; + gnapWalkTo(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, + 0, getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, 6, 1); + _s25_nextTicketVendorSequenceId = 0x5B; + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 1); + _s25_nextTicketVendorSequenceId = (getRandom(2) == 1) ? 0x59 : 0x56; + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkTicketVendor; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitOutsideCircusWorld: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 24; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107B4, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHSExitInsideCircusWorld: + if (_gnapActionStatus < 0) { + if (isFlag(2)) { + _isLeavingScene = true; + _newSceneNum = 26; + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + } else { + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(4, 5, 0, 0x107BB, 1); + _gnapActionStatus = kASEnterCircusWihoutTicket; + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + } + } + break; + + case kHSPosters1: + case kHSPosters2: + case kHSPosters3: + case kHSPosters4: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, -1, -1, 1); + if (_sceneClickedHotspot == 5 || _sceneClickedHotspot == 6) + _gnapIdleFacing = 5; + else if (_sceneClickedHotspot == 8) + _gnapIdleFacing = 1; + else + _gnapIdleFacing = 7; + playGnapIdle(0, 0); + scene25_playAnims(8 - _sceneClickedHotspot + 1); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapMoan2(0, 0); + break; + } + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene25_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _gnapActionStatus == -1) { + _timers[4] = getRandom(20) + 20; + switch (getRandom(13)) { + case 0: + _s25_nextTicketVendorSequenceId = 0x54; + break; + case 1: + _s25_nextTicketVendorSequenceId = 0x58; + break; + case 2: + _s25_nextTicketVendorSequenceId = 0x55; + break; + case 3: + _s25_nextTicketVendorSequenceId = 0x5A; + break; + case 4: + case 5: + case 6: + case 7: + _s25_nextTicketVendorSequenceId = 0x5B; + break; + case 8: + case 9: + case 10: + case 11: + _s25_nextTicketVendorSequenceId = 0x5C; + break; + case 12: + _s25_nextTicketVendorSequenceId = 0x5D; + break; + default: + _s25_nextTicketVendorSequenceId = 0x52; + break; + } + } + playSoundA(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene25_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene25_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASTalkTicketVendor: + _s25_nextTicketVendorSequenceId = (getRandom(2) == 1) ? 0x57 : 0x5F; + _gnapActionStatus = -1; + break; + case kASEnterCircusWihoutTicket: + _s25_nextTicketVendorSequenceId = 0x5E; + _gameSys->setAnimation(0x5E, 39, 0); + _gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); + _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, 32, 0, 0, 0); + _gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); + _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; + _s25_nextTicketVendorSequenceId = -1; + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + playGnapIdle(0, 0); + gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, -1, 0x107BB, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _gnapActionStatus = kASEnterCircusWihoutTicketDone; + break; + case kASEnterCircusWihoutTicketDone: + _gnapActionStatus = -1; + break; + case kASShowTicketToVendor: + setGrabCursorSprite(-1); + invRemove(kItemTickets); + setFlag(2); + _gameSys->setAnimation(0x61, 40, 0); + _gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); + _gnapActionStatus = kASShowTicketToVendorDone; + break; + case kASShowTicketToVendorDone: + _s25_nextTicketVendorSequenceId = 0x53; + break; + case kASLeaveScene: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + if (_s25_nextTicketVendorSequenceId == 0x53) { + _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; + _s25_nextTicketVendorSequenceId = -1; + _gnapActionStatus = -1; + } else if (_s25_nextTicketVendorSequenceId != -1) { + _gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); + _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; + _s25_nextTicketVendorSequenceId = -1; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp new file mode 100644 index 0000000000..644db6b3fd --- /dev/null +++ b/engines/gnap/scenes/scene26.cpp @@ -0,0 +1,256 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitOutsideCircusWorld = 1, + kHSExitOutsideClown = 2, + kHSExitArcade = 3, + kHSExitElephant = 4, + kHSExitBeerStand = 5, + kHSDevice = 6, + kHSWalkArea1 = 7, + kHSWalkArea2 = 8 +}; + +enum { + kASLeaveScene = 0 +}; + +int GnapEngine::scene26_init() { + return isFlag(23) ? 0x61 : 0x60; +} + +void GnapEngine::scene26_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10); + setHotspot(kHSExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8); + setHotspot(kHSExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8); + setHotspot(kHSExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8); + setHotspot(kHSExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8); + setHotspot(kHSWalkArea1, 0, 0, 800, 500); + setHotspot(kHSWalkArea2, 281, 0, 800, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 9; +} + +void GnapEngine::scene26_run() { + + startSoundTimerB(7); + playSound(0x1093B, 1); + + _s26_currKidSequenceId = 0x5B; + _s26_nextKidSequenceId = -1; + _gameSys->setAnimation(0x5B, 160, 3); + _gameSys->insertSequence(_s26_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); + + _timers[5] = getRandom(20) + 50; + _timers[4] = getRandom(20) + 50; + _timers[6] = getRandom(50) + 100; + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); + + if (_prevSceneNum == 25) { + initGnapPos(-1, 8, 1); + initBeaverPos(-2, 8, 0); + endSceneInit(); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + } else { + initGnapPos(2, 8, 1); + initBeaverPos(3, 8, 0); + endSceneInit(); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene26_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitOutsideCircusWorld: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 25; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + } + break; + + case kHSExitOutsideClown: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 27; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BC, 1); + _gnapActionStatus = kASLeaveScene; + } + break; + + case kHSExitArcade: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 29; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitArcade].y, 0, 0x107BC, 1); + _gnapActionStatus = kASLeaveScene; + } + break; + + case kHSExitElephant: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 30; + gnapWalkTo(-1, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _gnapActionStatus = kASLeaveScene; + } + break; + + case kHSExitBeerStand: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 31; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107BB, 1); + _gnapActionStatus = kASLeaveScene; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene26_updateAnimations(); + + if (!isSoundPlaying(0x1093B)) + playSound(0x1093B, 1); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[5] && _s26_nextKidSequenceId == -1) { + _timers[5] = getRandom(20) + 50; + if (getRandom(5) != 0) + _s26_nextKidSequenceId = 0x5B; + else + _s26_nextKidSequenceId = 0x5A; + } + if (!_timers[4]) { + _timers[4] = getRandom(20) + 130; + _gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_timers[6]) { + _timers[6] = getRandom(50) + 100; + _gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); + } + playSoundB(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene26_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene26_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + if (_gnapActionStatus == kASLeaveScene) + _sceneDone = true; + _gnapActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(3) == 2 && _s26_nextKidSequenceId != -1) { + _gameSys->insertSequence(_s26_nextKidSequenceId, 160, _s26_currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s26_nextKidSequenceId, 160, 3); + _s26_currKidSequenceId = _s26_nextKidSequenceId; + _s26_nextKidSequenceId = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp new file mode 100644 index 0000000000..000a94203c --- /dev/null +++ b/engines/gnap/scenes/scene27.cpp @@ -0,0 +1,423 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSJanitor = 1, + kHSDevice = 2, + kHSBucket = 3, + kHSExitCircus = 4, + kHSExitArcade = 5, + kHSExitBeerStand = 6, + kHSExitClown = 7, + kHSWalkArea1 = 8 +}; + +enum { + kASTalkJanitor = 0, + kASGrabBucket = 1, + kASGrabBucketDone = 2, + kASShowPictureToJanitor = 3, + kASTryEnterClownTent = 4, + kASTryEnterClownTentDone = 5, + kASEnterClownTent = 6, + kASLeaveScene = 7 +}; + +int GnapEngine::scene27_init() { + return 0xD5; +} + +void GnapEngine::scene27_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSJanitor, 488, 204, 664, 450, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 8); + setHotspot(kHSBucket, 129, 406, 186, 453, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 6); + setHotspot(kHSExitCircus, 200, 585, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitArcade, 0, 0, 15, 600, SF_EXIT_L_CURSOR, 0, 6); + setHotspot(kHSExitBeerStand, 785, 0, 800, 600, SF_EXIT_R_CURSOR, 11, 7); + setHotspot(kHSExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); + setHotspot(kHSWalkArea1, 0, 0, 800, 507); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(13)) + _hotspots[kHSBucket].flags = SF_DISABLED; + _hotspotsCount = 9; +} + +void GnapEngine::scene27_run() { + + playSound(0x1093B, 1); + startSoundTimerB(4); + _timers[7] = getRandom(100) + 300; + queueInsertDeviceIcon(); + + if (!isFlag(13)) + _gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); + + if (_debugLevel == 4) + startIdleTimer(6); + + _gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); + + _s27_currJanitorSequenceId = 0xCB; + _s27_nextJanitorSequenceId = -1; + + _gameSys->setAnimation(0xCB, 39, 3); + + _timers[5] = getRandom(20) + 60; + + switch (_prevSceneNum) { + case 26: + initGnapPos(7, 12, 1); + initBeaverPos(6, 12, 0); + endSceneInit(); + gnapWalkTo(7, 8, -1, 0x107B9, 1); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + break; + case 29: + initGnapPos(-1, 8, 1); + initBeaverPos(-1, 9, 0); + endSceneInit(); + gnapWalkTo(3, 8, -1, 0x107B9, 1); + platypusWalkTo(3, 9, -1, 0x107C2, 1); + break; + case 31: + initGnapPos(12, 8, 3); + initBeaverPos(12, 9, 4); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107BA, 1); + platypusWalkTo(8, 9, -1, 0x107C2, 1); + break; + default: + initGnapPos(6, 8, 1); + initBeaverPos(5, 9, 0); + endSceneInit(); + break; + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + _sceneClickedHotspot = -1; + if (_gnapActionStatus < 0) + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene27_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSJanitor: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemPicture) { + _gnapIdleFacing = 5; + if (gnapWalkTo(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 0, 0x107BC, 1)) + _gnapActionStatus = kASShowPictureToJanitor; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 7, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 3); + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = kASTalkJanitor; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSBucket: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, 3, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(3, 3); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBucket].x, _hotspotsWalkPos[kHSBucket].y) | 0x10000, 1); + _gnapActionStatus = kASGrabBucket; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitCircus: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 26; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C7, 1); + } + break; + + case kHSExitArcade: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 29; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitArcade].y, 0, 0x107AF, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitArcade].x, _hotspotsWalkPos[kHSExitArcade].y + 1, -1, 0x107CF, 1); + } + break; + + case kHSExitBeerStand: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 31; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107AB, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitBeerStand].x, _hotspotsWalkPos[kHSExitBeerStand].y + 1, -1, 0x107CD, 1); + } + break; + + case kHSExitClown: + if (_gnapActionStatus < 0) { + if (isFlag(0)) { + _isLeavingScene = true; + _newSceneNum = 28; + gnapWalkTo(_hotspotsWalkPos[kHSExitClown].x, _hotspotsWalkPos[kHSExitClown].y, 0, 0x107AD, 1); + _gnapActionStatus = kASLeaveScene; + platypusWalkTo(_hotspotsWalkPos[kHSExitClown].x + 1, _hotspotsWalkPos[kHSExitClown].y, -1, 0x107C4, 1); + } else { + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSExitClown].x, 7, 0, 0x107BC, 1); + _hotspots[kHSWalkArea1].flags &= SF_WALKABLE; + _gnapActionStatus = kASTryEnterClownTent; + } + } + break; + + case kHSWalkArea1: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene27_updateAnimations(); + + if (!isSoundPlaying(0x1093B)) + playSound(0x1093B, 1); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (_debugLevel == 4) + updateIdleTimer(); + if (!_timers[5]) { + _timers[5] = getRandom(20) + 60; + if (_gnapActionStatus < 0) { + if (getRandom(3) != 0) + _s27_nextJanitorSequenceId = 0xCB; + else + _s27_nextJanitorSequenceId = 0xCF; + } + } + if (!_timers[7]) { + _timers[7] = getRandom(100) + 300; + if (_gnapActionStatus < 0) + _gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); + } + playSoundB(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene27_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene27_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case kASTalkJanitor: + switch (getRandom(3)) { + case 0: + _s27_nextJanitorSequenceId = 0xCC; + break; + case 1: + _s27_nextJanitorSequenceId = 0xCD; + break; + case 2: + _s27_nextJanitorSequenceId = 0xCE; + break; + } + break; + case kASGrabBucket: + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _hotspots[kHSBucket].flags = SF_DISABLED; + invAdd(kItemEmptyBucket); + setFlag(13); + _gameSys->setAnimation(0xD2, 39, 0); + _gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = kASGrabBucketDone; + break; + case kASGrabBucketDone: + setGrabCursorSprite(kItemEmptyBucket); + _gnapActionStatus = -1; + break; + case kASShowPictureToJanitor: + _s27_nextJanitorSequenceId = 0xD0; + break; + case kASTryEnterClownTent: + _s27_nextJanitorSequenceId = 0xD1; + _gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, 32, 0, 0, 0); + _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); + _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; + _s27_nextJanitorSequenceId = -1; + _gnapActionStatus = kASTryEnterClownTentDone; + break; + case kASTryEnterClownTentDone: + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _gnapActionStatus = -1; + break; + case kASEnterClownTent: + gnapWalkTo(_gnapX, _gnapY, 0, 0x107B2, 1); + _gnapActionStatus = kASLeaveScene; + break; + case kASLeaveScene: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_s27_nextJanitorSequenceId) { + case -1: + _s27_nextJanitorSequenceId = 0xCB; + _gameSys->insertSequence(0xCB, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; + _s27_nextJanitorSequenceId = -1; + break; + case 0xCC: + case 0xCD: + case 0xCE: + _gnapActionStatus = -1; + _gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); + _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; + _s27_nextJanitorSequenceId = -1; + break; + case 0xD0: + // Show picture to janitor + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); + _gnapActionStatus = kASEnterClownTent; + _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; + _s27_nextJanitorSequenceId = -1; + setFlag(0); + setGrabCursorSprite(-1); + invRemove(kItemPicture); + _newSceneNum = 28; + break; + default: + _gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; + _s27_nextJanitorSequenceId = -1; + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp new file mode 100644 index 0000000000..23c3e52974 --- /dev/null +++ b/engines/gnap/scenes/scene28.cpp @@ -0,0 +1,435 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSHorn = 1, + kHSClown = 2, + kHSExitOutsideClown = 3, + kHSUnknown = 4, + kHSDevice = 5, + kHSWalkArea1 = 6, + kHSWalkArea2 = 7 +}; + +int GnapEngine::scene28_init() { + return 0x125; +} + +void GnapEngine::scene28_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); + setHotspot(kHSUnknown, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); + setHotspot(kHSWalkArea1, 0, 0, 799, 523); + setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (invHas(kItemHorn)) + _hotspots[kHSHorn].flags = SF_DISABLED; + if (isFlag(22)) + _hotspots[kHSUnknown].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspotsCount = 8; +} + +void GnapEngine::scene28_run() { + + playSound(0x1093C, 1); + _s28_dword_47EA60 = -1; + queueInsertDeviceIcon(); + _gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(22)) + _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(1)) { + if (isFlag(21)) { + _gameSys->setAnimation(0x11C, 39, 3); + _gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); + if (!invHas(kItemHorn)) + _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); + _s28_dword_47EA5C = 0x11C; + } else { + _s28_dword_47EA5C = 0x11B; + _gameSys->setAnimation(0x11B, 39, 3); + _gameSys->insertSequence(_s28_dword_47EA5C, 39, 0, 0, kSeqNone, 0, 0, 0); + _timers[4] = getRandom(20) + 80; + } + initGnapPos(8, 8, 3); + initBeaverPos(9, 8, 4); + endSceneInit(); + } else { + _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + initGnapPos(8, 8, 3); + initBeaverPos(9, 8, 4); + endSceneInit(); + playSequences(0xF7, 0x121, 0x122, 0x123); + _s28_dword_47EA5C = 0x115; + setFlag(1); + _gameSys->setAnimation(0x115, 39, 3); + _gameSys->insertSequence(_s28_dword_47EA5C, 39, 283, 39, kSeqSyncWait, 0, 0, 0); + _s28_dword_47EA60 = -1; + _timers[4] = getRandom(20) + 80; + _gnapActionStatus = 9; + while (_gameSys->getAnimationStatus(3) != 2) { + gameUpdateTick(); + updateMouseCursor(); + } + _gnapActionStatus = -1; + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene28_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSHorn: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(2, 8, 3, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(2, 4); + break; + case GRAB_CURSOR: + if (isFlag(21)) { + if (!invHas(kItemHorn)) { + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); + _gnapActionStatus = 4; + } + } else { + _gnapIdleFacing = 5; + gnapWalkTo(2, 8, 0, 0x107BB, 1); + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _gnapActionStatus = 2; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSClown: + if (_gnapActionStatus < 0) { + if (isFlag(21)) { + if (_verbCursor == LOOK_CURSOR) + playGnapScratchingHead(5, 2); + else + playGnapImpossible(0, 0); + } else if (_grabCursorSpriteIndex == kItemBucketWithBeer) { + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _gnapActionStatus = 0; + } else if (_grabCursorSpriteIndex == kItemBucketWithPill) { + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _gnapActionStatus = 1; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 2, 4); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(5, 2); + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 8; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitOutsideClown: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + _newSceneNum = 27; + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); + _gnapActionStatus = 10; + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); + } + break; + + case kHSUnknown: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, 8, 6); + } else if (isFlag(21)) { + playGnapImpossible(8, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(8, 6); + break; + case GRAB_CURSOR: + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSUnknown].x, _hotspotsWalkPos[kHSUnknown].y) | 0x10000, 1); + _gnapActionStatus = 3; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene28_updateAnimations(); + + if (!isSoundPlaying(0x1093C)) + playSound(0x1093C, 1); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(20) + 80; + if (_gnapActionStatus < 0 && !isFlag(21)) + _s28_dword_47EA60 = 0x114; + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene28_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene28_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 0: + setFlag(22); + _s28_dword_47EA60 = 275; + invRemove(kItemBucketWithBeer); + scene28_updateHotspots(); + break; + case 1: + _s28_dword_47EA60 = 0x116; + invRemove(kItemBucketWithPill); + setFlag(22); + setFlag(21); + scene28_updateHotspots(); + break; + case 2: + _s28_dword_47EA60 = 0x119; + break; + case 3: + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _gameSys->setAnimation(0x111, 99, 0); + _gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = 6; + break; + case 4: + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _gameSys->setAnimation(0x117, 59, 0); + _gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = 5; + break; + case 5: + hideCursor(); + setGrabCursorSprite(-1); + addFullScreenSprite(0xF6, 255); + _gameSys->setAnimation(0x120, 256, 0); + _gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + removeFullScreenSprite(); + showCursor(); + setGrabCursorSprite(kItemHorn); + invAdd(kItemHorn); + scene28_updateHotspots(); + _gnapActionStatus = -1; + break; + case 6: + setGrabCursorSprite(kItemEmptyBucket); + clearFlag(22);; + scene28_updateHotspots(); + invAdd(kItemEmptyBucket); + _gnapActionStatus = -1; + break; + case 7: + _gameSys->insertSequence(0x107B5, _gnapId, 281, 39, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7B5; + _gnapSequenceDatNum = 1; + _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _s28_dword_47EA5C = 0x11B; + _s28_dword_47EA60 = -1; + _gnapActionStatus = -1; + gnapWalkTo(2, 8, -1, 0x107BB, 1); + break; + case 8: + _s28_dword_474938 = (_s28_dword_474938 + 1) % 2; + if (_s28_dword_474938 == 0) + _s28_dword_47EA60 = 0x11D; + else if (_s28_dword_474938 == 1) + _s28_dword_47EA60 = 0x11E; + else if (_s28_dword_474938 == 2) + _s28_dword_47EA60 = 0x11F; // NOTE CHECKME Never set, bug in the original? + break; + case 9: + _gnapActionStatus = -1; + break; + case 10: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_s28_dword_47EA60) { + case 0x113: + setGrabCursorSprite(-1); + _gameSys->setAnimation(_s28_dword_47EA60, 39, 0); + _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_dword_47EA60), 0, 0); + _gameSys->insertSequence(_s28_dword_47EA60, 39, _s28_dword_47EA5C, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x11B, 39, _s28_dword_47EA60, 39, kSeqSyncWait, 0, 0, 0); + _s28_dword_47EA5C = 0x11B; + _s28_dword_47EA60 = -1; + _gnapActionStatus = 9; + break; + case 0x116: + setGrabCursorSprite(-1); + _gameSys->setAnimation(_s28_dword_47EA60, 39, 0); + _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_dword_47EA60), 0, 0); + _gameSys->insertSequence(_s28_dword_47EA60, 39, _s28_dword_47EA5C, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x11C, 39, _s28_dword_47EA60, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_dword_47EA60), 0, 0); + _s28_dword_47EA5C = _s28_dword_47EA60; + _s28_dword_47EA60 = -1; + _gnapActionStatus = 9; + break; + case 0x11D: + case 0x11E: + case 0x11F: + _gnapActionStatus = -1; + break; + case 0x119: + _gameSys->insertSequence(_s28_dword_47EA60, 39, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_dword_47EA60, 39, 0); + _gameSys->removeSequence(_s28_dword_47EA5C, 39, 1); + _gnapActionStatus = 7; + _gnapSequenceId = _s28_dword_47EA60; + _gnapSequenceDatNum = 0; + _s28_dword_47EA60 = -1; + break; + } + if (_s28_dword_47EA60 != -1) { + _gameSys->insertSequence(_s28_dword_47EA60, 39, _s28_dword_47EA5C, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_dword_47EA60, 39, 3); + _s28_dword_47EA5C = _s28_dword_47EA60; + _s28_dword_47EA60 = -1; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp new file mode 100644 index 0000000000..3a78107db5 --- /dev/null +++ b/engines/gnap/scenes/scene29.cpp @@ -0,0 +1,352 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSMonkey = 1, + kHSDevice = 2, + kHSExitCircus = 3, + kHSExitOutsideClown = 4, + kHSAracde = 5, + kHSWalkArea1 = 6 +}; + +int GnapEngine::scene29_init() { + return 0xF6; +} + +void GnapEngine::scene29_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSMonkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); + setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); + setHotspot(kHSAracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + setHotspot(kHSWalkArea1, 0, 0, 800, 478); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (invHas(kItemHorn)) + _hotspots[kHSMonkey].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspotsCount = 7; +} + +void GnapEngine::scene29_run() { + + playSound(0x1093B, 1); + startSoundTimerB(6); + queueInsertDeviceIcon(); + + if (invHas(kItemHorn)) { + _s29_dword_47EA74 = 0xE8; + _s29_dword_47EA78 = -1; + _gameSys->setAnimation(0xE8, 159, 4); + _gameSys->insertSequence(_s29_dword_47EA74, 159, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _s29_dword_47EA7C = 0xED; + _s29_dword_47EA80 = -1; + _gameSys->setAnimation(0xED, 39, 3); + _timers[4] = getRandom(20) + 60; + } else { + _gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(0, 0, 4); + _gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(0, 0, 3); + } + + _gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); + + if (_prevSceneNum == 27) { + initGnapPos(12, 7, 1); + initBeaverPos(12, 8, 0); + endSceneInit(); + gnapWalkTo(8, 7, -1, 0x107B9, 1); + platypusWalkTo(8, 8, -1, 0x107C2, 1); + } else { + initGnapPos(-1, 7, 1); + initBeaverPos(-2, 7, 0); + endSceneInit(); + gnapWalkTo(2, 7, -1, 0x107B9, 1); + platypusWalkTo(1, 7, -1, 0x107C2, 1); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene29_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSMonkey: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemBanana) { + _gnapIdleFacing = 1; + gnapWalkTo(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _gnapActionStatus = 0; + _newSceneNum = 51; + _isLeavingScene = 1; + setGrabCursorSprite(-1); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y, 5, 6); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(5, 6); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y); + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitCircus: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 26; + gnapWalkTo(_hotspotsWalkPos[kHSExitCircus].x, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _gnapActionStatus = 2; + platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); + } + break; + + case kHSExitOutsideClown: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 27; + gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AB, 1); + _gnapActionStatus = 2; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y - 1, -1, 0x107CD, 1); + } + break; + + case kHSAracde: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { + setGrabCursorSprite(-1); + _isLeavingScene = 1; + _newSceneNum = 52; + gnapWalkTo(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y, 0, -1, 1); + playGnapIdle(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y); + _gnapActionStatus = 2; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y, 2, 3); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan2(0, 0); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSWalkArea1: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + } + + scene29_updateAnimations(); + + if (!isSoundPlaying(0x1093B)) + playSound(0x1093B, 1); + + if (!_isLeavingScene) { + if (_gnapActionStatus < 0) { + updateGnapIdleSequence(); + updateBeaverIdleSequence(); + } + if (!_timers[4]) { + if (invHas(kItemHorn)) { + _timers[4] = getRandom(20) + 60; + if (_gnapActionStatus < 0) { + switch (getRandom(5)) { + case 0: + _s29_dword_47EA80 = 0xED; + break; + case 1: + _s29_dword_47EA80 = 0xEE; + break; + case 2: + _s29_dword_47EA80 = 0xEF; + break; + case 3: + _s29_dword_47EA80 = 0xF0; + break; + case 4: + _s29_dword_47EA80 = 0xF1; + break; + } + } + } + } + playSoundB(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene29_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene29_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 0: + _s29_dword_47EA78 = 0xE5; + break; + case 1: + case 2: + _sceneDone = true; + break; + } + } + + if (_gameSys->getAnimationStatus(3) == 2 && _s29_dword_47EA80 != -1) { + _gameSys->insertSequence(_s29_dword_47EA80, 39, _s29_dword_47EA7C, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s29_dword_47EA80, 39, 3); + _s29_dword_47EA7C = _s29_dword_47EA80; + _s29_dword_47EA80 = -1; + } + + if (_gameSys->getAnimationStatus(4) == 2) { + if (_s29_dword_47EA78 == 0xE5) { + _gameSys->insertSequence(0xF2, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0xF2; + _gameSys->setAnimation(0xE6, 159, 0); + _gameSys->setAnimation(0, 159, 4); + _gameSys->insertSequence(_s29_dword_47EA78, 159, _s29_dword_47EA74, 159, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xE6, 159, _s29_dword_47EA78, 159, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = 1; + _s29_dword_47EA74 = 0xE6; + _s29_dword_47EA78 = -1; + _timers[5] = 30; + while (_timers[5]) + gameUpdateTick(); + platypusWalkTo(0, 8, 1, 0x107CF, 1); + while (_gameSys->getAnimationStatus(1) != 2) + gameUpdateTick(); + } else if (_s29_dword_47EA78 == -1) { + switch (getRandom(6)) { + case 0: + _s29_dword_47EA78 = 0xE8; + break; + case 1: + _s29_dword_47EA78 = 0xE9; + break; + case 2: + _s29_dword_47EA78 = 0xEA; + break; + case 3: + _s29_dword_47EA78 = 0xEB; + break; + case 4: + _s29_dword_47EA78 = 0xEC; + break; + case 5: + _s29_dword_47EA78 = 0xE7; + break; + } + _gameSys->insertSequence(_s29_dword_47EA78, 159, _s29_dword_47EA74, 159, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s29_dword_47EA78, 159, 4); + _s29_dword_47EA74 = _s29_dword_47EA78; + _s29_dword_47EA78 = -1; + } else { + _gameSys->insertSequence(_s29_dword_47EA78, 159, _s29_dword_47EA74, 159, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s29_dword_47EA78, 159, 4); + _s29_dword_47EA74 = _s29_dword_47EA78; + _s29_dword_47EA78 = -1; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp new file mode 100644 index 0000000000..341caee618 --- /dev/null +++ b/engines/gnap/scenes/scene30.cpp @@ -0,0 +1,281 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSPillMachine = 1, + kHSDevice = 2, + kHSExitCircus = 3, + kHSWalkArea1 = 4 +}; + +int GnapEngine::scene30_init() { + return isFlag(23) ? 0x10B : 0x10A; +} + +void GnapEngine::scene30_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSPillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); + setHotspot(kHSExitCircus, 100, 590, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitCircus, 0, 0, 800, 514); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 5; +} + +void GnapEngine::scene30_run() { + bool hasTakenPill = false; + + playSound(0x1093B, 1); + startSoundTimerB(6); + + queueInsertDeviceIcon(); + + if (isFlag(23)) + _gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (!isFlag(13)) + _gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); + _timers[5] = getRandom(50) + 180; + + _gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); + _timers[4] = getRandom(100) + 300; + + _s30_dword_47EA88 = 0x101; + initGnapPos(7, 12, 1); + initBeaverPos(6, 12, 0); + endSceneInit(); + gnapWalkTo(7, 8, -1, 0x107B9, 1); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene30_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSPillMachine: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemDiceQuarterHole && !isFlag(23)) { + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _gnapActionStatus = 1; + hasTakenPill = true; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 8, 5); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + gnapWalkTo(9, 8, 0, 0x107BC, 1); + _gnapActionStatus = 3; + break; + case GRAB_CURSOR: + playGnapScratchingHead(8, 5); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(8, 5); + break; + } + } + } + break; + + case kHSExitCircus: + if (_gnapActionStatus < 0) { + _isLeavingScene = true; + if (hasTakenPill) + _newSceneNum = 47; + else + _newSceneNum = 26; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C2, 1); + } + break; + + case kHSWalkArea1: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene30_updateAnimations(); + + if (!isSoundPlaying(0x1093B)) + playSound(0x1093B, 1); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(100) + 300; + if (_gnapActionStatus < 0) { + if (getRandom(5) == 1) { + _gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x100, 40, _s30_dword_47EA88, 40, kSeqSyncWait, 0, 0, 0); + _s30_dword_47EA88 = 0x100; + } else { + _gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); + } + } + } + if (!_timers[5]) { + _timers[5] = getRandom(50) + 180; + if (_gnapActionStatus < 0) { + if (!isFlag(23) || hasTakenPill) + _s30_dword_47EA8C = 0x109; + else + _s30_dword_47EA8C = 0x108; + _gameSys->insertSequence(_s30_dword_47EA8C, 20, 0, 0, kSeqNone, 0, 0, 0); + } + } + playSoundB(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene30_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene30_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 0: + _sceneDone = true; + break; + case 1: + setGrabCursorSprite(-1); + _gameSys->setAnimation(0x105, _gnapId, 0); + _gameSys->insertSequence(0x105, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x105; + _gnapSequenceDatNum = 0; + _gnapActionStatus = 2; + break; + case 2: + hideCursor(); + setGrabCursorSprite(-1); + addFullScreenSprite(0x3F, 255); + _gameSys->removeSequence(0x105, _gnapId, 1); + _gameSys->setAnimation(0x102, 256, 0); + _gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) { + // checkGameAppStatus(); + gameUpdateTick(); + } + _gameSys->setAnimation(0x103, _gnapId, 0); + _gameSys->insertSequence(0x103, _gnapId, 0, 0, kSeqNone, 0, 0, 0); + removeFullScreenSprite(); + showCursor(); + _gnapActionStatus = 4; + invAdd(kItemPill); + setFlag(23); + break; + case 3: + if (isFlag(23)) + showFullScreenSprite(0xE3); + else + showFullScreenSprite(0xE2); + _gnapActionStatus = -1; + break; + case 4: + _gameSys->setAnimation(0x104, _gnapId, 0); + _gameSys->insertSequence(0x104, _gnapId, makeRid(_gnapSequenceDatNum, 0x103), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x104; + _gnapSequenceDatNum = 0; + _gnapActionStatus = 5; + setGrabCursorSprite(kItemDiceQuarterHole); + break; + case 5: + _gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y + 1, -1, 0x107BC, 1); + _gnapActionStatus = -1; + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp new file mode 100644 index 0000000000..864dbf90bc --- /dev/null +++ b/engines/gnap/scenes/scene31.cpp @@ -0,0 +1,398 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSMeasuringClown = 1, + kHSBeerBarrel = 2, + kHSDevice = 3, + kHSExitCircus = 4, + kHSExitOutsideClown = 5, + kHSWalkArea1 = 6 +}; + +int GnapEngine::scene31_init() { + return 0x105; +} + +void GnapEngine::scene31_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSMeasuringClown, 34, 150, 256, 436, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 6); + setHotspot(kHSBeerBarrel, 452, 182, 560, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitOutsideClown, 0, 0, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + setHotspot(kHSWalkArea1, 0, 0, 800, 480); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 7; +} + +void GnapEngine::scene31_run() { + + playSound(0x1093B, 1); + startSoundTimerB(6); + + queueInsertDeviceIcon(); + + _s31_beerGuyDistracted = false; + _gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); + + _s31_dword_47EAA8 = 0xFB; + _s31_dword_47EAAC = -1; + + _gameSys->setAnimation(0xFB, 39, 3); + + _timers[4] = getRandom(20) + 60; + _timers[5] = getRandom(50) + 180; + + if (_prevSceneNum == 27) { + initGnapPos(-1, 8, 3); + initBeaverPos(-1, 9, 4); + endSceneInit(); + gnapWalkTo(3, 8, -1, 0x107BA, 1); + platypusWalkTo(3, 9, -1, 0x107D2, 1); + } else { + initGnapPos(7, 12, 1); + initBeaverPos(6, 12, 0); + endSceneInit(); + gnapWalkTo(7, 8, -1, 0x107BA, 1); + platypusWalkTo(6, 8, -1, 0x107D2, 1); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0 || _gnapActionStatus == 4) { + runMenu(); + scene31_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemJoint) { + gnapUseJointOnPlatypus(); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSMeasuringClown: + if (_gnapActionStatus < 0 || _gnapActionStatus == 4) { + if (_gnapActionStatus == 4) { + if (_verbCursor == LOOK_CURSOR) + playGnapScratchingHead(2, 2); + else + playGnapImpossible(0, 0); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, 2, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(2, 2); + break; + case GRAB_CURSOR: + gnapWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, -1, -1, 1); + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + gnapWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 0, 0x107B9, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _gnapActionStatus = 5; + _timers[4] = 300; + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (!invHas(kItemBucketWithBeer)) { + gnapUseDeviceOnBeaver(); + platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, 1, 0x107C2, 1); + _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); + _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _beaverActionStatus = 4; + _gnapActionStatus = 4; + _timers[4] = 300; + } else + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSBeerBarrel: + if (_gnapActionStatus < 0 || _gnapActionStatus == 4) { + if (_grabCursorSpriteIndex == kItemEmptyBucket && _s31_beerGuyDistracted) { + setGrabCursorSprite(-1); + gnapWalkTo(_gnapX, _gnapY, -1, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y) | 0x10000, 1); + _s31_dword_474940 += 5; + _gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); + playGnapPullOutDevice(6, 8); + playGnapUseDevice(0, 0); + gnapWalkTo(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); + _gnapActionStatus = 2; + _timers[4] = 300; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 6, 2); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(6, 2); + break; + case GRAB_CURSOR: + if (_s31_beerGuyDistracted) { + playGnapScratchingHead(6, 2); + } else { + gnapWalkTo(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); + _gnapActionStatus = 1; + _gnapIdleFacing = 5; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitCircus: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 26; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _gnapActionStatus = 6; + platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); + } + break; + + case kHSExitOutsideClown: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _newSceneNum = 27; + gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AF, 1); + _gnapActionStatus = 6; + platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y + 1, -1, 0x107CF, 1); + } + break; + + case kHSWalkArea1: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + } + + scene31_updateAnimations(); + + if (!isSoundPlaying(0x1093B)) + playSound(0x1093B, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(20) + 60; + if (_gnapActionStatus < 0 && _s31_dword_47EAAC == -1) { + switch (getRandom(6)){ + case 0: + _s31_dword_47EAAC = 0xFF; + break; + case 1: + _s31_dword_47EAAC = 0x100; + break; + case 2: + _s31_dword_47EAAC = 0x101; + break; + default: + _s31_dword_47EAAC = 0xFB; + break; + } + } + } + if (!_timers[5]) { + _timers[5] = getRandom(50) + 180; + if (_gnapActionStatus < 0) { + if (getRandom(2) != 0) + _s31_dword_47EAB4 = 0x104; + else + _s31_dword_47EAB4 = 0x103; + _gameSys->insertSequence(_s31_dword_47EAB4, 20, 0, 0, kSeqNone, 0, 0, 0); + } + } + playSoundB(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene31_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene31_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 1: + _s31_dword_47EAAC = 0xFE; + break; + case 2: + _gameSys->setAnimation(0x102, 59, 0); + _gameSys->insertSequence(0x102, 59, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapX = 5; + _gnapY = 7; + _gnapSequenceDatNum = 0; + _gnapSequenceId = 0x102; + _gnapId = 59; + _gnapActionStatus = 3; + break; + case 3: + _gnapIdleFacing = 3; + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = -1; + invAdd(kItemBucketWithBeer); + invRemove(kItemEmptyBucket); + setGrabCursorSprite(kItemBucketWithBeer); + break; + case 5: + _s31_dword_47EAAC = 0xFA; + _s31_dword_474940 = 1; + break; + case 6: + _sceneDone = true; + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + if (_beaverActionStatus == 4) { + _sceneWaiting = 1; + _s31_beerGuyDistracted = true; + _s31_dword_47EAAC = 0xFA; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_s31_dword_47EAAC) { + case 0xFA: + _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xFC, 39, _s31_dword_47EAAC, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0xFC, 39, 3); + _s31_dword_47EAA8 = 0xFC; + _s31_dword_47EAAC = 0xFC; + _s31_dword_47EAB0 = 0; + break; + case 0xFC: + ++_s31_dword_47EAB0; + if (_s31_dword_47EAB0 >= _s31_dword_474940) { + if (_gnapActionStatus != 5) + _beaverActionStatus = -1; + _timers[0] = 40; + _gameSys->insertSequence(0xFD, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); + _s31_dword_47EAA8 = 0xFD; + _s31_dword_47EAAC = -1; + if (_gnapActionStatus != 3 && _gnapActionStatus != 2) + _gnapActionStatus = -1; + _s31_beerGuyDistracted = false; + _s31_dword_474940 = 3; + _gameSys->setAnimation(0xFD, 39, 3); + _sceneWaiting = 0; + } else { + _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); + _s31_dword_47EAA8 = _s31_dword_47EAAC; + _s31_dword_47EAAC = 0xFC; + _gameSys->setAnimation(0xFC, 39, 3); + } + break; + case 0xFE: + _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s31_dword_47EAAC, 39, 3); + _s31_dword_47EAA8 = _s31_dword_47EAAC; + _s31_dword_47EAAC = -1; + _gnapActionStatus = -1; + break; + default: + if (_s31_dword_47EAAC != -1) { + _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s31_dword_47EAAC, 39, 3); + _s31_dword_47EAA8 = _s31_dword_47EAAC; + _s31_dword_47EAAC = -1; + } + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp new file mode 100644 index 0000000000..3edd3db2cd --- /dev/null +++ b/engines/gnap/scenes/scene32.cpp @@ -0,0 +1,201 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitTruck = 1, + kHSDevice = 2, + kHSWalkArea1 = 3, + kHSWalkArea2 = 4, + kHSWalkArea3 = 5, + kHSWalkArea4 = 6, + kHSWalkArea5 = 7, + kHSWalkArea6 = 8, + kHSWalkArea7 = 9, + kHSWalkArea8 = 10 +}; + +int GnapEngine::scene32_init() { + _gameSys->setAnimation(0, 0, 0); + return isFlag(26) ? 0xF : 0x10; +} + +void GnapEngine::scene32_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + setHotspot(kHSWalkArea1, 0, 0, 162, 426); + setHotspot(kHSWalkArea2, 162, 0, 237, 396); + setHotspot(kHSWalkArea3, 237, 0, 319, 363); + setHotspot(kHSWalkArea4, 520, 0, 800, 404); + setHotspot(kHSWalkArea5, 300, 447, 800, 600); + setHotspot(kHSWalkArea6, 678, 0, 800, 404); + setHotspot(kHSWalkArea7, 0, 0, 520, 351); + setHotspot(kHSWalkArea8, 0, 546, 300, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 11; +} + +void GnapEngine::scene32_run() { + + playSound(0x1091C, 1); + startSoundTimerC(5); + queueInsertDeviceIcon(); + _s32_dword_47EADC = -1; + _timers[4] = getRandom(100) + 300; + + if (_prevSceneNum == 33) { + initGnapPos(11, 6, 3); + initBeaverPos(12, 6, 4); + endSceneInit(); + platypusWalkTo(9, 6, -1, 0x107D2, 1); + gnapWalkTo(8, 6, -1, 0x107BA, 1); + } else { + initGnapPos(1, 6, 1); + initBeaverPos(1, 7, 0); + endSceneInit(); + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene32_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitTruck: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + setGrabCursorSprite(-1); + gnapWalkTo(_hotspotsWalkPos[kHSExitTruck].x, _hotspotsWalkPos[kHSExitTruck].y, 0, 0x107AB, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitTruck].x, _hotspotsWalkPos[kHSExitTruck].y + 1, -1, 0x107CD, 1); + _newSceneNum = 33; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + case kHSWalkArea5: + case kHSWalkArea6: + case kHSWalkArea7: + case kHSWalkArea8: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = 0; + } + + scene32_updateAnimations(); + + if (!isSoundPlaying(0x1091C)) + playSound(0x1091C, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(100) + 300; + if (getRandom(2) != 0) + _s32_dword_47EADC = 14; + else + _s32_dword_47EADC = 13; + _gameSys->insertSequence(_s32_dword_47EADC, 180, 0, 0, kSeqNone, 0, 0, 0); + } + playSoundC(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene32_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene32_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + if (_gnapActionStatus == 0) + _sceneDone = true; + } + +} + +} // End of namespace Gnap + \ No newline at end of file diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp new file mode 100644 index 0000000000..f9471abcd5 --- /dev/null +++ b/engines/gnap/scenes/scene33.cpp @@ -0,0 +1,327 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSChicken = 1, + kHSDevice = 2, + kHSExitHouse = 3, + kHSExitBarn = 4, + kHSExitCreek = 5, + kHSExitPigpen = 6, + kHSWalkArea1 = 7, + kHSWalkArea2 = 8 +}; + +int GnapEngine::scene33_init() { + return isFlag(26) ? 0x84 : 0x85; +} + +void GnapEngine::scene33_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSChicken, 606, 455, 702, 568, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 3); + setHotspot(kHSExitBarn, 610, 75, 800, 164, SF_EXIT_U_CURSOR, 10, 3); + setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + setHotspot(kHSWalkArea1, 120, 0, 514, 458); + setHotspot(kHSWalkArea2, 0, 0, 800, 452); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 9; +} + +void GnapEngine::scene33_run() { + + playSound(0x1091C, 1); + startSoundTimerC(6); + queueInsertDeviceIcon(); + + _s33_dword_47EAEC = 0x7E; + _gameSys->setAnimation(0x7E, 179, 2); + _gameSys->insertSequence(_s33_dword_47EAEC, 179, 0, 0, kSeqNone, 0, 0, 0); + _s33_dword_47EAE4 = -1; + _timers[5] = getRandom(20) + 30; + _s33_dword_47EAE8 = -1; + _timers[4] = getRandom(100) + 300; + + switch (_prevSceneNum) { + case 34: + initGnapPos(11, 7, 3); + initBeaverPos(12, 7, 4); + endSceneInit(); + gnapWalkTo(8, 7, -1, 0x107BA, 1); + platypusWalkTo(9, 7, -1, 0x107D2, 1); + break; + case 37: + initGnapPos(7, 7, 1); + initBeaverPos(8, 7, 0); + endSceneInit(); + break; + case 32: + initGnapPos(-1, 6, 1); + initBeaverPos(-1, 7, 0); + endSceneInit(); + platypusWalkTo(2, 7, -1, 0x107C2, 1); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + break; + default: + initGnapPos(3, 7, 1); + initBeaverPos(2, 7, 0); + endSceneInit(); + break; + } + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + testWalk(0, 0, 7, 6, 8, 6); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + if (_gnapActionStatus < 0) { + runMenu(); + scene33_updateHotspots(); + } + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSChicken: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(7, 9, 9, 8); + } else { + switch (_verbCursor) { + case GRAB_CURSOR: + _gnapIdleFacing = 1; + if (gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _gnapActionStatus = 2; + else + _gnapActionStatus = -1; + break; + case TALK_CURSOR: + _gnapIdleFacing = 1; + gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 1; + break; + case LOOK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitHouse: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _gnapActionStatus = 0; + _newSceneNum = 37; + if (_gnapX > 6) + gnapWalkTo(_gnapX, _gnapY, 0, 0x107AD, 1); + else + gnapWalkTo(6, 7, 0, 0x107B1, 1); + } + break; + + case kHSExitBarn: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _gnapActionStatus = 0; + _newSceneNum = 35; + if (_gnapX > 7) + gnapWalkTo(_gnapX, _gnapY, 0, 0x107AD, 1); + else + gnapWalkTo(7, 7, 0, 0x107B1, 1); + } + break; + + case kHSExitCreek: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitCreek].x, _hotspotsWalkPos[kHSExitCreek].y, 0, 0x107AB, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitCreek].x, _hotspotsWalkPos[kHSExitCreek].y, -1, 0x107CD, 1); + _newSceneNum = 34; + } + break; + + case kHSExitPigpen: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitPigpen].x, _hotspotsWalkPos[kHSExitPigpen].y, 0, 0x107AF, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitPigpen].x, _hotspotsWalkPos[kHSExitPigpen].y, -1, 0x107CF, 1); + _newSceneNum = 32; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene33_updateAnimations(); + + if (!isSoundPlaying(0x1091C)) + playSound(0x1091C, 1); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(100) + 300; + if (getRandom(2) != 0) + _s33_dword_47EAE8 = 0x83; + else + _s33_dword_47EAE8 = 0x82; + _gameSys->insertSequence(_s33_dword_47EAE8, 256, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_timers[5] && _s33_dword_47EAE4 == -1 && _gnapActionStatus != 1 && _gnapActionStatus != 2) { + if (getRandom(6) != 0) { + _s33_dword_47EAE4 = 0x7E; + _timers[5] = getRandom(20) + 30; + } else { + _s33_dword_47EAE4 = 0x80; + _timers[5] = getRandom(20) + 50; + } + } + playSoundC(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene33_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene33_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + switch (_gnapActionStatus) { + case 0: + _sceneDone = true; + break; + case 1: + _s33_dword_47EAE4 = 0x7F; + break; + case 2: + _s33_dword_47EAE4 = 0x81; + _timers[2] = 100; + break; + case 3: + _gameSys->insertSequence(0x107B5, _gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceId = 0x7B5; + _gnapSequenceDatNum = 1; + _s33_dword_47EAEC = 0x7E; + _gameSys->setAnimation(0x7E, 179, 2); + _gameSys->insertSequence(_s33_dword_47EAEC, 179, 0, 0, kSeqNone, 0, 0, 0); + _gnapActionStatus = -1; + _timers[5] = 30; + break; + default: + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + if (_s33_dword_47EAE4 == 0x81) { + _gameSys->setAnimation(_s33_dword_47EAE4, 179, 0); + _gameSys->insertSequence(_s33_dword_47EAE4, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(_s33_dword_47EAEC, 179, 1); + _s33_dword_47EAE4 = -1; + _s33_dword_47EAEC = -1; + _gnapActionStatus = 3; + _timers[5] = 500; + } else if (_s33_dword_47EAE4 == 0x7F) { + _gameSys->setAnimation(_s33_dword_47EAE4, 179, 2); + _gameSys->insertSequence(_s33_dword_47EAE4, 179, _s33_dword_47EAEC, 179, kSeqSyncWait, 0, 0, 0); + _s33_dword_47EAEC = _s33_dword_47EAE4; + _s33_dword_47EAE4 = -1; + _gnapActionStatus = -1; + } else if (_s33_dword_47EAE4 != -1) { + _gameSys->setAnimation(_s33_dword_47EAE4, 179, 2); + _gameSys->insertSequence(_s33_dword_47EAE4, 179, _s33_dword_47EAEC, 179, kSeqSyncWait, 0, 0, 0); + _s33_dword_47EAEC = _s33_dword_47EAE4; + _s33_dword_47EAE4 = -1; + } + } + +} + +} // End of namespace Gnap + \ No newline at end of file diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp new file mode 100644 index 0000000000..cfbaf9dcaf --- /dev/null +++ b/engines/gnap/scenes/scene38.cpp @@ -0,0 +1,355 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitHouse = 1, + kHSExitCave = 2, + kHSTrapDoorLid1 = 3, + kHSTrapDoorLid2 = 4, + kHSHuntingTrophy = 5, + kHSWalkArea1 = 6, + kHSDevice = 7, + kHSWalkArea2 = 8, + kHSWalkArea3 = 9, + kHSWalkArea4 = 10, + kHSWalkArea5 = 11, + kHSWalkArea6 = 12 +}; + +int GnapEngine::scene38_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + return 0xA5; +} + +void GnapEngine::scene38_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); + setHotspot(kHSExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); + setHotspot(kHSTrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); + setHotspot(kHSTrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); + setHotspot(kHSHuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + setHotspot(kHSWalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + setHotspot(kHSWalkArea2, 0, 0, 799, 396); + setHotspot(kHSWalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); + setHotspot(kHSWalkArea4, 0, 0, 97, 445); + setHotspot(kHSWalkArea5, 770, 0, 799, 445); + setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_beaverActionStatus == 6) + _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_DISABLED; + if (_beaverActionStatus == 6) + _hotspots[kHSExitCave].flags = SF_EXIT_D_CURSOR; + else if (_gnapActionStatus == 3) + _hotspots[kHSExitCave].flags = SF_EXIT_D_CURSOR; + if (_beaverActionStatus == 6) + _hotspots[kHSTrapDoorLid1].flags = SF_DISABLED; + else if (_gnapActionStatus == 3) + _hotspots[kHSTrapDoorLid1].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_beaverActionStatus == 6) + _hotspots[kHSTrapDoorLid2].flags = SF_DISABLED; + else if (_gnapActionStatus == 3) + _hotspots[kHSTrapDoorLid2].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_beaverActionStatus == 6) + _hotspots[kHSWalkArea6].flags = 0; + _hotspotsCount = 13; +} + +void GnapEngine::scene38_run() { + + queueInsertDeviceIcon(); + _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + + if (_prevSceneNum == 39) { + initGnapPos(3, 7, 3); + initBeaverPos(4, 7, 4); + } else { + initGnapPos(3, 8, 1); + initBeaverPos(4, 8, 0); + } + endSceneInit(); + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene38_updateHotspots(); + break; + + case kHSPlatypus: + if (_gnapActionStatus == 3) { + _gnapActionStatus = 4; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + break; + + case kHSExitHouse: + if (_gnapActionStatus == 3) { + _gnapActionStatus = 4; + } else { + _isLeavingScene = 1; + gnapWalkTo(-1, -1, 0, 0x107AE, 1); + _gnapActionStatus = 0; + _newSceneNum = 37; + } + break; + + case kHSExitCave: + if (_gnapActionStatus == 3) { + _gnapActionStatus = 4; + if (_beaverActionStatus == 6) + _isLeavingScene = 1; + } else if (_beaverActionStatus == 6) { + _sceneWaiting = 0; + _isLeavingScene = 1; + gnapWalkTo(5, 7, 0, 0x107BB, 1); + _newSceneNum = 39; + _gnapActionStatus = 1; + } + break; + + case kHSTrapDoorLid1: + case kHSTrapDoorLid2: + if (_gnapActionStatus == 3) { + if (_beaverActionStatus == 6 && _verbCursor == PLAT_CURSOR) + _gnapActionStatus = 5; + else + _gnapActionStatus = 4; + } + break; + + case kHSHuntingTrophy: + if (_gnapActionStatus != 3) { + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(3, 6, 2, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(0, 0); + break; + case GRAB_CURSOR: + if (_beaverActionStatus == 6) + playGnapImpossible(0, 0); + else { + gnapWalkTo(3, 6, 0, 0x107BB, 1); + platypusWalkTo(4, 8, -1, -1, 1); + _gnapActionStatus = 2; + } + break; + case TALK_CURSOR: + playGnapBrainPulsating(2, 0); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSWalkArea1: + // Nothing + break; + + case kHSWalkArea2: + case kHSWalkArea3: + case kHSWalkArea4: + case kHSWalkArea5: + case kHSWalkArea6: + if (_gnapActionStatus == 3) + _gnapActionStatus = 4; + else if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left) { + if (_gnapActionStatus == 3) + _gnapActionStatus = 4; + else if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene38_updateAnimations(); + + if (!_isLeavingScene) { + updateBeaverIdleSequence(); + updateGnapIdleSequence(); + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene38_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene38_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 0: + _sceneDone = true; + break; + case 1: + _gameSys->removeSequence(_beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, 1); + _gameSys->insertSequence(0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0xA3; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0xA3, _gnapId, 0); + _gnapActionStatus = 0; + break; + case 2: + _gameSys->removeSequence(0x9B, 0, 1); + _gameSys->insertSequence(0x9C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x9C; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x9C, _gnapId, 0); + _gnapActionStatus = 3; + scene38_updateHotspots(); + break; + case 3: + if (_beaverActionStatus != 6) + _sceneWaiting = 1; + if (_gnapSequenceId == 0xA4) { + _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x9D; + } else { + _gameSys->insertSequence(0xA4, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0xA4; + } + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(_gnapSequenceId, _gnapId, 0); + break; + case 4: + if (_gnapSequenceId == 0x9E) { + _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + _gnapActionStatus = -1; + } else if (_beaverActionStatus == 6) { + _gameSys->insertSequence(0xA0, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0xA0; + _gnapSequenceDatNum = 0; + _gnapX = 3; + _gnapY = 6; + _gnapIdleFacing = 1; + if (_isLeavingScene) { + _sceneWaiting = 0; + gnapWalkTo(5, 7, 0, 0x107BB, 1); + _newSceneNum = 39; + _gnapActionStatus = 1; + } else { + _gnapActionStatus = -1; + } + } else { + _gameSys->insertSequence(0x9E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x9E; + _gnapSequenceDatNum = 0; + _gnapX = 3; + _gnapY = 6; + _gnapIdleFacing = 1; + _gameSys->setAnimation(0x9E, _gnapId, 0); + _sceneWaiting = 0; + scene38_updateHotspots(); + } + break; + case 5: + _sceneWaiting = 0; + _gameSys->insertSequence(0x9F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x9F; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x9F, _gnapId, 0); + _gnapActionStatus = 3; + if (_beaverFacing) + playBeaverSequence(0x107D5); + else + playBeaverSequence(0x107D4); + platypusWalkTo(8, 7, -1, 0x107D2, 1); + _gameSys->insertSequence(0xA1, _gnapId + 1, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceId = 0xA1; + _beaverSequenceDatNum = 0; + _beaverId = _gnapId + 1; + _gameSys->setAnimation(0xA1, _gnapId + 1, 1); + _beaverActionStatus = 6; + scene38_updateHotspots(); + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + if (_beaverActionStatus == 6) { + _gameSys->insertSequence(0xA2, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceId = 0xA2; + _beaverSequenceDatNum = 0; + scene38_updateHotspots(); + _sceneWaiting = true; + } + } + +} + +} // End of namespace Gnap + \ No newline at end of file diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp new file mode 100644 index 0000000000..7bf04de240 --- /dev/null +++ b/engines/gnap/scenes/scene39.cpp @@ -0,0 +1,237 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitInsideHouse = 1, + kHSExitUfoParty = 2, + kHSSign = 3, + kHSDevice = 4, + kHSWalkArea1 = 5, + kHSWalkArea2 = 6 +}; + +int GnapEngine::scene39_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + return 0x35; +} + +void GnapEngine::scene39_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitInsideHouse, 0, 0, 140, 206, SF_EXIT_U_CURSOR, 4, 8); + setHotspot(kHSExitUfoParty, 360, 204, 480, 430, SF_EXIT_R_CURSOR, 6, 8); + setHotspot(kHSSign, 528, 232, 607, 397, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 3); + setHotspot(kHSWalkArea1, 0, 0, 800, 466); + setHotspot(kHSWalkArea2, 502, 466, 800, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 7; +} + +void GnapEngine::scene39_run() { + + queueInsertDeviceIcon(); + _s39_dword_47EAF8 = 0x33; + + _gameSys->setAnimation(0x33, 21, 3); + _gameSys->insertSequence(_s39_dword_47EAF8, 21, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); + + _s39_dword_47EAFC = -1; + if (_prevSceneNum == 38) { + initGnapPos(3, 7, 7); + initBeaverPos(2, 7, 5); + endSceneInit(); + } else { + initGnapPos(4, 7, 1); + initBeaverPos(5, 7, 0); + endSceneInit(); + } + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094B)) { + playSound(0x1094B, 1); + setSoundVolume(0x1094B, 60); + } + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene39_updateHotspots(); + _timers[5] = getRandom(20) + 50; + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitUfoParty: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + _sceneDone = true; + gnapWalkTo(_gnapX, _gnapY, 0, 0x107AB, 1); + _gnapActionStatus = 0; + _newSceneNum = 40; + } + break; + + case kHSSign: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(0, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + gnapWalkTo(_hotspotsWalkPos[kHSSign].x, _hotspotsWalkPos[kHSSign].y, 0, -1, 1); + playGnapIdle(_hotspotsWalkPos[kHSSign].x, _hotspotsWalkPos[kHSSign].y); + showFullScreenSprite(0x1C); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSExitInsideHouse: + if (_gnapActionStatus < 0) { + _sceneDone = true; + _isLeavingScene = 1; + _newSceneNum = 38; + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) { + gnapWalkTo(-1, -1, -1, -1, 1); + _mouseClickState.left = false; + } + break; + + } + + scene39_updateAnimations(); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0) + updateGnapIdleSequence(); + if (!_timers[5]) { + _timers[5] = getRandom(20) + 50; + switch (getRandom(4)) { + case 0: + _s39_dword_47EAFC = 0x30; + break; + case 1: + _s39_dword_47EAFC = 0x31; + break; + case 2: + _s39_dword_47EAFC = 0x32; + break; + case 3: + _s39_dword_47EAFC = 0x33; + break; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene39_updateHotspots(); + _timers[5] = getRandom(20) + 50; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene39_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + if (_gnapActionStatus == 0) + _sceneDone = true; + else + _gnapActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(3) == 2 && _s39_dword_47EAFC != -1) { + _gameSys->setAnimation(_s39_dword_47EAFC, 21, 3); + _gameSys->insertSequence(_s39_dword_47EAFC, 21, _s39_dword_47EAF8, 21, kSeqSyncWait, 0, 0, 0); + _s39_dword_47EAF8 = _s39_dword_47EAFC; + _s39_dword_47EAFC = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp new file mode 100644 index 0000000000..fe91dbf777 --- /dev/null +++ b/engines/gnap/scenes/scene40.cpp @@ -0,0 +1,193 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitCave = 1, + kHSExitToyStand = 2, + kHSExitBBQ = 3, + kHSExitUfo = 4, + kHSExitKissinBooth = 5, + kHSExitDancefloor = 6, + kHSExitShoe = 7, + kHSDevice = 8 +}; + +int GnapEngine::scene40_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + return isFlag(23) ? 0x01 : 0x00; +} + +void GnapEngine::scene40_updateHotspots() { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_DISABLED | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitCave, 169, 510, 264, 600, SF_EXIT_D_CURSOR, 0, 8); + setHotspot(kHSExitToyStand, 238, 297, 328, 376, SF_EXIT_L_CURSOR, 0, 8); + setHotspot(kHSExitBBQ, 328, 220, 401, 306, SF_EXIT_L_CURSOR, 0, 8); + setHotspot(kHSExitUfo, 421, 215, 501, 282, SF_EXIT_U_CURSOR, 0, 8); + setHotspot(kHSExitKissinBooth, 476, 284, 556, 345, SF_EXIT_R_CURSOR, 0, 8); + setHotspot(kHSExitDancefloor, 317, 455, 445, 600, SF_EXIT_D_CURSOR, 0, 8); + setHotspot(kHSExitShoe, 455, 346, 549, 417, SF_EXIT_D_CURSOR, 0, 8); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 9; +} + +void GnapEngine::scene40_run() { + + queueInsertDeviceIcon(); + endSceneInit(); + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094B)) + playSound(0x1094B, 1); + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene40_updateHotspots(); + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitCave: + if (_gnapActionStatus < 0) { + _newSceneNum = 39; + _sceneDone = true; + } + break; + + case kHSExitToyStand: + if (_gnapActionStatus < 0) { + _newSceneNum = 41; + _sceneDone = true; + } + break; + + case kHSExitBBQ: + if (_gnapActionStatus < 0) { + _newSceneNum = 42; + _sceneDone = true; + } + break; + + case kHSExitUfo: + if (_gnapActionStatus < 0) { + _newSceneNum = 43; + _sceneDone = true; + } + break; + + case kHSExitKissinBooth: + if (_gnapActionStatus < 0) { + _newSceneNum = 44; + _sceneDone = true; + } + break; + + case kHSExitDancefloor: + if (_gnapActionStatus < 0) { + _newSceneNum = 45; + _sceneDone = true; + } + break; + + case kHSExitShoe: + if (_gnapActionStatus < 0) { + _newSceneNum = 46; + _sceneDone = true; + } + break; + + default: + if (_mouseClickState.left && _gnapActionStatus < 0) + _mouseClickState.left = false; + break; + + } + + scene40_updateAnimations(); + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene40_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene40_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + if (_gnapActionStatus) + _gnapActionStatus = -1; + else + _sceneDone = true; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp new file mode 100644 index 0000000000..60c5979ae7 --- /dev/null +++ b/engines/gnap/scenes/scene41.cpp @@ -0,0 +1,577 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitCave = 1, + kHSExit = 2, + kHSExitBBQ = 3, + kHSToyVendor = 4, + kHSKid = 5, + kHSToyUfo = 6, + kHSDevice = 7, + kHSWalkArea1 = 8 +}; + +enum { + kHSUfoExitLeft = 1, + kHSUfoExitRight = 2, + kHSUfoDevice = 3, + kHSUfoWalkArea1 = 4 +}; + +int GnapEngine::scene41_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + return 0x129; +} + +void GnapEngine::scene41_updateHotspots() { + if (isFlag(12)) { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + setHotspot(kHSUfoExitLeft, 0, 0, 10, 500, SF_EXIT_L_CURSOR | SF_DISABLED); + setHotspot(kHSUfoExitRight, 790, 0, 799, 500, SF_EXIT_R_CURSOR); + setHotspot(kHSUfoWalkArea1, 0, 0, 800, 470, SF_DISABLED); + setDeviceHotspot(kHSUfoDevice, -1, -1, -1, -1); + _hotspotsCount = 5; + } else { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitCave, 150, 590, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExit, 0, 100, 10, 599, SF_EXIT_L_CURSOR | SF_DISABLED, 0, 8); + setHotspot(kHSExitBBQ, 790, 100, 799, 599, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + setHotspot(kHSToyVendor, 320, 150, 430, 310, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSKid, 615, 340, 710, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSToyUfo, 0, 0, 0, 0, SF_GRAB_CURSOR); + setHotspot(kHSWalkArea1, 0, 0, 800, 470); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 9; + } +} + +void GnapEngine::scene41_run() { + + queueInsertDeviceIcon(); + + if (isFlag(12)) { + _toyUfoX = 770; + if (_toyUfoY < 0 || _toyUfoY > 300) + _toyUfoY = 150; + if (!_timers[9]) + _gnapActionStatus = 6; + } else { + if (!isFlag(16) && !isFlag(17) && !isFlag(18) && !isFlag(19)) + toyUfoSetStatus(16); + _toyUfoX = 600; + _toyUfoY = 200; + } + + _toyUfoId = 0; + _toyUfoActionStatus = -1; + _toyUfoSequenceId = toyUfoGetSequenceId(); + _toyUfoNextSequenceId = _toyUfoSequenceId; + + _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 2); + _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); + _gameSys->insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); + + if (isFlag(12)) + _s41_dword_47F2C4 = 0x11B; + else + _s41_dword_47F2C4 = 0x11D; + + _s41_dword_47F2C0 = -1; + + _gameSys->setAnimation(_s41_dword_47F2C4, 1, 4); + _gameSys->insertSequence(_s41_dword_47F2C4, 1, 0, 0, kSeqNone, 0, 0, 0); + + _s41_dword_47F2CC = 0x118; + _s41_dword_47F2C8 = -1; + + _gameSys->setAnimation(0x118, 1, 3); + _gameSys->insertSequence(_s41_dword_47F2CC, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(12)) { + _gnapSequenceId = 0x120; + _gnapSequenceDatNum = 0; + _gnapIdleFacing = 7; + _gnapX = 7; + _gnapY = 7; + _gnapId = 140; + _gameSys->insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); + initBeaverPos(8, 10, 3); + endSceneInit(); + } else if (_prevSceneNum == 45) { + initGnapPos(-1, 8, 7); + initBeaverPos(-2, 8, 5); + endSceneInit(); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + } else if (_prevSceneNum == 42) { + initGnapPos(11, 8, 7); + initBeaverPos(11, 9, 5); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 8, -1, 0x107D2, 1); + } else { + initGnapPos(5, 8, 1); + initBeaverPos(6, 8, 3); + endSceneInit(); + } + + _timers[4] = getRandom(100) + 100; + _timers[5] = getRandom(30) + 20; + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094B)) + playSound(0x1094B, 1); + + if (!isFlag(12)) { + _hotspots[kHSToyUfo].x1 = _toyUfoX - 25; + _hotspots[kHSToyUfo].y1 = _toyUfoY - 20; + _hotspots[kHSToyUfo].x2 = _toyUfoX + 25; + _hotspots[kHSToyUfo].y2 = _toyUfoY + 20; + } + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (isFlag(12)) { + + switch (_sceneClickedHotspot) { + + case kHSUfoExitLeft: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 7; + _newSceneNum = 45; + toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); + } + break; + + case kHSUfoExitRight: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 7; + _newSceneNum = 42; + toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); + } + break; + + case kHSUfoDevice: + runMenu(); + scene41_updateHotspots(); + _timers[4] = getRandom(100) + 100; + _timers[5] = getRandom(30) + 20; + break; + + } + + } else { + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene41_updateHotspots(); + _timers[4] = getRandom(100) + 100; + _timers[5] = getRandom(30) + 20; + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitCave: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitCave].x, _hotspotsWalkPos[kHSExitCave].y, 0, 0x107AE, 1); + _gnapActionStatus = 0; + _newSceneNum = 40; + break; + + case kHSExit: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExit].x, -1, 0, 0x107AF, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExit].x, -1, -1, 0x107CF, 1); + _newSceneNum = 45; + break; + + case kHSExitBBQ: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, -1, 0, 0x107AB, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, -1, -1, 0x107CD, 1); + _newSceneNum = 42; + break; + + case kHSToyVendor: + if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _gnapActionStatus = 1; + gnapWalkTo(4, 7, 0, 0x107BB, 9); + playGnapShowItem(_grabCursorSpriteIndex, 5, 0); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(4, 7, 5, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(5, 0); + break; + case GRAB_CURSOR: + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 2; + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSKid: + if (_grabCursorSpriteIndex == kItemChickenBucket) { + gnapWalkTo(7, 7, 0, 0x107BB, 1); + _gnapIdleFacing = 7; + _gnapActionStatus = 4; + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(7, 7, 8, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(9, 0); + break; + case GRAB_CURSOR: + gnapWalkTo(7, 7, 0, 0x107BB, 1); + _gnapIdleFacing = 7; + _gnapActionStatus = 5; + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(7, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSToyUfo: + if (_grabCursorSpriteIndex == kItemGum) { + playGnapPullOutDevice(9, 0); + _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); + _gnapActionStatus = 3; + } + break; + + case kHSWalkArea1: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + } + + } + + if (isFlag(12)) { + if (!_timers[9] && _gnapActionStatus < 0) { + _gnapActionStatus = 6; + if (_gnapSequenceId == 0x121 || _gnapSequenceId == 0x122) { + _gameSys->insertSequence(0x123, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x123; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x123, _gnapId, 0); + } + } + } + + if (_mouseClickState.left && _gnapActionStatus < 0) { + _mouseClickState.left = false; + if (isFlag(12)) { + int sequenceId; + if (_leftClickMouseX >= 400) { + if (_gnapSequenceId == 0x11F || _gnapSequenceId == 0x120 || _gnapSequenceId == 0x123 || _gnapSequenceId == 0x126) + sequenceId = 0x120; + else if (_leftClickMouseX - _toyUfoX >= 400) + sequenceId = 0x126; + else + sequenceId = 0x123; + } else { + if (_gnapSequenceId == 0x121 || _gnapSequenceId == 0x125 || _gnapSequenceId == 0x122) + sequenceId = 0x122; + else if (_toyUfoX - _leftClickMouseX >= 400) + sequenceId = 0x125; + else + sequenceId = 0x121; + } + _gameSys->insertSequence(sequenceId, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = sequenceId; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(sequenceId, _gnapId, 0); + _toyUfoActionStatus = 8; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + scene41_updateAnimations(); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0 && !isFlag(12)) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(100) + 100; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_dword_47F2C8 == -1) { + _gnapRandomValue = getRandom(3); + switch (_gnapRandomValue) { + case 0: + _s41_dword_47F2C8 = 0x113; + break; + case 1: + _s41_dword_47F2C8 = 0x117; + break; + case 2: + _s41_dword_47F2C8 = 0x119; + break; + } + if (_s41_dword_47F2C8 == _s41_dword_47F2CC) + _s41_dword_47F2C8 = -1; + } + } + if (!_timers[5]) { + _timers[5] = getRandom(30) + 20; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_dword_47F2C0 == -1) { + if (isFlag(12)) + _s41_dword_47F2C0 = 0x11B; + else if (getRandom(3) != 0) + _s41_dword_47F2C0 = 0x11D; + else + _s41_dword_47F2C0 = 0x11E; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene41_updateHotspots(); + _timers[4] = getRandom(100) + 100; + _timers[5] = getRandom(30) + 20; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene41_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + switch (_gnapActionStatus) { + case 0: + _gameSys->setAnimation(0, 0, 0); + _sceneDone = true; + _gnapActionStatus = -1; + break; + case 1: + _gameSys->setAnimation(0, 0, 0); + _s41_dword_47F2C8 = 0x114; + _gnapActionStatus = -1; + break; + case 2: + _gameSys->setAnimation(0, 0, 0); + _s41_dword_47F2C8 = 0x116; + _gnapActionStatus = -1; + break; + case 3: + _gameSys->setAnimation(0, 0, 0); + playGnapUseDevice(9, 0); + _gnapActionStatus = -1; + setGrabCursorSprite(-1); + invRemove(kItemGum); + _toyUfoActionStatus = 9; + break; + case 4: + if (_gameSys->getAnimationStatus(4) == 2) { + _timers[2] = getRandom(30) + 20; + _timers[3] = getRandom(50) + 200; + setGrabCursorSprite(-1); + _gameSys->insertSequence(0x11F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x11F; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x11F, _gnapId, 0); + _s41_dword_47F2C0 = 0x11A; + _gameSys->insertSequence(0x11A, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); + _s41_dword_47F2C4 = _s41_dword_47F2C0; + _s41_dword_47F2C0 = 0x11B; + _timers[5] = getRandom(30) + 20; + _gnapActionStatus = -1; + setFlag(12); + scene41_updateHotspots(); + _timers[9] = 600; + } + break; + case 5: + if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { + _timers[2] = getRandom(30) + 20; + _timers[3] = getRandom(50) + 200; + _gameSys->insertSequence(0x110, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x110; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x110, _gnapId, 0); + _s41_dword_47F2C8 = 0x111; + _gameSys->insertSequence(0x111, 1, _s41_dword_47F2CC, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_dword_47F2C8, 1, 3); + _s41_dword_47F2CC = _s41_dword_47F2C8; + _s41_dword_47F2C8 = -1; + _timers[4] = getRandom(100) + 100; + _s41_dword_47F2C0 = 0x10F; + _gameSys->insertSequence(0x10F, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); + _s41_dword_47F2C4 = _s41_dword_47F2C0; + _s41_dword_47F2C0 = -1; + _timers[5] = getRandom(30) + 20; + _gnapActionStatus = -1; + } + break; + case 6: + if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { + _timers[2] = getRandom(30) + 20; + _timers[3] = getRandom(50) + 200; + _gameSys->insertSequence(0x124, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x124; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x124, _gnapId, 0); + _s41_dword_47F2C8 = 0x112; + _gameSys->insertSequence(0x112, 1, _s41_dword_47F2CC, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_dword_47F2C8, 1, 3); + _s41_dword_47F2CC = _s41_dword_47F2C8; + _s41_dword_47F2C8 = -1; + _timers[4] = getRandom(100) + 100; + _s41_dword_47F2C0 = 0x11C; + _gameSys->insertSequence(0x11C, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); + _s41_dword_47F2C4 = _s41_dword_47F2C0; + _s41_dword_47F2C0 = -1; + _timers[5] = getRandom(30) + 20; + _gnapActionStatus = -1; + clearFlag(12); + scene41_updateHotspots(); + } + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + switch (_toyUfoActionStatus) { + case 7: + _sceneDone = true; + break; + case 9: + _toyUfoNextSequenceId = 0x873; + _gameSys->insertSequence(0x10873, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, + kSeqSyncWait, 0, _toyUfoX - 365, _toyUfoY - 128); + _toyUfoSequenceId = _toyUfoNextSequenceId; + _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 2); + toyUfoSetStatus(17); + break; + default: + _toyUfoNextSequenceId = toyUfoGetSequenceId(); + _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, _toyUfoSequenceId | 0x10000, _toyUfoId, + kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); + _toyUfoSequenceId = _toyUfoNextSequenceId; + ++_toyUfoId; + _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 2); + break; + } + _toyUfoActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(3) == 2 && _s41_dword_47F2C8 != -1) { + _gameSys->insertSequence(_s41_dword_47F2C8, 1, _s41_dword_47F2CC, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_dword_47F2C8, 1, 3); + _s41_dword_47F2CC = _s41_dword_47F2C8; + _s41_dword_47F2C8 = -1; + _timers[4] = getRandom(100) + 100; + } + + if (_gameSys->getAnimationStatus(4) == 2 && _s41_dword_47F2C0 != -1) { + _gameSys->insertSequence(_s41_dword_47F2C0, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); + _s41_dword_47F2C4 = _s41_dword_47F2C0; + _s41_dword_47F2C0 = -1; + _timers[5] = getRandom(30) + 20; + if (_s41_dword_47F2C4 == 0x11E) { + _toyUfoActionStatus = 8; + toyUfoFlyTo(getRandom(300) + 500, getRandom(225) + 75, 0, 799, 0, 300, 2); + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp new file mode 100644 index 0000000000..2f98a820a2 --- /dev/null +++ b/engines/gnap/scenes/scene42.cpp @@ -0,0 +1,494 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitUfoParty = 1, + kHSExitToyStand = 2, + kHSExitUfo = 3, + kHSBBQVendor = 4, + kHSChickenLeg = 5, + kHSDevice = 6, + kHSWalkArea1 = 7, + kHSWalkArea2 = 8 +}; + +enum { + kHSUfoExitLeft = 1, + kHSUfoExitRight = 2, + kHSUfoHotSauce = 3, + kHSUfoDevice = 4 +}; + +int GnapEngine::scene42_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + if (isFlag(20) || (isFlag(18) && isFlag(23))) + return 0x153; + return 0x152; +} + +void GnapEngine::scene42_updateHotspots() { + if (isFlag(12)) { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + setHotspot(kHSUfoHotSauce, 335, 110, 440, 175, SF_DISABLED); + setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + if ((isFlag(20) || isFlag(18)) && isFlag(23) && !isFlag(24)) + _hotspots[kHSUfoHotSauce].flags = SF_GRAB_CURSOR; + _hotspotsCount = 5; + } else { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitUfoParty, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitToyStand, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + setHotspot(kHSExitUfo, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + setHotspot(kHSBBQVendor, 410, 200, 520, 365, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 8); + setHotspot(kHSChickenLeg, 530, 340, 620, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 7); + setHotspot(kHSWalkArea1, 0, 0, 800, 445); + setHotspot(kHSWalkArea2, 240, 0, 550, 495); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 9; + } +} + +void GnapEngine::scene42_run() { + + queueInsertDeviceIcon(); + + _s42_dword_47F2B8 = 0x14A; + _s42_dword_47F2BC = -1; + + _gameSys->setAnimation(0x14A, 1, 2); + _gameSys->insertSequence(_s42_dword_47F2B8, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(12)) { + _toyUfoId = 0; + _toyUfoActionStatus = -1; + if (_prevSceneNum == 43 && isFlag(18)) { + _toyUfoSequenceId = 0x872; + _toyUfoNextSequenceId = toyUfoGetSequenceId(); + _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, 0, 0); + _toyUfoX = 317; + _toyUfoY = 61; + toyUfoSetStatus(17); + setFlag(20); + _timers[9] = 600; + } else { + _toyUfoSequenceId = toyUfoGetSequenceId(); + _toyUfoNextSequenceId = _toyUfoSequenceId; + if (_prevSceneNum == 41) + _toyUfoX = 30; + else + _toyUfoX = 770; + _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); + } + _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 3); + endSceneInit(); + if (_toyUfoSequenceId == 0x872) + setGrabCursorSprite(-1); + } else if (_prevSceneNum == 41) { + initGnapPos(-1, 8, 7); + initBeaverPos(-1, 9, 5); + endSceneInit(); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + } else if (_prevSceneNum == 43) { + initGnapPos(11, 8, 7); + initBeaverPos(11, 9, 5); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 8, -1, 0x107D2, 1); + } else { + initGnapPos(5, 11, 7); + initBeaverPos(6, 11, 5); + endSceneInit(); + gnapWalkTo(5, 8, -1, 0x107BA, 1); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094B)) + playSound(0x1094B, 1); + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (isFlag(12)) { + + switch (_sceneClickedHotspot) { + + case kHSUfoExitLeft: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = true; + _toyUfoActionStatus = 5; + _newSceneNum = 41; + toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + } + break; + + case kHSUfoExitRight: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = true; + _toyUfoActionStatus = 5; + _newSceneNum = 43; + toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + } + break; + + case kHSUfoHotSauce: + if (isFlag(17)) { + _toyUfoActionStatus = 7; + toyUfoFlyTo(384, 77, 0, 799, 0, 300, 3); + _timers[9] = 600; + } else { + _toyUfoActionStatus = 6; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } + break; + + case kHSUfoDevice: + runMenu(); + scene42_updateHotspots(); + break; + + } + + } else { + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene42_updateHotspots(); + _timers[4] = getRandom(20) + 30; + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitUfoParty: + _isLeavingScene = true; + gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _gnapActionStatus = 0; + platypusWalkTo(_platX, _hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); + _newSceneNum = 40; + break; + + case kHSExitToyStand: + _isLeavingScene = true; + gnapWalkTo(_hotspotsWalkPos[kHSExitToyStand].x, _gnapY, 0, 0x107AF, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitToyStand].x, _hotspotsWalkPos[kHSExitToyStand].y, -1, 0x107CF, 1); + _newSceneNum = 41; + break; + + case kHSExitUfo: + _isLeavingScene = true; + gnapWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _gnapY, 0, 0x107AB, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _hotspotsWalkPos[kHSExitUfo].y, -1, 0x107CD, 1); + _newSceneNum = 43; + break; + + case kHSBBQVendor: + if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { + gnapWalkTo(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, 0, 0x107BB, 1); + _gnapActionStatus = 2; + if (_platY < 9) + platypusWalkTo(_platX, 9, -1, -1, 1); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, _hotspotsWalkPos[kHSBBQVendor].x + 1, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_hotspotsWalkPos[kHSBBQVendor].x - 1, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 1; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSChickenLeg: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSChickenLeg].x, _hotspotsWalkPos[kHSChickenLeg].y, _hotspotsWalkPos[kHSChickenLeg].x - 1, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(_hotspotsWalkPos[kHSChickenLeg].x - 1, 0); + break; + case GRAB_CURSOR: + gnapWalkTo(_hotspotsWalkPos[kHSChickenLeg].x, _hotspotsWalkPos[kHSChickenLeg].y, 0, 0x107BC, 1); + _gnapActionStatus = 4; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + } + + if (_mouseClickState.left && _gnapActionStatus < 0) { + _mouseClickState.left = false; + if (isFlag(12)) { + _toyUfoActionStatus = 6; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + scene42_updateAnimations(); + + toyUfoCheckTimer(); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && !isFlag(12)) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0 && !isFlag(12)) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(20) + 30; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s42_dword_47F2BC == -1) { + _gnapRandomValue = getRandom(8); + switch (_gnapRandomValue) { + case 0: + _s42_dword_47F2BC = 0x14C; + break; + case 1: + case 2: + _s42_dword_47F2BC = 0x149; + break; + case 3: + case 4: + case 5: + case 6: + _s42_dword_47F2BC = 0x14D; + break; + case 7: + _s42_dword_47F2BC = 0x14A; + break; + } + if (_s42_dword_47F2BC == _s42_dword_47F2B8 && _s42_dword_47F2BC != 0x14D) + _s42_dword_47F2BC = -1; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene42_updateHotspots(); + _timers[4] = getRandom(20) + 30; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene42_updateAnimations() { + int sequenceId; + + if (_gameSys->getAnimationStatus(0) == 2) { + switch (_gnapActionStatus) { + case 0: + _gameSys->setAnimation(0, 0, 0); + _gnapActionStatus = -1; + _sceneDone = true; + break; + case 1: + _gameSys->setAnimation(0, 0, 0); + _gnapActionStatus = -1; + _s42_dword_47F2BC = 0x14B; + break; + case 3: + _gameSys->setAnimation(0, 0, 0); + setGrabCursorSprite(kItemChickenBucket); + _gnapActionStatus = -1; + break; + case 2: + case 4: + if (_gameSys->getAnimationStatus(2) == 2) { + if (_gnapActionStatus == 2) { + invRemove(kItemDiceQuarterHole); + invAdd(kItemChickenBucket); + setGrabCursorSprite(-1); + sequenceId = 0x150; + _s42_dword_47F2BC = 0x148; + } else if (isFlag(27)) { + if (isFlag(28)) { + sequenceId = 0x7B7; + _s42_dword_47F2BC = 0x145; + } else { + setFlag(28); + sequenceId = 0x14F; + _s42_dword_47F2BC = 0x147; + } + } else { + setFlag(27); + sequenceId = 0x14E; + _s42_dword_47F2BC = 0x146; + } + if (sequenceId == 0x7B7) { + _gameSys->insertSequence(0x107B7, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, getSequenceTotalDuration(_s42_dword_47F2BC), + 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + _gnapSequenceDatNum = 1; + } else { + _gameSys->insertSequence(sequenceId, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 0, 0); + _gnapSequenceDatNum = 0; + } + _gnapSequenceId = sequenceId; + _gameSys->setAnimation(sequenceId | (_gnapSequenceDatNum << 16), _gnapId, 0); + if (_gnapActionStatus == 2) + _gnapActionStatus = 3; + else + _gnapActionStatus = -1; + _gameSys->insertSequence(_s42_dword_47F2BC, 1, _s42_dword_47F2B8, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s42_dword_47F2BC, 1, 2); + _s42_dword_47F2B8 = _s42_dword_47F2BC; + if (_s42_dword_47F2BC == 0x145) + _s42_dword_47F2BC = 0x14A; + else + _s42_dword_47F2BC = -1; + _timers[4] = getRandom(20) + 30; + _timers[2] = getRandom(30) + 20; + _timers[3] = getRandom(50) + 200; + } + break; + default: + _gameSys->setAnimation(0, 0, 0); + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2 && _s42_dword_47F2BC != -1) { + _gameSys->insertSequence(_s42_dword_47F2BC, 1, _s42_dword_47F2B8, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s42_dword_47F2BC, 1, 2); + _s42_dword_47F2B8 = _s42_dword_47F2BC; + _s42_dword_47F2BC = -1; + _timers[4] = getRandom(20) + 30; + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_toyUfoActionStatus) { + case 5: + _sceneDone = true; + break; + case 7: + _gameSys->insertSequence(0x10870, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); + setFlag(24); + scene42_updateHotspots(); + toyUfoSetStatus(19); + _toyUfoSequenceId = 0x870; + _gameSys->setAnimation(0x10870, _toyUfoId, 3); + _toyUfoActionStatus = -1; + _toyUfoX = 0x181; + _toyUfoY = 53; + break; + default: + if (_toyUfoSequenceId == 0x872) { + hideCursor(); + addFullScreenSprite(0x13E, 255); + _gameSys->setAnimation(0x151, 256, 0); + _gameSys->insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + removeFullScreenSprite(); + showCursor(); + } + _toyUfoNextSequenceId = toyUfoGetSequenceId(); + _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, (_toyUfoId + 1) % 10, 3); + _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, (_toyUfoId + 1) % 10, + _toyUfoSequenceId | 0x10000, _toyUfoId, + kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); + _toyUfoSequenceId = _toyUfoNextSequenceId; + _toyUfoId = (_toyUfoId + 1) % 10; + break; + } + _toyUfoActionStatus = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp new file mode 100644 index 0000000000..3510cb4d99 --- /dev/null +++ b/engines/gnap/scenes/scene43.cpp @@ -0,0 +1,484 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSDevice = 1, + kHSExitUfoParty = 2, + kHSExitBBQ = 3, + kHSExitKissinBooth = 4, + kHSTwoHeadedGuy = 5, + kHSKey = 6, + kHSUfo = 7, + kHSWalkArea1 = 8, + kHSWalkArea2 = 9 +}; + +enum { + kHSUfoExitLeft = 1, + kHSUfoExitRight = 2, + kHSUfoKey = 3, + kHSUfoBucket = 4, + kHSUfoDevice = 5 +}; + +int GnapEngine::scene43_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + return 0x13F; +} + +void GnapEngine::scene43_updateHotspots() { + if (isFlag(12)) { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + setHotspot(kHSUfoKey, 140, 170, 185, 260, SF_GRAB_CURSOR); + setHotspot(kHSUfoBucket, 475, 290, 545, 365, SF_DISABLED); + setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + if (isFlag(19)) + _hotspots[kHSUfoBucket].flags = SF_GRAB_CURSOR; + // NOTE Bug in the original. Key hotspot wasn't disabled. + if (isFlag(14)) + _hotspots[kHSUfoKey].flags = SF_DISABLED; + _hotspotsCount = 6; + } else { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitBBQ, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + setHotspot(kHSExitKissinBooth, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + setHotspot(kHSTwoHeadedGuy, 470, 240, 700, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSKey, 140, 170, 185, 260, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSUfo, 110, 0, 690, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSWalkArea1, 0, 0, 800, 445); + setHotspot(kHSWalkArea2, 465, 0, 800, 493); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(14)) + _hotspots[kHSKey].flags = SF_DISABLED; + _hotspotsCount = 10; + } +} + +void GnapEngine::scene43_run() { + + queueInsertDeviceIcon(); + + if (!isFlag(14)) + _gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); + + _s43_dword_47F2B0 = 0x13C; + _s43_dword_47F2B4 = -1; + + _gameSys->setAnimation(0x13C, 1, 2); + _gameSys->insertSequence(_s43_dword_47F2B0, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(12)) { + _toyUfoId = 0; + _toyUfoActionStatus = -1; + _toyUfoSequenceId = toyUfoGetSequenceId(); + _toyUfoNextSequenceId = _toyUfoSequenceId; + if (_prevSceneNum == 42) + _toyUfoX = 30; + else + _toyUfoX = 770; + _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 3); + _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); + endSceneInit(); + } else { + switch (_prevSceneNum) { + case 42: + initGnapPos(-1, 8, 7); + initBeaverPos(-1, 9, 5); + endSceneInit(); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + break; + case 44: + initGnapPos(11, 8, 7); + initBeaverPos(11, 9, 5); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 8, -1, 0x107D2, 1); + break; + case 54: + initGnapPos(4, 7, 3); + initBeaverPos(11, 8, 5); + endSceneInit(); + platypusWalkTo(9, 8, -1, 0x107D2, 1); + break; + default: + initGnapPos(5, 11, 7); + initBeaverPos(6, 11, 5); + endSceneInit(); + gnapWalkTo(5, 8, -1, 0x107BA, 1); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + break; + } + } + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094B)) + playSound(0x1094B, 1); + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (isFlag(12)) { + + switch (_sceneClickedHotspot) { + + case kHSUfoDevice: + runMenu(); + scene43_updateHotspots(); + _timers[4] = getRandom(100) + 100; + break; + + case kHSUfoExitLeft: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 4; + _newSceneNum = 42; + toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + } + break; + + case kHSUfoExitRight: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 4; + _newSceneNum = 44; + toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + } + break; + + case kHSUfoKey: + if (isFlag(17)) { + _toyUfoActionStatus = 6; + toyUfoFlyTo(163, 145, 0, 799, 0, 300, 3); + } else { + _toyUfoActionStatus = 5; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } + break; + + case kHSUfoBucket: + _toyUfoActionStatus = 7; + toyUfoFlyTo(497, 143, 0, 799, 0, 300, 3); + _timers[9] = 600; + break; + } + + } else { + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene43_updateHotspots(); + _timers[4] = getRandom(100) + 100; + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitUfoParty: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); + _newSceneNum = 40; + break; + + case kHSExitBBQ: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, _gnapY, 0, 0x107AF, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, _hotspotsWalkPos[kHSExitBBQ].y, -1, 0x107CF, 1); + _newSceneNum = 42; + break; + + case kHSExitKissinBooth: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _gnapY, 0, 0x107AB, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _hotspotsWalkPos[kHSExitKissinBooth].y, -1, 0x107CD, 1); + _newSceneNum = 44; + break; + + case kHSTwoHeadedGuy: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(6, 8, 7, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(7, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 2; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSKey: + case kHSUfo: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(3, 7, 2, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(0, 0); + break; + case GRAB_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(3, 7, 0, 67515, 1); + _gnapActionStatus = 1; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + } + + if (_mouseClickState.left && _gnapActionStatus < 0) { + _mouseClickState.left = false; + if (isFlag(12) && (_toyUfoActionStatus == 5 || _toyUfoActionStatus == -1)) { + _toyUfoActionStatus = 5; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + scene43_updateAnimations(); + + toyUfoCheckTimer(); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && !isFlag(12)) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0 && !isFlag(12)) + updateGnapIdleSequence(); + if (!_timers[4] && (!isFlag(12) || !isFlag(19))) { + _timers[4] = getRandom(100) + 100; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s43_dword_47F2B4 == -1) { + _gnapRandomValue = getRandom(5); + switch (_gnapRandomValue) { + case 0: + _s43_dword_47F2B4 = 0x13C; + break; + case 1: + _s43_dword_47F2B4 = 0x134; + break; + case 2: + _s43_dword_47F2B4 = 0x135; + break; + case 3: + _s43_dword_47F2B4 = 0x136; + break; + case 4: + _s43_dword_47F2B4 = 0x13A; + break; + } + if (_s43_dword_47F2B4 == _s43_dword_47F2B0) + _s43_dword_47F2B4 = -1; + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene43_updateHotspots(); + _timers[4] = getRandom(100) + 100; + } + + gameUpdateTick(); + + } + + if (_newSceneNum == 54) + clearFlag(12); + +} + +void GnapEngine::scene43_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + switch (_gnapActionStatus) { + case 0: + _gameSys->setAnimation(0, 0, 0); + _sceneDone = true; + break; + case 1: + if (_gameSys->getAnimationStatus(2) == 2) { + _timers[2] = getRandom(30) + 20; + _timers[3] = getRandom(50) + 200; + _gameSys->insertSequence(0x13D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x13D; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x13D, _gnapId, 0); + _s43_dword_47F2B4 = 0x13B; + _gameSys->insertSequence(0x13B, 1, _s43_dword_47F2B0, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s43_dword_47F2B4, 1, 2); + _s43_dword_47F2B0 = _s43_dword_47F2B4; + _s43_dword_47F2B4 = -1; + _timers[4] = getRandom(100) + 100; + _gnapActionStatus = -1; + } + break; + default: + _gameSys->setAnimation(0, 0, 0); + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + if (_s43_dword_47F2B0 == 0x13A) { + if (isFlag(19)) { + _s43_dword_47F2B4 = 0x13E; + stopSound(0x108F6); + } else if (getRandom(2) != 0) { + _s43_dword_47F2B4 = 0x137; + } else { + _s43_dword_47F2B4 = 0x138; + } + } else if (_s43_dword_47F2B0 == 0x13E) { + _sceneDone = true; + _newSceneNum = 54; + } + if (_s43_dword_47F2B4 != -1) { + _gameSys->insertSequence(_s43_dword_47F2B4, 1, _s43_dword_47F2B0, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s43_dword_47F2B4, 1, 2); + _s43_dword_47F2B0 = _s43_dword_47F2B4; + _s43_dword_47F2B4 = -1; + _timers[4] = getRandom(100) + 100; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_toyUfoActionStatus) { + case 4: + _sceneDone = true; + _toyUfoActionStatus = -1; + break; + case 6: + _gameSys->insertSequence(0x10871, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(0x1086F, 1, 1); + setFlag(14); + scene43_updateHotspots(); + toyUfoSetStatus(18); + _toyUfoSequenceId = 0x871; + _gameSys->setAnimation(0x10871, _toyUfoId, 3); + _toyUfoActionStatus = -1; + _toyUfoX = 96; + _toyUfoY = 131; + break; + case 7: + _gameSys->insertSequence(0x10874, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); + _toyUfoSequenceId = 0x874; + _gameSys->setAnimation(0x10874, _toyUfoId, 3); + _toyUfoActionStatus = 8; + setFlag(17); + _gnapActionStatus = 3; + break; + case 8: + _s43_dword_47F2B4 = 0x13A; + _toyUfoX = 514; + _toyUfoY = 125; + toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); + _toyUfoActionStatus = 9; + break; + case 9: + // Nothing + break; + default: + _toyUfoNextSequenceId = toyUfoGetSequenceId(); + _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, + _toyUfoSequenceId | 0x10000, _toyUfoId, + kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); + _toyUfoSequenceId = _toyUfoNextSequenceId; + ++_toyUfoId; + _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 3); + _toyUfoActionStatus = -1; + break; + } + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp new file mode 100644 index 0000000000..b2c711898c --- /dev/null +++ b/engines/gnap/scenes/scene44.cpp @@ -0,0 +1,529 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitUfoParty = 1, + kHSExitUfo = 2, + kHSExitShow = 3, + kHSKissingLady = 4, + kHSSpring = 5, + kHSSpringGuy = 6, + kHSDevice = 7, + kHSWalkArea1 = 8, + kHSWalkArea2 = 9 +}; + +enum { + kHSUfoExitLeft = 1, + kHSUfoExitRight = 2, + kHSUfoDevice = 3 +}; + +int GnapEngine::scene44_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + _gameSys->setAnimation(0, 0, 3); + return 0xFF; +} + +void GnapEngine::scene44_updateHotspots() { + if (isFlag(12)) { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + _hotspotsCount = 4; + } else { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitUfo, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + setHotspot(kHSExitShow, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + setHotspot(kHSKissingLady, 300, 160, 400, 315, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + setHotspot(kHSSpring, 580, 310, 635, 375, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + setHotspot(kHSSpringGuy, 610, 375, 690, 515, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + setHotspot(kHSWalkArea1, 0, 0, 800, 445); + setHotspot(kHSWalkArea2, 617, 0, 800, 600); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(13)) + _hotspots[kHSKissingLady].flags = SF_DISABLED; + if (isFlag(15)) + _hotspots[kHSSpring].flags = SF_DISABLED; + _hotspotsCount = 10; + } +} + +void GnapEngine::scene44_run() { + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); + _gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(15)) + _s44_dword_47EB0C = 0xF8; + else + _s44_dword_47EB0C = 0xF9; + + _s44_dword_47EB04 = -1; + _gameSys->setAnimation(_s44_dword_47EB0C, 1, 4); + _gameSys->insertSequence(_s44_dword_47EB0C, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(13)) { + if (_prevSceneNum != 50 || _sceneSavegameLoaded) { + _s44_dword_47EB10 = 0xF6; + _s44_dword_47EB08 = -1; + } else { + setGrabCursorSprite(kItemGum); + _s44_dword_47EB10 = 0xF5; + _s44_dword_47EB08 = 0xF6; + _gameSys->setAnimation(0xF5, 1, 2); + } + } else { + _s44_dword_47EB10 = 0xEC; + _s44_dword_47EB08 = -1; + _gameSys->setAnimation(0xEC, 1, 2); + } + + _gameSys->insertSequence(_s44_dword_47EB10, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(12)) { + _toyUfoId = 0; + _toyUfoActionStatus = -1; + _toyUfoSequenceId = toyUfoGetSequenceId(); + _toyUfoNextSequenceId = _toyUfoSequenceId; + if (_prevSceneNum == 43) + _toyUfoX = 30; + else + _toyUfoX = 770; + _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 3); + _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); + endSceneInit(); + } else { + switch (_prevSceneNum) { + case 43: + initGnapPos(-1, 8, 7); + initBeaverPos(-1, 7, 5); + endSceneInit(); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + break; + case 46: + initGnapPos(11, 8, 7); + initBeaverPos(11, 8, 5); + endSceneInit(); + gnapWalkTo(6, 8, -1, 0x107BA, 1); + platypusWalkTo(7, 8, -1, 0x107D2, 1); + break; + case 50: + initGnapPos(4, 8, 1); + if (_sceneSavegameLoaded) { + initBeaverPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 4); + } else if (!isFlag(13)) { + _timers[0] = 50; + _timers[1] = 20; + _platX = 5; + _platY = 8; + _beaverSequenceId = 0xFD; + _beaverFacing = 0; + _beaverId = 160; + _beaverSequenceDatNum = 0; + _gameSys->insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); + } + endSceneInit(); + break; + default: + initGnapPos(5, 11, 7); + initBeaverPos(6, 11, 5); + endSceneInit(); + platypusWalkTo(6, 8, -1, 0x107C2, 1); + gnapWalkTo(5, 8, -1, 0x107BA, 1); + break; + } + } + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094B)) + playSound(0x1094B, 1); + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (isFlag(12)) { + + switch (_sceneClickedHotspot) { + + case kHSUfoExitLeft: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 6; + _newSceneNum = 43; + toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + } + break; + + case kHSUfoExitRight: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 6; + _newSceneNum = 46; + toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + } + break; + + case kHSUfoDevice: + runMenu(); + scene44_updateHotspots(); + _timers[4] = getRandom(20) + 20; + break; + + } + + } else if (_sceneClickedHotspot <= 9) { + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene44_updateHotspots(); + _timers[4] = getRandom(20) + 20; + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitUfoParty: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _gnapActionStatus = 0; + _newSceneNum = 40; + break; + + case kHSExitUfo: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _gnapY, 0, 0x107AF, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _platY, -1, 0x107CF, 1); + _newSceneNum = 43; + break; + + case kHSExitShow: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitShow].x, _hotspotsWalkPos[kHSExitShow].y, 0, 0x107AB, 1); + _gnapActionStatus = 0; + _newSceneNum = 46; + break; + + case kHSKissingLady: + if (_grabCursorSpriteIndex >= 0) { + _gnapActionStatus = 2; + gnapWalkTo(_hotspotsWalkPos[kHSKissingLady].x, _hotspotsWalkPos[kHSKissingLady].y, 0, -1, 9); + playGnapShowItem(_grabCursorSpriteIndex, _hotspotsWalkPos[kHSKissingLady].x - 1, _hotspotsWalkPos[kHSKissingLady].y); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(4, 3); + break; + case GRAB_CURSOR: + playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSKissingLady].x, _hotspotsWalkPos[kHSKissingLady].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 1; + break; + case PLAT_CURSOR: + gnapUseDeviceOnBeaver(); + platypusWalkTo(6, 7, 1, 0x107D2, 1); + if (_gnapX == 7 && _gnapY == 7) + gnapWalkStep(); + playGnapIdle(5, 7); + _beaverActionStatus = 4; + break; + } + } + break; + + case kHSSpring: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSSpring].x, _hotspotsWalkPos[kHSSpring].y, 8, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(8, 7); + break; + case GRAB_CURSOR: + playGnapPullOutDevice(8, 0); + playGnapUseDevice(8, 0); + _s44_dword_47EB04 = 0xFB; + invAdd(kItemSpring); + setFlag(15); + scene44_updateHotspots(); + break; + case TALK_CURSOR: + playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSSpringGuy: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSSpringGuy].x, _hotspotsWalkPos[kHSSpringGuy].y, 8, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + if (isFlag(15)) + playGnapMoan1(8, 7); + else + playGnapScratchingHead(8, 7); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSSpringGuy].x, _hotspotsWalkPos[kHSSpringGuy].y, -1, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSWalkArea1: + case kHSWalkArea2: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + } + + if (_mouseClickState.left && _gnapActionStatus < 0) { + _mouseClickState.left = false; + if (isFlag(12)) { + _toyUfoActionStatus = 7; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + scene44_updateAnimations(); + + toyUfoCheckTimer(); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && !isFlag(12) && _s44_dword_47EB10 != 0xF5) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0 && !isFlag(12)) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(20) + 20; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_dword_47EB08 == -1) { + _gnapRandomValue = getRandom(20); + switch (_gnapRandomValue) { + case 0: + _s44_dword_47EB08 = 0xED; + break; + case 1: + _s44_dword_47EB08 = 0xEE; + break; + case 2: + _s44_dword_47EB08 = 0xF0; + break; + case 3: + _s44_dword_47EB08 = 0xF3; + break; + case 4: + _s44_dword_47EB08 = 0xF4; + break; + default: + _s44_dword_47EB08 = 0xEC; + break; + } + if (_s44_dword_47EB08 != 0xEC && _s44_dword_47EB08 == _s44_dword_47EB10) + _s44_dword_47EB08 = -1; + } + } + if (!_timers[5]) { + _timers[5] = getRandom(20) + 20; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_dword_47EB04 == -1) { + _gnapRandomValue = getRandom(5); + if (_gnapRandomValue != 0) { + if (!isFlag(15)) + _s44_dword_47EB04 = 0xF9; + } else { + if (isFlag(15)) + _s44_dword_47EB04 = 0xF8; + else + _s44_dword_47EB04 = 0xFA; + } + } + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene44_updateHotspots(); + _timers[4] = getRandom(20) + 20; + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene44_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 0: + _sceneDone = true; + break; + case 1: + _s44_dword_47EB08 = 0xEF; + break; + case 2: + _s44_dword_47EB08 = 0xF2; + break; + } + _gnapActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + switch (_beaverActionStatus) { + case 4: + if (_gameSys->getAnimationStatus(2) == 2) { + _gameSys->insertSequence(0xFE, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _beaverSequenceId = 0xFE; + _beaverSequenceDatNum = 0; + _gameSys->setAnimation(0xFE, _beaverId, 1); + _gameSys->removeSequence(_s44_dword_47EB10, 1, 1); + _beaverActionStatus = 5; + } + break; + case 5: + _sceneDone = true; + _newSceneNum = 50; + break; + default: + _beaverActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(2) == 2) { + if (_s44_dword_47EB08 == 0xF6) { + _gameSys->insertSequence(_s44_dword_47EB08, 1, _s44_dword_47EB10, 1, kSeqSyncWait, 0, 0, 0); + initBeaverPos(5, 8, 0); + _s44_dword_47EB10 = _s44_dword_47EB08; + _s44_dword_47EB08 = -1; + _gameSys->setAnimation(0, 0, 2); + } else if (_s44_dword_47EB08 != -1) { + _gameSys->insertSequence(_s44_dword_47EB08, 1, _s44_dword_47EB10, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s44_dword_47EB08, 1, 2); + _s44_dword_47EB10 = _s44_dword_47EB08; + _s44_dword_47EB08 = -1; + _timers[4] = getRandom(20) + 20; + } + } + + if (_gameSys->getAnimationStatus(4) == 2) { + if (_s44_dword_47EB0C == 0xFB) { + setGrabCursorSprite(kItemSpring); + _s44_dword_47EB04 = 0xF8; + } + if (_s44_dword_47EB04 != -1) { + _gameSys->insertSequence(_s44_dword_47EB04, 1, _s44_dword_47EB0C, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s44_dword_47EB04, 1, 4); + _s44_dword_47EB0C = _s44_dword_47EB04; + _s44_dword_47EB04 = -1; + _timers[5] = getRandom(20) + 20; + } + } + + if (_gameSys->getAnimationStatus(3) == 2) { + switch (_toyUfoActionStatus) { + case 6: + _sceneDone = true; + break; + default: + _toyUfoNextSequenceId = toyUfoGetSequenceId(); + _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, + _toyUfoSequenceId | 0x10000, _toyUfoId, + kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); + _toyUfoSequenceId = _toyUfoNextSequenceId; + ++_toyUfoId; + _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 3); + break; + } + _toyUfoActionStatus = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp new file mode 100644 index 0000000000..ba583045e5 --- /dev/null +++ b/engines/gnap/scenes/scene45.cpp @@ -0,0 +1,430 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitUfoParty = 1, + kHSExitShoe = 2, + kHSExitRight = 3, + kHSExitDiscoBall = 4, + kHSDiscoBall = 5, + kHSDevice = 6, + kHSWalkArea1 = 7 +}; + +enum { + kHSUfoExitLeft = 1, + kHSUfoExitRight = 2, + kHSUfoDevice = 3 +}; + +int GnapEngine::scene45_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + _gameSys->setAnimation(0, 0, 3); + _gameSys->setAnimation(0, 0, 4); + _gameSys->setAnimation(0, 0, 5); + return isFlag(23) ? 0xA2 : 0xA1; +} + +void GnapEngine::scene45_updateHotspots() { + if (isFlag(12)) { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + setHotspot(kHSUfoExitRight, 794, 0, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED); + setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + _hotspotsCount = 4; + } else { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitShoe, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + setHotspot(kHSExitRight, 794, 100, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED, 10, 8); + setHotspot(kHSExitDiscoBall, 200, 0, 600, 10, SF_DISABLED); + setHotspot(kHSDiscoBall, 370, 10, 470, 125, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + setHotspot(kHSWalkArea1, 0, 0, 800, 472); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (isFlag(22)) { + _hotspots[kHSPlatypus].flags = SF_DISABLED; + _hotspots[kHSExitUfoParty].flags = SF_DISABLED; + _hotspots[kHSExitShoe].flags = SF_DISABLED; + _hotspots[kHSExitRight].flags = SF_DISABLED; + _hotspots[kHSExitDiscoBall].flags = SF_EXIT_U_CURSOR; + } + if (isFlag(23) || isFlag(22)) + _hotspots[kHSDiscoBall].flags = SF_DISABLED; + _hotspotsCount = 8; + } +} + +void GnapEngine::scene45_run() { + + if (!isSoundPlaying(0x1094A)) + playSound(0x1094A, 1); + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(0x96, 1, 3); + _gameSys->insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(0x99, 1, 4); + _s45_dword_4749BC = 0x8F; + _gameSys->setAnimation(0x8F, 1, 2); + _gameSys->insertSequence(_s45_dword_4749BC, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(12)) { + _toyUfoId = 0; + _toyUfoActionStatus = -1; + _toyUfoSequenceId = toyUfoGetSequenceId(); + _toyUfoNextSequenceId = _toyUfoSequenceId; + if (_prevSceneNum == 46) + _toyUfoX = 30; + else + _toyUfoX = 770; + _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 5); + _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); + endSceneInit(); + } else if (isFlag(22)) { + _gnapSequenceId = 0x9E; + _gnapSequenceDatNum = 0; + _gnapId = 1; + _gameSys->setAnimation(0x9E, 1, 0); + _gnapActionStatus = 1; + _gameSys->insertSequence(_gnapSequenceId, _gnapId, 0, 0, kSeqNone, 0, 0, 0); + initBeaverPos(4, 8, 0); + endSceneInit(); + } else if (_prevSceneNum == 46) { + initGnapPos(-1, 8, 7); + initBeaverPos(-1, 9, 5); + endSceneInit(); + platypusWalkTo(4, 8, -1, 0x107C2, 1); + gnapWalkTo(2, 7, -1, 0x107B9, 1); + } else if (_prevSceneNum == 41) { + initGnapPos(11, 8, 7); + initBeaverPos(11, 9, 5); + endSceneInit(); + platypusWalkTo(4, 8, -1, 0x107D2, 1); + gnapWalkTo(10, 9, -1, 0x107BA, 1); + } else { + initGnapPos(2, 11, 7); + initBeaverPos(6, 11, 5); + endSceneInit(); + platypusWalkTo(4, 8, -1, 0x107C2, 1); + gnapWalkTo(2, 7, -1, 0x107B9, 1); + } + + if (!isFlag(21) && !isFlag(12)) { + setFlag(21); + setGrabCursorSprite(-1); + _gameSys->setAnimation(0x9D, _gnapId, 0); + _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) { + gameUpdateTick(); + if (_gameSys->getAnimationStatus(2) == 2) { + _gameSys->setAnimation(0, 0, 2); + _gnapRandomValue = getRandom(7); + _s45_dword_4749C0 = _gnapRandomValue + 0x8F; + _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_dword_4749BC, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s45_dword_4749C0, 1, 2); + _s45_dword_4749BC = _s45_dword_4749C0; + } + if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { + _gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x96, 1, 3); + _gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x99, 1, 4); + } + } + _gnapSequenceId = 0x9D; + _gnapSequenceDatNum = 0; + hideCursor(); + addFullScreenSprite(0x8A, 255); + _gameSys->setAnimation(0xA0, 256, 0); + _gameSys->insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_gameSys->getAnimationStatus(0) != 2) + gameUpdateTick(); + _gameSys->setAnimation(0x107BD, _gnapId, 0); + _gameSys->insertSequence(0x107BD, _gnapId, + makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + removeFullScreenSprite(); + showCursor(); + _gnapSequenceId = 0x7BD; + _gnapSequenceDatNum = 1; + } + + playBeaverSequence(0x9A); + _gameSys->setAnimation(_beaverSequenceId, _beaverId, 1); + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094A)) + playSound(0x1094A, 1); + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (isFlag(12)) { + + switch (_sceneClickedHotspot) { + + case kHSUfoExitLeft: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 2; + _newSceneNum = 46; + toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 5); + } + break; + + case kHSUfoExitRight: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 2; + _newSceneNum = 41; + toyUfoFlyTo(835, -1, 0, 835, 0, 300, 5); + } + break; + + case kHSUfoDevice: + runMenu(); + scene45_updateHotspots(); + break; + + } + + } else { + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene45_updateHotspots(); + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + playBeaverSequence(0x9A); + _gameSys->setAnimation(_beaverSequenceId, _beaverId, 1); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSExitUfoParty: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _gnapActionStatus = 0; + _newSceneNum = 40; + } + break; + + case kHSExitShoe: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitShoe].x, _gnapY, 0, 0x107AF, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitShoe].x, _platY, -1, 0x107CF, 1); + _newSceneNum = 46; + } + break; + + case kHSExitRight: + if (_gnapActionStatus < 0) { + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitRight].x, _gnapY, 0, 0x107AB, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitRight].x, _platY, -1, 0x107CD, 1); + _newSceneNum = 41; + } + break; + + case kHSExitDiscoBall: + clearFlag(22); + setFlag(23); + _sceneDone = true; + _newSceneNum = 54; + break; + + case kHSDiscoBall: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex == kItemSpring) { + gnapWalkTo(_hotspotsWalkPos[kHSDiscoBall].x, _hotspotsWalkPos[kHSDiscoBall].y, 0, 0x9F, 5); + _gnapActionStatus = 1; + setGrabCursorSprite(-1); + invRemove(kItemSpring); + } else if (_grabCursorSpriteIndex >= 0) { + playGnapShowItem(_grabCursorSpriteIndex, 5, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapScratchingHead(5, 0); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHSWalkArea1: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + } + + if (_mouseClickState.left && _gnapActionStatus < 0) { + _mouseClickState.left = false; + if (isFlag(12)) { + _toyUfoActionStatus = 3; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + scene45_updateAnimations(); + toyUfoCheckTimer(); + + if (!_isLeavingScene && _gnapActionStatus < 0 && !isFlag(12)) + updateGnapIdleSequence(); + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene45_updateHotspots(); + } + + gameUpdateTick(); + + } + + _sceneWaiting = 0; + +} + +void GnapEngine::scene45_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 0: + _sceneDone = true; + break; + case 1: + _sceneWaiting = 1; + setFlag(22); + scene45_updateHotspots(); + _gameSys->insertSequence(0x9E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gnapSequenceId = 0x9E; + _gnapSequenceDatNum = 0; + _gameSys->setAnimation(0x9E, _gnapId, 0); + break; + default: + _gnapActionStatus = -1; + break; + } + } + + if (_gameSys->getAnimationStatus(1) == 2) { + _gameSys->setAnimation(0, 0, 1); + if (getRandom(2) != 0) + playBeaverSequence(0x9B); + else + playBeaverSequence(0x9C); + _gameSys->setAnimation(_beaverSequenceId, _beaverId, 1); + } + + if (_gameSys->getAnimationStatus(2) == 2) { + _gameSys->setAnimation(0, 0, 2); + _gnapRandomValue = getRandom(7); + _s45_dword_4749C0 = _gnapRandomValue + 0x8F; + _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_dword_4749BC, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s45_dword_4749C0, 1, 2); + _s45_dword_4749BC = _s45_dword_4749C0; + } + + if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { + _gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x96, 1, 3); + _gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0x99, 1, 4); + } + + if (_gameSys->getAnimationStatus(5) == 2) { + switch (_toyUfoActionStatus) { + case 2: + _sceneDone = true; + break; + default: + _toyUfoNextSequenceId = toyUfoGetSequenceId(); + _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, + _toyUfoSequenceId | 0x10000, _toyUfoId, + kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); + _toyUfoSequenceId = _toyUfoNextSequenceId; + ++_toyUfoId; + _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 5); + break; + } + _toyUfoActionStatus = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp new file mode 100644 index 0000000000..86855bbdf2 --- /dev/null +++ b/engines/gnap/scenes/scene46.cpp @@ -0,0 +1,378 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +enum { + kHSPlatypus = 0, + kHSExitUfoParty = 1, + kHSExitKissinBooth = 2, + kHSExitDisco = 3, + kHSSackGuy = 4, + kHSItchyGuy = 5, + kHSDevice = 6, + kHSWalkArea1 = 7 +}; + +enum { + kHSUfoExitLeft = 1, + kHSUfoExitRight = 2, + kHSUfoDevice = 3 +}; + +int GnapEngine::scene46_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + _gameSys->setAnimation(0, 0, 2); + _gameSys->setAnimation(0, 0, 3); + _gameSys->setAnimation(0, 0, 4); + return 0x4E; +} + +void GnapEngine::scene46_updateHotspots() { + if (isFlag(12)) { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + _hotspotsCount = 4; + } else { + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSExitKissinBooth, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + setHotspot(kHSExitDisco, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + setHotspot(kHSSackGuy, 180, 370, 235, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + setHotspot(kHSItchyGuy, 535, 210, 650, 480, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + setHotspot(kHSWalkArea1, 0, 0, 800, 485); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _hotspotsCount = 8; + } +} + +void GnapEngine::scene46_run() { + + queueInsertDeviceIcon(); + + _gameSys->insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); + + _s46_dword_47EB18 = 0x4B; + _s46_dword_47EB20 = -1; + _gameSys->setAnimation(0x4B, 1, 3); + _gameSys->insertSequence(_s46_dword_47EB18, 1, 0, 0, kSeqNone, 0, 0, 0); + + _s46_dword_47EB24 = 0x47; + _s46_dword_47EB1C = -1; + _gameSys->setAnimation(0x47, 1, 4); + _gameSys->insertSequence(_s46_dword_47EB24, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (isFlag(12)) { + _toyUfoId = 0; + _toyUfoActionStatus = -1; + _toyUfoSequenceId = toyUfoGetSequenceId(); + _toyUfoNextSequenceId = _toyUfoSequenceId; + if (_prevSceneNum == 44) + _toyUfoX = 30; + else + _toyUfoX = 770; + _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 2); + _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); + endSceneInit(); + } else if (_prevSceneNum == 44) { + initGnapPos(-1, 8, 7); + initBeaverPos(-1, 8, 5); + endSceneInit(); + platypusWalkTo(1, 8, -1, 0x107C2, 1); + gnapWalkTo(2, 8, -1, 0x107B9, 1); + } else if (_prevSceneNum == 45) { + initGnapPos(11, 8, 7); + initBeaverPos(12, 8, 5); + endSceneInit(); + gnapWalkTo(8, 8, -1, 0x107BA, 1); + platypusWalkTo(9, 8, -1, 0x107D2, 1); + } else { + initGnapPos(5, 11, 7); + initBeaverPos(6, 11, 5); + endSceneInit(); + platypusWalkTo(5, 8, -1, 0x107C2, 1); + gnapWalkTo(6, 8, -1, 0x107BA, 1); + } + + _timers[4] = getRandom(50) + 80; + _timers[5] = getRandom(50) + 80; + + while (!_sceneDone) { + + if (!isSoundPlaying(0x1094B)) + playSound(0x1094B, 1); + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + if (isFlag(12)) { + + switch (_sceneClickedHotspot) { + + case kHSUfoExitLeft: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 3; + _newSceneNum = 44; + toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); + } + break; + + case kHSUfoExitRight: + if (_toyUfoActionStatus < 0) { + _isLeavingScene = 1; + _toyUfoActionStatus = 3; + _newSceneNum = 45; + toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); + } + break; + + case kHSUfoDevice: + runMenu(); + scene46_updateHotspots(); + break; + } + + } else { + + switch (_sceneClickedHotspot) { + + case kHSDevice: + runMenu(); + scene46_updateHotspots(); + break; + + case kHSPlatypus: + if (_gnapActionStatus < 0) { + if (_grabCursorSpriteIndex >= 0) { + playGnapImpossible(_platX, _platY); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_platX, _platY); + break; + case GRAB_CURSOR: + gnapKissPlatypus(0); + break; + case TALK_CURSOR: + playGnapBrainPulsating(_platX, _platY); + playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + break; + case PLAT_CURSOR: + playGnapImpossible(_platX, _platY); + break; + } + } + } + break; + + case kHSSackGuy: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSSackGuy].x, _hotspotsWalkPos[kHSSackGuy].y, 2, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_hotspotsWalkPos[kHSSackGuy].x + 1, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 5; + gnapWalkTo(_hotspotsWalkPos[kHSSackGuy].x, _hotspotsWalkPos[kHSSackGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 2; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSItchyGuy: + if (_grabCursorSpriteIndex >= 0) { + playGnapShowCurrItem(_hotspotsWalkPos[kHSItchyGuy].x, _hotspotsWalkPos[kHSItchyGuy].y, 7, 0); + } else { + switch (_verbCursor) { + case LOOK_CURSOR: + playGnapMoan1(_hotspotsWalkPos[kHSItchyGuy].x - 1, 0); + break; + case TALK_CURSOR: + _gnapIdleFacing = 7; + gnapWalkTo(_hotspotsWalkPos[kHSItchyGuy].x, _hotspotsWalkPos[kHSItchyGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _gnapActionStatus = 1; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + playGnapImpossible(0, 0); + break; + } + } + break; + + case kHSExitUfoParty: + _isLeavingScene = 1; + gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _gnapActionStatus = 0; + _newSceneNum = 40; + break; + + case kHSExitKissinBooth: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _gnapY, 0, 0x107AF, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _platY, -1, 0x107CF, 1); + _newSceneNum = 44; + break; + + case kHSExitDisco: + _isLeavingScene = 1; + gnapWalkTo(_hotspotsWalkPos[kHSExitDisco].x, _gnapY, 0, 0x107AB, 1); + _gnapActionStatus = 0; + platypusWalkTo(_hotspotsWalkPos[kHSExitDisco].x, _platY, -1, 0x107CD, 1); + _newSceneNum = 45; + break; + + case kHSWalkArea1: + if (_gnapActionStatus < 0) + gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + } + + if (_mouseClickState.left && _gnapActionStatus < 0) { + _mouseClickState.left = false; + if (isFlag(12)) { + _toyUfoActionStatus = 4; + toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); + } else { + gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + scene46_updateAnimations(); + + toyUfoCheckTimer(); + + if (!_isLeavingScene) { + if (_beaverActionStatus < 0 && !isFlag(12)) + updateBeaverIdleSequence(); + if (_gnapActionStatus < 0 && !isFlag(12)) + updateGnapIdleSequence(); + if (!_timers[4]) { + _timers[4] = getRandom(50) + 80; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_dword_47EB1C == -1) { + _gnapRandomValue = getRandom(2); + if (_gnapRandomValue != 0) + _s46_dword_47EB1C = 0x49; + else + _s46_dword_47EB1C = 0x48; + } + } + if (!_timers[5]) { + _timers[5] = getRandom(50) + 80; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_dword_47EB20 == -1) + _s46_dword_47EB20 = 0x4C; + } + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene46_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +void GnapEngine::scene46_updateAnimations() { + + if (_gameSys->getAnimationStatus(0) == 2) { + _gameSys->setAnimation(0, 0, 0); + switch (_gnapActionStatus) { + case 0: + _sceneDone = true; + break; + case 1: + _s46_dword_47EB1C = 0x46; + break; + case 2: + _s46_dword_47EB20 = 0x4A; + break; + } + _gnapActionStatus = -1; + } + + if (_gameSys->getAnimationStatus(3) == 2 && _s46_dword_47EB20 != -1) { + _gameSys->insertSequence(_s46_dword_47EB20, 1, _s46_dword_47EB18, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s46_dword_47EB20, 1, 3); + _s46_dword_47EB18 = _s46_dword_47EB20; + _s46_dword_47EB20 = -1; + _timers[5] = getRandom(50) + 80; + } + + if (_gameSys->getAnimationStatus(4) == 2 && _s46_dword_47EB1C != -1) { + _gameSys->insertSequence(_s46_dword_47EB1C, 1, _s46_dword_47EB24, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s46_dword_47EB1C, 1, 4); + _s46_dword_47EB24 = _s46_dword_47EB1C; + _s46_dword_47EB1C = -1; + _timers[4] = getRandom(50) + 80; + } + + if (_gameSys->getAnimationStatus(2) == 2) { + switch (_toyUfoActionStatus) { + case 3: + _sceneDone = true; + break; + default: + _toyUfoNextSequenceId = toyUfoGetSequenceId(); + _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, + _toyUfoSequenceId | 0x10000, _toyUfoId, + kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); + _toyUfoSequenceId = _toyUfoNextSequenceId; + ++_toyUfoId; + _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 2); + break; + } + _toyUfoActionStatus = -1; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp new file mode 100644 index 0000000000..2e735e3650 --- /dev/null +++ b/engines/gnap/scenes/scene47.cpp @@ -0,0 +1,171 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +void GnapEngine::scene47_initCutscene1() { + _s99_dword_47F370[0] = 0x301; + _s99_dword_47F370[1] = 0x305; + _s99_dword_47F370[2] = 0x302; + _s99_dword_47F370[3] = 0x304; + _s99_dword_47F370[4] = 0x300; + _s99_dword_47F2F0[0] = 3; + _s99_dword_47F2F0[1] = 0; + _s99_dword_47F2F0[2] = 1; + _s99_dword_47F2F0[3] = 0; + _s99_dword_47F2F0[4] = 2; + _s99_dword_47F330[0] = 1; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = 1; + _s99_dword_47F330[3] = 1; + _s99_dword_47F330[4] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_canSkip[2] = 0; + _s99_canSkip[3] = 0; + _s99_canSkip[4] = 0; + _s99_itemsCount = 5; +} + +void GnapEngine::scene47_initCutscene2() { + _s99_dword_47F370[0] = 0x306; + _s99_dword_47F370[1] = 0x309; + _s99_dword_47F370[2] = 0x307; + _s99_dword_47F370[3] = 0x308; + _s99_dword_47F370[4] = 0x30A; + _s99_dword_47F2F0[0] = 0x8E; + _s99_dword_47F2F0[1] = 0x90; + _s99_dword_47F2F0[2] = 0x8F; + _s99_dword_47F2F0[3] = 0x91; + _s99_dword_47F330[0] = 2; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = 1; + _s99_dword_47F330[3] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_canSkip[2] = 0; + _s99_canSkip[3] = 0; + _s99_itemsCount = 4; +} + +void GnapEngine::scene47_initCutscene3() { + _s99_dword_47F370[0] = 0x320; + _s99_dword_47F370[1] = 0x321; + _s99_dword_47F2F0[0] = 0x142; + _s99_dword_47F2F0[1] = 0x143; + _s99_dword_47F330[0] = 1; + _s99_dword_47F330[1] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_itemsCount = 2; +} + +void GnapEngine::scene47_initCutscene4() { + _s99_dword_47F370[0] = 0x30C; + _s99_dword_47F370[1] = 0x30D; + _s99_dword_47F370[2] = 0x30B; + _s99_dword_47F2F0[0] = 0x142; + _s99_dword_47F2F0[1] = 0x141; + _s99_dword_47F2F0[2] = 0x177; + _s99_dword_47F330[0] = 1; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_canSkip[2] = 0; + _s99_itemsCount = 3; +} + +void GnapEngine::scene47_initCutscene5() { + _s99_dword_47F370[0] = 0x30E; + _s99_dword_47F370[1] = 0x30F; + _s99_dword_47F370[2] = 0x310; + _s99_dword_47F370[3] = 0x311; + _s99_dword_47F2F0[0] = 0x206; + _s99_dword_47F2F0[1] = 0x207; + _s99_dword_47F330[0] = 3; + _s99_dword_47F330[1] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_itemsCount = 2; +} + +void GnapEngine::scene47_initCutscene6() { + _s99_dword_47F370[0] = 0x31E; + _s99_dword_47F370[1] = 0x31F; + _s99_dword_47F2F0[0] = 0x2FA; + _s99_dword_47F330[0] = 2; + _s99_canSkip[0] = 0; + _s99_itemsCount = 1; +} + +void GnapEngine::scene47_initCutscene7() { + int v1 = 4, v0, v4, v2, v3; + + _s99_dword_47F370[0] = 0x316; + _s99_dword_47F370[1] = 0x31A; + _s99_dword_47F370[2] = 0x314; + _s99_dword_47F370[3] = 0x31B; + v1 = 4; + if (!isFlag(3)) { + _s99_dword_47F370[4] = 0x31C; + v1 = 5; + } + if (!isFlag(26)) + _s99_dword_47F370[v1++] = 0x31D; + v4 = v1; + _s99_dword_47F370[v1] = 0x319; + v0 = v1 + 1; + v3 = v0; + _s99_dword_47F370[v0++] = 0x317; + _s99_dword_47F370[v0++] = 0x312; + _s99_dword_47F370[v0] = 0x31A; + v2 = v0 + 1; + if (!isFlag(3)) + _s99_dword_47F370[v2++] = 0x31C; + if (!isFlag(26)) + _s99_dword_47F370[v2++] = 0x31D; + _s99_dword_47F370[v2] = 0x313; + _s99_dword_47F370[v2 + 1] = 0x315; + _s99_dword_47F2F0[0] = 0x2B8; + _s99_dword_47F2F0[1] = 0x20C; + _s99_dword_47F2F0[2] = 0x2B8; + _s99_dword_47F2F0[3] = 0x20B; + _s99_dword_47F2F0[4] = 0x20B; + _s99_dword_47F330[0] = v4; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = v2 - v3; + _s99_dword_47F330[3] = 1; + _s99_dword_47F330[4] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_canSkip[2] = 0; + _s99_canSkip[3] = 0; + _s99_canSkip[4] = 0; + _s99_itemsCount = 5; +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene48.cpp b/engines/gnap/scenes/scene48.cpp new file mode 100644 index 0000000000..3b24d57a8c --- /dev/null +++ b/engines/gnap/scenes/scene48.cpp @@ -0,0 +1,85 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +void GnapEngine::scene48_initCutscene() { + _s99_dword_47F370[0] = 390; + _s99_dword_47F370[1] = 391; + _s99_dword_47F370[2] = 392; + _s99_dword_47F370[3] = 393; + _s99_dword_47F370[4] = 394; + _s99_dword_47F370[5] = 395; + _s99_dword_47F370[6] = 396; + _s99_dword_47F370[7] = 397; + _s99_dword_47F370[8] = 398; + _s99_dword_47F370[9] = 399; + _s99_dword_47F370[10] = 400; + _s99_dword_47F370[11] = 401; + _s99_dword_47F370[12] = 402; + _s99_dword_47F2F0[0] = 238; + _s99_dword_47F2F0[1] = 42; + _s99_dword_47F2F0[2] = 2; + _s99_dword_47F2F0[3] = 37; + _s99_dword_47F2F0[4] = 35; + _s99_dword_47F2F0[5] = 38; + _s99_dword_47F2F0[6] = 39; + _s99_dword_47F2F0[7] = 40; + _s99_dword_47F2F0[8] = 41; + _s99_dword_47F2F0[9] = 36; + _s99_dword_47F2F0[10] = 41; + _s99_dword_47F2F0[11] = 388; + _s99_dword_47F2F0[12] = 387; + _s99_dword_47F330[0] = 1; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = 1; + _s99_dword_47F330[3] = 1; + _s99_dword_47F330[4] = 1; + _s99_dword_47F330[5] = 1; + _s99_dword_47F330[6] = 1; + _s99_dword_47F330[7] = 1; + _s99_dword_47F330[8] = 1; + _s99_dword_47F330[9] = 1; + _s99_dword_47F330[10] = 1; + _s99_dword_47F330[11] = 1; + _s99_dword_47F330[12] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_canSkip[2] = 0; + _s99_canSkip[3] = 0; + _s99_canSkip[4] = 0; + _s99_canSkip[5] = 0; + _s99_canSkip[6] = 0; + _s99_canSkip[7] = 0; + _s99_canSkip[8] = 0; + _s99_canSkip[9] = 0; + _s99_canSkip[10] = 0; + _s99_canSkip[11] = 0; + _s99_canSkip[12] = 0; + _s99_itemsCount = 13; +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp new file mode 100644 index 0000000000..e8415bbc9f --- /dev/null +++ b/engines/gnap/scenes/scene49.cpp @@ -0,0 +1,513 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +struct ObstacleDef { + int sequenceId, ticks; +}; + +static const ObstacleDef kObstacleDefs[] = { + {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14}, + {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12}, + {0xCD, 11}, {0xCB, 15}, {0xB7, 12}, {0xCD, 11}, {0xCB, 10}, + {0xCF, 15}, {0xCF, 14}, {0xBD, 13}, {0xCF, 12}, {0xCD, 11}, + {0xCB, 15}, {0xCB, 13}, {0xB4, 12}, {0xCB, 11}, {0xCD, 10}, + {0xCF, 15}, {0xCD, 12}, {0xBA, 12}, {0xCD, 12}, {0xCF, 12}, + {0xCB, 15}, {0xCB, 9}, {0xCD, 9}, {0xCF, 9}, {0xCD, 9}, + {0xCB, 9}, {0xCD, 9}, {0xCF, 5}, {0xBD, 13}, {0xCF, 8}, + {0xCB, 8}, {0xCD, 15}, {0xB4, 1}, {0xBD, 7}, {0xCF, 7}, + {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15} +}; + +int GnapEngine::scene49_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + for (int i = 0; i < 5; ++i) + _gameSys->setAnimation(0, 0, i + 2); + _timers[2] = 0; + _timers[0] = 0; + _timers[1] = 0; + clearKeyStatus1(28); + clearKeyStatus1(54); + clearKeyStatus1(52); + return 0xD5; +} + +void GnapEngine::scene49_updateHotspots() { + _hotspotsCount = 0; +} + +void GnapEngine::scene49_checkObstacles() { + + if (_timers[2] == 0) { + + if (_timers[3] == 0) + for (int i = 0; i < 5; ++i) + scene49_clearObstacle(i); + + for (int j = 0; j < 5; ++j) { + if (_s49_obstacles[j].currSequenceId == 0) { + _timers[3] = 35; + _s49_obstacles[j].currSequenceId = kObstacleDefs[_s49_obstacleIndex].sequenceId; + switch (_s49_obstacles[j].currSequenceId) { + case 0xB4: + _s49_obstacles[j].laneNum = 1; + _s49_obstacles[j].closerSequenceId = 180; + _s49_obstacles[j].passedSequenceId = 181; + _s49_obstacles[j].splashSequenceId = 182; + _s49_obstacles[j].collisionSequenceId = 192; + break; + case 0xB7: + _s49_obstacles[j].laneNum = 2; + _s49_obstacles[j].closerSequenceId = 183; + _s49_obstacles[j].passedSequenceId = 184; + _s49_obstacles[j].splashSequenceId = 185; + _s49_obstacles[j].collisionSequenceId = 193; + break; + case 0xBD: + _s49_obstacles[j].laneNum = 3; + _s49_obstacles[j].closerSequenceId = 189; + _s49_obstacles[j].passedSequenceId = 190; + _s49_obstacles[j].splashSequenceId = 191; + _s49_obstacles[j].collisionSequenceId = 195; + break; + case 0xBA: + _s49_obstacles[j].laneNum = 2; + _s49_obstacles[j].closerSequenceId = 186; + _s49_obstacles[j].passedSequenceId = 187; + _s49_obstacles[j].splashSequenceId = 188; + _s49_obstacles[j].collisionSequenceId = 194; + break; + case 0xCB: + _s49_obstacles[j].laneNum = 1; + _s49_obstacles[j].closerSequenceId = 203; + _s49_obstacles[j].passedSequenceId = 204; + _s49_obstacles[j].splashSequenceId = 0; + _s49_obstacles[j].collisionSequenceId = 209; + break; + case 0xCD: + _s49_obstacles[j].laneNum = 2; + _s49_obstacles[j].closerSequenceId = 205; + _s49_obstacles[j].passedSequenceId = 206; + _s49_obstacles[j].splashSequenceId = 0; + _s49_obstacles[j].collisionSequenceId = 210; + break; + case 0xCF: + _s49_obstacles[j].laneNum = 3; + _s49_obstacles[j].closerSequenceId = 207; + _s49_obstacles[j].passedSequenceId = 208; + _s49_obstacles[j].splashSequenceId = 0; + _s49_obstacles[j].collisionSequenceId = 211; + break; + } + _s49_obstacles[j].prevId = _s49_truckId; + _s49_obstacles[j].currId = _s49_obstacles[j].prevId; + _gameSys->setAnimation(_s49_obstacles[j].currSequenceId, _s49_obstacles[j].currId, j + 2); + _gameSys->insertSequence(_s49_obstacles[j].currSequenceId, _s49_obstacles[j].currId, 0, 0, kSeqNone, 0, 0, -50); + _timers[2] = kObstacleDefs[_s49_obstacleIndex].ticks; + ++_s49_obstacleIndex; + if (_s49_obstacleIndex == 50) + _s49_obstacleIndex = 0; + break; + } + } + + } + +} + +void GnapEngine::scene49_updateObstacle(int i) { + + Scene49Obstacle &obstacle = _s49_obstacles[i]; + + obstacle.currId = obstacle.prevId; + + switch (obstacle.laneNum) { + case 1: + obstacle.prevId = _s49_truckId + 1; + break; + case 2: + if (_s49_truckLaneNum != 2 && _s49_truckLaneNum != 3) + obstacle.prevId = _s49_truckId - 1; + else + obstacle.prevId = _s49_truckId + 1; + break; + case 3: + if (_s49_truckLaneNum != 1 && _s49_truckLaneNum != 2) + obstacle.prevId = _s49_truckId; + else + obstacle.prevId = _s49_truckId - 1; + break; + } + + if (obstacle.currSequenceId == obstacle.closerSequenceId) { + if (_s49_truckLaneNum == obstacle.laneNum) { + if (obstacle.splashSequenceId) { + _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, i + 2); + _gameSys->insertSequence(obstacle.collisionSequenceId, obstacle.prevId, + obstacle.currSequenceId, obstacle.currId, + kSeqSyncWait, 0, 0, -50); + obstacle.currSequenceId = obstacle.collisionSequenceId; + playSound(224, 0); + scene49_increaseScore(30); + } else if ((obstacle.laneNum == 1 && _s49_truckSequenceId == 0xB0) || + (obstacle.laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || + (obstacle.laneNum == 3 && _s49_truckSequenceId == 0xB3)) { + _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, i + 2); + _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, + obstacle.currSequenceId, obstacle.currId, + kSeqSyncWait, 0, 0, -50); + obstacle.currSequenceId = obstacle.passedSequenceId; + } else { + _gameSys->setAnimation(obstacle.collisionSequenceId, 256, 0); + _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, i + 2); + _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, + obstacle.currSequenceId, obstacle.currId, + kSeqSyncWait, 0, 0, -50); + _gameSys->insertSequence(obstacle.collisionSequenceId, 256, + _s49_truckSequenceId, _s49_truckId, + 32, 0, 0, -50); + _s49_truckSequenceId = obstacle.collisionSequenceId; + _s49_truckId = 256; + obstacle.currSequenceId = obstacle.passedSequenceId; + playSound(225, 0); + scene49_decreaseScore(30); + } + } else { + _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, i + 2); + _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, + obstacle.currSequenceId, obstacle.currId, + kSeqSyncWait, 0, 0, -50); + obstacle.currSequenceId = obstacle.passedSequenceId; + } + } else if (obstacle.currSequenceId == obstacle.passedSequenceId) { + if (_s49_truckLaneNum == obstacle.laneNum) { + if (obstacle.splashSequenceId) { + _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, i + 2); + _gameSys->insertSequence(obstacle.collisionSequenceId, obstacle.prevId, + obstacle.currSequenceId, obstacle.currId, + kSeqSyncWait, 0, 0, -50); + obstacle.currSequenceId = obstacle.collisionSequenceId; + playSound(224, 0); + scene49_increaseScore(30); + } + } else if (obstacle.splashSequenceId) { + _gameSys->setAnimation(obstacle.splashSequenceId, obstacle.prevId, i + 2); + _gameSys->insertSequence(obstacle.splashSequenceId, obstacle.prevId, + obstacle.currSequenceId, obstacle.currId, + kSeqSyncWait, 0, 0, -50); + obstacle.currSequenceId = obstacle.splashSequenceId; + } + } else { + _gameSys->setAnimation(0, 0, i + 2); + scene49_clearObstacle(i); + } + +} + +void GnapEngine::scene49_increaseScore(int amount) { + if (_s49_scoreBarPos + amount <= 556) { + _s49_scoreBarPos += amount; + _gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 255, 0, 0); + } + _s49_scoreLevel = _s49_scoreBarPos + amount >= 556; +} + +void GnapEngine::scene49_decreaseScore(int amount) { + if (_s49_scoreBarPos >= 226 && _s49_scoreLevel == 0) { + if (_s49_scoreBarFlash) + scene49_refreshScoreBar(); + _gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 89, 0, 5); + _s49_scoreBarPos -= amount; + _s49_scoreLevel = 0; + } +} + +void GnapEngine::scene49_refreshScoreBar() { + if (_s49_scoreBarFlash) + _gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); + else + _gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); + _s49_scoreBarFlash = !_s49_scoreBarFlash; +} + +void GnapEngine::scene49_clearObstacle(int index) { + _s49_obstacles[index].currSequenceId = 0; + _s49_obstacles[index].closerSequenceId = 0; + _s49_obstacles[index].passedSequenceId = 0; + _s49_obstacles[index].splashSequenceId = 0; + _s49_obstacles[index].collisionSequenceId = 0; + _s49_obstacles[index].prevId = 0; + _s49_obstacles[index].currId = 0; + _s49_obstacles[index].laneNum = 0; +} + +void GnapEngine::scene49_run() { + + bool animToggle6 = false; + bool animToggle5 = false; + bool animToggle4 = false; + bool animToggle3 = false; + bool streetAnimToggle = false; + bool bgAnimToggle = false; + + playSound(0xE2, 1); + setSoundVolume(0xE2, 75); + + hideCursor(); + setGrabCursorSprite(-1); + + _s49_scoreBarPos = 196; + _s49_scoreLevel = 0; + _s49_scoreBarFlash = false; + + switch (getRandom(3)) { + case 0: + _s49_truckSequenceId = 0xAD; + _s49_truckLaneNum = 1; + break; + case 1: + _s49_truckSequenceId = 0xAE; + _s49_truckLaneNum = 2; + break; + case 2: + _s49_truckSequenceId = 0xAF; + _s49_truckLaneNum = 3; + break; + } + + int bgWidth1 = _gameSys->getSpriteWidthById(0x5E); + int bgX1 = 600; + + int bgWidth2 = _gameSys->getSpriteWidthById(0x5F); + int bgX2 = 400; + + int bgWidth3 = _gameSys->getSpriteWidthById(4); + int bgX3 = 700; + + int bgWidth4 = _gameSys->getSpriteWidthById(5); + int bgX4 = 500; + + int bgWidth5 = _gameSys->getSpriteWidthById(6); + int bgX5 = 300; + + int bgWidth6 = _gameSys->getSpriteWidthById(7); + int bgX6 = 100; + + _gameSys->setAnimation(0xC8, 251, 1); + _gameSys->setAnimation(_s49_truckSequenceId, 256, 0); + _gameSys->insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); + _gameSys->insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); + _gameSys->insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); + _gameSys->insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); + _gameSys->insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); + _gameSys->insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); + _gameSys->insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); + _gameSys->insertSequence(_s49_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); + + _timers[0] = 2; + + for (int i = 0; i < 5; ++i) + scene49_clearObstacle(i); + + _s49_obstacleIndex = 0; + + _timers[2] = getRandom(20) + 10; + + _s49_truckId = 256; + _timers[3] = 35; + + while (!_sceneDone) { + + if (_timers[0] == 0) { + // Update background animations (clouds etc.) + --bgX1; + bgX2 -= 2; + bgX3 -= 5; + --bgX4; + --bgX5; + --bgX6; + if (bgX1 <= -bgWidth1) + bgX1 = 799; + if (bgX2 <= -bgWidth2) + bgX2 = 799; + if (bgX3 <= -bgWidth3) + bgX3 = 799; + if (bgX4 <= -bgWidth4) + bgX4 = 799; + if (bgX5 <= -bgWidth5) + bgX5 = 799; + if (bgX6 <= -bgWidth6) + bgX6 = 799; + bgAnimToggle = !bgAnimToggle; + _gameSys->insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); + _gameSys->insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); + _gameSys->insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); + _gameSys->insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); + _gameSys->insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); + _gameSys->insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); + _timers[0] = 2; + } + + if (_gameSys->getAnimationStatus(1) == 2) { + streetAnimToggle = !streetAnimToggle; + _gameSys->setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); + _gameSys->insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); + } + + scene49_checkObstacles(); + + if (_gameSys->getAnimationStatus(0) == 2) { + switch (_s49_truckSequenceId) { + case 0xB1: + _s49_truckLaneNum = 1; + break; + case 0xB0: + case 0xB3: + _s49_truckLaneNum = 2; + break; + case 0xB2: + _s49_truckLaneNum = 3; + break; + } + animToggle3 = !animToggle3; + if (_s49_truckLaneNum == 1) { + _gameSys->setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); + _gameSys->insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); + _s49_truckSequenceId = 0xAD; + } else if (_s49_truckLaneNum == 2) { + _gameSys->setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); + _gameSys->insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); + _s49_truckSequenceId = 0xAE; + } else { + _gameSys->setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); + _gameSys->insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); + _s49_truckSequenceId = 0xAF; + } + _s49_truckId = (animToggle3 ? 1 : 0) + 256; + if (_s49_scoreLevel == 1) { + if (!_gameSys->isSequenceActive(0xD4, 266)) { + _gameSys->setAnimation(0xD4, 266, 8); + _gameSys->insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); + } + ++_s49_scoreLevel; + _timers[1] = 2; + animToggle4 = false; + animToggle5 = false; + animToggle6 = false; + _s49_scoreBarFlash = false; + } + } + + if (_s49_scoreLevel != 0 && !_timers[1]) { + scene49_refreshScoreBar(); + _timers[1] = 8; + if (animToggle6) { + if (animToggle5) { + if (animToggle4 && !_gameSys->isSequenceActive(212, 266)) + _gameSys->insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); + animToggle4 = !animToggle4; + } + animToggle5 = !animToggle5; + } + animToggle6 = !animToggle6; + } + + scene49_updateAnimations(); + + if (sceneXX_sub_4466B1()) { + _sceneDone = true; + _newSceneNum = 2; + _newCursorValue = 1; + } + + if (isKeyStatus1(Common::KEYCODE_RIGHT)) { + // Steer right + if (_s49_truckSequenceId == 0xB3) + _s49_truckLaneNum = 2; + if (_s49_truckSequenceId == 0xB1) + _s49_truckLaneNum = 1; + if (_s49_truckLaneNum != 3 && _s49_truckLaneNum != 2) { + if (_s49_scoreLevel) { + _sceneDone = true; + _newSceneNum = 47; + } + } else { + int steerSequenceId = (_s49_truckLaneNum == 3) ? 0xB3 : 0xB1; + if (_s49_truckSequenceId == 0xAE || _s49_truckSequenceId == 0xAF) { + _gameSys->setAnimation(steerSequenceId, 256, 0); + _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, 32, 0, 0, -50); + _s49_truckSequenceId = steerSequenceId; + _s49_truckId = 256; + } + } + clearKeyStatus1(Common::KEYCODE_RIGHT); + } + + if (isKeyStatus1(Common::KEYCODE_LEFT)) { + // Steer left + if (_s49_truckSequenceId == 0xB0) + _s49_truckLaneNum = 2; + if (_s49_truckSequenceId == 0xB2) + _s49_truckLaneNum = 3; + if (_s49_truckLaneNum == 1 || _s49_truckLaneNum == 2) { + int steerSequenceId = (_s49_truckLaneNum == 1) ? 0xB0 : 0xB2; + if (_s49_truckSequenceId == 0xAD || _s49_truckSequenceId == 0xAE) { + _gameSys->setAnimation(steerSequenceId, 256, 0); + _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, 32, 0, 0, -50); + _s49_truckSequenceId = steerSequenceId; + _s49_truckId = 256; + } + } + clearKeyStatus1(Common::KEYCODE_LEFT); + } + + gameUpdateTick(); + + } + + stopSound(0xE2); + +} + +void GnapEngine::scene49_updateAnimations() { + + for (int i = 0; i < 5; ++i) { + if (_gameSys->getAnimationStatus(i + 2) == 2) { + if (_s49_obstacles[i].currSequenceId) + scene49_updateObstacle(i); + } + } + + if (_gameSys->getAnimationStatus(8) == 2) { + _sceneDone = true; + _newSceneNum = 47; + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene50.cpp b/engines/gnap/scenes/scene50.cpp new file mode 100644 index 0000000000..ce24354be0 --- /dev/null +++ b/engines/gnap/scenes/scene50.cpp @@ -0,0 +1,479 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +int GnapEngine::scene50_init() { + return 0xC7; +} + +void GnapEngine::scene50_updateHotspots() { + _hotspotsCount = 0; +} + +bool GnapEngine::scene50_tongueWinsRound(int tongueNum) { + if (tongueNum == 1) + ++_s50_leftTongueRoundsWon; + else + ++_s50_rightTongueRoundsWon; + scene50_playWinBadgeAnim(tongueNum); + bool fightOver = _s50_rightTongueRoundsWon == 2 || _s50_leftTongueRoundsWon == 2; + scene50_playWinAnim(tongueNum, fightOver); + return fightOver; +} + +void GnapEngine::scene50_playWinAnim(int tongueNum, bool fightOver) { + if (tongueNum == 1) { + if (fightOver) { + _gameSys->insertSequence(0xAD, 140, 0xAC, 140, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); + _s50_leftTongueSequenceId = 0xB4; + _s50_rightTongueSequenceId = 0xBC; + _s50_rightTongueId = 100; + _s50_leftTongueId = 100; + _gameSys->setAnimation(0xB4, 100, 6); + _gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); + scene50_waitForAnim(6); + scene50_waitForAnim(5); + invAdd(kItemGum); + setFlag(13); + } else { + _gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); + _s50_leftTongueSequenceId = 0xB4; + _s50_rightTongueSequenceId = 0xBC; + _s50_rightTongueId = 100; + _s50_leftTongueId = 100; + _gameSys->setAnimation(0xB4, 100, 6); + _gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); + scene50_waitForAnim(6); + scene50_waitForAnim(5); + } + } else { + _gameSys->insertSequence(0xBE, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0xBE, 100, 5); + scene50_waitForAnim(5); + _gameSys->insertSequence(0xBF, 100, 0xBE, 100, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xB5, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _s50_rightTongueSequenceId = 0xBF; + _s50_leftTongueSequenceId = 0xB5; + _s50_rightTongueId = 100; + _s50_leftTongueId = 100; + _gameSys->setAnimation(0xB5, 100, 6); + _gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); + scene50_waitForAnim(6); + scene50_waitForAnim(5); + } + // TODO delayTicksA(1, 7); +} + +void GnapEngine::scene50_delayTicks() { + // TODO delayTicksA(3, 7); +} + +void GnapEngine::scene50_initRound() { + _s50_leftTongueEnergy = 10; + _s50_rightTongueEnergy = 10; + _s50_fightDone = false; + _timers[3] = scene50_getRightTongueActionTicks(); + _timers[4] = 0; + _timers[6] = 0; + _gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0); + _gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0); + _s50_timeRemaining = 40; + scene50_drawCountdown(40); +} + +bool GnapEngine::scene50_updateCountdown() { + if (!_timers[5]) { + --_s50_timeRemaining; + if (_s50_timeRemaining < 0) { + return true; + } else { + _timers[5] = 15; + scene50_drawCountdown(_s50_timeRemaining); + } + } + return false; +} + +void GnapEngine::scene50_drawCountdown(int value) { + char str[8]; + sprintf(str, "%02d", value); + _gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0); + _gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str); +} + +void GnapEngine::scene50_playTonguesIdle() { + _gameSys->insertSequence(0xBA, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xC2, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _s50_leftTongueSequenceId = 0xBA; + _s50_rightTongueSequenceId = 0xC2; + _s50_rightTongueNextSequenceId = -1; + _s50_leftTongueNextSequenceId = -1; + _s50_leftTongueId = 100; + _s50_rightTongueId = 100; + _gameSys->setAnimation(0xC2, 100, 5); + _gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); +} + +void GnapEngine::scene50_playRoundAnim(int roundNum) { + int sequenceId; + + switch (roundNum) { + case 1: + sequenceId = 0xAF; + break; + case 2: + sequenceId = 0xB0; + break; + case 3: + sequenceId = 0xB1; + break; + } + + _gameSys->insertSequence(sequenceId, 256, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(sequenceId, 256, 7); + scene50_waitForAnim(7); + + _gameSys->insertSequence(0xAB, 256, sequenceId, 256, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(0xAB, 256, 7); + scene50_waitForAnim(7); + +} + +bool GnapEngine::scene50_updateEnergyBars(int newLeftBarPos, int newRightBarPos) { + + if (newLeftBarPos != _s50_leftTongueEnergyBarPos) { + if (newLeftBarPos < 0) + newLeftBarPos = 0; + _s50_leftTongueEnergyBarPos = newLeftBarPos; + _gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); + } + + if (newRightBarPos != _s50_rightTongueEnergyBarPos) { + if (newRightBarPos < 0) + newRightBarPos = 0; + _s50_rightTongueEnergyBarPos = newRightBarPos; + if (newRightBarPos != 10) + _gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); + } + + if (newLeftBarPos * newRightBarPos > 0) + return false; + + _s50_leftTongueEnergyBarPos = 10; + _s50_rightTongueEnergyBarPos = 10; + return true; +} + +void GnapEngine::scene50_waitForAnim(int animationIndex) { + while (_gameSys->getAnimationStatus(animationIndex) != 2) { + gameUpdateTick(); + } + _gameSys->setAnimation(0, 0, animationIndex); +} + +int GnapEngine::scene50_checkInput() { + int sequenceId = -1; + + if (isKeyStatus1(Common::KEYCODE_RIGHT)) { + clearKeyStatus1(Common::KEYCODE_RIGHT); + sequenceId = 0xB6; + } else if (isKeyStatus1(Common::KEYCODE_LEFT)) { + clearKeyStatus1(Common::KEYCODE_LEFT); + sequenceId = 0xB3; + } else if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { + clearKeyStatus1(Common::KEYCODE_ESCAPE); + _s50_fightDone = true; + } + + return sequenceId; +} + +int GnapEngine::scene50_getRightTongueAction() { + int sequenceId = -1; + + if (!_timers[3]) { + _timers[3] = scene50_getRightTongueActionTicks(); + if (_s50_rightTongueEnergy >= _s50_leftTongueEnergy) { + switch (getRandom(5)) { + case 0: + sequenceId = 0xBE; + break; + case 1: + sequenceId = 0xBE; + break; + case 2: + sequenceId = 0xBB; + break; + case 3: + sequenceId = 0xBB; + break; + case 4: + sequenceId = 0xBB; + break; + } + } else { + switch (getRandom(4)) { + case 0: + sequenceId = 0xBE; + break; + case 1: + sequenceId = 0xBB; + break; + case 2: + sequenceId = 0xBE; + break; + case 3: + sequenceId = 0xBE; + break; + } + } + } + + return sequenceId; +} + +void GnapEngine::scene50_updateAnimations() { + + if (!_timers[4]) + _s50_attackCounter = 0; + + if (_gameSys->getAnimationStatus(5) == 2) { + if (_s50_rightTongueSequenceId == 0xBE) { + if (_s50_leftTongueSequenceId != 0xB3 && _s50_leftTongueSequenceId != 0xB8) + _s50_rightTongueNextSequenceId = 0xBF; + else + _s50_rightTongueNextSequenceId = 0xC0; + } + if (_s50_rightTongueNextSequenceId == -1) + _s50_rightTongueNextSequenceId = 0xC2; + if (_s50_rightTongueNextSequenceId == 0xBF) { + _s50_leftTongueNextId = scene50_getLeftTongueNextId(); + _s50_rightTongueNextId = scene50_getRightTongueNextId(); + _gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); + _gameSys->setAnimation(0xB9, _s50_leftTongueNextId, 6); + _gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, 32, 0, 0, 0); + _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; + _s50_rightTongueNextSequenceId = -1; + _s50_leftTongueSequenceId = 0xB9; + _s50_leftTongueNextSequenceId = -1; + _s50_rightTongueId = _s50_rightTongueNextId; + _s50_leftTongueId = _s50_leftTongueNextId; + _s50_leftTongueEnergy -= getRandom(2) + 1;//CHECKME + } else { + _s50_rightTongueNextId = scene50_getRightTongueNextId(); + _gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); + _gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; + _s50_rightTongueNextSequenceId = -1; + _s50_rightTongueId = _s50_rightTongueNextId; + } + } + + if (_gameSys->getAnimationStatus(6) == 2) { + if (_s50_leftTongueSequenceId == 0xB6) { + ++_s50_attackCounter; + if (_s50_timesPlayedModifier + 3 <= _s50_attackCounter) { + _s50_leftTongueNextSequenceId = 0xB8; + } else { + _timers[4] = 20; + //CHECKME + if (_s50_rightTongueSequenceId != 0xBB && _s50_rightTongueSequenceId != 0xC0 && getRandom(8) != _s50_roundNum) + _s50_leftTongueNextSequenceId = 0xB7; + else + _s50_leftTongueNextSequenceId = 0xB8; + } + } + if (_s50_leftTongueNextSequenceId == 0xB3) + --_s50_attackCounter; + if (_s50_leftTongueNextSequenceId == -1) + _s50_leftTongueNextSequenceId = 0xBA; + if (_s50_leftTongueNextSequenceId == 0xB7) { + _s50_leftTongueNextId = scene50_getLeftTongueNextId(); + _s50_rightTongueNextId = scene50_getRightTongueNextId(); + _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); + _gameSys->setAnimation(0xC1, _s50_rightTongueNextId, 5); + _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, 32, 0, 0, 0); + _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; + _s50_leftTongueNextSequenceId = -1; + _s50_rightTongueSequenceId = 0xC1; + _s50_rightTongueNextSequenceId = -1; + _s50_rightTongueId = _s50_rightTongueNextId; + _s50_leftTongueId = _s50_leftTongueNextId; + --_s50_rightTongueEnergy; + } else if (_s50_leftTongueNextSequenceId != 0xB8 || _s50_rightTongueSequenceId != 0xC2) { + _s50_leftTongueNextId = scene50_getLeftTongueNextId(); + _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); + _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; + _s50_leftTongueNextSequenceId = -1; + _s50_leftTongueId = _s50_leftTongueNextId; + } else { + _s50_leftTongueNextId = scene50_getLeftTongueNextId(); + _s50_rightTongueNextId = scene50_getRightTongueNextId(); + _gameSys->setAnimation(0xBB, _s50_rightTongueNextId, 5); + _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); + _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, 32, 0, 0, 0); + _s50_rightTongueSequenceId = 0xBB; + _s50_rightTongueId = _s50_rightTongueNextId; + _s50_rightTongueNextSequenceId = -1; + _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; + _s50_leftTongueNextSequenceId = -1; + _s50_leftTongueId = _s50_leftTongueNextId; + } + } + +} + +int GnapEngine::scene50_getRightTongueActionTicks() { + return 15 - 5 * _s50_roundNum + 1; +} + +int GnapEngine::scene50_getLeftTongueNextId() { + _s50_leftTongueNextIdCtr = (_s50_leftTongueNextIdCtr + 1) % 3; + return _s50_leftTongueNextIdCtr + 100; +} + +int GnapEngine::scene50_getRightTongueNextId() { + _s50_rightTongueNextIdCtr = (_s50_rightTongueNextIdCtr + 1) % 3; + return _s50_rightTongueNextIdCtr + 100; +} + +void GnapEngine::scene50_playWinBadgeAnim(int tongueNum) { + int sequenceId; + + if (tongueNum == 1) { + if (_s50_leftTongueRoundsWon == 1) + sequenceId = 0xC3; + else + sequenceId = 0xC4; + } else { + if (_s50_rightTongueRoundsWon == 1) + sequenceId = 0xC5; + else + sequenceId = 0xC6; + } + + _gameSys->setAnimation(sequenceId, 120, 7); + _gameSys->insertSequence(sequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + scene50_waitForAnim(7); + +} + +void GnapEngine::scene50_run() { + + ++_s50_timesPlayed; + _s50_timesPlayedModifier = _s50_timesPlayed / 4; + _s50_leftTongueRoundsWon = 0; + _s50_rightTongueRoundsWon = 0; + // scene50_initFont(); + _s50_leftTongueSequenceId = 186; + _s50_rightTongueSequenceId = 194; + _s50_rightTongueNextSequenceId = -1; + _s50_leftTongueNextSequenceId = -1; + _s50_leftTongueId = 100; + _s50_rightTongueId = 100; + + _gameSys->setAnimation(194, 100, 5); + _gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); + _gameSys->insertSequence(_s50_leftTongueSequenceId, _s50_leftTongueId, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s50_rightTongueSequenceId, _s50_rightTongueId, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(172, 140, 0, 0, kSeqNone, 0, 0, 0); + endSceneInit(); + + scene50_initRound(); + + _s50_roundNum = 1; + + setGrabCursorSprite(-1); + hideCursor(); + + // TODO delayTicksA(1, 7); + + scene50_playRoundAnim(_s50_roundNum); + + _timers[5] = 15; + + while (!_s50_fightDone) { + + /* TODO + if (sceneXX_sub_4466B1()) + _s50_fightDone = true; + */ + + int playerSequenceId = scene50_checkInput(); + if (playerSequenceId != -1) + _s50_leftTongueNextSequenceId = playerSequenceId; + + int rightSequenceId = scene50_getRightTongueAction(); + if (rightSequenceId != -1) + _s50_rightTongueNextSequenceId = rightSequenceId; + + scene50_updateAnimations(); + + if (scene50_updateCountdown() || + scene50_updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy)) { + int v0; + if (_s50_rightTongueEnergy < _s50_leftTongueEnergy) + v0 = scene50_tongueWinsRound(1); + else + v0 = scene50_tongueWinsRound(2); + if (v0) { + scene50_delayTicks(); + _s50_fightDone = true; + } else { + ++_s50_roundNum; + scene50_initRound(); + scene50_playTonguesIdle(); + scene50_updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy); + scene50_playRoundAnim(_s50_roundNum); + _timers[5] = 15; + } + } + + gameUpdateTick(); + + } + + // scene50_freeFont(); + + _gameSys->setAnimation(0, 0, 7); + _gameSys->setAnimation(0, 0, 6); + _gameSys->setAnimation(0, 0, 5); + _gameSys->setAnimation(0, 0, 3); + + showCursor(); +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp new file mode 100644 index 0000000000..1313c1d2db --- /dev/null +++ b/engines/gnap/scenes/scene51.cpp @@ -0,0 +1,880 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +static const int kDigitSequenceIds[] = { + 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, + 0xCF, 0xD0, 0xD1, 0xD2, 0xD3 +}; + +static const int kDigitPositions[4] = { + 0, 34, 83, 119 +}; + +/* + 0xBA Falling banana peel + 0xBC Banana peel goes away + 0xBD Falling coin + 0xBE Fallen coin + 0xC0 Falling banknote + 0xB6 Platypus tripping (right) + 0xB7 Platypus tripping (left) + 0x76 Platypus jumping (right) +*/ + +int GnapEngine::scene51_init() { + _gameSys->setAnimation(0, 0, 0); + for (int i = 0; i < 6; ++i) + _gameSys->setAnimation(0, 0, i + 1); + return 0xD4; +} + +void GnapEngine::scene51_updateHotspots() { + _hotspotsCount = 0; +} + +void GnapEngine::scene51_clearItem(Scene51Item *item) { + item->currSequenceId = 0; + item->droppedSequenceId = 0; + item->x = 0; + item->y = 0; + item->x2 = 0; + item->collisionX = 0; + item->canCatch = 0; +} + +void GnapEngine::scene51_dropNextItem() { + + if (_timers[0]) + return; + + int index = 0; + + while (index < 6 && _s51_items[index].currSequenceId) + ++index; + + if (index == 6) + return; + + switch (_s51_nextDropItemKind) { + + case 0: + if (getRandom(10) != 0 || _s51_itemsCtr2 >= 2) { + _s51_items[index].currSequenceId = 0xBD; + } else { + --_s51_itemsCtr1; + _s51_items[index].currSequenceId = 0xBA; + ++_s51_itemsCtr2; + } + break; + + case 1: + if (getRandom(8) != 0 || _s51_itemsCtr2 >= 2) { + if (getRandom(5) == 0) { + if (_s51_itemInsertDirection) + _s51_itemInsertX -= 70; + else + _s51_itemInsertX += 70; + } + _s51_items[index].currSequenceId = 0xBD; + } else { + --_s51_itemsCtr1; + _s51_items[index].currSequenceId = 0xBA; + ++_s51_itemsCtr2; + } + break; + + case 2: + if (getRandom(6) != 0 || _s51_itemsCtr2 >= 2) { + _s51_items[index].currSequenceId = 0xBD; + } else { + --_s51_itemsCtr1; + _s51_items[index].currSequenceId = 0xBA; + ++_s51_itemsCtr2; + } + break; + + case 3: + case 4: + if (_s51_itemsCtr == 0) + _s51_itemsCtr1 = 3; + _s51_items[index].currSequenceId = 0xC0; + break; + + case 5: + case 6: + if (getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { + if (getRandom(5) != 0) + _s51_items[index].currSequenceId = 0xBD; + else + _s51_items[index].currSequenceId = 0xC0; + } else { + --_s51_itemsCtr1; + _s51_items[index].currSequenceId = 0xBA; + ++_s51_itemsCtr2; + } + break; + + case 7: + if (getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { + if (getRandom(5) == 0) { + if (_s51_itemInsertDirection) + _s51_itemInsertX -= 40; + else + _s51_itemInsertX += 40; + } + if (getRandom(9) != 0) + _s51_items[index].currSequenceId = 0xBD; + else + _s51_items[index].currSequenceId = 0xC0; + } else { + --_s51_itemsCtr1; + _s51_items[index].currSequenceId = 0xBA; + ++_s51_itemsCtr2; + } + break; + + default: + if (getRandom(4) != 0 || _s51_itemsCtr2 >= 2) { + if (getRandom(9) != 0) + _s51_items[index].currSequenceId = 0xBD; + else + _s51_items[index].currSequenceId = 0xC0; + } else { + --_s51_itemsCtr1; + _s51_items[index].currSequenceId = 0xBA; + ++_s51_itemsCtr2; + } + break; + + } + + if (_s51_itemInsertDirection) { + _s51_itemInsertX -= 73; + if (_s51_itemInsertX < 129) { + _s51_itemInsertX += 146; + _s51_itemInsertDirection = 0; + } + } else { + _s51_itemInsertX += 73; + if (_s51_itemInsertX > 685) { + _s51_itemInsertX -= 146; + _s51_itemInsertDirection = 1; + } + } + + if (_s51_itemInsertX > 685) + _s51_itemInsertX = 685; + + if (_s51_itemInsertX < 129) + _s51_itemInsertX = 129; + + if (_s51_items[index].currSequenceId == 0xBA) { + _s51_items[index].x2 = getRandom(350) + 200; + _s51_items[index].x = _s51_items[index].x2 - 362; + _s51_items[index].y = 15; + _s51_items[index].id = 249 - index; + } else { + _s51_items[index].collisionX = _s51_itemInsertX; + _s51_items[index].x = _s51_items[index].collisionX - 395; + if (_s51_items[index].currSequenceId == 0xC0) + _s51_items[index].x -= 65; + _s51_items[index].id = index + 250; + _s51_items[index].canCatch = 1; + } + + _gameSys->setAnimation(_s51_items[index].currSequenceId, _s51_items[index].id, index + 1); + _gameSys->insertSequence(_s51_items[index].currSequenceId, _s51_items[index].id, 0, 0, + kSeqNone, 0, _s51_items[index].x, _s51_items[index].y); + + _timers[0] = _s51_dropSpeedTicks; + + if (_s51_nextDropItemKind >= 3) + _timers[0] = 20; + + if (_s51_nextDropItemKind >= 5) + _timers[0] = 5; + + if (_s51_nextDropItemKind == 8) + _timers[0] = 4; + + ++_s51_itemsCtr; + +} + +void GnapEngine::scene51_updateItemAnimations() { + for (int i = 0; i < 6; ++i) + if (_gameSys->getAnimationStatus(i + 1) == 2) + scene51_updateItemAnimation(&_s51_items[i], i); +} + +int GnapEngine::scene51_checkCollision(int sequenceId) { + bool jumpingLeft = false, jumpingRight = false; + int v6 = 0; + int v2 = 0; + int v5 = 0; + int v8, v4; + int result = 0; + + if (!scene51_isJumping(sequenceId)) + return false; + + while (v6 < 6) + v2 += _s51_items[v6++].isCollision; + + if (!v2) + return false; + + if (scene51_isJumpingRight(sequenceId)) { + v8 = scene51_getPosRight(sequenceId); + v4 = scene51_getPosRight(sequenceId + 1); + jumpingRight = true; + } else if (scene51_isJumpingLeft(sequenceId)) { + v4 = scene51_getPosLeft(sequenceId - 1) + 33; + v8 = scene51_getPosLeft(sequenceId) + 33; + jumpingLeft = true; + } + + if (jumpingRight || jumpingLeft) { + int i; + for (i = 0; i < 6; ++i) { + if (_s51_items[i].isCollision) { + if (jumpingRight && _s51_items[i].x2 > v8 && _s51_items[i].x2 < v4) { + v5 = v8 - 359; + if (v8 == 359) + v5 = 1; + _s51_platypusNextSequenceId = 0xB6; + break; + } else if (jumpingLeft && _s51_items[i].x2 < v4 && _s51_items[i].x2 > v8) { + v5 = v8 - 344; + if (v8 == 344) + v5 = 1; + _s51_platypusNextSequenceId = 0xB7; + break; + } + } + } + if (v5) { + _gameSys->setAnimation(0xBC, _s51_items[i].id, i + 1); + _gameSys->insertSequence(0xBC, _s51_items[i].id, _s51_items[i].currSequenceId, _s51_items[i].id, kSeqSyncWait, 0, _s51_items[i].x, 15); + _s51_items[i].isCollision = 0; + _s51_items[i].currSequenceId = 0xBC; + --_s51_itemsCtr2; + } + result = v5; + } + + return result; +} + +void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { + + switch (item->currSequenceId) { + + case 0xBD: + case 0xC0: + case 0xC1: + // Falling coin and banknote + if (!scene51_itemIsCaught(item)) { + if (_s51_dropLoseCash) { + if (item->currSequenceId == 0xBD) + _s51_cashAmount -= 2; + else + _s51_cashAmount -= 25; + if (_s51_cashAmount < 0) + _s51_cashAmount = 0; + scene51_updateCash(_s51_cashAmount); + } + item->droppedSequenceId = item->currSequenceId + 1; + if (item->currSequenceId != 0xC0) { + item->canCatch = 0; + _s51_dropLoseCash = true; + _s51_itemsCtr = 0; + _timers[0] = 10; + } + if (item->droppedSequenceId) { + _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); + _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); + item->currSequenceId = item->droppedSequenceId; + item->y = 0; + } + } else { + _gameSys->removeSequence(item->currSequenceId, item->id, 1); + _gameSys->setAnimation(0, 0, index + 1); + playSound(218, 0); + if (scene51_incCashAmount(item->currSequenceId) == 1995) { + scene51_winMinigame(); + _sceneDone = true; + } else { + scene51_clearItem(item); + ++_s51_itemsCaughtCtr; + if (_s51_itemsCaughtCtr == 5) + --_s51_dropSpeedTicks; + if (_s51_itemsCaughtCtr == 8) + --_s51_dropSpeedTicks; + if (_s51_itemsCaughtCtr == 11) + --_s51_dropSpeedTicks; + if (_s51_itemsCaughtCtr == 14) + --_s51_dropSpeedTicks; + if (_s51_itemsCaughtCtr >= 15 && _s51_dropSpeedTicks > 4) + --_s51_dropSpeedTicks; + if (_s51_itemsCtr1 <= _s51_itemsCaughtCtr) { + ++_s51_nextDropItemKind; + _s51_dropSpeedTicks = 10; + _s51_itemsCtr = 0; + _s51_itemsCtr1 = 20; + _s51_dropLoseCash = false; + _s51_itemsCaughtCtr = 0; + scene51_removeCollidedItems(); + } + } + } + break; + + case 0xBE: + // Fallen coin + item->droppedSequenceId = item->currSequenceId + 1; + if (item->droppedSequenceId) { + _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); + _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); + item->currSequenceId = item->droppedSequenceId; + item->y = 0; + } + break; + + case 0xBF: + case 0xC2: + // Bouncing coin and banknote + _gameSys->setAnimation(0, 0, index + 1); + _gameSys->removeSequence(item->currSequenceId, item->id, 1); + scene51_clearItem(item); + break; + + case 0xBA: + // Falling banana peel + item->droppedSequenceId = 0xBB; + item->y = 15; + if (item->droppedSequenceId) { + _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); + _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); + item->currSequenceId = item->droppedSequenceId; + item->y = 0; + } + break; + + case 0xBB: + item->isCollision = 1; + item->droppedSequenceId = 0; + _gameSys->setAnimation(0, 0, index + 1); + break; + + case 0xBC: + _gameSys->removeSequence(item->currSequenceId, item->id, 1); + _gameSys->setAnimation(0, 0, index + 1); + scene51_clearItem(item); + break; + + default: + if (item->droppedSequenceId) { + _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); + _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); + item->currSequenceId = item->droppedSequenceId; + item->y = 0; + } + break; + + } + +} + +void GnapEngine::scene51_removeCollidedItems() { + for (int i = 0; i < 6; ++i) { + if (_s51_items[i].isCollision) { + _gameSys->removeSequence(_s51_items[i].currSequenceId, _s51_items[i].id, 1); + _gameSys->setAnimation(0, 0, i + 1); + scene51_clearItem(&_s51_items[i]); + } + } + _s51_itemsCtr2 = 0; +} + +int GnapEngine::scene51_itemIsCaught(Scene51Item *item) { + + if (!item->canCatch) + return 0; + + if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { + int v4 = scene51_getPosRight(_s51_platypusJumpSequenceId) + 97; + if (item->collisionX < v4 && v4 - item->collisionX < 56) + return 1; + } else { + int v2 = scene51_getPosLeft(_s51_platypusJumpSequenceId); + if (item->collisionX > v2 && item->collisionX - v2 < 56) + return 1; + } + + if (item->currSequenceId == 0xC1) { + int v3 = item->collisionX + 100; + if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { + if (ABS(scene51_getPosRight(_s51_platypusJumpSequenceId) + 46 - v3) < 56) + return 1; + } else if (ABS(scene51_getPosLeft(_s51_platypusJumpSequenceId) + 46 - v3) < 56) { + return 1; + } + } + + return 0; +} + +bool GnapEngine::scene51_isJumpingRight(int sequenceId) { + return sequenceId >= 0x76 && sequenceId <= 0x95; +} + +bool GnapEngine::scene51_isJumpingLeft(int sequenceId) { + return sequenceId >= 0x96 && sequenceId <= 0xB5; +} + +bool GnapEngine::scene51_isJumping(int sequenceId) { + return sequenceId >= 0x76 && sequenceId <= 0xB5; +} + +void GnapEngine::scene51_waitForAnim(int animationIndex) { + while (_gameSys->getAnimationStatus(animationIndex) != 2) { + // pollMessages(); + scene51_updateItemAnimations(); + gameUpdateTick(); + } +} + +int GnapEngine::scene51_getPosRight(int sequenceId) { + static const int kRightPosTbl[] = { + 131, 159, 178, 195, 203, 219, 238, 254, + 246, 274, 293, 310, 318, 334, 353, 369, + 362, 390, 409, 426, 434, 450, 469, 485, + 477, 505, 524, 541, 549, 565, 584, 600 + }; + + if (sequenceId >= 118 && sequenceId <= 149) + return kRightPosTbl[sequenceId - 118]; + return -1; +} + +int GnapEngine::scene51_getPosLeft(int sequenceId) { + static const int kLeftPosTbl[] = { + 580, 566, 550, 536, 526, 504, 488, 469, + 460, 446, 430, 416, 406, 384, 368, 349, + 342, 328, 312, 298, 288, 266, 250, 231, + 220, 206, 190, 176, 166, 144, 128, 109 + }; + + if (sequenceId >= 150 && sequenceId <= 181) + return kLeftPosTbl[sequenceId - 150]; + return -1; +} + +void GnapEngine::scene51_playIntroAnim() { + int soundCtr = 0; + + _s51_platypusSequenceId = 0x76; + _s51_platypusNextSequenceId = 0x76; + + for (int i = 0; i < 6; ++i) + scene51_clearItem(&_s51_items[i]); + + _s51_items[0].currSequenceId = 0xBA; + _s51_items[0].x2 = 320; + _s51_items[0].x = -42; + _s51_items[0].y = 15; + _s51_items[0].id = 249; + _s51_items[0].isCollision = 1; + + _gameSys->insertSequence(_s51_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0); + _gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _s51_items[0].x, _s51_items[0].y); + _gameSys->setAnimation(0xBA, 249, 1); + _gameSys->setAnimation(_s51_platypusSequenceId, 256, 0); + + while (_s51_platypusSequenceId < 0x80) { + scene51_waitForAnim(0); + ++_s51_platypusNextSequenceId; + _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, -179, 0); + _s51_platypusSequenceId = _s51_platypusNextSequenceId; + ++soundCtr; + if (soundCtr % 4 == 0) + playSound(214, 0); + } + + _s51_platypusNextSequenceId = 0x75; + + while (_s51_platypusSequenceId != 0x84) { + scene51_waitForAnim(0); + ++_s51_platypusNextSequenceId; + int oldSequenceId = _s51_platypusNextSequenceId; + int v0 = scene51_checkCollision(_s51_platypusNextSequenceId); + _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, v0, 0); + _s51_platypusSequenceId = _s51_platypusNextSequenceId; + if (v0) { + _s51_platypusNextSequenceId = oldSequenceId; + } else { + ++soundCtr; + if (soundCtr % 4 == 0) + playSound(214, 0); + } + } + + scene51_waitForAnim(0); + +} + +void GnapEngine::scene51_updateGuyAnimation() { + + if (!_timers[4]) { + _timers[4] = getRandom(20) + 60; + + switch (getRandom(5)) { + case 0: + _s51_guyNextSequenceId = 0xC3; + break; + case 1: + _s51_guyNextSequenceId = 0xC4; + break; + case 2: + _s51_guyNextSequenceId = 0xC5; + break; + case 3: + _s51_guyNextSequenceId = 0xC6; + break; + case 4: + _s51_guyNextSequenceId = 0xC7; + break; + } + + _gameSys->insertSequence(_s51_guyNextSequenceId, 39, _s51_guySequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s51_guySequenceId = _s51_guyNextSequenceId; + _s51_guyNextSequenceId = -1; + + } + +} + +int GnapEngine::scene51_incCashAmount(int sequenceId) { + switch (sequenceId) { + case 0xBD: + _s51_cashAmount += 10; + break; + case 0xC0: + case 0xC1: + _s51_cashAmount += 100; + break; + case 0xB6: + case 0xB7: + _s51_cashAmount -= 10 * getRandom(5) + 50; + if (_s51_cashAmount < 0) + _s51_cashAmount = 0; + break; + } + if (_s51_cashAmount > 1995) + _s51_cashAmount = 1995; + scene51_updateCash(_s51_cashAmount); + return _s51_cashAmount; +} + +void GnapEngine::scene51_winMinigame() { + scene51_updateCash(1995); + playSound(218, 0); + // TODO delayTicksA(1, 5); + _newSceneNum = 48; + invRemove(kItemBanana); +} + +void GnapEngine::scene51_playCashAppearAnim() { + _gameSys->setAnimation(0xC8, 252, 0); + _gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20); + while (_gameSys->getAnimationStatus(0) != 2) { + gameUpdateTick(); + // checkGameAppStatus(); + } +} + +void GnapEngine::scene51_updateCash(int amount) { + scene51_drawDigit(amount / 1000, 0); + scene51_drawDigit(amount / 100 % 10, 1); + scene51_drawDigit(amount / 10 % 10, 2); + scene51_drawDigit(amount % 10, 3); +} + +void GnapEngine::scene51_drawDigit(int digit, int position) { + if (digit != _s51_digits[position]) { + _gameSys->insertSequence(kDigitSequenceIds[digit], 253, + _s51_digitSequenceIds[position], 253, + kSeqSyncWait, 0, kDigitPositions[position] - 20, -20); + _s51_digitSequenceIds[position] = kDigitSequenceIds[digit]; + _s51_digits[position] = digit; + } +} + +void GnapEngine::scene51_initCashDisplay() { + for (int position = 0; position < 4; ++position) { + _s51_digits[position] = 0; + _s51_digitSequenceIds[position] = kDigitSequenceIds[0]; + _gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0, + kSeqNone, 0, kDigitPositions[position] - 20, -20); + } + _s51_cashAmount = 0; +} + +void GnapEngine::scene51_run() { + + int soundCtr = 0; + bool isIdle = true; + + _s51_itemsCtr = 0; + _newSceneNum = _prevSceneNum; + _s51_cashAmount = 0; + _s51_platypusJumpSequenceId = 0x84; + endSceneInit(); + + hideCursor(); + setGrabCursorSprite(-1); + + _s51_guySequenceId = 0xC3; + _s51_guyNextSequenceId = -1; + + _gameSys->insertSequence(0xC3, 39, 0, 0, kSeqNone, 0, 0, 0); + + _timers[4] = getRandom(20) + 60; + + scene51_playCashAppearAnim(); + scene51_initCashDisplay(); + scene51_playIntroAnim(); + + _s51_platypusNextSequenceId = 0x74; + _gameSys->setAnimation(0x74, 256, 0); + _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 362, 0); + _s51_platypusSequenceId = _s51_platypusNextSequenceId; + + _s51_itemInsertDirection = 0; + _s51_itemInsertX = 685; + _s51_dropSpeedTicks = 10; + _s51_nextDropItemKind = 0; + + for (int i = 0; i < 6; ++i) + scene51_clearItem(&_s51_items[i]); + + _s51_itemInsertX = getRandom(556) + 129; + + _timers[0] = 15; + + _s51_itemsCaughtCtr = 0; + _s51_dropLoseCash = false; + _s51_itemsCtr1 = 20; + + clearKeyStatus1(Common::KEYCODE_RIGHT); + clearKeyStatus1(Common::KEYCODE_LEFT); + clearKeyStatus1(Common::KEYCODE_UP); + clearKeyStatus1(Common::KEYCODE_SPACE); + clearKeyStatus1(Common::KEYCODE_ESCAPE); + + bool isCollision = false; + bool startWalk = true; + + while (!_sceneDone) { + + if (sceneXX_sub_4466B1()) + _sceneDone = true; + + gameUpdateTick(); + + scene51_updateGuyAnimation(); + scene51_dropNextItem(); + scene51_updateItemAnimations(); + + if (isKeyStatus2(Common::KEYCODE_UP) || isKeyStatus2(Common::KEYCODE_SPACE)) { + clearKeyStatus1(Common::KEYCODE_UP); + clearKeyStatus1(Common::KEYCODE_SPACE); + if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { + scene51_waitForAnim(0); + _gameSys->setAnimation(0xB8, 256, 0); + _gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 348, 0); + _s51_platypusSequenceId = 0xB8; + scene51_waitForAnim(0); + _s51_platypusNextSequenceId += 6; + if (_s51_platypusNextSequenceId > 0x95) + _s51_platypusNextSequenceId = 0x95; + _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; + } else { + scene51_waitForAnim(0); + _gameSys->setAnimation(0xB9, 256, 0); + _gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); + _s51_platypusSequenceId = 0xB9; + scene51_waitForAnim(0); + _s51_platypusNextSequenceId += 6; + if (_s51_platypusNextSequenceId > 0xB5) + _s51_platypusNextSequenceId = 0xB5; + _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; + } + isIdle = false; + } + + while (isKeyStatus2(Common::KEYCODE_RIGHT) && _s51_platypusNextSequenceId != 0x96) { + // pollMessages(); + if (_s51_platypusNextSequenceId == 0xB6) + _s51_platypusNextSequenceId = 0x76; + scene51_updateItemAnimations(); + if (startWalk) { + _s51_platypusNextSequenceId = 0x86; + startWalk = false; + } + + if (_gameSys->getAnimationStatus(0) == 2) { + int collisionX = scene51_checkCollision(_s51_platypusNextSequenceId); + if (collisionX) + scene51_incCashAmount(_s51_platypusNextSequenceId); + _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); + _s51_platypusSequenceId = _s51_platypusNextSequenceId; + if (collisionX) { + isCollision = true; + ++_s51_platypusJumpSequenceId; + _s51_platypusNextSequenceId = _s51_platypusJumpSequenceId; + } else { + _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; + } + if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { + ++_s51_platypusNextSequenceId; + if (!isCollision) { + if (isKeyStatus2(Common::KEYCODE_UP) || isKeyStatus2(Common::KEYCODE_SPACE)) { + clearKeyStatus1(Common::KEYCODE_UP); + clearKeyStatus1(Common::KEYCODE_SPACE); + scene51_waitForAnim(0); + _gameSys->setAnimation(0xB8, 256, 0); + _gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 348, 0); + _s51_platypusSequenceId = 0xB8; + scene51_waitForAnim(0); + _s51_platypusNextSequenceId += 6; + if (_s51_platypusNextSequenceId > 0x95) + _s51_platypusNextSequenceId = 0x95; + _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; + } else { + ++soundCtr; + if (soundCtr % 4 == 0) + playSound(214, 0); + } + } + } else { + _s51_platypusNextSequenceId = 150 - (_s51_platypusJumpSequenceId - 150); + } + isCollision = false; + isIdle = false; + } + gameUpdateTick(); + } + + while (isKeyStatus2(Common::KEYCODE_LEFT) && _s51_platypusNextSequenceId != 0xB6) { + // pollMessages(); + scene51_updateItemAnimations(); + if (startWalk) { + _s51_platypusNextSequenceId = 0xA5; + startWalk = false; + } + + if (_gameSys->getAnimationStatus(0) == 2) { + int collisionX = scene51_checkCollision(_s51_platypusNextSequenceId); + if (collisionX) + scene51_incCashAmount(_s51_platypusNextSequenceId); + _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); + _s51_platypusSequenceId = _s51_platypusNextSequenceId; + if (collisionX) { + isCollision = true; + ++_s51_platypusJumpSequenceId; + _s51_platypusNextSequenceId = _s51_platypusJumpSequenceId; + } else { + _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; + } + if (scene51_isJumpingLeft(_s51_platypusJumpSequenceId)) { + ++_s51_platypusNextSequenceId; + if (!isCollision) { + if (isKeyStatus2(Common::KEYCODE_UP) || isKeyStatus2(Common::KEYCODE_SPACE)) { + clearKeyStatus1(Common::KEYCODE_UP); + clearKeyStatus1(Common::KEYCODE_SPACE); + scene51_waitForAnim(0); + _gameSys->setAnimation(0xB9, 256, 0); + _gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); + _s51_platypusSequenceId = 0xB9; + scene51_waitForAnim(0); + _s51_platypusNextSequenceId += 6; + if (_s51_platypusNextSequenceId > 0xB5) + _s51_platypusNextSequenceId = 0xB5; + _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; + } else { + ++soundCtr; + if (soundCtr % 4 == 0) + playSound(214, 0); + } + } + } else { + _s51_platypusNextSequenceId = 182 - (_s51_platypusJumpSequenceId - 118); + } + isCollision = false; + isIdle = false; + } + gameUpdateTick(); + } + + if (!isIdle && _gameSys->getAnimationStatus(0) == 2) { + if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { + _gameSys->setAnimation(0x74, 256, 0); + _gameSys->insertSequence(0x74, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 362, 0); + _s51_platypusSequenceId = 0x74; + } else { + _gameSys->setAnimation(0x75, 256, 0); + _gameSys->insertSequence(0x75, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosLeft(_s51_platypusJumpSequenceId) - 341, 0); + _s51_platypusSequenceId = 0x75; + } + scene51_waitForAnim(0); + isIdle = true; + } + + } + + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(Common::KEYCODE_UP); + clearKeyStatus1(Common::KEYCODE_SPACE); + clearKeyStatus1(Common::KEYCODE_RIGHT); + clearKeyStatus1(Common::KEYCODE_LEFT); + + _gameSys->setAnimation(0, 0, 0); + for (int i = 0; i < 6; ++i) + _gameSys->setAnimation(0, 0, i + 1); + + showCursor(); + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp new file mode 100644 index 0000000000..62cc2f3728 --- /dev/null +++ b/engines/gnap/scenes/scene52.cpp @@ -0,0 +1,907 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +int GnapEngine::scene52_init() { + scene52_initAnims(); + return 0x2B; +} + +void GnapEngine::scene52_updateHotspots() { + _hotspotsCount = 0; +} + +void GnapEngine::scene52_update() { + + for (int rowNum = 0; rowNum < 7; ++rowNum) { + gameUpdateTick(); + if (_gameSys->getAnimationStatus(_s52_alienRowAnims[rowNum]) == 2) { + scene52_updateAlienRow(rowNum); + rowNum = 0; + } + } + + if (_s52_liveAlienRows == 0 && !_s52_alienSingle) { + _s52_alienWave = false; + playSound(48, 0); + ++_s52_alienCounter; + if (_s52_alienCounter != 3) { + _timers[0] = 50; + _timers[2] = 100; + _s52_alienRowDownCtr = 0; + _s52_alienSingle = true; + } + } + + if (_s52_alienSingle && !_timers[0]) { + scene52_initAliens(); + _s52_alienSingle = false; + _timers[2] = 5; + _s52_alienWave = true; + } + + if ((_s52_alienRowDownCtr || _s52_liveAlienRows == 0) && !_s52_alienSingle) { + scene52_moveDownAlienRow(); + _s52_alienRowDownCtr = 0; + } + + if (isKeyStatus1(Common::KEYCODE_UP) || isKeyStatus1(Common::KEYCODE_SPACE)) { + clearKeyStatus1(Common::KEYCODE_SPACE); + clearKeyStatus1(Common::KEYCODE_UP); + if (!_s52_aliensCount) + scene52_fireShipCannon(_s52_shipPosX); + } + + if (_s52_shipCannonFiring) + scene52_updateShipCannon(); + + scene52_fireAlienCannon(); + scene52_updateAlienCannons(); + + if (_s52_aliensCount == 1) { + _s52_alienWave = false; + _timers[3] = 20; + _timers[2] = 100; + ++_s52_aliensCount; + } + + if (_s52_aliensCount && !_timers[3]) { + scene52_updateAliens(); + scene52_loseShip(); + if (_s52_shipsLeft != 0) { + _timers[3] = 40; + while (_timers[3]) { + scene52_updateAlienCannons(); + if (_s52_shipCannonFiring) + scene52_updateShipCannon(); + gameUpdateTick(); + } + scene52_initAliens(); + _s52_shipPosX = (800 - _s52_shipMidX) / 2; + _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _s52_ufoSequenceId = _s52_nextUfoSequenceId; + _timers[2] = 5; + _s52_alienWave = true; + } else { + _sceneDone = true; + } + } + + if (_timers[1] || scene52_getFreeShipCannon() == -1) { + _s52_nextUfoSequenceId = 34; + if (_s52_ufoSequenceId != 34) + _s52_shipFlag = true; + } else { + _s52_nextUfoSequenceId = 34; + if (_s52_ufoSequenceId != 34) + _s52_shipFlag = true; + } + + if (_s52_shipFlag) { + if (_gameSys->getAnimationStatus(7) == 2) { + _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _s52_ufoSequenceId = _s52_nextUfoSequenceId; + } + _s52_shipFlag = false; + } + + if (_s52_alienWave && !_timers[0]) { + scene52_playSound(); + int v0 = _s52_alienSpeed; + if (_s52_alienSpeed >= 10) + v0 = 10; + int v1 = v0; + if (v0 < 2) + v1 = 2; + _timers[0] = v1; + } +} + +void GnapEngine::scene52_initShipCannon(int bottomY) { + _s52_shipCannonFired = 0; + _s52_shipCannonWidth = MAX(_gameSys->getSpriteWidthById(14), _gameSys->getSpriteWidthById(16)); + _s52_shipCannonHeight = MAX(_gameSys->getSpriteHeightById(14), _gameSys->getSpriteHeightById(16)); + _s52_shipCannonTopY = bottomY - _s52_shipCannonHeight; + _s52_shipCannonFiring = 0; +} + +void GnapEngine::scene52_initAlienCannons() { + for (int i = 0; i < 3; ++i) { + _s52_alienCannonIds[i] = 0; + _s52_alienCannonFired[i] = 0; + } + _s52_alienCannonSequenceIds[0] = 30; + _s52_alienCannonSequenceIds[1] = 31; + _s52_alienCannonSequenceIds[2] = 32; +} + +void GnapEngine::scene52_fireShipCannon(int posX) { + + if (_timers[1]) + return; + + int cannonNum = scene52_getFreeShipCannon(); + if (cannonNum != -1) { + _s52_shipCannonPosX = _s52_shipMidX / 2 + posX - _s52_shipCannonWidth / 2; + _s52_shipCannonPosY = _s52_shipCannonTopY; + _gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8); + _gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); + playSound(0x2D, 0); + if (scene52_shipCannonHitShield(cannonNum)) { + _gameSys->setAnimation(0, 0, cannonNum + 8); + _gameSys->removeSequence(0x23, cannonNum + 256, 1); + } else { + _s52_shipCannonFired = 1; + _s52_shipCannonPosY -= 13; + _s52_shipCannonFiring = 1; + } + _timers[1] = 5; + } + +} + +void GnapEngine::scene52_fireAlienCannon() { + + if (_timers[2]) + return; + + int cannonNum = scene52_getFreeAlienCannon(); + if (cannonNum != -1) { + int alienX1 = _s52_alienLeftX + _s52_alienRowXOfs[0]; + int alienX2 = _s52_alienLeftX + _s52_alienRowXOfs[0] + 5 * _s52_alienWidth - (_s52_alienWidth / 2 - 15); + _s52_alienCannonPosX[cannonNum] = getRandom(alienX2 - alienX1) + alienX1; + _s52_alienCannonPosY[cannonNum] = 104; + _s52_alienCannonFired[cannonNum] = 1; + _gameSys->setAnimation(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, cannonNum + 9); + _gameSys->insertSequence(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, 0, 0, + kSeqNone, 0, _s52_alienCannonPosX[cannonNum], _s52_alienCannonPosY[cannonNum]); + _s52_alienCannonPosY[cannonNum] -= 13; + _timers[2] = 5; + } + +} + +int GnapEngine::scene52_getFreeShipCannon() { + if (!_s52_shipCannonFired) + return 0; + return -1; +} + +int GnapEngine::scene52_getFreeAlienCannon() { + for (int i = 0; i < 3; ++i) + if (!_s52_alienCannonFired[i]) + return i; + return -1; +} + +void GnapEngine::scene52_updateShipCannon() { + if (_s52_shipCannonFired && _gameSys->getAnimationStatus(8) == 2) { + _s52_shipCannonPosY -= 13; + if (_s52_shipCannonPosY - 13 >= 135) { + if (scene52_updateHitAlien()) { + _gameSys->setAnimation(0, 0, 8); + _gameSys->removeSequence(35, 256, 1); + _s52_shipCannonFired = 0; + scene52_drawScore(_s52_gameScore); + } else { + _gameSys->setAnimation(35, 256, 8); + _gameSys->insertSequence(35, 256, 35, 256, kSeqSyncWait, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); + _s52_shipCannonPosY -= 13; + } + } else { + _gameSys->setAnimation(0, 0, 8); + _gameSys->removeSequence(35, 256, 1); + _s52_shipCannonFired = 0; + } + } +} + +void GnapEngine::scene52_updateAlienCannons() { + for (int i = 0; i < 3; ++i) { + if (_s52_alienCannonFired[i] && _gameSys->getAnimationStatus(i + 9) == 2) { + _s52_alienCannonPosY[i] += 13; + if (_s52_shipCannonHeight + _s52_alienCannonPosY[i] + 13 <= 550) { + if (scene52_alienCannonHitShip(i)) { + _gameSys->setAnimation(0, 0, i + 9); + _s52_alienCannonFired[i] = 0; + scene52_shipExplode(); + } else if (scene52_alienCannonHitShield(i)) { + _s52_alienCannonFired[i] = 0; + } else { + _gameSys->insertSequence(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, 0, 0, + kSeqNone, 0, _s52_alienCannonPosX[i], _s52_alienCannonPosY[i]); + _gameSys->setAnimation(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, i + 9); + _s52_alienCannonIds[i] = 1 - _s52_alienCannonIds[i]; + _s52_alienCannonPosY[i] += 13; + } + } else { + _gameSys->setAnimation(0, 0, i + 9); + _s52_alienCannonFired[i] = 0; + } + } + } +} + +void GnapEngine::scene52_initAliens() { + + if (!_s52_aliensInitialized) { + scene52_initAlienSize(); + _s52_aliensInitialized = true; + } + + _s52_liveAlienRows = 0; + _s52_alienSpeed = 0; + _s52_bottomAlienFlag = false; + _s52_aliensCount = 0; + _s52_alienSingle = false; + _s52_alienRowDownCtr = 0; + + scene52_initShields(); + + _s52_alienRowKind[0] = -1; + _s52_alienRowKind[1] = -1; + _s52_alienRowKind[2] = -1; + _s52_alienRowKind[3] = -1; + _s52_alienRowKind[4] = getRandom(2) != 0 ? 24 : 27; + _s52_alienRowKind[5] = getRandom(2) != 0 ? 25 : 28; + _s52_alienRowKind[6] = getRandom(2) != 0 ? 26 : 29; + + for (int i = 0; i < 7; ++i) { + _s52_alienRowAnims[i] = i; + _s52_alienRowXOfs[i] = 0; + scene52_initAlienRowKind(i, _s52_alienRowKind[i]); + scene52_insertAlienRow(i); + } + +} + +void GnapEngine::scene52_initAlienRowKind(int rowNum, int alienKind) { + for (int i = 0; i < 5; ++i) + _s52_items[rowNum][i] = alienKind; +} + +void GnapEngine::scene52_insertAlienRow(int rowNum) { + if (_s52_alienRowKind[rowNum] >= 0) { + scene52_insertAlienRowAliens(rowNum); + _s52_alienRowIds[rowNum] = 256; + _gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); + ++_s52_liveAlienRows; + } +} + +void GnapEngine::scene52_insertAlienRowAliens(int rowNum) { + int xOffs = _s52_alienLeftX; + int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10; + for (int i = 0; i < 5; ++i) { + if (_s52_items[rowNum][i] >= 0) { + _gameSys->insertSequence(_s52_items[rowNum][i], i + 256, 0, 0, kSeqNone, 0, xOffs, yOffs); + ++_s52_alienSpeed; + } + xOffs += _s52_alienWidth; + } +} + +void GnapEngine::scene52_updateAlienRow(int rowNum) { + + if (_s52_alienRowKind[rowNum] != -1 && !scene52_checkAlienRow(rowNum)) { + scene52_updateAlienRowXOfs(); + _s52_alienRowIds[rowNum] = -1; + int xOffs = _s52_alienLeftX + _s52_alienRowXOfs[rowNum]; + int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10; + for (int i = 0; i < 5; ++i) { + if (_s52_items[rowNum][i] >= 0) { + _gameSys->insertSequence(_s52_items[rowNum][i], i + 256, _s52_items[rowNum][i], i + 256, kSeqSyncWait, 0, xOffs, yOffs); + if (_s52_alienRowIds[rowNum] == -1) + _s52_alienRowIds[rowNum] = i + 256; + } else if (_s52_items[rowNum][i] == -2) { + _gameSys->removeSequence(_s52_alienRowKind[rowNum], i + 256, 1); + _s52_items[rowNum][i] = -1; + --_s52_alienSpeed; + } + xOffs += _s52_alienWidth; + } + if (_s52_alienRowIds[rowNum] == -1) { + _gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); + // MessageBoxA(0, "No live aliens!", "Error 3:", 0x30u); + } else { + _gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); + } + if (rowNum == 1) { + for (int j = 0; j < 3; ++j) { + if (_s52_shieldSpriteIds[j] != -1) { + _gameSys->fillSurface(0, _s52_shieldPosX[j], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _s52_shieldSpriteIds[j] = -1; + } + } + } + if (rowNum == 0 && _s52_bottomAlienFlag) + scene52_shipExplode(); + } +} + +void GnapEngine::scene52_moveDownAlienRow() { + + int v2[5], v3, v1, v0, v4; + + for (int i = 0; i < 5; ++i) + v2[i] = _s52_items[0][i]; + + v3 = _s52_alienRowIds[0]; + v1 = _s52_alienRowAnims[0]; + v0 = _s52_alienRowKind[0]; + v4 = _s52_alienRowXOfs[0]; + + for (int j = 0; j < 7; ++j) { + for (int i = 0; i < 5; ++i) + _s52_items[j][i] = _s52_items[j + 1][i]; + _s52_alienRowIds[j] = _s52_alienRowIds[j + 1]; + _s52_alienRowAnims[j] = _s52_alienRowAnims[j + 1]; + _s52_alienRowKind[j] = _s52_alienRowKind[j + 1]; + _s52_alienRowXOfs[j] = _s52_alienRowXOfs[j + 1]; + } + + for (int i = 0; i < 5; ++i) + _s52_items[6][i] = v2[i]; + + _s52_alienRowIds[6] = v3; + _s52_alienRowAnims[6] = v1; + _s52_alienRowKind[6] = v0; + _s52_alienRowXOfs[6] = v4; + + scene52_updateAlien(6); + scene52_initAlienRowKind(6, _s52_alienRowKind[6]); + scene52_insertAlienRow(6); + + _s52_bottomAlienFlag = _s52_alienRowKind[0] > -1; +} + +int GnapEngine::scene52_updateHitAlien() { + int result = 0, rowNum, ya; + + int y = _s52_shipCannonTopY - _s52_shipCannonPosY; + + if (y == 26) { + rowNum = 1; + ya = _s52_shipCannonPosY + 26; + } else { + if (y % 52) + return 0; + rowNum = y / 52 + 1; + ya = _s52_shipCannonPosY; + } + + if (rowNum < 7) { + int hitAlienNum = scene52_getHitAlienNum(rowNum); + if (hitAlienNum != -1 && _s52_items[rowNum][hitAlienNum] >= 0) { + _s52_gameScore = ((_s52_items[rowNum][hitAlienNum] - 24) % 3 + _s52_gameScore + 1) % 1000; + _s52_items[rowNum][hitAlienNum] = -2; + playSound(44, 0); + _gameSys->insertSequence(0x21, 266, 0, 0, + kSeqNone, 0, _s52_alienLeftX + hitAlienNum * _s52_alienWidth + _s52_alienRowXOfs[rowNum] - 10, ya - _s52_alienHeight); + result = 1; + } + } + + return result; +} + +int GnapEngine::scene52_getHitAlienNum(int rowNum) { + + int result = -1; + + int v3 = _s52_alienLeftX + _s52_alienRowXOfs[rowNum]; + + if (_s52_shipCannonPosX >= v3) { + int v8 = _s52_alienWidth / 2 - 15; + if (v3 + 5 * _s52_alienWidth - v8 >= _s52_shipCannonPosX) { + int v4 = v3 + _s52_alienWidth; + if (_s52_shipCannonPosX >= v4 - v8) { + int v5 = v4 + _s52_alienWidth; + if (_s52_shipCannonPosX >= v5 - v8) { + int v6 = v5 + _s52_alienWidth; + if (_s52_shipCannonPosX >= v6 - v8) { + int v7 = v6 + _s52_alienWidth; + if (_s52_shipCannonPosX >= v7 - v8) { + if (_s52_shipCannonPosX >= v7 + _s52_alienWidth - v8) + result = -1; + else + result = 4; + } else { + result = 3; + } + } else { + result = 2; + } + } else { + result = 1; + } + } else { + result = 0; + } + } else { + result = -1; + } + } else { + result = -1; + } + return result; +} + +int GnapEngine::scene52_alienCannonHitShip(int cannonNum) { + int result = 0; + + if (_s52_aliensCount) { + result = 0; + } else { + int cannonY = _s52_alienCannonPosY[cannonNum] - 13; + if (_s52_arcadeScreenBottom <= cannonY) { + if (_s52_shipMidY + _s52_arcadeScreenBottom > cannonY) { + if (_s52_alienCannonPosX[cannonNum] >= _s52_shipPosX) + result = _s52_alienCannonPosX[cannonNum] < _s52_shipMidX + _s52_shipPosX; + else + result = 0; + } else { + result = 0; + } + } else { + result = 0; + } + } + return result; +} + +int GnapEngine::scene52_alienCannonHitShield(int cannonNum) { + int result = 0; + + int v3 = _s52_alienCannonPosY[cannonNum] + 39; + if (_s52_arcadeScreenBottom - 44 > v3) + return 0; + + if (_s52_arcadeScreenBottom <= v3) + return 0; + + if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[0]) + return 0; + + if (_s52_alienCannonPosX[cannonNum] > _s52_shieldPosX[2] + 33) + return 0; + + int shieldNum = -1; + if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[0] + 33) + shieldNum = 0; + + if (shieldNum < 0 && _s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[1]) + return 0; + + if (shieldNum < 0 && _s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[1] + 33) + shieldNum = 1; + + if (shieldNum < 0) { + if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[2]) + return 0; + shieldNum = 2; + } + + if (_s52_shieldSpriteIds[shieldNum] == -1) { + result = 0; + } else { + ++_s52_shieldSpriteIds[shieldNum]; + if (_s52_shieldSpriteIds[shieldNum] <= 21) { + _gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); + } else { + _gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _s52_shieldSpriteIds[shieldNum] = -1; + } + _gameSys->setAnimation(0, 0, cannonNum + 9); + _gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[cannonNum] - 18, _s52_arcadeScreenBottom - 44); + playSound(0x2C, 0); + result = 1; + } + + return result; +} + +int GnapEngine::scene52_shipCannonHitShield(int cannonNum) { + int result = 0; + + if (_s52_shipCannonPosX < _s52_shieldPosX[0]) + return 0; + + if (_s52_shipCannonPosX > _s52_shieldPosX[2] + 33) + return 0; + + int shieldNum = -1; + if (_s52_shipCannonPosX < _s52_shieldPosX[0] + 33) + shieldNum = 0; + + if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1]) + return 0; + + if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1] + 33) + shieldNum = 1; + + if (shieldNum < 0) { + if (_s52_shipCannonPosX < _s52_shieldPosX[2]) + return 0; + shieldNum = 2; + } + + if (_s52_shieldSpriteIds[shieldNum] == -1) { + result = 0; + } else { + ++_s52_shieldSpriteIds[shieldNum]; + if (_s52_shieldSpriteIds[shieldNum] <= 21) { + _gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); + } else { + _gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _s52_shieldSpriteIds[shieldNum] = -1; + } + _gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_shipCannonPosX - 18, _s52_arcadeScreenBottom - 44); + playSound(0x2C, 0); + result = 1; + } + + return result; +} + +int GnapEngine::scene52_shipCannonHitAlien() { + int result = 0; + + if (_s52_aliensCount) { + result = 0; + } else if (scene52_checkAlienRow(0)) { + result = 0; + } else { + int v1 = _s52_alienLeftX + _s52_alienRowXOfs[0]; + if (_s52_shipMidX + _s52_shipPosX >= _s52_alienLeftX + _s52_alienRowXOfs[0]) { + int v7 = _s52_alienWidth / 2 - 15; + if (v1 + 5 * _s52_alienWidth - v7 >= _s52_shipPosX) { + int v2 = v1 + _s52_alienWidth; + if (_s52_items[0][0] <= -1 || v2 - v7 <= _s52_shipPosX) { + int v3 = v2 + _s52_alienWidth; + if (_s52_items[0][1] <= -1 || v3 - v7 <= _s52_shipPosX) { + int v4 = v3 + _s52_alienWidth; + if (_s52_items[0][2] <= -1 || v4 - v7 <= _s52_shipPosX) { + int v5 = v4 + _s52_alienWidth; + if (_s52_items[0][3] <= -1 || v5 - v7 <= _s52_shipPosX) { + int v6 = v5 + _s52_alienWidth; + result = _s52_items[0][4] > -1 && v6 - v7 > _s52_shipPosX; + } else { + result = 1; + } + } else { + result = 1; + } + } else { + result = 1; + } + } else { + result = 1; + } + } else { + result = 0; + } + } else { + result = 0; + } + } + + return result; +} + +void GnapEngine::scene52_shipExplode() { + if (!_s52_aliensCount) { + _gameSys->setAnimation(0, 0, 7); + _gameSys->removeSequence(_s52_ufoSequenceId, 256, 1); + playSound(44, 0); + _gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _s52_aliensCount = 1; + playSound(0x31, 0); + } +} + +int GnapEngine::scene52_checkAlienRow(int rowNum) { + + int v4 = 0; + + for (int i = 0; i < 5; ++i) + if (_s52_items[rowNum][i] >= 0) + return 0; + + for (int j = 0; j < 5; ++j) + if (_s52_items[rowNum][j] == -2) { + _gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, 1); + _s52_items[rowNum][j] = -1; + --_s52_alienSpeed; + v4 = 1; + } + + if (v4) { + _gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); + --_s52_liveAlienRows; + } + + if (_s52_liveAlienRows < 0) + _s52_liveAlienRows = 0; + + return 1; +} + +void GnapEngine::scene52_updateAlienRowXOfs() { + + int amount = 2 * (3 - _s52_liveAlienRows) + 1; + + if (_s52_alienSpeed == 2) + amount *= 4; + else if (_s52_alienSpeed == 1) + amount *= 10; + + if (_s52_alienDirection) { + for (int i = 0; i < 7; ++i) { + _s52_alienRowXOfs[i] -= amount; + if (_s52_alienRowXOfs[i] <= -100) { + _s52_alienRowXOfs[i] = -100; + _s52_alienDirection = 0; + ++_s52_alienRowDownCtr; + } + } + } else { + for (int j = 0; j < 7; ++j) { + _s52_alienRowXOfs[j] += amount; + if (_s52_alienRowXOfs[j] >= 100) { + _s52_alienRowXOfs[j] = 100; + _s52_alienDirection = 1; + ++_s52_alienRowDownCtr; + } + } + } + +} + +void GnapEngine::scene52_initAlienSize() { + + _s52_alienWidth = _gameSys->getSpriteWidthById(0); + if (_gameSys->getSpriteWidthById(1) > _s52_alienWidth) + _s52_alienWidth = _gameSys->getSpriteWidthById(1); + if (_gameSys->getSpriteWidthById(4) > _s52_alienWidth) + _s52_alienWidth = _gameSys->getSpriteWidthById(4); + if (_gameSys->getSpriteWidthById(5) > _s52_alienWidth) + _s52_alienWidth = _gameSys->getSpriteWidthById(5); + if (_gameSys->getSpriteWidthById(12) > _s52_alienWidth) + _s52_alienWidth = _gameSys->getSpriteWidthById(12); + if (_gameSys->getSpriteWidthById(13) > _s52_alienWidth) + _s52_alienWidth = _gameSys->getSpriteWidthById(13); + + _s52_alienHeight = _gameSys->getSpriteHeightById(0); + if (_gameSys->getSpriteHeightById(1) > _s52_alienHeight) + _s52_alienHeight = _gameSys->getSpriteHeightById(1); + if (_gameSys->getSpriteHeightById(4) > _s52_alienHeight) + _s52_alienHeight = _gameSys->getSpriteHeightById(4); + if (_gameSys->getSpriteHeightById(5) > _s52_alienHeight) + _s52_alienHeight = _gameSys->getSpriteHeightById(5); + if (_gameSys->getSpriteHeightById(12) > _s52_alienHeight) + _s52_alienHeight = _gameSys->getSpriteHeightById(12); + if (_gameSys->getSpriteHeightById(13) > _s52_alienHeight) + _s52_alienHeight = _gameSys->getSpriteHeightById(13); + + _s52_alienTopY = _s52_shipCannonTopY + 52; + _s52_alienLeftX = (800 - 5 * _s52_alienWidth) / 2; + +} + +void GnapEngine::scene52_playSound() { + if (_s52_soundToggle) { + playSound(0x2F, 0); + _s52_soundToggle = false; + } else { + playSound(0x2E, 0); + _s52_soundToggle = true; + } +} + +void GnapEngine::scene52_updateAliens() { + for (int i = 0; i < 7; ++i) + scene52_updateAlien(i); +} + +void GnapEngine::scene52_updateAlien(int rowNum) { + if (_s52_alienRowKind[rowNum] >= 0 && !scene52_checkAlienRow(rowNum)) { + for (int i = 0; i < 5; ++i) + if (_s52_items[rowNum][i] >= 0) + _s52_items[rowNum][i] = -2; + scene52_checkAlienRow(rowNum); + } +} + +void GnapEngine::scene52_loseShip() { + --_s52_shipsLeft; + if (_s52_shipsLeft == 2) { + _gameSys->fillSurface(0, 120, 140, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); + } else if (_s52_shipsLeft == 1) { + _gameSys->fillSurface(0, 120, 185, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); + } +} + +void GnapEngine::scene52_initShields() { + for (int i = 0; i < 3; ++i) { + _gameSys->drawSpriteToBackground(_s52_shieldPosX[i], _s52_arcadeScreenBottom - 44, 17); + _s52_shieldSpriteIds[i] = 17; + } +} + +void GnapEngine::scene52_initAnims() { + for (int i = 0; i < 7; ++i) + _gameSys->setAnimation(0, 0, i); + _gameSys->setAnimation(0, 0, 7); + for (int j = 0; j < 1; ++j) + _gameSys->setAnimation(0, 0, j + 8); + for (int k = 0; k < 3; ++k) + _gameSys->setAnimation(0, 0, k + 9); +} + +void GnapEngine::scene52_drawScore(int a1) { + char str[4]; + sprintf(str, "%03d", a1); + _gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); + _gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); +} + +void GnapEngine::scene52_run() { + + _timers[1] = 0; + + hideCursor(); + + // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000); + // TODO setFontSize(24); + + _s52_gameScore = 0; + _gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); + _gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); + + scene52_drawScore(0); + + _s52_shipMidX = 33; + _s52_shipMidY = _gameSys->getSpriteHeightById(15); + _s52_shipPosX = (800 - _s52_shipMidX) / 2; + _s52_arcadeScreenBottom = 496; + _s52_arcadeScreenRight = 595 - _s52_shipMidX; + _s52_arcadeScreenLeft = 210; + _s52_shipsLeft = 3; + _s52_alienCounter = 0; + + _s52_shieldPosX[0] = 247; + _s52_shieldPosX[1] = 387; + _s52_shieldPosX[2] = 525; + + for (int i = 0; i < 3; ++i) + _s52_shieldSpriteIds[i] = -1; + + _gameSys->drawSpriteToBackground(120, 140, 0xF); + _gameSys->drawSpriteToBackground(120, 185, 0xF); + + scene52_initShipCannon(_s52_arcadeScreenBottom); + scene52_initAlienCannons(); + scene52_initAliens(); + + _s52_nextUfoSequenceId = 0x22; + _gameSys->setAnimation(0x22, 256, 7); + _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + + _s52_ufoSequenceId = _s52_nextUfoSequenceId; + + clearKeyStatus1(Common::KEYCODE_RIGHT); + clearKeyStatus1(Common::KEYCODE_LEFT); + clearKeyStatus1(Common::KEYCODE_SPACE); + clearKeyStatus1(Common::KEYCODE_UP); + clearKeyStatus1(Common::KEYCODE_ESCAPE); + + _timers[2] = 5; + _s52_shipFlag = false; + + _timers[0] = 10; + _s52_alienWave = true; + + while (!_sceneDone) { + + gameUpdateTick(); + + while (isKeyStatus2(Common::KEYCODE_RIGHT)) { + scene52_update(); + if (_gameSys->getAnimationStatus(7) == 2) { + if (_s52_shipPosX < _s52_arcadeScreenRight) { + _s52_shipPosX += 15; + if (_s52_shipPosX > _s52_arcadeScreenRight) + _s52_shipPosX = _s52_arcadeScreenRight; + _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _s52_ufoSequenceId = _s52_nextUfoSequenceId; + if (_s52_bottomAlienFlag && scene52_shipCannonHitAlien()) + scene52_shipExplode(); + } + break; + } + } + + while (isKeyStatus2(Common::KEYCODE_LEFT)) { + scene52_update(); + if (_gameSys->getAnimationStatus(7) == 2) { + if (_s52_shipPosX > _s52_arcadeScreenLeft) { + _s52_shipPosX -= 15; + if (_s52_shipPosX < _s52_arcadeScreenLeft) + _s52_shipPosX = _s52_arcadeScreenLeft; + _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _s52_ufoSequenceId = _s52_nextUfoSequenceId; + if (_s52_bottomAlienFlag && scene52_shipCannonHitAlien()) + scene52_shipExplode(); + } + break; + } + } + + scene52_update(); + + if (sceneXX_sub_4466B1()) { + _s52_alienWave = false; + _gameSys->waitForUpdate(); + scene52_initAnims(); + clearKeyStatus1(30); + _sceneDone = true; + } + + } + + // TODO freeFont(); + + _gameSys->waitForUpdate(); + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp new file mode 100644 index 0000000000..20486eb34e --- /dev/null +++ b/engines/gnap/scenes/scene53.cpp @@ -0,0 +1,383 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +int GnapEngine::scene53_init() { + _gameSys->setAnimation(0, 0, 0); + _gameSys->setAnimation(0, 0, 1); + return 0x75; +} + +void GnapEngine::scene53_updateHotspots() { + setHotspot(0, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(2, 336, 361, 238, 270, SF_GRAB_CURSOR); + setHotspot(3, 376, 405, 243, 274, SF_GRAB_CURSOR); + setHotspot(4, 415, 441, 248, 276, SF_GRAB_CURSOR); + setHotspot(5, 329, 358, 276, 303, SF_GRAB_CURSOR); + setHotspot(6, 378, 408, 282, 311, SF_GRAB_CURSOR); + setHotspot(7, 417, 446, 286, 319, SF_GRAB_CURSOR); + setHotspot(8, 332, 361, 311, 342, SF_GRAB_CURSOR); + setHotspot(9, 376, 407, 318, 349, SF_GRAB_CURSOR); + setHotspot(10, 417, 447, 320, 353, SF_GRAB_CURSOR); + setHotspot(11, 377, 405, 352, 384, SF_GRAB_CURSOR); + setHotspot(12, 419, 450, 358, 394, SF_GRAB_CURSOR); + setHotspot(13, 328, 359, 346, 379, SF_GRAB_CURSOR); + setHotspot(14, 150, 650, 585, 600, SF_EXIT_D_CURSOR); + setDeviceHotspot(1, -1, -1, -1, -1); + _hotspotsCount = 15; +} + +int GnapEngine::scene53_pressPhoneNumberButton(int phoneNumber, int buttonNum) { + + static const int kGnapHandSequenceIds[13] = { + 0x00, + 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, + 0x4C, 0x4D, 0x4E, 0x50, 0x51, 0x4F + }; + + static const int kPlatypusHandSequenceIds[13] = { + 0x00, + 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x5C, 0x5D, 0x5B + }; + + if (_s53_isGnapPhoning) { + _gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); + _gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s53_currHandSequenceId = kGnapHandSequenceIds[buttonNum]; + } else { + _gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); + _gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s53_currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; + } + + _gnapActionStatus = 6; + while (_gameSys->getAnimationStatus(6) != 2) { + // checkGameAppStatus(); + updateMouseCursor(); + gameUpdateTick(); + } + _gnapActionStatus = -1; + + if (buttonNum < 11) + phoneNumber = buttonNum % 10 + 10 * phoneNumber; + + return phoneNumber; +} + +int GnapEngine::scene53_getRandomCallIndex() { + int index, tries = 0; + if (_s53_callsRndUsed == 0x7FFF) + _s53_callsRndUsed = 0; + do { + index = getRandom(16); + if (++tries == 300) + _s53_callsRndUsed = 0; + } while (_s53_callsRndUsed & (1 << index)); + _s53_callsRndUsed |= (1 << index); + return index; +} + +void GnapEngine::scene53_runRandomCall() { + + static const int kCallSequenceIds[15] = { + 0x60, 0x61, 0x62, 0x63, 0x64, + 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6A, 0x6B, 0x6C, 0x6D, 0x71 + }; + + int index; + + ++_s53_callsMadeCtr; + + if (_s53_callsMadeCtr <= 10) { + do { + index = scene53_getRandomCallIndex(); + } while (!_s53_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); + _gameSys->setAnimation(kCallSequenceIds[index], 1, 6); + _gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); + } else { + _gameSys->setAnimation(0x74, 1, 6); + _gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); + _s53_callsMadeCtr = 0; + } + + _gnapActionStatus = 1; + while (_gameSys->getAnimationStatus(6) != 2) { + updateMouseCursor(); + // checkGameAppStatus(); + gameUpdateTick(); + } + _gnapActionStatus = -1; + +} + +void GnapEngine::scene53_runChitChatLine() { + bool flag = false; + int sequenceId; + + _gameSys->setAnimation(0x6E, 1, 6); + _gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); + + _gnapActionStatus = 1; + while (_gameSys->getAnimationStatus(6) != 2) { + updateMouseCursor(); + // checkGameAppStatus(); + gameUpdateTick(); + } + _gnapActionStatus = -1; + + if (isFlag(15)) { + _gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s53_currHandSequenceId = 0x45; + } else { + _gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s53_currHandSequenceId = 0x5E; + } + + _hotspots[1].flags = SF_DISABLED; + + while (!flag) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + case 2: + sequenceId = 0x6F; + flag = 1; + break; + case 3: + sequenceId = 0x70; + flag = 1; + break; + case 4: + sequenceId = 0x71; + flag = 1; + break; + case 14: + sequenceId = -1; + flag = 1; + _isLeavingScene = true; + _sceneDone = 1; + _gnapActionStatus = 0; + _newSceneNum = 17; + break; + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + scene53_pressPhoneNumberButton(0, _sceneClickedHotspot - 1); + break; + } + + if (flag && sequenceId != -1) { + stopSound(0xA0); + scene53_pressPhoneNumberButton(0, _sceneClickedHotspot - 1); + _gnapActionStatus = 1; + _gameSys->setAnimation(sequenceId, 1, 6); + _gameSys->insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); + _gnapActionStatus = 1; + while (_gameSys->getAnimationStatus(6) != 2) { + updateMouseCursor(); + // checkGameAppStatus(); + gameUpdateTick(); + } + _gnapActionStatus = -1; + _gameSys->setAnimation(0x72, 1, 6); + _gameSys->insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); + _gnapActionStatus = 1; + while (_gameSys->getAnimationStatus(6) != 2) { + updateMouseCursor(); + // checkGameAppStatus(); + gameUpdateTick(); + } + _gnapActionStatus = -1; + } + + } + + scene53_updateHotspots(); + + _gnapActionStatus = 1; + + if (isFlag(15)) { + _gameSys->setAnimation(0x73, 40, 6); + _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_gameSys->getAnimationStatus(6) != 2) { + updateMouseCursor(); + // checkGameAppStatus(); + gameUpdateTick(); + } + _s53_currHandSequenceId = 0x73; + _gnapActionStatus = -1; + } + +} + +void GnapEngine::scene53_run() { + int phoneNumber = 0; + int phoneNumberLen = 0; + + queueInsertDeviceIcon(); + + if (isFlag(15)) { + _s53_currHandSequenceId = 0x45; + _s53_isGnapPhoning = true; + } else { + _s53_currHandSequenceId = 0x5E; + _s53_isGnapPhoning = false; + } + + _gameSys->insertSequence(_s53_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + + endSceneInit(); + + setVerbCursor(GRAB_CURSOR); + + playSound(0xA0, 1); + + while (!_sceneDone) { + + updateMouseCursor(); + updateCursorByHotspot(); + + testWalk(0, 0, -1, -1, -1, -1); + + _sceneClickedHotspot = getClickedHotspotId(); + updateGrabCursorSprite(0, 0); + + switch (_sceneClickedHotspot) { + case 1: + if (_gnapActionStatus < 0) { + runMenu(); + scene53_updateHotspots(); + } + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + stopSound(0xA0); + ++phoneNumberLen; + phoneNumber = scene53_pressPhoneNumberButton(phoneNumber, _sceneClickedHotspot - 1); + debug("phoneNumber: %d", phoneNumber); + if (phoneNumberLen == 7) { + _gnapActionStatus = 1; + if (isFlag(15)) { + _gameSys->setAnimation(0x73, 40, 6); + _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_gameSys->getAnimationStatus(6) != 2) { + updateMouseCursor(); + // checkGameAppStatus(); + gameUpdateTick(); + } + _s53_currHandSequenceId = 0x73; + _gnapActionStatus = -1; + } + if (phoneNumber == 7284141) { + scene53_runChitChatLine(); + phoneNumber = 0; + phoneNumberLen = 0; + _sceneDone = 1; + _newSceneNum = 17; + } else if (phoneNumber != 5556789 || isFlag(20)) { + scene53_runRandomCall(); + phoneNumber = 0; + phoneNumberLen = 0; + _sceneDone = 1; + _newSceneNum = 17; + } else { + phoneNumber = 0; + phoneNumberLen = 0; + _sceneDone = 1; + _newSceneNum = 17; + if (_s53_isGnapPhoning) + setFlag(25); + else + setFlag(26); + } + } + break; + case 12: + case 13: + scene53_pressPhoneNumberButton(0, _sceneClickedHotspot - 1); + break; + case 14: + if (_gnapActionStatus < 0) { + _gnapActionStatus = 1; + if (isFlag(15)) { + _gameSys->setAnimation(0x73, 40, 6); + _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_gameSys->getAnimationStatus(6) != 2) { + updateMouseCursor(); + // checkGameAppStatus(); + gameUpdateTick(); + } + _s53_currHandSequenceId = 0x73; + _gnapActionStatus = -1; + } + _isLeavingScene = true; + _sceneDone = 1; + _gnapActionStatus = 0; + _newSceneNum = 17; + } + break; + } + + checkGameKeys(); + + if (isKeyStatus1(8)) { + clearKeyStatus1(8); + runMenu(); + scene53_updateHotspots(); + } + + gameUpdateTick(); + + } + +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp new file mode 100644 index 0000000000..76bc66b9f3 --- /dev/null +++ b/engines/gnap/scenes/scene54.cpp @@ -0,0 +1,127 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +void GnapEngine::scene54_initCutscene1() { + _s99_dword_47F370[0] = 0x1BE; + _s99_dword_47F370[1] = 0x1BF; + _s99_dword_47F370[2] = 0x1BA; + _s99_dword_47F370[3] = 0x1BB; + _s99_dword_47F370[4] = 0x1BD; + _s99_dword_47F370[5] = 0x1BC; + _s99_dword_47F2F0[0] = 0x3C; + _s99_dword_47F2F0[1] = 0x43; + _s99_dword_47F2F0[2] = 0x44; + if (isFlag(20)) + _s99_dword_47F2F0[3] = 0x47; + else + _s99_dword_47F2F0[3] = 0x46; + _s99_dword_47F2F0[4] = 0x45; + _s99_dword_47F330[0] = 1; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = 1; + _s99_dword_47F330[3] = 2; + _s99_dword_47F330[4] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_canSkip[2] = 0; + _s99_canSkip[3] = 0; + _s99_canSkip[4] = 0; + _s99_itemsCount = 5; +} + +void GnapEngine::scene54_initCutscene2() { + _s99_dword_47F370[0] = 0x1C9; + _s99_dword_47F370[1] = 0x1C7; + _s99_dword_47F370[2] = 0x1CC; + _s99_dword_47F370[3] = 0x1C8; + _s99_dword_47F370[4] = 0x1CB; + _s99_dword_47F370[5] = 0x1C0; + _s99_dword_47F370[6] = 0x1CA; + _s99_dword_47F370[7] = 0x1CE; + _s99_dword_47F370[8] = 0x1CD; + _s99_dword_47F370[9] = 0x1C1; + _s99_dword_47F370[10] = 0x1C2; + _s99_dword_47F370[11] = 0x1C3; + _s99_dword_47F370[12] = 0x1C4; + _s99_dword_47F370[13] = 0x1C6; + _s99_dword_47F370[14] = 0x1C5; + _s99_dword_47F370[15] = 0x1D0; + _s99_dword_47F370[16] = 0x1D0; + _s99_dword_47F370[17] = 0x1D0; + _s99_dword_47F2F0[0] = 0xD5; + _s99_dword_47F2F0[1] = 0x14C; + _s99_dword_47F2F0[2] = 0xD5; + _s99_dword_47F2F0[3] = 0xBF; + _s99_dword_47F2F0[4] = 0xD6; + _s99_dword_47F2F0[5] = 0x154; + _s99_dword_47F2F0[6] = 0x155; + _s99_dword_47F2F0[7] = 0xB9; + _s99_dword_47F2F0[8] = 0xBA; + _s99_dword_47F2F0[9] = 0x17B; + _s99_dword_47F2F0[10] = 0x17A; + _s99_dword_47F2F0[11] = 0x17C; + _s99_dword_47F2F0[12] = 0x17A; + _s99_dword_47F2F0[13] = 0x1B7; + _s99_dword_47F2F0[14] = 0x1B8; + _s99_dword_47F2F0[15] = 0x1B9; + _s99_dword_47F330[0] = 2; + _s99_dword_47F330[1] = 1; + _s99_dword_47F330[2] = 2; + _s99_dword_47F330[3] = 1; + _s99_dword_47F330[4] = 1; + _s99_dword_47F330[5] = 1; + _s99_dword_47F330[6] = 1; + _s99_dword_47F330[7] = 1; + _s99_dword_47F330[8] = 1; + _s99_dword_47F330[9] = 1; + _s99_dword_47F330[10] = 1; + _s99_dword_47F330[11] = 1; + _s99_dword_47F330[12] = 1; + _s99_dword_47F330[13] = 1; + _s99_dword_47F330[14] = 1; + _s99_dword_47F330[15] = 1; + _s99_canSkip[0] = 0; + _s99_canSkip[1] = 0; + _s99_canSkip[2] = 0; + _s99_canSkip[3] = 0; + _s99_canSkip[4] = 0; + _s99_canSkip[5] = 0; + _s99_canSkip[6] = 0; + _s99_canSkip[7] = 0; + _s99_canSkip[8] = 0; + _s99_canSkip[9] = 0; + _s99_canSkip[10] = 0; + _s99_canSkip[11] = 0; + _s99_canSkip[12] = 0; + _s99_canSkip[13] = 1; + _s99_canSkip[14] = 1; + _s99_canSkip[15] = 0; + _s99_itemsCount = 16; +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp new file mode 100644 index 0000000000..2736addb31 --- /dev/null +++ b/engines/gnap/scenes/scenecore.cpp @@ -0,0 +1,658 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +int GnapEngine::initSceneLogic() { + + int backgroundId = -1; + + switch (_currentSceneNum) { +#if 0 // TODO + case 0: + backgroundId = scene00_init(); + _gameSys->setScaleValues(0, 500, 1, 1000); + break; +#endif + case 1: + backgroundId = scene01_init(); + scene01_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 2: + backgroundId = scene02_init(); + scene02_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 3: + backgroundId = scene03_init(); + scene03_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 4: + backgroundId = scene04_init(); + scene04_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 5: + backgroundId = scene05_init(); + scene05_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 6: + backgroundId = scene06_init(); + scene06_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 7: + backgroundId = scene07_init(); + scene07_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 8: + backgroundId = scene08_init(); + scene08_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 9: + backgroundId = scene09_init(); + scene09_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 10: + backgroundId = scene10_init(); + scene10_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 11: + backgroundId = scene11_init(); + scene11_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 12: + backgroundId = scene12_init(); + scene12_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 13: + backgroundId = scene13_init(); + scene13_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 14: + backgroundId = scene14_init(); + scene14_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + break; + case 15: + backgroundId = scene15_init(); + scene15_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + break; + case 16: + case 47: + case 48: + case 54: + backgroundId = cutscene_init(); + _gameSys->setScaleValues(0, 500, 1, 1000); + break; + case 17: + backgroundId = scene17_init(); + scene17_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 18: + backgroundId = scene18_init(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + scene18_updateHotspots(); + break; + case 19: + backgroundId = scene19_init(); + scene19_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 20: + backgroundId = scene20_init(); + scene20_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 21: + backgroundId = scene21_init(); + scene21_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 22: + backgroundId = scene22_init(); + scene22_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 23: + backgroundId = scene23_init(); + scene23_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 24: + backgroundId = scene24_init(); + scene24_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 136, 11, 10); + break; + case 25: + backgroundId = scene25_init(); + scene25_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 26: + backgroundId = scene26_init(); + scene26_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 27: + backgroundId = scene27_init(); + scene27_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 28: + backgroundId = scene28_init(); + scene28_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 29: + backgroundId = scene29_init(); + scene29_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 30: + backgroundId = scene30_init(); + scene30_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 31: + backgroundId = scene31_init(); + scene31_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 32: + backgroundId = scene32_init(); + scene32_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 33: + backgroundId = scene33_init(); + scene33_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 34: + backgroundId = scene03_init(); + scene03_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 35: + backgroundId = scene05_init(); + scene05_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 36: + backgroundId = scene06_init(); + scene06_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 37: + backgroundId = scene04_init(); + scene04_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 38: + backgroundId = scene38_init(); + scene38_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 39: + backgroundId = scene39_init(); + scene39_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 40: + backgroundId = scene40_init(); + scene40_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 41: + backgroundId = scene41_init(); + scene41_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 42: + backgroundId = scene42_init(); + scene42_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 43: + backgroundId = scene43_init(); + scene43_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 44: + backgroundId = scene44_init(); + scene44_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 45: + backgroundId = scene45_init(); + scene45_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 46: + backgroundId = scene46_init(); + scene46_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 49: + backgroundId = scene49_init(); + scene49_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 50: + backgroundId = scene50_init(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 51: + backgroundId = scene51_init(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 52: + backgroundId = scene52_init(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + case 53: + backgroundId = scene53_init(); + scene53_updateHotspots(); + _gameSys->setScaleValues(0, 500, 1, 1000); + initSceneGrid(21, 146, 11, 10); + break; + } + + return backgroundId; +} + +void GnapEngine::runSceneLogic() { + switch (_currentSceneNum) { + case 0: +#if 0 // TODO + scene00_run(); + if (_newSceneNum == 55) + _newSceneNum = 8; + break; +#endif + case 1: + scene01_run(); + if (_newSceneNum == 55) + _newSceneNum = 4; + break; + case 2: + scene02_run(); + if (_newSceneNum == 55) + _newSceneNum = 4; + break; + case 3: + scene03_run(); + if (_newSceneNum == 55) + _newSceneNum = 4; + break; + case 4: + scene04_run(); + if (_newSceneNum == 55) + _newSceneNum = 4; + break; + case 5: + scene05_run(); + if (_newSceneNum == 55) + _newSceneNum = 4; + break; + case 6: + scene06_run(); + if (_newSceneNum == 55) + _newSceneNum = 4; + break; + case 7: + scene07_run(); + if (_newSceneNum == 55) + _newSceneNum = 8; + break; + case 8: + scene08_run(); + if (_newSceneNum == 55) + _newSceneNum = 9; + break; + case 9: + scene09_run(); + if (_newSceneNum == 55) + _newSceneNum = 10; + break; + case 10: + scene10_run(); + if (_newSceneNum == 55) + _newSceneNum = 11; + break; + case 11: + scene11_run(); + if (_newSceneNum == 55) + _newSceneNum = 12; + break; + case 12: + scene12_run(); + if (_newSceneNum == 55) + _newSceneNum = 11; + break; + case 13: + scene13_run(); + if (_newSceneNum == 55) + _newSceneNum = 11; + break; + case 14: + scene14_run(); + if (_newSceneNum == 55) + _newSceneNum = 13; + break; + case 15: + scene15_run(); + if (_newSceneNum == 55) + _newSceneNum = 12; + break; + case 16: + scene16_initCutscene(); + _newSceneNum = 17; + _newCursorValue = 3; + cutscene_run(); + break; + case 17: + scene17_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 18: + scene18_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 19: + scene19_run(); + if (_newSceneNum == 55) + _newSceneNum = 19; + break; + case 20: + scene20_run(); + if (_newSceneNum == 55) + _newSceneNum = 22; + break; + case 21: + scene21_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 22: + scene22_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 23: + scene23_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 24: + scene24_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 25: + scene25_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 26: + scene26_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 27: + scene27_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 28: + scene28_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 29: + scene29_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 30: + scene30_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 31: + scene31_run(); + if (_newSceneNum == 55) + _newSceneNum = 20; + break; + case 32: + scene32_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 33: + scene33_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 34: + scene03_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 35: + scene05_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 36: + scene06_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 37: + scene04_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 38: + scene38_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 39: + scene39_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 40: + scene40_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 41: + scene41_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 42: + scene42_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 43: + scene43_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 44: + scene44_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 45: + scene45_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 46: + scene46_run(); + if (_newSceneNum == 55) + _newSceneNum = 37; + break; + case 47: + if (_prevSceneNum == 49) { + scene47_initCutscene1(); + _newSceneNum = 7; + _newCursorValue = 2; + } else if (_prevSceneNum == 13) { + scene47_initCutscene2(); + _newSceneNum = 11; + } else if (!isFlag(10) && _prevSceneNum == 2) {//CHECKME + if (isFlag(25)) { + scene47_initCutscene3(); + _newSceneNum = 2; + } else { + scene47_initCutscene4(); + _newSceneNum = 49; + } + } else if (_prevSceneNum == 21) { + scene47_initCutscene5(); + _newSceneNum = 21; + setFlag(3); + setFlag(5); + } else if (_prevSceneNum == 30) { + scene47_initCutscene6(); + _newSceneNum = 26; + } else if (isFlag(10) && _cursorValue == 1) { + scene47_initCutscene7(); + _newSceneNum = 4; + } + cutscene_run(); + break; + case 48: + scene48_initCutscene(); + _newSceneNum = 33; + _newCursorValue = 4; + cutscene_run(); + break; + case 49: + scene49_run(); + if (_newSceneNum == 55) + _newSceneNum = 47; + break; + case 50: + scene50_run(); + _newSceneNum = _prevSceneNum; + break; + case 51: + scene51_run(); + break; + case 52: + scene52_run(); + _newSceneNum = _prevSceneNum; + break; + case 53: + scene53_run(); + if (_newSceneNum == 55) + _newSceneNum = 53; + break; + case 54: + if (_prevSceneNum == 45) { + scene54_initCutscene1(); + _newSceneNum = 43; + cutscene_run(); + } else { + scene54_initCutscene2(); + cutscene_run(); + _gameDone = true; + } + break; + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/sound.cpp b/engines/gnap/sound.cpp new file mode 100644 index 0000000000..9471d12a67 --- /dev/null +++ b/engines/gnap/sound.cpp @@ -0,0 +1,91 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/sound.h" +#include "audio/audiostream.h" +#include "audio/decoders/wave.h" + +namespace Gnap { + +SoundMan::SoundMan(GnapEngine *vm) + : _vm(vm) { +} + +SoundMan::~SoundMan() { +} + +void SoundMan::playSound(int resourceId, bool looping) { + SoundItem soundItem; + soundItem.resourceId = resourceId; + + SoundResource *soundResource = _vm->_soundCache->get(resourceId); + Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundResource->_data, soundResource->_size, DisposeAfterUse::NO); + Audio::AudioStream *audioStream = Audio::makeLoopingAudioStream(Audio::makeWAVStream(stream, DisposeAfterUse::YES), looping ? 0 : 1); + + _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &soundItem.handle, audioStream); + + _items.push_back(soundItem); + +} + +void SoundMan::stopSound(int resourceId) { + const int index = find(resourceId); + if (index >= 0) { + _vm->_soundCache->release(_items[index].resourceId); + _vm->_mixer->stopHandle(_items[index].handle); + _items.remove_at(index); + } +} + +void SoundMan::setSoundVolume(int resourceId, int volume) { + // TODO +} + +bool SoundMan::isSoundPlaying(int resourceId) { + const int index = find(resourceId); + return index >= 0 && _vm->_mixer->isSoundHandleActive(_items[index].handle); +} + +void SoundMan::stopAll() { + for (int index = 0; index < (int)_items.size(); ++index) { + _vm->_soundCache->release(_items[index].resourceId); + _vm->_mixer->stopHandle(_items[index].handle); + } +} + +void SoundMan::update() { + for (int index = 0; index < (int)_items.size(); ++index) + if (!_vm->_mixer->isSoundHandleActive(_items[index].handle)) { + _vm->_soundCache->release(_items[index].resourceId); + _items.remove_at(index); + --index; + } +} + +int SoundMan::find(int resourceId) { + for (int index = 0; index < (int)_items.size(); ++index) + if (_items[index].resourceId == resourceId) + return index; + return -1; +} + +} // End of namespace Gnap diff --git a/engines/gnap/sound.h b/engines/gnap/sound.h new file mode 100644 index 0000000000..ec5888ed1b --- /dev/null +++ b/engines/gnap/sound.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SOUND_H +#define GNAP_SOUND_H + +#include "gnap/gnap.h" +#include "gnap/resource.h" +#include "audio/mixer.h" +#include "common/array.h" + +namespace Gnap { + +struct SoundItem { + int resourceId; + Audio::SoundHandle handle; +}; + +class SoundMan { +public: + SoundMan(GnapEngine *vm); + ~SoundMan(); + void playSound(int resourceId, bool looping); + void stopSound(int resourceId); + void setSoundVolume(int resourceId, int volume); + bool isSoundPlaying(int resourceId); + void stopAll(); + void update(); +protected: + GnapEngine *_vm; + Common::Array _items; + int find(int resourceId); +}; + +} // End of namespace Gnap + +#endif // GNAP_SOUND_H -- cgit v1.2.3 From ea59c06ba9194cd82de811f7516a69a0e8555c89 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 10:30:24 +0100 Subject: GNAP: Clean up scene 28 --- engines/gnap/gnap.cpp | 7 +- engines/gnap/gnap.h | 5 +- engines/gnap/scenes/scene28.cpp | 170 ++++++++++++++++++++++------------------ 3 files changed, 98 insertions(+), 84 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 08f598551e..80817b86ec 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -158,14 +158,14 @@ Common::Error GnapEngine::run() { //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - _currentSceneNum = 26; + _currentSceneNum = 28; Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); _dat->open(0, datFilename.c_str()); _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - _gameSys->insertSequence(0x5b, 100, -1, -1, 0, 0, 0, 0); + _gameSys->insertSequence(0x113, 100, -1, -1, 0, 0, 0, 0); CursorMan.showMouse(true); @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 27; + _newSceneNum = 28; _newCursorValue = 3; // < DEBUG END @@ -2131,6 +2131,7 @@ bool GnapEngine::sceneXX_sub_4466B1() { pauseGame(); updatePause(); } + return false; } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index e1d13eca41..60fe0298cd 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -779,9 +779,8 @@ public: void scene27_updateAnimations(); // Scene 28 - int _s28_dword_47EA5C; - int _s28_dword_47EA60; - int _s28_dword_474938; + int _s28_currClownSequenceId, _s28_nextClownSequenceId; + int _s28_clownTalkCtr; int scene28_init(); void scene28_updateHotspots(); void scene28_run(); diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index 23c3e52974..b2b8455ad5 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -31,12 +31,26 @@ enum { kHSHorn = 1, kHSClown = 2, kHSExitOutsideClown = 3, - kHSUnknown = 4, + kHSEmptyBucket = 4, kHSDevice = 5, kHSWalkArea1 = 6, kHSWalkArea2 = 7 }; +enum { + kASUseBeerBucketWithClown = 0, + kASUsePillBucketWithClown = 1, + kASGrabHornFails = 2, + kASGrabEmptyBucket = 3, + kASGrabHornSuccess = 4, + kASGrabHornSuccessDone = 5, + kASGrabEmptyBucketDone = 6, + kASGrabHornFailsDone = 7, + kASTalkClown = 8, + kASGnapWaiting = 9, + kASLeaveScene = 10 +}; + int GnapEngine::scene28_init() { return 0x125; } @@ -46,21 +60,21 @@ void GnapEngine::scene28_updateHotspots() { setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); - setHotspot(kHSUnknown, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); + setHotspot(kHSEmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); setHotspot(kHSWalkArea1, 0, 0, 799, 523); setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (invHas(kItemHorn)) _hotspots[kHSHorn].flags = SF_DISABLED; if (isFlag(22)) - _hotspots[kHSUnknown].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSEmptyBucket].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspotsCount = 8; } void GnapEngine::scene28_run() { playSound(0x1093C, 1); - _s28_dword_47EA60 = -1; + _s28_nextClownSequenceId = -1; queueInsertDeviceIcon(); _gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -73,11 +87,11 @@ void GnapEngine::scene28_run() { _gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); if (!invHas(kItemHorn)) _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); - _s28_dword_47EA5C = 0x11C; + _s28_currClownSequenceId = 0x11C; } else { - _s28_dword_47EA5C = 0x11B; + _s28_currClownSequenceId = 0x11B; _gameSys->setAnimation(0x11B, 39, 3); - _gameSys->insertSequence(_s28_dword_47EA5C, 39, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _timers[4] = getRandom(20) + 80; } initGnapPos(8, 8, 3); @@ -89,13 +103,13 @@ void GnapEngine::scene28_run() { initBeaverPos(9, 8, 4); endSceneInit(); playSequences(0xF7, 0x121, 0x122, 0x123); - _s28_dword_47EA5C = 0x115; + _s28_currClownSequenceId = 0x115; setFlag(1); _gameSys->setAnimation(0x115, 39, 3); - _gameSys->insertSequence(_s28_dword_47EA5C, 39, 283, 39, kSeqSyncWait, 0, 0, 0); - _s28_dword_47EA60 = -1; + _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); + _s28_nextClownSequenceId = -1; _timers[4] = getRandom(20) + 80; - _gnapActionStatus = 9; + _gnapActionStatus = kASGnapWaiting; while (_gameSys->getAnimationStatus(3) != 2) { gameUpdateTick(); updateMouseCursor(); @@ -159,7 +173,7 @@ void GnapEngine::scene28_run() { if (isFlag(21)) { if (!invHas(kItemHorn)) { gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); - _gnapActionStatus = 4; + _gnapActionStatus = kASGrabHornSuccess; } } else { _gnapIdleFacing = 5; @@ -167,7 +181,7 @@ void GnapEngine::scene28_run() { _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; - _gnapActionStatus = 2; + _gnapActionStatus = kASGrabHornFails; } break; case TALK_CURSOR: @@ -191,13 +205,13 @@ void GnapEngine::scene28_run() { gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); - _gnapActionStatus = 0; + _gnapActionStatus = kASUseBeerBucketWithClown; } else if (_grabCursorSpriteIndex == kItemBucketWithPill) { _gnapIdleFacing = 5; gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); - _gnapActionStatus = 1; + _gnapActionStatus = kASUsePillBucketWithClown; } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 2, 4); } else { @@ -208,7 +222,7 @@ void GnapEngine::scene28_run() { case TALK_CURSOR: _gnapIdleFacing = 5; gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 8; + _gnapActionStatus = kASTalkClown; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -225,13 +239,13 @@ void GnapEngine::scene28_run() { _newSceneNum = 27; _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); - _gnapActionStatus = 10; + _gnapActionStatus = kASLeaveScene; _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); } break; - case kHSUnknown: + case kHSEmptyBucket: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex >= 0) { playGnapShowItem(_grabCursorSpriteIndex, 8, 6); @@ -243,8 +257,8 @@ void GnapEngine::scene28_run() { playGnapScratchingHead(8, 6); break; case GRAB_CURSOR: - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSUnknown].x, _hotspotsWalkPos[kHSUnknown].y) | 0x10000, 1); - _gnapActionStatus = 3; + gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSEmptyBucket].x, _hotspotsWalkPos[kHSEmptyBucket].y) | 0x10000, 1); + _gnapActionStatus = kASGrabEmptyBucket; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -281,7 +295,7 @@ void GnapEngine::scene28_run() { if (!_timers[4]) { _timers[4] = getRandom(20) + 80; if (_gnapActionStatus < 0 && !isFlag(21)) - _s28_dword_47EA60 = 0x114; + _s28_nextClownSequenceId = 0x114; } } @@ -304,37 +318,30 @@ void GnapEngine::scene28_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { - case 0: + case kASUseBeerBucketWithClown: setFlag(22); - _s28_dword_47EA60 = 275; + _s28_nextClownSequenceId = 0x113; invRemove(kItemBucketWithBeer); scene28_updateHotspots(); break; - case 1: - _s28_dword_47EA60 = 0x116; + case kASUsePillBucketWithClown: + _s28_nextClownSequenceId = 0x116; invRemove(kItemBucketWithPill); setFlag(22); setFlag(21); scene28_updateHotspots(); break; - case 2: - _s28_dword_47EA60 = 0x119; + case kASGrabHornFails: + _s28_nextClownSequenceId = 0x119; break; - case 3: - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x111, 99, 0); - _gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = 6; - break; - case 4: + case kASGrabHornSuccess: playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); _gameSys->setAnimation(0x117, 59, 0); _gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = 5; + _gnapActionStatus = kASGrabHornSuccessDone; break; - case 5: + case kASGrabHornSuccessDone: hideCursor(); setGrabCursorSprite(-1); addFullScreenSprite(0xF6, 255); @@ -349,63 +356,70 @@ void GnapEngine::scene28_updateAnimations() { scene28_updateHotspots(); _gnapActionStatus = -1; break; - case 6: + case kASGrabEmptyBucket: + playGnapPullOutDevice(0, 0); + playGnapUseDevice(0, 0); + _gameSys->setAnimation(0x111, 99, 0); + _gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = kASGrabEmptyBucketDone; + break; + case kASGrabEmptyBucketDone: setGrabCursorSprite(kItemEmptyBucket); clearFlag(22);; scene28_updateHotspots(); invAdd(kItemEmptyBucket); _gnapActionStatus = -1; break; - case 7: + case kASGrabHornFailsDone: _gameSys->insertSequence(0x107B5, _gnapId, 281, 39, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7B5; _gnapSequenceDatNum = 1; _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _s28_dword_47EA5C = 0x11B; - _s28_dword_47EA60 = -1; + _s28_currClownSequenceId = 0x11B; + _s28_nextClownSequenceId = -1; _gnapActionStatus = -1; gnapWalkTo(2, 8, -1, 0x107BB, 1); break; - case 8: - _s28_dword_474938 = (_s28_dword_474938 + 1) % 2; - if (_s28_dword_474938 == 0) - _s28_dword_47EA60 = 0x11D; - else if (_s28_dword_474938 == 1) - _s28_dword_47EA60 = 0x11E; - else if (_s28_dword_474938 == 2) - _s28_dword_47EA60 = 0x11F; // NOTE CHECKME Never set, bug in the original? + case kASTalkClown: + _s28_clownTalkCtr = (_s28_clownTalkCtr + 1) % 2; + if (_s28_clownTalkCtr == 0) + _s28_nextClownSequenceId = 0x11D; + else if (_s28_clownTalkCtr == 1) + _s28_nextClownSequenceId = 0x11E; + else if (_s28_clownTalkCtr == 2) + _s28_nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? break; - case 9: + case kASGnapWaiting: _gnapActionStatus = -1; break; - case 10: + case kASLeaveScene: _sceneDone = true; break; } } if (_gameSys->getAnimationStatus(3) == 2) { - switch (_s28_dword_47EA60) { + switch (_s28_nextClownSequenceId) { case 0x113: setGrabCursorSprite(-1); - _gameSys->setAnimation(_s28_dword_47EA60, 39, 0); - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_dword_47EA60), 0, 0); - _gameSys->insertSequence(_s28_dword_47EA60, 39, _s28_dword_47EA5C, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x11B, 39, _s28_dword_47EA60, 39, kSeqSyncWait, 0, 0, 0); - _s28_dword_47EA5C = 0x11B; - _s28_dword_47EA60 = -1; - _gnapActionStatus = 9; + _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x11B, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s28_currClownSequenceId = 0x11B; + _s28_nextClownSequenceId = -1; + _gnapActionStatus = kASGnapWaiting; break; case 0x116: setGrabCursorSprite(-1); - _gameSys->setAnimation(_s28_dword_47EA60, 39, 0); - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_dword_47EA60), 0, 0); - _gameSys->insertSequence(_s28_dword_47EA60, 39, _s28_dword_47EA5C, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x11C, 39, _s28_dword_47EA60, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_dword_47EA60), 0, 0); - _s28_dword_47EA5C = _s28_dword_47EA60; - _s28_dword_47EA60 = -1; - _gnapActionStatus = 9; + _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x11C, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _s28_currClownSequenceId = _s28_nextClownSequenceId; + _s28_nextClownSequenceId = -1; + _gnapActionStatus = kASGnapWaiting; break; case 0x11D: case 0x11E: @@ -413,20 +427,20 @@ void GnapEngine::scene28_updateAnimations() { _gnapActionStatus = -1; break; case 0x119: - _gameSys->insertSequence(_s28_dword_47EA60, 39, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_dword_47EA60, 39, 0); - _gameSys->removeSequence(_s28_dword_47EA5C, 39, 1); - _gnapActionStatus = 7; - _gnapSequenceId = _s28_dword_47EA60; + _gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _gameSys->removeSequence(_s28_currClownSequenceId, 39, 1); + _gnapActionStatus = kASGrabHornFailsDone; + _gnapSequenceId = _s28_nextClownSequenceId; _gnapSequenceDatNum = 0; - _s28_dword_47EA60 = -1; + _s28_nextClownSequenceId = -1; break; } - if (_s28_dword_47EA60 != -1) { - _gameSys->insertSequence(_s28_dword_47EA60, 39, _s28_dword_47EA5C, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_dword_47EA60, 39, 3); - _s28_dword_47EA5C = _s28_dword_47EA60; - _s28_dword_47EA60 = -1; + if (_s28_nextClownSequenceId != -1) { + _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 3); + _s28_currClownSequenceId = _s28_nextClownSequenceId; + _s28_nextClownSequenceId = -1; } } -- cgit v1.2.3 From 22b8cc704a37e03373e77ebca45d6d6c4bb456d4 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 11:01:13 +0100 Subject: GNAP: Clean up scene 29 --- engines/gnap/gnap.cpp | 10 ++-- engines/gnap/gnap.h | 6 +-- engines/gnap/scenes/scene29.cpp | 100 +++++++++++++++++++++------------------- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 80817b86ec..aa1b29eb4d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -158,14 +158,14 @@ Common::Error GnapEngine::run() { //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - _currentSceneNum = 28; + _currentSceneNum = 29; Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); _dat->open(0, datFilename.c_str()); _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - _gameSys->insertSequence(0x113, 100, -1, -1, 0, 0, 0, 0); + _gameSys->insertSequence(0xed, 100, -1, -1, 0, 0, 0, 0); CursorMan.showMouse(true); @@ -721,8 +721,8 @@ void GnapEngine::initGameFlags(int num) { //invAdd(kItemPill); invAdd(kItemBucketWithBeer); invAdd(kItemChickenBucket); - invAdd(kItemGum); - invAdd(kItemPicture); + invAdd(kItemBanana); + invAdd(kItemHorn); #endif } @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 28; + _newSceneNum = 29; _newCursorValue = 3; // < DEBUG END diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 60fe0298cd..7141cc82a0 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -787,10 +787,8 @@ public: void scene28_updateAnimations(); // Scene 29 - int _s29_dword_47EA74; - int _s29_dword_47EA78; - int _s29_dword_47EA7C; - int _s29_dword_47EA80; + int _s28_currMonkeySequenceId, _s28_nextMonkeySequenceId; + int _s28_currManSequenceId, _s28_nextManSequenceId; int scene29_init(); void scene29_updateHotspots(); void scene29_run(); diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 3a78107db5..4433c0a725 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -36,6 +36,11 @@ enum { kHSWalkArea1 = 6 }; +enum { + kASUseBananaWithMonkey = 0, + kASLeaveScene = 2 +}; + int GnapEngine::scene29_init() { return 0xF6; } @@ -60,13 +65,13 @@ void GnapEngine::scene29_run() { queueInsertDeviceIcon(); if (invHas(kItemHorn)) { - _s29_dword_47EA74 = 0xE8; - _s29_dword_47EA78 = -1; + _s28_currMonkeySequenceId = 0xE8; + _s28_nextMonkeySequenceId = -1; _gameSys->setAnimation(0xE8, 159, 4); - _gameSys->insertSequence(_s29_dword_47EA74, 159, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s28_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _s29_dword_47EA7C = 0xED; - _s29_dword_47EA80 = -1; + _s28_currManSequenceId = 0xED; + _s28_nextManSequenceId = -1; _gameSys->setAnimation(0xED, 39, 3); _timers[4] = getRandom(20) + 60; } else { @@ -141,9 +146,9 @@ void GnapEngine::scene29_run() { if (_grabCursorSpriteIndex == kItemBanana) { _gnapIdleFacing = 1; gnapWalkTo(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASUseBananaWithMonkey; _newSceneNum = 51; - _isLeavingScene = 1; + _isLeavingScene = true; setGrabCursorSprite(-1); } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y, 5, 6); @@ -166,20 +171,20 @@ void GnapEngine::scene29_run() { case kHSExitCircus: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 26; gnapWalkTo(_hotspotsWalkPos[kHSExitCircus].x, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _gnapActionStatus = 2; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); } break; case kHSExitOutsideClown: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 27; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AB, 1); - _gnapActionStatus = 2; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y - 1, -1, 0x107CD, 1); } break; @@ -188,11 +193,11 @@ void GnapEngine::scene29_run() { if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { setGrabCursorSprite(-1); - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 52; gnapWalkTo(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y, 0, -1, 1); playGnapIdle(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y); - _gnapActionStatus = 2; + _gnapActionStatus = kASLeaveScene; } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y, 2, 3); } else { @@ -239,19 +244,19 @@ void GnapEngine::scene29_run() { if (_gnapActionStatus < 0) { switch (getRandom(5)) { case 0: - _s29_dword_47EA80 = 0xED; + _s28_nextManSequenceId = 0xED; break; case 1: - _s29_dword_47EA80 = 0xEE; + _s28_nextManSequenceId = 0xEE; break; case 2: - _s29_dword_47EA80 = 0xEF; + _s28_nextManSequenceId = 0xEF; break; case 3: - _s29_dword_47EA80 = 0xF0; + _s28_nextManSequenceId = 0xF0; break; case 4: - _s29_dword_47EA80 = 0xF1; + _s28_nextManSequenceId = 0xF1; break; } } @@ -279,71 +284,70 @@ void GnapEngine::scene29_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { - case 0: - _s29_dword_47EA78 = 0xE5; + case kASUseBananaWithMonkey: + _s28_nextMonkeySequenceId = 0xE5; break; - case 1: - case 2: + case kASLeaveScene: _sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(3) == 2 && _s29_dword_47EA80 != -1) { - _gameSys->insertSequence(_s29_dword_47EA80, 39, _s29_dword_47EA7C, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s29_dword_47EA80, 39, 3); - _s29_dword_47EA7C = _s29_dword_47EA80; - _s29_dword_47EA80 = -1; + if (_gameSys->getAnimationStatus(3) == 2 && _s28_nextManSequenceId != -1) { + _gameSys->insertSequence(_s28_nextManSequenceId, 39, _s28_currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_nextManSequenceId, 39, 3); + _s28_currManSequenceId = _s28_nextManSequenceId; + _s28_nextManSequenceId = -1; } if (_gameSys->getAnimationStatus(4) == 2) { - if (_s29_dword_47EA78 == 0xE5) { + if (_s28_nextMonkeySequenceId == 0xE5) { _gameSys->insertSequence(0xF2, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceDatNum = 0; _gnapSequenceId = 0xF2; _gameSys->setAnimation(0xE6, 159, 0); _gameSys->setAnimation(0, 159, 4); - _gameSys->insertSequence(_s29_dword_47EA78, 159, _s29_dword_47EA74, 159, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xE6, 159, _s29_dword_47EA78, 159, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = 1; - _s29_dword_47EA74 = 0xE6; - _s29_dword_47EA78 = -1; + _gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xE6, 159, _s28_nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _gnapActionStatus = kASLeaveScene; + _s28_currMonkeySequenceId = 0xE6; + _s28_nextMonkeySequenceId = -1; _timers[5] = 30; while (_timers[5]) gameUpdateTick(); platypusWalkTo(0, 8, 1, 0x107CF, 1); while (_gameSys->getAnimationStatus(1) != 2) gameUpdateTick(); - } else if (_s29_dword_47EA78 == -1) { + } else if (_s28_nextMonkeySequenceId == -1) { switch (getRandom(6)) { case 0: - _s29_dword_47EA78 = 0xE8; + _s28_nextMonkeySequenceId = 0xE8; break; case 1: - _s29_dword_47EA78 = 0xE9; + _s28_nextMonkeySequenceId = 0xE9; break; case 2: - _s29_dword_47EA78 = 0xEA; + _s28_nextMonkeySequenceId = 0xEA; break; case 3: - _s29_dword_47EA78 = 0xEB; + _s28_nextMonkeySequenceId = 0xEB; break; case 4: - _s29_dword_47EA78 = 0xEC; + _s28_nextMonkeySequenceId = 0xEC; break; case 5: - _s29_dword_47EA78 = 0xE7; + _s28_nextMonkeySequenceId = 0xE7; break; } - _gameSys->insertSequence(_s29_dword_47EA78, 159, _s29_dword_47EA74, 159, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s29_dword_47EA78, 159, 4); - _s29_dword_47EA74 = _s29_dword_47EA78; - _s29_dword_47EA78 = -1; + _gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); + _s28_currMonkeySequenceId = _s28_nextMonkeySequenceId; + _s28_nextMonkeySequenceId = -1; } else { - _gameSys->insertSequence(_s29_dword_47EA78, 159, _s29_dword_47EA74, 159, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s29_dword_47EA78, 159, 4); - _s29_dword_47EA74 = _s29_dword_47EA78; - _s29_dword_47EA78 = -1; + _gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); + _s28_currMonkeySequenceId = _s28_nextMonkeySequenceId; + _s28_nextMonkeySequenceId = -1; } } -- cgit v1.2.3 From bd7d790f141eb0afb2276777391e2a7986195b09 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 11:21:18 +0100 Subject: GNAP: Clean up scene 30 --- engines/gnap/gnap.cpp | 6 ++--- engines/gnap/gnap.h | 3 +-- engines/gnap/scenes/scene30.cpp | 60 ++++++++++++++++++++++------------------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index aa1b29eb4d..d1f4b8047a 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -158,14 +158,14 @@ Common::Error GnapEngine::run() { //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - _currentSceneNum = 29; + _currentSceneNum = 30; Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); _dat->open(0, datFilename.c_str()); _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - _gameSys->insertSequence(0xed, 100, -1, -1, 0, 0, 0, 0); + _gameSys->insertSequence(0xff, 100, -1, -1, 0, 0, 0, 0); CursorMan.showMouse(true); @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 29; + _newSceneNum = 30; _newCursorValue = 3; // < DEBUG END diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 7141cc82a0..d90a58fec0 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -795,8 +795,7 @@ public: void scene29_updateAnimations(); // Scene 30 - int _s30_dword_47EA88; - int _s30_dword_47EA8C; + int _s30_kidSequenceId; int scene30_init(); void scene30_updateHotspots(); void scene30_run(); diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 341caee618..f6ec96951c 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -34,6 +34,15 @@ enum { kHSWalkArea1 = 4 }; +enum { + kASLeaveScene = 0, + kASUsePillMachine = 1, + kASUsePillMachine2 = 2, + kASLookPillMachine = 3, + kASUsePillMachine3 = 4, + kASUsePillMachine4 = 5 +}; + int GnapEngine::scene30_init() { return isFlag(23) ? 0x10B : 0x10A; } @@ -65,7 +74,7 @@ void GnapEngine::scene30_run() { _gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); _timers[4] = getRandom(100) + 300; - _s30_dword_47EA88 = 0x101; + _s30_kidSequenceId = 0x101; initGnapPos(7, 12, 1); initBeaverPos(6, 12, 0); endSceneInit(); @@ -121,7 +130,7 @@ void GnapEngine::scene30_run() { _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; - _gnapActionStatus = 1; + _gnapActionStatus = kASUsePillMachine; hasTakenPill = true; } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 8, 5); @@ -129,7 +138,7 @@ void GnapEngine::scene30_run() { switch (_verbCursor) { case LOOK_CURSOR: gnapWalkTo(9, 8, 0, 0x107BC, 1); - _gnapActionStatus = 3; + _gnapActionStatus = kASLookPillMachine; break; case GRAB_CURSOR: playGnapScratchingHead(8, 5); @@ -151,7 +160,7 @@ void GnapEngine::scene30_run() { else _newSceneNum = 26; gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C2, 1); } break; @@ -184,8 +193,8 @@ void GnapEngine::scene30_run() { if (_gnapActionStatus < 0) { if (getRandom(5) == 1) { _gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x100, 40, _s30_dword_47EA88, 40, kSeqSyncWait, 0, 0, 0); - _s30_dword_47EA88 = 0x100; + _gameSys->insertSequence(0x100, 40, _s30_kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _s30_kidSequenceId = 0x100; } else { _gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); } @@ -195,10 +204,9 @@ void GnapEngine::scene30_run() { _timers[5] = getRandom(50) + 180; if (_gnapActionStatus < 0) { if (!isFlag(23) || hasTakenPill) - _s30_dword_47EA8C = 0x109; + _gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else - _s30_dword_47EA8C = 0x108; - _gameSys->insertSequence(_s30_dword_47EA8C, 20, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); } } playSoundB(); @@ -223,56 +231,54 @@ void GnapEngine::scene30_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { - case 0: + case kASLeaveScene: _sceneDone = true; break; - case 1: + case kASUsePillMachine: setGrabCursorSprite(-1); _gameSys->setAnimation(0x105, _gnapId, 0); _gameSys->insertSequence(0x105, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x105; _gnapSequenceDatNum = 0; - _gnapActionStatus = 2; + _gnapActionStatus = kASUsePillMachine2; break; - case 2: + case kASUsePillMachine2: hideCursor(); setGrabCursorSprite(-1); addFullScreenSprite(0x3F, 255); _gameSys->removeSequence(0x105, _gnapId, 1); _gameSys->setAnimation(0x102, 256, 0); _gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) { - // checkGameAppStatus(); + while (_gameSys->getAnimationStatus(0) != 2) gameUpdateTick(); - } _gameSys->setAnimation(0x103, _gnapId, 0); _gameSys->insertSequence(0x103, _gnapId, 0, 0, kSeqNone, 0, 0, 0); removeFullScreenSprite(); showCursor(); - _gnapActionStatus = 4; + _gnapActionStatus = kASUsePillMachine3; invAdd(kItemPill); setFlag(23); break; - case 3: - if (isFlag(23)) - showFullScreenSprite(0xE3); - else - showFullScreenSprite(0xE2); - _gnapActionStatus = -1; - break; - case 4: + case kASUsePillMachine3: _gameSys->setAnimation(0x104, _gnapId, 0); _gameSys->insertSequence(0x104, _gnapId, makeRid(_gnapSequenceDatNum, 0x103), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x104; _gnapSequenceDatNum = 0; - _gnapActionStatus = 5; + _gnapActionStatus = kASUsePillMachine4; setGrabCursorSprite(kItemDiceQuarterHole); break; - case 5: + case kASUsePillMachine4: _gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y + 1, -1, 0x107BC, 1); _gnapActionStatus = -1; break; + case kASLookPillMachine: + if (isFlag(23)) + showFullScreenSprite(0xE3); + else + showFullScreenSprite(0xE2); + _gnapActionStatus = -1; + break; } } -- cgit v1.2.3 From 11c381c8df1ff9e6d545c63c4b2654df0e020281 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 11:40:15 +0100 Subject: GNAP: Clean up scene 31 --- engines/gnap/gnap.cpp | 12 ++-- engines/gnap/gnap.h | 7 +-- engines/gnap/scenes/scene31.cpp | 128 +++++++++++++++++++++------------------- 3 files changed, 78 insertions(+), 69 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index d1f4b8047a..4d18215223 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -158,14 +158,14 @@ Common::Error GnapEngine::run() { //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - _currentSceneNum = 30; + _currentSceneNum = 31; Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); _dat->open(0, datFilename.c_str()); _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - _gameSys->insertSequence(0xff, 100, -1, -1, 0, 0, 0, 0); + _gameSys->insertSequence(0xfe, 100, -1, -1, 0, 0, 0, 0); CursorMan.showMouse(true); @@ -719,7 +719,7 @@ void GnapEngine::initGameFlags(int num) { //invAdd(kItemTongs); invAdd(kItemDiceQuarterHole); //invAdd(kItemPill); - invAdd(kItemBucketWithBeer); + //invAdd(kItemBucketWithBeer); invAdd(kItemChickenBucket); invAdd(kItemBanana); invAdd(kItemHorn); @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 30; + _newSceneNum = 31; _newCursorValue = 3; // < DEBUG END @@ -2087,6 +2087,10 @@ void GnapEngine::initGlobalSceneVars() { // Scene 22 _s22_caughtBefore = false; _s22_cashierCtr = 3; + + // Scene 31 + _s31_beerGuyDistracted = false; + _s31_clerkMeasureMaxCtr = 3; // Scene 50 _s50_timesPlayed = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index d90a58fec0..ebd1162095 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -802,12 +802,9 @@ public: void scene30_updateAnimations(); // Scene 31 - int _s31_dword_47EAA8; - int _s31_dword_47EAAC; - int _s31_dword_47EAB0; + int _s28_currClerkSequenceId, _s28_nextClerkSequenceId; bool _s31_beerGuyDistracted; - int _s31_dword_474940; - int _s31_dword_47EAB4; + int _s31_clerkMeasureCtr, _s31_clerkMeasureMaxCtr; int scene31_init(); void scene31_updateHotspots(); void scene31_run(); diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 864dbf90bc..39bb1bb267 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -36,6 +36,15 @@ enum { kHSWalkArea1 = 6 }; +enum { + kASUseBeerBarrel = 1, + kASFillEmptyBucketWithBeer = 2, + kASFillEmptyBucketWithBeerDone = 3, + kASPlatMeasuringClown = 4, + kASUseMeasuringClown = 5, + kASLeaveScene = 6 +}; + int GnapEngine::scene31_init() { return 0x105; } @@ -61,8 +70,8 @@ void GnapEngine::scene31_run() { _s31_beerGuyDistracted = false; _gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); - _s31_dword_47EAA8 = 0xFB; - _s31_dword_47EAAC = -1; + _s28_currClerkSequenceId = 0xFB; + _s28_nextClerkSequenceId = -1; _gameSys->setAnimation(0xFB, 39, 3); @@ -94,7 +103,7 @@ void GnapEngine::scene31_run() { switch (_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0 || _gnapActionStatus == 4) { + if (_gnapActionStatus < 0 || _gnapActionStatus == kASPlatMeasuringClown) { runMenu(); scene31_updateHotspots(); } @@ -127,8 +136,8 @@ void GnapEngine::scene31_run() { break; case kHSMeasuringClown: - if (_gnapActionStatus < 0 || _gnapActionStatus == 4) { - if (_gnapActionStatus == 4) { + if (_gnapActionStatus < 0 || _gnapActionStatus == kASPlatMeasuringClown) { + if (_gnapActionStatus == kASPlatMeasuringClown) { if (_verbCursor == LOOK_CURSOR) playGnapScratchingHead(2, 2); else @@ -145,7 +154,7 @@ void GnapEngine::scene31_run() { _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 0, 0x107B9, 1); _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; - _gnapActionStatus = 5; + _gnapActionStatus = kASUseMeasuringClown; _timers[4] = 300; break; case TALK_CURSOR: @@ -158,8 +167,8 @@ void GnapEngine::scene31_run() { _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; - _beaverActionStatus = 4; - _gnapActionStatus = 4; + _beaverActionStatus = kASPlatMeasuringClown; + _gnapActionStatus = kASPlatMeasuringClown; _timers[4] = 300; } else playGnapImpossible(0, 0); @@ -170,16 +179,16 @@ void GnapEngine::scene31_run() { break; case kHSBeerBarrel: - if (_gnapActionStatus < 0 || _gnapActionStatus == 4) { + if (_gnapActionStatus < 0 || _gnapActionStatus == kASPlatMeasuringClown) { if (_grabCursorSpriteIndex == kItemEmptyBucket && _s31_beerGuyDistracted) { setGrabCursorSprite(-1); gnapWalkTo(_gnapX, _gnapY, -1, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y) | 0x10000, 1); - _s31_dword_474940 += 5; + _s31_clerkMeasureMaxCtr += 5; _gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); playGnapPullOutDevice(6, 8); playGnapUseDevice(0, 0); gnapWalkTo(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _gnapActionStatus = 2; + _gnapActionStatus = kASFillEmptyBucketWithBeer; _timers[4] = 300; } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 6, 2); @@ -193,7 +202,7 @@ void GnapEngine::scene31_run() { playGnapScratchingHead(6, 2); } else { gnapWalkTo(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _gnapActionStatus = 1; + _gnapActionStatus = kASUseBeerBarrel; _gnapIdleFacing = 5; } break; @@ -211,7 +220,7 @@ void GnapEngine::scene31_run() { _isLeavingScene = 1; _newSceneNum = 26; gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _gnapActionStatus = 6; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); } break; @@ -221,7 +230,7 @@ void GnapEngine::scene31_run() { _isLeavingScene = 1; _newSceneNum = 27; gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AF, 1); - _gnapActionStatus = 6; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y + 1, -1, 0x107CF, 1); } break; @@ -251,19 +260,19 @@ void GnapEngine::scene31_run() { updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 60; - if (_gnapActionStatus < 0 && _s31_dword_47EAAC == -1) { + if (_gnapActionStatus < 0 && _s28_nextClerkSequenceId == -1) { switch (getRandom(6)){ case 0: - _s31_dword_47EAAC = 0xFF; + _s28_nextClerkSequenceId = 0xFF; break; case 1: - _s31_dword_47EAAC = 0x100; + _s28_nextClerkSequenceId = 0x100; break; case 2: - _s31_dword_47EAAC = 0x101; + _s28_nextClerkSequenceId = 0x101; break; default: - _s31_dword_47EAAC = 0xFB; + _s28_nextClerkSequenceId = 0xFB; break; } } @@ -272,10 +281,9 @@ void GnapEngine::scene31_run() { _timers[5] = getRandom(50) + 180; if (_gnapActionStatus < 0) { if (getRandom(2) != 0) - _s31_dword_47EAB4 = 0x104; + _gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); else - _s31_dword_47EAB4 = 0x103; - _gameSys->insertSequence(_s31_dword_47EAB4, 20, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); } } playSoundB(); @@ -300,10 +308,10 @@ void GnapEngine::scene31_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { - case 1: - _s31_dword_47EAAC = 0xFE; + case kASUseBeerBarrel: + _s28_nextClerkSequenceId = 0xFE; break; - case 2: + case kASFillEmptyBucketWithBeer: _gameSys->setAnimation(0x102, 59, 0); _gameSys->insertSequence(0x102, 59, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapX = 5; @@ -311,9 +319,9 @@ void GnapEngine::scene31_updateAnimations() { _gnapSequenceDatNum = 0; _gnapSequenceId = 0x102; _gnapId = 59; - _gnapActionStatus = 3; + _gnapActionStatus = kASFillEmptyBucketWithBeerDone; break; - case 3: + case kASFillEmptyBucketWithBeerDone: _gnapIdleFacing = 3; playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); @@ -323,11 +331,11 @@ void GnapEngine::scene31_updateAnimations() { invRemove(kItemEmptyBucket); setGrabCursorSprite(kItemBucketWithBeer); break; - case 5: - _s31_dword_47EAAC = 0xFA; - _s31_dword_474940 = 1; + case kASUseMeasuringClown: + _s28_nextClerkSequenceId = 0xFA; + _s31_clerkMeasureMaxCtr = 1; break; - case 6: + case kASLeaveScene: _sceneDone = true; _gnapActionStatus = -1; break; @@ -336,58 +344,58 @@ void GnapEngine::scene31_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - if (_beaverActionStatus == 4) { - _sceneWaiting = 1; + if (_beaverActionStatus == kASPlatMeasuringClown) { + _sceneWaiting = true; _s31_beerGuyDistracted = true; - _s31_dword_47EAAC = 0xFA; + _s28_nextClerkSequenceId = 0xFA; } } if (_gameSys->getAnimationStatus(3) == 2) { - switch (_s31_dword_47EAAC) { + switch (_s28_nextClerkSequenceId) { case 0xFA: - _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xFC, 39, _s31_dword_47EAAC, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xFC, 39, _s28_nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(0xFC, 39, 3); - _s31_dword_47EAA8 = 0xFC; - _s31_dword_47EAAC = 0xFC; - _s31_dword_47EAB0 = 0; + _s28_currClerkSequenceId = 0xFC; + _s28_nextClerkSequenceId = 0xFC; + _s31_clerkMeasureCtr = 0; break; case 0xFC: - ++_s31_dword_47EAB0; - if (_s31_dword_47EAB0 >= _s31_dword_474940) { + ++_s31_clerkMeasureCtr; + if (_s31_clerkMeasureCtr >= _s31_clerkMeasureMaxCtr) { if (_gnapActionStatus != 5) _beaverActionStatus = -1; _timers[0] = 40; - _gameSys->insertSequence(0xFD, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); - _s31_dword_47EAA8 = 0xFD; - _s31_dword_47EAAC = -1; - if (_gnapActionStatus != 3 && _gnapActionStatus != 2) + _gameSys->insertSequence(0xFD, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s28_currClerkSequenceId = 0xFD; + _s28_nextClerkSequenceId = -1; + if (_gnapActionStatus != kASFillEmptyBucketWithBeerDone && _gnapActionStatus != kASFillEmptyBucketWithBeer) _gnapActionStatus = -1; _s31_beerGuyDistracted = false; - _s31_dword_474940 = 3; + _s31_clerkMeasureMaxCtr = 3; _gameSys->setAnimation(0xFD, 39, 3); - _sceneWaiting = 0; + _sceneWaiting = false; } else { - _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); - _s31_dword_47EAA8 = _s31_dword_47EAAC; - _s31_dword_47EAAC = 0xFC; + _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s28_currClerkSequenceId = _s28_nextClerkSequenceId; + _s28_nextClerkSequenceId = 0xFC; _gameSys->setAnimation(0xFC, 39, 3); } break; case 0xFE: - _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s31_dword_47EAAC, 39, 3); - _s31_dword_47EAA8 = _s31_dword_47EAAC; - _s31_dword_47EAAC = -1; + _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_nextClerkSequenceId, 39, 3); + _s28_currClerkSequenceId = _s28_nextClerkSequenceId; + _s28_nextClerkSequenceId = -1; _gnapActionStatus = -1; break; default: - if (_s31_dword_47EAAC != -1) { - _gameSys->insertSequence(_s31_dword_47EAAC, 39, _s31_dword_47EAA8, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s31_dword_47EAAC, 39, 3); - _s31_dword_47EAA8 = _s31_dword_47EAAC; - _s31_dword_47EAAC = -1; + if (_s28_nextClerkSequenceId != -1) { + _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s28_nextClerkSequenceId, 39, 3); + _s28_currClerkSequenceId = _s28_nextClerkSequenceId; + _s28_nextClerkSequenceId = -1; } break; } -- cgit v1.2.3 From fad62e18c898ec6f392b4cec5bfaa9bd7ff44bb5 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 12:51:43 +0100 Subject: GNAP: Clean up scene 32 --- engines/gnap/gnap.cpp | 2 +- engines/gnap/gnap.h | 1 - engines/gnap/scenes/scene32.cpp | 16 +++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 4d18215223..86fc38d7c0 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 31; + _newSceneNum = 32; _newCursorValue = 3; // < DEBUG END diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index ebd1162095..ec891b0941 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -811,7 +811,6 @@ public: void scene31_updateAnimations(); // Scene 32 - int _s32_dword_47EADC; int scene32_init(); void scene32_updateHotspots(); void scene32_run(); diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index 3edd3db2cd..9eaf4d232d 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -40,6 +40,10 @@ enum { kHSWalkArea8 = 10 }; +enum { + kASLeaveScene = 0 +}; + int GnapEngine::scene32_init() { _gameSys->setAnimation(0, 0, 0); return isFlag(26) ? 0xF : 0x10; @@ -65,7 +69,6 @@ void GnapEngine::scene32_run() { playSound(0x1091C, 1); startSoundTimerC(5); queueInsertDeviceIcon(); - _s32_dword_47EADC = -1; _timers[4] = getRandom(100) + 300; if (_prevSceneNum == 33) { @@ -124,10 +127,10 @@ void GnapEngine::scene32_run() { case kHSExitTruck: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; setGrabCursorSprite(-1); gnapWalkTo(_hotspotsWalkPos[kHSExitTruck].x, _hotspotsWalkPos[kHSExitTruck].y, 0, 0x107AB, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitTruck].x, _hotspotsWalkPos[kHSExitTruck].y + 1, -1, 0x107CD, 1); _newSceneNum = 33; } @@ -165,10 +168,9 @@ void GnapEngine::scene32_run() { if (!_timers[4]) { _timers[4] = getRandom(100) + 300; if (getRandom(2) != 0) - _s32_dword_47EADC = 14; + _gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); else - _s32_dword_47EADC = 13; - _gameSys->insertSequence(_s32_dword_47EADC, 180, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); } playSoundC(); } @@ -191,7 +193,7 @@ void GnapEngine::scene32_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); - if (_gnapActionStatus == 0) + if (_gnapActionStatus == kASLeaveScene) _sceneDone = true; } -- cgit v1.2.3 From d5d7d3c802ed676fc8f5db98e1158bec5a2f286e Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 13:04:58 +0100 Subject: GNAP: Clean up scene 33 --- engines/gnap/gnap.h | 4 +- engines/gnap/scenes/scene33.cpp | 95 ++++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index ec891b0941..cf146e407d 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -816,9 +816,7 @@ public: void scene32_run(); void scene32_updateAnimations(); - int _s33_dword_47EAE4; - int _s33_dword_47EAE8; - int _s33_dword_47EAEC; + int _s33_currChickenSequenceId, _s33_nextChickenSequenceId; int scene33_init(); void scene33_updateHotspots(); void scene33_run(); diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index f9471abcd5..e8c232833b 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -38,6 +38,13 @@ enum { kHSWalkArea2 = 8 }; +enum { + kASLeaveScene = 0, + kASTalkChicken = 1, + kASUseChicken = 2, + kASUseChickenDone = 3 +}; + int GnapEngine::scene33_init() { return isFlag(26) ? 0x84 : 0x85; } @@ -61,12 +68,11 @@ void GnapEngine::scene33_run() { startSoundTimerC(6); queueInsertDeviceIcon(); - _s33_dword_47EAEC = 0x7E; + _s33_currChickenSequenceId = 0x7E; _gameSys->setAnimation(0x7E, 179, 2); - _gameSys->insertSequence(_s33_dword_47EAEC, 179, 0, 0, kSeqNone, 0, 0, 0); - _s33_dword_47EAE4 = -1; + _gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _s33_nextChickenSequenceId = -1; _timers[5] = getRandom(20) + 30; - _s33_dword_47EAE8 = -1; _timers[4] = getRandom(100) + 300; switch (_prevSceneNum) { @@ -147,14 +153,14 @@ void GnapEngine::scene33_run() { case GRAB_CURSOR: _gnapIdleFacing = 1; if (gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _gnapActionStatus = 2; + _gnapActionStatus = kASUseChicken; else _gnapActionStatus = -1; break; case TALK_CURSOR: _gnapIdleFacing = 1; gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 1; + _gnapActionStatus = kASTalkChicken; break; case LOOK_CURSOR: case PLAT_CURSOR: @@ -167,8 +173,8 @@ void GnapEngine::scene33_run() { case kHSExitHouse: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; - _gnapActionStatus = 0; + _isLeavingScene = true; + _gnapActionStatus = kASLeaveScene; _newSceneNum = 37; if (_gnapX > 6) gnapWalkTo(_gnapX, _gnapY, 0, 0x107AD, 1); @@ -179,8 +185,8 @@ void GnapEngine::scene33_run() { case kHSExitBarn: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; - _gnapActionStatus = 0; + _isLeavingScene = true; + _gnapActionStatus = kASLeaveScene; _newSceneNum = 35; if (_gnapX > 7) gnapWalkTo(_gnapX, _gnapY, 0, 0x107AD, 1); @@ -191,9 +197,9 @@ void GnapEngine::scene33_run() { case kHSExitCreek: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitCreek].x, _hotspotsWalkPos[kHSExitCreek].y, 0, 0x107AB, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitCreek].x, _hotspotsWalkPos[kHSExitCreek].y, -1, 0x107CD, 1); _newSceneNum = 34; } @@ -201,9 +207,9 @@ void GnapEngine::scene33_run() { case kHSExitPigpen: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitPigpen].x, _hotspotsWalkPos[kHSExitPigpen].y, 0, 0x107AF, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitPigpen].x, _hotspotsWalkPos[kHSExitPigpen].y, -1, 0x107CF, 1); _newSceneNum = 32; } @@ -237,17 +243,16 @@ void GnapEngine::scene33_run() { if (!_timers[4]) { _timers[4] = getRandom(100) + 300; if (getRandom(2) != 0) - _s33_dword_47EAE8 = 0x83; + _gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); else - _s33_dword_47EAE8 = 0x82; - _gameSys->insertSequence(_s33_dword_47EAE8, 256, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[5] && _s33_dword_47EAE4 == -1 && _gnapActionStatus != 1 && _gnapActionStatus != 2) { + if (!_timers[5] && _s33_nextChickenSequenceId == -1 && _gnapActionStatus != kASTalkChicken && _gnapActionStatus != kASUseChicken) { if (getRandom(6) != 0) { - _s33_dword_47EAE4 = 0x7E; + _s33_nextChickenSequenceId = 0x7E; _timers[5] = getRandom(20) + 30; } else { - _s33_dword_47EAE4 = 0x80; + _s33_nextChickenSequenceId = 0x80; _timers[5] = getRandom(20) + 50; } } @@ -272,23 +277,23 @@ void GnapEngine::scene33_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { switch (_gnapActionStatus) { - case 0: + case kASLeaveScene: _sceneDone = true; break; - case 1: - _s33_dword_47EAE4 = 0x7F; + case kASTalkChicken: + _s33_nextChickenSequenceId = 0x7F; break; - case 2: - _s33_dword_47EAE4 = 0x81; + case kASUseChicken: + _s33_nextChickenSequenceId = 0x81; _timers[2] = 100; break; - case 3: + case kASUseChickenDone: _gameSys->insertSequence(0x107B5, _gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7B5; _gnapSequenceDatNum = 1; - _s33_dword_47EAEC = 0x7E; + _s33_currChickenSequenceId = 0x7E; _gameSys->setAnimation(0x7E, 179, 2); - _gameSys->insertSequence(_s33_dword_47EAEC, 179, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _gnapActionStatus = -1; _timers[5] = 30; break; @@ -299,25 +304,25 @@ void GnapEngine::scene33_updateAnimations() { } if (_gameSys->getAnimationStatus(2) == 2) { - if (_s33_dword_47EAE4 == 0x81) { - _gameSys->setAnimation(_s33_dword_47EAE4, 179, 0); - _gameSys->insertSequence(_s33_dword_47EAE4, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(_s33_dword_47EAEC, 179, 1); - _s33_dword_47EAE4 = -1; - _s33_dword_47EAEC = -1; - _gnapActionStatus = 3; + if (_s33_nextChickenSequenceId == 0x81) { + _gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 0); + _gameSys->insertSequence(_s33_nextChickenSequenceId, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _gameSys->removeSequence(_s33_currChickenSequenceId, 179, 1); + _s33_nextChickenSequenceId = -1; + _s33_currChickenSequenceId = -1; + _gnapActionStatus = kASUseChickenDone; _timers[5] = 500; - } else if (_s33_dword_47EAE4 == 0x7F) { - _gameSys->setAnimation(_s33_dword_47EAE4, 179, 2); - _gameSys->insertSequence(_s33_dword_47EAE4, 179, _s33_dword_47EAEC, 179, kSeqSyncWait, 0, 0, 0); - _s33_dword_47EAEC = _s33_dword_47EAE4; - _s33_dword_47EAE4 = -1; + } else if (_s33_nextChickenSequenceId == 0x7F) { + _gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); + _gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _s33_currChickenSequenceId = _s33_nextChickenSequenceId; + _s33_nextChickenSequenceId = -1; _gnapActionStatus = -1; - } else if (_s33_dword_47EAE4 != -1) { - _gameSys->setAnimation(_s33_dword_47EAE4, 179, 2); - _gameSys->insertSequence(_s33_dword_47EAE4, 179, _s33_dword_47EAEC, 179, kSeqSyncWait, 0, 0, 0); - _s33_dword_47EAEC = _s33_dword_47EAE4; - _s33_dword_47EAE4 = -1; + } else if (_s33_nextChickenSequenceId != -1) { + _gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); + _gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _s33_currChickenSequenceId = _s33_nextChickenSequenceId; + _s33_nextChickenSequenceId = -1; } } -- cgit v1.2.3 From 4752703298c568a87b3a7bfb281cd1993d9de3c7 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 13:21:20 +0100 Subject: GNAP: Clean up scene 38 --- engines/gnap/gnap.cpp | 2 +- engines/gnap/gnap.h | 1 + engines/gnap/scenes/scene38.cpp | 112 ++++++++++++++++++++++------------------ 3 files changed, 63 insertions(+), 52 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 86fc38d7c0..677b073207 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 32; + _newSceneNum = 38; _newCursorValue = 3; // < DEBUG END diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index cf146e407d..86bce8d935 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -816,6 +816,7 @@ public: void scene32_run(); void scene32_updateAnimations(); + // Scene 33 int _s33_currChickenSequenceId, _s33_nextChickenSequenceId; int scene33_init(); void scene33_updateHotspots(); diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index cfbaf9dcaf..53768fe9ca 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -42,6 +42,16 @@ enum { kHSWalkArea6 = 12 }; +enum { + kASLeaveScene = 0, + kASExitCave = 1, + kASUseHuntingTrophy = 2, + kASHoldingHuntingTrophy = 3, + kASReleaseHuntingTrophy = 4, + kASUseBeaverWithTrapDoor = 5, + kASBeaverHoldingTrapDoor = 6 +}; + int GnapEngine::scene38_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); @@ -62,21 +72,21 @@ void GnapEngine::scene38_updateHotspots() { setHotspot(kHSWalkArea5, 770, 0, 799, 445); setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_beaverActionStatus == 6) + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_DISABLED; - if (_beaverActionStatus == 6) + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSExitCave].flags = SF_EXIT_D_CURSOR; - else if (_gnapActionStatus == 3) + else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSExitCave].flags = SF_EXIT_D_CURSOR; - if (_beaverActionStatus == 6) + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSTrapDoorLid1].flags = SF_DISABLED; - else if (_gnapActionStatus == 3) + else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSTrapDoorLid1].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_beaverActionStatus == 6) + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSTrapDoorLid2].flags = SF_DISABLED; - else if (_gnapActionStatus == 3) + else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSTrapDoorLid2].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_beaverActionStatus == 6) + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSWalkArea6].flags = 0; _hotspotsCount = 13; } @@ -111,8 +121,8 @@ void GnapEngine::scene38_run() { break; case kHSPlatypus: - if (_gnapActionStatus == 3) { - _gnapActionStatus = 4; + if (_gnapActionStatus == kASHoldingHuntingTrophy) { + _gnapActionStatus = kASReleaseHuntingTrophy; } else if (_grabCursorSpriteIndex >= 0) { playGnapImpossible(_platX, _platY); } else { @@ -135,42 +145,42 @@ void GnapEngine::scene38_run() { break; case kHSExitHouse: - if (_gnapActionStatus == 3) { - _gnapActionStatus = 4; + if (_gnapActionStatus == kASHoldingHuntingTrophy) { + _gnapActionStatus = kASReleaseHuntingTrophy; } else { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(-1, -1, 0, 0x107AE, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; _newSceneNum = 37; } break; case kHSExitCave: - if (_gnapActionStatus == 3) { - _gnapActionStatus = 4; - if (_beaverActionStatus == 6) - _isLeavingScene = 1; - } else if (_beaverActionStatus == 6) { - _sceneWaiting = 0; - _isLeavingScene = 1; + if (_gnapActionStatus == kASHoldingHuntingTrophy) { + _gnapActionStatus = kASReleaseHuntingTrophy; + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + _isLeavingScene = true; + } else if (_beaverActionStatus == kASBeaverHoldingTrapDoor) { + _sceneWaiting = false; + _isLeavingScene = true; gnapWalkTo(5, 7, 0, 0x107BB, 1); _newSceneNum = 39; - _gnapActionStatus = 1; + _gnapActionStatus = kASExitCave; } break; case kHSTrapDoorLid1: case kHSTrapDoorLid2: - if (_gnapActionStatus == 3) { - if (_beaverActionStatus == 6 && _verbCursor == PLAT_CURSOR) - _gnapActionStatus = 5; + if (_gnapActionStatus == kASHoldingHuntingTrophy) { + if (_verbCursor == PLAT_CURSOR && _beaverActionStatus != kASBeaverHoldingTrapDoor) + _gnapActionStatus = kASUseBeaverWithTrapDoor; else - _gnapActionStatus = 4; + _gnapActionStatus = kASReleaseHuntingTrophy; } break; case kHSHuntingTrophy: - if (_gnapActionStatus != 3) { + if (_gnapActionStatus != kASHoldingHuntingTrophy) { if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(3, 6, 2, 0); } else { @@ -179,12 +189,12 @@ void GnapEngine::scene38_run() { playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (_beaverActionStatus == 6) + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) playGnapImpossible(0, 0); else { gnapWalkTo(3, 6, 0, 0x107BB, 1); platypusWalkTo(4, 8, -1, -1, 1); - _gnapActionStatus = 2; + _gnapActionStatus = kASUseHuntingTrophy; } break; case TALK_CURSOR: @@ -207,16 +217,16 @@ void GnapEngine::scene38_run() { case kHSWalkArea4: case kHSWalkArea5: case kHSWalkArea6: - if (_gnapActionStatus == 3) - _gnapActionStatus = 4; + if (_gnapActionStatus == kASHoldingHuntingTrophy) + _gnapActionStatus = kASReleaseHuntingTrophy; else if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); break; default: if (_mouseClickState.left) { - if (_gnapActionStatus == 3) - _gnapActionStatus = 4; + if (_gnapActionStatus == kASHoldingHuntingTrophy) + _gnapActionStatus = kASReleaseHuntingTrophy; else if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); _mouseClickState.left = false; @@ -251,29 +261,29 @@ void GnapEngine::scene38_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { - case 0: + case kASLeaveScene: _sceneDone = true; break; - case 1: + case kASExitCave: _gameSys->removeSequence(_beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, 1); _gameSys->insertSequence(0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0xA3; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0xA3, _gnapId, 0); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; break; - case 2: + case kASUseHuntingTrophy: _gameSys->removeSequence(0x9B, 0, 1); _gameSys->insertSequence(0x9C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x9C; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x9C, _gnapId, 0); - _gnapActionStatus = 3; + _gnapActionStatus = kASHoldingHuntingTrophy; scene38_updateHotspots(); break; - case 3: - if (_beaverActionStatus != 6) - _sceneWaiting = 1; + case kASHoldingHuntingTrophy: + if (_beaverActionStatus != kASBeaverHoldingTrapDoor) + _sceneWaiting = true; if (_gnapSequenceId == 0xA4) { _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x9D; @@ -284,11 +294,11 @@ void GnapEngine::scene38_updateAnimations() { _gnapSequenceDatNum = 0; _gameSys->setAnimation(_gnapSequenceId, _gnapId, 0); break; - case 4: + case kASReleaseHuntingTrophy: if (_gnapSequenceId == 0x9E) { _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); _gnapActionStatus = -1; - } else if (_beaverActionStatus == 6) { + } else if (_beaverActionStatus == kASBeaverHoldingTrapDoor) { _gameSys->insertSequence(0xA0, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0xA0; _gnapSequenceDatNum = 0; @@ -296,10 +306,10 @@ void GnapEngine::scene38_updateAnimations() { _gnapY = 6; _gnapIdleFacing = 1; if (_isLeavingScene) { - _sceneWaiting = 0; + _sceneWaiting = false; gnapWalkTo(5, 7, 0, 0x107BB, 1); _newSceneNum = 39; - _gnapActionStatus = 1; + _gnapActionStatus = kASExitCave; } else { _gnapActionStatus = -1; } @@ -311,17 +321,17 @@ void GnapEngine::scene38_updateAnimations() { _gnapY = 6; _gnapIdleFacing = 1; _gameSys->setAnimation(0x9E, _gnapId, 0); - _sceneWaiting = 0; + _sceneWaiting = false; scene38_updateHotspots(); } break; - case 5: - _sceneWaiting = 0; + case kASUseBeaverWithTrapDoor: + _sceneWaiting = false; _gameSys->insertSequence(0x9F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x9F; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x9F, _gnapId, 0); - _gnapActionStatus = 3; + _gnapActionStatus = kASHoldingHuntingTrophy; if (_beaverFacing) playBeaverSequence(0x107D5); else @@ -332,7 +342,7 @@ void GnapEngine::scene38_updateAnimations() { _beaverSequenceDatNum = 0; _beaverId = _gnapId + 1; _gameSys->setAnimation(0xA1, _gnapId + 1, 1); - _beaverActionStatus = 6; + _beaverActionStatus = kASBeaverHoldingTrapDoor; scene38_updateHotspots(); break; } @@ -340,7 +350,7 @@ void GnapEngine::scene38_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - if (_beaverActionStatus == 6) { + if (_beaverActionStatus == kASBeaverHoldingTrapDoor) { _gameSys->insertSequence(0xA2, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); _beaverSequenceId = 0xA2; _beaverSequenceDatNum = 0; -- cgit v1.2.3 From 9bac81c802e12b64cde335af30d748a98815658c Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 13:53:06 +0100 Subject: GNAP: Clean up scene 39 --- engines/gnap/gnap.cpp | 6 +++--- engines/gnap/gnap.h | 3 +-- engines/gnap/scenes/scene39.cpp | 40 +++++++++++++++++++++++----------------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 677b073207..598fd8c7c8 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -158,14 +158,14 @@ Common::Error GnapEngine::run() { //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - _currentSceneNum = 31; + _currentSceneNum = 39; Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); _dat->open(0, datFilename.c_str()); _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - _gameSys->insertSequence(0xfe, 100, -1, -1, 0, 0, 0, 0); + _gameSys->insertSequence(0x33, 100, -1, -1, 0, 0, 0, 0); CursorMan.showMouse(true); @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 38; + _newSceneNum = 39; _newCursorValue = 3; // < DEBUG END diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 86bce8d935..02c1aeb031 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -830,8 +830,7 @@ public: void scene38_updateAnimations(); // Scene 39 - int _s39_dword_47EAF8; - int _s39_dword_47EAFC; + int _s39_currGuySequenceId, _s39_nextGuySequenceId; int scene39_init(); void scene39_updateHotspots(); void scene39_run(); diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index 7bf04de240..4ba8e16b05 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -36,6 +36,10 @@ enum { kHSWalkArea2 = 6 }; +enum { + kASLeaveScene = 0 +}; + int GnapEngine::scene39_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); @@ -54,15 +58,17 @@ void GnapEngine::scene39_updateHotspots() { } void GnapEngine::scene39_run() { + + _timers[5] = 0; // Bug in the original? Timer was never intiailized. queueInsertDeviceIcon(); - _s39_dword_47EAF8 = 0x33; + _s39_currGuySequenceId = 0x33; _gameSys->setAnimation(0x33, 21, 3); - _gameSys->insertSequence(_s39_dword_47EAF8, 21, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s39_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); - _s39_dword_47EAFC = -1; + _s39_nextGuySequenceId = -1; if (_prevSceneNum == 38) { initGnapPos(3, 7, 7); initBeaverPos(2, 7, 5); @@ -79,7 +85,7 @@ void GnapEngine::scene39_run() { playSound(0x1094B, 1); setSoundVolume(0x1094B, 60); } - + updateMouseCursor(); updateCursorByHotspot(); @@ -122,10 +128,10 @@ void GnapEngine::scene39_run() { case kHSExitUfoParty: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _sceneDone = true; gnapWalkTo(_gnapX, _gnapY, 0, 0x107AB, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; _newSceneNum = 40; } break; @@ -154,7 +160,7 @@ void GnapEngine::scene39_run() { case kHSExitInsideHouse: if (_gnapActionStatus < 0) { _sceneDone = true; - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 38; } break; @@ -185,16 +191,16 @@ void GnapEngine::scene39_run() { _timers[5] = getRandom(20) + 50; switch (getRandom(4)) { case 0: - _s39_dword_47EAFC = 0x30; + _s39_nextGuySequenceId = 0x30; break; case 1: - _s39_dword_47EAFC = 0x31; + _s39_nextGuySequenceId = 0x31; break; case 2: - _s39_dword_47EAFC = 0x32; + _s39_nextGuySequenceId = 0x32; break; case 3: - _s39_dword_47EAFC = 0x33; + _s39_nextGuySequenceId = 0x33; break; } } @@ -219,17 +225,17 @@ void GnapEngine::scene39_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); - if (_gnapActionStatus == 0) + if (_gnapActionStatus == kASLeaveScene) _sceneDone = true; else _gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s39_dword_47EAFC != -1) { - _gameSys->setAnimation(_s39_dword_47EAFC, 21, 3); - _gameSys->insertSequence(_s39_dword_47EAFC, 21, _s39_dword_47EAF8, 21, kSeqSyncWait, 0, 0, 0); - _s39_dword_47EAF8 = _s39_dword_47EAFC; - _s39_dword_47EAFC = -1; + if (_gameSys->getAnimationStatus(3) == 2 && _s39_nextGuySequenceId != -1) { + _gameSys->setAnimation(_s39_nextGuySequenceId, 21, 3); + _gameSys->insertSequence(_s39_nextGuySequenceId, 21, _s39_currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _s39_currGuySequenceId = _s39_nextGuySequenceId; + _s39_nextGuySequenceId = -1; } } -- cgit v1.2.3 From bd5417aea1e513f591cedf7bc2f7daad345d375e Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 14:54:47 +0100 Subject: GNAP: Clean up scene 41 --- engines/gnap/gnap.cpp | 6 +- engines/gnap/gnap.h | 6 +- engines/gnap/scenes/scene41.cpp | 183 +++++++++++++++++++++------------------- 3 files changed, 103 insertions(+), 92 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 598fd8c7c8..aaecbfb058 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -158,14 +158,14 @@ Common::Error GnapEngine::run() { //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - _currentSceneNum = 39; + _currentSceneNum = 41; Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); _dat->open(0, datFilename.c_str()); _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - _gameSys->insertSequence(0x33, 100, -1, -1, 0, 0, 0, 0); + _gameSys->insertSequence(0x11b, 100, -1, -1, 0, 0, 0, 0); CursorMan.showMouse(true); @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 39; + _newSceneNum = 41; _newCursorValue = 3; // < DEBUG END diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 02c1aeb031..b0852934e1 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -849,10 +849,8 @@ public: void toyUfoFlyTo(int destX, int destY, int a3, int a4, int a5, int a6, int animationIndex); // Scene 41 - int _s41_dword_47F2C0; - int _s41_dword_47F2C4; - int _s41_dword_47F2C8; - int _s41_dword_47F2CC; + int _s41_currKidSequenceId, _s41_nextKidSequenceId; + int _s41_currToyVendorSequenceId, _s41_nextToyVendorSequenceId; int scene41_init(); void scene41_updateHotspots(); void scene41_run(); diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 60c5979ae7..ff90193888 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -45,6 +45,19 @@ enum { kHSUfoWalkArea1 = 4 }; +enum { + kASLeaveScene = 0, + kASUseQuarterWithToyVendor = 1, + kASTalkToyVendor = 2, + kASUseGumWithToyUfo = 3, + kASUseChickenBucketWithKid = 4, + kASGrabKid = 5, + kASGiveBackToyUfo = 6, + kASToyUfoLeaveScene = 7, + kASToyUfoRefresh = 8, + kASUfoGumAttached = 9 +}; + int GnapEngine::scene41_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); @@ -83,7 +96,7 @@ void GnapEngine::scene41_run() { if (_toyUfoY < 0 || _toyUfoY > 300) _toyUfoY = 150; if (!_timers[9]) - _gnapActionStatus = 6; + _gnapActionStatus = kASGiveBackToyUfo; } else { if (!isFlag(16) && !isFlag(17) && !isFlag(18) && !isFlag(19)) toyUfoSetStatus(16); @@ -101,20 +114,20 @@ void GnapEngine::scene41_run() { _gameSys->insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); if (isFlag(12)) - _s41_dword_47F2C4 = 0x11B; + _s41_currKidSequenceId = 0x11B; else - _s41_dword_47F2C4 = 0x11D; + _s41_currKidSequenceId = 0x11D; - _s41_dword_47F2C0 = -1; + _s41_nextKidSequenceId = -1; - _gameSys->setAnimation(_s41_dword_47F2C4, 1, 4); - _gameSys->insertSequence(_s41_dword_47F2C4, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(_s41_currKidSequenceId, 1, 4); + _gameSys->insertSequence(_s41_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _s41_dword_47F2CC = 0x118; - _s41_dword_47F2C8 = -1; + _s41_currToyVendorSequenceId = 0x118; + _s41_nextToyVendorSequenceId = -1; _gameSys->setAnimation(0x118, 1, 3); - _gameSys->insertSequence(_s41_dword_47F2CC, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s41_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { @@ -175,8 +188,8 @@ void GnapEngine::scene41_run() { case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; - _toyUfoActionStatus = 7; + _isLeavingScene = true; + _toyUfoActionStatus = kASToyUfoLeaveScene; _newSceneNum = 45; toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); } @@ -184,8 +197,8 @@ void GnapEngine::scene41_run() { case kHSUfoExitRight: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; - _toyUfoActionStatus = 7; + _isLeavingScene = true; + _toyUfoActionStatus = kASToyUfoLeaveScene; _newSceneNum = 42; toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); } @@ -236,31 +249,31 @@ void GnapEngine::scene41_run() { break; case kHSExitCave: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitCave].x, _hotspotsWalkPos[kHSExitCave].y, 0, 0x107AE, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; _newSceneNum = 40; break; case kHSExit: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExit].x, -1, 0, 0x107AF, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExit].x, -1, -1, 0x107CF, 1); _newSceneNum = 45; break; case kHSExitBBQ: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, -1, 0, 0x107AB, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, -1, -1, 0x107CD, 1); _newSceneNum = 42; break; case kHSToyVendor: if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _gnapActionStatus = 1; + _gnapActionStatus = kASUseQuarterWithToyVendor; gnapWalkTo(4, 7, 0, 0x107BB, 9); playGnapShowItem(_grabCursorSpriteIndex, 5, 0); } else if (_grabCursorSpriteIndex >= 0) { @@ -276,7 +289,7 @@ void GnapEngine::scene41_run() { case TALK_CURSOR: _gnapIdleFacing = 7; gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 2; + _gnapActionStatus = kASTalkToyVendor; break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -289,7 +302,7 @@ void GnapEngine::scene41_run() { if (_grabCursorSpriteIndex == kItemChickenBucket) { gnapWalkTo(7, 7, 0, 0x107BB, 1); _gnapIdleFacing = 7; - _gnapActionStatus = 4; + _gnapActionStatus = kASUseChickenBucketWithKid; } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(7, 7, 8, 0); } else { @@ -300,7 +313,7 @@ void GnapEngine::scene41_run() { case GRAB_CURSOR: gnapWalkTo(7, 7, 0, 0x107BB, 1); _gnapIdleFacing = 7; - _gnapActionStatus = 5; + _gnapActionStatus = kASGrabKid; break; case TALK_CURSOR: _gnapIdleFacing = 7; @@ -317,7 +330,7 @@ void GnapEngine::scene41_run() { if (_grabCursorSpriteIndex == kItemGum) { playGnapPullOutDevice(9, 0); _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - _gnapActionStatus = 3; + _gnapActionStatus = kASUseGumWithToyUfo; } break; @@ -331,7 +344,7 @@ void GnapEngine::scene41_run() { if (isFlag(12)) { if (!_timers[9] && _gnapActionStatus < 0) { - _gnapActionStatus = 6; + _gnapActionStatus = kASGiveBackToyUfo; if (_gnapSequenceId == 0x121 || _gnapSequenceId == 0x122) { _gameSys->insertSequence(0x123, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x123; @@ -364,7 +377,7 @@ void GnapEngine::scene41_run() { _gnapSequenceId = sequenceId; _gnapSequenceDatNum = 0; _gameSys->setAnimation(sequenceId, _gnapId, 0); - _toyUfoActionStatus = 8; + _toyUfoActionStatus = kASToyUfoRefresh; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { gnapWalkTo(-1, -1, -1, -1, 1); @@ -380,32 +393,32 @@ void GnapEngine::scene41_run() { updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_dword_47F2C8 == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { _gnapRandomValue = getRandom(3); switch (_gnapRandomValue) { case 0: - _s41_dword_47F2C8 = 0x113; + _s41_nextToyVendorSequenceId = 0x113; break; case 1: - _s41_dword_47F2C8 = 0x117; + _s41_nextToyVendorSequenceId = 0x117; break; case 2: - _s41_dword_47F2C8 = 0x119; + _s41_nextToyVendorSequenceId = 0x119; break; } - if (_s41_dword_47F2C8 == _s41_dword_47F2CC) - _s41_dword_47F2C8 = -1; + if (_s41_nextToyVendorSequenceId == _s41_currToyVendorSequenceId) + _s41_nextToyVendorSequenceId = -1; } } if (!_timers[5]) { _timers[5] = getRandom(30) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_dword_47F2C0 == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { if (isFlag(12)) - _s41_dword_47F2C0 = 0x11B; + _s41_nextKidSequenceId = 0x11B; else if (getRandom(3) != 0) - _s41_dword_47F2C0 = 0x11D; + _s41_nextKidSequenceId = 0x11D; else - _s41_dword_47F2C0 = 0x11E; + _s41_nextKidSequenceId = 0x11E; } } } @@ -430,30 +443,30 @@ void GnapEngine::scene41_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { switch (_gnapActionStatus) { - case 0: + case kASLeaveScene: _gameSys->setAnimation(0, 0, 0); _sceneDone = true; _gnapActionStatus = -1; break; - case 1: + case kASUseQuarterWithToyVendor: _gameSys->setAnimation(0, 0, 0); - _s41_dword_47F2C8 = 0x114; + _s41_nextToyVendorSequenceId = 0x114; _gnapActionStatus = -1; break; - case 2: + case kASTalkToyVendor: _gameSys->setAnimation(0, 0, 0); - _s41_dword_47F2C8 = 0x116; + _s41_nextToyVendorSequenceId = 0x116; _gnapActionStatus = -1; break; - case 3: + case kASUseGumWithToyUfo: _gameSys->setAnimation(0, 0, 0); playGnapUseDevice(9, 0); _gnapActionStatus = -1; setGrabCursorSprite(-1); invRemove(kItemGum); - _toyUfoActionStatus = 9; + _toyUfoActionStatus = kASUfoGumAttached; break; - case 4: + case kASUseChickenBucketWithKid: if (_gameSys->getAnimationStatus(4) == 2) { _timers[2] = getRandom(30) + 20; _timers[3] = getRandom(50) + 200; @@ -462,11 +475,11 @@ void GnapEngine::scene41_updateAnimations() { _gnapSequenceId = 0x11F; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x11F, _gnapId, 0); - _s41_dword_47F2C0 = 0x11A; - _gameSys->insertSequence(0x11A, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); - _s41_dword_47F2C4 = _s41_dword_47F2C0; - _s41_dword_47F2C0 = 0x11B; + _s41_nextKidSequenceId = 0x11A; + _gameSys->insertSequence(0x11A, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + _s41_currKidSequenceId = _s41_nextKidSequenceId; + _s41_nextKidSequenceId = 0x11B; _timers[5] = getRandom(30) + 20; _gnapActionStatus = -1; setFlag(12); @@ -474,7 +487,7 @@ void GnapEngine::scene41_updateAnimations() { _timers[9] = 600; } break; - case 5: + case kASGrabKid: if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { _timers[2] = getRandom(30) + 20; _timers[3] = getRandom(50) + 200; @@ -482,22 +495,22 @@ void GnapEngine::scene41_updateAnimations() { _gnapSequenceId = 0x110; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x110, _gnapId, 0); - _s41_dword_47F2C8 = 0x111; - _gameSys->insertSequence(0x111, 1, _s41_dword_47F2CC, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_dword_47F2C8, 1, 3); - _s41_dword_47F2CC = _s41_dword_47F2C8; - _s41_dword_47F2C8 = -1; + _s41_nextToyVendorSequenceId = 0x111; + _gameSys->insertSequence(0x111, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); + _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; + _s41_nextToyVendorSequenceId = -1; _timers[4] = getRandom(100) + 100; - _s41_dword_47F2C0 = 0x10F; - _gameSys->insertSequence(0x10F, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); - _s41_dword_47F2C4 = _s41_dword_47F2C0; - _s41_dword_47F2C0 = -1; + _s41_nextKidSequenceId = 0x10F; + _gameSys->insertSequence(0x10F, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + _s41_currKidSequenceId = _s41_nextKidSequenceId; + _s41_nextKidSequenceId = -1; _timers[5] = getRandom(30) + 20; _gnapActionStatus = -1; } break; - case 6: + case kASGiveBackToyUfo: if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { _timers[2] = getRandom(30) + 20; _timers[3] = getRandom(50) + 200; @@ -507,17 +520,17 @@ void GnapEngine::scene41_updateAnimations() { _gnapSequenceId = 0x124; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x124, _gnapId, 0); - _s41_dword_47F2C8 = 0x112; - _gameSys->insertSequence(0x112, 1, _s41_dword_47F2CC, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_dword_47F2C8, 1, 3); - _s41_dword_47F2CC = _s41_dword_47F2C8; - _s41_dword_47F2C8 = -1; + _s41_nextToyVendorSequenceId = 0x112; + _gameSys->insertSequence(0x112, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); + _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; + _s41_nextToyVendorSequenceId = -1; _timers[4] = getRandom(100) + 100; - _s41_dword_47F2C0 = 0x11C; - _gameSys->insertSequence(0x11C, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); - _s41_dword_47F2C4 = _s41_dword_47F2C0; - _s41_dword_47F2C0 = -1; + _s41_nextKidSequenceId = 0x11C; + _gameSys->insertSequence(0x11C, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + _s41_currKidSequenceId = _s41_nextKidSequenceId; + _s41_nextKidSequenceId = -1; _timers[5] = getRandom(30) + 20; _gnapActionStatus = -1; clearFlag(12); @@ -529,10 +542,10 @@ void GnapEngine::scene41_updateAnimations() { if (_gameSys->getAnimationStatus(2) == 2) { switch (_toyUfoActionStatus) { - case 7: + case kASToyUfoLeaveScene: _sceneDone = true; break; - case 9: + case kASUfoGumAttached: _toyUfoNextSequenceId = 0x873; _gameSys->insertSequence(0x10873, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, _toyUfoX - 365, _toyUfoY - 128); @@ -552,22 +565,22 @@ void GnapEngine::scene41_updateAnimations() { _toyUfoActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s41_dword_47F2C8 != -1) { - _gameSys->insertSequence(_s41_dword_47F2C8, 1, _s41_dword_47F2CC, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_dword_47F2C8, 1, 3); - _s41_dword_47F2CC = _s41_dword_47F2C8; - _s41_dword_47F2C8 = -1; + if (_gameSys->getAnimationStatus(3) == 2 && _s41_nextToyVendorSequenceId != -1) { + _gameSys->insertSequence(_s41_nextToyVendorSequenceId, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); + _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; + _s41_nextToyVendorSequenceId = -1; _timers[4] = getRandom(100) + 100; } - if (_gameSys->getAnimationStatus(4) == 2 && _s41_dword_47F2C0 != -1) { - _gameSys->insertSequence(_s41_dword_47F2C0, 1, _s41_dword_47F2C4, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_dword_47F2C0, 1, 4); - _s41_dword_47F2C4 = _s41_dword_47F2C0; - _s41_dword_47F2C0 = -1; + if (_gameSys->getAnimationStatus(4) == 2 && _s41_nextKidSequenceId != -1) { + _gameSys->insertSequence(_s41_nextKidSequenceId, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + _s41_currKidSequenceId = _s41_nextKidSequenceId; + _s41_nextKidSequenceId = -1; _timers[5] = getRandom(30) + 20; - if (_s41_dword_47F2C4 == 0x11E) { - _toyUfoActionStatus = 8; + if (_s41_currKidSequenceId == 0x11E) { + _toyUfoActionStatus = kASToyUfoRefresh; toyUfoFlyTo(getRandom(300) + 500, getRandom(225) + 75, 0, 799, 0, 300, 2); } } -- cgit v1.2.3 From 9f821cf1e1dab4e572873ad0c19704ba2bfcbd6e Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 23 Jan 2014 16:58:49 +0100 Subject: GNAP: Clean up scene 42 --- engines/gnap/gnap.cpp | 2 +- engines/gnap/gnap.h | 3 +- engines/gnap/scenes/scene42.cpp | 115 ++++++++++++++++++++++------------------ 3 files changed, 65 insertions(+), 55 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index aaecbfb058..ba8214d4f1 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 41; + _newSceneNum = 42; _newCursorValue = 3; // < DEBUG END diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index b0852934e1..7aeff8c3b4 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -857,8 +857,7 @@ public: void scene41_updateAnimations(); // Scene 42 - int _s42_dword_47F2B8; - int _s42_dword_47F2BC; + int _s42_currBBQVendorSequenceId, _s42_nextBBQVendorSequenceId; int scene42_init(); void scene42_updateHotspots(); void scene42_run(); diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 2f98a820a2..33f437b8c6 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -45,6 +45,17 @@ enum { kHSUfoDevice = 4 }; +enum { + kASLeaveScene = 0, + kASTalkBBQVendor = 1, + kASUseQuarterWithBBQVendor = 2, + kASUseQuarterWithBBQVendorDone = 3, + kASGrabChickenLeg = 4, + kASToyUfoLeaveScene = 5, + kASToyUfoRefresh = 6, + kASToyUfoPickUpHotSauce = 7 +}; + int GnapEngine::scene42_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); @@ -82,11 +93,11 @@ void GnapEngine::scene42_run() { queueInsertDeviceIcon(); - _s42_dword_47F2B8 = 0x14A; - _s42_dword_47F2BC = -1; + _s42_currBBQVendorSequenceId = 0x14A; + _s42_nextBBQVendorSequenceId = -1; _gameSys->setAnimation(0x14A, 1, 2); - _gameSys->insertSequence(_s42_dword_47F2B8, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s42_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -153,7 +164,7 @@ void GnapEngine::scene42_run() { case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { _isLeavingScene = true; - _toyUfoActionStatus = 5; + _toyUfoActionStatus = kASToyUfoLeaveScene; _newSceneNum = 41; toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); } @@ -162,7 +173,7 @@ void GnapEngine::scene42_run() { case kHSUfoExitRight: if (_toyUfoActionStatus < 0) { _isLeavingScene = true; - _toyUfoActionStatus = 5; + _toyUfoActionStatus = kASToyUfoLeaveScene; _newSceneNum = 43; toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); } @@ -170,11 +181,11 @@ void GnapEngine::scene42_run() { case kHSUfoHotSauce: if (isFlag(17)) { - _toyUfoActionStatus = 7; + _toyUfoActionStatus = kASToyUfoPickUpHotSauce; toyUfoFlyTo(384, 77, 0, 799, 0, 300, 3); _timers[9] = 600; } else { - _toyUfoActionStatus = 6; + _toyUfoActionStatus = kASToyUfoRefresh; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } break; @@ -223,7 +234,7 @@ void GnapEngine::scene42_run() { case kHSExitUfoParty: _isLeavingScene = true; gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_platX, _hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); _newSceneNum = 40; break; @@ -231,7 +242,7 @@ void GnapEngine::scene42_run() { case kHSExitToyStand: _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitToyStand].x, _gnapY, 0, 0x107AF, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitToyStand].x, _hotspotsWalkPos[kHSExitToyStand].y, -1, 0x107CF, 1); _newSceneNum = 41; break; @@ -239,7 +250,7 @@ void GnapEngine::scene42_run() { case kHSExitUfo: _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _gnapY, 0, 0x107AB, 1); - _gnapActionStatus = 0; + _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _hotspotsWalkPos[kHSExitUfo].y, -1, 0x107CD, 1); _newSceneNum = 43; break; @@ -247,7 +258,7 @@ void GnapEngine::scene42_run() { case kHSBBQVendor: if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { gnapWalkTo(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, 0, 0x107BB, 1); - _gnapActionStatus = 2; + _gnapActionStatus = kASUseQuarterWithBBQVendor; if (_platY < 9) platypusWalkTo(_platX, 9, -1, -1, 1); } else if (_grabCursorSpriteIndex >= 0) { @@ -260,7 +271,7 @@ void GnapEngine::scene42_run() { case TALK_CURSOR: _gnapIdleFacing = 7; gnapWalkTo(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 1; + _gnapActionStatus = kASTalkBBQVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -280,7 +291,7 @@ void GnapEngine::scene42_run() { break; case GRAB_CURSOR: gnapWalkTo(_hotspotsWalkPos[kHSChickenLeg].x, _hotspotsWalkPos[kHSChickenLeg].y, 0, 0x107BC, 1); - _gnapActionStatus = 4; + _gnapActionStatus = kASGrabChickenLeg; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -303,7 +314,7 @@ void GnapEngine::scene42_run() { if (_mouseClickState.left && _gnapActionStatus < 0) { _mouseClickState.left = false; if (isFlag(12)) { - _toyUfoActionStatus = 6; + _toyUfoActionStatus = kASToyUfoRefresh; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { gnapWalkTo(-1, -1, -1, -1, 1); @@ -321,28 +332,28 @@ void GnapEngine::scene42_run() { updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 30; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s42_dword_47F2BC == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { _gnapRandomValue = getRandom(8); switch (_gnapRandomValue) { case 0: - _s42_dword_47F2BC = 0x14C; + _s42_nextBBQVendorSequenceId = 0x14C; break; case 1: case 2: - _s42_dword_47F2BC = 0x149; + _s42_nextBBQVendorSequenceId = 0x149; break; case 3: case 4: case 5: case 6: - _s42_dword_47F2BC = 0x14D; + _s42_nextBBQVendorSequenceId = 0x14D; break; case 7: - _s42_dword_47F2BC = 0x14A; + _s42_nextBBQVendorSequenceId = 0x14A; break; } - if (_s42_dword_47F2BC == _s42_dword_47F2B8 && _s42_dword_47F2BC != 0x14D) - _s42_dword_47F2BC = -1; + if (_s42_nextBBQVendorSequenceId == _s42_currBBQVendorSequenceId && _s42_nextBBQVendorSequenceId != 0x14D) + _s42_nextBBQVendorSequenceId = -1; } } } @@ -367,48 +378,43 @@ void GnapEngine::scene42_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { switch (_gnapActionStatus) { - case 0: + case kASLeaveScene: _gameSys->setAnimation(0, 0, 0); _gnapActionStatus = -1; _sceneDone = true; break; - case 1: + case kASTalkBBQVendor: _gameSys->setAnimation(0, 0, 0); _gnapActionStatus = -1; - _s42_dword_47F2BC = 0x14B; + _s42_nextBBQVendorSequenceId = 0x14B; break; - case 3: - _gameSys->setAnimation(0, 0, 0); - setGrabCursorSprite(kItemChickenBucket); - _gnapActionStatus = -1; - break; - case 2: - case 4: + case kASUseQuarterWithBBQVendor: + case kASGrabChickenLeg: if (_gameSys->getAnimationStatus(2) == 2) { - if (_gnapActionStatus == 2) { + if (_gnapActionStatus == kASUseQuarterWithBBQVendor) { invRemove(kItemDiceQuarterHole); invAdd(kItemChickenBucket); setGrabCursorSprite(-1); sequenceId = 0x150; - _s42_dword_47F2BC = 0x148; + _s42_nextBBQVendorSequenceId = 0x148; } else if (isFlag(27)) { if (isFlag(28)) { sequenceId = 0x7B7; - _s42_dword_47F2BC = 0x145; + _s42_nextBBQVendorSequenceId = 0x145; } else { setFlag(28); sequenceId = 0x14F; - _s42_dword_47F2BC = 0x147; + _s42_nextBBQVendorSequenceId = 0x147; } } else { setFlag(27); sequenceId = 0x14E; - _s42_dword_47F2BC = 0x146; + _s42_nextBBQVendorSequenceId = 0x146; } if (sequenceId == 0x7B7) { _gameSys->insertSequence(0x107B7, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, getSequenceTotalDuration(_s42_dword_47F2BC), + kSeqSyncWait, getSequenceTotalDuration(_s42_nextBBQVendorSequenceId), 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceDatNum = 1; } else { @@ -419,22 +425,27 @@ void GnapEngine::scene42_updateAnimations() { } _gnapSequenceId = sequenceId; _gameSys->setAnimation(sequenceId | (_gnapSequenceDatNum << 16), _gnapId, 0); - if (_gnapActionStatus == 2) - _gnapActionStatus = 3; + if (_gnapActionStatus == kASUseQuarterWithBBQVendor) + _gnapActionStatus = kASUseQuarterWithBBQVendorDone; else _gnapActionStatus = -1; - _gameSys->insertSequence(_s42_dword_47F2BC, 1, _s42_dword_47F2B8, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s42_dword_47F2BC, 1, 2); - _s42_dword_47F2B8 = _s42_dword_47F2BC; - if (_s42_dword_47F2BC == 0x145) - _s42_dword_47F2BC = 0x14A; + _gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); + _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; + if (_s42_nextBBQVendorSequenceId == 0x145) + _s42_nextBBQVendorSequenceId = 0x14A; else - _s42_dword_47F2BC = -1; + _s42_nextBBQVendorSequenceId = -1; _timers[4] = getRandom(20) + 30; _timers[2] = getRandom(30) + 20; _timers[3] = getRandom(50) + 200; } break; + case kASUseQuarterWithBBQVendorDone: + _gameSys->setAnimation(0, 0, 0); + setGrabCursorSprite(kItemChickenBucket); + _gnapActionStatus = -1; + break; default: _gameSys->setAnimation(0, 0, 0); _gnapActionStatus = -1; @@ -442,20 +453,20 @@ void GnapEngine::scene42_updateAnimations() { } } - if (_gameSys->getAnimationStatus(2) == 2 && _s42_dword_47F2BC != -1) { - _gameSys->insertSequence(_s42_dword_47F2BC, 1, _s42_dword_47F2B8, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s42_dword_47F2BC, 1, 2); - _s42_dword_47F2B8 = _s42_dword_47F2BC; - _s42_dword_47F2BC = -1; + if (_gameSys->getAnimationStatus(2) == 2 && _s42_nextBBQVendorSequenceId != -1) { + _gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); + _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; + _s42_nextBBQVendorSequenceId = -1; _timers[4] = getRandom(20) + 30; } if (_gameSys->getAnimationStatus(3) == 2) { switch (_toyUfoActionStatus) { - case 5: + case kASToyUfoLeaveScene: _sceneDone = true; break; - case 7: + case kASToyUfoPickUpHotSauce: _gameSys->insertSequence(0x10870, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); setFlag(24); scene42_updateHotspots(); -- cgit v1.2.3 From 2a23b8d90c8b2c3a56a457a7791775b652876d17 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Mar 2016 22:47:16 +0100 Subject: GNAP: Update copyright --- engines/gnap/detection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 8898d9069a..88994451a4 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -63,7 +63,7 @@ public: } virtual const char *getOriginalCopyright() const { - return "Gnap (C) 1999"; + return "Gnap (C) Artech Digital Entertainment 1997"; } virtual bool hasFeature(MetaEngineFeature f) const; -- cgit v1.2.3 From c18c5b047d33f261c003d6196891bae7d6669fd6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Mar 2016 00:05:55 +0100 Subject: GNAP: Reduce variable scope in fatUpdateFrame, change variable type to boolean --- engines/gnap/gamesys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index d6f8db8c7a..6e0260a2ce 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -1022,7 +1022,7 @@ void GameSys::fatUpdateFrame() { return; bool updFlag = true; - int duration, v20, currFrameNum; + int duration, currFrameNum; // NOTE Skipped avi code (reqAviStart) @@ -1071,13 +1071,13 @@ void GameSys::fatUpdateFrame() { duration = clockDelta - gfxItem->delayTicks; gfxItem->delayTicks = 0; if (gfxItem->prevFrame.duration <= duration) { - v20 = 0; + bool v20 = false; if (gfxItem->prevFrame.duration > 0) { duration -= gfxItem->prevFrame.duration; gfxItem->prevFrame.duration = -duration; } else { gfxItem->prevFrame.duration = 0; - v20 = 1; + v20 = true; } currFrameNum = gfxItem->currFrameNum; if (animation->framesCount > currFrameNum) { -- cgit v1.2.3 From 9d52140b09ccf1821515bfc4ed92127a5c97c3ce Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Mar 2016 00:06:56 +0100 Subject: GNAP: Some renaming in toyUfoFlyTo --- engines/gnap/gnap.cpp | 79 +++++++++++++++++++++++++-------------------------- engines/gnap/gnap.h | 2 +- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index ba8214d4f1..57fa625794 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2221,12 +2221,7 @@ bool GnapEngine::toyUfoCheckTimer() { return true; } -void GnapEngine::toyUfoFlyTo(int destX, int destY, int a3, int a4, int a5, int a6, int animationIndex) { - int v21 = 0; - int v14 = 0; - int v17 = 36; - int v15 = 32; - int i = 0; +void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex) { GridStruct v16[34]; if (destX == -1) @@ -2237,76 +2232,80 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int a3, int a4, int a5, int a //CHECKME - int v25 = CLIP(destX, a3, a4); - int v26 = CLIP(destY, a5, a6); - int v24, v23; - int v13, v20; + int clippedDestX = CLIP(destX, minX, maxX); + int clippedDestY = CLIP(destY, minY, maxY); + int dirX, dirY; // 0, -1 or 1 - if (v25 == _toyUfoX) - v24 = 0; + if (clippedDestX == _toyUfoX) + dirX = 0; else - v24 = (v25 - _toyUfoX) / ABS(v25 - _toyUfoX); + dirX = (clippedDestX - _toyUfoX) / ABS(clippedDestX - _toyUfoX); - if (v26 == _toyUfoY) - v23 = 0; + if (clippedDestY == _toyUfoY) + dirY = 0; else - v23 = (v26 - _toyUfoY) / ABS(v26 - _toyUfoY); - - v13 = ABS(v25 - _toyUfoX); - v20 = ABS(v26 - _toyUfoY); + dirY = (clippedDestY - _toyUfoY) / ABS(clippedDestY - _toyUfoY); - if (v20 > v13) { - int v22 = v20 / v15; - while (v14 < v20 && i < 34) { + int deltaX = ABS(clippedDestX - _toyUfoX); + int deltaY = ABS(clippedDestY - _toyUfoY); + + int i = 0; + if (deltaY > deltaX) { + int v15 = 32; + int v22 = deltaY / v15; + int v14 = 0; + while (v14 < deltaY && i < 34) { if (v22 - 5 >= i) { v15 = MIN(36, 8 * i + 8); } else { v15 = MAX(6, v15 - 3); } v14 += v15; - v16[i].gridX1 = _toyUfoX + v24 * v13 * v14 / v20; - v16[i].gridY1 = _toyUfoY + v23 * v14; + v16[i].gridX1 = _toyUfoX + dirX * deltaX * v14 / deltaY; + v16[i].gridY1 = _toyUfoY + dirY * v14; ++i; } } else { - int v22 = v13 / v17; - while (v14 < v13 && i < 34) { + int v17 = 36; + int v22 = deltaX / v17; + int v14 = 0; + while (v14 < deltaX && i < 34) { if (v22 - 5 >= i) { v17 = MIN(38, 8 * i + 8); } else { v17 = MAX(6, v17 - 3); } v14 += v17; - v16[i].gridX1 = _toyUfoX + v24 * v14; - v16[i].gridY1 = _toyUfoY + v23 * v20 * v14 / v13; + v16[i].gridX1 = _toyUfoX + dirX * v14; + v16[i].gridY1 = _toyUfoY + dirY * deltaY * v14 / deltaX; ++i; } } - v21 = i - 1; + int v21 = i - 1; - _toyUfoX = v25; - _toyUfoY = v26; + _toyUfoX = clippedDestX; + _toyUfoY = clippedDestY; - debug("v21: %d", v21); +// debug("v21: %d", v21); if (i - 1 > 0) { - int v18; + int seqId; if (isFlag(16)) - v18 = 0x867; + seqId = 0x867; else if (isFlag(17)) - v18 = 0x84F; + seqId = 0x84F; else if (isFlag(18)) - v18 = 0x85F; + seqId = 0x85F; else if (isFlag(19)) - v18 = 0x857; - v16[0].sequenceId = v18; + seqId = 0x857; + v16[0].sequenceId = seqId; v16[0].id = 0; - _gameSys->insertSequence(v18 | 0x10000, 0, + _gameSys->insertSequence(seqId | 0x10000, 0, _toyUfoSequenceId | 0x10000, _toyUfoId, 8, 0, v16[0].gridX1 - 365, v16[0].gridY1 - 128); for (i = 1; i < v21; ++i) { - v16[i].sequenceId = v18 + (i % 8); + v16[i].sequenceId = seqId + (i % 8); v16[i].id = i; _gameSys->insertSequence(v16[i].sequenceId | 0x10000, v16[i].id, v16[i - 1].sequenceId | 0x10000, v16[i - 1].id, diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 7aeff8c3b4..6b532a0141 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -846,7 +846,7 @@ public: void toyUfoSetStatus(int a1); int toyUfoGetSequenceId(); bool toyUfoCheckTimer(); - void toyUfoFlyTo(int destX, int destY, int a3, int a4, int a5, int a6, int animationIndex); + void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); // Scene 41 int _s41_currKidSequenceId, _s41_nextKidSequenceId; -- cgit v1.2.3 From 37f84d0bc5626f9b5a406c79ff82ba566e88f4af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Mar 2016 00:30:18 +0100 Subject: GNAP: change 3rd parameter of removeSequence to boolean, adapt calls accordingly --- engines/gnap/gamesys.cpp | 16 ++++++++-------- engines/gnap/gamesys.h | 8 ++++---- engines/gnap/gnap.cpp | 5 ++--- engines/gnap/scenes/scene01.cpp | 2 +- engines/gnap/scenes/scene02.cpp | 2 +- engines/gnap/scenes/scene04.cpp | 4 ++-- engines/gnap/scenes/scene08.cpp | 6 +++--- engines/gnap/scenes/scene09.cpp | 2 +- engines/gnap/scenes/scene10.cpp | 2 +- engines/gnap/scenes/scene11.cpp | 4 ++-- engines/gnap/scenes/scene13.cpp | 2 +- engines/gnap/scenes/scene15.cpp | 8 ++++---- engines/gnap/scenes/scene18.cpp | 26 +++++++++++++------------- engines/gnap/scenes/scene28.cpp | 2 +- engines/gnap/scenes/scene30.cpp | 2 +- engines/gnap/scenes/scene33.cpp | 2 +- engines/gnap/scenes/scene38.cpp | 4 ++-- engines/gnap/scenes/scene43.cpp | 2 +- engines/gnap/scenes/scene44.cpp | 2 +- engines/gnap/scenes/scene51.cpp | 8 ++++---- engines/gnap/scenes/scene52.cpp | 12 ++++++------ 21 files changed, 60 insertions(+), 61 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 6e0260a2ce..0037574611 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -90,12 +90,12 @@ void GameSys::insertDirtyRect(const Common::Rect &rect) { _dirtyRects.push_back(rect); } -void GameSys::removeSequence(int sequenceId, int a2, int a3) { +void GameSys::removeSequence(int sequenceId, int id, bool resetFl) { //WaitForSingleObject(removeSequence2Mutex, INFINITE); if (_removeSequenceItemsCount < kMaxSequenceItems) { - _removeSequenceItems[_removeSequenceItemsCount].sequenceId = sequenceId; - _removeSequenceItems[_removeSequenceItemsCount].id = a2; - _removeSequenceItems[_removeSequenceItemsCount].a3 = a3; + _removeSequenceItems[_removeSequenceItemsCount]._sequenceId = sequenceId; + _removeSequenceItems[_removeSequenceItemsCount]._id = id; + _removeSequenceItems[_removeSequenceItemsCount]._forceFrameReset = resetFl; ++_removeSequenceItemsCount; //ResetEvent(removeSequenceItemsEvent); //ReleaseMutex(removeSequence2Mutex); @@ -964,16 +964,16 @@ void GameSys::handleReqRemoveSequenceItems() { if (_removeSequenceItemsCount > 0) { for (int i = 0; i < _removeSequenceItemsCount; ++i) { int gfxIndex; - if (seqFind(_removeSequenceItems[i].sequenceId, _removeSequenceItems[i].id, &gfxIndex)) + if (seqFind(_removeSequenceItems[i]._sequenceId, _removeSequenceItems[i]._id, &gfxIndex)) _seqItems.remove_at(gfxIndex); - seqLocateGfx(_removeSequenceItems[i].sequenceId, _removeSequenceItems[i].id, &gfxIndex); + seqLocateGfx(_removeSequenceItems[i]._sequenceId, _removeSequenceItems[i]._id, &gfxIndex); for (GfxItem *gfxItem = &_gfxItems[gfxIndex]; - gfxIndex < _gfxItemsCount && gfxItem->sequenceId == _removeSequenceItems[i].sequenceId && gfxItem->id == _removeSequenceItems[i].id; + gfxIndex < _gfxItemsCount && gfxItem->sequenceId == _removeSequenceItems[i]._sequenceId && gfxItem->id == _removeSequenceItems[i]._id; gfxItem = &_gfxItems[gfxIndex]) { gfxItem->sequenceId = -1; gfxItem->animation = 0; gfxItem->soundValue = 0; - if (_removeSequenceItems[i].a3) { + if (_removeSequenceItems[i]._forceFrameReset) { gfxItem->currFrame.duration = 0; gfxItem->currFrame.spriteId = -1; gfxItem->currFrame.soundId = -1; diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index 5e996bf844..5bf92b6f22 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -65,9 +65,9 @@ struct SpriteDrawItem { }; struct RemoveSequenceItem { - int sequenceId; - int id; - int a3; + int _sequenceId; + int _id; + bool _forceFrameReset; }; struct RemoveSpriteDrawItem { @@ -106,7 +106,7 @@ public: ~GameSys(); void insertSequence(int sequenceId, int a2, int sequenceId2, int a4, int flags, int totalDuration, int16 x, int16 y); void insertDirtyRect(const Common::Rect &rect); - void removeSequence(int sequenceId, int a2, int a3); + void removeSequence(int sequenceId, int id, bool resetFl); void invalidateGrabCursorSprite(int id, Common::Rect &rect, Graphics::Surface *surface1, Graphics::Surface *surface2); void requestClear2(int a1); void requestClear1(); diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 57fa625794..e31c78ee58 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -613,7 +613,7 @@ void GnapEngine::insertDeviceIconActive() { } void GnapEngine::removeDeviceIconActive() { - _gameSys->removeSequence(0x1084A, 21, 1); + _gameSys->removeSequence(0x1084A, 21, true); } void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int y2) { @@ -2337,8 +2337,6 @@ void GnapEngine::cutscene_run() { int duration = 0; bool skip = false; - int v1 = 0; - if (_prevSceneNum == 2) { soundId = 0x36B; duration = MAX(1, 300 / getSequenceTotalDuration(_s99_dword_47F370[_s99_itemsCount - 1]));//CHECKME @@ -2362,6 +2360,7 @@ void GnapEngine::cutscene_run() { _mouseClickState.left = false; + int v1 = 0; while (!_sceneDone) { gameUpdateTick(); diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 0e4695c619..e084a54c76 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -314,7 +314,7 @@ void GnapEngine::scene01_updateAnimations() { _gnapActionStatus = kASLookSpaceshipDone; break; case kASLookSpaceshipDone: - _gameSys->removeSequence(133, 256, 1); + _gameSys->removeSequence(133, 256, true); _gameSys->removeSpriteDrawItem(_s01_spaceshipSurface, 255); deleteSurface(&_s01_spaceshipSurface); _gnapActionStatus = -1; diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index 5d740b906f..d745b0927a 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -515,7 +515,7 @@ void GnapEngine::scene02_updateAnimations() { if (_s02_nextChickenSequenceId == 0x150) { _gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 0); _gameSys->insertSequence(_s02_nextChickenSequenceId, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(_s02_currChickenSequenceId, 179, 1); + _gameSys->removeSequence(_s02_currChickenSequenceId, 179, true); _s02_nextChickenSequenceId = -1; _s02_currChickenSequenceId = -1; _gnapActionStatus = kASGrabChickenDone; diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index bc5ee855d3..37ebe34839 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -507,8 +507,8 @@ void GnapEngine::scene04_updateAnimations() { _gnapActionStatus = kASGetKeyAnotherDone; break; case kASGetKeyAnotherDone: - _gameSys->removeSequence(0x1FF, 256, 1); - _gameSys->removeSequence(0x20A, 256, 1); + _gameSys->removeSequence(0x1FF, 256, true); + _gameSys->removeSequence(0x20A, 256, true); _gameSys->insertSequence(0x107B5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index a4ebf92c71..f7c0b9c886 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -475,17 +475,17 @@ void GnapEngine::scene08_updateAnimations() { case 0x149: setFlag(7); _hotspots[kHSMeat].flags = SF_DISABLED | SF_WALKABLE; - _gameSys->removeSequence(0x144, 1, 1); + _gameSys->removeSequence(0x144, 1, true); break; case 0x14A: setFlag(8); _hotspots[kHSBone].flags = SF_DISABLED | SF_WALKABLE; - _gameSys->removeSequence(0x145, 1, 1); + _gameSys->removeSequence(0x145, 1, true); break; case 0x14B: setFlag(9); _hotspots[kHSToy].flags = SF_DISABLED | SF_WALKABLE; - _gameSys->removeSequence(0x146, 1, 1); + _gameSys->removeSequence(0x146, 1, true); break; } _s08_currDogSequenceId = _s08_nextDogSequenceId; diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 4436d1e436..3654be55f4 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -218,7 +218,7 @@ void GnapEngine::scene09_updateAnimations() { case kASSearchTrash: _gameSys->setAnimation(0x4C, 120, 0); _gameSys->insertSequence(0x4C, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x4B, 2, 1); + _gameSys->removeSequence(0x4B, 2, true); _gnapSequenceId = 0x4C; _gnapId = 120; _gnapIdleFacing = 5; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index c6faf5a0ca..32162e2b21 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -392,7 +392,7 @@ void GnapEngine::scene10_updateAnimations() { _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, getSequenceTotalDuration(0x109) + getSequenceTotalDuration(0x10A) + getSequenceTotalDuration(0x10843), 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _gameSys->removeSequence(0x107, 100, 1); + _gameSys->removeSequence(0x107, 100, true); _s10_currCookSequenceId = 0x109; _s10_nextCookSequenceId = 0x843; _beaverSequenceId = 0x7C9; diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 6bbc542e90..3a112b9e9f 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -408,8 +408,8 @@ void GnapEngine::scene11_updateAnimations() { _gnapSequenceId = 0x1F4; _gnapId = 255; _gnapSequenceDatNum = 0; - _gameSys->removeSequence(0x207, 257, 1); - _gameSys->removeSequence(0x208, 256, 1); + _gameSys->removeSequence(0x207, 257, true); + _gameSys->removeSequence(0x208, 256, true); _s11_nextGoggleGuySequenceId = 0x1F8; _timers[5] = getRandom(100) + 75; _gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index c9b4d53917..729fdebf31 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -413,7 +413,7 @@ void GnapEngine::scene13_updateAnimations() { case kASGrabSink: _gameSys->setAnimation(0xAB, 160, 0); _gameSys->insertSequence(0xAB, 160, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0xAA, 256, 1); + _gameSys->removeSequence(0xAA, 256, true); _gnapSequenceId = 0xAB; _gnapId = 160; _gnapIdleFacing = 1; diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp index 54eb146fa5..578f4fcba1 100644 --- a/engines/gnap/scenes/scene15.cpp +++ b/engines/gnap/scenes/scene15.cpp @@ -284,11 +284,11 @@ void GnapEngine::scene15_updateAnimations() { case 0xD8: case 0xDA: if (_s15_currUpperButtonSequenceId != -1) { - _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, 1); + _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); _s15_currUpperButtonSequenceId = -1; } if (_s15_currLowerButtonSequenceId != -1) { - _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, 1); + _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); _s15_currLowerButtonSequenceId = -1; } break; @@ -303,9 +303,9 @@ void GnapEngine::scene15_updateAnimations() { _newSceneNum = 16; _isLeavingScene = true; } - _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, 1); + _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); _s15_currUpperButtonSequenceId = -1; - _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, 1); + _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); _s15_currLowerButtonSequenceId = -1; } else if (_s15_nextUpperButtonSequenceId != -1) { _gameSys->setAnimation(_s15_nextUpperButtonSequenceId, 1, 0); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 619d50f5e2..ff43a5d202 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -267,7 +267,7 @@ void GnapEngine::scene18_platEndPhoning(int a1) { while (_gameSys->getAnimationStatus(3) != 2) gameUpdateTick(); } - _gameSys->removeSequence(0x21F, 254, 1); + _gameSys->removeSequence(0x21F, 254, true); _gameSys->setAnimation(0, 0, 3); clearFlag(26); if (a1) { @@ -796,14 +796,14 @@ void GnapEngine::scene18_updateAnimations() { _gnapSequenceDatNum = 0; _gnapSequenceId = 0x1FD; } - _gameSys->removeSequence(0x1FA, 19, 1); + _gameSys->removeSequence(0x1FA, 19, true); setFlag(10); scene18_updateHotspots(); _gnapActionStatus = -1; break; case kASGrabGarbageCanFromHydrant: _gameSys->insertSequence(0x1FE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x1F9, 19, 1); + _gameSys->removeSequence(0x1F9, 19, true); _gnapSequenceDatNum = 0; _gnapSequenceId = 0x1FE; clearFlag(9); @@ -813,9 +813,9 @@ void GnapEngine::scene18_updateAnimations() { break; case kASCloseRightValveNoGarbageCan: _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x20D, 39, 1); - _gameSys->removeSequence(0x212, 39, 1); - _gameSys->removeSequence(0x211, 39, 1); + _gameSys->removeSequence(0x20D, 39, true); + _gameSys->removeSequence(0x212, 39, true); + _gameSys->removeSequence(0x211, 39, true); stopSound(0x22B); _gnapSequenceDatNum = 0; _gnapSequenceId = 0x205; @@ -840,7 +840,7 @@ void GnapEngine::scene18_updateAnimations() { setGrabCursorSprite(-1); _gameSys->insertSequence(0x208, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); - _gameSys->removeSequence(0x20C, 19, 1); + _gameSys->removeSequence(0x20C, 19, true); _gameSys->setAnimation(0x217, 39, 5); _gameSys->insertSequence(0x217, 39, 0x216, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) @@ -855,9 +855,9 @@ void GnapEngine::scene18_updateAnimations() { break; case kASCloseTopValve: _gameSys->insertSequence(0x206, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x20E, 39, 1); - _gameSys->removeSequence(0x216, 39, 1); - _gameSys->removeSequence(0x217, 39, 1); + _gameSys->removeSequence(0x20E, 39, true); + _gameSys->removeSequence(0x216, 39, true); + _gameSys->removeSequence(0x217, 39, true); stopSound(0x22B); _gnapSequenceDatNum = 0; _gnapSequenceId = 0x206; @@ -942,7 +942,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x207, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); _gameSys->requestRemoveSequence(0x1F9, 19); - _gameSys->removeSequence(0x20B, 19, 1); + _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x213, 39, 5); _gameSys->insertSequence(0x214, 39, 0x213, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) @@ -958,7 +958,7 @@ void GnapEngine::scene18_updateAnimations() { setGrabCursorSprite(-1); _gameSys->insertSequence(0x207, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); - _gameSys->removeSequence(0x20B, 19, 1); + _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x211, 39, 5); _gameSys->insertSequence(0x212, 39, 0x211, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) @@ -972,7 +972,7 @@ void GnapEngine::scene18_updateAnimations() { break; case kASCloseRightValveWithGarbageCan: _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x20D, 39, 1); + _gameSys->removeSequence(0x20D, 39, true); _gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); stopSound(0x22B); _gameSys->setAnimation(0x1F9, 19, 0); diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index b2b8455ad5..251e3b48f4 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -429,7 +429,7 @@ void GnapEngine::scene28_updateAnimations() { case 0x119: _gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _gameSys->removeSequence(_s28_currClownSequenceId, 39, 1); + _gameSys->removeSequence(_s28_currClownSequenceId, 39, true); _gnapActionStatus = kASGrabHornFailsDone; _gnapSequenceId = _s28_nextClownSequenceId; _gnapSequenceDatNum = 0; diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index f6ec96951c..85e6614f91 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -246,7 +246,7 @@ void GnapEngine::scene30_updateAnimations() { hideCursor(); setGrabCursorSprite(-1); addFullScreenSprite(0x3F, 255); - _gameSys->removeSequence(0x105, _gnapId, 1); + _gameSys->removeSequence(0x105, _gnapId, true); _gameSys->setAnimation(0x102, 256, 0); _gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); while (_gameSys->getAnimationStatus(0) != 2) diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index e8c232833b..fc66b15b65 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -307,7 +307,7 @@ void GnapEngine::scene33_updateAnimations() { if (_s33_nextChickenSequenceId == 0x81) { _gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 0); _gameSys->insertSequence(_s33_nextChickenSequenceId, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(_s33_currChickenSequenceId, 179, 1); + _gameSys->removeSequence(_s33_currChickenSequenceId, 179, true); _s33_nextChickenSequenceId = -1; _s33_currChickenSequenceId = -1; _gnapActionStatus = kASUseChickenDone; diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index 53768fe9ca..f807728bae 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -265,7 +265,7 @@ void GnapEngine::scene38_updateAnimations() { _sceneDone = true; break; case kASExitCave: - _gameSys->removeSequence(_beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, 1); + _gameSys->removeSequence(_beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, true); _gameSys->insertSequence(0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0xA3; _gnapSequenceDatNum = 0; @@ -273,7 +273,7 @@ void GnapEngine::scene38_updateAnimations() { _gnapActionStatus = kASLeaveScene; break; case kASUseHuntingTrophy: - _gameSys->removeSequence(0x9B, 0, 1); + _gameSys->removeSequence(0x9B, 0, true); _gameSys->insertSequence(0x9C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x9C; _gnapSequenceDatNum = 0; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 3510cb4d99..611e5c9bd3 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -438,7 +438,7 @@ void GnapEngine::scene43_updateAnimations() { break; case 6: _gameSys->insertSequence(0x10871, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x1086F, 1, 1); + _gameSys->removeSequence(0x1086F, 1, true); setFlag(14); scene43_updateHotspots(); toyUfoSetStatus(18); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index b2c711898c..27336950c6 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -462,7 +462,7 @@ void GnapEngine::scene44_updateAnimations() { _beaverSequenceId = 0xFE; _beaverSequenceDatNum = 0; _gameSys->setAnimation(0xFE, _beaverId, 1); - _gameSys->removeSequence(_s44_dword_47EB10, 1, 1); + _gameSys->removeSequence(_s44_dword_47EB10, 1, true); _beaverActionStatus = 5; } break; diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index 1313c1d2db..f56f9c96c4 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -323,7 +323,7 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { item->y = 0; } } else { - _gameSys->removeSequence(item->currSequenceId, item->id, 1); + _gameSys->removeSequence(item->currSequenceId, item->id, true); _gameSys->setAnimation(0, 0, index + 1); playSound(218, 0); if (scene51_incCashAmount(item->currSequenceId) == 1995) { @@ -370,7 +370,7 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { case 0xC2: // Bouncing coin and banknote _gameSys->setAnimation(0, 0, index + 1); - _gameSys->removeSequence(item->currSequenceId, item->id, 1); + _gameSys->removeSequence(item->currSequenceId, item->id, true); scene51_clearItem(item); break; @@ -393,7 +393,7 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { break; case 0xBC: - _gameSys->removeSequence(item->currSequenceId, item->id, 1); + _gameSys->removeSequence(item->currSequenceId, item->id, true); _gameSys->setAnimation(0, 0, index + 1); scene51_clearItem(item); break; @@ -414,7 +414,7 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { void GnapEngine::scene51_removeCollidedItems() { for (int i = 0; i < 6; ++i) { if (_s51_items[i].isCollision) { - _gameSys->removeSequence(_s51_items[i].currSequenceId, _s51_items[i].id, 1); + _gameSys->removeSequence(_s51_items[i].currSequenceId, _s51_items[i].id, true); _gameSys->setAnimation(0, 0, i + 1); scene51_clearItem(&_s51_items[i]); } diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index 62cc2f3728..02718ec467 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -175,7 +175,7 @@ void GnapEngine::scene52_fireShipCannon(int posX) { playSound(0x2D, 0); if (scene52_shipCannonHitShield(cannonNum)) { _gameSys->setAnimation(0, 0, cannonNum + 8); - _gameSys->removeSequence(0x23, cannonNum + 256, 1); + _gameSys->removeSequence(0x23, cannonNum + 256, true); } else { _s52_shipCannonFired = 1; _s52_shipCannonPosY -= 13; @@ -226,7 +226,7 @@ void GnapEngine::scene52_updateShipCannon() { if (_s52_shipCannonPosY - 13 >= 135) { if (scene52_updateHitAlien()) { _gameSys->setAnimation(0, 0, 8); - _gameSys->removeSequence(35, 256, 1); + _gameSys->removeSequence(35, 256, true); _s52_shipCannonFired = 0; scene52_drawScore(_s52_gameScore); } else { @@ -236,7 +236,7 @@ void GnapEngine::scene52_updateShipCannon() { } } else { _gameSys->setAnimation(0, 0, 8); - _gameSys->removeSequence(35, 256, 1); + _gameSys->removeSequence(35, 256, true); _s52_shipCannonFired = 0; } } @@ -340,7 +340,7 @@ void GnapEngine::scene52_updateAlienRow(int rowNum) { if (_s52_alienRowIds[rowNum] == -1) _s52_alienRowIds[rowNum] = i + 256; } else if (_s52_items[rowNum][i] == -2) { - _gameSys->removeSequence(_s52_alienRowKind[rowNum], i + 256, 1); + _gameSys->removeSequence(_s52_alienRowKind[rowNum], i + 256, true); _s52_items[rowNum][i] = -1; --_s52_alienSpeed; } @@ -638,7 +638,7 @@ int GnapEngine::scene52_shipCannonHitAlien() { void GnapEngine::scene52_shipExplode() { if (!_s52_aliensCount) { _gameSys->setAnimation(0, 0, 7); - _gameSys->removeSequence(_s52_ufoSequenceId, 256, 1); + _gameSys->removeSequence(_s52_ufoSequenceId, 256, true); playSound(44, 0); _gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_aliensCount = 1; @@ -656,7 +656,7 @@ int GnapEngine::scene52_checkAlienRow(int rowNum) { for (int j = 0; j < 5; ++j) if (_s52_items[rowNum][j] == -2) { - _gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, 1); + _gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, true); _s52_items[rowNum][j] = -1; --_s52_alienSpeed; v4 = 1; -- cgit v1.2.3 From ccadc0ab208c9de0c1b56a83c58b81e5002beb6a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Mar 2016 07:04:52 +0100 Subject: GNAP: Some renaming, change some function parameters to boolean --- engines/gnap/datarchive.cpp | 16 ++--- engines/gnap/datarchive.h | 12 ++-- engines/gnap/fontdata.h | 10 ++-- engines/gnap/gamesys.cpp | 143 ++++++++++++++++++++++---------------------- engines/gnap/gamesys.h | 34 +++++------ engines/gnap/gnap.cpp | 8 +-- engines/gnap/menu.cpp | 5 -- 7 files changed, 110 insertions(+), 118 deletions(-) diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp index d480d31e67..7f5dadfe9b 100644 --- a/engines/gnap/datarchive.cpp +++ b/engines/gnap/datarchive.cpp @@ -44,10 +44,10 @@ DatArchive::DatArchive(const char *filename) { _fd->skip(4); // Skip unknown _entries = new DatEntry[_entriesCount]; for (int i = 0; i < _entriesCount; ++i) { - _entries[i].ofs = _fd->readUint32LE(); - _entries[i].outSize1 = _fd->readUint32LE(); - _entries[i].type = _fd->readUint32LE(); - _entries[i].outSize2 = _fd->readUint32LE(); + _entries[i]._ofs = _fd->readUint32LE(); + _entries[i]._outSize1 = _fd->readUint32LE(); + _entries[i]._type = _fd->readUint32LE(); + _entries[i]._outSize2 = _fd->readUint32LE(); } } @@ -58,10 +58,10 @@ DatArchive::~DatArchive() { } byte *DatArchive::load(int index) { - _fd->seek(_entries[index].ofs); - debug(1, "_entries[index].outSize2: %d; _entries[index].outSize1: %d", _entries[index].outSize2, _entries[index].outSize1); - byte *buffer = new byte[_entries[index].outSize1]; - if (!Common::decompressDCL(_fd, buffer, 0, _entries[index].outSize1)) + _fd->seek(_entries[index]._ofs); + debug(1, "_entries[index].outSize2: %d; _entries[index].outSize1: %d", _entries[index]._outSize2, _entries[index]._outSize1); + byte *buffer = new byte[_entries[index]._outSize1]; + if (!Common::decompressDCL(_fd, buffer, 0, _entries[index]._outSize1)) error("DatArchive::load() Error during decompression of entry %d", index); return buffer; } diff --git a/engines/gnap/datarchive.h b/engines/gnap/datarchive.h index 2fd431bf70..28664fea5c 100644 --- a/engines/gnap/datarchive.h +++ b/engines/gnap/datarchive.h @@ -36,10 +36,10 @@ namespace Gnap { struct DatEntry { - uint32 ofs; - uint32 outSize1; - uint32 type; - uint32 outSize2; + uint32 _ofs; + uint32 _outSize1; + uint32 _type; + uint32 _outSize2; }; class DatArchive { @@ -48,8 +48,8 @@ public: ~DatArchive(); byte *load(int index); int getCount() const { return _entriesCount; } - uint32 getEntryType(int index) { return _entries[index].type; } - uint32 getEntrySize(int index) { return _entries[index].outSize1; } + uint32 getEntryType(int index) { return _entries[index]._type; } + uint32 getEntrySize(int index) { return _entries[index]._outSize1; } protected: Common::File *_fd; int _entriesCount; diff --git a/engines/gnap/fontdata.h b/engines/gnap/fontdata.h index 9ad0d23ae8..bb87638255 100644 --- a/engines/gnap/fontdata.h +++ b/engines/gnap/fontdata.h @@ -26,8 +26,8 @@ namespace Gnap { struct FONT_CHAR_INFO { - const byte width; // width, in bits (or pixels), of the character - const uint16 offset; // offset of the character's bitmap, in bytes, into the the FONT_INFO's data array + const byte _width; // width, in bits (or pixels), of the character + const uint16 _offset; // offset of the character's bitmap, in bytes, into the the FONT_INFO's data array }; /* @@ -35,8 +35,7 @@ struct FONT_CHAR_INFO { */ /* Character bitmaps for DejaVu Sans 9pt */ -const byte dejaVuSans9ptCharBitmaps[] = -{ +const byte _dejaVuSans9ptCharBitmaps[] = { /* @0 ' ' (5 pixels wide) */ 0x00, 0x00, /* */ 0x00, 0x00, /* */ @@ -747,8 +746,7 @@ const byte dejaVuSans9ptCharBitmaps[] = /* Character descriptors for DejaVu Sans 9pt */ /* { [Char width in bits], [Offset into dejaVuSans9ptCharBitmaps in bytes] } */ -const FONT_CHAR_INFO dejaVuSans9ptCharDescriptors[] = -{ +const FONT_CHAR_INFO _dejaVuSans9ptCharDescriptors[] = { {5, 0}, /* */ {1, 10}, /* ! */ {3, 12}, /* " */ diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 0037574611..ff60980158 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -75,14 +75,14 @@ void GameSys::insertSequence(int sequenceId, int a2, int sequenceId2, int a4, in Sequence sequence; SequenceResource *sequenceResource = _vm->_sequenceCache->get(sequenceId); sequenceResource->_sequenceId = sequenceId; - sequence.sequenceId = sequenceId; - sequence.id = a2 != -1 ? a2 : sequenceResource->_field_8; - sequence.sequenceId2 = sequenceId2 != (int32)0x80000000 ? sequenceId2 : sequenceResource->_sequenceId2; - sequence.id2 = a4 != -1 ? a4 : sequenceResource->_field_10; - sequence.flags = flags != -1 ? flags : sequenceResource->_flags; - sequence.totalDuration = totalDuration != -1 ? totalDuration : sequenceResource->_totalDuration; - sequence.x = (x < 10000 && x > -10000) ? x : sequenceResource->_xOffs; - sequence.y = (y < 10000 && y > -10000) ? y : sequenceResource->_yOffs; + sequence._sequenceId = sequenceId; + sequence._id = a2 != -1 ? a2 : sequenceResource->_field_8; + sequence._sequenceId2 = sequenceId2 != (int32)0x80000000 ? sequenceId2 : sequenceResource->_sequenceId2; + sequence._id2 = a4 != -1 ? a4 : sequenceResource->_field_10; + sequence._flags = flags != -1 ? flags : sequenceResource->_flags; + sequence._totalDuration = totalDuration != -1 ? totalDuration : sequenceResource->_totalDuration; + sequence._x = (x < 10000 && x > -10000) ? x : sequenceResource->_xOffs; + sequence._y = (y < 10000 && y > -10000) ? y : sequenceResource->_yOffs; _fatSequenceItems.push_back(sequence); } @@ -115,7 +115,7 @@ void GameSys::invalidateGrabCursorSprite(int id, Common::Rect &rect, Graphics::S //WaitForSingleObject(grabSpriteEvent, INFINITE); } -void GameSys::requestClear2(int a1) { +void GameSys::requestClear2(bool resetFl) { _fatSequenceItems.clear(); _seqItems.clear(); for (int i = 0; i < _gfxItemsCount; ++i) { @@ -123,7 +123,7 @@ void GameSys::requestClear2(int a1) { gfxItem->sequenceId = -1; gfxItem->animation = 0; gfxItem->soundValue = 0; - if (a1) { + if (resetFl) { gfxItem->currFrame.duration = 0; gfxItem->currFrame.spriteId = -1; gfxItem->currFrame.soundId = -1; @@ -145,13 +145,13 @@ void GameSys::requestClear1() { _gameSysClock = 0; } -void GameSys::requestRemoveSequence(int sequenceId, int a2) { +void GameSys::requestRemoveSequence(int sequenceId, int id) { //WaitForSingleObject(removeSequence2Mutex, INFINITE); _reqRemoveSequenceItem = true; _removeSequenceItemSequenceId = sequenceId; - _removeSequenceItemValue = a2; + _removeSequenceItemValue = id; - handleReqRemoveSequenceItem();//CHECKME? + handleReqRemoveSequenceItem(); //CHECKME? //ResetEvent(reqClearEvent); //ReleaseMutex(removeSequence2Mutex); @@ -163,9 +163,9 @@ void GameSys::waitForUpdate() { //WaitForSingleObject(updateEvent, INFINITE); } -int GameSys::isSequenceActive(int sequenceId, int a2) { +int GameSys::isSequenceActive(int sequenceId, int id) { for (uint i = 0; i < _seqItems.size(); ++i) - if (_seqItems[i].sequenceId == sequenceId && _seqItems[i].id == a2) + if (_seqItems[i]._sequenceId == sequenceId && _seqItems[i]._id == id) return true; return false; } @@ -212,16 +212,16 @@ void GameSys::setScaleValues(int a1, int a2, int a3, int a4) { void GameSys::insertSpriteDrawItem(Graphics::Surface *surface, int x, int y, int id) { if (surface && _newSpriteDrawItemsCount < kMaxSpriteDrawItems) { - _newSpriteDrawItems[_newSpriteDrawItemsCount].id = id; - _newSpriteDrawItems[_newSpriteDrawItemsCount].rect = Common::Rect(x, y, x + surface->w, y + surface->h); - _newSpriteDrawItems[_newSpriteDrawItemsCount].surface = surface; + _newSpriteDrawItems[_newSpriteDrawItemsCount]._id = id; + _newSpriteDrawItems[_newSpriteDrawItemsCount]._rect = Common::Rect(x, y, x + surface->w, y + surface->h); + _newSpriteDrawItems[_newSpriteDrawItemsCount]._surface = surface; ++_newSpriteDrawItemsCount; } } -void GameSys::removeSpriteDrawItem(Graphics::Surface *surface, int a2) { +void GameSys::removeSpriteDrawItem(Graphics::Surface *surface, int id) { if (surface && _removeSpriteDrawItemsCount < kMaxSpriteDrawItems) { - _removeSpriteDrawItems[_removeSpriteDrawItemsCount].id = a2; + _removeSpriteDrawItems[_removeSpriteDrawItemsCount]._id = id; _removeSpriteDrawItems[_removeSpriteDrawItemsCount].surface = surface; ++_removeSpriteDrawItemsCount; } @@ -288,8 +288,8 @@ void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r if (c < 32 || c > 127) c = (byte)'_'; c -= 32; - int w = dejaVuSans9ptCharDescriptors[c].width; - const byte *data = dejaVuSans9ptCharBitmaps + dejaVuSans9ptCharDescriptors[c].offset; + int w = _dejaVuSans9ptCharDescriptors[c]._width; + const byte *data = _dejaVuSans9ptCharBitmaps + _dejaVuSans9ptCharDescriptors[c]._offset; for (int xc = 0; xc < w; ++xc) { for (int yc = 15; yc >= 0; --yc) { byte *dst = (byte*)surface->getBasePtr(x + xc, y + yc); @@ -314,7 +314,7 @@ int GameSys::getTextWidth(const char *text) { if (c < 32 || c > 127) c = (byte)'_'; c -= 32; - width += dejaVuSans9ptCharDescriptors[c].width + 1; + width += _dejaVuSans9ptCharDescriptors[c]._width + 1; } return width; } @@ -400,9 +400,9 @@ void GameSys::drawBitmap(int resourceId) { insertDirtyRect(Common::Rect(0, 0, 800, 600)); } -Sequence *GameSys::seqFind(int sequenceId, int a2, int *outIndex) { +Sequence *GameSys::seqFind(int sequenceId, int id, int *outIndex) { for (uint i = 0; i < _seqItems.size(); ++i) - if (_seqItems[i].sequenceId == sequenceId && _seqItems[i].id == a2) { + if (_seqItems[i]._sequenceId == sequenceId && _seqItems[i]._id == id) { if (outIndex) *outIndex = i; return &_seqItems[i]; @@ -430,15 +430,14 @@ int GameSys::seqLocateGfx(int sequenceId, int id, int *outGfxIndex) { } void GameSys::seqInsertGfx(int index, int duration) { - Sequence *seqItem = &_seqItems[index]; - SequenceResource *sequenceResource = _vm->_sequenceCache->get(seqItem->sequenceId); + SequenceResource *sequenceResource = _vm->_sequenceCache->get(seqItem->_sequenceId); if (sequenceResource->_animationsCount > 50 - _gfxItemsCount) return; int gfxIndex; - seqLocateGfx(seqItem->sequenceId, seqItem->id, &gfxIndex); + seqLocateGfx(seqItem->_sequenceId, seqItem->_id, &gfxIndex); if (gfxIndex != _gfxItemsCount) memcpy(&_gfxItems[gfxIndex + sequenceResource->_animationsCount], &_gfxItems[gfxIndex], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); @@ -449,14 +448,14 @@ void GameSys::seqInsertGfx(int index, int duration) { GfxItem *gfxItem = &_gfxItems[i + gfxIndex]; SequenceAnimation *animation = &sequenceResource->_animations[i]; - debug(0, "GameSys::seqInsertGfx() seqItem->sequenceId: %08X", seqItem->sequenceId); + debug(0, "GameSys::seqInsertGfx() seqItem->sequenceId: %08X", seqItem->_sequenceId); - gfxItem->sequenceId = seqItem->sequenceId; - gfxItem->id = seqItem->id; + gfxItem->sequenceId = seqItem->_sequenceId; + gfxItem->id = seqItem->_id; gfxItem->animation = animation; gfxItem->currFrameNum = 0; gfxItem->flags = 0; - gfxItem->delayTicks = seqItem->totalDuration + animation->field_4; + gfxItem->delayTicks = seqItem->_totalDuration + animation->field_4; gfxItem->updFlag = false; gfxItem->updRectsCount = 0; gfxItem->prevFrame.duration = 0; @@ -464,7 +463,7 @@ void GameSys::seqInsertGfx(int index, int duration) { gfxItem->prevFrame.soundId = -1; gfxItem->prevFrame.unkValue = -1; totalDuration = duration; - if ((seqItem->flags & 4) && totalDuration > 0) { + if ((seqItem->_flags & 4) && totalDuration > 0) { gfxItem->prevFrame.duration = 1; if (gfxItem->delayTicks <= totalDuration) gfxItem->delayTicks = 0; @@ -484,15 +483,15 @@ void GameSys::seqInsertGfx(int index, int duration) { gfxItem->currFrame = animation->frames[j++]; else gfxItem->currFrame = animation->frames[j - 1]; - if (gfxItem->currFrame.spriteId != -1 && (seqItem->x != 0 || seqItem->y != 0)) - gfxItem->currFrame.rect.translate(seqItem->x, seqItem->y); + if (gfxItem->currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) + gfxItem->currFrame.rect.translate(seqItem->_x, seqItem->_y); // Update sprite scaling - if ((seqItem->flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { - int v2 = _backgroundImageValue2 + (gfxItem->currFrame.rect.bottom - _backgroundImageValue1) * + if ((seqItem->_flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { + int scaleValue = _backgroundImageValue2 + (gfxItem->currFrame.rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / (_backgroundImageValue3 - _backgroundImageValue1); - gfxItem->currFrame.rect.top = gfxItem->currFrame.rect.bottom - v2 * (gfxItem->currFrame.rect.bottom - gfxItem->currFrame.rect.top) / 1000; - gfxItem->currFrame.rect.right = v2 * (gfxItem->currFrame.rect.right - gfxItem->currFrame.rect.left) / 1000 + gfxItem->currFrame.rect.left; + gfxItem->currFrame.rect.top = gfxItem->currFrame.rect.bottom - scaleValue * (gfxItem->currFrame.rect.bottom - gfxItem->currFrame.rect.top) / 1000; + gfxItem->currFrame.rect.right = scaleValue * (gfxItem->currFrame.rect.right - gfxItem->currFrame.rect.left) / 1000 + gfxItem->currFrame.rect.left; gfxItem->currFrame.isScaled = 1; } gfxItem->currFrame.duration -= totalDuration; @@ -507,7 +506,7 @@ void GameSys::seqInsertGfx(int index, int duration) { } for (int k = 0; k < kMaxAnimations; ++k) { - if (_animations[k].sequenceId != -1 && _animations[k].sequenceId == seqItem->sequenceId && _animations[k].id == seqItem->id) { + if (_animations[k].sequenceId != -1 && _animations[k].sequenceId == seqItem->_sequenceId && _animations[k].id == seqItem->_id) { _animations[k].status = 1; break; } @@ -569,12 +568,12 @@ bool GameSys::updateSequenceDuration(int sequenceId, int id, int *outDuration) { return found; } -void GameSys::updateAnimationsStatus(int sequenceId, int a2) { +void GameSys::updateAnimationsStatus(int sequenceId, int id) { Animation *foundAnimation = 0; for (int animationIndex = 0; animationIndex < kMaxAnimations; ++animationIndex) { Animation *animation = &_animations[animationIndex]; - if (animation->sequenceId != -1 && animation->sequenceId == sequenceId && animation->id == a2) { + if (animation->sequenceId != -1 && animation->sequenceId == sequenceId && animation->id == id) { foundAnimation = animation; break; } @@ -587,7 +586,7 @@ void GameSys::updateAnimationsStatus(int sequenceId, int a2) { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; SequenceAnimation *animation = gfxItem->animation; - if (gfxItem->sequenceId == sequenceId && gfxItem->id == a2 && animation) { + if (gfxItem->sequenceId == sequenceId && gfxItem->id == id && animation) { foundSequence = true; if (animation->framesCount > gfxItem->currFrameNum || (gfxItem->updFlag && gfxItem->currFrame.duration > 1) || @@ -995,7 +994,7 @@ void GameSys::handleReqRemoveSpriteDrawItems() { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; if (gfxItem->sequenceId == -1 && !gfxItem->animation && (gfxItem->flags & 1) && - gfxItem->id == _removeSpriteDrawItems[j].id && _removeSpriteDrawItems[j].surface == gfxItem->surface) { + gfxItem->id == _removeSpriteDrawItems[j]._id && _removeSpriteDrawItems[j].surface == gfxItem->surface) { gfxItem->flags = 0; gfxItem->currFrame.duration = 0; gfxItem->currFrame.spriteId = -1; @@ -1054,7 +1053,7 @@ void GameSys::fatUpdateFrame() { gfxItem->currFrame.soundId = -1; gfxItem->currFrame.unkValue = -1; gfxItem->updFlag = true; - } else if ((seqItem->flags & 4) && clockDelta > 1) { + } else if ((seqItem->_flags & 4) && clockDelta > 1) { updFlag = false; if (gfxItem->delayTicks < clockDelta) { duration = clockDelta - gfxItem->delayTicks; @@ -1093,10 +1092,10 @@ void GameSys::fatUpdateFrame() { gfxItem->currFrame = animation->frames[currFrameNum++]; else gfxItem->currFrame = animation->frames[currFrameNum - 1]; - if (gfxItem->currFrame.spriteId != -1 && (seqItem->x != 0 || seqItem->y != 0)) - gfxItem->currFrame.rect.translate(seqItem->x, seqItem->y); + if (gfxItem->currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) + gfxItem->currFrame.rect.translate(seqItem->_x, seqItem->_y); // Update sprite scaling - if ((seqItem->flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { + if ((seqItem->_flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { int v17 = _backgroundImageValue2 + (gfxItem->currFrame.rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / (_backgroundImageValue3 - _backgroundImageValue1); @@ -1141,28 +1140,28 @@ void GameSys::fatUpdateFrame() { for (int k = 0; k < _newSpriteDrawItemsCount; ++k) { if (_gfxItemsCount < 50) { int insertIndex; - seqLocateGfx(-1, _newSpriteDrawItems[k].id, &insertIndex); + seqLocateGfx(-1, _newSpriteDrawItems[k]._id, &insertIndex); if (_gfxItemsCount != insertIndex) memcpy(&_gfxItems[insertIndex + 1], &_gfxItems[insertIndex], sizeof(GfxItem) * (_gfxItemsCount - insertIndex)); ++_gfxItemsCount; GfxItem *gfxItem = &_gfxItems[insertIndex]; gfxItem->sequenceId = -1; - gfxItem->id = _newSpriteDrawItems[k].id; + gfxItem->id = _newSpriteDrawItems[k]._id; gfxItem->animation = 0; gfxItem->currFrameNum = 0; gfxItem->flags = 1; gfxItem->delayTicks = 0; gfxItem->updFlag = true; gfxItem->updRectsCount = 0; - gfxItem->surface = _newSpriteDrawItems[k].surface; + gfxItem->surface = _newSpriteDrawItems[k]._surface; gfxItem->prevFrame.duration = 0; gfxItem->prevFrame.spriteId = -1; gfxItem->prevFrame.soundId = -1; gfxItem->prevFrame.unkValue = -1; gfxItem->currFrame.duration = 0; gfxItem->currFrame.isScaled = 0; - gfxItem->currFrame.rect = _newSpriteDrawItems[k].rect; - gfxItem->currFrame.spriteId = _newSpriteDrawItems[k].surface ? 0xCAFEBABE : -1;// TODO + gfxItem->currFrame.rect = _newSpriteDrawItems[k]._rect; + gfxItem->currFrame.spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO gfxItem->currFrame.soundId = -1; gfxItem->currFrame.unkValue = -1; } @@ -1195,14 +1194,14 @@ void GameSys::fatUpdateFrame() { for (uint i = 0; i < _fatSequenceItems.size(); ++i) { Sequence *seqItem = &_fatSequenceItems[i]; - if (((seqItem->flags & 8) || (seqItem->flags & 0x20)) && seqItem->sequenceId2 != -1) { + if (((seqItem->_flags & 8) || (seqItem->_flags & 0x20)) && seqItem->_sequenceId2 != -1) { duration = 0; - if (((seqItem->flags & 0x20) && seqLocateGfx(seqItem->sequenceId2, seqItem->id2, 0)) || - updateSequenceDuration(seqItem->sequenceId2, seqItem->id2, &duration)) { - int index; + if (((seqItem->_flags & 0x20) && seqLocateGfx(seqItem->_sequenceId2, seqItem->_id2, 0)) || + updateSequenceDuration(seqItem->_sequenceId2, seqItem->_id2, &duration)) { + int index = -1; bool found = false; - if (seqItem->sequenceId2 == seqItem->sequenceId && seqItem->id == seqItem->id2 && - seqFind(seqItem->sequenceId, seqItem->id, &index)) { + if (seqItem->_sequenceId2 == seqItem->_sequenceId && seqItem->_id == seqItem->_id2 && + seqFind(seqItem->_sequenceId, seqItem->_id, &index)) { _seqItems[index] = *seqItem; found = true; } else if (_seqItems.size() < 50) { @@ -1212,8 +1211,8 @@ void GameSys::fatUpdateFrame() { } if (found) { updFlag = false; - seqRemoveGfx(seqItem->sequenceId2, seqItem->id2); - seqRemoveGfx(seqItem->sequenceId, seqItem->id); + seqRemoveGfx(seqItem->_sequenceId2, seqItem->_id2); + seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); _fatSequenceItems.remove_at(i); --i; seqInsertGfx(index, duration); @@ -1221,12 +1220,12 @@ void GameSys::fatUpdateFrame() { } } else { updFlag = false; - if (seqItem->totalDuration < clockDelta) { + if (seqItem->_totalDuration < clockDelta) { int index; bool found = false; - duration = clockDelta - seqItem->totalDuration; - seqItem->totalDuration = 0; - if (seqFind(seqItem->sequenceId, seqItem->id, &index)) { + duration = clockDelta - seqItem->_totalDuration; + seqItem->_totalDuration = 0; + if (seqFind(seqItem->_sequenceId, seqItem->_id, &index)) { _seqItems[index] = *seqItem; found = true; } else if (_seqItems.size() < 50) { @@ -1235,13 +1234,13 @@ void GameSys::fatUpdateFrame() { found = true; } if (found) { - seqRemoveGfx(seqItem->sequenceId, seqItem->id); + seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); _fatSequenceItems.remove_at(i); --i; seqInsertGfx(index, duration - 1); } } else { - seqItem->totalDuration -= clockDelta; + seqItem->_totalDuration -= clockDelta; } } } @@ -1250,13 +1249,13 @@ void GameSys::fatUpdateFrame() { for (uint i = 0; i < _seqItems.size(); ++i) { Sequence *seqItem = &_seqItems[i]; - if (seqLocateGfx(seqItem->sequenceId, seqItem->id, 0)) { - updateAnimationsStatus(seqItem->sequenceId, seqItem->id); - if (seqItem->flags & 2) { + if (seqLocateGfx(seqItem->_sequenceId, seqItem->_id, 0)) { + updateAnimationsStatus(seqItem->_sequenceId, seqItem->_id); + if (seqItem->_flags & 2) { int gfxDuration; updFlag = false; - if (updateSequenceDuration(seqItem->sequenceId, seqItem->id, &gfxDuration)) { - seqRemoveGfx(seqItem->sequenceId, seqItem->id); + if (updateSequenceDuration(seqItem->_sequenceId, seqItem->_id, &gfxDuration)) { + seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); seqInsertGfx(i, gfxDuration); } } diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index 5bf92b6f22..76b2afe464 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -49,19 +49,19 @@ enum { }; struct Sequence { - int32 sequenceId; - int32 id; - int32 sequenceId2; - int32 id2; - uint32 flags; - int32 totalDuration; - int16 x, y; + int32 _sequenceId; + int32 _id; + int32 _sequenceId2; + int32 _id2; + uint32 _flags; + int32 _totalDuration; + int16 _x, _y; }; struct SpriteDrawItem { - int id; - Common::Rect rect; - Graphics::Surface *surface; + int _id; + Common::Rect _rect; + Graphics::Surface *_surface; }; struct RemoveSequenceItem { @@ -71,7 +71,7 @@ struct RemoveSequenceItem { }; struct RemoveSpriteDrawItem { - int id; + int _id; Graphics::Surface *surface; }; @@ -108,15 +108,15 @@ public: void insertDirtyRect(const Common::Rect &rect); void removeSequence(int sequenceId, int id, bool resetFl); void invalidateGrabCursorSprite(int id, Common::Rect &rect, Graphics::Surface *surface1, Graphics::Surface *surface2); - void requestClear2(int a1); + void requestClear2(bool resetFl); void requestClear1(); - void requestRemoveSequence(int sequenceId, int a2); + void requestRemoveSequence(int sequenceId, int id); void waitForUpdate(); - int isSequenceActive(int sequenceId, int a2); + int isSequenceActive(int sequenceId, int id); void setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, int a6, int a7); void setScaleValues(int a1, int a2, int a3, int a4); void insertSpriteDrawItem(Graphics::Surface *surface, int x, int y, int id); - void removeSpriteDrawItem(Graphics::Surface *surface, int a2); + void removeSpriteDrawItem(Graphics::Surface *surface, int id); void drawSpriteToBackground(int x, int y, int resourceId); Graphics::Surface *allocSurface(int width, int height); Graphics::Surface *createSurface(int resourceId); @@ -177,12 +177,12 @@ public: Graphics::Surface *_frontSurface; Common::Rect _screenRect; - Sequence *seqFind(int sequenceId, int a2, int *outIndex); + Sequence *seqFind(int sequenceId, int id, int *outIndex); int seqLocateGfx(int sequenceId, int id, int *outGfxIndex); void seqInsertGfx(int index, int duration); void seqRemoveGfx(int sequenceId, int id); bool updateSequenceDuration(int sequenceId, int id, int *outDuration); - void updateAnimationsStatus(int sequenceId, int a2); + void updateAnimationsStatus(int sequenceId, int id); void restoreBackgroundRect(const Common::Rect &rect); diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e31c78ee58..a46b4c6cce 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -869,11 +869,11 @@ void GnapEngine::afterScene() { setGrabCursorSprite(-1); - _gameSys->requestClear2(0); + _gameSys->requestClear2(false); _gameSys->requestClear1(); _gameSys->waitForUpdate(); - _gameSys->requestClear2(0); + _gameSys->requestClear2(false); _gameSys->requestClear1(); _gameSys->waitForUpdate(); @@ -2366,8 +2366,8 @@ void GnapEngine::cutscene_run() { gameUpdateTick(); if (_gameSys->getAnimationStatus(0) == 2 || skip) { - skip = 0; - _gameSys->requestClear2(0); + skip = false; + _gameSys->requestClear2(false); _gameSys->requestClear1(); _gameSys->setAnimation(0, 0, 0); v1 += _s99_dword_47F330[itemIndex++]; diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index e6fc073c53..0b63ce110e 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -255,9 +255,6 @@ void GnapEngine::removeInventorySprites() { } void GnapEngine::runMenu() { - - int v43; - _spriteHandle = 0; _cursorSprite = 0; _menuSprite1 = 0; @@ -277,8 +274,6 @@ void GnapEngine::runMenu() { _savegameSprites[i] = 0; } - v43 = 0; - if (_menuStatus == 0) { invAdd(kItemMagazine); setGrabCursorSprite(-1); -- cgit v1.2.3 From da2cb981d2d5a71fc9db04404569bfcc92fbfcf3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Mar 2016 07:21:37 +0100 Subject: GNAP: Some renaming, remove useless variables in GfxItem --- engines/gnap/gamesys.cpp | 448 +++++++++++++++++++++++------------------------ engines/gnap/gamesys.h | 29 ++- 2 files changed, 236 insertions(+), 241 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index ff60980158..9909139ecf 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -30,9 +30,9 @@ namespace Gnap { void GfxItem::testUpdRect(const Common::Rect &updRect) { Common::Rect intersectingRect; - if (!updFlag && prevFrame.spriteId != -1 && - updRectsCount < 20 && intersectRect(intersectingRect, prevFrame.rect, updRect)) - updRects[updRectsCount++] = intersectingRect; + if (!_updFlag && _prevFrame.spriteId != -1 && + _updRectsCount < 20 && intersectRect(intersectingRect, _prevFrame.rect, updRect)) + _updRects[_updRectsCount++] = intersectingRect; } // GameSys @@ -120,17 +120,16 @@ void GameSys::requestClear2(bool resetFl) { _seqItems.clear(); for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - gfxItem->sequenceId = -1; - gfxItem->animation = 0; - gfxItem->soundValue = 0; + gfxItem->_sequenceId = -1; + gfxItem->_animation = nullptr; if (resetFl) { - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.spriteId = -1; - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; - gfxItem->updFlag = true; + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.spriteId = -1; + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; + gfxItem->_updFlag = true; } else { - gfxItem->updFlag = false; + gfxItem->_updFlag = false; } } _lastUpdateClock = 0; @@ -222,7 +221,7 @@ void GameSys::insertSpriteDrawItem(Graphics::Surface *surface, int x, int y, int void GameSys::removeSpriteDrawItem(Graphics::Surface *surface, int id) { if (surface && _removeSpriteDrawItemsCount < kMaxSpriteDrawItems) { _removeSpriteDrawItems[_removeSpriteDrawItemsCount]._id = id; - _removeSpriteDrawItems[_removeSpriteDrawItemsCount].surface = surface; + _removeSpriteDrawItems[_removeSpriteDrawItemsCount]._surface = surface; ++_removeSpriteDrawItemsCount; } } @@ -413,12 +412,12 @@ Sequence *GameSys::seqFind(int sequenceId, int id, int *outIndex) { int GameSys::seqLocateGfx(int sequenceId, int id, int *outGfxIndex) { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - if (gfxItem->sequenceId == sequenceId && gfxItem->id == id) { + if (gfxItem->_sequenceId == sequenceId && gfxItem->_id == id) { if (outGfxIndex) *outGfxIndex = i; - return gfxItem->sequenceId; + return gfxItem->_sequenceId; } - if (gfxItem->id > id) { + if (gfxItem->_id > id) { if (outGfxIndex) *outGfxIndex = i; return 0; @@ -450,58 +449,58 @@ void GameSys::seqInsertGfx(int index, int duration) { debug(0, "GameSys::seqInsertGfx() seqItem->sequenceId: %08X", seqItem->_sequenceId); - gfxItem->sequenceId = seqItem->_sequenceId; - gfxItem->id = seqItem->_id; - gfxItem->animation = animation; - gfxItem->currFrameNum = 0; - gfxItem->flags = 0; - gfxItem->delayTicks = seqItem->_totalDuration + animation->field_4; - gfxItem->updFlag = false; - gfxItem->updRectsCount = 0; - gfxItem->prevFrame.duration = 0; - gfxItem->prevFrame.spriteId = -1; - gfxItem->prevFrame.soundId = -1; - gfxItem->prevFrame.unkValue = -1; + gfxItem->_sequenceId = seqItem->_sequenceId; + gfxItem->_id = seqItem->_id; + gfxItem->_animation = animation; + gfxItem->_currFrameNum = 0; + gfxItem->_flags = 0; + gfxItem->_delayTicks = seqItem->_totalDuration + animation->field_4; + gfxItem->_updFlag = false; + gfxItem->_updRectsCount = 0; + gfxItem->_prevFrame.duration = 0; + gfxItem->_prevFrame.spriteId = -1; + gfxItem->_prevFrame.soundId = -1; + gfxItem->_prevFrame.unkValue = -1; totalDuration = duration; if ((seqItem->_flags & 4) && totalDuration > 0) { - gfxItem->prevFrame.duration = 1; - if (gfxItem->delayTicks <= totalDuration) - gfxItem->delayTicks = 0; + gfxItem->_prevFrame.duration = 1; + if (gfxItem->_delayTicks <= totalDuration) + gfxItem->_delayTicks = 0; else - gfxItem->delayTicks -= totalDuration + 1; - gfxItem->updFlag = false; - } else if (gfxItem->delayTicks <= totalDuration) { + gfxItem->_delayTicks -= totalDuration + 1; + gfxItem->_updFlag = false; + } else if (gfxItem->_delayTicks <= totalDuration) { int j; - totalDuration -= gfxItem->delayTicks; - gfxItem->delayTicks = 0; - for (j = gfxItem->currFrameNum; j < animation->framesCount && animation->frames[j].duration <= totalDuration; ++j) { + totalDuration -= gfxItem->_delayTicks; + gfxItem->_delayTicks = 0; + for (j = gfxItem->_currFrameNum; j < animation->framesCount && animation->frames[j].duration <= totalDuration; ++j) { if (animation->frames[j].soundId != -1) - _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | animation->frames[j].soundId); + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[j].soundId); totalDuration -= animation->frames[j].duration; } if (animation->framesCount > j) - gfxItem->currFrame = animation->frames[j++]; + gfxItem->_currFrame = animation->frames[j++]; else - gfxItem->currFrame = animation->frames[j - 1]; - if (gfxItem->currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) - gfxItem->currFrame.rect.translate(seqItem->_x, seqItem->_y); + gfxItem->_currFrame = animation->frames[j - 1]; + if (gfxItem->_currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) + gfxItem->_currFrame.rect.translate(seqItem->_x, seqItem->_y); // Update sprite scaling - if ((seqItem->_flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { - int scaleValue = _backgroundImageValue2 + (gfxItem->currFrame.rect.bottom - _backgroundImageValue1) * + if ((seqItem->_flags & 1) && gfxItem->_currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame.rect.bottom <= _backgroundImageValue3) { + int scaleValue = _backgroundImageValue2 + (gfxItem->_currFrame.rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / (_backgroundImageValue3 - _backgroundImageValue1); - gfxItem->currFrame.rect.top = gfxItem->currFrame.rect.bottom - scaleValue * (gfxItem->currFrame.rect.bottom - gfxItem->currFrame.rect.top) / 1000; - gfxItem->currFrame.rect.right = scaleValue * (gfxItem->currFrame.rect.right - gfxItem->currFrame.rect.left) / 1000 + gfxItem->currFrame.rect.left; - gfxItem->currFrame.isScaled = 1; + gfxItem->_currFrame.rect.top = gfxItem->_currFrame.rect.bottom - scaleValue * (gfxItem->_currFrame.rect.bottom - gfxItem->_currFrame.rect.top) / 1000; + gfxItem->_currFrame.rect.right = scaleValue * (gfxItem->_currFrame.rect.right - gfxItem->_currFrame.rect.left) / 1000 + gfxItem->_currFrame.rect.left; + gfxItem->_currFrame.isScaled = 1; } - gfxItem->currFrame.duration -= totalDuration; - if (gfxItem->currFrame.soundId != -1) - _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | gfxItem->currFrame.soundId); - gfxItem->currFrameNum = j; - gfxItem->updFlag = true; + gfxItem->_currFrame.duration -= totalDuration; + if (gfxItem->_currFrame.soundId != -1) + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | gfxItem->_currFrame.soundId); + gfxItem->_currFrameNum = j; + gfxItem->_updFlag = true; } else { - gfxItem->delayTicks -= totalDuration + 1; - gfxItem->updFlag = false; + gfxItem->_delayTicks -= totalDuration + 1; + gfxItem->_updFlag = false; } } @@ -518,19 +517,19 @@ void GameSys::seqRemoveGfx(int sequenceId, int id) { int gfxIndex; if (seqLocateGfx(sequenceId, id, &gfxIndex)) { GfxItem *gfxItem = &_gfxItems[gfxIndex]; - while (gfxIndex < _gfxItemsCount && gfxItem->sequenceId == sequenceId && gfxItem->id == id) { - if (gfxItem->prevFrame.spriteId == -1) { + while (gfxIndex < _gfxItemsCount && gfxItem->_sequenceId == sequenceId && gfxItem->_id == id) { + if (gfxItem->_prevFrame.spriteId == -1) { --_gfxItemsCount; if (gfxIndex != _gfxItemsCount) memcpy(&_gfxItems[gfxIndex], &_gfxItems[gfxIndex + 1], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); } else { - gfxItem->sequenceId = -1; - gfxItem->animation = 0; - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.spriteId = -1; - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; - gfxItem->updFlag = true; + gfxItem->_sequenceId = -1; + gfxItem->_animation = nullptr; + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.spriteId = -1; + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; + gfxItem->_updFlag = true; ++gfxIndex; gfxItem = &_gfxItems[gfxIndex]; } @@ -543,22 +542,22 @@ bool GameSys::updateSequenceDuration(int sequenceId, int id, int *outDuration) { int duration = 0x7FFFFFFF; for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - if (gfxItem->sequenceId == sequenceId && gfxItem->id == id) { + if (gfxItem->_sequenceId == sequenceId && gfxItem->_id == id) { found = true; - SequenceAnimation *animation = gfxItem->animation; + SequenceAnimation *animation = gfxItem->_animation; if (animation) { - if (gfxItem->currFrameNum < animation->framesCount) + if (gfxItem->_currFrameNum < animation->framesCount) return false; - if (gfxItem->updFlag) { - if (gfxItem->currFrame.duration > 0) + if (gfxItem->_updFlag) { + if (gfxItem->_currFrame.duration > 0) return false; - if (-gfxItem->currFrame.duration < duration) - duration = -gfxItem->currFrame.duration; + if (-gfxItem->_currFrame.duration < duration) + duration = -gfxItem->_currFrame.duration; } else { - if (gfxItem->prevFrame.duration > 0) + if (gfxItem->_prevFrame.duration > 0) return false; - if (-gfxItem->prevFrame.duration < duration) - duration = -gfxItem->prevFrame.duration; + if (-gfxItem->_prevFrame.duration < duration) + duration = -gfxItem->_prevFrame.duration; } } } @@ -585,12 +584,12 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { bool foundSequence = false; for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - SequenceAnimation *animation = gfxItem->animation; - if (gfxItem->sequenceId == sequenceId && gfxItem->id == id && animation) { + SequenceAnimation *animation = gfxItem->_animation; + if (gfxItem->_sequenceId == sequenceId && gfxItem->_id == id && animation) { foundSequence = true; - if (animation->framesCount > gfxItem->currFrameNum || - (gfxItem->updFlag && gfxItem->currFrame.duration > 1) || - gfxItem->prevFrame.duration > 1) + if (animation->framesCount > gfxItem->_currFrameNum || + (gfxItem->_updFlag && gfxItem->_currFrame.duration > 1) || + gfxItem->_prevFrame.duration > 1) foundSequence = false; break; } @@ -804,44 +803,44 @@ void GameSys::drawSprites() { for (int k = 0; k < _gfxItemsCount; ++k) { GfxItem *gfxItem2 = &_gfxItems[k]; - if (!gfxItem2->updFlag) + if (!gfxItem2->_updFlag) continue; - if (gfxItem2->prevFrame.spriteId != -1) { + if (gfxItem2->_prevFrame.spriteId != -1) { int transparent = 0; - if (gfxItem2->currFrame.spriteId != -1 && !(gfxItem2->flags & 2)) { - if (gfxItem2->flags & 1) { + if (gfxItem2->_currFrame.spriteId != -1 && !(gfxItem2->_flags & 2)) { + if (gfxItem2->_flags & 1) { transparent = 1; } else { - int resourceId = (gfxItem2->sequenceId & 0xFFFF0000) | gfxItem2->currFrame.spriteId; + int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame.spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); transparent = spriteResource->_transparent; _vm->_spriteCache->release(resourceId); } } - if ((gfxItem2->flags & 8) || gfxItem2->currFrame.spriteId == -1 || - (!(gfxItem2->flags & 2) && (!gfxItem2->prevFrame.rect.equals(gfxItem2->currFrame.rect) || !transparent))) { - restoreBackgroundRect(gfxItem2->prevFrame.rect); + if ((gfxItem2->_flags & 8) || gfxItem2->_currFrame.spriteId == -1 || + (!(gfxItem2->_flags & 2) && (!gfxItem2->_prevFrame.rect.equals(gfxItem2->_currFrame.rect) || !transparent))) { + restoreBackgroundRect(gfxItem2->_prevFrame.rect); for (int l = 0; l < _gfxItemsCount; ++l) - _gfxItems[l].testUpdRect(gfxItem2->prevFrame.rect); + _gfxItems[l].testUpdRect(gfxItem2->_prevFrame.rect); } } - if (gfxItem2->currFrame.spriteId != -1) { + if (gfxItem2->_currFrame.spriteId != -1) { int transparent = 0; - if (gfxItem2->flags & 1) { + if (gfxItem2->_flags & 1) { transparent = 1; - } else if (!(gfxItem2->flags & 2)) { - int resourceId = (gfxItem2->sequenceId & 0xFFFF0000) | gfxItem2->currFrame.spriteId; + } else if (!(gfxItem2->_flags & 2)) { + int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame.spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); transparent = spriteResource->_transparent; _vm->_spriteCache->release(resourceId); } - if (((gfxItem2->flags & 2) && !(gfxItem2->flags & 8)) || - gfxItem2->prevFrame.spriteId == -1 || - !gfxItem2->prevFrame.rect.equals(gfxItem2->currFrame.rect) || transparent) { + if (((gfxItem2->_flags & 2) && !(gfxItem2->_flags & 8)) || + gfxItem2->_prevFrame.spriteId == -1 || + !gfxItem2->_prevFrame.rect.equals(gfxItem2->_currFrame.rect) || transparent) { for (int l = k; l < _gfxItemsCount; ++l) - _gfxItems[l].testUpdRect(gfxItem2->currFrame.rect); + _gfxItems[l].testUpdRect(gfxItem2->_currFrame.rect); } } @@ -851,37 +850,37 @@ void GameSys::drawSprites() { GfxItem *gfxItem5 = &_gfxItems[m]; debug(0, "DrawGfxItem(%d) updFlag: %d; currFrame.spriteId: %04X; updRectsCount: %d; flags: %04X; sequenceId: %08X", - m, gfxItem5->updFlag, gfxItem5->currFrame.spriteId, gfxItem5->updRectsCount, gfxItem5->flags, gfxItem5->sequenceId); + m, gfxItem5->_updFlag, gfxItem5->_currFrame.spriteId, gfxItem5->_updRectsCount, gfxItem5->_flags, gfxItem5->_sequenceId); - if (gfxItem5->updFlag) { - if (gfxItem5->currFrame.spriteId != -1) { - if (gfxItem5->flags & 1) { - seqDrawStaticFrame(gfxItem5->surface, gfxItem5->currFrame, 0); + if (gfxItem5->_updFlag) { + if (gfxItem5->_currFrame.spriteId != -1) { + if (gfxItem5->_flags & 1) { + seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, 0); //debug("seqDrawStaticFrame"); - } else if (gfxItem5->flags & 2) { + } else if (gfxItem5->_flags & 2) { // TODO seqDrawAviFrame(gfxItem5->currFrame.spriteId, &gfxItem5->currFrame, 0, gfxItem5->flags & 8); } else { - int resourceId = (gfxItem5->sequenceId & 0xFFFF0000) | gfxItem5->currFrame.spriteId; + int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame.spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); - seqDrawSpriteFrame(spriteResource, gfxItem5->currFrame, 0); + seqDrawSpriteFrame(spriteResource, gfxItem5->_currFrame, 0); _vm->_spriteCache->release(resourceId); } } - } else if (gfxItem5->updRectsCount > 0) { - if (gfxItem5->flags & 1) { - for (int n = 0; n < gfxItem5->updRectsCount; ++n) - seqDrawStaticFrame(gfxItem5->surface, gfxItem5->prevFrame, &gfxItem5->updRects[n]); - } else if (gfxItem5->flags & 2) { + } else if (gfxItem5->_updRectsCount > 0) { + if (gfxItem5->_flags & 1) { + for (int n = 0; n < gfxItem5->_updRectsCount; ++n) + seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_prevFrame, &gfxItem5->_updRects[n]); + } else if (gfxItem5->_flags & 2) { /* TODO spriteData4 = gfxItem5->prevFrame.spriteId; for (int n = 0; n < gfxItem5->updRectsCount; ++n) seqDrawAviFrame(spriteData4, &gfxItem5->prevFrame, &gfxItem5->updRects[n], gfxItem5->flags & 8); */ } else { - int resourceId = (gfxItem5->sequenceId & 0xFFFF0000) | gfxItem5->prevFrame.spriteId; + int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_prevFrame.spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); - for (int n = 0; n < gfxItem5->updRectsCount; ++n) - seqDrawSpriteFrame(spriteResource, gfxItem5->prevFrame, &gfxItem5->updRects[n]); + for (int n = 0; n < gfxItem5->_updRectsCount; ++n) + seqDrawSpriteFrame(spriteResource, gfxItem5->_prevFrame, &gfxItem5->_updRects[n]); _vm->_spriteCache->release(resourceId); } } @@ -919,19 +918,19 @@ void GameSys::updateScreen() { GfxItem *gfxItem = &_gfxItems[j]; - if (!gfxItem->updFlag) + if (!gfxItem->_updFlag) continue; - if (gfxItem->prevFrame.spriteId == -1 || - !intersectRect(srcRect, _screenRect, gfxItem->prevFrame.rect)) { - if (gfxItem->currFrame.spriteId != -1 && intersectRect(rcSrc2, _screenRect, gfxItem->currFrame.rect)) + if (gfxItem->_prevFrame.spriteId == -1 || + !intersectRect(srcRect, _screenRect, gfxItem->_prevFrame.rect)) { + if (gfxItem->_currFrame.spriteId != -1 && intersectRect(rcSrc2, _screenRect, gfxItem->_currFrame.rect)) updateRect(rcSrc2); - } else if (gfxItem->currFrame.spriteId != -1 && - intersectRect(rcSrc2, _screenRect, gfxItem->currFrame.rect)) { + } else if (gfxItem->_currFrame.spriteId != -1 && + intersectRect(rcSrc2, _screenRect, gfxItem->_currFrame.rect)) { updateRect(srcRect); updateRect(rcSrc2); } - gfxItem->prevFrame = gfxItem->currFrame; + gfxItem->_prevFrame = gfxItem->_currFrame; } updateRect(Common::Rect(0, 0, 800, 600)); @@ -949,7 +948,7 @@ void GameSys::handleReqRemoveSequenceItem() { if (seqLocateGfx(_removeSequenceItemSequenceId, _removeSequenceItemValue, &gfxIndex2)) { int gfxIndex2a = gfxIndex2; for (GfxItem *gfxItem = &_gfxItems[gfxIndex2a]; - gfxIndex2a < _gfxItemsCount && gfxItem->sequenceId == _removeSequenceItemSequenceId && gfxItem->id == _removeSequenceItemValue; + gfxIndex2a < _gfxItemsCount && gfxItem->_sequenceId == _removeSequenceItemSequenceId && gfxItem->_id == _removeSequenceItemValue; gfxItem = &_gfxItems[gfxIndex2a]) ++gfxIndex2a; _gfxItemsCount -= gfxIndex2a - gfxIndex2; @@ -967,19 +966,18 @@ void GameSys::handleReqRemoveSequenceItems() { _seqItems.remove_at(gfxIndex); seqLocateGfx(_removeSequenceItems[i]._sequenceId, _removeSequenceItems[i]._id, &gfxIndex); for (GfxItem *gfxItem = &_gfxItems[gfxIndex]; - gfxIndex < _gfxItemsCount && gfxItem->sequenceId == _removeSequenceItems[i]._sequenceId && gfxItem->id == _removeSequenceItems[i]._id; + gfxIndex < _gfxItemsCount && gfxItem->_sequenceId == _removeSequenceItems[i]._sequenceId && gfxItem->_id == _removeSequenceItems[i]._id; gfxItem = &_gfxItems[gfxIndex]) { - gfxItem->sequenceId = -1; - gfxItem->animation = 0; - gfxItem->soundValue = 0; + gfxItem->_sequenceId = -1; + gfxItem->_animation = nullptr; if (_removeSequenceItems[i]._forceFrameReset) { - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.spriteId = -1; - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; - gfxItem->updFlag = true; + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.spriteId = -1; + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; + gfxItem->_updFlag = true; } else { - gfxItem->updFlag = false; + gfxItem->_updFlag = false; } ++gfxIndex; } @@ -993,14 +991,14 @@ void GameSys::handleReqRemoveSpriteDrawItems() { for (int j = 0; j < _removeSpriteDrawItemsCount; ++j) { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - if (gfxItem->sequenceId == -1 && !gfxItem->animation && (gfxItem->flags & 1) && - gfxItem->id == _removeSpriteDrawItems[j]._id && _removeSpriteDrawItems[j].surface == gfxItem->surface) { - gfxItem->flags = 0; - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.spriteId = -1; - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; - gfxItem->updFlag = true; + if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && (gfxItem->_flags & 1) && + gfxItem->_id == _removeSpriteDrawItems[j]._id && _removeSpriteDrawItems[j]._surface == gfxItem->_surface) { + gfxItem->_flags = 0; + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.spriteId = -1; + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; + gfxItem->_updFlag = true; } } } @@ -1027,104 +1025,104 @@ void GameSys::fatUpdateFrame() { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - SequenceAnimation *animation = gfxItem->animation; - if ((gfxItem->sequenceId != -1 && animation) || (gfxItem->flags & 2) || - gfxItem->prevFrame.spriteId != -1 || gfxItem->prevFrame.duration > 0) { - if (gfxItem->sequenceId == -1 || gfxItem->updFlag) { - if ((gfxItem->flags & 2) && !gfxItem->updFlag) { + SequenceAnimation *animation = gfxItem->_animation; + if ((gfxItem->_sequenceId != -1 && animation) || (gfxItem->_flags & 2) || + gfxItem->_prevFrame.spriteId != -1 || gfxItem->_prevFrame.duration > 0) { + if (gfxItem->_sequenceId == -1 || gfxItem->_updFlag) { + if ((gfxItem->_flags & 2) && !gfxItem->_updFlag) { // NOTE Skipped avi code } } else { - Sequence *seqItem = seqFind(gfxItem->sequenceId, gfxItem->id, 0); + Sequence *seqItem = seqFind(gfxItem->_sequenceId, gfxItem->_id, 0); if (!animation) { updFlag = false; - gfxItem->sequenceId = -1; - gfxItem->animation = 0; - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.spriteId = -1; - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; - gfxItem->updFlag = true; + gfxItem->_sequenceId = -1; + gfxItem->_animation = nullptr; + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.spriteId = -1; + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; + gfxItem->_updFlag = true; } else if (!seqItem) { updFlag = false; - gfxItem->animation = 0; - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.spriteId = -1; - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; - gfxItem->updFlag = true; + gfxItem->_animation = nullptr; + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.spriteId = -1; + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; + gfxItem->_updFlag = true; } else if ((seqItem->_flags & 4) && clockDelta > 1) { updFlag = false; - if (gfxItem->delayTicks < clockDelta) { - duration = clockDelta - gfxItem->delayTicks; - gfxItem->delayTicks = 0; - if (gfxItem->prevFrame.duration <= duration) - gfxItem->prevFrame.duration = 1; + if (gfxItem->_delayTicks < clockDelta) { + duration = clockDelta - gfxItem->_delayTicks; + gfxItem->_delayTicks = 0; + if (gfxItem->_prevFrame.duration <= duration) + gfxItem->_prevFrame.duration = 1; else - gfxItem->prevFrame.duration -= duration; + gfxItem->_prevFrame.duration -= duration; } else { - gfxItem->delayTicks -= clockDelta; + gfxItem->_delayTicks -= clockDelta; } - gfxItem->updFlag = false; - } else if (gfxItem->delayTicks < clockDelta) { - duration = clockDelta - gfxItem->delayTicks; - gfxItem->delayTicks = 0; - if (gfxItem->prevFrame.duration <= duration) { + gfxItem->_updFlag = false; + } else if (gfxItem->_delayTicks < clockDelta) { + duration = clockDelta - gfxItem->_delayTicks; + gfxItem->_delayTicks = 0; + if (gfxItem->_prevFrame.duration <= duration) { bool v20 = false; - if (gfxItem->prevFrame.duration > 0) { - duration -= gfxItem->prevFrame.duration; - gfxItem->prevFrame.duration = -duration; + if (gfxItem->_prevFrame.duration > 0) { + duration -= gfxItem->_prevFrame.duration; + gfxItem->_prevFrame.duration = -duration; } else { - gfxItem->prevFrame.duration = 0; + gfxItem->_prevFrame.duration = 0; v20 = true; } - currFrameNum = gfxItem->currFrameNum; + currFrameNum = gfxItem->_currFrameNum; if (animation->framesCount > currFrameNum) { updFlag = false; while (animation->framesCount > currFrameNum && animation->frames[currFrameNum].duration <= duration) { if (animation->frames[currFrameNum].soundId != -1) - _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | animation->frames[currFrameNum].soundId); + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[currFrameNum].soundId); duration -= animation->frames[currFrameNum].duration; ++currFrameNum; } if (animation->framesCount > currFrameNum) - gfxItem->currFrame = animation->frames[currFrameNum++]; + gfxItem->_currFrame = animation->frames[currFrameNum++]; else - gfxItem->currFrame = animation->frames[currFrameNum - 1]; - if (gfxItem->currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) - gfxItem->currFrame.rect.translate(seqItem->_x, seqItem->_y); + gfxItem->_currFrame = animation->frames[currFrameNum - 1]; + if (gfxItem->_currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) + gfxItem->_currFrame.rect.translate(seqItem->_x, seqItem->_y); // Update sprite scaling - if ((seqItem->_flags & 1) && gfxItem->currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->currFrame.rect.bottom <= _backgroundImageValue3) { - int v17 = _backgroundImageValue2 + (gfxItem->currFrame.rect.bottom - _backgroundImageValue1) * + if ((seqItem->_flags & 1) && gfxItem->_currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame.rect.bottom <= _backgroundImageValue3) { + int v17 = _backgroundImageValue2 + (gfxItem->_currFrame.rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / (_backgroundImageValue3 - _backgroundImageValue1); - gfxItem->currFrame.rect.top = gfxItem->currFrame.rect.bottom - v17 * (gfxItem->currFrame.rect.bottom - gfxItem->currFrame.rect.top) / 1000; - gfxItem->currFrame.rect.right = v17 * (gfxItem->currFrame.rect.right - gfxItem->currFrame.rect.left) / 1000 + gfxItem->currFrame.rect.left; - gfxItem->currFrame.isScaled = 1; + gfxItem->_currFrame.rect.top = gfxItem->_currFrame.rect.bottom - v17 * (gfxItem->_currFrame.rect.bottom - gfxItem->_currFrame.rect.top) / 1000; + gfxItem->_currFrame.rect.right = v17 * (gfxItem->_currFrame.rect.right - gfxItem->_currFrame.rect.left) / 1000 + gfxItem->_currFrame.rect.left; + gfxItem->_currFrame.isScaled = 1; } - gfxItem->currFrame.duration -= duration; - if (gfxItem->currFrame.soundId != -1) - _soundIds.push_back((gfxItem->sequenceId & 0xFFFF0000) | gfxItem->currFrame.soundId); - gfxItem->currFrameNum = currFrameNum; - gfxItem->updFlag = true; - } else if (v20 && gfxItem->prevFrame.spriteId == -1) { + gfxItem->_currFrame.duration -= duration; + if (gfxItem->_currFrame.soundId != -1) + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | gfxItem->_currFrame.soundId); + gfxItem->_currFrameNum = currFrameNum; + gfxItem->_updFlag = true; + } else if (v20 && gfxItem->_prevFrame.spriteId == -1) { --_gfxItemsCount; if (_gfxItemsCount != i) memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); --i; } else { - gfxItem->updFlag = false; + gfxItem->_updFlag = false; } } else { updFlag = false; - gfxItem->prevFrame.duration -= duration; - gfxItem->updFlag = false; + gfxItem->_prevFrame.duration -= duration; + gfxItem->_updFlag = false; } } else { updFlag = false; - gfxItem->delayTicks -= clockDelta; - gfxItem->updFlag = false; + gfxItem->_delayTicks -= clockDelta; + gfxItem->_updFlag = false; } } } else { @@ -1145,25 +1143,25 @@ void GameSys::fatUpdateFrame() { memcpy(&_gfxItems[insertIndex + 1], &_gfxItems[insertIndex], sizeof(GfxItem) * (_gfxItemsCount - insertIndex)); ++_gfxItemsCount; GfxItem *gfxItem = &_gfxItems[insertIndex]; - gfxItem->sequenceId = -1; - gfxItem->id = _newSpriteDrawItems[k]._id; - gfxItem->animation = 0; - gfxItem->currFrameNum = 0; - gfxItem->flags = 1; - gfxItem->delayTicks = 0; - gfxItem->updFlag = true; - gfxItem->updRectsCount = 0; - gfxItem->surface = _newSpriteDrawItems[k]._surface; - gfxItem->prevFrame.duration = 0; - gfxItem->prevFrame.spriteId = -1; - gfxItem->prevFrame.soundId = -1; - gfxItem->prevFrame.unkValue = -1; - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.isScaled = 0; - gfxItem->currFrame.rect = _newSpriteDrawItems[k]._rect; - gfxItem->currFrame.spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; + gfxItem->_sequenceId = -1; + gfxItem->_id = _newSpriteDrawItems[k]._id; + gfxItem->_animation = nullptr; + gfxItem->_currFrameNum = 0; + gfxItem->_flags = 1; + gfxItem->_delayTicks = 0; + gfxItem->_updFlag = true; + gfxItem->_updRectsCount = 0; + gfxItem->_surface = _newSpriteDrawItems[k]._surface; + gfxItem->_prevFrame.duration = 0; + gfxItem->_prevFrame.spriteId = -1; + gfxItem->_prevFrame.soundId = -1; + gfxItem->_prevFrame.unkValue = -1; + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.isScaled = 0; + gfxItem->_currFrame.rect = _newSpriteDrawItems[k]._rect; + gfxItem->_currFrame.spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; } } _newSpriteDrawItemsCount = 0; @@ -1172,16 +1170,16 @@ void GameSys::fatUpdateFrame() { if (_grabSpriteChanged) { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - if (gfxItem->sequenceId == -1 && !gfxItem->animation && (gfxItem->flags & 1) && - gfxItem->id == _grabSpriteId && gfxItem->surface == _grabSpriteSurface1) { - gfxItem->currFrame.duration = 0; - gfxItem->currFrame.isScaled = 0; - gfxItem->currFrame.rect = _grabSpriteRect; - gfxItem->currFrame.spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO - gfxItem->currFrame.soundId = -1; - gfxItem->currFrame.unkValue = -1; - gfxItem->updFlag = true; - gfxItem->surface = _grabSpriteSurface2; + if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && (gfxItem->_flags & 1) && + gfxItem->_id == _grabSpriteId && gfxItem->_surface == _grabSpriteSurface1) { + gfxItem->_currFrame.duration = 0; + gfxItem->_currFrame.isScaled = 0; + gfxItem->_currFrame.rect = _grabSpriteRect; + gfxItem->_currFrame.spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO + gfxItem->_currFrame.soundId = -1; + gfxItem->_currFrame.unkValue = -1; + gfxItem->_updFlag = true; + gfxItem->_surface = _grabSpriteSurface2; break; } } @@ -1272,8 +1270,8 @@ void GameSys::fatUpdate() { debug(1, "GameSys::fatUpdate() _gfxItemsCount: %d", _gfxItemsCount); for (int i = 0; i < _gfxItemsCount; ++i) { - _gfxItems[i].updFlag = false; - _gfxItems[i].updRectsCount = 0; + _gfxItems[i]._updFlag = false; + _gfxItems[i]._updRectsCount = 0; } handleReqRemoveSequenceItem(); diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index 76b2afe464..cb6de0033b 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -72,25 +72,22 @@ struct RemoveSequenceItem { struct RemoveSpriteDrawItem { int _id; - Graphics::Surface *surface; + Graphics::Surface *_surface; }; struct GfxItem { - int sequenceId; - int id; - int flags; - SequenceAnimation *animation; - int soundValue; - int field_18; - int field_1C; - int currFrameNum; - int delayTicks; - bool updFlag; - int updRectsCount; - Graphics::Surface *surface; - Common::Rect updRects[kMaxUpdRects]; - SequenceFrame prevFrame; - SequenceFrame currFrame; + int _sequenceId; + int _id; + int _flags; + SequenceAnimation *_animation; + int _currFrameNum; + int _delayTicks; + bool _updFlag; + int _updRectsCount; + Graphics::Surface *_surface; + Common::Rect _updRects[kMaxUpdRects]; + SequenceFrame _prevFrame; + SequenceFrame _currFrame; void testUpdRect(const Common::Rect &updRect); }; -- cgit v1.2.3 From 83bc85713bacd3a50daaace0411a3382c855797a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Mar 2016 07:40:03 +0100 Subject: GNAP: More renaming. Remove unused variable in MouseButtonState and Hotspot --- engines/gnap/gamesys.cpp | 24 ++-- engines/gnap/gamesys.h | 10 +- engines/gnap/gnap.cpp | 96 ++++++------- engines/gnap/gnap.h | 20 ++- engines/gnap/grid.cpp | 6 +- engines/gnap/menu.cpp | 302 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene01.cpp | 8 +- engines/gnap/scenes/scene02.cpp | 10 +- engines/gnap/scenes/scene03.cpp | 22 +-- engines/gnap/scenes/scene04.cpp | 10 +- engines/gnap/scenes/scene05.cpp | 8 +- engines/gnap/scenes/scene06.cpp | 24 ++-- engines/gnap/scenes/scene07.cpp | 6 +- engines/gnap/scenes/scene08.cpp | 16 +-- engines/gnap/scenes/scene09.cpp | 4 +- engines/gnap/scenes/scene10.cpp | 4 +- engines/gnap/scenes/scene11.cpp | 10 +- engines/gnap/scenes/scene12.cpp | 4 +- engines/gnap/scenes/scene13.cpp | 8 +- engines/gnap/scenes/scene14.cpp | 4 +- engines/gnap/scenes/scene15.cpp | 10 +- engines/gnap/scenes/scene17.cpp | 18 +-- engines/gnap/scenes/scene18.cpp | 70 +++++----- engines/gnap/scenes/scene19.cpp | 30 ++-- engines/gnap/scenes/scene20.cpp | 16 +-- engines/gnap/scenes/scene21.cpp | 12 +- engines/gnap/scenes/scene22.cpp | 4 +- engines/gnap/scenes/scene23.cpp | 4 +- engines/gnap/scenes/scene24.cpp | 4 +- engines/gnap/scenes/scene25.cpp | 20 +-- engines/gnap/scenes/scene26.cpp | 4 +- engines/gnap/scenes/scene27.cpp | 16 +-- engines/gnap/scenes/scene28.cpp | 16 +-- engines/gnap/scenes/scene29.cpp | 6 +- engines/gnap/scenes/scene30.cpp | 8 +- engines/gnap/scenes/scene31.cpp | 12 +- engines/gnap/scenes/scene32.cpp | 4 +- engines/gnap/scenes/scene33.cpp | 4 +- engines/gnap/scenes/scene38.cpp | 20 +-- engines/gnap/scenes/scene39.cpp | 4 +- engines/gnap/scenes/scene40.cpp | 4 +- engines/gnap/scenes/scene41.cpp | 12 +- engines/gnap/scenes/scene42.cpp | 6 +- engines/gnap/scenes/scene43.cpp | 10 +- engines/gnap/scenes/scene44.cpp | 8 +- engines/gnap/scenes/scene45.cpp | 16 +-- engines/gnap/scenes/scene46.cpp | 4 +- engines/gnap/scenes/scene53.cpp | 2 +- 48 files changed, 468 insertions(+), 472 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 9909139ecf..1612ba2363 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -60,9 +60,9 @@ GameSys::GameSys(GnapEngine *vm) _backgroundSurface = 0; _frontSurface = 0; for (int i = 0; i < kMaxAnimations; ++i) { - _animations[i].sequenceId = -1; - _animations[i].id = 0; - _animations[i].status = 0; + _animations[i]._sequenceId = -1; + _animations[i]._id = 0; + _animations[i]._status = 0; } _screenRect = Common::Rect(0, 0, 800, 600); } @@ -330,16 +330,16 @@ void GameSys::fillSurface(Graphics::Surface *surface, int x, int y, int width, i void GameSys::setAnimation(int sequenceId, int id, int animationIndex) { if (animationIndex < kMaxAnimations) { - _animations[animationIndex].sequenceId = sequenceId; - _animations[animationIndex].id = id; - _animations[animationIndex].status = 0; + _animations[animationIndex]._sequenceId = sequenceId; + _animations[animationIndex]._id = id; + _animations[animationIndex]._status = 0; } } int GameSys::getAnimationStatus(int animationIndex) { int result = -1; if (animationIndex < kMaxAnimations) - result = _animations[animationIndex].status; + result = _animations[animationIndex]._status; return result; } @@ -505,8 +505,8 @@ void GameSys::seqInsertGfx(int index, int duration) { } for (int k = 0; k < kMaxAnimations; ++k) { - if (_animations[k].sequenceId != -1 && _animations[k].sequenceId == seqItem->_sequenceId && _animations[k].id == seqItem->_id) { - _animations[k].status = 1; + if (_animations[k]._sequenceId != -1 && _animations[k]._sequenceId == seqItem->_sequenceId && _animations[k]._id == seqItem->_id) { + _animations[k]._status = 1; break; } } @@ -572,7 +572,7 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { Animation *foundAnimation = 0; for (int animationIndex = 0; animationIndex < kMaxAnimations; ++animationIndex) { Animation *animation = &_animations[animationIndex]; - if (animation->sequenceId != -1 && animation->sequenceId == sequenceId && animation->id == id) { + if (animation->_sequenceId != -1 && animation->_sequenceId == sequenceId && animation->_id == id) { foundAnimation = animation; break; } @@ -596,8 +596,8 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { } if (foundSequence) { - foundAnimation->sequenceId = -1; - foundAnimation->status = 2; + foundAnimation->_sequenceId = -1; + foundAnimation->_status = 2; } } diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index cb6de0033b..043dec3c32 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -92,9 +92,9 @@ struct GfxItem { }; struct Animation { - int sequenceId; - int id; - int status; + int _sequenceId; + int _id; + int _status; }; class GameSys { @@ -135,8 +135,6 @@ public: SpriteDrawItem _newSpriteDrawItems[kMaxSpriteDrawItems]; int _newSpriteDrawItemsCount; - bool _spriteDrawItems1Changed; - RemoveSequenceItem _removeSequenceItems[kMaxSequenceItems]; int _removeSequenceItemsCount; @@ -166,7 +164,7 @@ public: int _backgroundImageValue3, _backgroundImageValue1; int _backgroundImageValue4, _backgroundImageValue2; - bool _backgroundImageError; + bool _backgroundImageError; // CHECKME: Unused int32 _gameSysClock, _lastUpdateClock; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index a46b4c6cce..08861f4398 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -246,20 +246,20 @@ void GnapEngine::updateEvents() { _mouseY = event.mouse.y; break; case Common::EVENT_LBUTTONUP: - _mouseButtonState.left = false; + _mouseButtonState._left = false; break; case Common::EVENT_LBUTTONDOWN: _leftClickMouseX = event.mouse.x; _leftClickMouseY = event.mouse.y; - _mouseButtonState.left = true; - _mouseClickState.left = true; + _mouseButtonState._left = true; + _mouseClickState._left = true; break; case Common::EVENT_RBUTTONUP: - _mouseButtonState.right = false; + _mouseButtonState._right = false; break; case Common::EVENT_RBUTTONDOWN: - _mouseButtonState.right = true; - _mouseClickState.right = true; + _mouseButtonState._right = true; + _mouseClickState._right = true; break; case Common::EVENT_QUIT: quitGame(); @@ -331,8 +331,8 @@ void GnapEngine::resumeGame() { // TODO stopMidi(); _isPaused = false; clearAllKeyStatus1(); - _mouseClickState.left = false; - _mouseClickState.right = false; + _mouseClickState._left = false; + _mouseClickState._right = false; showCursor(); _gameSys->_gameSysClock = 0; _gameSys->_lastUpdateClock = 0; @@ -375,12 +375,12 @@ void GnapEngine::delayTicksCursor(int a1) { void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags, int16 walkX, int16 walkY) { - _hotspots[index].x1 = x1; - _hotspots[index].y1 = y1; - _hotspots[index].x2 = x2; - _hotspots[index].y2 = y2; - _hotspots[index].flags = flags; - _hotspots[index].id = index; + _hotspots[index]._x1 = x1; + _hotspots[index]._y1 = y1; + _hotspots[index]._x2 = x2; + _hotspots[index]._y2 = y2; + _hotspots[index]._flags = flags; + _hotspots[index]._id = index; _hotspotsWalkPos[index].x = walkX; _hotspotsWalkPos[index].y = walkY; } @@ -406,44 +406,44 @@ void GnapEngine::updateCursorByHotspot() { if (hotspotIndex < 0) setCursor(kDisabledCursors[_verbCursor]); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_L_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_L_CURSOR) setCursor(EXIT_L_CURSOR); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_R_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_R_CURSOR) setCursor(EXIT_R_CURSOR); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_U_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_U_CURSOR) setCursor(EXIT_U_CURSOR); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_D_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_D_CURSOR) setCursor(EXIT_D_CURSOR); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_NE_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_NE_CURSOR) setCursor(EXIT_NE_CURSOR); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_NW_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_NW_CURSOR) setCursor(EXIT_NW_CURSOR); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_SE_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_SE_CURSOR) setCursor(EXIT_SE_CURSOR); - else if (_hotspots[hotspotIndex].flags & SF_EXIT_SW_CURSOR) + else if (_hotspots[hotspotIndex]._flags & SF_EXIT_SW_CURSOR) setCursor(EXIT_SW_CURSOR); - else if (_hotspots[hotspotIndex].flags & (1 << _verbCursor)) + else if (_hotspots[hotspotIndex]._flags & (1 << _verbCursor)) setCursor(kCursors[_verbCursor]); else setCursor(kDisabledCursors[_verbCursor]); } // Update platypus hotspot - _hotspots[0].x1 = _gridMinX + 75 * _platX - 30; - _hotspots[0].y1 = _gridMinY + 48 * _platY - 100; - _hotspots[0].x2 = _gridMinX + 75 * _platX + 30; - _hotspots[0].y2 = _gridMinY + 48 * _platY; + _hotspots[0]._x1 = _gridMinX + 75 * _platX - 30; + _hotspots[0]._y1 = _gridMinY + 48 * _platY - 100; + _hotspots[0]._x2 = _gridMinX + 75 * _platX + 30; + _hotspots[0]._y2 = _gridMinY + 48 * _platY; } int GnapEngine::getClickedHotspotId() { int result = -1; if (_isWaiting) - _mouseClickState.left = false; - else if (_mouseClickState.left) { + _mouseClickState._left = false; + else if (_mouseClickState._left) { int hotspotIndex = getHotspotIndexAtPos(_leftClickMouseX, _leftClickMouseY); if (hotspotIndex >= 0) { - _mouseClickState.left = false; + _mouseClickState._left = false; _timers[3] = 300; - result = _hotspots[hotspotIndex].id; + result = _hotspots[hotspotIndex]._id; } } return result; @@ -454,9 +454,9 @@ int GnapEngine::getInventoryItemSpriteNum(int index) { } void GnapEngine::updateMouseCursor() { - if (_mouseClickState.right) { + if (_mouseClickState._right) { // Switch through the verb cursors - _mouseClickState.right = false; + _mouseClickState._right = false; _timers[3] = 300; _verbCursor = (_verbCursor + 1) % 4; if (!isFlag(0) && _verbCursor == PLAT_CURSOR && _cursorValue == 1) @@ -592,11 +592,11 @@ void GnapEngine::showFullScreenSprite(int resourceId) { hideCursor(); setGrabCursorSprite(-1); addFullScreenSprite(resourceId, 256); - while (!_mouseClickState.left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && + while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29)) { gameUpdateTick(); } - _mouseClickState.left = false; + _mouseClickState._left = false; clearKeyStatus1(Common::KEYCODE_ESCAPE); clearKeyStatus1(29); clearKeyStatus1(Common::KEYCODE_SPACE); @@ -629,12 +629,12 @@ void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int _deviceY1 = 14; if (y2 == -1) _deviceY2 = 79; - _hotspots[hotspotIndex].x1 = _deviceX1; - _hotspots[hotspotIndex].y1 = _deviceY1; - _hotspots[hotspotIndex].x2 = _deviceX2; - _hotspots[hotspotIndex].y2 = _deviceY2; - _hotspots[hotspotIndex].flags = SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _hotspots[hotspotIndex].id = hotspotIndex; + _hotspots[hotspotIndex]._x1 = _deviceX1; + _hotspots[hotspotIndex]._y1 = _deviceY1; + _hotspots[hotspotIndex]._x2 = _deviceX2; + _hotspots[hotspotIndex]._y2 = _deviceY2; + _hotspots[hotspotIndex]._flags = SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[hotspotIndex]._id = hotspotIndex; } int GnapEngine::getSequenceTotalDuration(int resourceId) { @@ -819,8 +819,8 @@ void GnapEngine::initScene() { gnapInitBrainPulseRndValue(); hideCursor(); clearAllKeyStatus1(); - _mouseClickState.left = false; - _mouseClickState.right = false; + _mouseClickState._left = false; + _mouseClickState._right = false; _sceneClickedHotspot = -1; datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); @@ -886,8 +886,8 @@ void GnapEngine::afterScene() { clearKeyStatus1(Common::KEYCODE_p); - _mouseClickState.left = false; - _mouseClickState.right = false; + _mouseClickState._left = false; + _mouseClickState._right = false; } @@ -1720,14 +1720,14 @@ void GnapEngine::updateGnapIdleSequence2() { } bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2) { - if (_mouseClickState.left && someStatus == _gnapActionStatus) { + if (_mouseClickState._left && someStatus == _gnapActionStatus) { _isLeavingScene = false; _gameSys->setAnimation(0, 0, animationIndex); _gnapActionStatus = -1; _beaverActionStatus = -1; gnapWalkTo(gridX1, gridY1, -1, -1, 1); platypusWalkTo(gridX2, gridY2, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; return true; } return false; @@ -2358,7 +2358,7 @@ void GnapEngine::cutscene_run() { clearKeyStatus1(Common::KEYCODE_SPACE); clearKeyStatus1(29); - _mouseClickState.left = false; + _mouseClickState._left = false; int v1 = 0; while (!_sceneDone) { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 6b532a0141..7894ebd209 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -50,24 +50,21 @@ class GameSys; class SoundMan; struct MouseButtonState { - bool left; - bool right; - bool middle; - MouseButtonState() : left(false), right(false), middle(false) { + bool _left; + bool _right; + MouseButtonState() : _left(false), _right(false) { } }; struct Hotspot { - int16 x1, y1, x2, y2; - int16 field_10; - int16 field_12; - uint16 flags; - int id; + int16 _x1, _y1, _x2, _y2; + uint16 _flags; + int _id; bool isPointInside(int16 x, int16 y) const { - return x >= x1 && x <= x2 && y >= y1 && y <= y2; + return x >= _x1 && x <= _x2 && y >= _y1 && y <= _y2; } bool isFlag(uint16 flag) const { - return (flags & flag) != 0; + return (_flags & flag) != 0; } }; @@ -82,6 +79,7 @@ const int kMaxGridStructs = 30; const int kMaxTimers = 10; enum { + SF_NONE = 0x0000, SF_LOOK_CURSOR = 0x0001, SF_GRAB_CURSOR = 0x0002, SF_TALK_CURSOR = 0x0004, diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 522c72c491..baf1a67f93 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -80,9 +80,9 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { const int y = _gridMinY + 48 * gridY; for (int i = 0; i < _hotspotsCount; ++i) { - if (x >= _hotspots[i].x1 && x <= _hotspots[i].x2 && - y >= _hotspots[i].y1 && y <= _hotspots[i].y2 && - !(_hotspots[i].flags & SF_WALKABLE)) + if (x >= _hotspots[i]._x1 && x <= _hotspots[i]._x2 && + y >= _hotspots[i]._y1 && y <= _hotspots[i]._y2 && + !(_hotspots[i]._flags & SF_WALKABLE)) return true; } diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 0b63ce110e..1a618fdc35 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -44,39 +44,39 @@ void GnapEngine::initMenuHotspots1() { for (int i = 0; i < 3; ++i) { int v1 = 0; while (v1 < 3) { - _hotspots[v2].x1 = 87 * v1 + 262; - _hotspots[v2].y1 = 74 * i + 69; - _hotspots[v2].x2 = _hotspots[v2].x1 + 79; - _hotspots[v2].y2 = _hotspots[v2].y1 + 66; - _hotspots[v2].flags = 0; - _hotspots[v2].id = v2; + _hotspots[v2]._x1 = 87 * v1 + 262; + _hotspots[v2]._y1 = 74 * i + 69; + _hotspots[v2]._x2 = _hotspots[v2]._x1 + 79; + _hotspots[v2]._y2 = _hotspots[v2]._y1 + 66; + _hotspots[v2]._flags = SF_NONE; + _hotspots[v2]._id = v2; ++v1; ++v2; } } - _hotspots[v2].x1 = 330; - _hotspots[v2].y1 = 350; - _hotspots[v2].x2 = 430; - _hotspots[v2].y2 = 460; - _hotspots[v2].flags = 2; - _hotspots[v2].id = v2; + _hotspots[v2]._x1 = 330; + _hotspots[v2]._y1 = 350; + _hotspots[v2]._x2 = 430; + _hotspots[v2]._y2 = 460; + _hotspots[v2]._flags = SF_GRAB_CURSOR; + _hotspots[v2]._id = v2; v0 = v2 + 1; - _hotspots[v0].x1 = 180; - _hotspots[v0].y1 = 15; - _hotspots[v0].x2 = 620; - _hotspots[v0].y2 = 580; - _hotspots[v0].flags = 0; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 180; + _hotspots[v0]._y1 = 15; + _hotspots[v0]._x2 = 620; + _hotspots[v0]._y2 = 580; + _hotspots[v0]._flags = SF_NONE; + _hotspots[v0]._id = v0; ++v0; - _hotspots[v0].x1 = 0; - _hotspots[v0].y1 = 0; - _hotspots[v0].x2 = 799; - _hotspots[v0].y2 = 599; - _hotspots[v0].flags = 0; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 0; + _hotspots[v0]._y1 = 0; + _hotspots[v0]._x2 = 799; + _hotspots[v0]._y2 = 599; + _hotspots[v0]._flags = SF_NONE; + _hotspots[v0]._id = v0; _hotspotsCount = v0 + 1; } @@ -85,129 +85,129 @@ void GnapEngine::initMenuHotspots2() { int i, v0; for (i = 0; i < 4; ++i) { - _hotspots[i].x1 = 312; - _hotspots[i].y1 = 48 * i + 85; - _hotspots[i].x2 = _hotspots[i].x1 + 153; - _hotspots[i].y2 = _hotspots[i].y1 + 37; - _hotspots[i].flags = SF_GRAB_CURSOR; - _hotspots[i].id = i; - } - _hotspots[i].x1 = 500; - _hotspots[i].y1 = 72; - _hotspots[i].x2 = 527; - _hotspots[i].y2 = 99; - _hotspots[i].flags = SF_DISABLED; - _hotspots[i].id = i; + _hotspots[i]._x1 = 312; + _hotspots[i]._y1 = 48 * i + 85; + _hotspots[i]._x2 = _hotspots[i]._x1 + 153; + _hotspots[i]._y2 = _hotspots[i]._y1 + 37; + _hotspots[i]._flags = SF_GRAB_CURSOR; + _hotspots[i]._id = i; + } + _hotspots[i]._x1 = 500; + _hotspots[i]._y1 = 72; + _hotspots[i]._x2 = 527; + _hotspots[i]._y2 = 99; + _hotspots[i]._flags = SF_DISABLED; + _hotspots[i]._id = i; v0 = i + 1; - _hotspots[v0].x1 = 330; - _hotspots[v0].y1 = 350; - _hotspots[v0].x2 = 430; - _hotspots[v0].y2 = 460; - _hotspots[v0].flags = SF_GRAB_CURSOR; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 330; + _hotspots[v0]._y1 = 350; + _hotspots[v0]._x2 = 430; + _hotspots[v0]._y2 = 460; + _hotspots[v0]._flags = SF_GRAB_CURSOR; + _hotspots[v0]._id = v0; ++v0; - _hotspots[v0].x1 = 180; - _hotspots[v0].y1 = 15; - _hotspots[v0].x2 = 620; - _hotspots[v0].y2 = 580; - _hotspots[v0].flags = 0; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 180; + _hotspots[v0]._y1 = 15; + _hotspots[v0]._x2 = 620; + _hotspots[v0]._y2 = 580; + _hotspots[v0]._flags = SF_NONE; + _hotspots[v0]._id = v0; ++v0; - _hotspots[v0].x1 = 0; - _hotspots[v0].y1 = 0; - _hotspots[v0].x2 = 799; - _hotspots[v0].y2 = 599; - _hotspots[v0].flags = 0; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 0; + _hotspots[v0]._y1 = 0; + _hotspots[v0]._x2 = 799; + _hotspots[v0]._y2 = 599; + _hotspots[v0]._flags = SF_NONE; + _hotspots[v0]._id = v0; _hotspotsCount = v0 + 1; } void GnapEngine::initMenuQuitQueryHotspots() { - _hotspots[0].x1 = 311; - _hotspots[0].y1 = 197; - _hotspots[0].x2 = 377; - _hotspots[0].y2 = 237; - _hotspots[0].flags = SF_GRAB_CURSOR; - _hotspots[0].id = 0; - _hotspots[1].x1 = 403; - _hotspots[1].y1 = 197; - _hotspots[1].x2 = 469; - _hotspots[1].y2 = 237; - _hotspots[1].flags = SF_GRAB_CURSOR; - _hotspots[1].id = 1; - _hotspots[2].x1 = 330; - _hotspots[2].y1 = 350; - _hotspots[2].x2 = 430; - _hotspots[2].y2 = 460; - _hotspots[2].flags = SF_GRAB_CURSOR; - _hotspots[2].id = 2; - _hotspots[3].x1 = 180; - _hotspots[3].y1 = 15; - _hotspots[3].x2 = 620; - _hotspots[3].y2 = 580; - _hotspots[3].flags = 0; - _hotspots[3].id = 3; - _hotspots[4].x1 = 0; - _hotspots[4].y1 = 0; - _hotspots[4].x2 = 799; - _hotspots[4].y2 = 599; - _hotspots[4].flags = 0; - _hotspots[4].id = 4; + _hotspots[0]._x1 = 311; + _hotspots[0]._y1 = 197; + _hotspots[0]._x2 = 377; + _hotspots[0]._y2 = 237; + _hotspots[0]._flags = SF_GRAB_CURSOR; + _hotspots[0]._id = 0; + _hotspots[1]._x1 = 403; + _hotspots[1]._y1 = 197; + _hotspots[1]._x2 = 469; + _hotspots[1]._y2 = 237; + _hotspots[1]._flags = SF_GRAB_CURSOR; + _hotspots[1]._id = 1; + _hotspots[2]._x1 = 330; + _hotspots[2]._y1 = 350; + _hotspots[2]._x2 = 430; + _hotspots[2]._y2 = 460; + _hotspots[2]._flags = SF_GRAB_CURSOR; + _hotspots[2]._id = 2; + _hotspots[3]._x1 = 180; + _hotspots[3]._y1 = 15; + _hotspots[3]._x2 = 620; + _hotspots[3]._y2 = 580; + _hotspots[3]._flags = SF_NONE; + _hotspots[3]._id = 3; + _hotspots[4]._x1 = 0; + _hotspots[4]._y1 = 0; + _hotspots[4]._x2 = 799; + _hotspots[4]._y2 = 599; + _hotspots[4]._flags = SF_NONE; + _hotspots[4]._id = 4; _hotspotsCount = 5; } void GnapEngine::initSaveLoadHotspots() { int i, v0; for (i = 0; i < 7; ++i ) { - _hotspots[i].x1 = 288; - _hotspots[i].y1 = 31 * i + 74; - _hotspots[i].x2 = _hotspots[i].x1 + 91; - _hotspots[i].y2 = _hotspots[i].y1 + 22; - _hotspots[i].flags = SF_GRAB_CURSOR; - _hotspots[i].id = i; + _hotspots[i]._x1 = 288; + _hotspots[i]._y1 = 31 * i + 74; + _hotspots[i]._x2 = _hotspots[i]._x1 + 91; + _hotspots[i]._y2 = _hotspots[i]._y1 + 22; + _hotspots[i]._flags = SF_GRAB_CURSOR; + _hotspots[i]._id = i; } if (_menuStatus == 2) { - _hotspots[i].x1 = 416; - _hotspots[i].y1 = 160; - _hotspots[i].x2 = 499; - _hotspots[i].y2 = 188; - _hotspots[i].flags = SF_GRAB_CURSOR; - _hotspots[i].id = i; + _hotspots[i]._x1 = 416; + _hotspots[i]._y1 = 160; + _hotspots[i]._x2 = 499; + _hotspots[i]._y2 = 188; + _hotspots[i]._flags = SF_GRAB_CURSOR; + _hotspots[i]._id = i; ++i; } - _hotspots[i].x1 = 416; - _hotspots[i].y1 = 213; - _hotspots[i].x2 = 499; - _hotspots[i].y2 = 241; - _hotspots[i].flags = SF_GRAB_CURSOR; - _hotspots[i].id = i; + _hotspots[i]._x1 = 416; + _hotspots[i]._y1 = 213; + _hotspots[i]._x2 = 499; + _hotspots[i]._y2 = 241; + _hotspots[i]._flags = SF_GRAB_CURSOR; + _hotspots[i]._id = i; v0 = i + 1; - _hotspots[v0].x1 = 330; - _hotspots[v0].y1 = 350; - _hotspots[v0].x2 = 430; - _hotspots[v0].y2 = 460; - _hotspots[v0].flags = SF_GRAB_CURSOR; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 330; + _hotspots[v0]._y1 = 350; + _hotspots[v0]._x2 = 430; + _hotspots[v0]._y2 = 460; + _hotspots[v0]._flags = SF_GRAB_CURSOR; + _hotspots[v0]._id = v0; ++v0; - _hotspots[v0].x1 = 180; - _hotspots[v0].y1 = 15; - _hotspots[v0].x2 = 620; - _hotspots[v0].y2 = 580; - _hotspots[v0].flags = 0; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 180; + _hotspots[v0]._y1 = 15; + _hotspots[v0]._x2 = 620; + _hotspots[v0]._y2 = 580; + _hotspots[v0]._flags = SF_NONE; + _hotspots[v0]._id = v0; ++v0; - _hotspots[v0].x1 = 0; - _hotspots[v0].y1 = 0; - _hotspots[v0].x2 = 799; - _hotspots[v0].y2 = 599; - _hotspots[v0].flags = 0; - _hotspots[v0].id = v0; + _hotspots[v0]._x1 = 0; + _hotspots[v0]._y1 = 0; + _hotspots[v0]._x2 = 799; + _hotspots[v0]._y2 = 599; + _hotspots[v0]._flags = SF_NONE; + _hotspots[v0]._id = v0; _hotspotsCount = v0 + 1; } void GnapEngine::drawInventoryFrames() { for (int i = 0; i < 9; ++i) - _gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i].x1 - 93, _hotspots[i].y1, 0x10001); + _gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i]._x1 - 93, _hotspots[i]._y1, 0x10001); } void GnapEngine::insertInventorySprites() { @@ -223,16 +223,16 @@ void GnapEngine::insertInventorySprites() { for (int index = 0; index < 30 && _menuSpritesIndex < 9; ++index) { if (invHas(index)) { _gameSys->drawSpriteToSurface(_menuBackgroundSurface, - _hotspots[_menuSpritesIndex].x1 - 93, _hotspots[_menuSpritesIndex].y1, 0x10000); + _hotspots[_menuSpritesIndex]._x1 - 93, _hotspots[_menuSpritesIndex]._y1, 0x10000); _menuInventorySprites[_menuSpritesIndex] = _gameSys->createSurface(getInventoryItemSpriteNum(index) | 0x10000); if (index != _grabCursorSpriteIndex) { _menuInventoryIndices[_menuSpritesIndex] = index; _gameSys->insertSpriteDrawItem(_menuInventorySprites[_menuSpritesIndex], - _hotspots[_menuSpritesIndex].x1 + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2), - _hotspots[_menuSpritesIndex].y1 + ((66 - _menuInventorySprites[_menuSpritesIndex]->h) / 2), + _hotspots[_menuSpritesIndex]._x1 + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2), + _hotspots[_menuSpritesIndex]._y1 + ((66 - _menuInventorySprites[_menuSpritesIndex]->h) / 2), 261); } - _hotspots[_menuSpritesIndex].flags = SF_GRAB_CURSOR; + _hotspots[_menuSpritesIndex]._flags = SF_GRAB_CURSOR; ++_menuSpritesIndex; } } @@ -355,7 +355,7 @@ void GnapEngine::runMenu() { clearAllKeyStatus1(); - _mouseClickState.left = false; + _mouseClickState._left = false; removeDeviceIconActive(); @@ -373,10 +373,10 @@ void GnapEngine::updateMenuStatusInventory() { }; updateGrabCursorSprite(0, 0); - _hotspots[0].x1 = 262; - _hotspots[0].y1 = 69; - _hotspots[0].x2 = 341; - _hotspots[0].y2 = 135; + _hotspots[0]._x1 = 262; + _hotspots[0]._y1 = 69; + _hotspots[0]._x2 = 341; + _hotspots[0]._y2 = 135; _sceneClickedHotspot = -1; if (_timers[2] == 0) _sceneClickedHotspot = getClickedHotspotId(); @@ -386,7 +386,7 @@ void GnapEngine::updateMenuStatusInventory() { _timers[2] = 10; playSound(0x108F4, 0); _menuStatus = 1; - Common::Rect dirtyRect(_hotspots[0].x1, _hotspots[0].y1, _hotspots[2].x2, _hotspots[_hotspotsCount - 4].y2); + Common::Rect dirtyRect(_hotspots[0]._x1, _hotspots[0]._y1, _hotspots[2]._x2, _hotspots[_hotspotsCount - 4]._y2); drawInventoryFrames(); initMenuHotspots2(); removeInventorySprites(); @@ -409,8 +409,8 @@ void GnapEngine::updateMenuStatusInventory() { } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] == -1 && _grabCursorSpriteIndex != -1) { _menuInventoryIndices[_sceneClickedHotspot] = _grabCursorSpriteIndex; _gameSys->insertSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], - _hotspots[_sceneClickedHotspot].x1 + ((79 - _menuInventorySprites[_sceneClickedHotspot]->w) / 2), - _hotspots[_sceneClickedHotspot].y1 + (66 - _menuInventorySprites[_sceneClickedHotspot]->h) / 2, + _hotspots[_sceneClickedHotspot]._x1 + ((79 - _menuInventorySprites[_sceneClickedHotspot]->w) / 2), + _hotspots[_sceneClickedHotspot]._y1 + (66 - _menuInventorySprites[_sceneClickedHotspot]->h) / 2, 261); setGrabCursorSprite(-1); } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] != -1 && _grabCursorSpriteIndex != -1) { @@ -429,7 +429,7 @@ void GnapEngine::updateMenuStatusInventory() { playSound(0x108AE, 0); deleteSurface(&_spriteHandle); // CHECKME _spriteHandle = _gameSys->createSurface(0x10001); - _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1].x1, _hotspots[_menuSpritesIndex - 1].y1, 261); + _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1]._x1, _hotspots[_menuSpritesIndex - 1]._y1, 261); setGrabCursorSprite(kCombineItems[combineIndex].resultItem); removeInventorySprites(); insertInventorySprites(); @@ -441,10 +441,10 @@ void GnapEngine::updateMenuStatusInventory() { } void GnapEngine::updateMenuStatusMainMenu() { - _hotspots[0].x1 = 312; - _hotspots[0].y1 = 85; - _hotspots[0].x2 = 465; - _hotspots[0].y2 = 122; + _hotspots[0]._x1 = 312; + _hotspots[0]._y1 = 85; + _hotspots[0]._x2 = 465; + _hotspots[0]._y2 = 122; _sceneClickedHotspot = -1; if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); @@ -486,12 +486,12 @@ void GnapEngine::updateMenuStatusMainMenu() { _gameSys->insertDirtyRect(dirtyRect); } - while (!_mouseClickState.left && !isKeyStatus1(28) && !isKeyStatus1(30) && !isKeyStatus1(29) && !_timers[2]) { + while (!_mouseClickState._left && !isKeyStatus1(28) && !isKeyStatus1(30) && !isKeyStatus1(29) && !_timers[2]) { gameUpdateTick(); } playSound(0x108F5, 0); - _mouseClickState.left = false; + _mouseClickState._left = false; clearKeyStatus1(28); clearKeyStatus1(29); clearKeyStatus1(30); @@ -513,7 +513,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (_menuSprite1) _gameSys->removeSpriteDrawItem(_menuSprite1, 262); insertInventorySprites(); - Common::Rect dirtyRect(_hotspots[0].x1, _hotspots[0].y1, _hotspots[2].x2, _hotspots[_hotspotsCount - 4].y2); + Common::Rect dirtyRect(_hotspots[0]._x1, _hotspots[0]._y1, _hotspots[2]._x2, _hotspots[_hotspotsCount - 4]._y2); _gameSys->insertDirtyRect(dirtyRect); } } else { @@ -546,7 +546,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (readSavegameDescription(i + 1, savegameDescription) == 0) strncpy(_savegameFilenames[i], savegameDescription.c_str(), 40); _gameSys->drawTextToSurface(_savegameSprites[i], 0, 0, 255, 0, 0, _savegameFilenames[i]); - _gameSys->insertSpriteDrawItem(_savegameSprites[i], 288, _hotspots[i].y1, 263); + _gameSys->insertSpriteDrawItem(_savegameSprites[i], 288, _hotspots[i]._y1, 263); } _savegameIndex = -1; } @@ -729,10 +729,10 @@ void GnapEngine::updateMenuStatusSaveGame() { } void GnapEngine::updateMenuStatusLoadGame() { - _hotspots[0].x1 = 288; - _hotspots[0].y1 = 74; - _hotspots[0].x2 = 379; - _hotspots[0].y2 = 96; + _hotspots[0]._x1 = 288; + _hotspots[0]._y1 = 74; + _hotspots[0]._x2 = 379; + _hotspots[0]._y2 = 96; _sceneClickedHotspot = -1; if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); @@ -762,10 +762,10 @@ void GnapEngine::updateMenuStatusLoadGame() { void GnapEngine::updateMenuStatusQueryQuit() { - _hotspots[0].x1 = 311; - _hotspots[0].y1 = 197; - _hotspots[0].x2 = 377; - _hotspots[0].y2 = 237; + _hotspots[0]._x1 = 311; + _hotspots[0]._y1 = 197; + _hotspots[0]._x2 = 377; + _hotspots[0]._y2 = 237; _sceneClickedHotspot = -1; diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index e084a54c76..9efe45d5ae 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -74,9 +74,9 @@ void GnapEngine::scene01_updateHotspots() { setHotspot(kHSWalkArea8, 0, 546, 300, 600); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(0)) - _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (isFlag(1)) - _hotspots[kHSMud].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSMud]._flags = SF_WALKABLE | SF_DISABLED; _hotspotsCount = 14; } @@ -259,9 +259,9 @@ void GnapEngine::scene01_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index d745b0927a..a4d62c80dc 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -79,7 +79,7 @@ void GnapEngine::scene02_updateHotspots() { setHotspot(kHSWalkArea4, 386, 0, 509, 410); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(0)) - _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspotsCount = 14; } @@ -238,10 +238,10 @@ void GnapEngine::scene02_run() { _gnapActionStatus = kASUseTruckNoGas; } } else if (_grabCursorSpriteIndex == kItemGas) { - _hotspots[kHSWalkArea4].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea4]._flags |= SF_WALKABLE; if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _gnapActionStatus = kASUseGasWithTruck; - _hotspots[kHSWalkArea4].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea4]._flags &= ~SF_WALKABLE; } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 2, 2); } else { @@ -350,9 +350,9 @@ void GnapEngine::scene02_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 6f191dc6e3..7ca1c4a2da 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -70,13 +70,13 @@ void GnapEngine::scene03_updateHotspots() { setHotspot(kHSWalkAreas3, 0, 0, 800, 354); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(0)) - _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (isFlag(6)) - _hotspots[kHSGrass].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSGrass]._flags = SF_WALKABLE | SF_DISABLED; if (isFlag(0)) - _hotspots[kHSTrappedPlatypus].flags = SF_DISABLED; + _hotspots[kHSTrappedPlatypus]._flags = SF_DISABLED; if (isFlag(0) || _s03_platypusHypnotized) - _hotspots[kHSPlatypusWalkArea].flags |= SF_WALKABLE; + _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; _hotspotsCount = 10; } @@ -181,7 +181,7 @@ void GnapEngine::scene03_run() { playGnapUseDevice(0, 0); _gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(0x1B3, 253, 5); - _hotspots[kHSGrass].flags |= SF_WALKABLE | SF_DISABLED; + _hotspots[kHSGrass]._flags |= SF_WALKABLE | SF_DISABLED; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -195,12 +195,12 @@ void GnapEngine::scene03_run() { case kHSExitTruck: if (_gnapActionStatus < 0) { _isLeavingScene = 1; - _hotspots[kHSPlatypusWalkArea].flags |= SF_WALKABLE; + _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107AD, 1); _gnapActionStatus = kASLeaveScene; if (isFlag(0)) platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, -1, 0x107C2, 1); - _hotspots[kHSPlatypusWalkArea].flags &= ~SF_WALKABLE; + _hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; if (_cursorValue == 1) _newSceneNum = 2; else @@ -219,11 +219,11 @@ void GnapEngine::scene03_run() { break; case GRAB_CURSOR: if (!isFlag(0)) - _hotspots[kHSPlatypusWalkArea].flags |= SF_WALKABLE; + _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y + 1) | 0x10000, 1)) _gnapActionStatus = kASGrabCreek; if (!isFlag(0)) - _hotspots[kHSPlatypusWalkArea].flags &= ~SF_WALKABLE; + _hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -306,9 +306,9 @@ void GnapEngine::scene03_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 37ebe34839..52fdb39d83 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -74,11 +74,11 @@ void GnapEngine::scene04_updateHotspots() { setHotspot(kHSWalkArea2, 562, 0, 800, 500); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(0)) - _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (isFlag(3)) - _hotspots[kHSTwig].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; if (isFlag(26) || _cursorValue == 1) - _hotspots[kHSAxe].flags = SF_DISABLED; + _hotspots[kHSAxe]._flags = SF_DISABLED; _hotspotsCount = 11; } @@ -385,9 +385,9 @@ void GnapEngine::scene04_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index fdc6ba16fe..fea0dc1b63 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -70,9 +70,9 @@ void GnapEngine::scene05_updateHotspots() { setHotspot(kHSWalkArea3, 0, 0, 104, 499); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(0)) - _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (isFlag(7)) - _hotspots[kHSPadlock].flags = SF_EXIT_U_CURSOR; + _hotspots[kHSPadlock]._flags = SF_EXIT_U_CURSOR; _hotspotsCount = 10; } @@ -306,9 +306,9 @@ void GnapEngine::scene05_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index 3878d3514e..7df09a1cc0 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -73,10 +73,10 @@ void GnapEngine::scene06_updateHotspots() { setHotspot(kHSWalkArea5, 0, 0, 800, 504); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(29)) - _hotspots[kHSLadder].flags = SF_DISABLED; + _hotspots[kHSLadder]._flags = SF_DISABLED; if (_cursorValue == 4) { - _hotspots[kHSLadder].flags = SF_DISABLED; - _hotspots[kHSGas].flags = SF_DISABLED; + _hotspots[kHSLadder]._flags = SF_DISABLED; + _hotspots[kHSGas]._flags = SF_DISABLED; } _hotspotsCount = 11; } @@ -174,9 +174,9 @@ void GnapEngine::scene06_run() { if (isFlag(4)) { playGnapImpossible(0, 0); } else if (triedDeviceOnGas) { - _hotspots[kHSWalkArea5].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107BC, 1); - _hotspots[kHSWalkArea5].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASTryToGetGas; } else { triedDeviceOnGas = true; @@ -225,9 +225,9 @@ void GnapEngine::scene06_run() { case kHSHorse: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemTwig && _s06_horseTurnedBack) { - _hotspots[kHSWalkArea5].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _hotspots[kHSWalkArea5].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; _gnapIdleFacing = 5; platypusWalkTo(6, 8, 1, 0x107C2, 1); _beaverFacing = 0; @@ -245,9 +245,9 @@ void GnapEngine::scene06_run() { gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { _gnapIdleFacing = 3; - _hotspots[kHSWalkArea5].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _hotspots[kHSWalkArea5].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASTalkToHorse; } break; @@ -282,9 +282,9 @@ void GnapEngine::scene06_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; @@ -383,7 +383,7 @@ void GnapEngine::scene06_updateAnimations() { _gameSys->setAnimation(0, 0, 1); invAdd(kItemGas); setFlag(29); - _hotspots[kHSLadder].flags = SF_DISABLED; + _hotspots[kHSLadder]._flags = SF_DISABLED; setGrabCursorSprite(kItemGas); _beaverActionStatus = -1; _platX = 6; diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index 9b8ee2975b..aa486b6fb1 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -54,7 +54,7 @@ void GnapEngine::scene07_updateHotspots() { setHotspot(kHSWalkArea3, 160, 0, 325, 495); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(0)) - _hotspots[kHSDice].flags = SF_DISABLED; + _hotspots[kHSDice]._flags = SF_DISABLED; _hotspotsCount = 7; } @@ -185,9 +185,9 @@ void GnapEngine::scene07_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index f7c0b9c886..29437251b6 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -68,11 +68,11 @@ void GnapEngine::scene08_updateHotspots() { setHotspot(kHSWalkArea2, 0, 0, 799, 420); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(7)) - _hotspots[kHSMeat].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED; if (isFlag(8)) - _hotspots[kHSBone].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED; if (isFlag(9)) - _hotspots[kHSToy].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSToy]._flags = SF_WALKABLE | SF_DISABLED; _hotspotsCount = 11; } @@ -346,10 +346,10 @@ void GnapEngine::scene08_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapActionIdle(0x14D); gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; @@ -474,17 +474,17 @@ void GnapEngine::scene08_updateAnimations() { switch (_s08_nextDogSequenceId) { case 0x149: setFlag(7); - _hotspots[kHSMeat].flags = SF_DISABLED | SF_WALKABLE; + _hotspots[kHSMeat]._flags = SF_DISABLED | SF_WALKABLE; _gameSys->removeSequence(0x144, 1, true); break; case 0x14A: setFlag(8); - _hotspots[kHSBone].flags = SF_DISABLED | SF_WALKABLE; + _hotspots[kHSBone]._flags = SF_DISABLED | SF_WALKABLE; _gameSys->removeSequence(0x145, 1, true); break; case 0x14B: setFlag(9); - _hotspots[kHSToy].flags = SF_DISABLED | SF_WALKABLE; + _hotspots[kHSToy]._flags = SF_DISABLED | SF_WALKABLE; _gameSys->removeSequence(0x146, 1, true); break; } diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 3654be55f4..69165ce8f0 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -167,9 +167,9 @@ void GnapEngine::scene09_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index 32162e2b21..54cf5b5d89 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -309,10 +309,10 @@ void GnapEngine::scene10_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapActionIdle(0x10C); gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 3a112b9e9f..8097b23e73 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -85,7 +85,7 @@ void GnapEngine::scene11_run() { _timers[7] = 50; - _hotspots[kHSBillard].flags |= SF_DISABLED; + _hotspots[kHSBillard]._flags |= SF_DISABLED; _s11_currGoggleGuySequenceId = 0x1F9; @@ -290,9 +290,9 @@ void GnapEngine::scene11_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; @@ -434,7 +434,7 @@ void GnapEngine::scene11_updateAnimations() { _s11_nextHookGuySequenceId = -1; _timers[4] = getRandom(40) + 20; _gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, getSequenceTotalDuration(0x1F4) - 5, 0, 0); - _hotspots[kHSBillard].flags |= SF_DISABLED; + _hotspots[kHSBillard]._flags |= SF_DISABLED; _gameSys->setAnimation(0x207, 257, 4); _gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, getSequenceTotalDuration(0x1FE), 0, 0); _gnapActionStatus = -1; @@ -480,7 +480,7 @@ void GnapEngine::scene11_updateAnimations() { if (_gameSys->getAnimationStatus(4) == 2) { _gameSys->setAnimation(0, 0, 4); - _hotspots[kHSBillard].flags &= ~SF_DISABLED; + _hotspots[kHSBillard]._flags &= ~SF_DISABLED; } } diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index 076fa0408d..4bc10fcb43 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -296,9 +296,9 @@ void GnapEngine::scene12_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 729fdebf31..233b7544b2 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -87,10 +87,10 @@ void GnapEngine::scene13_showScribble() { hideCursor(); _largeSprite = _gameSys->createSurface(0x6F); _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); - while (!_mouseClickState.left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && + while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29)) gameUpdateTick(); - _mouseClickState.left = false; + _mouseClickState._left = false; clearKeyStatus1(Common::KEYCODE_ESCAPE); clearKeyStatus1(29); clearKeyStatus1(Common::KEYCODE_SPACE); @@ -305,9 +305,9 @@ void GnapEngine::scene13_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp index 4f799db977..b4e68a82b4 100644 --- a/engines/gnap/scenes/scene14.cpp +++ b/engines/gnap/scenes/scene14.cpp @@ -47,7 +47,7 @@ void GnapEngine::scene14_updateHotspots() { setHotspot(kHSToilet, 225, 250, 510, 500, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(2)) - _hotspots[kHSCoin].flags = SF_DISABLED; + _hotspots[kHSCoin]._flags = SF_DISABLED; _hotspotsCount = 5; } @@ -143,7 +143,7 @@ void GnapEngine::scene14_run() { break; default: - _mouseClickState.left = false; + _mouseClickState._left = false; break; } diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp index 578f4fcba1..f9fb3efbe6 100644 --- a/engines/gnap/scenes/scene15.cpp +++ b/engines/gnap/scenes/scene15.cpp @@ -94,10 +94,10 @@ void GnapEngine::scene15_run() { updateMouseCursor(); updateCursorByHotspot(); - _hotspots[kHSPlatypus].x1 = 0; - _hotspots[kHSPlatypus].y1 = 0; - _hotspots[kHSPlatypus].x2 = 0; - _hotspots[kHSPlatypus].y2 = 0; + _hotspots[kHSPlatypus]._x1 = 0; + _hotspots[kHSPlatypus]._y1 = 0; + _hotspots[kHSPlatypus]._x2 = 0; + _hotspots[kHSPlatypus]._y2 = 0; _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); @@ -222,7 +222,7 @@ void GnapEngine::scene15_run() { break; default: - _mouseClickState.left = false; + _mouseClickState._left = false; break; } diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index 5b7c54c0a8..c86df4c8a3 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -73,10 +73,10 @@ void GnapEngine::scene17_updateHotspots() { setHotspot(kHSWalkArea3, 0, 204, 173, 468); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(6)) - _hotspots[kHSWrench].flags = 0; + _hotspots[kHSWrench]._flags = SF_NONE; if (isFlag(26)) { - _hotspots[kHSDevice].flags = SF_DISABLED; - _hotspots[kHSPlatypus].flags = SF_DISABLED; + _hotspots[kHSDevice]._flags = SF_DISABLED; + _hotspots[kHSPlatypus]._flags = SF_DISABLED; } _hotspotsCount = 10; } @@ -85,9 +85,9 @@ void GnapEngine::scene17_update() { gameUpdateTick(); updateMouseCursor(); updateGrabCursorSprite(0, 0); - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } } @@ -476,9 +476,9 @@ void GnapEngine::scene17_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = 0; + _mouseClickState._left = 0; } break; } @@ -742,9 +742,9 @@ void GnapEngine::scene17_updateAnimations() { case 0x22E: case 0x235: if (_s17_nextWrenchSequenceId == 0x235) - _hotspots[kHSWrench].flags &= ~SF_DISABLED; + _hotspots[kHSWrench]._flags &= ~SF_DISABLED; else - _hotspots[kHSWrench].flags |= SF_DISABLED; + _hotspots[kHSWrench]._flags |= SF_DISABLED; _s17_canTryGetWrench = !_s17_canTryGetWrench; _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index ff43a5d202..7363468dc2 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -88,39 +88,39 @@ void GnapEngine::scene18_updateHotspots() { setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(8)) { if (isFlag(9)) { - _hotspots[kHSHydrantTopValve].flags = SF_DISABLED; - _hotspots[kHSHydrantRightValve].x1 = 148; - _hotspots[kHSHydrantRightValve].y1 = 403; - _hotspots[kHSGarbageCan].flags = SF_DISABLED; + _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; + _hotspots[kHSHydrantRightValve]._x1 = 148; + _hotspots[kHSHydrantRightValve]._y1 = 403; + _hotspots[kHSGarbageCan]._flags = SF_DISABLED; _hotspotsWalkPos[kHSGarbageCan].x = 3; _hotspotsWalkPos[kHSGarbageCan].y = 7; } else { - _hotspots[kHSHydrantTopValve].y1 = 246; + _hotspots[kHSHydrantTopValve]._y1 = 246; } } else if (isFlag(7)) { - _hotspots[kHSHydrantRightValve].flags = SF_DISABLED; - _hotspots[kHSHydrantTopValve].x1 = 105; - _hotspots[kHSHydrantTopValve].x2 = 192; + _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; + _hotspots[kHSHydrantTopValve]._x1 = 105; + _hotspots[kHSHydrantTopValve]._x2 = 192; } else if (isFlag(9)) { - _hotspots[kHSGarbageCan].x1 = 115; - _hotspots[kHSGarbageCan].y1 = 365; - _hotspots[kHSGarbageCan].x2 = 168; - _hotspots[kHSGarbageCan].y2 = 470; - _hotspots[kHSGarbageCan].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSGarbageCan]._x1 = 115; + _hotspots[kHSGarbageCan]._y1 = 365; + _hotspots[kHSGarbageCan]._x2 = 168; + _hotspots[kHSGarbageCan]._y2 = 470; + _hotspots[kHSGarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspotsWalkPos[kHSGarbageCan].x = 3; _hotspotsWalkPos[kHSGarbageCan].y = 7; } if (isFlag(10)) - _hotspots[kHSGarbageCan].flags = SF_DISABLED; + _hotspots[kHSGarbageCan]._flags = SF_DISABLED; if (isFlag(26)) { - _hotspots[kHSDevice].flags = SF_DISABLED; - _hotspots[kHSHydrantTopValve].flags = SF_DISABLED; - _hotspots[kHSHydrantRightValve].flags = SF_DISABLED; - _hotspots[kHSPlatypus].flags = SF_DISABLED; + _hotspots[kHSDevice]._flags = SF_DISABLED; + _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; + _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; + _hotspots[kHSPlatypus]._flags = SF_DISABLED; } if (isFlag(14)) { - _hotspots[kHSHydrantTopValve].flags = SF_DISABLED; - _hotspots[kHSCowboyHat].flags = SF_DISABLED; + _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; + _hotspots[kHSCowboyHat]._flags = SF_DISABLED; } _hotspotsCount = 11; } @@ -571,9 +571,9 @@ void GnapEngine::scene18_run() { break; case GRAB_CURSOR: if (isFlag(7)) { - _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); - _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASCloseTopValve; } else playGnapImpossible(0, 0); @@ -679,14 +679,14 @@ void GnapEngine::scene18_run() { scene18_closeHydrantValve(); _isLeavingScene = 1; _newSceneNum = 20; - _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); _gnapActionStatus = kASLeaveScene; if (isFlag(26)) scene18_platEndPhoning(0); else platypusWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y - 1, -1, 0x107CF, 1); - _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -699,19 +699,19 @@ void GnapEngine::scene18_run() { } else { gnapWalkTo(-1, -1, -1, -1, 1); } - _mouseClickState.left = false; + _mouseClickState._left = false; } break; default: - if (_gnapActionStatus != kASStandingOnHydrant && _mouseClickState.left) { + if (_gnapActionStatus != kASStandingOnHydrant && _mouseClickState._left) { if (isFlag(10)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } else { gnapWalkTo(-1, -1, -1, -1, 1); } - _mouseClickState.left = false; + _mouseClickState._left = false; } break; @@ -739,11 +739,11 @@ void GnapEngine::scene18_run() { clearFlag(26); } } else { - _hotspots[kHSWalkArea1].y2 += 48; - _hotspots[kHSWalkArea2].x1 += 75; + _hotspots[kHSWalkArea1]._y2 += 48; + _hotspots[kHSWalkArea2]._x1 += 75; updateBeaverIdleSequence(); - _hotspots[kHSWalkArea2].x1 -= 75; - _hotspots[kHSWalkArea1].y2 -= 48; + _hotspots[kHSWalkArea2]._x1 -= 75; + _hotspots[kHSWalkArea1]._y2 -= 48; } if (!_timers[5]) { _timers[5] = getRandom(100) + 100; @@ -831,9 +831,9 @@ void GnapEngine::scene18_updateAnimations() { playGnapPullOutDevice(2, 7); playGnapUseDevice(0, 0); _gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); - _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BB, 1); - _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASOpenTopValveDone; break; case kASOpenTopValveDone: @@ -929,9 +929,9 @@ void GnapEngine::scene18_updateAnimations() { playGnapPullOutDevice(2, 7); playGnapUseDevice(0, 0); _gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); - _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; if (_gnapActionStatus == kASOpenRightValveNoGarbageCan) _gnapActionStatus = kASOpenRightValveNoGarbageCanDone; else diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index ebfdd728a1..60208bc381 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -81,17 +81,17 @@ void GnapEngine::scene19_updateHotspots() { setHotspot(kHSWalkArea3, 0, 0, 800, 437); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(26)) { - _hotspots[kHSToy1].flags = SF_DISABLED; - _hotspots[kHSToy2].flags = SF_DISABLED; - _hotspots[kHSToy3].flags = SF_DISABLED; - _hotspots[kHSToy4].flags = SF_DISABLED; - _hotspots[kHSToy5].flags = SF_DISABLED; - _hotspots[kHSToy6].flags = SF_DISABLED; - _hotspots[kHSToy7].flags = SF_DISABLED; - _hotspots[kHSShopAssistant].flags = SF_DISABLED; - _hotspots[kHSPhone].flags = SF_DISABLED; - _hotspots[kHSPlatypus].flags = SF_DISABLED; - _hotspots[kHSPicture].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSToy1]._flags = SF_DISABLED; + _hotspots[kHSToy2]._flags = SF_DISABLED; + _hotspots[kHSToy3]._flags = SF_DISABLED; + _hotspots[kHSToy4]._flags = SF_DISABLED; + _hotspots[kHSToy5]._flags = SF_DISABLED; + _hotspots[kHSToy6]._flags = SF_DISABLED; + _hotspots[kHSToy7]._flags = SF_DISABLED; + _hotspots[kHSShopAssistant]._flags = SF_DISABLED; + _hotspots[kHSPhone]._flags = SF_DISABLED; + _hotspots[kHSPlatypus]._flags = SF_DISABLED; + _hotspots[kHSPicture]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; } _hotspotsCount = 16; } @@ -182,14 +182,14 @@ void GnapEngine::scene19_run() { if (_gnapActionStatus < 0) { _isLeavingScene = true; _newSceneNum = 18; - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107B2, 1); _gnapActionStatus = kASLeaveScene; if (isFlag(26)) setFlag(27); else platypusWalkTo(_hotspotsWalkPos[1].x + 1, _hotspotsWalkPos[1].y, -1, 0x107C5, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; } break; @@ -300,9 +300,9 @@ void GnapEngine::scene19_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = 0; + _mouseClickState._left = 0; } } diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 136f234bce..41a0cc4f79 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -266,10 +266,10 @@ void GnapEngine::scene20_run() { initGnapPos(8, 6, 3); initBeaverPos(9, 6, 4); endSceneInit(); - _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 9, -1, 0x107C2, 1); - _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; break; } } @@ -351,11 +351,11 @@ void GnapEngine::scene20_run() { _timers[4] = 0; _isLeavingScene = 1; _newSceneNum = 18; - _hotspots[kHSWalkArea2].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); - _hotspots[kHSWalkArea2].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -479,9 +479,9 @@ void GnapEngine::scene20_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; @@ -494,9 +494,9 @@ void GnapEngine::scene20_run() { if (!_isLeavingScene) { if (_beaverActionStatus < 0) { - _hotspots[kHSWalkArea1].y2 += 48; + _hotspots[kHSWalkArea1]._y2 += 48; updateBeaverIdleSequence(); - _hotspots[kHSWalkArea1].y2 -= 48; + _hotspots[kHSWalkArea1]._y2 -= 48; } if (_gnapActionStatus < 0) updateGnapIdleSequence(); diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index 56da904ce1..6f1f406ad2 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -60,9 +60,9 @@ void GnapEngine::scene21_updateHotspots() { setHotspot(kHSWalkArea2, 698, 0, 800, 600); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(4) || !isFlag(3)) - _hotspots[kHSBanana].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSBanana]._flags = SF_WALKABLE | SF_DISABLED; if (isFlag(3)) - _hotspots[kHSOldLady].flags = SF_DISABLED; + _hotspots[kHSOldLady]._flags = SF_DISABLED; _hotspotsCount = 7; } @@ -187,10 +187,10 @@ void GnapEngine::scene21_run() { break; case GRAB_CURSOR: _gnapIdleFacing = 5; - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(7, 6, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabOldLady; - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: _gnapIdleFacing = 7; @@ -221,9 +221,9 @@ void GnapEngine::scene21_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index 0290666daa..5c390d66e5 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -212,9 +212,9 @@ void GnapEngine::scene22_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index cafeb71a56..7257ab1753 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -185,9 +185,9 @@ void GnapEngine::scene23_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp index 236ee7d30a..b7660a3723 100644 --- a/engines/gnap/scenes/scene24.cpp +++ b/engines/gnap/scenes/scene24.cpp @@ -171,9 +171,9 @@ void GnapEngine::scene24_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index cb82658cc2..1539b319cf 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -91,11 +91,11 @@ void GnapEngine::scene25_playAnims(int index) { } _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); delayTicksCursor(5); - while (!_mouseClickState.left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_SPACE) && + while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29)) { gameUpdateTick(); } - _mouseClickState.left = false; + _mouseClickState._left = false; clearKeyStatus1(Common::KEYCODE_ESCAPE); clearKeyStatus1(29); clearKeyStatus1(Common::KEYCODE_SPACE); @@ -223,16 +223,16 @@ void GnapEngine::scene25_run() { if (isFlag(2)) { _isLeavingScene = true; _newSceneNum = 26; - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; } else { - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(4, 5, 0, 0x107BB, 1); _gnapActionStatus = kASEnterCircusWihoutTicket; - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; } } break; @@ -274,9 +274,9 @@ void GnapEngine::scene25_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; @@ -356,10 +356,10 @@ void GnapEngine::scene25_updateAnimations() { _gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; _s25_nextTicketVendorSequenceId = -1; - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; playGnapIdle(0, 0); gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, -1, 0x107BB, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASEnterCircusWihoutTicketDone; break; case kASEnterCircusWihoutTicketDone: diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index 644db6b3fd..974525d55a 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -187,9 +187,9 @@ void GnapEngine::scene26_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 000a94203c..720080d1ec 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -64,7 +64,7 @@ void GnapEngine::scene27_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 800, 507); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(13)) - _hotspots[kHSBucket].flags = SF_DISABLED; + _hotspots[kHSBucket]._flags = SF_DISABLED; _hotspotsCount = 9; } @@ -252,9 +252,9 @@ void GnapEngine::scene27_run() { _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitClown].x + 1, _hotspotsWalkPos[kHSExitClown].y, -1, 0x107C4, 1); } else { - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitClown].x, 7, 0, 0x107BC, 1); - _hotspots[kHSWalkArea1].flags &= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= SF_WALKABLE; _gnapActionStatus = kASTryEnterClownTent; } } @@ -266,9 +266,9 @@ void GnapEngine::scene27_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; @@ -337,7 +337,7 @@ void GnapEngine::scene27_updateAnimations() { case kASGrabBucket: playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); - _hotspots[kHSBucket].flags = SF_DISABLED; + _hotspots[kHSBucket]._flags = SF_DISABLED; invAdd(kItemEmptyBucket); setFlag(13); _gameSys->setAnimation(0xD2, 39, 0); @@ -361,9 +361,9 @@ void GnapEngine::scene27_updateAnimations() { _gnapActionStatus = kASTryEnterClownTentDone; break; case kASTryEnterClownTentDone: - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; _gnapActionStatus = -1; break; case kASEnterClownTent: diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index 251e3b48f4..e39bb8d92d 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -65,9 +65,9 @@ void GnapEngine::scene28_updateHotspots() { setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (invHas(kItemHorn)) - _hotspots[kHSHorn].flags = SF_DISABLED; + _hotspots[kHSHorn]._flags = SF_DISABLED; if (isFlag(22)) - _hotspots[kHSEmptyBucket].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspotsCount = 8; } @@ -178,9 +178,9 @@ void GnapEngine::scene28_run() { } else { _gnapIdleFacing = 5; gnapWalkTo(2, 8, 0, 0x107BB, 1); - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASGrabHornFails; } break; @@ -237,10 +237,10 @@ void GnapEngine::scene28_run() { if (_gnapActionStatus < 0) { _isLeavingScene = true; _newSceneNum = 27; - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); _gnapActionStatus = kASLeaveScene; - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); } break; @@ -276,9 +276,9 @@ void GnapEngine::scene28_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 4433c0a725..666ec9e845 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -54,7 +54,7 @@ void GnapEngine::scene29_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 800, 478); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (invHas(kItemHorn)) - _hotspots[kHSMonkey].flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSMonkey]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspotsCount = 7; } @@ -221,9 +221,9 @@ void GnapEngine::scene29_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; } diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 85e6614f91..48b97bdaae 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -127,9 +127,9 @@ void GnapEngine::scene30_run() { case kHSPillMachine: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemDiceQuarterHole && !isFlag(23)) { - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASUsePillMachine; hasTakenPill = true; } else if (_grabCursorSpriteIndex >= 0) { @@ -171,9 +171,9 @@ void GnapEngine::scene30_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 39bb1bb267..17cde86db4 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -151,9 +151,9 @@ void GnapEngine::scene31_run() { break; case GRAB_CURSOR: gnapWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, -1, -1, 1); - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 0, 0x107B9, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; _gnapActionStatus = kASUseMeasuringClown; _timers[4] = 300; break; @@ -164,9 +164,9 @@ void GnapEngine::scene31_run() { if (!invHas(kItemBucketWithBeer)) { gnapUseDeviceOnBeaver(); platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, 1, 0x107C2, 1); - _hotspots[kHSWalkArea1].flags |= SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); - _hotspots[kHSWalkArea1].flags &= ~SF_WALKABLE; + _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; _beaverActionStatus = kASPlatMeasuringClown; _gnapActionStatus = kASPlatMeasuringClown; _timers[4] = 300; @@ -241,9 +241,9 @@ void GnapEngine::scene31_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; } diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index 9eaf4d232d..fca05ee7b4 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -150,9 +150,9 @@ void GnapEngine::scene32_run() { } - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = 0; + _mouseClickState._left = 0; } scene32_updateAnimations(); diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index fc66b15b65..b601d5fab1 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -222,9 +222,9 @@ void GnapEngine::scene33_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index f807728bae..a53d5b0691 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -73,21 +73,21 @@ void GnapEngine::scene38_updateHotspots() { setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (_beaverActionStatus == kASBeaverHoldingTrapDoor) - _hotspots[kHSPlatypus].flags = SF_WALKABLE | SF_DISABLED; + _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; if (_beaverActionStatus == kASBeaverHoldingTrapDoor) - _hotspots[kHSExitCave].flags = SF_EXIT_D_CURSOR; + _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSExitCave].flags = SF_EXIT_D_CURSOR; + _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; if (_beaverActionStatus == kASBeaverHoldingTrapDoor) - _hotspots[kHSTrapDoorLid1].flags = SF_DISABLED; + _hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSTrapDoorLid1].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_beaverActionStatus == kASBeaverHoldingTrapDoor) - _hotspots[kHSTrapDoorLid2].flags = SF_DISABLED; + _hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSTrapDoorLid2].flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_beaverActionStatus == kASBeaverHoldingTrapDoor) - _hotspots[kHSWalkArea6].flags = 0; + _hotspots[kHSWalkArea6]._flags = SF_NONE; _hotspotsCount = 13; } @@ -224,12 +224,12 @@ void GnapEngine::scene38_run() { break; default: - if (_mouseClickState.left) { + if (_mouseClickState._left) { if (_gnapActionStatus == kASHoldingHuntingTrophy) _gnapActionStatus = kASReleaseHuntingTrophy; else if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index 4ba8e16b05..b8a5f1e724 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -172,9 +172,9 @@ void GnapEngine::scene39_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) { + if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState.left = false; + _mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index fe91dbf777..99b62f6330 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -156,8 +156,8 @@ void GnapEngine::scene40_run() { break; default: - if (_mouseClickState.left && _gnapActionStatus < 0) - _mouseClickState.left = false; + if (_mouseClickState._left && _gnapActionStatus < 0) + _mouseClickState._left = false; break; } diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index ff90193888..b84c4ba988 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -168,10 +168,10 @@ void GnapEngine::scene41_run() { playSound(0x1094B, 1); if (!isFlag(12)) { - _hotspots[kHSToyUfo].x1 = _toyUfoX - 25; - _hotspots[kHSToyUfo].y1 = _toyUfoY - 20; - _hotspots[kHSToyUfo].x2 = _toyUfoX + 25; - _hotspots[kHSToyUfo].y2 = _toyUfoY + 20; + _hotspots[kHSToyUfo]._x1 = _toyUfoX - 25; + _hotspots[kHSToyUfo]._y1 = _toyUfoY - 20; + _hotspots[kHSToyUfo]._x2 = _toyUfoX + 25; + _hotspots[kHSToyUfo]._y2 = _toyUfoY + 20; } updateMouseCursor(); @@ -354,8 +354,8 @@ void GnapEngine::scene41_run() { } } - if (_mouseClickState.left && _gnapActionStatus < 0) { - _mouseClickState.left = false; + if (_mouseClickState._left && _gnapActionStatus < 0) { + _mouseClickState._left = false; if (isFlag(12)) { int sequenceId; if (_leftClickMouseX >= 400) { diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 33f437b8c6..c15919a1e1 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -73,7 +73,7 @@ void GnapEngine::scene42_updateHotspots() { setHotspot(kHSUfoHotSauce, 335, 110, 440, 175, SF_DISABLED); setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); if ((isFlag(20) || isFlag(18)) && isFlag(23) && !isFlag(24)) - _hotspots[kHSUfoHotSauce].flags = SF_GRAB_CURSOR; + _hotspots[kHSUfoHotSauce]._flags = SF_GRAB_CURSOR; _hotspotsCount = 5; } else { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); @@ -311,8 +311,8 @@ void GnapEngine::scene42_run() { } - if (_mouseClickState.left && _gnapActionStatus < 0) { - _mouseClickState.left = false; + if (_mouseClickState._left && _gnapActionStatus < 0) { + _mouseClickState._left = false; if (isFlag(12)) { _toyUfoActionStatus = kASToyUfoRefresh; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 611e5c9bd3..f7ba272082 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -63,10 +63,10 @@ void GnapEngine::scene43_updateHotspots() { setHotspot(kHSUfoBucket, 475, 290, 545, 365, SF_DISABLED); setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); if (isFlag(19)) - _hotspots[kHSUfoBucket].flags = SF_GRAB_CURSOR; + _hotspots[kHSUfoBucket]._flags = SF_GRAB_CURSOR; // NOTE Bug in the original. Key hotspot wasn't disabled. if (isFlag(14)) - _hotspots[kHSUfoKey].flags = SF_DISABLED; + _hotspots[kHSUfoKey]._flags = SF_DISABLED; _hotspotsCount = 6; } else { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); @@ -80,7 +80,7 @@ void GnapEngine::scene43_updateHotspots() { setHotspot(kHSWalkArea2, 465, 0, 800, 493); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(14)) - _hotspots[kHSKey].flags = SF_DISABLED; + _hotspots[kHSKey]._flags = SF_DISABLED; _hotspotsCount = 10; } } @@ -311,8 +311,8 @@ void GnapEngine::scene43_run() { } - if (_mouseClickState.left && _gnapActionStatus < 0) { - _mouseClickState.left = false; + if (_mouseClickState._left && _gnapActionStatus < 0) { + _mouseClickState._left = false; if (isFlag(12) && (_toyUfoActionStatus == 5 || _toyUfoActionStatus == -1)) { _toyUfoActionStatus = 5; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 27336950c6..bcc435ebc8 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -72,9 +72,9 @@ void GnapEngine::scene44_updateHotspots() { setHotspot(kHSWalkArea2, 617, 0, 800, 600); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(13)) - _hotspots[kHSKissingLady].flags = SF_DISABLED; + _hotspots[kHSKissingLady]._flags = SF_DISABLED; if (isFlag(15)) - _hotspots[kHSSpring].flags = SF_DISABLED; + _hotspots[kHSSpring]._flags = SF_DISABLED; _hotspotsCount = 10; } } @@ -356,8 +356,8 @@ void GnapEngine::scene44_run() { } - if (_mouseClickState.left && _gnapActionStatus < 0) { - _mouseClickState.left = false; + if (_mouseClickState._left && _gnapActionStatus < 0) { + _mouseClickState._left = false; if (isFlag(12)) { _toyUfoActionStatus = 7; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index ba583045e5..3e1b5299b9 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -70,14 +70,14 @@ void GnapEngine::scene45_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 800, 472); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(22)) { - _hotspots[kHSPlatypus].flags = SF_DISABLED; - _hotspots[kHSExitUfoParty].flags = SF_DISABLED; - _hotspots[kHSExitShoe].flags = SF_DISABLED; - _hotspots[kHSExitRight].flags = SF_DISABLED; - _hotspots[kHSExitDiscoBall].flags = SF_EXIT_U_CURSOR; + _hotspots[kHSPlatypus]._flags = SF_DISABLED; + _hotspots[kHSExitUfoParty]._flags = SF_DISABLED; + _hotspots[kHSExitShoe]._flags = SF_DISABLED; + _hotspots[kHSExitRight]._flags = SF_DISABLED; + _hotspots[kHSExitDiscoBall]._flags = SF_EXIT_U_CURSOR; } if (isFlag(23) || isFlag(22)) - _hotspots[kHSDiscoBall].flags = SF_DISABLED; + _hotspots[kHSDiscoBall]._flags = SF_DISABLED; _hotspotsCount = 8; } } @@ -327,8 +327,8 @@ void GnapEngine::scene45_run() { } - if (_mouseClickState.left && _gnapActionStatus < 0) { - _mouseClickState.left = false; + if (_mouseClickState._left && _gnapActionStatus < 0) { + _mouseClickState._left = false; if (isFlag(12)) { _toyUfoActionStatus = 3; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 86855bbdf2..ec061138d3 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -271,8 +271,8 @@ void GnapEngine::scene46_run() { } - if (_mouseClickState.left && _gnapActionStatus < 0) { - _mouseClickState.left = false; + if (_mouseClickState._left && _gnapActionStatus < 0) { + _mouseClickState._left = false; if (isFlag(12)) { _toyUfoActionStatus = 4; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index 20486eb34e..cc7b7915b2 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -159,7 +159,7 @@ void GnapEngine::scene53_runChitChatLine() { _s53_currHandSequenceId = 0x5E; } - _hotspots[1].flags = SF_DISABLED; + _hotspots[1]._flags = SF_DISABLED; while (!flag) { -- cgit v1.2.3 From e7e585fd9b0279272b9d966a5b1bf36c52baa49d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Mar 2016 07:41:05 +0100 Subject: GNAP: Reduce variable scope, some renaming --- engines/gnap/scenes/scene10.cpp | 2 +- engines/gnap/scenes/scene18.cpp | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index 54cf5b5d89..e2da08e3bd 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -328,10 +328,10 @@ void GnapEngine::scene10_run() { playSound(0x12B, 0); } if (!_timers[5]) { - int sequenceId; _timers[5] = getRandom(100) + 100; _gnapRandomValue = getRandom(4); if (_gnapRandomValue) { + int sequenceId; if (_gnapRandomValue == 1) { sequenceId = 0x8A5; } else if (_gnapRandomValue == 2) { diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 7363468dc2..e00b525209 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -134,7 +134,7 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, }; int gnapSeqId, gnapId, gnapDatNum, gnapGridX; - int v13, v12, v5, v10, v11, v15, v16, a2; + int v13, v12, v5, v10, v11, direction; if (x >= 0) v13 = x; @@ -161,9 +161,9 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, gnapDatNum = _gnapSequenceDatNum; gnapGridX = _gnapX; if (_gnapX <= v13) - v15 = 1; + direction = 1; else - v15 = -1; + direction = -1; } else { if (_gnapY == _platY) { if (v12 >= _gnapX) { @@ -177,23 +177,24 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, gnapId = _gnapId; gnapDatNum = _gnapSequenceDatNum; gnapGridX = _gnapX; - if (v12 < _gnapX) - v15 = -1; - else - v15 = 1; - v16 = v15 == -1; - a2 = 20 * _gnapY + 1; + int seqId = 0; + if (v12 < _gnapX) { + direction = -1; + seqId = 1; + } else + direction = 1; + int a2 = 20 * _gnapY + 1; do { - if (isPointBlocked(gnapGridX + v15, _gnapY)) + if (isPointBlocked(gnapGridX + direction, _gnapY)) break; - a2 += v15; - _gameSys->insertSequence(kSequenceIds[v16], a2, + a2 += direction; + _gameSys->insertSequence(kSequenceIds[seqId], a2, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqSyncWait, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); - gnapSeqId = kSequenceIds[v16]; + gnapSeqId = kSequenceIds[seqId]; gnapId = a2; gnapDatNum = 0; - gnapGridX += v15; + gnapGridX += direction; } while (v12 != gnapGridX); } @@ -201,14 +202,14 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, _gnapSequenceId = ridToEntryIndex(argC); _gnapSequenceDatNum = ridToDatIndex(argC); } else { - if (v15 == 1) + if (direction == 1) _gnapSequenceId = 0x20A; else _gnapSequenceId = 0x209; _gnapSequenceDatNum = 0; } - if (v15 == 1) + if (direction == 1) _gnapIdleFacing = 1; else _gnapIdleFacing = 3; -- cgit v1.2.3 From cfaa49f5fd8be46ca448b09aec2869a49ba7e197 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Mar 2016 07:49:30 +0100 Subject: GNAP: Reduce variable scope, some renaming. Change the type of parameter to boolean --- engines/gnap/gnap.h | 4 ++-- engines/gnap/scenes/scene18.cpp | 32 ++++++++++++++++---------------- engines/gnap/scenes/scene42.cpp | 3 +-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 7894ebd209..c05706dffb 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -690,9 +690,9 @@ public: Graphics::Surface *_s18_cowboyHatSurface; int scene18_init(); void scene18_updateHotspots(); - void scene18_gnapCarryGarbageCanTo(int a1, int arg4, int animationIndex, int argC, int a5); + void scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5); void scene18_putDownGarbageCan(int animationIndex); - void scene18_platEndPhoning(int a1); + void scene18_platEndPhoning(bool platFl); void scene18_closeHydrantValve(); void scene18_waitForGnapAction(); void scene18_run(); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index e00b525209..4d16486818 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -126,24 +126,24 @@ void GnapEngine::scene18_updateHotspots() { } void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { + // CHECKME: (x, y) is always set to (-1, -1) - // TODO Cleanup - + // TODO Cleanup static const int kSequenceIds[] = { 0x203, 0x204 }; int gnapSeqId, gnapId, gnapDatNum, gnapGridX; - int v13, v12, v5, v10, v11, direction; + int clippedX, v12, v5, v10, v11, direction; if (x >= 0) - v13 = x; + clippedX = x; else - v13 = (_leftClickMouseX - _gridMinX + 37) / 75; - if (v13 >= _gnapX) - v10 = v13 - 1; + clippedX = (_leftClickMouseX - _gridMinX + 37) / 75; + if (clippedX >= _gnapX) + v10 = clippedX - 1; else - v10 = v13 + 1; + v10 = clippedX + 1; if (a5 < 0) a5 = 4; @@ -160,7 +160,7 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, gnapId = _gnapId; gnapDatNum = _gnapSequenceDatNum; gnapGridX = _gnapX; - if (_gnapX <= v13) + if (_gnapX <= clippedX) direction = 1; else direction = -1; @@ -257,7 +257,7 @@ void GnapEngine::scene18_putDownGarbageCan(int animationIndex) { gameUpdateTick(); } -void GnapEngine::scene18_platEndPhoning(int a1) { +void GnapEngine::scene18_platEndPhoning(bool platFl) { if (isFlag(26)) { _s18_platPhoneIter = 0; _s18_platPhoneCtr = 0; @@ -271,7 +271,7 @@ void GnapEngine::scene18_platEndPhoning(int a1) { _gameSys->removeSequence(0x21F, 254, true); _gameSys->setAnimation(0, 0, 3); clearFlag(26); - if (a1) { + if (platFl) { _beaverActionStatus = kASPlatComesHere; _timers[6] = 50; _sceneWaiting = true; @@ -355,7 +355,7 @@ void GnapEngine::scene18_run() { _gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); _s18_currPhoneSequenceId = -1; - scene18_platEndPhoning(1); + scene18_platEndPhoning(true); clearFlag(27); } else { _s18_currPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr]; @@ -365,7 +365,7 @@ void GnapEngine::scene18_run() { endSceneInit(); } if (isFlag(27)) { - scene18_platEndPhoning(1); + scene18_platEndPhoning(true); clearFlag(27); } else { _gameSys->setAnimation(_s18_currPhoneSequenceId, 254, 3); @@ -487,7 +487,7 @@ void GnapEngine::scene18_run() { playGnapImpossible(0, 0); } else { if (isFlag(26)) - scene18_platEndPhoning(1); + scene18_platEndPhoning(true); if (_grabCursorSpriteIndex >= 0) { if (!isFlag(9)) playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), @@ -684,7 +684,7 @@ void GnapEngine::scene18_run() { gnapWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); _gnapActionStatus = kASLeaveScene; if (isFlag(26)) - scene18_platEndPhoning(0); + scene18_platEndPhoning(false); else platypusWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y - 1, -1, 0x107CF, 1); _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; @@ -1018,7 +1018,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); _s18_currPhoneSequenceId = _s18_nextPhoneSequenceId; } else { - scene18_platEndPhoning(1); + scene18_platEndPhoning(true); } } diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index c15919a1e1..1399cbe8ad 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -374,8 +374,6 @@ void GnapEngine::scene42_run() { } void GnapEngine::scene42_updateAnimations() { - int sequenceId; - if (_gameSys->getAnimationStatus(0) == 2) { switch (_gnapActionStatus) { case kASLeaveScene: @@ -391,6 +389,7 @@ void GnapEngine::scene42_updateAnimations() { case kASUseQuarterWithBBQVendor: case kASGrabChickenLeg: if (_gameSys->getAnimationStatus(2) == 2) { + int sequenceId; if (_gnapActionStatus == kASUseQuarterWithBBQVendor) { invRemove(kItemDiceQuarterHole); invAdd(kItemChickenBucket); -- cgit v1.2.3 From b6ba5cfd89bed28dfab39f5af7b445b0041c2c7e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Mar 2016 01:32:32 +0100 Subject: GNAP: Reduce the scope of a couple of variables, make use of enum values in calls to InsertSequence --- engines/gnap/gnap.cpp | 42 +++++++++++++++++++++-------------------- engines/gnap/grid.cpp | 16 ++++++++++++++-- engines/gnap/scenes/scene02.cpp | 2 +- engines/gnap/scenes/scene03.cpp | 4 ++-- engines/gnap/scenes/scene13.cpp | 1 + engines/gnap/scenes/scene17.cpp | 3 ++- engines/gnap/scenes/scene18.cpp | 6 +++++- engines/gnap/scenes/scene20.cpp | 20 ++++++++++---------- engines/gnap/scenes/scene25.cpp | 2 +- engines/gnap/scenes/scene27.cpp | 2 +- engines/gnap/scenes/scene47.cpp | 4 ++-- engines/gnap/scenes/scene49.cpp | 6 +++--- engines/gnap/scenes/scene50.cpp | 6 +++--- engines/gnap/scenes/scene51.cpp | 7 +++---- engines/gnap/scenes/scene53.cpp | 4 ++-- 15 files changed, 72 insertions(+), 53 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 08861f4398..e6a789a7b7 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -165,7 +165,7 @@ Common::Error GnapEngine::run() { _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - _gameSys->insertSequence(0x11b, 100, -1, -1, 0, 0, 0, 0); + _gameSys->insertSequence(0x11b, 100, -1, -1, kSeqNone, 0, 0, 0); CursorMan.showMouse(true); @@ -1559,7 +1559,7 @@ void GnapEngine::gnapIdle() { _gnapSequenceId == 0x831 || _gnapSequenceId == 0x89A)) { _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 32, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncExists, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); _gnapSequenceDatNum = 1; } @@ -1570,7 +1570,7 @@ void GnapEngine::gnapActionIdle(int sequenceId) { ridToEntryIndex(sequenceId) == _gnapSequenceId) { _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 32, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncExists, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); _gnapSequenceDatNum = 1; } @@ -1580,6 +1580,7 @@ void GnapEngine::playGnapSequence(int sequenceId) { _timers[2] = getRandom(30) + 20; _timers[3] = 300; gnapIdle(); + // CHECKME: Check the value of the flag _gameSys->insertSequence(sequenceId, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 9, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); @@ -1668,13 +1669,13 @@ void GnapEngine::updateGnapIdleSequence() { if (_gnapIdleFacing == 1) { _gameSys->insertSequence(0x107BD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7BD; _gnapSequenceDatNum = 1; } else if (_gnapIdleFacing == 3) { _gameSys->insertSequence(0x107BE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7BE; _gnapSequenceDatNum = 1; } @@ -1702,13 +1703,13 @@ void GnapEngine::updateGnapIdleSequence2() { if (_gnapIdleFacing == 1) { _gameSys->insertSequence(0x107BD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7BD; _gnapSequenceDatNum = 1; } else if (_gnapIdleFacing == 3) { _gameSys->insertSequence(0x107BE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7BE; _gnapSequenceDatNum = 1; } @@ -1752,7 +1753,7 @@ void GnapEngine::initGnapPos(int gridX, int gridY, int facing) { _gnapSequenceDatNum = 1; _gameSys->insertSequence(makeRid(1, _gnapSequenceId), 20 * _gnapY, 0, 0, - 1, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqScale, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); } void GnapEngine::gnapInitBrainPulseRndValue() { @@ -1766,13 +1767,13 @@ void GnapEngine::gnapUseDeviceOnBeaver() { if (_beaverFacing != 0) { _gameSys->insertSequence(makeRid(1, 0x7D5), _beaverId, makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, - 8, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _beaverSequenceId = 0x7D5; _beaverSequenceDatNum = 1; } else { _gameSys->insertSequence(makeRid(1, 0x7D4), _beaverId, makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, - 8, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _beaverSequenceId = 0x7D4; _beaverSequenceDatNum = 1; } @@ -1780,7 +1781,7 @@ void GnapEngine::gnapUseDeviceOnBeaver() { int newSequenceId = getGnapSequenceId(gskUseDevice, 0, 0); _gameSys->insertSequence(makeRid(1, newSequenceId), _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = newSequenceId; _gnapSequenceDatNum = 1; @@ -1838,12 +1839,12 @@ void GnapEngine::gnapKissPlatypus(int callback) { _gameSys->setAnimation(0x10847, _gnapId, 0); _gameSys->insertSequence(0x10847, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 15 * (5 * _gnapX - 20) - (21 - _gridMinX), 48 * (_gnapY - 6) - (146 - _gridMinY)); + kSeqSyncWait, 0, 15 * (5 * _gnapX - 20) - (21 - _gridMinX), 48 * (_gnapY - 6) - (146 - _gridMinY)); _gnapSequenceDatNum = 1; _gnapSequenceId = 0x847; _gameSys->insertSequence(0x107CB, _beaverId, makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, - 8, getSequenceTotalDuration(0x10847), 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqSyncWait, getSequenceTotalDuration(0x10847), 75 * _platX - _platGridX, 48 * _platY - _platGridY); _beaverSequenceDatNum = 1; _beaverSequenceId = 0x7CB; _beaverFacing = 0; @@ -1868,12 +1869,12 @@ void GnapEngine::gnapUseJointOnPlatypus() { _gameSys->setAnimation(0x10876, _beaverId, 0); _gameSys->insertSequence(0x10875, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 15 * (5 * _gnapX - 30), 48 * (_gnapY - 7)); + kSeqSyncWait, 0, 15 * (5 * _gnapX - 30), 48 * (_gnapY - 7)); _gnapSequenceDatNum = 1; _gnapSequenceId = 0x875; _gameSys->insertSequence(0x10876, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, - 8, 0, 15 * (5 * _platX - 25), 48 * (_platY - 7)); + kSeqSyncWait, 0, 15 * (5 * _platX - 25), 48 * (_platY - 7)); _beaverSequenceDatNum = 1; _beaverSequenceId = 0x876; _beaverFacing = 0; @@ -1927,6 +1928,7 @@ int GnapEngine::getBeaverSequenceId(int kind, int gridX, int gridY) { } void GnapEngine::playBeaverSequence(int sequenceId) { + // CHECKME: Check the value of the flag _gameSys->insertSequence(sequenceId, _beaverId, makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, 9, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); @@ -2020,7 +2022,7 @@ void GnapEngine::initBeaverPos(int gridX, int gridY, int facing) { _beaverSequenceDatNum = 1; _gameSys->insertSequence(makeRid(1, _beaverSequenceId), 20 * _platY, 0, 0, - 1, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqScale, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); } //////////////////////////////////////////////////////////////////////////////// @@ -2166,7 +2168,7 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ _gameSys->setAnimation(sequenceId2, _gnapId, 0); _gameSys->insertSequence(sequenceId2, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); + kSeqSyncWait, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); _gnapSequenceId = sequenceId2; _gnapSequenceDatNum = 0; while (_gameSys->getAnimationStatus(0) != 2) @@ -2180,7 +2182,7 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ _gameSys->setAnimation(sequenceId3, _gnapId, 0); _gameSys->insertSequence(sequenceId3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 8, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); + kSeqSyncWait, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); removeFullScreenSprite(); showCursor(); _gnapSequenceId = sequenceId3; @@ -2303,13 +2305,13 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, v16[0].id = 0; _gameSys->insertSequence(seqId | 0x10000, 0, _toyUfoSequenceId | 0x10000, _toyUfoId, - 8, 0, v16[0].gridX1 - 365, v16[0].gridY1 - 128); + kSeqSyncWait, 0, v16[0].gridX1 - 365, v16[0].gridY1 - 128); for (i = 1; i < v21; ++i) { v16[i].sequenceId = seqId + (i % 8); v16[i].id = i; _gameSys->insertSequence(v16[i].sequenceId | 0x10000, v16[i].id, v16[i - 1].sequenceId | 0x10000, v16[i - 1].id, - 8, 0, + kSeqSyncWait, 0, v16[i].gridX1 - 365, v16[i].gridY1 - 128); } diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index baf1a67f93..5b2f5aa454 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -581,12 +581,14 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapWalkNodes[index].id = index + 20 * _gnapWalkNodes[index].gridY1; if (_gnapWalkNodes[index].deltaX == 1 && _gnapWalkNodes[index].deltaY == 0) { if (index % 2) { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7AB), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); _gnapWalkNodes[index].sequenceId = 0x7AB; gnapSequenceId = 0x7AB; } else { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7AC), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); @@ -595,12 +597,14 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } } else if (_gnapWalkNodes[index].deltaX == -1 && _gnapWalkNodes[index].deltaY == 0) { if (index % 2) { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7AF), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); _gnapWalkNodes[index].sequenceId = 0x7AF; gnapSequenceId = 0x7AF; } else { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7B0), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); @@ -613,6 +617,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen else _gnapWalkNodes[index].id += 10; int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index].deltaX, _gnapWalkNodes[index].deltaY); + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); @@ -633,7 +638,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); } else if (animationIndex >= 0) { _gameSys->setAnimation(0x107D3, 1, animationIndex); - _gameSys->insertSequence(0x107D3, 1, 0, 0, 0, 0, 0, 0); + _gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); } } else { if (sequenceId >= 0 && sequenceId != -1) { @@ -694,10 +699,12 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } if (flags & 4) { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, 9, 0, 0, 0); } else { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, 9, 0, 75 * _gnapWalkDestX - _gnapGridX, 48 * _gnapWalkDestY - _gnapGridY); @@ -1234,12 +1241,14 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platWalkNodes[index].id = index + 20 * _platWalkNodes[index].gridY1; if (_platWalkNodes[index].deltaX == 1 && _platWalkNodes[index].deltaY == 0) { if (index % 2) { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7CD), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); _platWalkNodes[index].sequenceId = 0x7CD; platSequenceId = 0x7CD; } else { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7CE), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); @@ -1248,12 +1257,14 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se } } else if (_platWalkNodes[index].deltaX == -1 && _platWalkNodes[index].deltaY == 0) { if (index % 2) { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7CF), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); _platWalkNodes[index].sequenceId = 0x7CF; platSequenceId = 0x7CF; } else { + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7D0), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); @@ -1266,6 +1277,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se else _platWalkNodes[index].id += 10; int newSequenceId = getBeaverWalkSequenceId(_platWalkNodes[index].deltaX, _platWalkNodes[index].deltaY); + // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); @@ -1294,7 +1306,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _gameSys->setAnimation(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, animationIndex); } else if (animationIndex >= 0) { _gameSys->setAnimation(0x107D3, 1, animationIndex); - _gameSys->insertSequence(0x107D3, 1, 0, 0, 0, 0, 0, 0); + _gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); } } else { if (sequenceId >= 0 && sequenceId != -1) { diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index a4d62c80dc..cd72020d94 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -498,7 +498,7 @@ void GnapEngine::scene02_updateAnimations() { break; case kASUseTwigWithChicken: playGnapShowItem(5, 0, 0); - _gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, 32, 0, 0, 0); + _gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _s02_currChickenSequenceId = 0x155; _s02_nextChickenSequenceId = -1; _gnapActionStatus = -1; diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 7ca1c4a2da..95449f5e6c 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -406,7 +406,7 @@ void GnapEngine::scene03_updateAnimations() { gameUpdateTick(); removeFullScreenSprite(); _gameSys->setAnimation(0x1BA, 99, 1); - _gameSys->insertSequence(0x1BA, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, 32, 0, 0, 0); + _gameSys->insertSequence(0x1BA, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _beaverSequenceDatNum = 0; _beaverSequenceId = 0x1BA; _gnapActionStatus = -1; @@ -415,7 +415,7 @@ void GnapEngine::scene03_updateAnimations() { break; case kASHypnotizeScaredPlat: playGnapBrainPulsating(0, 0); - _gameSys->insertSequence(0x1BF, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, 32, 0, 0, 0); + _gameSys->insertSequence(0x1BF, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _gameSys->setAnimation(0x1BF, 99, 1); while (_gameSys->getAnimationStatus(1) != 2) gameUpdateTick(); diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 233b7544b2..2897f687db 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -184,6 +184,7 @@ void GnapEngine::scene13_run() { if (_gnapX == 5 && _gnapY == 5) { _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); _gameSys->setAnimation(_s13_backToiletCtr + 0xA3, _gnapId, 0); + // CHECKME: Check the value of the flag _gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 9, 0, 0, 0); diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index c86df4c8a3..322cdd62dd 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -100,7 +100,7 @@ void GnapEngine::scene17_platHangUpPhone() { _s17_platPhoneCtr = 0; _beaverActionStatus = -1; _gameSys->setAnimation(0x257, 254, 4); - _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, 32, 0, 0, 0); + _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (_gameSys->getAnimationStatus(4) != 2) gameUpdateTick(); _gameSys->setAnimation(0x25B, _beaverId, 1); @@ -265,6 +265,7 @@ void GnapEngine::scene17_run() { _platY = 8; _beaverId = 160; _gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + // CHECKME: Check the value of the flag _gameSys->insertSequence(0x107C1, _beaverId, 0x241, _beaverId, 9, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 4d16486818..5466360c11 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -219,6 +219,7 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, if (animationIndex >= 0) _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); + // CHECKME: Check the value of the flag _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, 9, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); @@ -264,7 +265,7 @@ void GnapEngine::scene18_platEndPhoning(bool platFl) { _beaverActionStatus = -1; if (_s18_currPhoneSequenceId != -1) { _gameSys->setAnimation(0x21E, 254, 3); - _gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, 32, 0, 0, 0); + _gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (_gameSys->getAnimationStatus(3) != 2) gameUpdateTick(); } @@ -843,6 +844,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); _gameSys->removeSequence(0x20C, 19, true); _gameSys->setAnimation(0x217, 39, 5); + // CHECKME: check the value of the flag _gameSys->insertSequence(0x217, 39, 0x216, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); @@ -945,6 +947,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->requestRemoveSequence(0x1F9, 19); _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x213, 39, 5); + // CHECKME: check the value of the flag _gameSys->insertSequence(0x214, 39, 0x213, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); @@ -961,6 +964,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x211, 39, 5); + // CHECKME: check the value of the flag _gameSys->insertSequence(0x212, 39, 0x211, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 41a0cc4f79..788a7fac0b 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -551,8 +551,8 @@ void GnapEngine::scene20_updateAnimations() { case kASTalkStonerGuyNoJoint: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; @@ -565,8 +565,8 @@ void GnapEngine::scene20_updateAnimations() { case kASTalkStonerGuyHasJoint: _gameSys->setAnimation(0x168, 21, 2); _gameSys->setAnimation(379, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); @@ -589,8 +589,8 @@ void GnapEngine::scene20_updateAnimations() { case kASTalkGroceryStoreGuy: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; @@ -606,8 +606,8 @@ void GnapEngine::scene20_updateAnimations() { case kASGrabGroceryStoreGuy: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; @@ -619,8 +619,8 @@ void GnapEngine::scene20_updateAnimations() { case kASGrabGroceryStoreHat: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index 1539b319cf..b1bbfb40e8 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -352,7 +352,7 @@ void GnapEngine::scene25_updateAnimations() { _s25_nextTicketVendorSequenceId = 0x5E; _gameSys->setAnimation(0x5E, 39, 0); _gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, 32, 0, 0, 0); + _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); _gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; _s25_nextTicketVendorSequenceId = -1; diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 720080d1ec..d241daf04d 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -353,7 +353,7 @@ void GnapEngine::scene27_updateAnimations() { break; case kASTryEnterClownTent: _s27_nextJanitorSequenceId = 0xD1; - _gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, 32, 0, 0, 0); + _gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index 2e735e3650..f4aa91feda 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -123,13 +123,13 @@ void GnapEngine::scene47_initCutscene6() { } void GnapEngine::scene47_initCutscene7() { - int v1 = 4, v0, v4, v2, v3; + int v0, v4, v2, v3; _s99_dword_47F370[0] = 0x316; _s99_dword_47F370[1] = 0x31A; _s99_dword_47F370[2] = 0x314; _s99_dword_47F370[3] = 0x31B; - v1 = 4; + int v1 = 4; if (!isFlag(3)) { _s99_dword_47F370[4] = 0x31C; v1 = 5; diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index e8415bbc9f..e3683bebb9 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -190,7 +190,7 @@ void GnapEngine::scene49_updateObstacle(int i) { kSeqSyncWait, 0, 0, -50); _gameSys->insertSequence(obstacle.collisionSequenceId, 256, _s49_truckSequenceId, _s49_truckId, - 32, 0, 0, -50); + kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = obstacle.collisionSequenceId; _s49_truckId = 256; obstacle.currSequenceId = obstacle.passedSequenceId; @@ -460,7 +460,7 @@ void GnapEngine::scene49_run() { int steerSequenceId = (_s49_truckLaneNum == 3) ? 0xB3 : 0xB1; if (_s49_truckSequenceId == 0xAE || _s49_truckSequenceId == 0xAF) { _gameSys->setAnimation(steerSequenceId, 256, 0); - _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, 32, 0, 0, -50); + _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = steerSequenceId; _s49_truckId = 256; } @@ -478,7 +478,7 @@ void GnapEngine::scene49_run() { int steerSequenceId = (_s49_truckLaneNum == 1) ? 0xB0 : 0xB2; if (_s49_truckSequenceId == 0xAD || _s49_truckSequenceId == 0xAE) { _gameSys->setAnimation(steerSequenceId, 256, 0); - _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, 32, 0, 0, -50); + _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = steerSequenceId; _s49_truckId = 256; } diff --git a/engines/gnap/scenes/scene50.cpp b/engines/gnap/scenes/scene50.cpp index ce24354be0..cd5b700b9f 100644 --- a/engines/gnap/scenes/scene50.cpp +++ b/engines/gnap/scenes/scene50.cpp @@ -281,7 +281,7 @@ void GnapEngine::scene50_updateAnimations() { _gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); _gameSys->setAnimation(0xB9, _s50_leftTongueNextId, 6); _gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, 32, 0, 0, 0); + _gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncExists, 0, 0, 0); _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; _s50_rightTongueNextSequenceId = -1; _s50_leftTongueSequenceId = 0xB9; @@ -323,7 +323,7 @@ void GnapEngine::scene50_updateAnimations() { _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); _gameSys->setAnimation(0xC1, _s50_rightTongueNextId, 5); _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, 32, 0, 0, 0); + _gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; _s50_leftTongueNextSequenceId = -1; _s50_rightTongueSequenceId = 0xC1; @@ -344,7 +344,7 @@ void GnapEngine::scene50_updateAnimations() { _gameSys->setAnimation(0xBB, _s50_rightTongueNextId, 5); _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, 32, 0, 0, 0); + _gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); _s50_rightTongueSequenceId = 0xBB; _s50_rightTongueId = _s50_rightTongueNextId; _s50_rightTongueNextSequenceId = -1; diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index f56f9c96c4..1610e36192 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -236,7 +236,6 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { bool jumpingLeft = false, jumpingRight = false; int v6 = 0; int v2 = 0; - int v5 = 0; int v8, v4; int result = 0; @@ -260,18 +259,19 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { } if (jumpingRight || jumpingLeft) { + int v5 = 0; int i; for (i = 0; i < 6; ++i) { if (_s51_items[i].isCollision) { if (jumpingRight && _s51_items[i].x2 > v8 && _s51_items[i].x2 < v4) { v5 = v8 - 359; - if (v8 == 359) + if (v5 == 0) v5 = 1; _s51_platypusNextSequenceId = 0xB6; break; } else if (jumpingLeft && _s51_items[i].x2 < v4 && _s51_items[i].x2 > v8) { v5 = v8 - 344; - if (v8 == 344) + if (v5 == 0) v5 = 1; _s51_platypusNextSequenceId = 0xB7; break; @@ -294,7 +294,6 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { switch (item->currSequenceId) { - case 0xBD: case 0xC0: case 0xC1: diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index cc7b7915b2..76dc6d716a 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -110,11 +110,11 @@ void GnapEngine::scene53_runRandomCall() { 0x6A, 0x6B, 0x6C, 0x6D, 0x71 }; - int index; - ++_s53_callsMadeCtr; if (_s53_callsMadeCtr <= 10) { + int index; + do { index = scene53_getRandomCallIndex(); } while (!_s53_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); -- cgit v1.2.3 From db527374b78d75673b20d6a91e08b7c95a067d33 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Mar 2016 07:34:28 +0100 Subject: GNAP: Some renaming --- engines/gnap/gnap.cpp | 4 ++-- engines/gnap/gnap.h | 8 ++++---- engines/gnap/scenes/scene49.cpp | 20 ++++++++++---------- engines/gnap/scenes/scene52.cpp | 8 +++----- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e6a789a7b7..ce81f368b8 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2194,12 +2194,12 @@ int GnapEngine::scene00_init() { return 0x37C; } -void GnapEngine::toyUfoSetStatus(int a1) { +void GnapEngine::toyUfoSetStatus(int flagNum) { clearFlag(16); clearFlag(17); clearFlag(18); clearFlag(19); - setFlag(a1); + setFlag(flagNum); } int GnapEngine::toyUfoGetSequenceId() { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index c05706dffb..44d6e2e355 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -841,7 +841,7 @@ public: void scene40_updateAnimations(); // Scene 4x - void toyUfoSetStatus(int a1); + void toyUfoSetStatus(int flagNum); int toyUfoGetSequenceId(); bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); @@ -917,7 +917,7 @@ public: int scene49_init(); void scene49_updateHotspots(); void scene49_checkObstacles(); - void scene49_updateObstacle(int i); + void scene49_updateObstacle(int id); void scene49_increaseScore(int amount); void scene49_decreaseScore(int amount); void scene49_refreshScoreBar(); @@ -1057,7 +1057,7 @@ public: int scene52_shipCannonHitShield(int cannonNum); int scene52_shipCannonHitAlien(); void scene52_shipExplode(); - int scene52_checkAlienRow(int a1); + int scene52_checkAlienRow(int rowNum); void scene52_updateAlienRowXOfs(); void scene52_initAlienSize(); void scene52_playSound(); @@ -1066,7 +1066,7 @@ public: void scene52_loseShip(); void scene52_initShields(); void scene52_initAnims(); - void scene52_drawScore(int a1); + void scene52_drawScore(int score); void scene52_run(); // Scene 53 diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index e3683bebb9..19da920bf2 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -140,9 +140,9 @@ void GnapEngine::scene49_checkObstacles() { } -void GnapEngine::scene49_updateObstacle(int i) { +void GnapEngine::scene49_updateObstacle(int id) { - Scene49Obstacle &obstacle = _s49_obstacles[i]; + Scene49Obstacle &obstacle = _s49_obstacles[id]; obstacle.currId = obstacle.prevId; @@ -167,7 +167,7 @@ void GnapEngine::scene49_updateObstacle(int i) { if (obstacle.currSequenceId == obstacle.closerSequenceId) { if (_s49_truckLaneNum == obstacle.laneNum) { if (obstacle.splashSequenceId) { - _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, i + 2); + _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, id + 2); _gameSys->insertSequence(obstacle.collisionSequenceId, obstacle.prevId, obstacle.currSequenceId, obstacle.currId, kSeqSyncWait, 0, 0, -50); @@ -177,14 +177,14 @@ void GnapEngine::scene49_updateObstacle(int i) { } else if ((obstacle.laneNum == 1 && _s49_truckSequenceId == 0xB0) || (obstacle.laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || (obstacle.laneNum == 3 && _s49_truckSequenceId == 0xB3)) { - _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, i + 2); + _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, id + 2); _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, obstacle.currSequenceId, obstacle.currId, kSeqSyncWait, 0, 0, -50); obstacle.currSequenceId = obstacle.passedSequenceId; } else { _gameSys->setAnimation(obstacle.collisionSequenceId, 256, 0); - _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, i + 2); + _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, id + 2); _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, obstacle.currSequenceId, obstacle.currId, kSeqSyncWait, 0, 0, -50); @@ -198,7 +198,7 @@ void GnapEngine::scene49_updateObstacle(int i) { scene49_decreaseScore(30); } } else { - _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, i + 2); + _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, id + 2); _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, obstacle.currSequenceId, obstacle.currId, kSeqSyncWait, 0, 0, -50); @@ -207,7 +207,7 @@ void GnapEngine::scene49_updateObstacle(int i) { } else if (obstacle.currSequenceId == obstacle.passedSequenceId) { if (_s49_truckLaneNum == obstacle.laneNum) { if (obstacle.splashSequenceId) { - _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, i + 2); + _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, id + 2); _gameSys->insertSequence(obstacle.collisionSequenceId, obstacle.prevId, obstacle.currSequenceId, obstacle.currId, kSeqSyncWait, 0, 0, -50); @@ -216,15 +216,15 @@ void GnapEngine::scene49_updateObstacle(int i) { scene49_increaseScore(30); } } else if (obstacle.splashSequenceId) { - _gameSys->setAnimation(obstacle.splashSequenceId, obstacle.prevId, i + 2); + _gameSys->setAnimation(obstacle.splashSequenceId, obstacle.prevId, id + 2); _gameSys->insertSequence(obstacle.splashSequenceId, obstacle.prevId, obstacle.currSequenceId, obstacle.currId, kSeqSyncWait, 0, 0, -50); obstacle.currSequenceId = obstacle.splashSequenceId; } } else { - _gameSys->setAnimation(0, 0, i + 2); - scene49_clearObstacle(i); + _gameSys->setAnimation(0, 0, id + 2); + scene49_clearObstacle(id); } } diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index 02718ec467..369668555d 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -647,13 +647,11 @@ void GnapEngine::scene52_shipExplode() { } int GnapEngine::scene52_checkAlienRow(int rowNum) { - - int v4 = 0; - for (int i = 0; i < 5; ++i) if (_s52_items[rowNum][i] >= 0) return 0; + int v4 = 0; for (int j = 0; j < 5; ++j) if (_s52_items[rowNum][j] == -2) { _gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, true); @@ -785,9 +783,9 @@ void GnapEngine::scene52_initAnims() { _gameSys->setAnimation(0, 0, k + 9); } -void GnapEngine::scene52_drawScore(int a1) { +void GnapEngine::scene52_drawScore(int score) { char str[4]; - sprintf(str, "%03d", a1); + sprintf(str, "%03d", score); _gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); _gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); } -- cgit v1.2.3 From deb1199c1da740ad1441a8deacc8cf5d40c81db6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Mar 2016 07:39:38 +0100 Subject: GNAP: Rename SequenceFrame members --- engines/gnap/gamesys.cpp | 250 +++++++++++++++++++++++----------------------- engines/gnap/resource.cpp | 20 ++-- engines/gnap/resource.h | 12 +-- 3 files changed, 141 insertions(+), 141 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 1612ba2363..d18d102060 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -30,8 +30,8 @@ namespace Gnap { void GfxItem::testUpdRect(const Common::Rect &updRect) { Common::Rect intersectingRect; - if (!_updFlag && _prevFrame.spriteId != -1 && - _updRectsCount < 20 && intersectRect(intersectingRect, _prevFrame.rect, updRect)) + if (!_updFlag && _prevFrame._spriteId != -1 && + _updRectsCount < 20 && intersectRect(intersectingRect, _prevFrame._rect, updRect)) _updRects[_updRectsCount++] = intersectingRect; } @@ -123,10 +123,10 @@ void GameSys::requestClear2(bool resetFl) { gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; if (resetFl) { - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.spriteId = -1; - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._spriteId = -1; + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else { gfxItem->_updFlag = false; @@ -457,13 +457,13 @@ void GameSys::seqInsertGfx(int index, int duration) { gfxItem->_delayTicks = seqItem->_totalDuration + animation->field_4; gfxItem->_updFlag = false; gfxItem->_updRectsCount = 0; - gfxItem->_prevFrame.duration = 0; - gfxItem->_prevFrame.spriteId = -1; - gfxItem->_prevFrame.soundId = -1; - gfxItem->_prevFrame.unkValue = -1; + gfxItem->_prevFrame._duration = 0; + gfxItem->_prevFrame._spriteId = -1; + gfxItem->_prevFrame._soundId = -1; + gfxItem->_prevFrame._unusedVal = -1; totalDuration = duration; if ((seqItem->_flags & 4) && totalDuration > 0) { - gfxItem->_prevFrame.duration = 1; + gfxItem->_prevFrame._duration = 1; if (gfxItem->_delayTicks <= totalDuration) gfxItem->_delayTicks = 0; else @@ -473,29 +473,29 @@ void GameSys::seqInsertGfx(int index, int duration) { int j; totalDuration -= gfxItem->_delayTicks; gfxItem->_delayTicks = 0; - for (j = gfxItem->_currFrameNum; j < animation->framesCount && animation->frames[j].duration <= totalDuration; ++j) { - if (animation->frames[j].soundId != -1) - _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[j].soundId); - totalDuration -= animation->frames[j].duration; + for (j = gfxItem->_currFrameNum; j < animation->framesCount && animation->frames[j]._duration <= totalDuration; ++j) { + if (animation->frames[j]._soundId != -1) + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[j]._soundId); + totalDuration -= animation->frames[j]._duration; } if (animation->framesCount > j) gfxItem->_currFrame = animation->frames[j++]; else gfxItem->_currFrame = animation->frames[j - 1]; - if (gfxItem->_currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) - gfxItem->_currFrame.rect.translate(seqItem->_x, seqItem->_y); + if (gfxItem->_currFrame._spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) + gfxItem->_currFrame._rect.translate(seqItem->_x, seqItem->_y); // Update sprite scaling - if ((seqItem->_flags & 1) && gfxItem->_currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame.rect.bottom <= _backgroundImageValue3) { - int scaleValue = _backgroundImageValue2 + (gfxItem->_currFrame.rect.bottom - _backgroundImageValue1) * + if ((seqItem->_flags & 1) && gfxItem->_currFrame._rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame._rect.bottom <= _backgroundImageValue3) { + int scaleValue = _backgroundImageValue2 + (gfxItem->_currFrame._rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / (_backgroundImageValue3 - _backgroundImageValue1); - gfxItem->_currFrame.rect.top = gfxItem->_currFrame.rect.bottom - scaleValue * (gfxItem->_currFrame.rect.bottom - gfxItem->_currFrame.rect.top) / 1000; - gfxItem->_currFrame.rect.right = scaleValue * (gfxItem->_currFrame.rect.right - gfxItem->_currFrame.rect.left) / 1000 + gfxItem->_currFrame.rect.left; - gfxItem->_currFrame.isScaled = 1; + gfxItem->_currFrame._rect.top = gfxItem->_currFrame._rect.bottom - scaleValue * (gfxItem->_currFrame._rect.bottom - gfxItem->_currFrame._rect.top) / 1000; + gfxItem->_currFrame._rect.right = scaleValue * (gfxItem->_currFrame._rect.right - gfxItem->_currFrame._rect.left) / 1000 + gfxItem->_currFrame._rect.left; + gfxItem->_currFrame._isScaled = 1; } - gfxItem->_currFrame.duration -= totalDuration; - if (gfxItem->_currFrame.soundId != -1) - _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | gfxItem->_currFrame.soundId); + gfxItem->_currFrame._duration -= totalDuration; + if (gfxItem->_currFrame._soundId != -1) + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | gfxItem->_currFrame._soundId); gfxItem->_currFrameNum = j; gfxItem->_updFlag = true; } else { @@ -518,17 +518,17 @@ void GameSys::seqRemoveGfx(int sequenceId, int id) { if (seqLocateGfx(sequenceId, id, &gfxIndex)) { GfxItem *gfxItem = &_gfxItems[gfxIndex]; while (gfxIndex < _gfxItemsCount && gfxItem->_sequenceId == sequenceId && gfxItem->_id == id) { - if (gfxItem->_prevFrame.spriteId == -1) { + if (gfxItem->_prevFrame._spriteId == -1) { --_gfxItemsCount; if (gfxIndex != _gfxItemsCount) memcpy(&_gfxItems[gfxIndex], &_gfxItems[gfxIndex + 1], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); } else { gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.spriteId = -1; - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._spriteId = -1; + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; ++gfxIndex; gfxItem = &_gfxItems[gfxIndex]; @@ -549,15 +549,15 @@ bool GameSys::updateSequenceDuration(int sequenceId, int id, int *outDuration) { if (gfxItem->_currFrameNum < animation->framesCount) return false; if (gfxItem->_updFlag) { - if (gfxItem->_currFrame.duration > 0) + if (gfxItem->_currFrame._duration > 0) return false; - if (-gfxItem->_currFrame.duration < duration) - duration = -gfxItem->_currFrame.duration; + if (-gfxItem->_currFrame._duration < duration) + duration = -gfxItem->_currFrame._duration; } else { - if (gfxItem->_prevFrame.duration > 0) + if (gfxItem->_prevFrame._duration > 0) return false; - if (-gfxItem->_prevFrame.duration < duration) - duration = -gfxItem->_prevFrame.duration; + if (-gfxItem->_prevFrame._duration < duration) + duration = -gfxItem->_prevFrame._duration; } } } @@ -588,8 +588,8 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { if (gfxItem->_sequenceId == sequenceId && gfxItem->_id == id && animation) { foundSequence = true; if (animation->framesCount > gfxItem->_currFrameNum || - (gfxItem->_updFlag && gfxItem->_currFrame.duration > 1) || - gfxItem->_prevFrame.duration > 1) + (gfxItem->_updFlag && gfxItem->_currFrame._duration > 1) || + gfxItem->_prevFrame._duration > 1) foundSequence = false; break; } @@ -736,9 +736,9 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &frame, Common::Rect *subRect) { debug(1, "GameSys::seqDrawStaticFrame() rect: (%d, %d, %d, %d)", - frame.rect.left, frame.rect.top, frame.rect.right, frame.rect.bottom); + frame._rect.left, frame._rect.top, frame._rect.right, frame._rect.bottom); - Common::Rect srcRect = subRect ? *subRect : frame.rect; + Common::Rect srcRect = subRect ? *subRect : frame._rect; Common::Rect clipRect; if (!intersectRect(clipRect, srcRect, _screenRect)) { @@ -748,7 +748,7 @@ void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &fram const int x = clipRect.left, y = clipRect.top; - clipRect.translate(-frame.rect.left, -frame.rect.top); + clipRect.translate(-frame._rect.left, -frame._rect.top); // TODO Save transparent flag somewhere blitSurface32(_frontSurface, x, y, surface, clipRect, true); @@ -757,9 +757,9 @@ void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &fram void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame &frame, Common::Rect *subRect) { debug(1, "GameSys::seqDrawSpriteFrame() spriteId: %04X; rect: (%d, %d, %d, %d)", - frame.spriteId, frame.rect.left, frame.rect.top, frame.rect.right, frame.rect.bottom); + frame._spriteId, frame._rect.left, frame._rect.top, frame._rect.right, frame._rect.bottom); - Common::Rect srcRect = subRect ? *subRect : frame.rect; + Common::Rect srcRect = subRect ? *subRect : frame._rect; Common::Rect clipRect; if (!intersectRect(clipRect, srcRect, _screenRect)) { @@ -772,14 +772,14 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & const int x = clipRect.left, y = clipRect.top; - debug(1, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame.isScaled); + debug(1, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame._isScaled); // 32bit sprite drawing - if (frame.isScaled) { + if (frame._isScaled) { Common::Rect sourceRect(0, 0, spriteResource->_width, spriteResource->_height); - blitSpriteScaled32(_frontSurface, frame.rect, clipRect, sourcePixels, spriteResource->_width, sourceRect, sourcePalette); + blitSpriteScaled32(_frontSurface, frame._rect, clipRect, sourcePixels, spriteResource->_width, sourceRect, sourcePalette); } else { - clipRect.translate(-frame.rect.left, -frame.rect.top); + clipRect.translate(-frame._rect.left, -frame._rect.top); blitSprite32(_frontSurface, x, y, sourcePixels, spriteResource->_width, clipRect, sourcePalette, true);//spriteResource->_transparent != 0); } @@ -806,41 +806,41 @@ void GameSys::drawSprites() { if (!gfxItem2->_updFlag) continue; - if (gfxItem2->_prevFrame.spriteId != -1) { + if (gfxItem2->_prevFrame._spriteId != -1) { int transparent = 0; - if (gfxItem2->_currFrame.spriteId != -1 && !(gfxItem2->_flags & 2)) { + if (gfxItem2->_currFrame._spriteId != -1 && !(gfxItem2->_flags & 2)) { if (gfxItem2->_flags & 1) { transparent = 1; } else { - int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame.spriteId; + int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); transparent = spriteResource->_transparent; _vm->_spriteCache->release(resourceId); } } - if ((gfxItem2->_flags & 8) || gfxItem2->_currFrame.spriteId == -1 || - (!(gfxItem2->_flags & 2) && (!gfxItem2->_prevFrame.rect.equals(gfxItem2->_currFrame.rect) || !transparent))) { - restoreBackgroundRect(gfxItem2->_prevFrame.rect); + if ((gfxItem2->_flags & 8) || gfxItem2->_currFrame._spriteId == -1 || + (!(gfxItem2->_flags & 2) && (!gfxItem2->_prevFrame._rect.equals(gfxItem2->_currFrame._rect) || !transparent))) { + restoreBackgroundRect(gfxItem2->_prevFrame._rect); for (int l = 0; l < _gfxItemsCount; ++l) - _gfxItems[l].testUpdRect(gfxItem2->_prevFrame.rect); + _gfxItems[l].testUpdRect(gfxItem2->_prevFrame._rect); } } - if (gfxItem2->_currFrame.spriteId != -1) { + if (gfxItem2->_currFrame._spriteId != -1) { int transparent = 0; if (gfxItem2->_flags & 1) { transparent = 1; } else if (!(gfxItem2->_flags & 2)) { - int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame.spriteId; + int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); transparent = spriteResource->_transparent; _vm->_spriteCache->release(resourceId); } if (((gfxItem2->_flags & 2) && !(gfxItem2->_flags & 8)) || - gfxItem2->_prevFrame.spriteId == -1 || - !gfxItem2->_prevFrame.rect.equals(gfxItem2->_currFrame.rect) || transparent) { + gfxItem2->_prevFrame._spriteId == -1 || + !gfxItem2->_prevFrame._rect.equals(gfxItem2->_currFrame._rect) || transparent) { for (int l = k; l < _gfxItemsCount; ++l) - _gfxItems[l].testUpdRect(gfxItem2->_currFrame.rect); + _gfxItems[l].testUpdRect(gfxItem2->_currFrame._rect); } } @@ -850,17 +850,17 @@ void GameSys::drawSprites() { GfxItem *gfxItem5 = &_gfxItems[m]; debug(0, "DrawGfxItem(%d) updFlag: %d; currFrame.spriteId: %04X; updRectsCount: %d; flags: %04X; sequenceId: %08X", - m, gfxItem5->_updFlag, gfxItem5->_currFrame.spriteId, gfxItem5->_updRectsCount, gfxItem5->_flags, gfxItem5->_sequenceId); + m, gfxItem5->_updFlag, gfxItem5->_currFrame._spriteId, gfxItem5->_updRectsCount, gfxItem5->_flags, gfxItem5->_sequenceId); if (gfxItem5->_updFlag) { - if (gfxItem5->_currFrame.spriteId != -1) { + if (gfxItem5->_currFrame._spriteId != -1) { if (gfxItem5->_flags & 1) { seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, 0); //debug("seqDrawStaticFrame"); } else if (gfxItem5->_flags & 2) { // TODO seqDrawAviFrame(gfxItem5->currFrame.spriteId, &gfxItem5->currFrame, 0, gfxItem5->flags & 8); } else { - int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame.spriteId; + int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); seqDrawSpriteFrame(spriteResource, gfxItem5->_currFrame, 0); _vm->_spriteCache->release(resourceId); @@ -877,7 +877,7 @@ void GameSys::drawSprites() { seqDrawAviFrame(spriteData4, &gfxItem5->prevFrame, &gfxItem5->updRects[n], gfxItem5->flags & 8); */ } else { - int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_prevFrame.spriteId; + int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_prevFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); for (int n = 0; n < gfxItem5->_updRectsCount; ++n) seqDrawSpriteFrame(spriteResource, gfxItem5->_prevFrame, &gfxItem5->_updRects[n]); @@ -921,12 +921,12 @@ void GameSys::updateScreen() { if (!gfxItem->_updFlag) continue; - if (gfxItem->_prevFrame.spriteId == -1 || - !intersectRect(srcRect, _screenRect, gfxItem->_prevFrame.rect)) { - if (gfxItem->_currFrame.spriteId != -1 && intersectRect(rcSrc2, _screenRect, gfxItem->_currFrame.rect)) + if (gfxItem->_prevFrame._spriteId == -1 || + !intersectRect(srcRect, _screenRect, gfxItem->_prevFrame._rect)) { + if (gfxItem->_currFrame._spriteId != -1 && intersectRect(rcSrc2, _screenRect, gfxItem->_currFrame._rect)) updateRect(rcSrc2); - } else if (gfxItem->_currFrame.spriteId != -1 && - intersectRect(rcSrc2, _screenRect, gfxItem->_currFrame.rect)) { + } else if (gfxItem->_currFrame._spriteId != -1 && + intersectRect(rcSrc2, _screenRect, gfxItem->_currFrame._rect)) { updateRect(srcRect); updateRect(rcSrc2); } @@ -971,10 +971,10 @@ void GameSys::handleReqRemoveSequenceItems() { gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; if (_removeSequenceItems[i]._forceFrameReset) { - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.spriteId = -1; - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._spriteId = -1; + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else { gfxItem->_updFlag = false; @@ -994,10 +994,10 @@ void GameSys::handleReqRemoveSpriteDrawItems() { if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && (gfxItem->_flags & 1) && gfxItem->_id == _removeSpriteDrawItems[j]._id && _removeSpriteDrawItems[j]._surface == gfxItem->_surface) { gfxItem->_flags = 0; - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.spriteId = -1; - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._spriteId = -1; + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } } @@ -1027,7 +1027,7 @@ void GameSys::fatUpdateFrame() { GfxItem *gfxItem = &_gfxItems[i]; SequenceAnimation *animation = gfxItem->_animation; if ((gfxItem->_sequenceId != -1 && animation) || (gfxItem->_flags & 2) || - gfxItem->_prevFrame.spriteId != -1 || gfxItem->_prevFrame.duration > 0) { + gfxItem->_prevFrame._spriteId != -1 || gfxItem->_prevFrame._duration > 0) { if (gfxItem->_sequenceId == -1 || gfxItem->_updFlag) { if ((gfxItem->_flags & 2) && !gfxItem->_updFlag) { // NOTE Skipped avi code @@ -1038,28 +1038,28 @@ void GameSys::fatUpdateFrame() { updFlag = false; gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.spriteId = -1; - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._spriteId = -1; + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else if (!seqItem) { updFlag = false; gfxItem->_animation = nullptr; - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.spriteId = -1; - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._spriteId = -1; + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else if ((seqItem->_flags & 4) && clockDelta > 1) { updFlag = false; if (gfxItem->_delayTicks < clockDelta) { duration = clockDelta - gfxItem->_delayTicks; gfxItem->_delayTicks = 0; - if (gfxItem->_prevFrame.duration <= duration) - gfxItem->_prevFrame.duration = 1; + if (gfxItem->_prevFrame._duration <= duration) + gfxItem->_prevFrame._duration = 1; else - gfxItem->_prevFrame.duration -= duration; + gfxItem->_prevFrame._duration -= duration; } else { gfxItem->_delayTicks -= clockDelta; } @@ -1067,46 +1067,46 @@ void GameSys::fatUpdateFrame() { } else if (gfxItem->_delayTicks < clockDelta) { duration = clockDelta - gfxItem->_delayTicks; gfxItem->_delayTicks = 0; - if (gfxItem->_prevFrame.duration <= duration) { + if (gfxItem->_prevFrame._duration <= duration) { bool v20 = false; - if (gfxItem->_prevFrame.duration > 0) { - duration -= gfxItem->_prevFrame.duration; - gfxItem->_prevFrame.duration = -duration; + if (gfxItem->_prevFrame._duration > 0) { + duration -= gfxItem->_prevFrame._duration; + gfxItem->_prevFrame._duration = -duration; } else { - gfxItem->_prevFrame.duration = 0; + gfxItem->_prevFrame._duration = 0; v20 = true; } currFrameNum = gfxItem->_currFrameNum; if (animation->framesCount > currFrameNum) { updFlag = false; while (animation->framesCount > currFrameNum && - animation->frames[currFrameNum].duration <= duration) { - if (animation->frames[currFrameNum].soundId != -1) - _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[currFrameNum].soundId); - duration -= animation->frames[currFrameNum].duration; + animation->frames[currFrameNum]._duration <= duration) { + if (animation->frames[currFrameNum]._soundId != -1) + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[currFrameNum]._soundId); + duration -= animation->frames[currFrameNum]._duration; ++currFrameNum; } if (animation->framesCount > currFrameNum) gfxItem->_currFrame = animation->frames[currFrameNum++]; else gfxItem->_currFrame = animation->frames[currFrameNum - 1]; - if (gfxItem->_currFrame.spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) - gfxItem->_currFrame.rect.translate(seqItem->_x, seqItem->_y); + if (gfxItem->_currFrame._spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) + gfxItem->_currFrame._rect.translate(seqItem->_x, seqItem->_y); // Update sprite scaling - if ((seqItem->_flags & 1) && gfxItem->_currFrame.rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame.rect.bottom <= _backgroundImageValue3) { - int v17 = _backgroundImageValue2 + (gfxItem->_currFrame.rect.bottom - _backgroundImageValue1) * + if ((seqItem->_flags & 1) && gfxItem->_currFrame._rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame._rect.bottom <= _backgroundImageValue3) { + int v17 = _backgroundImageValue2 + (gfxItem->_currFrame._rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / (_backgroundImageValue3 - _backgroundImageValue1); - gfxItem->_currFrame.rect.top = gfxItem->_currFrame.rect.bottom - v17 * (gfxItem->_currFrame.rect.bottom - gfxItem->_currFrame.rect.top) / 1000; - gfxItem->_currFrame.rect.right = v17 * (gfxItem->_currFrame.rect.right - gfxItem->_currFrame.rect.left) / 1000 + gfxItem->_currFrame.rect.left; - gfxItem->_currFrame.isScaled = 1; + gfxItem->_currFrame._rect.top = gfxItem->_currFrame._rect.bottom - v17 * (gfxItem->_currFrame._rect.bottom - gfxItem->_currFrame._rect.top) / 1000; + gfxItem->_currFrame._rect.right = v17 * (gfxItem->_currFrame._rect.right - gfxItem->_currFrame._rect.left) / 1000 + gfxItem->_currFrame._rect.left; + gfxItem->_currFrame._isScaled = 1; } - gfxItem->_currFrame.duration -= duration; - if (gfxItem->_currFrame.soundId != -1) - _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | gfxItem->_currFrame.soundId); + gfxItem->_currFrame._duration -= duration; + if (gfxItem->_currFrame._soundId != -1) + _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | gfxItem->_currFrame._soundId); gfxItem->_currFrameNum = currFrameNum; gfxItem->_updFlag = true; - } else if (v20 && gfxItem->_prevFrame.spriteId == -1) { + } else if (v20 && gfxItem->_prevFrame._spriteId == -1) { --_gfxItemsCount; if (_gfxItemsCount != i) memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); @@ -1116,7 +1116,7 @@ void GameSys::fatUpdateFrame() { } } else { updFlag = false; - gfxItem->_prevFrame.duration -= duration; + gfxItem->_prevFrame._duration -= duration; gfxItem->_updFlag = false; } } else { @@ -1152,16 +1152,16 @@ void GameSys::fatUpdateFrame() { gfxItem->_updFlag = true; gfxItem->_updRectsCount = 0; gfxItem->_surface = _newSpriteDrawItems[k]._surface; - gfxItem->_prevFrame.duration = 0; - gfxItem->_prevFrame.spriteId = -1; - gfxItem->_prevFrame.soundId = -1; - gfxItem->_prevFrame.unkValue = -1; - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.isScaled = 0; - gfxItem->_currFrame.rect = _newSpriteDrawItems[k]._rect; - gfxItem->_currFrame.spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_prevFrame._duration = 0; + gfxItem->_prevFrame._spriteId = -1; + gfxItem->_prevFrame._soundId = -1; + gfxItem->_prevFrame._unusedVal = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._isScaled = 0; + gfxItem->_currFrame._rect = _newSpriteDrawItems[k]._rect; + gfxItem->_currFrame._spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; } } _newSpriteDrawItemsCount = 0; @@ -1172,12 +1172,12 @@ void GameSys::fatUpdateFrame() { GfxItem *gfxItem = &_gfxItems[i]; if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && (gfxItem->_flags & 1) && gfxItem->_id == _grabSpriteId && gfxItem->_surface == _grabSpriteSurface1) { - gfxItem->_currFrame.duration = 0; - gfxItem->_currFrame.isScaled = 0; - gfxItem->_currFrame.rect = _grabSpriteRect; - gfxItem->_currFrame.spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO - gfxItem->_currFrame.soundId = -1; - gfxItem->_currFrame.unkValue = -1; + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._isScaled = 0; + gfxItem->_currFrame._rect = _grabSpriteRect; + gfxItem->_currFrame._spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO + gfxItem->_currFrame._soundId = -1; + gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; gfxItem->_surface = _grabSpriteSurface2; break; diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index ab83b1376b..e1d991afa5 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -27,17 +27,17 @@ namespace Gnap { // SequenceFrame void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) { - duration = stream.readUint16LE(); - isScaled = stream.readUint16LE(); - rect.left = stream.readUint32LE(); - rect.top = stream.readUint32LE(); - rect.right = stream.readUint32LE(); - rect.bottom = stream.readUint32LE(); - spriteId = stream.readUint32LE(); - soundId = stream.readUint32LE(); - unkValue = stream.readUint32LE(); + _duration = stream.readUint16LE(); + _isScaled = stream.readUint16LE(); + _rect.left = stream.readUint32LE(); + _rect.top = stream.readUint32LE(); + _rect.right = stream.readUint32LE(); + _rect.bottom = stream.readUint32LE(); + _spriteId = stream.readUint32LE(); + _soundId = stream.readUint32LE(); + _unusedVal = stream.readUint32LE(); //isScaled = 0;//DEBUG - debug(1, "SequenceFrame() spriteId: %d; soundId: %d", spriteId, soundId); + debug(1, "SequenceFrame() spriteId: %d; soundId: %d", _spriteId, _soundId); } // SequenceAnimation diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index b0f6a6169b..8e0c591614 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -46,12 +46,12 @@ enum { }; struct SequenceFrame { - int16 duration; - int16 isScaled; - Common::Rect rect; - int32 spriteId; - int32 soundId; - int32 unkValue; + int16 _duration; + int16 _isScaled; + Common::Rect _rect; + int32 _spriteId; + int32 _soundId; + int32 _unusedVal; void loadFromStream(Common::MemoryReadStream &stream); }; -- cgit v1.2.3 From d546847b5a02f020f816d556ca16ee0df8a04756 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Mar 2016 07:48:29 +0100 Subject: GNAP: More renaming in resource.h --- engines/gnap/gamesys.cpp | 24 ++++++++++++------------ engines/gnap/gamesys.h | 2 +- engines/gnap/gnap.cpp | 4 ++-- engines/gnap/resource.cpp | 26 +++++++++++++------------- engines/gnap/resource.h | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index d18d102060..cced8f3a21 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -70,15 +70,15 @@ GameSys::GameSys(GnapEngine *vm) GameSys::~GameSys() { } -void GameSys::insertSequence(int sequenceId, int a2, int sequenceId2, int a4, int flags, int totalDuration, int16 x, int16 y) { - debug(0, "GameSys::insertSequence() [%08X, %d] -> [%08X, %d] (%d, %d)", sequenceId, a2, sequenceId2, a4, x, y); +void GameSys::insertSequence(int sequenceId, int id, int sequenceId2, int id2, int flags, int totalDuration, int16 x, int16 y) { + debug(0, "GameSys::insertSequence() [%08X, %d] -> [%08X, %d] (%d, %d)", sequenceId, id, sequenceId2, id2, x, y); Sequence sequence; SequenceResource *sequenceResource = _vm->_sequenceCache->get(sequenceId); sequenceResource->_sequenceId = sequenceId; sequence._sequenceId = sequenceId; - sequence._id = a2 != -1 ? a2 : sequenceResource->_field_8; + sequence._id = id != -1 ? id : sequenceResource->_defaultId; sequence._sequenceId2 = sequenceId2 != (int32)0x80000000 ? sequenceId2 : sequenceResource->_sequenceId2; - sequence._id2 = a4 != -1 ? a4 : sequenceResource->_field_10; + sequence._id2 = id2 != -1 ? id2 : sequenceResource->_defaultId2; sequence._flags = flags != -1 ? flags : sequenceResource->_flags; sequence._totalDuration = totalDuration != -1 ? totalDuration : sequenceResource->_totalDuration; sequence._x = (x < 10000 && x > -10000) ? x : sequenceResource->_xOffs; @@ -454,7 +454,7 @@ void GameSys::seqInsertGfx(int index, int duration) { gfxItem->_animation = animation; gfxItem->_currFrameNum = 0; gfxItem->_flags = 0; - gfxItem->_delayTicks = seqItem->_totalDuration + animation->field_4; + gfxItem->_delayTicks = seqItem->_totalDuration + animation->_additionalDelay; gfxItem->_updFlag = false; gfxItem->_updRectsCount = 0; gfxItem->_prevFrame._duration = 0; @@ -473,12 +473,12 @@ void GameSys::seqInsertGfx(int index, int duration) { int j; totalDuration -= gfxItem->_delayTicks; gfxItem->_delayTicks = 0; - for (j = gfxItem->_currFrameNum; j < animation->framesCount && animation->frames[j]._duration <= totalDuration; ++j) { + for (j = gfxItem->_currFrameNum; j < animation->_framesCount && animation->frames[j]._duration <= totalDuration; ++j) { if (animation->frames[j]._soundId != -1) _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[j]._soundId); totalDuration -= animation->frames[j]._duration; } - if (animation->framesCount > j) + if (animation->_framesCount > j) gfxItem->_currFrame = animation->frames[j++]; else gfxItem->_currFrame = animation->frames[j - 1]; @@ -546,7 +546,7 @@ bool GameSys::updateSequenceDuration(int sequenceId, int id, int *outDuration) { found = true; SequenceAnimation *animation = gfxItem->_animation; if (animation) { - if (gfxItem->_currFrameNum < animation->framesCount) + if (gfxItem->_currFrameNum < animation->_framesCount) return false; if (gfxItem->_updFlag) { if (gfxItem->_currFrame._duration > 0) @@ -587,7 +587,7 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { SequenceAnimation *animation = gfxItem->_animation; if (gfxItem->_sequenceId == sequenceId && gfxItem->_id == id && animation) { foundSequence = true; - if (animation->framesCount > gfxItem->_currFrameNum || + if (animation->_framesCount > gfxItem->_currFrameNum || (gfxItem->_updFlag && gfxItem->_currFrame._duration > 1) || gfxItem->_prevFrame._duration > 1) foundSequence = false; @@ -1077,16 +1077,16 @@ void GameSys::fatUpdateFrame() { v20 = true; } currFrameNum = gfxItem->_currFrameNum; - if (animation->framesCount > currFrameNum) { + if (animation->_framesCount > currFrameNum) { updFlag = false; - while (animation->framesCount > currFrameNum && + while (animation->_framesCount > currFrameNum && animation->frames[currFrameNum]._duration <= duration) { if (animation->frames[currFrameNum]._soundId != -1) _soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[currFrameNum]._soundId); duration -= animation->frames[currFrameNum]._duration; ++currFrameNum; } - if (animation->framesCount > currFrameNum) + if (animation->_framesCount > currFrameNum) gfxItem->_currFrame = animation->frames[currFrameNum++]; else gfxItem->_currFrame = animation->frames[currFrameNum - 1]; diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index 043dec3c32..fc137eb65c 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -101,7 +101,7 @@ class GameSys { public: GameSys(GnapEngine *vm); ~GameSys(); - void insertSequence(int sequenceId, int a2, int sequenceId2, int a4, int flags, int totalDuration, int16 x, int16 y); + void insertSequence(int sequenceId, int id, int sequenceId2, int id2, int flags, int totalDuration, int16 x, int16 y); void insertDirtyRect(const Common::Rect &rect); void removeSequence(int sequenceId, int id, bool resetFl); void invalidateGrabCursorSprite(int id, Common::Rect &rect, Graphics::Surface *surface1, Graphics::Surface *surface2); diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index ce81f368b8..2edfcacabc 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -642,8 +642,8 @@ int GnapEngine::getSequenceTotalDuration(int resourceId) { int maxValue = 0; for (int i = 0; i < sequenceResource->_animationsCount; ++i) { SequenceAnimation *animation = &sequenceResource->_animations[i]; - if (animation->field_4 + animation->field_A > maxValue) - maxValue = animation->field_4 + animation->field_A; + if (animation->_additionalDelay + animation->_maxTotalDuration > maxValue) + maxValue = animation->_additionalDelay + animation->_maxTotalDuration; } int totalDuration = maxValue + sequenceResource->_totalDuration; _sequenceCache->release(resourceId); diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index e1d991afa5..17fe8f918a 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -43,14 +43,14 @@ void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) { // SequenceAnimation void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) { - field_0 = stream.readUint16LE(); - field_2 = stream.readUint16LE(); - field_4 = stream.readUint32LE(); - framesCount = stream.readUint16LE(); - field_A = stream.readUint16LE(); - debug(1, "SequenceAnimation() framesCount: %d", framesCount); - frames = new SequenceFrame[framesCount]; - for (int i = 0; i < framesCount; ++i) + _unusedVal1 = stream.readUint16LE(); + _unusedVal2 = stream.readUint16LE(); + _additionalDelay = stream.readUint32LE(); + _framesCount = stream.readUint16LE(); + _maxTotalDuration = stream.readUint16LE(); + debug(1, "SequenceAnimation() framesCount: %d", _framesCount); + frames = new SequenceFrame[_framesCount]; + for (int i = 0; i < _framesCount; ++i) frames[i].loadFromStream(stream); } @@ -58,11 +58,11 @@ void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) { SequenceResource::SequenceResource(int resourceId, byte *data, uint32 size) { Common::MemoryReadStream stream(data, size, DisposeAfterUse::NO); - _field_0 = stream.readUint32LE(); + _unusedVal1 = stream.readUint32LE(); _sequenceId = stream.readUint32LE(); - _field_8 = stream.readUint32LE(); + _defaultId = stream.readUint32LE(); _sequenceId2 = stream.readUint32LE(); - _field_10 = stream.readUint32LE(); + _defaultId2 = stream.readUint32LE(); _flags = stream.readUint32LE(); _totalDuration = stream.readUint32LE(); _xOffs = stream.readUint16LE(); @@ -91,8 +91,8 @@ SpriteResource::SpriteResource(int resourceId, byte *data, uint32 size) { _data = data; _width = READ_LE_UINT16(_data); _height = READ_LE_UINT16(_data + 2); - _unk1 = READ_LE_UINT16(_data + 4); - _unk2 = READ_LE_UINT16(_data + 6); + _unknownVal1 = READ_LE_UINT16(_data + 4); + _unknownVal2 = READ_LE_UINT16(_data + 6); _transparent = READ_LE_UINT16(_data + 8); _colorsCount = READ_LE_UINT16(_data + 10); _palette = (uint32*)(_data + 12); diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 8e0c591614..2ae933f3f7 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -56,13 +56,13 @@ struct SequenceFrame { }; struct SequenceAnimation { - int16 field_0; - int16 field_2; - int32 field_4; - int16 framesCount; - int16 field_A; + int16 _unusedVal1; + int16 _unusedVal2; + int32 _additionalDelay; + int16 _framesCount; + int16 _maxTotalDuration; SequenceFrame *frames; - SequenceAnimation() : frames(0) {} + SequenceAnimation() : frames(nullptr) {} ~SequenceAnimation() { delete[] frames; } void loadFromStream(Common::MemoryReadStream &stream); }; @@ -72,11 +72,11 @@ public: SequenceResource(int resourceId, byte *data, uint32 size); ~SequenceResource(); public: - uint32 _field_0; + uint32 _unusedVal1; int32 _sequenceId; - int32 _field_8; + int32 _defaultId; int32 _sequenceId2; - uint32 _field_10; + uint32 _defaultId2; uint32 _flags; int32 _totalDuration; int16 _xOffs; @@ -94,8 +94,8 @@ public: byte *_pixels; uint32 *_palette; int16 _width, _height; - uint16 _unk1; - uint16 _unk2; + uint16 _unknownVal1; + uint16 _unknownVal2; uint16 _transparent; uint16 _colorsCount; }; -- cgit v1.2.3 From 6b1a2f36498341ad409cdb8a9e0419e17ae0781c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 19 Mar 2016 01:25:07 +0100 Subject: GNAP: rename SoundItem members --- engines/gnap/sound.cpp | 20 ++++++++++---------- engines/gnap/sound.h | 5 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/engines/gnap/sound.cpp b/engines/gnap/sound.cpp index 9471d12a67..8fc216a880 100644 --- a/engines/gnap/sound.cpp +++ b/engines/gnap/sound.cpp @@ -35,13 +35,13 @@ SoundMan::~SoundMan() { void SoundMan::playSound(int resourceId, bool looping) { SoundItem soundItem; - soundItem.resourceId = resourceId; + soundItem._resourceId = resourceId; SoundResource *soundResource = _vm->_soundCache->get(resourceId); Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundResource->_data, soundResource->_size, DisposeAfterUse::NO); Audio::AudioStream *audioStream = Audio::makeLoopingAudioStream(Audio::makeWAVStream(stream, DisposeAfterUse::YES), looping ? 0 : 1); - _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &soundItem.handle, audioStream); + _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &soundItem._handle, audioStream); _items.push_back(soundItem); @@ -50,8 +50,8 @@ void SoundMan::playSound(int resourceId, bool looping) { void SoundMan::stopSound(int resourceId) { const int index = find(resourceId); if (index >= 0) { - _vm->_soundCache->release(_items[index].resourceId); - _vm->_mixer->stopHandle(_items[index].handle); + _vm->_soundCache->release(_items[index]._resourceId); + _vm->_mixer->stopHandle(_items[index]._handle); _items.remove_at(index); } } @@ -62,20 +62,20 @@ void SoundMan::setSoundVolume(int resourceId, int volume) { bool SoundMan::isSoundPlaying(int resourceId) { const int index = find(resourceId); - return index >= 0 && _vm->_mixer->isSoundHandleActive(_items[index].handle); + return index >= 0 && _vm->_mixer->isSoundHandleActive(_items[index]._handle); } void SoundMan::stopAll() { for (int index = 0; index < (int)_items.size(); ++index) { - _vm->_soundCache->release(_items[index].resourceId); - _vm->_mixer->stopHandle(_items[index].handle); + _vm->_soundCache->release(_items[index]._resourceId); + _vm->_mixer->stopHandle(_items[index]._handle); } } void SoundMan::update() { for (int index = 0; index < (int)_items.size(); ++index) - if (!_vm->_mixer->isSoundHandleActive(_items[index].handle)) { - _vm->_soundCache->release(_items[index].resourceId); + if (!_vm->_mixer->isSoundHandleActive(_items[index]._handle)) { + _vm->_soundCache->release(_items[index]._resourceId); _items.remove_at(index); --index; } @@ -83,7 +83,7 @@ void SoundMan::update() { int SoundMan::find(int resourceId) { for (int index = 0; index < (int)_items.size(); ++index) - if (_items[index].resourceId == resourceId) + if (_items[index]._resourceId == resourceId) return index; return -1; } diff --git a/engines/gnap/sound.h b/engines/gnap/sound.h index ec5888ed1b..ced3deda62 100644 --- a/engines/gnap/sound.h +++ b/engines/gnap/sound.h @@ -31,8 +31,8 @@ namespace Gnap { struct SoundItem { - int resourceId; - Audio::SoundHandle handle; + int _resourceId; + Audio::SoundHandle _handle; }; class SoundMan { @@ -48,6 +48,7 @@ public: protected: GnapEngine *_vm; Common::Array _items; + int find(int resourceId); }; -- cgit v1.2.3 From e1debd6e26720e168815872bfe2b4fec0444f98b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Mar 2016 18:01:40 +0100 Subject: GNAP: Some renaming in scene 43 --- engines/gnap/gnap.h | 9 ++++--- engines/gnap/scenes/scene42.cpp | 3 --- engines/gnap/scenes/scene43.cpp | 57 +++++++++++++++++++++-------------------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 44d6e2e355..9f670f35f1 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -855,15 +855,18 @@ public: void scene41_updateAnimations(); // Scene 42 - int _s42_currBBQVendorSequenceId, _s42_nextBBQVendorSequenceId; + int _s42_currBBQVendorSequenceId; + int _s42_nextBBQVendorSequenceId; + int scene42_init(); void scene42_updateHotspots(); void scene42_run(); void scene42_updateAnimations(); // Scene 43 - int _s43_dword_47F2B0; - int _s43_dword_47F2B4; + int _currTwoHeadedGuySequenceId; + int _nextTwoHeadedGuySequenceId; + int scene43_init(); void scene43_updateHotspots(); void scene43_run(); diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 1399cbe8ad..8de3a694eb 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -196,11 +196,8 @@ void GnapEngine::scene42_run() { break; } - } else { - switch (_sceneClickedHotspot) { - case kHSDevice: runMenu(); scene42_updateHotspots(); diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index f7ba272082..e0cc8ad033 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -92,11 +92,11 @@ void GnapEngine::scene43_run() { if (!isFlag(14)) _gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); - _s43_dword_47F2B0 = 0x13C; - _s43_dword_47F2B4 = -1; + _currTwoHeadedGuySequenceId = 0x13C; + _nextTwoHeadedGuySequenceId = -1; _gameSys->setAnimation(0x13C, 1, 2); - _gameSys->insertSequence(_s43_dword_47F2B0, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -332,27 +332,27 @@ void GnapEngine::scene43_run() { updateGnapIdleSequence(); if (!_timers[4] && (!isFlag(12) || !isFlag(19))) { _timers[4] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s43_dword_47F2B4 == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { _gnapRandomValue = getRandom(5); switch (_gnapRandomValue) { case 0: - _s43_dword_47F2B4 = 0x13C; + _nextTwoHeadedGuySequenceId = 0x13C; break; case 1: - _s43_dword_47F2B4 = 0x134; + _nextTwoHeadedGuySequenceId = 0x134; break; case 2: - _s43_dword_47F2B4 = 0x135; + _nextTwoHeadedGuySequenceId = 0x135; break; case 3: - _s43_dword_47F2B4 = 0x136; + _nextTwoHeadedGuySequenceId = 0x136; break; case 4: - _s43_dword_47F2B4 = 0x13A; + _nextTwoHeadedGuySequenceId = 0x13A; break; } - if (_s43_dword_47F2B4 == _s43_dword_47F2B0) - _s43_dword_47F2B4 = -1; + if (_nextTwoHeadedGuySequenceId == _currTwoHeadedGuySequenceId) + _nextTwoHeadedGuySequenceId = -1; } } } @@ -376,13 +376,13 @@ void GnapEngine::scene43_run() { } void GnapEngine::scene43_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { switch (_gnapActionStatus) { case 0: _gameSys->setAnimation(0, 0, 0); _sceneDone = true; break; + case 1: if (_gameSys->getAnimationStatus(2) == 2) { _timers[2] = getRandom(30) + 20; @@ -391,15 +391,16 @@ void GnapEngine::scene43_updateAnimations() { _gnapSequenceId = 0x13D; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x13D, _gnapId, 0); - _s43_dword_47F2B4 = 0x13B; - _gameSys->insertSequence(0x13B, 1, _s43_dword_47F2B0, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s43_dword_47F2B4, 1, 2); - _s43_dword_47F2B0 = _s43_dword_47F2B4; - _s43_dword_47F2B4 = -1; + _nextTwoHeadedGuySequenceId = 0x13B; + _gameSys->insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; _timers[4] = getRandom(100) + 100; _gnapActionStatus = -1; } break; + default: _gameSys->setAnimation(0, 0, 0); _gnapActionStatus = -1; @@ -408,24 +409,24 @@ void GnapEngine::scene43_updateAnimations() { } if (_gameSys->getAnimationStatus(2) == 2) { - if (_s43_dword_47F2B0 == 0x13A) { + if (_currTwoHeadedGuySequenceId == 0x13A) { if (isFlag(19)) { - _s43_dword_47F2B4 = 0x13E; + _nextTwoHeadedGuySequenceId = 0x13E; stopSound(0x108F6); } else if (getRandom(2) != 0) { - _s43_dword_47F2B4 = 0x137; + _nextTwoHeadedGuySequenceId = 0x137; } else { - _s43_dword_47F2B4 = 0x138; + _nextTwoHeadedGuySequenceId = 0x138; } - } else if (_s43_dword_47F2B0 == 0x13E) { + } else if (_currTwoHeadedGuySequenceId == 0x13E) { _sceneDone = true; _newSceneNum = 54; } - if (_s43_dword_47F2B4 != -1) { - _gameSys->insertSequence(_s43_dword_47F2B4, 1, _s43_dword_47F2B0, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s43_dword_47F2B4, 1, 2); - _s43_dword_47F2B0 = _s43_dword_47F2B4; - _s43_dword_47F2B4 = -1; + if (_nextTwoHeadedGuySequenceId != -1) { + _gameSys->insertSequence(_nextTwoHeadedGuySequenceId, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; _timers[4] = getRandom(100) + 100; } } @@ -457,7 +458,7 @@ void GnapEngine::scene43_updateAnimations() { _gnapActionStatus = 3; break; case 8: - _s43_dword_47F2B4 = 0x13A; + _nextTwoHeadedGuySequenceId = 0x13A; _toyUfoX = 514; _toyUfoY = 125; toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); -- cgit v1.2.3 From 7eb67ad8517cc5f623f258ec5f83fd7cd9d1756d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Mar 2016 18:14:47 +0100 Subject: GNAP: Renaming in scene 44 --- engines/gnap/gnap.h | 8 ++-- engines/gnap/scenes/scene44.cpp | 100 +++++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 57 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 9f670f35f1..f124897876 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -873,10 +873,10 @@ public: void scene43_updateAnimations(); // Scene 44 - int _s44_dword_47EB04; - int _s44_dword_47EB08; - int _s44_dword_47EB0C; - int _s44_dword_47EB10; + int _nextSpringGuySequenceId; + int _nextKissingLadySequenceId; + int _currSpringGuySequenceId; + int _currKissingLadySequenceId; int scene44_init(); void scene44_updateHotspots(); void scene44_run(); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index bcc435ebc8..1041734dbc 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -80,38 +80,37 @@ void GnapEngine::scene44_updateHotspots() { } void GnapEngine::scene44_run() { - queueInsertDeviceIcon(); _gameSys->insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); _gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(15)) - _s44_dword_47EB0C = 0xF8; + _currSpringGuySequenceId = 0xF8; else - _s44_dword_47EB0C = 0xF9; + _currSpringGuySequenceId = 0xF9; - _s44_dword_47EB04 = -1; - _gameSys->setAnimation(_s44_dword_47EB0C, 1, 4); - _gameSys->insertSequence(_s44_dword_47EB0C, 1, 0, 0, kSeqNone, 0, 0, 0); + _nextSpringGuySequenceId = -1; + _gameSys->setAnimation(_currSpringGuySequenceId, 1, 4); + _gameSys->insertSequence(_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(13)) { if (_prevSceneNum != 50 || _sceneSavegameLoaded) { - _s44_dword_47EB10 = 0xF6; - _s44_dword_47EB08 = -1; + _currKissingLadySequenceId = 0xF6; + _nextKissingLadySequenceId = -1; } else { setGrabCursorSprite(kItemGum); - _s44_dword_47EB10 = 0xF5; - _s44_dword_47EB08 = 0xF6; + _currKissingLadySequenceId = 0xF5; + _nextKissingLadySequenceId = 0xF6; _gameSys->setAnimation(0xF5, 1, 2); } } else { - _s44_dword_47EB10 = 0xEC; - _s44_dword_47EB08 = -1; + _currKissingLadySequenceId = 0xEC; + _nextKissingLadySequenceId = -1; _gameSys->setAnimation(0xEC, 1, 2); } - _gameSys->insertSequence(_s44_dword_47EB10, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -169,7 +168,6 @@ void GnapEngine::scene44_run() { } while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) playSound(0x1094B, 1); @@ -308,7 +306,7 @@ void GnapEngine::scene44_run() { case GRAB_CURSOR: playGnapPullOutDevice(8, 0); playGnapUseDevice(8, 0); - _s44_dword_47EB04 = 0xFB; + _nextSpringGuySequenceId = 0xFB; invAdd(kItemSpring); setFlag(15); scene44_updateHotspots(); @@ -371,50 +369,50 @@ void GnapEngine::scene44_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(12) && _s44_dword_47EB10 != 0xF5) + if (_beaverActionStatus < 0 && !isFlag(12) && _currKissingLadySequenceId != 0xF5) updateBeaverIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(12)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_dword_47EB08 == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _nextKissingLadySequenceId == -1) { _gnapRandomValue = getRandom(20); switch (_gnapRandomValue) { case 0: - _s44_dword_47EB08 = 0xED; + _nextKissingLadySequenceId = 0xED; break; case 1: - _s44_dword_47EB08 = 0xEE; + _nextKissingLadySequenceId = 0xEE; break; case 2: - _s44_dword_47EB08 = 0xF0; + _nextKissingLadySequenceId = 0xF0; break; case 3: - _s44_dword_47EB08 = 0xF3; + _nextKissingLadySequenceId = 0xF3; break; case 4: - _s44_dword_47EB08 = 0xF4; + _nextKissingLadySequenceId = 0xF4; break; default: - _s44_dword_47EB08 = 0xEC; + _nextKissingLadySequenceId = 0xEC; break; } - if (_s44_dword_47EB08 != 0xEC && _s44_dword_47EB08 == _s44_dword_47EB10) - _s44_dword_47EB08 = -1; + if (_nextKissingLadySequenceId != 0xEC && _nextKissingLadySequenceId == _currKissingLadySequenceId) + _nextKissingLadySequenceId = -1; } } if (!_timers[5]) { _timers[5] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_dword_47EB04 == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _nextSpringGuySequenceId == -1) { _gnapRandomValue = getRandom(5); if (_gnapRandomValue != 0) { if (!isFlag(15)) - _s44_dword_47EB04 = 0xF9; + _nextSpringGuySequenceId = 0xF9; } else { if (isFlag(15)) - _s44_dword_47EB04 = 0xF8; + _nextSpringGuySequenceId = 0xF8; else - _s44_dword_47EB04 = 0xFA; + _nextSpringGuySequenceId = 0xFA; } } } @@ -429,14 +427,11 @@ void GnapEngine::scene44_run() { _timers[4] = getRandom(20) + 20; } - gameUpdateTick(); - + gameUpdateTick(); } - } void GnapEngine::scene44_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { @@ -444,10 +439,10 @@ void GnapEngine::scene44_updateAnimations() { _sceneDone = true; break; case 1: - _s44_dword_47EB08 = 0xEF; + _nextKissingLadySequenceId = 0xEF; break; case 2: - _s44_dword_47EB08 = 0xF2; + _nextKissingLadySequenceId = 0xF2; break; } _gnapActionStatus = -1; @@ -462,7 +457,7 @@ void GnapEngine::scene44_updateAnimations() { _beaverSequenceId = 0xFE; _beaverSequenceDatNum = 0; _gameSys->setAnimation(0xFE, _beaverId, 1); - _gameSys->removeSequence(_s44_dword_47EB10, 1, true); + _gameSys->removeSequence(_currKissingLadySequenceId, 1, true); _beaverActionStatus = 5; } break; @@ -477,31 +472,31 @@ void GnapEngine::scene44_updateAnimations() { } if (_gameSys->getAnimationStatus(2) == 2) { - if (_s44_dword_47EB08 == 0xF6) { - _gameSys->insertSequence(_s44_dword_47EB08, 1, _s44_dword_47EB10, 1, kSeqSyncWait, 0, 0, 0); + if (_nextKissingLadySequenceId == 0xF6) { + _gameSys->insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); initBeaverPos(5, 8, 0); - _s44_dword_47EB10 = _s44_dword_47EB08; - _s44_dword_47EB08 = -1; + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; _gameSys->setAnimation(0, 0, 2); - } else if (_s44_dword_47EB08 != -1) { - _gameSys->insertSequence(_s44_dword_47EB08, 1, _s44_dword_47EB10, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s44_dword_47EB08, 1, 2); - _s44_dword_47EB10 = _s44_dword_47EB08; - _s44_dword_47EB08 = -1; + } else if (_nextKissingLadySequenceId != -1) { + _gameSys->insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_nextKissingLadySequenceId, 1, 2); + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; _timers[4] = getRandom(20) + 20; } } if (_gameSys->getAnimationStatus(4) == 2) { - if (_s44_dword_47EB0C == 0xFB) { + if (_currSpringGuySequenceId == 0xFB) { setGrabCursorSprite(kItemSpring); - _s44_dword_47EB04 = 0xF8; + _nextSpringGuySequenceId = 0xF8; } - if (_s44_dword_47EB04 != -1) { - _gameSys->insertSequence(_s44_dword_47EB04, 1, _s44_dword_47EB0C, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s44_dword_47EB04, 1, 4); - _s44_dword_47EB0C = _s44_dword_47EB04; - _s44_dword_47EB04 = -1; + if (_nextSpringGuySequenceId != -1) { + _gameSys->insertSequence(_nextSpringGuySequenceId, 1, _currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_nextSpringGuySequenceId, 1, 4); + _currSpringGuySequenceId = _nextSpringGuySequenceId; + _nextSpringGuySequenceId = -1; _timers[5] = getRandom(20) + 20; } } @@ -523,7 +518,6 @@ void GnapEngine::scene44_updateAnimations() { } _toyUfoActionStatus = -1; } - } } // End of namespace Gnap -- cgit v1.2.3 From 8cb4bd830c7acb921f1f8abc062d76f8a2da1ea1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Mar 2016 19:13:45 +0100 Subject: GNAP: Silence a false positive uninitialized variable --- engines/gnap/scenes/scene22.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index 5c390d66e5..65b7bc618d 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -94,7 +94,7 @@ void GnapEngine::scene22_run() { case 1: storeDetectiveSeqId = 0x56; break; - case 2: + default: storeDetectiveSeqId = 0x57; break; } -- cgit v1.2.3 From 6d1a6738f49e195276089666db166b17285bcce3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Mar 2016 19:15:59 +0100 Subject: GNAP: Some renaming in scene 45, change a global variable to local --- engines/gnap/gnap.h | 3 +-- engines/gnap/scenes/scene45.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index f124897876..873255bafa 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -883,8 +883,7 @@ public: void scene44_updateAnimations(); // Scene 45 - int _s45_dword_4749BC; - int _s45_dword_4749C0; + int _currDancerSequenceId; int scene45_init(); void scene45_updateHotspots(); void scene45_run(); diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 3e1b5299b9..a3dd758545 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -93,9 +93,9 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(0x96, 1, 3); _gameSys->insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); _gameSys->setAnimation(0x99, 1, 4); - _s45_dword_4749BC = 0x8F; - _gameSys->setAnimation(0x8F, 1, 2); - _gameSys->insertSequence(_s45_dword_4749BC, 1, 0, 0, kSeqNone, 0, 0, 0); + _currDancerSequenceId = 0x8F; + _gameSys->setAnimation(_currDancerSequenceId, 1, 2); + _gameSys->insertSequence(_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -148,10 +148,10 @@ void GnapEngine::scene45_run() { if (_gameSys->getAnimationStatus(2) == 2) { _gameSys->setAnimation(0, 0, 2); _gnapRandomValue = getRandom(7); - _s45_dword_4749C0 = _gnapRandomValue + 0x8F; - _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_dword_4749BC, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s45_dword_4749C0, 1, 2); - _s45_dword_4749BC = _s45_dword_4749C0; + int newSeqId = _gnapRandomValue + 0x8F; + _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; } if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { _gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); @@ -394,10 +394,10 @@ void GnapEngine::scene45_updateAnimations() { if (_gameSys->getAnimationStatus(2) == 2) { _gameSys->setAnimation(0, 0, 2); _gnapRandomValue = getRandom(7); - _s45_dword_4749C0 = _gnapRandomValue + 0x8F; - _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_dword_4749BC, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s45_dword_4749C0, 1, 2); - _s45_dword_4749BC = _s45_dword_4749C0; + int newSeqId = _gnapRandomValue + 0x8F; + _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; } if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { -- cgit v1.2.3 From e6496188f71dcb0435471bf82bab71cafabc73f3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Mar 2016 19:21:00 +0100 Subject: GNAP: Rename scene 43, 44 and 45 variables for consistency --- engines/gnap/gnap.h | 14 +++---- engines/gnap/scenes/scene43.cpp | 54 ++++++++++++------------ engines/gnap/scenes/scene44.cpp | 92 ++++++++++++++++++++--------------------- engines/gnap/scenes/scene45.cpp | 14 +++---- 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 873255bafa..a440f4a092 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -864,8 +864,8 @@ public: void scene42_updateAnimations(); // Scene 43 - int _currTwoHeadedGuySequenceId; - int _nextTwoHeadedGuySequenceId; + int _s43_currTwoHeadedGuySequenceId; + int _s43_nextTwoHeadedGuySequenceId; int scene43_init(); void scene43_updateHotspots(); @@ -873,17 +873,17 @@ public: void scene43_updateAnimations(); // Scene 44 - int _nextSpringGuySequenceId; - int _nextKissingLadySequenceId; - int _currSpringGuySequenceId; - int _currKissingLadySequenceId; + int _s44_nextSpringGuySequenceId; + int _s44_nextKissingLadySequenceId; + int _s44_currSpringGuySequenceId; + int _s44_currKissingLadySequenceId; int scene44_init(); void scene44_updateHotspots(); void scene44_run(); void scene44_updateAnimations(); // Scene 45 - int _currDancerSequenceId; + int _s45_currDancerSequenceId; int scene45_init(); void scene45_updateHotspots(); void scene45_run(); diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index e0cc8ad033..51917d5389 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -92,11 +92,11 @@ void GnapEngine::scene43_run() { if (!isFlag(14)) _gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); - _currTwoHeadedGuySequenceId = 0x13C; - _nextTwoHeadedGuySequenceId = -1; + _s43_currTwoHeadedGuySequenceId = 0x13C; + _s43_nextTwoHeadedGuySequenceId = -1; _gameSys->setAnimation(0x13C, 1, 2); - _gameSys->insertSequence(_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s43_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -332,27 +332,27 @@ void GnapEngine::scene43_run() { updateGnapIdleSequence(); if (!_timers[4] && (!isFlag(12) || !isFlag(19))) { _timers[4] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { _gnapRandomValue = getRandom(5); switch (_gnapRandomValue) { case 0: - _nextTwoHeadedGuySequenceId = 0x13C; + _s43_nextTwoHeadedGuySequenceId = 0x13C; break; case 1: - _nextTwoHeadedGuySequenceId = 0x134; + _s43_nextTwoHeadedGuySequenceId = 0x134; break; case 2: - _nextTwoHeadedGuySequenceId = 0x135; + _s43_nextTwoHeadedGuySequenceId = 0x135; break; case 3: - _nextTwoHeadedGuySequenceId = 0x136; + _s43_nextTwoHeadedGuySequenceId = 0x136; break; case 4: - _nextTwoHeadedGuySequenceId = 0x13A; + _s43_nextTwoHeadedGuySequenceId = 0x13A; break; } - if (_nextTwoHeadedGuySequenceId == _currTwoHeadedGuySequenceId) - _nextTwoHeadedGuySequenceId = -1; + if (_s43_nextTwoHeadedGuySequenceId == _s43_currTwoHeadedGuySequenceId) + _s43_nextTwoHeadedGuySequenceId = -1; } } } @@ -391,11 +391,11 @@ void GnapEngine::scene43_updateAnimations() { _gnapSequenceId = 0x13D; _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x13D, _gnapId, 0); - _nextTwoHeadedGuySequenceId = 0x13B; - _gameSys->insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); - _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; - _nextTwoHeadedGuySequenceId = -1; + _s43_nextTwoHeadedGuySequenceId = 0x13B; + _gameSys->insertSequence(0x13B, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); + _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; + _s43_nextTwoHeadedGuySequenceId = -1; _timers[4] = getRandom(100) + 100; _gnapActionStatus = -1; } @@ -409,24 +409,24 @@ void GnapEngine::scene43_updateAnimations() { } if (_gameSys->getAnimationStatus(2) == 2) { - if (_currTwoHeadedGuySequenceId == 0x13A) { + if (_s43_currTwoHeadedGuySequenceId == 0x13A) { if (isFlag(19)) { - _nextTwoHeadedGuySequenceId = 0x13E; + _s43_nextTwoHeadedGuySequenceId = 0x13E; stopSound(0x108F6); } else if (getRandom(2) != 0) { - _nextTwoHeadedGuySequenceId = 0x137; + _s43_nextTwoHeadedGuySequenceId = 0x137; } else { - _nextTwoHeadedGuySequenceId = 0x138; + _s43_nextTwoHeadedGuySequenceId = 0x138; } - } else if (_currTwoHeadedGuySequenceId == 0x13E) { + } else if (_s43_currTwoHeadedGuySequenceId == 0x13E) { _sceneDone = true; _newSceneNum = 54; } - if (_nextTwoHeadedGuySequenceId != -1) { - _gameSys->insertSequence(_nextTwoHeadedGuySequenceId, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); - _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; - _nextTwoHeadedGuySequenceId = -1; + if (_s43_nextTwoHeadedGuySequenceId != -1) { + _gameSys->insertSequence(_s43_nextTwoHeadedGuySequenceId, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); + _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; + _s43_nextTwoHeadedGuySequenceId = -1; _timers[4] = getRandom(100) + 100; } } @@ -458,7 +458,7 @@ void GnapEngine::scene43_updateAnimations() { _gnapActionStatus = 3; break; case 8: - _nextTwoHeadedGuySequenceId = 0x13A; + _s43_nextTwoHeadedGuySequenceId = 0x13A; _toyUfoX = 514; _toyUfoY = 125; toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 1041734dbc..c0905c7434 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -86,31 +86,31 @@ void GnapEngine::scene44_run() { _gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(15)) - _currSpringGuySequenceId = 0xF8; + _s44_currSpringGuySequenceId = 0xF8; else - _currSpringGuySequenceId = 0xF9; + _s44_currSpringGuySequenceId = 0xF9; - _nextSpringGuySequenceId = -1; - _gameSys->setAnimation(_currSpringGuySequenceId, 1, 4); - _gameSys->insertSequence(_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _s44_nextSpringGuySequenceId = -1; + _gameSys->setAnimation(_s44_currSpringGuySequenceId, 1, 4); + _gameSys->insertSequence(_s44_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(13)) { if (_prevSceneNum != 50 || _sceneSavegameLoaded) { - _currKissingLadySequenceId = 0xF6; - _nextKissingLadySequenceId = -1; + _s44_currKissingLadySequenceId = 0xF6; + _s44_nextKissingLadySequenceId = -1; } else { setGrabCursorSprite(kItemGum); - _currKissingLadySequenceId = 0xF5; - _nextKissingLadySequenceId = 0xF6; + _s44_currKissingLadySequenceId = 0xF5; + _s44_nextKissingLadySequenceId = 0xF6; _gameSys->setAnimation(0xF5, 1, 2); } } else { - _currKissingLadySequenceId = 0xEC; - _nextKissingLadySequenceId = -1; + _s44_currKissingLadySequenceId = 0xEC; + _s44_nextKissingLadySequenceId = -1; _gameSys->setAnimation(0xEC, 1, 2); } - _gameSys->insertSequence(_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s44_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -306,7 +306,7 @@ void GnapEngine::scene44_run() { case GRAB_CURSOR: playGnapPullOutDevice(8, 0); playGnapUseDevice(8, 0); - _nextSpringGuySequenceId = 0xFB; + _s44_nextSpringGuySequenceId = 0xFB; invAdd(kItemSpring); setFlag(15); scene44_updateHotspots(); @@ -369,50 +369,50 @@ void GnapEngine::scene44_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(12) && _currKissingLadySequenceId != 0xF5) + if (_beaverActionStatus < 0 && !isFlag(12) && _s44_currKissingLadySequenceId != 0xF5) updateBeaverIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(12)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _nextKissingLadySequenceId == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { _gnapRandomValue = getRandom(20); switch (_gnapRandomValue) { case 0: - _nextKissingLadySequenceId = 0xED; + _s44_nextKissingLadySequenceId = 0xED; break; case 1: - _nextKissingLadySequenceId = 0xEE; + _s44_nextKissingLadySequenceId = 0xEE; break; case 2: - _nextKissingLadySequenceId = 0xF0; + _s44_nextKissingLadySequenceId = 0xF0; break; case 3: - _nextKissingLadySequenceId = 0xF3; + _s44_nextKissingLadySequenceId = 0xF3; break; case 4: - _nextKissingLadySequenceId = 0xF4; + _s44_nextKissingLadySequenceId = 0xF4; break; default: - _nextKissingLadySequenceId = 0xEC; + _s44_nextKissingLadySequenceId = 0xEC; break; } - if (_nextKissingLadySequenceId != 0xEC && _nextKissingLadySequenceId == _currKissingLadySequenceId) - _nextKissingLadySequenceId = -1; + if (_s44_nextKissingLadySequenceId != 0xEC && _s44_nextKissingLadySequenceId == _s44_currKissingLadySequenceId) + _s44_nextKissingLadySequenceId = -1; } } if (!_timers[5]) { _timers[5] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _nextSpringGuySequenceId == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { _gnapRandomValue = getRandom(5); if (_gnapRandomValue != 0) { if (!isFlag(15)) - _nextSpringGuySequenceId = 0xF9; + _s44_nextSpringGuySequenceId = 0xF9; } else { if (isFlag(15)) - _nextSpringGuySequenceId = 0xF8; + _s44_nextSpringGuySequenceId = 0xF8; else - _nextSpringGuySequenceId = 0xFA; + _s44_nextSpringGuySequenceId = 0xFA; } } } @@ -439,10 +439,10 @@ void GnapEngine::scene44_updateAnimations() { _sceneDone = true; break; case 1: - _nextKissingLadySequenceId = 0xEF; + _s44_nextKissingLadySequenceId = 0xEF; break; case 2: - _nextKissingLadySequenceId = 0xF2; + _s44_nextKissingLadySequenceId = 0xF2; break; } _gnapActionStatus = -1; @@ -457,7 +457,7 @@ void GnapEngine::scene44_updateAnimations() { _beaverSequenceId = 0xFE; _beaverSequenceDatNum = 0; _gameSys->setAnimation(0xFE, _beaverId, 1); - _gameSys->removeSequence(_currKissingLadySequenceId, 1, true); + _gameSys->removeSequence(_s44_currKissingLadySequenceId, 1, true); _beaverActionStatus = 5; } break; @@ -472,31 +472,31 @@ void GnapEngine::scene44_updateAnimations() { } if (_gameSys->getAnimationStatus(2) == 2) { - if (_nextKissingLadySequenceId == 0xF6) { - _gameSys->insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + if (_s44_nextKissingLadySequenceId == 0xF6) { + _gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); initBeaverPos(5, 8, 0); - _currKissingLadySequenceId = _nextKissingLadySequenceId; - _nextKissingLadySequenceId = -1; + _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; + _s44_nextKissingLadySequenceId = -1; _gameSys->setAnimation(0, 0, 2); - } else if (_nextKissingLadySequenceId != -1) { - _gameSys->insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_nextKissingLadySequenceId, 1, 2); - _currKissingLadySequenceId = _nextKissingLadySequenceId; - _nextKissingLadySequenceId = -1; + } else if (_s44_nextKissingLadySequenceId != -1) { + _gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s44_nextKissingLadySequenceId, 1, 2); + _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; + _s44_nextKissingLadySequenceId = -1; _timers[4] = getRandom(20) + 20; } } if (_gameSys->getAnimationStatus(4) == 2) { - if (_currSpringGuySequenceId == 0xFB) { + if (_s44_currSpringGuySequenceId == 0xFB) { setGrabCursorSprite(kItemSpring); - _nextSpringGuySequenceId = 0xF8; + _s44_nextSpringGuySequenceId = 0xF8; } - if (_nextSpringGuySequenceId != -1) { - _gameSys->insertSequence(_nextSpringGuySequenceId, 1, _currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_nextSpringGuySequenceId, 1, 4); - _currSpringGuySequenceId = _nextSpringGuySequenceId; - _nextSpringGuySequenceId = -1; + if (_s44_nextSpringGuySequenceId != -1) { + _gameSys->insertSequence(_s44_nextSpringGuySequenceId, 1, _s44_currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s44_nextSpringGuySequenceId, 1, 4); + _s44_currSpringGuySequenceId = _s44_nextSpringGuySequenceId; + _s44_nextSpringGuySequenceId = -1; _timers[5] = getRandom(20) + 20; } } diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index a3dd758545..b25216d5bf 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -93,9 +93,9 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(0x96, 1, 3); _gameSys->insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); _gameSys->setAnimation(0x99, 1, 4); - _currDancerSequenceId = 0x8F; - _gameSys->setAnimation(_currDancerSequenceId, 1, 2); - _gameSys->insertSequence(_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _s45_currDancerSequenceId = 0x8F; + _gameSys->setAnimation(_s45_currDancerSequenceId, 1, 2); + _gameSys->insertSequence(_s45_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -149,9 +149,9 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(0, 0, 2); _gnapRandomValue = getRandom(7); int newSeqId = _gnapRandomValue + 0x8F; - _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(newSeqId, 1, 2); - _currDancerSequenceId = newSeqId; + _s45_currDancerSequenceId = newSeqId; } if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { _gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); @@ -395,9 +395,9 @@ void GnapEngine::scene45_updateAnimations() { _gameSys->setAnimation(0, 0, 2); _gnapRandomValue = getRandom(7); int newSeqId = _gnapRandomValue + 0x8F; - _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(newSeqId, 1, 2); - _currDancerSequenceId = newSeqId; + _s45_currDancerSequenceId = newSeqId; } if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { -- cgit v1.2.3 From b357844bde5e805aaca53ee51adcaee016e53d7c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Mar 2016 19:26:55 +0100 Subject: GNAP: Renaming in scene 46 --- engines/gnap/gnap.h | 8 +++--- engines/gnap/scenes/scene46.cpp | 55 +++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 36 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index a440f4a092..c17ae728f5 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -890,10 +890,10 @@ public: void scene45_updateAnimations(); // Scene 46 - int _s46_dword_47EB18; - int _s46_dword_47EB1C; - int _s46_dword_47EB20; - int _s46_dword_47EB24; + int _s46_currSackGuySequenceId; + int _s46_nextItchyGuySequenceId; + int _s46_nextSackGuySequenceId; + int _s46_currItchyGuySequenceId; int scene46_init(); void scene46_updateHotspots(); void scene46_run(); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index ec061138d3..864f3418d4 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -78,15 +78,15 @@ void GnapEngine::scene46_run() { _gameSys->insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); - _s46_dword_47EB18 = 0x4B; - _s46_dword_47EB20 = -1; + _s46_currSackGuySequenceId = 0x4B; + _s46_nextSackGuySequenceId = -1; _gameSys->setAnimation(0x4B, 1, 3); - _gameSys->insertSequence(_s46_dword_47EB18, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s46_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _s46_dword_47EB24 = 0x47; - _s46_dword_47EB1C = -1; + _s46_currItchyGuySequenceId = 0x47; + _s46_nextItchyGuySequenceId = -1; _gameSys->setAnimation(0x47, 1, 4); - _gameSys->insertSequence(_s46_dword_47EB24, 1, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->insertSequence(_s46_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(12)) { _toyUfoId = 0; @@ -163,11 +163,8 @@ void GnapEngine::scene46_run() { scene46_updateHotspots(); break; } - } else { - switch (_sceneClickedHotspot) { - case kHSDevice: runMenu(); scene46_updateHotspots(); @@ -266,9 +263,7 @@ void GnapEngine::scene46_run() { if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); break; - } - } if (_mouseClickState._left && _gnapActionStatus < 0) { @@ -292,18 +287,18 @@ void GnapEngine::scene46_run() { updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(50) + 80; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_dword_47EB1C == -1) { + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { _gnapRandomValue = getRandom(2); if (_gnapRandomValue != 0) - _s46_dword_47EB1C = 0x49; + _s46_nextItchyGuySequenceId = 0x49; else - _s46_dword_47EB1C = 0x48; + _s46_nextItchyGuySequenceId = 0x48; } } if (!_timers[5]) { _timers[5] = getRandom(50) + 80; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_dword_47EB20 == -1) - _s46_dword_47EB20 = 0x4C; + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_nextSackGuySequenceId == -1) + _s46_nextSackGuySequenceId = 0x4C; } } @@ -316,13 +311,10 @@ void GnapEngine::scene46_run() { } gameUpdateTick(); - } - } void GnapEngine::scene46_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { @@ -330,28 +322,28 @@ void GnapEngine::scene46_updateAnimations() { _sceneDone = true; break; case 1: - _s46_dword_47EB1C = 0x46; + _s46_nextItchyGuySequenceId = 0x46; break; case 2: - _s46_dword_47EB20 = 0x4A; + _s46_nextSackGuySequenceId = 0x4A; break; } _gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s46_dword_47EB20 != -1) { - _gameSys->insertSequence(_s46_dword_47EB20, 1, _s46_dword_47EB18, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s46_dword_47EB20, 1, 3); - _s46_dword_47EB18 = _s46_dword_47EB20; - _s46_dword_47EB20 = -1; + if (_gameSys->getAnimationStatus(3) == 2 && _s46_nextSackGuySequenceId != -1) { + _gameSys->insertSequence(_s46_nextSackGuySequenceId, 1, _s46_currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s46_nextSackGuySequenceId, 1, 3); + _s46_currSackGuySequenceId = _s46_nextSackGuySequenceId; + _s46_nextSackGuySequenceId = -1; _timers[5] = getRandom(50) + 80; } - if (_gameSys->getAnimationStatus(4) == 2 && _s46_dword_47EB1C != -1) { - _gameSys->insertSequence(_s46_dword_47EB1C, 1, _s46_dword_47EB24, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s46_dword_47EB1C, 1, 4); - _s46_dword_47EB24 = _s46_dword_47EB1C; - _s46_dword_47EB1C = -1; + if (_gameSys->getAnimationStatus(4) == 2 && _s46_nextItchyGuySequenceId != -1) { + _gameSys->insertSequence(_s46_nextItchyGuySequenceId, 1, _s46_currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->setAnimation(_s46_nextItchyGuySequenceId, 1, 4); + _s46_currItchyGuySequenceId = _s46_nextItchyGuySequenceId; + _s46_nextItchyGuySequenceId = -1; _timers[4] = getRandom(50) + 80; } @@ -372,7 +364,6 @@ void GnapEngine::scene46_updateAnimations() { } _toyUfoActionStatus = -1; } - } } // End of namespace Gnap -- cgit v1.2.3 From cb69189a50abb8771fc7196c07b8bcfa93c06547 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Mar 2016 23:37:05 +0100 Subject: GNAP: Renaming in cutscenes --- engines/gnap/gnap.cpp | 29 ++++---- engines/gnap/gnap.h | 7 +- engines/gnap/scenes/scene16.cpp | 98 ++++++++++++------------- engines/gnap/scenes/scene47.cpp | 158 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene48.cpp | 78 ++++++++++---------- engines/gnap/scenes/scene54.cpp | 134 +++++++++++++++++----------------- 6 files changed, 250 insertions(+), 254 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 2edfcacabc..30311ea776 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -751,7 +751,7 @@ void GnapEngine::mainLoop() { // > DEBUG BEGIN _currentSceneNum = 53; - _newSceneNum = 42; + _newSceneNum = 48; _newCursorValue = 3; // < DEBUG END @@ -2341,7 +2341,7 @@ void GnapEngine::cutscene_run() { if (_prevSceneNum == 2) { soundId = 0x36B; - duration = MAX(1, 300 / getSequenceTotalDuration(_s99_dword_47F370[_s99_itemsCount - 1]));//CHECKME + duration = MAX(1, 300 / getSequenceTotalDuration(_s99_sequenceIdArr[_s99_itemsCount - 1]));//CHECKME _timers[0] = 0; } @@ -2350,11 +2350,11 @@ void GnapEngine::cutscene_run() { hideCursor(); - _gameSys->drawSpriteToBackground(0, 0, _s99_dword_47F2F0[0]); + _gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[0]); - for (int j = 0; j < _s99_dword_47F330[0]; ++j) - _gameSys->insertSequence(_s99_dword_47F370[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(_s99_dword_47F370[0], 2, 0); + for (int j = 0; j < _s99_sequenceCountArr[0]; ++j) + _gameSys->insertSequence(_s99_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(_s99_sequenceIdArr[0], 2, 0); clearKeyStatus1(Common::KEYCODE_ESCAPE); clearKeyStatus1(Common::KEYCODE_SPACE); @@ -2362,9 +2362,8 @@ void GnapEngine::cutscene_run() { _mouseClickState._left = false; - int v1 = 0; + int firstSequenceIndex = 0; while (!_sceneDone) { - gameUpdateTick(); if (_gameSys->getAnimationStatus(0) == 2 || skip) { @@ -2372,14 +2371,14 @@ void GnapEngine::cutscene_run() { _gameSys->requestClear2(false); _gameSys->requestClear1(); _gameSys->setAnimation(0, 0, 0); - v1 += _s99_dword_47F330[itemIndex++]; + firstSequenceIndex += _s99_sequenceCountArr[itemIndex++]; if (itemIndex >= _s99_itemsCount) { _sceneDone = true; } else { - for (int m = 0; m < _s99_dword_47F330[itemIndex]; ++m) - _gameSys->insertSequence(_s99_dword_47F370[v1 + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->drawSpriteToBackground(0, 0, _s99_dword_47F2F0[itemIndex]); - _gameSys->setAnimation(_s99_dword_47F370[v1], 2, 0); + for (int m = 0; m < _s99_sequenceCountArr[itemIndex]; ++m) + _gameSys->insertSequence(_s99_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[itemIndex]); + _gameSys->setAnimation(_s99_sequenceIdArr[firstSequenceIndex], 2, 0); } } @@ -2398,12 +2397,10 @@ void GnapEngine::cutscene_run() { volume = MAX(1, volume - duration); setSoundVolume(soundId, volume); } - } if (soundId != -1) - stopSound(soundId); - + stopSound(soundId); } } // End of namespace Gnap diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index c17ae728f5..8e23990f52 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -1090,13 +1090,12 @@ public: // Scene 99 int _s99_itemsCount; - int _s99_dword_47F2F0[16]; - int _s99_dword_47F330[16]; - int _s99_dword_47F370[50]; + int _s99_resourceIdArr[16]; + int _s99_sequenceCountArr[16]; + int _s99_sequenceIdArr[50]; byte _s99_canSkip[16]; int cutscene_init(); void cutscene_run(); - }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene16.cpp b/engines/gnap/scenes/scene16.cpp index dfc852293e..64db758545 100644 --- a/engines/gnap/scenes/scene16.cpp +++ b/engines/gnap/scenes/scene16.cpp @@ -27,55 +27,55 @@ namespace Gnap { void GnapEngine::scene16_initCutscene() { - _s99_dword_47F370[0] = 0x1F2; - _s99_dword_47F370[1] = 0x201; - _s99_dword_47F370[2] = 0x1FC; - _s99_dword_47F370[3] = 0x1F4; - _s99_dword_47F370[4] = 0x1FB; - _s99_dword_47F370[5] = 0x1F0; - _s99_dword_47F370[6] = 0x1FD; - _s99_dword_47F370[7] = 0x1FE; - _s99_dword_47F370[8] = 0x1F7; - _s99_dword_47F370[9] = 0x1F9; - _s99_dword_47F370[10] = 0x1F8; - _s99_dword_47F370[11] = 0x1F1; - _s99_dword_47F370[12] = 0x202; - _s99_dword_47F370[13] = 0x1F6; - _s99_dword_47F370[14] = 0x1F3; - _s99_dword_47F370[15] = 0x1FA; - _s99_dword_47F370[16] = 0x1FF; - _s99_dword_47F370[17] = 0x200; - _s99_dword_47F370[18] = 0x203; - _s99_dword_47F370[19] = 0x206; - _s99_dword_47F370[20] = 0x207; - _s99_dword_47F370[21] = 0x204; - _s99_dword_47F370[22] = 0x205; - _s99_dword_47F2F0[0] = 0x1C; - _s99_dword_47F2F0[1] = 2; - _s99_dword_47F2F0[2] = 0x1B; - _s99_dword_47F2F0[3] = 0; - _s99_dword_47F2F0[4] = 0x167; - _s99_dword_47F2F0[5] = 1; - _s99_dword_47F2F0[6] = 0x15B; - _s99_dword_47F2F0[7] = 0x15A; - _s99_dword_47F2F0[8] = 0x170; - _s99_dword_47F2F0[9] = 0x1EB; - _s99_dword_47F2F0[10] = 0x1EC; - _s99_dword_47F2F0[11] = 0x1BE; - _s99_dword_47F2F0[12] = 0x1BF; - _s99_dword_47F330[0] = 4; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = 1; - _s99_dword_47F330[3] = 6; - _s99_dword_47F330[4] = 1; - _s99_dword_47F330[5] = 3; - _s99_dword_47F330[6] = 1; - _s99_dword_47F330[7] = 1; - _s99_dword_47F330[8] = 1; - _s99_dword_47F330[9] = 1; - _s99_dword_47F330[10] = 1; - _s99_dword_47F330[11] = 1; - _s99_dword_47F330[12] = 1; + _s99_sequenceIdArr[0] = 0x1F2; + _s99_sequenceIdArr[1] = 0x201; + _s99_sequenceIdArr[2] = 0x1FC; + _s99_sequenceIdArr[3] = 0x1F4; + _s99_sequenceIdArr[4] = 0x1FB; + _s99_sequenceIdArr[5] = 0x1F0; + _s99_sequenceIdArr[6] = 0x1FD; + _s99_sequenceIdArr[7] = 0x1FE; + _s99_sequenceIdArr[8] = 0x1F7; + _s99_sequenceIdArr[9] = 0x1F9; + _s99_sequenceIdArr[10] = 0x1F8; + _s99_sequenceIdArr[11] = 0x1F1; + _s99_sequenceIdArr[12] = 0x202; + _s99_sequenceIdArr[13] = 0x1F6; + _s99_sequenceIdArr[14] = 0x1F3; + _s99_sequenceIdArr[15] = 0x1FA; + _s99_sequenceIdArr[16] = 0x1FF; + _s99_sequenceIdArr[17] = 0x200; + _s99_sequenceIdArr[18] = 0x203; + _s99_sequenceIdArr[19] = 0x206; + _s99_sequenceIdArr[20] = 0x207; + _s99_sequenceIdArr[21] = 0x204; + _s99_sequenceIdArr[22] = 0x205; + _s99_resourceIdArr[0] = 0x1C; + _s99_resourceIdArr[1] = 2; + _s99_resourceIdArr[2] = 0x1B; + _s99_resourceIdArr[3] = 0; + _s99_resourceIdArr[4] = 0x167; + _s99_resourceIdArr[5] = 1; + _s99_resourceIdArr[6] = 0x15B; + _s99_resourceIdArr[7] = 0x15A; + _s99_resourceIdArr[8] = 0x170; + _s99_resourceIdArr[9] = 0x1EB; + _s99_resourceIdArr[10] = 0x1EC; + _s99_resourceIdArr[11] = 0x1BE; + _s99_resourceIdArr[12] = 0x1BF; + _s99_sequenceCountArr[0] = 4; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = 1; + _s99_sequenceCountArr[3] = 6; + _s99_sequenceCountArr[4] = 1; + _s99_sequenceCountArr[5] = 3; + _s99_sequenceCountArr[6] = 1; + _s99_sequenceCountArr[7] = 1; + _s99_sequenceCountArr[8] = 1; + _s99_sequenceCountArr[9] = 1; + _s99_sequenceCountArr[10] = 1; + _s99_sequenceCountArr[11] = 1; + _s99_sequenceCountArr[12] = 1; _s99_itemsCount = 13; } diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index f4aa91feda..bb5f53286f 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -27,21 +27,21 @@ namespace Gnap { void GnapEngine::scene47_initCutscene1() { - _s99_dword_47F370[0] = 0x301; - _s99_dword_47F370[1] = 0x305; - _s99_dword_47F370[2] = 0x302; - _s99_dword_47F370[3] = 0x304; - _s99_dword_47F370[4] = 0x300; - _s99_dword_47F2F0[0] = 3; - _s99_dword_47F2F0[1] = 0; - _s99_dword_47F2F0[2] = 1; - _s99_dword_47F2F0[3] = 0; - _s99_dword_47F2F0[4] = 2; - _s99_dword_47F330[0] = 1; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = 1; - _s99_dword_47F330[3] = 1; - _s99_dword_47F330[4] = 1; + _s99_sequenceIdArr[0] = 0x301; + _s99_sequenceIdArr[1] = 0x305; + _s99_sequenceIdArr[2] = 0x302; + _s99_sequenceIdArr[3] = 0x304; + _s99_sequenceIdArr[4] = 0x300; + _s99_resourceIdArr[0] = 3; + _s99_resourceIdArr[1] = 0; + _s99_resourceIdArr[2] = 1; + _s99_resourceIdArr[3] = 0; + _s99_resourceIdArr[4] = 2; + _s99_sequenceCountArr[0] = 1; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = 1; + _s99_sequenceCountArr[3] = 1; + _s99_sequenceCountArr[4] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_canSkip[2] = 0; @@ -51,19 +51,19 @@ void GnapEngine::scene47_initCutscene1() { } void GnapEngine::scene47_initCutscene2() { - _s99_dword_47F370[0] = 0x306; - _s99_dword_47F370[1] = 0x309; - _s99_dword_47F370[2] = 0x307; - _s99_dword_47F370[3] = 0x308; - _s99_dword_47F370[4] = 0x30A; - _s99_dword_47F2F0[0] = 0x8E; - _s99_dword_47F2F0[1] = 0x90; - _s99_dword_47F2F0[2] = 0x8F; - _s99_dword_47F2F0[3] = 0x91; - _s99_dword_47F330[0] = 2; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = 1; - _s99_dword_47F330[3] = 1; + _s99_sequenceIdArr[0] = 0x306; + _s99_sequenceIdArr[1] = 0x309; + _s99_sequenceIdArr[2] = 0x307; + _s99_sequenceIdArr[3] = 0x308; + _s99_sequenceIdArr[4] = 0x30A; + _s99_resourceIdArr[0] = 0x8E; + _s99_resourceIdArr[1] = 0x90; + _s99_resourceIdArr[2] = 0x8F; + _s99_resourceIdArr[3] = 0x91; + _s99_sequenceCountArr[0] = 2; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = 1; + _s99_sequenceCountArr[3] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_canSkip[2] = 0; @@ -72,27 +72,27 @@ void GnapEngine::scene47_initCutscene2() { } void GnapEngine::scene47_initCutscene3() { - _s99_dword_47F370[0] = 0x320; - _s99_dword_47F370[1] = 0x321; - _s99_dword_47F2F0[0] = 0x142; - _s99_dword_47F2F0[1] = 0x143; - _s99_dword_47F330[0] = 1; - _s99_dword_47F330[1] = 1; + _s99_sequenceIdArr[0] = 0x320; + _s99_sequenceIdArr[1] = 0x321; + _s99_resourceIdArr[0] = 0x142; + _s99_resourceIdArr[1] = 0x143; + _s99_sequenceCountArr[0] = 1; + _s99_sequenceCountArr[1] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_itemsCount = 2; } void GnapEngine::scene47_initCutscene4() { - _s99_dword_47F370[0] = 0x30C; - _s99_dword_47F370[1] = 0x30D; - _s99_dword_47F370[2] = 0x30B; - _s99_dword_47F2F0[0] = 0x142; - _s99_dword_47F2F0[1] = 0x141; - _s99_dword_47F2F0[2] = 0x177; - _s99_dword_47F330[0] = 1; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = 1; + _s99_sequenceIdArr[0] = 0x30C; + _s99_sequenceIdArr[1] = 0x30D; + _s99_sequenceIdArr[2] = 0x30B; + _s99_resourceIdArr[0] = 0x142; + _s99_resourceIdArr[1] = 0x141; + _s99_resourceIdArr[2] = 0x177; + _s99_sequenceCountArr[0] = 1; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_canSkip[2] = 0; @@ -100,24 +100,24 @@ void GnapEngine::scene47_initCutscene4() { } void GnapEngine::scene47_initCutscene5() { - _s99_dword_47F370[0] = 0x30E; - _s99_dword_47F370[1] = 0x30F; - _s99_dword_47F370[2] = 0x310; - _s99_dword_47F370[3] = 0x311; - _s99_dword_47F2F0[0] = 0x206; - _s99_dword_47F2F0[1] = 0x207; - _s99_dword_47F330[0] = 3; - _s99_dword_47F330[1] = 1; + _s99_sequenceIdArr[0] = 0x30E; + _s99_sequenceIdArr[1] = 0x30F; + _s99_sequenceIdArr[2] = 0x310; + _s99_sequenceIdArr[3] = 0x311; + _s99_resourceIdArr[0] = 0x206; + _s99_resourceIdArr[1] = 0x207; + _s99_sequenceCountArr[0] = 3; + _s99_sequenceCountArr[1] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_itemsCount = 2; } void GnapEngine::scene47_initCutscene6() { - _s99_dword_47F370[0] = 0x31E; - _s99_dword_47F370[1] = 0x31F; - _s99_dword_47F2F0[0] = 0x2FA; - _s99_dword_47F330[0] = 2; + _s99_sequenceIdArr[0] = 0x31E; + _s99_sequenceIdArr[1] = 0x31F; + _s99_resourceIdArr[0] = 0x2FA; + _s99_sequenceCountArr[0] = 2; _s99_canSkip[0] = 0; _s99_itemsCount = 1; } @@ -125,41 +125,41 @@ void GnapEngine::scene47_initCutscene6() { void GnapEngine::scene47_initCutscene7() { int v0, v4, v2, v3; - _s99_dword_47F370[0] = 0x316; - _s99_dword_47F370[1] = 0x31A; - _s99_dword_47F370[2] = 0x314; - _s99_dword_47F370[3] = 0x31B; + _s99_sequenceIdArr[0] = 0x316; + _s99_sequenceIdArr[1] = 0x31A; + _s99_sequenceIdArr[2] = 0x314; + _s99_sequenceIdArr[3] = 0x31B; int v1 = 4; if (!isFlag(3)) { - _s99_dword_47F370[4] = 0x31C; + _s99_sequenceIdArr[4] = 0x31C; v1 = 5; } if (!isFlag(26)) - _s99_dword_47F370[v1++] = 0x31D; + _s99_sequenceIdArr[v1++] = 0x31D; v4 = v1; - _s99_dword_47F370[v1] = 0x319; + _s99_sequenceIdArr[v1] = 0x319; v0 = v1 + 1; v3 = v0; - _s99_dword_47F370[v0++] = 0x317; - _s99_dword_47F370[v0++] = 0x312; - _s99_dword_47F370[v0] = 0x31A; + _s99_sequenceIdArr[v0++] = 0x317; + _s99_sequenceIdArr[v0++] = 0x312; + _s99_sequenceIdArr[v0] = 0x31A; v2 = v0 + 1; if (!isFlag(3)) - _s99_dword_47F370[v2++] = 0x31C; + _s99_sequenceIdArr[v2++] = 0x31C; if (!isFlag(26)) - _s99_dword_47F370[v2++] = 0x31D; - _s99_dword_47F370[v2] = 0x313; - _s99_dword_47F370[v2 + 1] = 0x315; - _s99_dword_47F2F0[0] = 0x2B8; - _s99_dword_47F2F0[1] = 0x20C; - _s99_dword_47F2F0[2] = 0x2B8; - _s99_dword_47F2F0[3] = 0x20B; - _s99_dword_47F2F0[4] = 0x20B; - _s99_dword_47F330[0] = v4; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = v2 - v3; - _s99_dword_47F330[3] = 1; - _s99_dword_47F330[4] = 1; + _s99_sequenceIdArr[v2++] = 0x31D; + _s99_sequenceIdArr[v2] = 0x313; + _s99_sequenceIdArr[v2 + 1] = 0x315; + _s99_resourceIdArr[0] = 0x2B8; + _s99_resourceIdArr[1] = 0x20C; + _s99_resourceIdArr[2] = 0x2B8; + _s99_resourceIdArr[3] = 0x20B; + _s99_resourceIdArr[4] = 0x20B; + _s99_sequenceCountArr[0] = v4; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = v2 - v3; + _s99_sequenceCountArr[3] = 1; + _s99_sequenceCountArr[4] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_canSkip[2] = 0; diff --git a/engines/gnap/scenes/scene48.cpp b/engines/gnap/scenes/scene48.cpp index 3b24d57a8c..3ea0f323d8 100644 --- a/engines/gnap/scenes/scene48.cpp +++ b/engines/gnap/scenes/scene48.cpp @@ -27,45 +27,45 @@ namespace Gnap { void GnapEngine::scene48_initCutscene() { - _s99_dword_47F370[0] = 390; - _s99_dword_47F370[1] = 391; - _s99_dword_47F370[2] = 392; - _s99_dword_47F370[3] = 393; - _s99_dword_47F370[4] = 394; - _s99_dword_47F370[5] = 395; - _s99_dword_47F370[6] = 396; - _s99_dword_47F370[7] = 397; - _s99_dword_47F370[8] = 398; - _s99_dword_47F370[9] = 399; - _s99_dword_47F370[10] = 400; - _s99_dword_47F370[11] = 401; - _s99_dword_47F370[12] = 402; - _s99_dword_47F2F0[0] = 238; - _s99_dword_47F2F0[1] = 42; - _s99_dword_47F2F0[2] = 2; - _s99_dword_47F2F0[3] = 37; - _s99_dword_47F2F0[4] = 35; - _s99_dword_47F2F0[5] = 38; - _s99_dword_47F2F0[6] = 39; - _s99_dword_47F2F0[7] = 40; - _s99_dword_47F2F0[8] = 41; - _s99_dword_47F2F0[9] = 36; - _s99_dword_47F2F0[10] = 41; - _s99_dword_47F2F0[11] = 388; - _s99_dword_47F2F0[12] = 387; - _s99_dword_47F330[0] = 1; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = 1; - _s99_dword_47F330[3] = 1; - _s99_dword_47F330[4] = 1; - _s99_dword_47F330[5] = 1; - _s99_dword_47F330[6] = 1; - _s99_dword_47F330[7] = 1; - _s99_dword_47F330[8] = 1; - _s99_dword_47F330[9] = 1; - _s99_dword_47F330[10] = 1; - _s99_dword_47F330[11] = 1; - _s99_dword_47F330[12] = 1; + _s99_sequenceIdArr[0] = 390; + _s99_sequenceIdArr[1] = 391; + _s99_sequenceIdArr[2] = 392; + _s99_sequenceIdArr[3] = 393; + _s99_sequenceIdArr[4] = 394; + _s99_sequenceIdArr[5] = 395; + _s99_sequenceIdArr[6] = 396; + _s99_sequenceIdArr[7] = 397; + _s99_sequenceIdArr[8] = 398; + _s99_sequenceIdArr[9] = 399; + _s99_sequenceIdArr[10] = 400; + _s99_sequenceIdArr[11] = 401; + _s99_sequenceIdArr[12] = 402; + _s99_resourceIdArr[0] = 238; + _s99_resourceIdArr[1] = 42; + _s99_resourceIdArr[2] = 2; + _s99_resourceIdArr[3] = 37; + _s99_resourceIdArr[4] = 35; + _s99_resourceIdArr[5] = 38; + _s99_resourceIdArr[6] = 39; + _s99_resourceIdArr[7] = 40; + _s99_resourceIdArr[8] = 41; + _s99_resourceIdArr[9] = 36; + _s99_resourceIdArr[10] = 41; + _s99_resourceIdArr[11] = 388; + _s99_resourceIdArr[12] = 387; + _s99_sequenceCountArr[0] = 1; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = 1; + _s99_sequenceCountArr[3] = 1; + _s99_sequenceCountArr[4] = 1; + _s99_sequenceCountArr[5] = 1; + _s99_sequenceCountArr[6] = 1; + _s99_sequenceCountArr[7] = 1; + _s99_sequenceCountArr[8] = 1; + _s99_sequenceCountArr[9] = 1; + _s99_sequenceCountArr[10] = 1; + _s99_sequenceCountArr[11] = 1; + _s99_sequenceCountArr[12] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_canSkip[2] = 0; diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp index 76bc66b9f3..6feb445490 100644 --- a/engines/gnap/scenes/scene54.cpp +++ b/engines/gnap/scenes/scene54.cpp @@ -27,25 +27,25 @@ namespace Gnap { void GnapEngine::scene54_initCutscene1() { - _s99_dword_47F370[0] = 0x1BE; - _s99_dword_47F370[1] = 0x1BF; - _s99_dword_47F370[2] = 0x1BA; - _s99_dword_47F370[3] = 0x1BB; - _s99_dword_47F370[4] = 0x1BD; - _s99_dword_47F370[5] = 0x1BC; - _s99_dword_47F2F0[0] = 0x3C; - _s99_dword_47F2F0[1] = 0x43; - _s99_dword_47F2F0[2] = 0x44; + _s99_sequenceIdArr[0] = 0x1BE; + _s99_sequenceIdArr[1] = 0x1BF; + _s99_sequenceIdArr[2] = 0x1BA; + _s99_sequenceIdArr[3] = 0x1BB; + _s99_sequenceIdArr[4] = 0x1BD; + _s99_sequenceIdArr[5] = 0x1BC; + _s99_resourceIdArr[0] = 0x3C; + _s99_resourceIdArr[1] = 0x43; + _s99_resourceIdArr[2] = 0x44; if (isFlag(20)) - _s99_dword_47F2F0[3] = 0x47; + _s99_resourceIdArr[3] = 0x47; else - _s99_dword_47F2F0[3] = 0x46; - _s99_dword_47F2F0[4] = 0x45; - _s99_dword_47F330[0] = 1; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = 1; - _s99_dword_47F330[3] = 2; - _s99_dword_47F330[4] = 1; + _s99_resourceIdArr[3] = 0x46; + _s99_resourceIdArr[4] = 0x45; + _s99_sequenceCountArr[0] = 1; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = 1; + _s99_sequenceCountArr[3] = 2; + _s99_sequenceCountArr[4] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_canSkip[2] = 0; @@ -55,56 +55,56 @@ void GnapEngine::scene54_initCutscene1() { } void GnapEngine::scene54_initCutscene2() { - _s99_dword_47F370[0] = 0x1C9; - _s99_dword_47F370[1] = 0x1C7; - _s99_dword_47F370[2] = 0x1CC; - _s99_dword_47F370[3] = 0x1C8; - _s99_dword_47F370[4] = 0x1CB; - _s99_dword_47F370[5] = 0x1C0; - _s99_dword_47F370[6] = 0x1CA; - _s99_dword_47F370[7] = 0x1CE; - _s99_dword_47F370[8] = 0x1CD; - _s99_dword_47F370[9] = 0x1C1; - _s99_dword_47F370[10] = 0x1C2; - _s99_dword_47F370[11] = 0x1C3; - _s99_dword_47F370[12] = 0x1C4; - _s99_dword_47F370[13] = 0x1C6; - _s99_dword_47F370[14] = 0x1C5; - _s99_dword_47F370[15] = 0x1D0; - _s99_dword_47F370[16] = 0x1D0; - _s99_dword_47F370[17] = 0x1D0; - _s99_dword_47F2F0[0] = 0xD5; - _s99_dword_47F2F0[1] = 0x14C; - _s99_dword_47F2F0[2] = 0xD5; - _s99_dword_47F2F0[3] = 0xBF; - _s99_dword_47F2F0[4] = 0xD6; - _s99_dword_47F2F0[5] = 0x154; - _s99_dword_47F2F0[6] = 0x155; - _s99_dword_47F2F0[7] = 0xB9; - _s99_dword_47F2F0[8] = 0xBA; - _s99_dword_47F2F0[9] = 0x17B; - _s99_dword_47F2F0[10] = 0x17A; - _s99_dword_47F2F0[11] = 0x17C; - _s99_dword_47F2F0[12] = 0x17A; - _s99_dword_47F2F0[13] = 0x1B7; - _s99_dword_47F2F0[14] = 0x1B8; - _s99_dword_47F2F0[15] = 0x1B9; - _s99_dword_47F330[0] = 2; - _s99_dword_47F330[1] = 1; - _s99_dword_47F330[2] = 2; - _s99_dword_47F330[3] = 1; - _s99_dword_47F330[4] = 1; - _s99_dword_47F330[5] = 1; - _s99_dword_47F330[6] = 1; - _s99_dword_47F330[7] = 1; - _s99_dword_47F330[8] = 1; - _s99_dword_47F330[9] = 1; - _s99_dword_47F330[10] = 1; - _s99_dword_47F330[11] = 1; - _s99_dword_47F330[12] = 1; - _s99_dword_47F330[13] = 1; - _s99_dword_47F330[14] = 1; - _s99_dword_47F330[15] = 1; + _s99_sequenceIdArr[0] = 0x1C9; + _s99_sequenceIdArr[1] = 0x1C7; + _s99_sequenceIdArr[2] = 0x1CC; + _s99_sequenceIdArr[3] = 0x1C8; + _s99_sequenceIdArr[4] = 0x1CB; + _s99_sequenceIdArr[5] = 0x1C0; + _s99_sequenceIdArr[6] = 0x1CA; + _s99_sequenceIdArr[7] = 0x1CE; + _s99_sequenceIdArr[8] = 0x1CD; + _s99_sequenceIdArr[9] = 0x1C1; + _s99_sequenceIdArr[10] = 0x1C2; + _s99_sequenceIdArr[11] = 0x1C3; + _s99_sequenceIdArr[12] = 0x1C4; + _s99_sequenceIdArr[13] = 0x1C6; + _s99_sequenceIdArr[14] = 0x1C5; + _s99_sequenceIdArr[15] = 0x1D0; + _s99_sequenceIdArr[16] = 0x1D0; + _s99_sequenceIdArr[17] = 0x1D0; + _s99_resourceIdArr[0] = 0xD5; + _s99_resourceIdArr[1] = 0x14C; + _s99_resourceIdArr[2] = 0xD5; + _s99_resourceIdArr[3] = 0xBF; + _s99_resourceIdArr[4] = 0xD6; + _s99_resourceIdArr[5] = 0x154; + _s99_resourceIdArr[6] = 0x155; + _s99_resourceIdArr[7] = 0xB9; + _s99_resourceIdArr[8] = 0xBA; + _s99_resourceIdArr[9] = 0x17B; + _s99_resourceIdArr[10] = 0x17A; + _s99_resourceIdArr[11] = 0x17C; + _s99_resourceIdArr[12] = 0x17A; + _s99_resourceIdArr[13] = 0x1B7; + _s99_resourceIdArr[14] = 0x1B8; + _s99_resourceIdArr[15] = 0x1B9; + _s99_sequenceCountArr[0] = 2; + _s99_sequenceCountArr[1] = 1; + _s99_sequenceCountArr[2] = 2; + _s99_sequenceCountArr[3] = 1; + _s99_sequenceCountArr[4] = 1; + _s99_sequenceCountArr[5] = 1; + _s99_sequenceCountArr[6] = 1; + _s99_sequenceCountArr[7] = 1; + _s99_sequenceCountArr[8] = 1; + _s99_sequenceCountArr[9] = 1; + _s99_sequenceCountArr[10] = 1; + _s99_sequenceCountArr[11] = 1; + _s99_sequenceCountArr[12] = 1; + _s99_sequenceCountArr[13] = 1; + _s99_sequenceCountArr[14] = 1; + _s99_sequenceCountArr[15] = 1; _s99_canSkip[0] = 0; _s99_canSkip[1] = 0; _s99_canSkip[2] = 0; -- cgit v1.2.3 From c4f5dd0209a42ef5d3f6cfe81a83c98f0d9853f5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Mar 2016 07:49:38 +0100 Subject: GNAP: Fix compilation --- engines/gnap/configure.engine | 3 +++ engines/gnap/detection.cpp | 2 +- engines/gnap/gamesys.cpp | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 engines/gnap/configure.engine diff --git a/engines/gnap/configure.engine b/engines/gnap/configure.engine new file mode 100644 index 0000000000..7aa538fd2c --- /dev/null +++ b/engines/gnap/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine gnap "UFOs" no diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 88994451a4..ecd07a6103 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -54,7 +54,7 @@ static const ADGameDescription gameDescriptions[] = { class GnapMetaEngine : public AdvancedMetaEngine { public: GnapMetaEngine() : AdvancedMetaEngine(Gnap::gameDescriptions, sizeof(ADGameDescription), gnapGames) { - _singleid = "gnap"; + _singleId = "gnap"; _maxScanDepth = 3; } diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index cced8f3a21..5a72428fb8 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -24,7 +24,7 @@ #include "gnap/fontdata.h" #include "graphics/fontman.h" #include "graphics/font.h" -#include "graphics/decoders/bmp.h" +#include "image/bmp.h" namespace Gnap { @@ -365,7 +365,7 @@ Graphics::Surface *GameSys::loadBitmap(int resourceId) { uint32 resourceSize = _vm->_dat->getResourceSize(resourceId); Common::MemoryReadStream stream(resourceData, resourceSize, DisposeAfterUse::NO); Graphics::Surface *bmpSurface; - Graphics::BitmapDecoder bmp; + Image::BitmapDecoder bmp; if (!bmp.loadStream(stream)) error("GameSys::loadBitmap() Could not load bitmap resource %08X", resourceId); bmpSurface = bmp.getSurface()->convertTo(_vm->_system->getScreenFormat()); -- cgit v1.2.3 From 5ecf00826028b4d3ee6d64f1a4fe67839b34bc43 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 22 Mar 2016 07:07:47 +0100 Subject: GNAP: Use nullptr instead of 0 for some pointers --- engines/gnap/gamesys.cpp | 4 ++-- engines/gnap/resource.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 5a72428fb8..d3e1195f4a 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -360,7 +360,7 @@ int GameSys::getSpriteHeightById(int resourceId) { Graphics::Surface *GameSys::loadBitmap(int resourceId) { debug("GameSys::loadBitmap() resourceId: %08X", resourceId); if (_vm->_dat->getResourceType(resourceId) != 1) - return 0; + return nullptr; byte *resourceData = _vm->_dat->loadResource(resourceId); uint32 resourceSize = _vm->_dat->getResourceSize(resourceId); Common::MemoryReadStream stream(resourceData, resourceSize, DisposeAfterUse::NO); @@ -406,7 +406,7 @@ Sequence *GameSys::seqFind(int sequenceId, int id, int *outIndex) { *outIndex = i; return &_seqItems[i]; } - return 0; + return nullptr; } int GameSys::seqLocateGfx(int sequenceId, int id, int *outGfxIndex) { diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 2ae933f3f7..20dd8d4192 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -169,13 +169,13 @@ protected: CacheMapIterator it = _cache.find(resourceId); if (it != _cache.end()) return it->_value; - return 0; + return nullptr; } ResourceClass *load(int resourceId) { if (_dat->getResourceType(resourceId) != ResourceType) { error("ResourceCache::load() Wrong resource type: Expected %d, got %d", ResourceType, _dat->getResourceType(resourceId)); - return 0; + return nullptr; } byte *resourceData = _dat->loadResource(resourceId); uint32 resourceSize = _dat->getResourceSize(resourceId); -- cgit v1.2.3 From bec37164f840d47bd16b5c094d35f4345eb1d38c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 23 Mar 2016 08:03:33 +0100 Subject: GNAP: Change a couple of variables to boolean, soft refactoring --- engines/gnap/gnap.cpp | 11 +-- engines/gnap/gnap.h | 32 +++---- engines/gnap/scenes/scene49.cpp | 190 +++++++++++++++++++-------------------- engines/gnap/scenes/scene51.cpp | 195 ++++++++++++++++++++-------------------- 4 files changed, 209 insertions(+), 219 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 30311ea776..e0d2f188ba 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -294,7 +294,6 @@ void GnapEngine::gameUpdateTick() { _soundMan->update(); _system->updateScreen(); _system->delayMillis(5); - } void GnapEngine::saveTimers() { @@ -793,7 +792,6 @@ void GnapEngine::mainLoop() { if (_debugLevel == 4) _gameDone = true; } - } if (_backgroundSurface) @@ -804,11 +802,9 @@ void GnapEngine::mainLoop() { // TODO freeFont(); debug("MainLoop #XXX2"); - } void GnapEngine::initScene() { - Common::String datFilename; _isLeavingScene = false; @@ -856,7 +852,6 @@ void GnapEngine::endSceneInit() { } void GnapEngine::afterScene() { - if (_gameDone) return; @@ -906,7 +901,6 @@ void GnapEngine::startSoundTimerA(int timerIndex) { } int GnapEngine::playSoundA() { - static const int kSoundIdsA[] = { 0x93E, 0x93F, 0x941, 0x942, 0x943, 0x944, 0x945, 0x946, 0x947, 0x948, 0x949 @@ -1030,7 +1024,6 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { int sequenceId = 0; switch (kind) { - case gskPullOutDevice: if (gridX > 0 && gridY > 0) { if (_gnapY > gridY) { @@ -1364,14 +1357,12 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { _gnapIdleFacing = 1; } break; - } return sequenceId | 0x10000; } int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { - int sequenceId; int facing = _gnapIdleFacing; @@ -1761,7 +1752,6 @@ void GnapEngine::gnapInitBrainPulseRndValue() { } void GnapEngine::gnapUseDeviceOnBeaver() { - playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _platX, _platY))); if (_beaverFacing != 0) { @@ -1902,6 +1892,7 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { setFlag(10); } +// CHECKME: The 3 parameters are always 0 int GnapEngine::getBeaverSequenceId(int kind, int gridX, int gridY) { int sequenceId; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 8e23990f52..e13158c245 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -214,25 +214,25 @@ enum { // 0x7B0 Gnap walks to the left 2 struct Scene49Obstacle { - int currSequenceId; - int closerSequenceId; - int passedSequenceId; - int splashSequenceId; - int collisionSequenceId; - int prevId; - int currId; - int laneNum; + int _currSequenceId; + int _closerSequenceId; + int _passedSequenceId; + int _splashSequenceId; + int _collisionSequenceId; + int _prevId; + int _currId; + int _laneNum; }; struct Scene51Item { - int currSequenceId; - int droppedSequenceId; - int x, y; - int collisionX; - int canCatch; - int isCollision; - int x2; - int id; + int _currSequenceId; + int _droppedSequenceId; + int _x, _y; + int _collisionX; + bool _canCatch; + bool _isCollision; + int _x2; + int _id; }; class GnapEngine : public Engine { diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index 19da920bf2..9a4714529d 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -70,64 +70,64 @@ void GnapEngine::scene49_checkObstacles() { scene49_clearObstacle(i); for (int j = 0; j < 5; ++j) { - if (_s49_obstacles[j].currSequenceId == 0) { + if (_s49_obstacles[j]._currSequenceId == 0) { _timers[3] = 35; - _s49_obstacles[j].currSequenceId = kObstacleDefs[_s49_obstacleIndex].sequenceId; - switch (_s49_obstacles[j].currSequenceId) { + _s49_obstacles[j]._currSequenceId = kObstacleDefs[_s49_obstacleIndex].sequenceId; + switch (_s49_obstacles[j]._currSequenceId) { case 0xB4: - _s49_obstacles[j].laneNum = 1; - _s49_obstacles[j].closerSequenceId = 180; - _s49_obstacles[j].passedSequenceId = 181; - _s49_obstacles[j].splashSequenceId = 182; - _s49_obstacles[j].collisionSequenceId = 192; + _s49_obstacles[j]._laneNum = 1; + _s49_obstacles[j]._closerSequenceId = 180; + _s49_obstacles[j]._passedSequenceId = 181; + _s49_obstacles[j]._splashSequenceId = 182; + _s49_obstacles[j]._collisionSequenceId = 192; break; case 0xB7: - _s49_obstacles[j].laneNum = 2; - _s49_obstacles[j].closerSequenceId = 183; - _s49_obstacles[j].passedSequenceId = 184; - _s49_obstacles[j].splashSequenceId = 185; - _s49_obstacles[j].collisionSequenceId = 193; + _s49_obstacles[j]._laneNum = 2; + _s49_obstacles[j]._closerSequenceId = 183; + _s49_obstacles[j]._passedSequenceId = 184; + _s49_obstacles[j]._splashSequenceId = 185; + _s49_obstacles[j]._collisionSequenceId = 193; break; case 0xBD: - _s49_obstacles[j].laneNum = 3; - _s49_obstacles[j].closerSequenceId = 189; - _s49_obstacles[j].passedSequenceId = 190; - _s49_obstacles[j].splashSequenceId = 191; - _s49_obstacles[j].collisionSequenceId = 195; + _s49_obstacles[j]._laneNum = 3; + _s49_obstacles[j]._closerSequenceId = 189; + _s49_obstacles[j]._passedSequenceId = 190; + _s49_obstacles[j]._splashSequenceId = 191; + _s49_obstacles[j]._collisionSequenceId = 195; break; case 0xBA: - _s49_obstacles[j].laneNum = 2; - _s49_obstacles[j].closerSequenceId = 186; - _s49_obstacles[j].passedSequenceId = 187; - _s49_obstacles[j].splashSequenceId = 188; - _s49_obstacles[j].collisionSequenceId = 194; + _s49_obstacles[j]._laneNum = 2; + _s49_obstacles[j]._closerSequenceId = 186; + _s49_obstacles[j]._passedSequenceId = 187; + _s49_obstacles[j]._splashSequenceId = 188; + _s49_obstacles[j]._collisionSequenceId = 194; break; case 0xCB: - _s49_obstacles[j].laneNum = 1; - _s49_obstacles[j].closerSequenceId = 203; - _s49_obstacles[j].passedSequenceId = 204; - _s49_obstacles[j].splashSequenceId = 0; - _s49_obstacles[j].collisionSequenceId = 209; + _s49_obstacles[j]._laneNum = 1; + _s49_obstacles[j]._closerSequenceId = 203; + _s49_obstacles[j]._passedSequenceId = 204; + _s49_obstacles[j]._splashSequenceId = 0; + _s49_obstacles[j]._collisionSequenceId = 209; break; case 0xCD: - _s49_obstacles[j].laneNum = 2; - _s49_obstacles[j].closerSequenceId = 205; - _s49_obstacles[j].passedSequenceId = 206; - _s49_obstacles[j].splashSequenceId = 0; - _s49_obstacles[j].collisionSequenceId = 210; + _s49_obstacles[j]._laneNum = 2; + _s49_obstacles[j]._closerSequenceId = 205; + _s49_obstacles[j]._passedSequenceId = 206; + _s49_obstacles[j]._splashSequenceId = 0; + _s49_obstacles[j]._collisionSequenceId = 210; break; case 0xCF: - _s49_obstacles[j].laneNum = 3; - _s49_obstacles[j].closerSequenceId = 207; - _s49_obstacles[j].passedSequenceId = 208; - _s49_obstacles[j].splashSequenceId = 0; - _s49_obstacles[j].collisionSequenceId = 211; + _s49_obstacles[j]._laneNum = 3; + _s49_obstacles[j]._closerSequenceId = 207; + _s49_obstacles[j]._passedSequenceId = 208; + _s49_obstacles[j]._splashSequenceId = 0; + _s49_obstacles[j]._collisionSequenceId = 211; break; } - _s49_obstacles[j].prevId = _s49_truckId; - _s49_obstacles[j].currId = _s49_obstacles[j].prevId; - _gameSys->setAnimation(_s49_obstacles[j].currSequenceId, _s49_obstacles[j].currId, j + 2); - _gameSys->insertSequence(_s49_obstacles[j].currSequenceId, _s49_obstacles[j].currId, 0, 0, kSeqNone, 0, 0, -50); + _s49_obstacles[j]._prevId = _s49_truckId; + _s49_obstacles[j]._currId = _s49_obstacles[j]._prevId; + _gameSys->setAnimation(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, j + 2); + _gameSys->insertSequence(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); _timers[2] = kObstacleDefs[_s49_obstacleIndex].ticks; ++_s49_obstacleIndex; if (_s49_obstacleIndex == 50) @@ -144,83 +144,83 @@ void GnapEngine::scene49_updateObstacle(int id) { Scene49Obstacle &obstacle = _s49_obstacles[id]; - obstacle.currId = obstacle.prevId; + obstacle._currId = obstacle._prevId; - switch (obstacle.laneNum) { + switch (obstacle._laneNum) { case 1: - obstacle.prevId = _s49_truckId + 1; + obstacle._prevId = _s49_truckId + 1; break; case 2: if (_s49_truckLaneNum != 2 && _s49_truckLaneNum != 3) - obstacle.prevId = _s49_truckId - 1; + obstacle._prevId = _s49_truckId - 1; else - obstacle.prevId = _s49_truckId + 1; + obstacle._prevId = _s49_truckId + 1; break; case 3: if (_s49_truckLaneNum != 1 && _s49_truckLaneNum != 2) - obstacle.prevId = _s49_truckId; + obstacle._prevId = _s49_truckId; else - obstacle.prevId = _s49_truckId - 1; + obstacle._prevId = _s49_truckId - 1; break; } - if (obstacle.currSequenceId == obstacle.closerSequenceId) { - if (_s49_truckLaneNum == obstacle.laneNum) { - if (obstacle.splashSequenceId) { - _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, id + 2); - _gameSys->insertSequence(obstacle.collisionSequenceId, obstacle.prevId, - obstacle.currSequenceId, obstacle.currId, + if (obstacle._currSequenceId == obstacle._closerSequenceId) { + if (_s49_truckLaneNum == obstacle._laneNum) { + if (obstacle._splashSequenceId) { + _gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + _gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - obstacle.currSequenceId = obstacle.collisionSequenceId; + obstacle._currSequenceId = obstacle._collisionSequenceId; playSound(224, 0); scene49_increaseScore(30); - } else if ((obstacle.laneNum == 1 && _s49_truckSequenceId == 0xB0) || - (obstacle.laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || - (obstacle.laneNum == 3 && _s49_truckSequenceId == 0xB3)) { - _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, id + 2); - _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, - obstacle.currSequenceId, obstacle.currId, + } else if ((obstacle._laneNum == 1 && _s49_truckSequenceId == 0xB0) || + (obstacle._laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || + (obstacle._laneNum == 3 && _s49_truckSequenceId == 0xB3)) { + _gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + _gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - obstacle.currSequenceId = obstacle.passedSequenceId; + obstacle._currSequenceId = obstacle._passedSequenceId; } else { - _gameSys->setAnimation(obstacle.collisionSequenceId, 256, 0); - _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, id + 2); - _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, - obstacle.currSequenceId, obstacle.currId, + _gameSys->setAnimation(obstacle._collisionSequenceId, 256, 0); + _gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + _gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - _gameSys->insertSequence(obstacle.collisionSequenceId, 256, + _gameSys->insertSequence(obstacle._collisionSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); - _s49_truckSequenceId = obstacle.collisionSequenceId; + _s49_truckSequenceId = obstacle._collisionSequenceId; _s49_truckId = 256; - obstacle.currSequenceId = obstacle.passedSequenceId; + obstacle._currSequenceId = obstacle._passedSequenceId; playSound(225, 0); scene49_decreaseScore(30); } } else { - _gameSys->setAnimation(obstacle.passedSequenceId, obstacle.prevId, id + 2); - _gameSys->insertSequence(obstacle.passedSequenceId, obstacle.prevId, - obstacle.currSequenceId, obstacle.currId, + _gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + _gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - obstacle.currSequenceId = obstacle.passedSequenceId; + obstacle._currSequenceId = obstacle._passedSequenceId; } - } else if (obstacle.currSequenceId == obstacle.passedSequenceId) { - if (_s49_truckLaneNum == obstacle.laneNum) { - if (obstacle.splashSequenceId) { - _gameSys->setAnimation(obstacle.collisionSequenceId, obstacle.prevId, id + 2); - _gameSys->insertSequence(obstacle.collisionSequenceId, obstacle.prevId, - obstacle.currSequenceId, obstacle.currId, + } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { + if (_s49_truckLaneNum == obstacle._laneNum) { + if (obstacle._splashSequenceId) { + _gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + _gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - obstacle.currSequenceId = obstacle.collisionSequenceId; + obstacle._currSequenceId = obstacle._collisionSequenceId; playSound(224, 0); scene49_increaseScore(30); } - } else if (obstacle.splashSequenceId) { - _gameSys->setAnimation(obstacle.splashSequenceId, obstacle.prevId, id + 2); - _gameSys->insertSequence(obstacle.splashSequenceId, obstacle.prevId, - obstacle.currSequenceId, obstacle.currId, + } else if (obstacle._splashSequenceId) { + _gameSys->setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); + _gameSys->insertSequence(obstacle._splashSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - obstacle.currSequenceId = obstacle.splashSequenceId; + obstacle._currSequenceId = obstacle._splashSequenceId; } } else { _gameSys->setAnimation(0, 0, id + 2); @@ -256,14 +256,14 @@ void GnapEngine::scene49_refreshScoreBar() { } void GnapEngine::scene49_clearObstacle(int index) { - _s49_obstacles[index].currSequenceId = 0; - _s49_obstacles[index].closerSequenceId = 0; - _s49_obstacles[index].passedSequenceId = 0; - _s49_obstacles[index].splashSequenceId = 0; - _s49_obstacles[index].collisionSequenceId = 0; - _s49_obstacles[index].prevId = 0; - _s49_obstacles[index].currId = 0; - _s49_obstacles[index].laneNum = 0; + _s49_obstacles[index]._currSequenceId = 0; + _s49_obstacles[index]._closerSequenceId = 0; + _s49_obstacles[index]._passedSequenceId = 0; + _s49_obstacles[index]._splashSequenceId = 0; + _s49_obstacles[index]._collisionSequenceId = 0; + _s49_obstacles[index]._prevId = 0; + _s49_obstacles[index]._currId = 0; + _s49_obstacles[index]._laneNum = 0; } void GnapEngine::scene49_run() { @@ -498,7 +498,7 @@ void GnapEngine::scene49_updateAnimations() { for (int i = 0; i < 5; ++i) { if (_gameSys->getAnimationStatus(i + 2) == 2) { - if (_s49_obstacles[i].currSequenceId) + if (_s49_obstacles[i]._currSequenceId) scene49_updateObstacle(i); } } diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index 1610e36192..d93506ff00 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -58,13 +58,13 @@ void GnapEngine::scene51_updateHotspots() { } void GnapEngine::scene51_clearItem(Scene51Item *item) { - item->currSequenceId = 0; - item->droppedSequenceId = 0; - item->x = 0; - item->y = 0; - item->x2 = 0; - item->collisionX = 0; - item->canCatch = 0; + item->_currSequenceId = 0; + item->_droppedSequenceId = 0; + item->_x = 0; + item->_y = 0; + item->_x2 = 0; + item->_collisionX = 0; + item->_canCatch = false; } void GnapEngine::scene51_dropNextItem() { @@ -74,7 +74,7 @@ void GnapEngine::scene51_dropNextItem() { int index = 0; - while (index < 6 && _s51_items[index].currSequenceId) + while (index < 6 && _s51_items[index]._currSequenceId) ++index; if (index == 6) @@ -84,10 +84,10 @@ void GnapEngine::scene51_dropNextItem() { case 0: if (getRandom(10) != 0 || _s51_itemsCtr2 >= 2) { - _s51_items[index].currSequenceId = 0xBD; + _s51_items[index]._currSequenceId = 0xBD; } else { --_s51_itemsCtr1; - _s51_items[index].currSequenceId = 0xBA; + _s51_items[index]._currSequenceId = 0xBA; ++_s51_itemsCtr2; } break; @@ -100,20 +100,20 @@ void GnapEngine::scene51_dropNextItem() { else _s51_itemInsertX += 70; } - _s51_items[index].currSequenceId = 0xBD; + _s51_items[index]._currSequenceId = 0xBD; } else { --_s51_itemsCtr1; - _s51_items[index].currSequenceId = 0xBA; + _s51_items[index]._currSequenceId = 0xBA; ++_s51_itemsCtr2; } break; case 2: if (getRandom(6) != 0 || _s51_itemsCtr2 >= 2) { - _s51_items[index].currSequenceId = 0xBD; + _s51_items[index]._currSequenceId = 0xBD; } else { --_s51_itemsCtr1; - _s51_items[index].currSequenceId = 0xBA; + _s51_items[index]._currSequenceId = 0xBA; ++_s51_itemsCtr2; } break; @@ -122,19 +122,19 @@ void GnapEngine::scene51_dropNextItem() { case 4: if (_s51_itemsCtr == 0) _s51_itemsCtr1 = 3; - _s51_items[index].currSequenceId = 0xC0; + _s51_items[index]._currSequenceId = 0xC0; break; case 5: case 6: if (getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { if (getRandom(5) != 0) - _s51_items[index].currSequenceId = 0xBD; + _s51_items[index]._currSequenceId = 0xBD; else - _s51_items[index].currSequenceId = 0xC0; + _s51_items[index]._currSequenceId = 0xC0; } else { --_s51_itemsCtr1; - _s51_items[index].currSequenceId = 0xBA; + _s51_items[index]._currSequenceId = 0xBA; ++_s51_itemsCtr2; } break; @@ -148,12 +148,12 @@ void GnapEngine::scene51_dropNextItem() { _s51_itemInsertX += 40; } if (getRandom(9) != 0) - _s51_items[index].currSequenceId = 0xBD; + _s51_items[index]._currSequenceId = 0xBD; else - _s51_items[index].currSequenceId = 0xC0; + _s51_items[index]._currSequenceId = 0xC0; } else { --_s51_itemsCtr1; - _s51_items[index].currSequenceId = 0xBA; + _s51_items[index]._currSequenceId = 0xBA; ++_s51_itemsCtr2; } break; @@ -161,12 +161,12 @@ void GnapEngine::scene51_dropNextItem() { default: if (getRandom(4) != 0 || _s51_itemsCtr2 >= 2) { if (getRandom(9) != 0) - _s51_items[index].currSequenceId = 0xBD; + _s51_items[index]._currSequenceId = 0xBD; else - _s51_items[index].currSequenceId = 0xC0; + _s51_items[index]._currSequenceId = 0xC0; } else { --_s51_itemsCtr1; - _s51_items[index].currSequenceId = 0xBA; + _s51_items[index]._currSequenceId = 0xBA; ++_s51_itemsCtr2; } break; @@ -193,23 +193,23 @@ void GnapEngine::scene51_dropNextItem() { if (_s51_itemInsertX < 129) _s51_itemInsertX = 129; - if (_s51_items[index].currSequenceId == 0xBA) { - _s51_items[index].x2 = getRandom(350) + 200; - _s51_items[index].x = _s51_items[index].x2 - 362; - _s51_items[index].y = 15; - _s51_items[index].id = 249 - index; + if (_s51_items[index]._currSequenceId == 0xBA) { + _s51_items[index]._x2 = getRandom(350) + 200; + _s51_items[index]._x = _s51_items[index]._x2 - 362; + _s51_items[index]._y = 15; + _s51_items[index]._id = 249 - index; } else { - _s51_items[index].collisionX = _s51_itemInsertX; - _s51_items[index].x = _s51_items[index].collisionX - 395; - if (_s51_items[index].currSequenceId == 0xC0) - _s51_items[index].x -= 65; - _s51_items[index].id = index + 250; - _s51_items[index].canCatch = 1; + _s51_items[index]._collisionX = _s51_itemInsertX; + _s51_items[index]._x = _s51_items[index]._collisionX - 395; + if (_s51_items[index]._currSequenceId == 0xC0) + _s51_items[index]._x -= 65; + _s51_items[index]._id = index + 250; + _s51_items[index]._canCatch = true; } - _gameSys->setAnimation(_s51_items[index].currSequenceId, _s51_items[index].id, index + 1); - _gameSys->insertSequence(_s51_items[index].currSequenceId, _s51_items[index].id, 0, 0, - kSeqNone, 0, _s51_items[index].x, _s51_items[index].y); + _gameSys->setAnimation(_s51_items[index]._currSequenceId, _s51_items[index]._id, index + 1); + _gameSys->insertSequence(_s51_items[index]._currSequenceId, _s51_items[index]._id, 0, 0, + kSeqNone, 0, _s51_items[index]._x, _s51_items[index]._y); _timers[0] = _s51_dropSpeedTicks; @@ -234,18 +234,17 @@ void GnapEngine::scene51_updateItemAnimations() { int GnapEngine::scene51_checkCollision(int sequenceId) { bool jumpingLeft = false, jumpingRight = false; - int v6 = 0; - int v2 = 0; int v8, v4; int result = 0; if (!scene51_isJumping(sequenceId)) return false; - while (v6 < 6) - v2 += _s51_items[v6++].isCollision; + bool checkFl = false; + for (int i = 0; i < 6; i++) + checkFl |= _s51_items[i]._isCollision; - if (!v2) + if (!checkFl) return false; if (scene51_isJumpingRight(sequenceId)) { @@ -262,14 +261,14 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { int v5 = 0; int i; for (i = 0; i < 6; ++i) { - if (_s51_items[i].isCollision) { - if (jumpingRight && _s51_items[i].x2 > v8 && _s51_items[i].x2 < v4) { + if (_s51_items[i]._isCollision) { + if (jumpingRight && _s51_items[i]._x2 > v8 && _s51_items[i]._x2 < v4) { v5 = v8 - 359; if (v5 == 0) v5 = 1; _s51_platypusNextSequenceId = 0xB6; break; - } else if (jumpingLeft && _s51_items[i].x2 < v4 && _s51_items[i].x2 > v8) { + } else if (jumpingLeft && _s51_items[i]._x2 < v4 && _s51_items[i]._x2 > v8) { v5 = v8 - 344; if (v5 == 0) v5 = 1; @@ -279,10 +278,10 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { } } if (v5) { - _gameSys->setAnimation(0xBC, _s51_items[i].id, i + 1); - _gameSys->insertSequence(0xBC, _s51_items[i].id, _s51_items[i].currSequenceId, _s51_items[i].id, kSeqSyncWait, 0, _s51_items[i].x, 15); - _s51_items[i].isCollision = 0; - _s51_items[i].currSequenceId = 0xBC; + _gameSys->setAnimation(0xBC, _s51_items[i]._id, i + 1); + _gameSys->insertSequence(0xBC, _s51_items[i]._id, _s51_items[i]._currSequenceId, _s51_items[i]._id, kSeqSyncWait, 0, _s51_items[i]._x, 15); + _s51_items[i]._isCollision = false; + _s51_items[i]._currSequenceId = 0xBC; --_s51_itemsCtr2; } result = v5; @@ -293,14 +292,14 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { - switch (item->currSequenceId) { + switch (item->_currSequenceId) { case 0xBD: case 0xC0: case 0xC1: // Falling coin and banknote if (!scene51_itemIsCaught(item)) { if (_s51_dropLoseCash) { - if (item->currSequenceId == 0xBD) + if (item->_currSequenceId == 0xBD) _s51_cashAmount -= 2; else _s51_cashAmount -= 25; @@ -308,24 +307,24 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { _s51_cashAmount = 0; scene51_updateCash(_s51_cashAmount); } - item->droppedSequenceId = item->currSequenceId + 1; - if (item->currSequenceId != 0xC0) { - item->canCatch = 0; + item->_droppedSequenceId = item->_currSequenceId + 1; + if (item->_currSequenceId != 0xC0) { + item->_canCatch = false; _s51_dropLoseCash = true; _s51_itemsCtr = 0; _timers[0] = 10; } - if (item->droppedSequenceId) { - _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); - _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); - item->currSequenceId = item->droppedSequenceId; - item->y = 0; + if (item->_droppedSequenceId) { + _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; } } else { - _gameSys->removeSequence(item->currSequenceId, item->id, true); + _gameSys->removeSequence(item->_currSequenceId, item->_id, true); _gameSys->setAnimation(0, 0, index + 1); playSound(218, 0); - if (scene51_incCashAmount(item->currSequenceId) == 1995) { + if (scene51_incCashAmount(item->_currSequenceId) == 1995) { scene51_winMinigame(); _sceneDone = true; } else { @@ -356,12 +355,12 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { case 0xBE: // Fallen coin - item->droppedSequenceId = item->currSequenceId + 1; - if (item->droppedSequenceId) { - _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); - _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); - item->currSequenceId = item->droppedSequenceId; - item->y = 0; + item->_droppedSequenceId = item->_currSequenceId + 1; + if (item->_droppedSequenceId) { + _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; } break; @@ -369,40 +368,40 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { case 0xC2: // Bouncing coin and banknote _gameSys->setAnimation(0, 0, index + 1); - _gameSys->removeSequence(item->currSequenceId, item->id, true); + _gameSys->removeSequence(item->_currSequenceId, item->_id, true); scene51_clearItem(item); break; case 0xBA: // Falling banana peel - item->droppedSequenceId = 0xBB; - item->y = 15; - if (item->droppedSequenceId) { - _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); - _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); - item->currSequenceId = item->droppedSequenceId; - item->y = 0; + item->_droppedSequenceId = 0xBB; + item->_y = 15; + if (item->_droppedSequenceId) { + _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; } break; case 0xBB: - item->isCollision = 1; - item->droppedSequenceId = 0; + item->_isCollision = true; + item->_droppedSequenceId = 0; _gameSys->setAnimation(0, 0, index + 1); break; case 0xBC: - _gameSys->removeSequence(item->currSequenceId, item->id, true); + _gameSys->removeSequence(item->_currSequenceId, item->_id, true); _gameSys->setAnimation(0, 0, index + 1); scene51_clearItem(item); break; default: - if (item->droppedSequenceId) { - _gameSys->setAnimation(item->droppedSequenceId, item->id, index + 1); - _gameSys->insertSequence(item->droppedSequenceId, item->id, item->currSequenceId, item->id, kSeqSyncWait, 0, item->x, item->y); - item->currSequenceId = item->droppedSequenceId; - item->y = 0; + if (item->_droppedSequenceId) { + _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; } break; @@ -412,8 +411,8 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { void GnapEngine::scene51_removeCollidedItems() { for (int i = 0; i < 6; ++i) { - if (_s51_items[i].isCollision) { - _gameSys->removeSequence(_s51_items[i].currSequenceId, _s51_items[i].id, true); + if (_s51_items[i]._isCollision) { + _gameSys->removeSequence(_s51_items[i]._currSequenceId, _s51_items[i]._id, true); _gameSys->setAnimation(0, 0, i + 1); scene51_clearItem(&_s51_items[i]); } @@ -423,21 +422,21 @@ void GnapEngine::scene51_removeCollidedItems() { int GnapEngine::scene51_itemIsCaught(Scene51Item *item) { - if (!item->canCatch) + if (!item->_canCatch) return 0; if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { int v4 = scene51_getPosRight(_s51_platypusJumpSequenceId) + 97; - if (item->collisionX < v4 && v4 - item->collisionX < 56) + if (item->_collisionX < v4 && v4 - item->_collisionX < 56) return 1; } else { int v2 = scene51_getPosLeft(_s51_platypusJumpSequenceId); - if (item->collisionX > v2 && item->collisionX - v2 < 56) + if (item->_collisionX > v2 && item->_collisionX - v2 < 56) return 1; } - if (item->currSequenceId == 0xC1) { - int v3 = item->collisionX + 100; + if (item->_currSequenceId == 0xC1) { + int v3 = item->_collisionX + 100; if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { if (ABS(scene51_getPosRight(_s51_platypusJumpSequenceId) + 46 - v3) < 56) return 1; @@ -504,15 +503,15 @@ void GnapEngine::scene51_playIntroAnim() { for (int i = 0; i < 6; ++i) scene51_clearItem(&_s51_items[i]); - _s51_items[0].currSequenceId = 0xBA; - _s51_items[0].x2 = 320; - _s51_items[0].x = -42; - _s51_items[0].y = 15; - _s51_items[0].id = 249; - _s51_items[0].isCollision = 1; + _s51_items[0]._currSequenceId = 0xBA; + _s51_items[0]._x2 = 320; + _s51_items[0]._x = -42; + _s51_items[0]._y = 15; + _s51_items[0]._id = 249; + _s51_items[0]._isCollision = true; _gameSys->insertSequence(_s51_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0); - _gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _s51_items[0].x, _s51_items[0].y); + _gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _s51_items[0]._x, _s51_items[0]._y); _gameSys->setAnimation(0xBA, 249, 1); _gameSys->setAnimation(_s51_platypusSequenceId, 256, 0); -- cgit v1.2.3 From ecc3e2a786629d06fbcf17e4d74605215efdc1ef Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 25 Mar 2016 07:33:22 +0100 Subject: GNAP: Change the type of some variables to boolean --- engines/gnap/gnap.cpp | 2 +- engines/gnap/gnap.h | 10 ++++++---- engines/gnap/scenes/scene47.cpp | 44 ++++++++++++++++++++--------------------- engines/gnap/scenes/scene48.cpp | 26 ++++++++++++------------ engines/gnap/scenes/scene52.cpp | 12 +++++------ engines/gnap/scenes/scene54.cpp | 42 +++++++++++++++++++-------------------- 6 files changed, 69 insertions(+), 67 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e0d2f188ba..1a3bcf4f44 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2377,7 +2377,7 @@ void GnapEngine::cutscene_run() { clearKeyStatus1(Common::KEYCODE_ESCAPE); clearKeyStatus1(Common::KEYCODE_SPACE); clearKeyStatus1(29); - if (_s99_canSkip[itemIndex] & 1) + if (_s99_canSkip[itemIndex]) skip = true; else _sceneDone = true; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index e13158c245..5eaa25d5b5 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -912,7 +912,8 @@ public: void scene48_initCutscene(); // Scene 49 - int _s49_scoreBarPos, _s49_scoreLevel, _s49_scoreBarFlash; + int _s49_scoreBarPos, _s49_scoreLevel; + bool _s49_scoreBarFlash; int _s49_obstacleIndex; Scene49Obstacle _s49_obstacles[5]; int _s49_truckSequenceId, _s49_truckId, _s49_truckLaneNum; @@ -1009,8 +1010,9 @@ public: int _s52_shieldSpriteIds[3]; int _s52_shieldPosX[3]; int _s52_shipPosX; - int _s52_shipCannonFired, _s52_shipCannonPosX, _s52_shipCannonPosY; - int _s52_shipCannonFiring; + int _s52_shipCannonPosX, _s52_shipCannonPosY; + bool _s52_shipCannonFiring; + bool _s52_shipCannonFired; int _s52_shipCannonWidth, _s52_shipCannonHeight; int _s52_shipCannonTopY; int _s52_shipMidX, _s52_shipMidY; @@ -1093,7 +1095,7 @@ public: int _s99_resourceIdArr[16]; int _s99_sequenceCountArr[16]; int _s99_sequenceIdArr[50]; - byte _s99_canSkip[16]; + bool _s99_canSkip[16]; int cutscene_init(); void cutscene_run(); }; diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index bb5f53286f..d692e1d83d 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -42,11 +42,11 @@ void GnapEngine::scene47_initCutscene1() { _s99_sequenceCountArr[2] = 1; _s99_sequenceCountArr[3] = 1; _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; - _s99_canSkip[2] = 0; - _s99_canSkip[3] = 0; - _s99_canSkip[4] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; + _s99_canSkip[2] = false; + _s99_canSkip[3] = false; + _s99_canSkip[4] = false; _s99_itemsCount = 5; } @@ -64,10 +64,10 @@ void GnapEngine::scene47_initCutscene2() { _s99_sequenceCountArr[1] = 1; _s99_sequenceCountArr[2] = 1; _s99_sequenceCountArr[3] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; - _s99_canSkip[2] = 0; - _s99_canSkip[3] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; + _s99_canSkip[2] = false; + _s99_canSkip[3] = false; _s99_itemsCount = 4; } @@ -78,8 +78,8 @@ void GnapEngine::scene47_initCutscene3() { _s99_resourceIdArr[1] = 0x143; _s99_sequenceCountArr[0] = 1; _s99_sequenceCountArr[1] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; _s99_itemsCount = 2; } @@ -93,9 +93,9 @@ void GnapEngine::scene47_initCutscene4() { _s99_sequenceCountArr[0] = 1; _s99_sequenceCountArr[1] = 1; _s99_sequenceCountArr[2] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; - _s99_canSkip[2] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; + _s99_canSkip[2] = false; _s99_itemsCount = 3; } @@ -108,8 +108,8 @@ void GnapEngine::scene47_initCutscene5() { _s99_resourceIdArr[1] = 0x207; _s99_sequenceCountArr[0] = 3; _s99_sequenceCountArr[1] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; _s99_itemsCount = 2; } @@ -118,7 +118,7 @@ void GnapEngine::scene47_initCutscene6() { _s99_sequenceIdArr[1] = 0x31F; _s99_resourceIdArr[0] = 0x2FA; _s99_sequenceCountArr[0] = 2; - _s99_canSkip[0] = 0; + _s99_canSkip[0] = false; _s99_itemsCount = 1; } @@ -160,11 +160,11 @@ void GnapEngine::scene47_initCutscene7() { _s99_sequenceCountArr[2] = v2 - v3; _s99_sequenceCountArr[3] = 1; _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; - _s99_canSkip[2] = 0; - _s99_canSkip[3] = 0; - _s99_canSkip[4] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; + _s99_canSkip[2] = false; + _s99_canSkip[3] = false; + _s99_canSkip[4] = false; _s99_itemsCount = 5; } diff --git a/engines/gnap/scenes/scene48.cpp b/engines/gnap/scenes/scene48.cpp index 3ea0f323d8..a614ca4549 100644 --- a/engines/gnap/scenes/scene48.cpp +++ b/engines/gnap/scenes/scene48.cpp @@ -66,19 +66,19 @@ void GnapEngine::scene48_initCutscene() { _s99_sequenceCountArr[10] = 1; _s99_sequenceCountArr[11] = 1; _s99_sequenceCountArr[12] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; - _s99_canSkip[2] = 0; - _s99_canSkip[3] = 0; - _s99_canSkip[4] = 0; - _s99_canSkip[5] = 0; - _s99_canSkip[6] = 0; - _s99_canSkip[7] = 0; - _s99_canSkip[8] = 0; - _s99_canSkip[9] = 0; - _s99_canSkip[10] = 0; - _s99_canSkip[11] = 0; - _s99_canSkip[12] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; + _s99_canSkip[2] = false; + _s99_canSkip[3] = false; + _s99_canSkip[4] = false; + _s99_canSkip[5] = false; + _s99_canSkip[6] = false; + _s99_canSkip[7] = false; + _s99_canSkip[8] = false; + _s99_canSkip[9] = false; + _s99_canSkip[10] = false; + _s99_canSkip[11] = false; + _s99_canSkip[12] = false; _s99_itemsCount = 13; } diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index 369668555d..0b00b4299a 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -144,11 +144,11 @@ void GnapEngine::scene52_update() { } void GnapEngine::scene52_initShipCannon(int bottomY) { - _s52_shipCannonFired = 0; + _s52_shipCannonFired = false; _s52_shipCannonWidth = MAX(_gameSys->getSpriteWidthById(14), _gameSys->getSpriteWidthById(16)); _s52_shipCannonHeight = MAX(_gameSys->getSpriteHeightById(14), _gameSys->getSpriteHeightById(16)); _s52_shipCannonTopY = bottomY - _s52_shipCannonHeight; - _s52_shipCannonFiring = 0; + _s52_shipCannonFiring = false; } void GnapEngine::scene52_initAlienCannons() { @@ -177,9 +177,9 @@ void GnapEngine::scene52_fireShipCannon(int posX) { _gameSys->setAnimation(0, 0, cannonNum + 8); _gameSys->removeSequence(0x23, cannonNum + 256, true); } else { - _s52_shipCannonFired = 1; + _s52_shipCannonFired = true; _s52_shipCannonPosY -= 13; - _s52_shipCannonFiring = 1; + _s52_shipCannonFiring = true; } _timers[1] = 5; } @@ -227,7 +227,7 @@ void GnapEngine::scene52_updateShipCannon() { if (scene52_updateHitAlien()) { _gameSys->setAnimation(0, 0, 8); _gameSys->removeSequence(35, 256, true); - _s52_shipCannonFired = 0; + _s52_shipCannonFired = false; scene52_drawScore(_s52_gameScore); } else { _gameSys->setAnimation(35, 256, 8); @@ -237,7 +237,7 @@ void GnapEngine::scene52_updateShipCannon() { } else { _gameSys->setAnimation(0, 0, 8); _gameSys->removeSequence(35, 256, true); - _s52_shipCannonFired = 0; + _s52_shipCannonFired = false; } } } diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp index 6feb445490..387b17c28c 100644 --- a/engines/gnap/scenes/scene54.cpp +++ b/engines/gnap/scenes/scene54.cpp @@ -46,11 +46,11 @@ void GnapEngine::scene54_initCutscene1() { _s99_sequenceCountArr[2] = 1; _s99_sequenceCountArr[3] = 2; _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; - _s99_canSkip[2] = 0; - _s99_canSkip[3] = 0; - _s99_canSkip[4] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; + _s99_canSkip[2] = false; + _s99_canSkip[3] = false; + _s99_canSkip[4] = false; _s99_itemsCount = 5; } @@ -105,22 +105,22 @@ void GnapEngine::scene54_initCutscene2() { _s99_sequenceCountArr[13] = 1; _s99_sequenceCountArr[14] = 1; _s99_sequenceCountArr[15] = 1; - _s99_canSkip[0] = 0; - _s99_canSkip[1] = 0; - _s99_canSkip[2] = 0; - _s99_canSkip[3] = 0; - _s99_canSkip[4] = 0; - _s99_canSkip[5] = 0; - _s99_canSkip[6] = 0; - _s99_canSkip[7] = 0; - _s99_canSkip[8] = 0; - _s99_canSkip[9] = 0; - _s99_canSkip[10] = 0; - _s99_canSkip[11] = 0; - _s99_canSkip[12] = 0; - _s99_canSkip[13] = 1; - _s99_canSkip[14] = 1; - _s99_canSkip[15] = 0; + _s99_canSkip[0] = false; + _s99_canSkip[1] = false; + _s99_canSkip[2] = false; + _s99_canSkip[3] = false; + _s99_canSkip[4] = false; + _s99_canSkip[5] = false; + _s99_canSkip[6] = false; + _s99_canSkip[7] = false; + _s99_canSkip[8] = false; + _s99_canSkip[9] = false; + _s99_canSkip[10] = false; + _s99_canSkip[11] = false; + _s99_canSkip[12] = false; + _s99_canSkip[13] = true; + _s99_canSkip[14] = true; + _s99_canSkip[15] = false; _s99_itemsCount = 16; } -- cgit v1.2.3 From f3a164342b4f62c3bdf02c226880e6d2d6316a66 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 25 Mar 2016 07:49:43 +0100 Subject: GNAP: Remove a global variable used for randomization --- engines/gnap/gnap.cpp | 25 +++++++++++-------------- engines/gnap/gnap.h | 1 - engines/gnap/scenes/scene07.cpp | 2 +- engines/gnap/scenes/scene08.cpp | 2 +- engines/gnap/scenes/scene10.cpp | 31 ++++++++++++++++--------------- engines/gnap/scenes/scene11.cpp | 8 +++----- engines/gnap/scenes/scene12.cpp | 5 ++--- engines/gnap/scenes/scene13.cpp | 6 ++---- engines/gnap/scenes/scene41.cpp | 3 +-- engines/gnap/scenes/scene42.cpp | 3 +-- engines/gnap/scenes/scene43.cpp | 3 +-- engines/gnap/scenes/scene44.cpp | 6 ++---- engines/gnap/scenes/scene45.cpp | 10 ++++------ engines/gnap/scenes/scene46.cpp | 3 +-- 14 files changed, 46 insertions(+), 62 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 1a3bcf4f44..5077568444 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1632,9 +1632,8 @@ void GnapEngine::updateGnapIdleSequence() { if (_timers[3] == 0) { _timers[2] = 60; _timers[3] = 300; - _gnapRandomValue = getRandom(5); if (_gnapIdleFacing == 1) { - switch (_gnapRandomValue) { + switch (getRandom(5)) { case 0: playGnapSequence(0x107A6); break; @@ -1649,7 +1648,7 @@ void GnapEngine::updateGnapIdleSequence() { break; } } else if (_gnapIdleFacing == 3) { - if (_gnapRandomValue > 2) + if (getRandom(5) > 2) playGnapSequence(0x10832); else playGnapSequence(0x10842); @@ -1932,19 +1931,19 @@ void GnapEngine::updateBeaverIdleSequence() { if (_timers[0] > 0) { if (_timers[1] == 0) { _timers[1] = getRandom(20) + 30; - _gnapRandomValue = getRandom(10); + int rnd = getRandom(10); if (_beaverFacing != 0) { - if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7CA) { - if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7CA) + if (rnd != 0 || _beaverSequenceId != 0x7CA) { + if (rnd != 1 || _beaverSequenceId != 0x7CA) playBeaverSequence(0x107CA); else playBeaverSequence(0x10845); } else { playBeaverSequence(0x107CC); } - } else if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7C9) { - if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7C9) { - if (_gnapRandomValue != 2 || _beaverSequenceId != 0x7C9) + } else if (rnd != 0 || _beaverSequenceId != 0x7C9) { + if (rnd != 1 || _beaverSequenceId != 0x7C9) { + if (rnd != 2 || _beaverSequenceId != 0x7C9) playBeaverSequence(0x107C9); else playBeaverSequence(0x108A4); @@ -1970,14 +1969,13 @@ void GnapEngine::beaverSub426234() { if (_timers[0]) { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; - _gnapRandomValue = getRandom(10); if (_beaverFacing != 0) { - if (_gnapRandomValue >= 2 || _beaverSequenceId != 0x7CA) + if (getRandom(10) >= 2 || _beaverSequenceId != 0x7CA) playBeaverSequence(0x107CA); else playBeaverSequence(0x107CC); } else { - if (_gnapRandomValue >= 2 || _beaverSequenceId != 0x7C9) { + if (getRandom(10) >= 2 || _beaverSequenceId != 0x7C9) { playBeaverSequence(0x107C9); } else { playBeaverSequence(0x107CB); @@ -2136,8 +2134,7 @@ bool GnapEngine::sceneXX_sub_4466B1() { void GnapEngine::sceneXX_playRandomSound(int timerIndex) { if (!_timers[timerIndex]) { _timers[timerIndex] = getRandom(40) + 50; - _gnapRandomValue = getRandom(4); - switch (_gnapRandomValue) { + switch (getRandom(4)) { case 0: playSound(0x1091B, 0); break; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 5eaa25d5b5..d376ffd5c9 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -487,7 +487,6 @@ public: int _gnapActionStatus; int _gnapBrainPulseNum, _gnapBrainPulseRndValue; int _gnapSequenceId, _gnapSequenceDatNum, _gnapId; - int _gnapRandomValue; int getGnapSequenceId(int kind, int gridX, int gridY); int getGnapShowSequenceId(int index, int gridX, int gridY); diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index aa486b6fb1..c6eda8f3a1 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -201,7 +201,7 @@ void GnapEngine::scene07_run() { if (_timers[0]) { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; - _gnapRandomValue = getRandom(20); + int _gnapRandomValue = getRandom(20); // TODO Cleanup if (_beaverFacing != 0) { if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7CA) { diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index 29437251b6..01e77084b9 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -364,7 +364,7 @@ void GnapEngine::scene08_run() { _timers[4] = getRandom(50) + 125; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s08_nextManSequenceId == -1 && (_s08_currDogSequenceId == 0x134 || _s08_currDogSequenceId == 0x135)) { - _gnapRandomValue = getRandom(4); + int _gnapRandomValue = getRandom(4); switch (_gnapRandomValue) { case 0: _s08_nextManSequenceId = 0x138; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index e2da08e3bd..aea4a34789 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -329,7 +329,7 @@ void GnapEngine::scene10_run() { } if (!_timers[5]) { _timers[5] = getRandom(100) + 100; - _gnapRandomValue = getRandom(4); + int _gnapRandomValue = getRandom(4); if (_gnapRandomValue) { int sequenceId; if (_gnapRandomValue == 1) { @@ -428,45 +428,46 @@ void GnapEngine::scene10_updateAnimations() { } switch (_s10_currCookSequenceId) { - case 0x106: - _gnapRandomValue = getRandom(7); + case 0x106: { + // TODO: Refactor into a if + a switch + int rnd = getRandom(7); if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) _s10_nextCookSequenceId = 0x106; - else if (_gnapRandomValue == 0) + else if (rnd == 0) _s10_nextCookSequenceId = 0x104; - else if (_gnapRandomValue == 1) + else if (rnd == 1) _s10_nextCookSequenceId = 0x103; - else if (_gnapRandomValue == 2) { + else if (rnd == 2) { _s10_nextCookSequenceId = 0x106; _gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); } else _s10_nextCookSequenceId = 0x106; + } break; case 0x103: - _gnapRandomValue = getRandom(7); if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) _s10_nextCookSequenceId = 0x106; - else if (_gnapRandomValue == 0) + else if (getRandom(7) == 0) _s10_nextCookSequenceId = 0x104; else _s10_nextCookSequenceId = 0x106; break; case 0x104: - _gnapRandomValue = getRandom(7); if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) _s10_nextCookSequenceId = 0x106; - else if (_gnapRandomValue == 0) + else if (getRandom(7) == 0) _s10_nextCookSequenceId = 0x103; else _s10_nextCookSequenceId = 0x106; break; - case 0x105: - _gnapRandomValue = getRandom(7); + case 0x105: { + // TODO: Refactor into a if + a switch + int rnd = getRandom(7); if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) _s10_nextCookSequenceId = 0x106; - else if (_gnapRandomValue == 0) + else if (rnd == 0) _s10_nextCookSequenceId = 0x104; - else if (_gnapRandomValue == 1) + else if (rnd == 1) _s10_nextCookSequenceId = 0x103; else _s10_nextCookSequenceId = 0x106; @@ -478,6 +479,7 @@ void GnapEngine::scene10_updateAnimations() { _gnapSequenceDatNum = 0; _gnapActionStatus = -1; _beaverActionStatus = -1; + } break; } if (_s10_currCookSequenceId == 0x843) @@ -485,7 +487,6 @@ void GnapEngine::scene10_updateAnimations() { else _gameSys->setAnimation(_s10_currCookSequenceId, 100, 2); } - } void GnapEngine::scene10_updateAnimationsCb() { diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 8097b23e73..04509eef5c 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -311,8 +311,7 @@ void GnapEngine::scene11_run() { if (!_timers[5]) { _timers[5] = getRandom(100) + 75; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) { - _gnapRandomValue = getRandom(2); - if (_gnapRandomValue) + if (getRandom(2)) _s11_nextGoggleGuySequenceId = 0x1F6; else _s11_nextGoggleGuySequenceId = 0x1F9; @@ -322,8 +321,7 @@ void GnapEngine::scene11_run() { _timers[4] = getRandom(40) + 20; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s11_nextHookGuySequenceId == -1) { if (_s11_currHookGuySequenceId == 0x201) { - _gnapRandomValue = getRandom(7); - switch (_gnapRandomValue) { + switch (getRandom(7)) { case 0: _s11_nextHookGuySequenceId = 0x200; break; @@ -344,7 +342,7 @@ void GnapEngine::scene11_run() { } if (!_timers[6]) { _timers[6] = getRandom(100) + 100; - _gnapRandomValue = getRandom(3); + int _gnapRandomValue = getRandom(3); switch (_gnapRandomValue) { case 0: _gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index 4bc10fcb43..f26bb30f0b 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -347,7 +347,7 @@ void GnapEngine::scene12_run() { } if (!_timers[7]) { _timers[7] = getRandom(100) + 100; - _gnapRandomValue = getRandom(3); + int _gnapRandomValue = getRandom(3); switch (_gnapRandomValue) { case 0: _gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); @@ -450,8 +450,7 @@ void GnapEngine::scene12_updateAnimations() { _s12_nextBeardGuySequenceId = 0x1F0; break; case kASTalkBarkeeper: - _gnapRandomValue = getRandom(2); - if (_gnapRandomValue != 0) + if (getRandom(2) != 0) _s12_nextBarkeeperSequenceId = 0x1FD; else _s12_nextBarkeeperSequenceId = 0x1FF; diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 2897f687db..4d7b6d01c6 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -324,8 +324,7 @@ void GnapEngine::scene13_run() { updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 20; - _gnapRandomValue = getRandom(5); - switch (_gnapRandomValue) { + switch (getRandom(5)) { case 0: playSound(0xD2, 0); break; @@ -346,8 +345,7 @@ void GnapEngine::scene13_run() { if (!_timers[5]) { int newSoundId; _timers[5] = getRandom(50) + 50; - _gnapRandomValue = getRandom(7); - switch (_gnapRandomValue) { + switch (getRandom(7)) { case 0: newSoundId = 0xD7; _timers[5] = 2 * getRandom(50) + 100; diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index b84c4ba988..ca5c677264 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -394,8 +394,7 @@ void GnapEngine::scene41_run() { if (!_timers[4]) { _timers[4] = getRandom(100) + 100; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { - _gnapRandomValue = getRandom(3); - switch (_gnapRandomValue) { + switch (getRandom(3)) { case 0: _s41_nextToyVendorSequenceId = 0x113; break; diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 8de3a694eb..3826f7b29b 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -330,8 +330,7 @@ void GnapEngine::scene42_run() { if (!_timers[4]) { _timers[4] = getRandom(20) + 30; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { - _gnapRandomValue = getRandom(8); - switch (_gnapRandomValue) { + switch (getRandom(8)) { case 0: _s42_nextBBQVendorSequenceId = 0x14C; break; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 51917d5389..957aea3ec6 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -333,8 +333,7 @@ void GnapEngine::scene43_run() { if (!_timers[4] && (!isFlag(12) || !isFlag(19))) { _timers[4] = getRandom(100) + 100; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { - _gnapRandomValue = getRandom(5); - switch (_gnapRandomValue) { + switch (getRandom(5)) { case 0: _s43_nextTwoHeadedGuySequenceId = 0x13C; break; diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index c0905c7434..3bcde76fc6 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -376,8 +376,7 @@ void GnapEngine::scene44_run() { if (!_timers[4]) { _timers[4] = getRandom(20) + 20; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { - _gnapRandomValue = getRandom(20); - switch (_gnapRandomValue) { + switch (getRandom(20)) { case 0: _s44_nextKissingLadySequenceId = 0xED; break; @@ -404,8 +403,7 @@ void GnapEngine::scene44_run() { if (!_timers[5]) { _timers[5] = getRandom(20) + 20; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { - _gnapRandomValue = getRandom(5); - if (_gnapRandomValue != 0) { + if (getRandom(5) != 0) { if (!isFlag(15)) _s44_nextSpringGuySequenceId = 0xF9; } else { diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index b25216d5bf..87d52bef4b 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -147,9 +147,8 @@ void GnapEngine::scene45_run() { gameUpdateTick(); if (_gameSys->getAnimationStatus(2) == 2) { _gameSys->setAnimation(0, 0, 2); - _gnapRandomValue = getRandom(7); - int newSeqId = _gnapRandomValue + 0x8F; - _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + int newSeqId = getRandom(7) + 0x8F; + _gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(newSeqId, 1, 2); _s45_currDancerSequenceId = newSeqId; } @@ -393,9 +392,8 @@ void GnapEngine::scene45_updateAnimations() { if (_gameSys->getAnimationStatus(2) == 2) { _gameSys->setAnimation(0, 0, 2); - _gnapRandomValue = getRandom(7); - int newSeqId = _gnapRandomValue + 0x8F; - _gameSys->insertSequence(_gnapRandomValue + 0x8F, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + int newSeqId = getRandom(7) + 0x8F; + _gameSys->insertSequence(newSeqId + 0x8F, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(newSeqId, 1, 2); _s45_currDancerSequenceId = newSeqId; } diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 864f3418d4..544829207e 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -288,8 +288,7 @@ void GnapEngine::scene46_run() { if (!_timers[4]) { _timers[4] = getRandom(50) + 80; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { - _gnapRandomValue = getRandom(2); - if (_gnapRandomValue != 0) + if (getRandom(2) != 0) _s46_nextItchyGuySequenceId = 0x49; else _s46_nextItchyGuySequenceId = 0x48; -- cgit v1.2.3 From dca374efcde85472676a67e2af3decfeee51589e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 25 Mar 2016 18:19:39 +0100 Subject: GNAP: Change another variable to boolean --- engines/gnap/gamesys.cpp | 10 +++++----- engines/gnap/resource.cpp | 2 +- engines/gnap/resource.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index d3e1195f4a..88b5ea2e53 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -491,7 +491,7 @@ void GameSys::seqInsertGfx(int index, int duration) { (_backgroundImageValue3 - _backgroundImageValue1); gfxItem->_currFrame._rect.top = gfxItem->_currFrame._rect.bottom - scaleValue * (gfxItem->_currFrame._rect.bottom - gfxItem->_currFrame._rect.top) / 1000; gfxItem->_currFrame._rect.right = scaleValue * (gfxItem->_currFrame._rect.right - gfxItem->_currFrame._rect.left) / 1000 + gfxItem->_currFrame._rect.left; - gfxItem->_currFrame._isScaled = 1; + gfxItem->_currFrame._isScaled = true; } gfxItem->_currFrame._duration -= totalDuration; if (gfxItem->_currFrame._soundId != -1) @@ -772,7 +772,7 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & const int x = clipRect.left, y = clipRect.top; - debug(1, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame._isScaled); + debug(1, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame._isScaled ? 1 : 0); // 32bit sprite drawing if (frame._isScaled) { @@ -1099,7 +1099,7 @@ void GameSys::fatUpdateFrame() { (_backgroundImageValue3 - _backgroundImageValue1); gfxItem->_currFrame._rect.top = gfxItem->_currFrame._rect.bottom - v17 * (gfxItem->_currFrame._rect.bottom - gfxItem->_currFrame._rect.top) / 1000; gfxItem->_currFrame._rect.right = v17 * (gfxItem->_currFrame._rect.right - gfxItem->_currFrame._rect.left) / 1000 + gfxItem->_currFrame._rect.left; - gfxItem->_currFrame._isScaled = 1; + gfxItem->_currFrame._isScaled = true; } gfxItem->_currFrame._duration -= duration; if (gfxItem->_currFrame._soundId != -1) @@ -1157,7 +1157,7 @@ void GameSys::fatUpdateFrame() { gfxItem->_prevFrame._soundId = -1; gfxItem->_prevFrame._unusedVal = -1; gfxItem->_currFrame._duration = 0; - gfxItem->_currFrame._isScaled = 0; + gfxItem->_currFrame._isScaled = false; gfxItem->_currFrame._rect = _newSpriteDrawItems[k]._rect; gfxItem->_currFrame._spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO gfxItem->_currFrame._soundId = -1; @@ -1173,7 +1173,7 @@ void GameSys::fatUpdateFrame() { if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && (gfxItem->_flags & 1) && gfxItem->_id == _grabSpriteId && gfxItem->_surface == _grabSpriteSurface1) { gfxItem->_currFrame._duration = 0; - gfxItem->_currFrame._isScaled = 0; + gfxItem->_currFrame._isScaled = false; gfxItem->_currFrame._rect = _grabSpriteRect; gfxItem->_currFrame._spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO gfxItem->_currFrame._soundId = -1; diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index 17fe8f918a..d83598b149 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -28,7 +28,7 @@ namespace Gnap { void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) { _duration = stream.readUint16LE(); - _isScaled = stream.readUint16LE(); + _isScaled = (stream.readUint16LE() != 0); _rect.left = stream.readUint32LE(); _rect.top = stream.readUint32LE(); _rect.right = stream.readUint32LE(); diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 20dd8d4192..52acdc56f3 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -47,7 +47,7 @@ enum { struct SequenceFrame { int16 _duration; - int16 _isScaled; + bool _isScaled; Common::Rect _rect; int32 _spriteId; int32 _soundId; -- cgit v1.2.3 From 29d989ac0e75cfb59173141851ad8f2131a58461 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Mar 2016 00:00:36 +0200 Subject: GNAP: Change the initial values of backGroundImageValue2&4, change transparent to boolean, use nullptr in several places --- engines/gnap/gamesys.cpp | 44 +++++++++++------------------------------ engines/gnap/gnap.cpp | 11 ++++------- engines/gnap/menu.cpp | 14 ++++++------- engines/gnap/resource.cpp | 2 +- engines/gnap/resource.h | 2 +- engines/gnap/scenes/scene14.cpp | 2 +- 6 files changed, 26 insertions(+), 49 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 88b5ea2e53..6bdeb81f24 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -37,9 +37,7 @@ void GfxItem::testUpdRect(const Common::Rect &updRect) { // GameSys -GameSys::GameSys(GnapEngine *vm) - : _vm(vm) { - +GameSys::GameSys(GnapEngine *vm) : _vm(vm) { _newSpriteDrawItemsCount = 0; _removeSequenceItemsCount = 0; _removeSpriteDrawItemsCount = 0; @@ -52,13 +50,13 @@ GameSys::GameSys(GnapEngine *vm) _animationsCount = 0; _backgroundImageValue3 = 0; _backgroundImageValue1 = 0; - _backgroundImageValue4 = 0; - _backgroundImageValue2 = 0; + _backgroundImageValue4 = 1000; + _backgroundImageValue2 = 1000; _backgroundImageError = true; _gameSysClock = 0; _lastUpdateClock = 0; - _backgroundSurface = 0; - _frontSurface = 0; + _backgroundSurface = nullptr; + _frontSurface = nullptr; for (int i = 0; i < kMaxAnimations; ++i) { _animations[i]._sequenceId = -1; _animations[i]._id = 0; @@ -170,7 +168,6 @@ int GameSys::isSequenceActive(int sequenceId, int id) { } void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, int a6, int a7) { - debug(1, "GameSys::setBackgroundSurface() Setting background image"); _backgroundSurface = surface; @@ -199,7 +196,6 @@ void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, i _backgroundImageValue4 = a7; _lastUpdateClock = 0; _gameSysClock = 0; - } void GameSys::setScaleValues(int a1, int a2, int a3, int a4) { @@ -227,7 +223,6 @@ void GameSys::removeSpriteDrawItem(Graphics::Surface *surface, int id) { } void GameSys::drawSpriteToBackground(int x, int y, int resourceId) { - SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); uint32 *sourcePalette = spriteResource->_palette; byte *sourcePixels = spriteResource->_pixels; @@ -270,7 +265,6 @@ void GameSys::drawSpriteToSurface(Graphics::Surface *surface, int x, int y, int } void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r, byte g, byte b, const char *text) { - // NOTE Not that nice but will have to do for now bool doDirty = false; @@ -443,7 +437,6 @@ void GameSys::seqInsertGfx(int index, int duration) { _gfxItemsCount += sequenceResource->_animationsCount; for (int i = 0; i < sequenceResource->_animationsCount; ++i) { - int totalDuration; GfxItem *gfxItem = &_gfxItems[i + gfxIndex]; SequenceAnimation *animation = &sequenceResource->_animations[i]; @@ -461,7 +454,7 @@ void GameSys::seqInsertGfx(int index, int duration) { gfxItem->_prevFrame._spriteId = -1; gfxItem->_prevFrame._soundId = -1; gfxItem->_prevFrame._unusedVal = -1; - totalDuration = duration; + int totalDuration = duration; if ((seqItem->_flags & 4) && totalDuration > 0) { gfxItem->_prevFrame._duration = 1; if (gfxItem->_delayTicks <= totalDuration) @@ -510,7 +503,6 @@ void GameSys::seqInsertGfx(int index, int duration) { break; } } - } void GameSys::seqRemoveGfx(int sequenceId, int id) { @@ -568,8 +560,7 @@ bool GameSys::updateSequenceDuration(int sequenceId, int id, int *outDuration) { } void GameSys::updateAnimationsStatus(int sequenceId, int id) { - - Animation *foundAnimation = 0; + Animation *foundAnimation = nullptr; for (int animationIndex = 0; animationIndex < kMaxAnimations; ++animationIndex) { Animation *animation = &_animations[animationIndex]; if (animation->_sequenceId != -1 && animation->_sequenceId == sequenceId && animation->_id == id) { @@ -599,7 +590,6 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { foundAnimation->_sequenceId = -1; foundAnimation->_status = 2; } - } void GameSys::restoreBackgroundRect(const Common::Rect &rect) { @@ -752,7 +742,6 @@ void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &fram // TODO Save transparent flag somewhere blitSurface32(_frontSurface, x, y, surface, clipRect, true); - } void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame &frame, Common::Rect *subRect) { @@ -782,11 +771,9 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & clipRect.translate(-frame._rect.left, -frame._rect.top); blitSprite32(_frontSurface, x, y, sourcePixels, spriteResource->_width, clipRect, sourcePalette, true);//spriteResource->_transparent != 0); } - } void GameSys::drawSprites() { - debug(1, "GameSys::drawSprites() _gfxItemsCount: %d", _gfxItemsCount); // TODO Split into multiple functions for clarity @@ -807,10 +794,10 @@ void GameSys::drawSprites() { continue; if (gfxItem2->_prevFrame._spriteId != -1) { - int transparent = 0; + bool transparent = false; if (gfxItem2->_currFrame._spriteId != -1 && !(gfxItem2->_flags & 2)) { if (gfxItem2->_flags & 1) { - transparent = 1; + transparent = true; } else { int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); @@ -827,9 +814,9 @@ void GameSys::drawSprites() { } if (gfxItem2->_currFrame._spriteId != -1) { - int transparent = 0; + bool transparent = false; if (gfxItem2->_flags & 1) { - transparent = 1; + transparent = true; } else if (!(gfxItem2->_flags & 2)) { int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); @@ -843,7 +830,6 @@ void GameSys::drawSprites() { _gfxItems[l].testUpdRect(gfxItem2->_currFrame._rect); } } - } for (int m = 0; m < _gfxItemsCount; ++m) { @@ -855,7 +841,7 @@ void GameSys::drawSprites() { if (gfxItem5->_updFlag) { if (gfxItem5->_currFrame._spriteId != -1) { if (gfxItem5->_flags & 1) { - seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, 0); + seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, nullptr); //debug("seqDrawStaticFrame"); } else if (gfxItem5->_flags & 2) { // TODO seqDrawAviFrame(gfxItem5->currFrame.spriteId, &gfxItem5->currFrame, 0, gfxItem5->flags & 8); @@ -887,7 +873,6 @@ void GameSys::drawSprites() { } debug(1, "GameSys::drawSprites() OK"); - } void GameSys::updateRect(const Common::Rect &r) { @@ -900,7 +885,6 @@ void GameSys::updateRect(const Common::Rect &r) { } void GameSys::updateScreen() { - debug(1, "GameSys::updateScreen()"); for (uint i = 0; i < _dirtyRects.size(); ++i) @@ -936,7 +920,6 @@ void GameSys::updateScreen() { updateRect(Common::Rect(0, 0, 800, 600)); debug(1, "GameSys::updateScreen() OK"); - } void GameSys::handleReqRemoveSequenceItem() { @@ -1262,11 +1245,9 @@ void GameSys::fatUpdateFrame() { --i; } } - } void GameSys::fatUpdate() { - debug(1, "GameSys::fatUpdate() _gfxItemsCount: %d", _gfxItemsCount); for (int i = 0; i < _gfxItemsCount; ++i) { @@ -1280,7 +1261,6 @@ void GameSys::fatUpdate() { // NOTE Skipped avi stuff (reqAviStop) fatUpdateFrame(); - } void GameSys::updatePlaySounds() { diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 5077568444..548a4362ac 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -97,13 +97,10 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : _random = new Common::RandomSource("gnap"); Engine::syncSoundSettings(); - } GnapEngine::~GnapEngine() { - delete _random; - } Common::Error GnapEngine::run() { @@ -122,13 +119,13 @@ Common::Error GnapEngine::run() { _verbCursor = 1; invClear(); clearFlags(); - _grabCursorSprite = 0; + _grabCursorSprite = nullptr; _newGrabCursorSpriteIndex = -1; - _backgroundSurface = 0; + _backgroundSurface = nullptr; _isStockDatLoaded = false; _gameDone = false; _isPaused = false; - _pauseSprite = 0; + _pauseSprite = nullptr; //////////////////////////////////////////////////////////////////////////// @@ -143,7 +140,7 @@ Common::Error GnapEngine::run() { _gameSys = new GameSys(this); _soundMan = new SoundMan(this); - _menuBackgroundSurface = 0; + _menuBackgroundSurface = nullptr; initGlobalSceneVars(); diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 1a618fdc35..1f0fbea88d 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -255,12 +255,12 @@ void GnapEngine::removeInventorySprites() { } void GnapEngine::runMenu() { - _spriteHandle = 0; - _cursorSprite = 0; - _menuSprite1 = 0; - _menuSprite2 = 0; - _menuSaveLoadSprite = 0; - _menuQuitQuerySprite = 0; + _spriteHandle = nullptr; + _cursorSprite = nullptr; + _menuSprite1 = nullptr; + _menuSprite2 = nullptr; + _menuSaveLoadSprite = nullptr; + _menuQuitQuerySprite = nullptr; _menuStatus = 0; _menuDone = false; @@ -271,7 +271,7 @@ void GnapEngine::runMenu() { for (int i = 0; i < 7; ++i) { _savegameFilenames[i][0] = 0; - _savegameSprites[i] = 0; + _savegameSprites[i] = nullptr; } if (_menuStatus == 0) { diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index d83598b149..eb07d96fdb 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -93,7 +93,7 @@ SpriteResource::SpriteResource(int resourceId, byte *data, uint32 size) { _height = READ_LE_UINT16(_data + 2); _unknownVal1 = READ_LE_UINT16(_data + 4); _unknownVal2 = READ_LE_UINT16(_data + 6); - _transparent = READ_LE_UINT16(_data + 8); + _transparent = (READ_LE_UINT16(_data + 8) != 0); _colorsCount = READ_LE_UINT16(_data + 10); _palette = (uint32*)(_data + 12); _pixels = _data + 12 + _colorsCount * 4; diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 52acdc56f3..b689869d2e 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -96,7 +96,7 @@ public: int16 _width, _height; uint16 _unknownVal1; uint16 _unknownVal2; - uint16 _transparent; + bool _transparent; uint16 _colorsCount; }; diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp index b4e68a82b4..893b850221 100644 --- a/engines/gnap/scenes/scene14.cpp +++ b/engines/gnap/scenes/scene14.cpp @@ -53,7 +53,7 @@ void GnapEngine::scene14_updateHotspots() { void GnapEngine::scene14_run() { - _largeSprite = 0; + _largeSprite = nullptr; queueInsertDeviceIcon(); -- cgit v1.2.3 From 158726abf5889a3a6b761adae37c8e56623af11d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 30 Mar 2016 22:05:54 +0200 Subject: GNAP: Fix crash in DCL decompression --- engines/gnap/datarchive.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp index 7f5dadfe9b..a0423c1f29 100644 --- a/engines/gnap/datarchive.cpp +++ b/engines/gnap/datarchive.cpp @@ -61,7 +61,7 @@ byte *DatArchive::load(int index) { _fd->seek(_entries[index]._ofs); debug(1, "_entries[index].outSize2: %d; _entries[index].outSize1: %d", _entries[index]._outSize2, _entries[index]._outSize1); byte *buffer = new byte[_entries[index]._outSize1]; - if (!Common::decompressDCL(_fd, buffer, 0, _entries[index]._outSize1)) + if (!Common::decompressDCL(_fd, buffer, _entries[index]._outSize2, _entries[index]._outSize1)) error("DatArchive::load() Error during decompression of entry %d", index); return buffer; } -- cgit v1.2.3 From c0369a421b361a5e4ccfab3e7857d1c7ecd27cf7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 1 Apr 2016 01:21:43 +0200 Subject: GNAP: Refactoring - Use an enum for Facing (Alien) --- engines/gnap/gnap.cpp | 233 ++++++++++++++++++++-------------------- engines/gnap/gnap.h | 15 ++- engines/gnap/grid.cpp | 24 ++--- engines/gnap/scenes/scene01.cpp | 12 +-- engines/gnap/scenes/scene02.cpp | 21 ++-- engines/gnap/scenes/scene03.cpp | 8 +- engines/gnap/scenes/scene04.cpp | 18 ++-- engines/gnap/scenes/scene05.cpp | 14 +-- engines/gnap/scenes/scene06.cpp | 6 +- engines/gnap/scenes/scene07.cpp | 4 +- engines/gnap/scenes/scene08.cpp | 12 +-- engines/gnap/scenes/scene09.cpp | 6 +- engines/gnap/scenes/scene10.cpp | 12 +-- engines/gnap/scenes/scene11.cpp | 14 +-- engines/gnap/scenes/scene12.cpp | 28 ++--- engines/gnap/scenes/scene13.cpp | 18 ++-- engines/gnap/scenes/scene17.cpp | 20 ++-- engines/gnap/scenes/scene18.cpp | 20 ++-- engines/gnap/scenes/scene19.cpp | 6 +- engines/gnap/scenes/scene20.cpp | 26 ++--- engines/gnap/scenes/scene21.cpp | 10 +- engines/gnap/scenes/scene22.cpp | 6 +- engines/gnap/scenes/scene23.cpp | 4 +- engines/gnap/scenes/scene24.cpp | 6 +- engines/gnap/scenes/scene25.cpp | 12 +-- engines/gnap/scenes/scene26.cpp | 4 +- engines/gnap/scenes/scene27.cpp | 14 +-- engines/gnap/scenes/scene28.cpp | 12 +-- engines/gnap/scenes/scene29.cpp | 6 +- engines/gnap/scenes/scene30.cpp | 2 +- engines/gnap/scenes/scene31.cpp | 8 +- engines/gnap/scenes/scene32.cpp | 4 +- engines/gnap/scenes/scene33.cpp | 12 +-- engines/gnap/scenes/scene38.cpp | 8 +- engines/gnap/scenes/scene39.cpp | 4 +- engines/gnap/scenes/scene41.cpp | 16 +-- engines/gnap/scenes/scene42.cpp | 8 +- engines/gnap/scenes/scene43.cpp | 12 +-- engines/gnap/scenes/scene44.cpp | 12 +-- engines/gnap/scenes/scene45.cpp | 6 +- engines/gnap/scenes/scene46.cpp | 10 +- 41 files changed, 351 insertions(+), 342 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 548a4362ac..c84583905f 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -890,6 +890,7 @@ void GnapEngine::checkGameKeys() { updatePause(); } // TODO? Debug input + debug("facing %d", _gnapIdleFacing); } void GnapEngine::startSoundTimerA(int timerIndex) { @@ -1026,29 +1027,29 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x83F; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; } else { sequenceId = 0x83D; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } } else { if (_gnapX > gridX) { sequenceId = 0x83B; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x839; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } } else { switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: sequenceId = 0x839; break; - case 3: + case kDirBottomLeft: sequenceId = 0x83B; break; - case 7: + case kDirUpRight: sequenceId = 0x83D; break; default: @@ -1063,29 +1064,29 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x829; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; } else { sequenceId = 0x828; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } } else { if (_gnapX > gridX) { sequenceId = 0x827; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x826; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } } else { switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: sequenceId = 0x826; break; - case 3: + case kDirBottomLeft: sequenceId = 0x827; break; - case 7: + case kDirUpRight: sequenceId = 0x828; break; default: @@ -1100,37 +1101,37 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x834; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x885; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } } else { if (_gnapX > gridX) { sequenceId = 0x834; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x833; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } } else { switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: sequenceId = 0x833; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; break; - case 3: + case kDirBottomLeft: sequenceId = 0x834; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; break; - case 7: + case kDirUpRight: sequenceId = 0x885; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; break; default: sequenceId = 0x834; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; break; } } @@ -1141,29 +1142,29 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x7BC; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; } else { sequenceId = 0x7BB; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } } else { if (_gnapX > gridX) { sequenceId = 0x7BA; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7B9; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } } else { switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: sequenceId = 0x7B9; break; - case 3: + case kDirBottomLeft: sequenceId = 0x7BA; break; - case 7: + case kDirUpRight: sequenceId = 0x7BB; break; default: @@ -1179,29 +1180,29 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; } else { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } } else { if (_gnapX > gridX) { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } } else { switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; break; - case 3: + case kDirBottomLeft: sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; break; - case 7: + case kDirUpRight: sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; break; default: @@ -1216,32 +1217,32 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x831; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7A8; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } else { if (_gnapX > gridX) { sequenceId = 0x831; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { if (_gnapX % 2) sequenceId = 0x7A8; else sequenceId = 0x89A; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } - } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { sequenceId = 0x831; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { if (_currentSceneNum % 2) sequenceId = 0x7A8; else sequenceId = 0x89A; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } break; @@ -1250,32 +1251,32 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x830; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; } else { sequenceId = 0x82F; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } } else { if (_gnapX > gridX) { sequenceId = 0x82E; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7A7; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } } else { switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: sequenceId = 0x7A7; break; - case 3: + case kDirBottomLeft: sequenceId = 0x82E; break; - case 5: + case kDirUpLeft: sequenceId = 0x830; break; - case 7: + case kDirUpRight: sequenceId = 0x82F; break; } @@ -1284,16 +1285,16 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case gskUseDevice: switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: sequenceId = 0x83A; break; - case 3: + case kDirBottomLeft: sequenceId = 0x83C; break; - case 5: + case kDirUpLeft: sequenceId = 0x840; break; - case 7: + case kDirUpRight: sequenceId = 0x83E; break; } @@ -1304,26 +1305,26 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x832; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } else { if (_gnapX > gridX) { sequenceId = 0x832; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } - } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { sequenceId = 0x832; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } break; @@ -1332,26 +1333,26 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { if (_gnapY > gridY) { if (_gnapX > gridX) { sequenceId = 0x832; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } else { if (_gnapX > gridX) { sequenceId = 0x832; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } } - } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { sequenceId = 0x832; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } break; } @@ -1361,120 +1362,120 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { int sequenceId; - int facing = _gnapIdleFacing; + Facing facing = _gnapIdleFacing; if (gridY > 0 && gridX > 0) { if (_gnapY > gridY) { if (_gnapX > gridX) - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; else - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } else { if (_gnapX > gridX) - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; else - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } - } else if (_gnapIdleFacing != 1 && _gnapIdleFacing != 7) { - _gnapIdleFacing = 5; + } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { + _gnapIdleFacing = kDirUpLeft; } else { - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } switch (index) { case 0: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x8A0; else sequenceId = 0x8A1; break; case 1: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x880; else sequenceId = 0x895; break; case 2: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x884; else sequenceId = 0x899; break; //Skip 3 case 4: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x881; else sequenceId = 0x896; break; case 5: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x883; else sequenceId = 0x898; break; case 6: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87E; else sequenceId = 0x893; break; case 7: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x848; else sequenceId = 0x890; break; case 8: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87D; else sequenceId = 0x892; break; case 9: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x882; else sequenceId = 0x897; break; case 10: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87C; else sequenceId = 0x891; break; case 11: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87C; else sequenceId = 0x891; break; case 12: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87D; else sequenceId = 0x892; break; case 13: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x888; else sequenceId = 0x89D; break; case 14: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87F; else sequenceId = 0x894; break; case 15: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87B; else sequenceId = 0x8A3; break; case 16: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x877; else sequenceId = 0x88C; @@ -1484,43 +1485,43 @@ int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { sequenceId = 0x887; break; case 19: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87A; else sequenceId = 0x88F; break; case 20: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x878; else sequenceId = 0x88D; break; case 21: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x879; else sequenceId = 0x88E; break; case 22: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x88A; else sequenceId = 0x89F; break; case 23: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x889; else sequenceId = 0x89E; break; case 24: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x886; else sequenceId = 0x89B; break; case 25: - if (_gnapIdleFacing == 7) + if (_gnapIdleFacing == kDirUpRight) sequenceId = 0x87A; else sequenceId = 0x88F; @@ -1629,7 +1630,7 @@ void GnapEngine::updateGnapIdleSequence() { if (_timers[3] == 0) { _timers[2] = 60; _timers[3] = 300; - if (_gnapIdleFacing == 1) { + if (_gnapIdleFacing == kDirBottomRight) { switch (getRandom(5)) { case 0: playGnapSequence(0x107A6); @@ -1644,7 +1645,7 @@ void GnapEngine::updateGnapIdleSequence() { playGnapSequence(0x108A2); break; } - } else if (_gnapIdleFacing == 3) { + } else if (_gnapIdleFacing == kDirBottomLeft) { if (getRandom(5) > 2) playGnapSequence(0x10832); else @@ -1653,13 +1654,13 @@ void GnapEngine::updateGnapIdleSequence() { } } else { _timers[2] = getRandom(30) + 20; - if (_gnapIdleFacing == 1) { + if (_gnapIdleFacing == kDirBottomRight) { _gameSys->insertSequence(0x107BD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7BD; _gnapSequenceDatNum = 1; - } else if (_gnapIdleFacing == 3) { + } else if (_gnapIdleFacing == kDirBottomLeft) { _gameSys->insertSequence(0x107BE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); @@ -1679,21 +1680,21 @@ void GnapEngine::updateGnapIdleSequence2() { if (_timers[3] == 0) { _timers[2] = 60; _timers[3] = 300; - if (_gnapIdleFacing == 1) { + if (_gnapIdleFacing == kDirBottomRight) { playGnapSequence(0x107AA); - } else if (_gnapIdleFacing == 3) { + } else if (_gnapIdleFacing == kDirBottomLeft) { playGnapSequence(0x10832); } } } else { _timers[2] = getRandom(30) + 20; - if (_gnapIdleFacing == 1) { + if (_gnapIdleFacing == kDirBottomRight) { _gameSys->insertSequence(0x107BD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7BD; _gnapSequenceDatNum = 1; - } else if (_gnapIdleFacing == 3) { + } else if (_gnapIdleFacing == kDirBottomLeft) { _gameSys->insertSequence(0x107BE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); @@ -1721,20 +1722,20 @@ bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gr return false; } -void GnapEngine::initGnapPos(int gridX, int gridY, int facing) { +void GnapEngine::initGnapPos(int gridX, int gridY, Facing facing) { _timers[2] = 30; _timers[3] = 300; _gnapX = gridX; _gnapY = gridY; - if (facing <= 0) - _gnapIdleFacing = 1; + if (facing == kDirNone) + _gnapIdleFacing = kDirBottomRight; else _gnapIdleFacing = facing; - if (_gnapIdleFacing == 3) { + if (_gnapIdleFacing == kDirBottomLeft) { _gnapSequenceId = 0x7B8; } else { _gnapSequenceId = 0x7B5; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } _gnapId = 20 * _gnapY; _gnapSequenceDatNum = 1; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index d376ffd5c9..2872f69f20 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -235,6 +235,15 @@ struct Scene51Item { int _id; }; +enum Facing { + kDirNone = 0, + kDirBottomRight = 1, + kDirBottomLeft = 3, + kDirUnk4 = 4, + kDirUpLeft = 5, + kDirUpRight = 7 +}; + class GnapEngine : public Engine { protected: Common::Error run(); @@ -458,7 +467,7 @@ public: int getGnapWalkSequenceId(int deltaX, int deltaY); int getGnapWalkStopSequenceId(int deltaX, int deltaY); - int getGnapWalkFacing(int deltaX, int deltaY); + Facing getGnapWalkFacing(int deltaX, int deltaY); bool gridSub41F08B(int gridX, int gridY); bool gridSub41F5FC(int gridX, int gridY, int index); bool gridSub41FAD5(int gridX, int gridY, int index); @@ -483,7 +492,7 @@ public: void beaverMakeRoom(); // Gnap - int _gnapIdleFacing; + Facing _gnapIdleFacing; int _gnapActionStatus; int _gnapBrainPulseNum, _gnapBrainPulseRndValue; int _gnapSequenceId, _gnapSequenceDatNum, _gnapId; @@ -506,7 +515,7 @@ public: void playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); void updateGnapIdleSequence(); void updateGnapIdleSequence2(); - void initGnapPos(int gridX, int gridY, int facing); + void initGnapPos(int gridX, int gridY, Facing facing); void gnapInitBrainPulseRndValue(); void gnapUseDeviceOnBeaver(); void doCallback(int callback); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 5b2f5aa454..136e8d429e 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -58,11 +58,11 @@ int GnapEngine::getGnapWalkStopSequenceId(int deltaX, int deltaY) { return _gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY]; } -int GnapEngine::getGnapWalkFacing(int deltaX, int deltaY) { - static const int _gnapWalkFacings[9] = { - 5, 3, 3, - 5, 0, 3, - 7, 1, 1 +Facing GnapEngine::getGnapWalkFacing(int deltaX, int deltaY) { + static const Facing _gnapWalkFacings[9] = { + kDirUpLeft, kDirBottomLeft, kDirBottomLeft, + kDirUpLeft, kDirNone, kDirBottomLeft, + kDirUpRight, kDirBottomRight, kDirBottomRight }; // CHECKME This is a little weird return _gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; @@ -645,17 +645,17 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapSequenceId = ridToEntryIndex(sequenceId); _gnapSequenceDatNum = ridToDatIndex(sequenceId); if (_gnapSequenceId == 0x7B9) { - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; } else { switch (_gnapSequenceId) { case 0x7BA: - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; break; case 0x7BB: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; break; case 0x7BC: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; break; } } @@ -665,13 +665,13 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1].deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1].deltaY); } else if (gridX >= 0 || gridY >= 0) { switch (_gnapIdleFacing) { - case 1: + case kDirBottomRight: _gnapSequenceId = 0x7B9; break; - case 3: + case kDirBottomLeft: _gnapSequenceId = 0x7BA; break; - case 7: + case kDirUpRight: _gnapSequenceId = 0x7BB; break; default: diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 9efe45d5ae..ba906b601b 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -102,7 +102,7 @@ void GnapEngine::scene01_run() { queueInsertDeviceIcon(); if (_prevSceneNum == 2) { - initGnapPos(11, 6, 3); + initGnapPos(11, 6, kDirBottomLeft); if (isFlag(0)) initBeaverPos(12, 6, 4); endSceneInit(); @@ -110,7 +110,7 @@ void GnapEngine::scene01_run() { platypusWalkTo(9, 6, -1, 0x107C2, 1); gnapWalkTo(8, 6, -1, 0x107B9, 1); } else { - initGnapPos(1, 6, 1); + initGnapPos(1, 6, kDirBottomRight); if (isFlag(0)) initBeaverPos(1, 7, 0); endSceneInit(); @@ -170,7 +170,7 @@ void GnapEngine::scene01_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; if (gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _gnapActionStatus = kASLookSpaceship; break; @@ -213,17 +213,17 @@ void GnapEngine::scene01_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); _gnapActionStatus = kASLookPigs; break; case GRAB_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); _gnapActionStatus = kASUsePigs; break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); _gnapActionStatus = kASLookPigs; break; diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index cd72020d94..5d254870da 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -84,7 +84,6 @@ void GnapEngine::scene02_updateHotspots() { } void GnapEngine::scene02_run() { - playSound(0x1091C, 1); startSoundTimerC(6); @@ -100,7 +99,7 @@ void GnapEngine::scene02_run() { switch (_prevSceneNum) { case 3: - initGnapPos(11, 6, 3); + initGnapPos(11, 6, kDirBottomLeft); if (isFlag(0)) initBeaverPos(12, 6, 4); endSceneInit(); @@ -109,7 +108,7 @@ void GnapEngine::scene02_run() { gnapWalkTo(8, 6, -1, 0x107BA, 1); break; case 4: - initGnapPos(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 3); + initGnapPos(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, kDirBottomLeft); if (isFlag(0)) initBeaverPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 4); endSceneInit(); @@ -121,18 +120,18 @@ void GnapEngine::scene02_run() { break; case 47: clearFlag(25); - initGnapPos(5, 6, 3); + initGnapPos(5, 6, kDirBottomLeft); initBeaverPos(6, 7, 4); endSceneInit(); break; case 49: - initGnapPos(5, 6, 1); + initGnapPos(5, 6, kDirBottomRight); if (isFlag(0)) initBeaverPos(6, 7, 0); endSceneInit(); break; default: - initGnapPos(-1, 6, 1); + initGnapPos(-1, 6, kDirBottomRight); if (isFlag(0)) initBeaverPos(-1, 7, 0); endSceneInit(); @@ -194,7 +193,7 @@ void GnapEngine::scene02_run() { case kHSChicken: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemTwig) { - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASUseTwigWithChicken; @@ -206,14 +205,14 @@ void GnapEngine::scene02_run() { playGnapMoan2(9, 8); break; case GRAB_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; if (gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _gnapActionStatus = kASGrabChicken; else _gnapActionStatus = -1; break; case TALK_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkChicken; break; @@ -258,7 +257,7 @@ void GnapEngine::scene02_run() { _gnapActionStatus = kASUseTruckNoGas; } } else { - _gnapIdleFacing = 4; + _gnapIdleFacing = kDirUnk4; if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _gnapActionStatus = kASUseTruckNoKeys; } @@ -282,7 +281,7 @@ void GnapEngine::scene02_run() { playGnapMoan2(2, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabTruckGrill; break; diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 95449f5e6c..c7600133d2 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -91,7 +91,7 @@ void GnapEngine::scene03_run() { _s03_platypusHypnotized = false; - initGnapPos(3, 4, 1); + initGnapPos(3, 4, kDirBottomRight); _gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -261,7 +261,7 @@ void GnapEngine::scene03_run() { if (_s03_platypusHypnotized) { playGnapBrainPulsating(8, 4); } else { - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_s03_platypusScared) _gnapActionStatus = kASHypnotizeScaredPlat; @@ -462,7 +462,7 @@ void GnapEngine::scene03_updateAnimations() { _gameSys->insertSequence(_s03_nextPlatSequenceId, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x1B5; _gnapSequenceDatNum = 0; - _gnapIdleFacing = 0; + _gnapIdleFacing = kDirNone; _beaverSequenceId = _s03_nextPlatSequenceId; _beaverSequenceDatNum = 0; _gameSys->setAnimation(_s03_nextPlatSequenceId, 99, 1); @@ -477,7 +477,7 @@ void GnapEngine::scene03_updateAnimations() { _gnapId = 20 * _gnapY; _gnapSequenceId = 0x1B6; _gnapSequenceDatNum = 0; - _gnapIdleFacing = 0; + _gnapIdleFacing = kDirNone; _gnapActionStatus = kASFreePlatypusDone; _s03_nextPlatSequenceId = -1; } else if (_s03_nextPlatSequenceId == 0x1C2 && !_s03_platypusScared) { diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 52fdb39d83..164a53f35d 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -135,7 +135,7 @@ void GnapEngine::scene04_run() { } else { _gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 2) { - initGnapPos(5, 11, 7); + initGnapPos(5, 11, kDirUpRight); if (isFlag(0)) initBeaverPos(6, 11, 5); endSceneInit(); @@ -143,11 +143,11 @@ void GnapEngine::scene04_run() { platypusWalkTo(5, 8, -1, 0x107C2, 1); gnapWalkTo(6, 9, -1, 0x107BA, 1); } else if (_prevSceneNum == 38) { - initGnapPos(5, 7, 1); + initGnapPos(5, 7, kDirBottomRight); initBeaverPos(4, 7, 0); endSceneInit(); } else { - initGnapPos(12, 9, 1); + initGnapPos(12, 9, kDirBottomRight); if (isFlag(0)) initBeaverPos(12, 8, 0); endSceneInit(); @@ -242,7 +242,7 @@ void GnapEngine::scene04_run() { playGnapMoan2(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y); break; case GRAB_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabAxe; setFlag(26); @@ -270,12 +270,12 @@ void GnapEngine::scene04_run() { } break; case GRAB_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _gnapActionStatus = kASGrabDog; break; case TALK_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; if (gnapWalkTo(_gnapX, _gnapY, 0, -1, 1)) { playGnapBrainPulsating(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y); _s04_nextDogSequenceId = 0x20E; @@ -304,7 +304,7 @@ void GnapEngine::scene04_run() { gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); _gnapActionStatus = kASOpenDoor; _timers[5] = 300; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; } else { _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); @@ -485,7 +485,7 @@ void GnapEngine::scene04_updateAnimations() { _gameSys->insertSequence(0x107B5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; _gnapSequenceId = 0x7B5; _gnapSequenceDatNum = 1; _gnapActionStatus = -1; @@ -514,7 +514,7 @@ void GnapEngine::scene04_updateAnimations() { kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7B5; _gnapSequenceDatNum = 1; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; _gnapActionStatus = -1; break; case kASGrabDog: diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index fea0dc1b63..f13a2a358d 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -96,7 +96,7 @@ void GnapEngine::scene05_run() { queueInsertDeviceIcon(); if (_prevSceneNum != 6 && _prevSceneNum != 36) { - initGnapPos(-1, 8, 1); + initGnapPos(-1, 8, kDirBottomRight); if (isFlag(0)) initBeaverPos(-1, 9, 0); endSceneInit(); @@ -104,7 +104,7 @@ void GnapEngine::scene05_run() { platypusWalkTo(2, 8, -1, 0x107C2, 1); gnapWalkTo(2, 9, -1, 0x107B9, 1); } else { - initGnapPos(6, 8, 1); + initGnapPos(6, 8, kDirBottomRight); if (isFlag(0)) initBeaverPos(7, 9, 0); endSceneInit(); @@ -193,7 +193,7 @@ void GnapEngine::scene05_run() { case kHSChicken: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemTwig) { - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASUseTwigWithChicken; @@ -205,12 +205,12 @@ void GnapEngine::scene05_run() { playGnapMoan2(9, 7); break; case GRAB_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabChicken; break; case TALK_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkChicken; break; @@ -232,7 +232,7 @@ void GnapEngine::scene05_run() { playGnapMoan2(2, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabLadder; break; @@ -267,7 +267,7 @@ void GnapEngine::scene05_run() { playGnapScratchingHead(7, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTryPickPadlock; diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index 7df09a1cc0..acf309cbab 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -106,7 +106,7 @@ void GnapEngine::scene06_run() { queueInsertDeviceIcon(); - initGnapPos(5, 12, 1); + initGnapPos(5, 12, kDirBottomRight); initBeaverPos(6, 12, 0); endSceneInit(); @@ -228,7 +228,7 @@ void GnapEngine::scene06_run() { _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; platypusWalkTo(6, 8, 1, 0x107C2, 1); _beaverFacing = 0; _gnapActionStatus = kASUseTwigOnHorse; @@ -244,7 +244,7 @@ void GnapEngine::scene06_run() { if (_s06_horseTurnedBack) { gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index c6eda8f3a1..1b609f8689 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -71,7 +71,7 @@ void GnapEngine::scene07_run() { _gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 8) { - initGnapPos(7, 7, 3); + initGnapPos(7, 7, kDirBottomLeft); initBeaverPos(9, 7, 4); endSceneInit(); } else { @@ -80,7 +80,7 @@ void GnapEngine::scene07_run() { _gnapId = 140; _gnapSequenceId = 0x8F; _gnapSequenceDatNum = 0; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; _gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); _gnapActionStatus = kASWait; diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index 01e77084b9..5988114f9a 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -116,7 +116,7 @@ void GnapEngine::scene08_run() { if (!isFlag(9)) _gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); - initGnapPos(-1, 8, 1); + initGnapPos(-1, 8, kDirBottomRight); initBeaverPos(-1, 7, 0); endSceneInit(); @@ -202,13 +202,13 @@ void GnapEngine::scene08_run() { gnapActionIdle(0x14D); gnapWalkTo(6, 6, 0, 0x107BB, 1); _gnapActionStatus = kASLookMan; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; break; case GRAB_CURSOR: playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapActionIdle(0x14D); gnapWalkTo(8, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkMan; @@ -240,10 +240,10 @@ void GnapEngine::scene08_run() { case GRAB_CURSOR: gnapWalkTo(4, 7, 0, 0x107BB, 1); _gnapActionStatus = kASGrabDog; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapActionIdle(0x14D); gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkDog; @@ -515,7 +515,7 @@ void GnapEngine::scene08_updateAnimations() { _timers[3] = getRandom(50) + 200; _gameSys->insertSequence(0x14D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x14D; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapSequenceDatNum = 0; _gnapActionStatus = -1; } diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 69165ce8f0..2cf57a9a12 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -67,13 +67,13 @@ void GnapEngine::scene09_run() { _gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 8) { - initGnapPos(11, 8, 3); + initGnapPos(11, 8, kDirBottomLeft); initBeaverPos(12, 7, 4); endSceneInit(); gnapWalkTo(9, 8, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { - initGnapPos(4, 7, 1); + initGnapPos(4, 7, kDirBottomRight); initBeaverPos(5, 7, 0); endSceneInit(); } @@ -221,7 +221,7 @@ void GnapEngine::scene09_updateAnimations() { _gameSys->removeSequence(0x4B, 2, true); _gnapSequenceId = 0x4C; _gnapId = 120; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; _gnapSequenceDatNum = 0; _gnapX = 9; _gnapY = 6; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index aea4a34789..0a89682c00 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -84,13 +84,13 @@ void GnapEngine::scene10_run() { queueInsertDeviceIcon(); if (_prevSceneNum == 9) { - initGnapPos(11, 8, 3); + initGnapPos(11, 8, kDirBottomLeft); initBeaverPos(12, 7, 4); endSceneInit(); gnapWalkTo(9, 8, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { - initGnapPos(-1, 7, 1); + initGnapPos(-1, 7, kDirBottomRight); initBeaverPos(-2, 8, 0); endSceneInit(); gnapWalkTo(1, 7, -1, 0x107B9, 1); @@ -173,10 +173,10 @@ void GnapEngine::scene10_run() { break; case GRAB_CURSOR: playGnapImpossible(0, 0); - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapActionIdle(0x10C); gnapWalkTo(4, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASAnnoyCook; @@ -279,7 +279,7 @@ void GnapEngine::scene10_run() { _gameSys->insertSequence(0x10E, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x10E; _gnapId = 120; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapSequenceDatNum = 0; _gnapX = 9; _gnapY = 6; @@ -475,7 +475,7 @@ void GnapEngine::scene10_updateAnimations() { _timers[3] = 300; _gameSys->insertSequence(0x10C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x10C; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapSequenceDatNum = 0; _gnapActionStatus = -1; _beaverActionStatus = -1; diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 04509eef5c..f3646772d3 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -93,22 +93,22 @@ void GnapEngine::scene11_run() { switch (_prevSceneNum) { case 13: - initGnapPos(8, 5, 3); + initGnapPos(8, 5, kDirBottomLeft); initBeaverPos(9, 6, 4); break; case 47: - initGnapPos(8, 5, 3); + initGnapPos(8, 5, kDirBottomLeft); initBeaverPos(9, 5, 4); _s11_currGoggleGuySequenceId = 0x1FA; _s11_currHookGuySequenceId = 0x1FF; _timers[7] = 180; break; case 12: - initGnapPos(-1, 9, 1); + initGnapPos(-1, 9, kDirBottomRight); initBeaverPos(-2, 8, 0); break; default: - initGnapPos(6, 6, 3); + initGnapPos(6, 6, kDirBottomLeft); initBeaverPos(6, 5, 4); break; } @@ -213,7 +213,7 @@ void GnapEngine::scene11_run() { playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(3, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkGoggleGuy; break; @@ -224,7 +224,7 @@ void GnapEngine::scene11_run() { case kHSHookGuy: if (_gnapActionStatus < 0) { - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; if (_grabCursorSpriteIndex >= 0) { gnapWalkTo(5, 6, 0, 0x107BC, 9); _gnapActionStatus = kASShowItemToHookGuy; @@ -239,7 +239,7 @@ void GnapEngine::scene11_run() { _gnapActionStatus = kASGrabHookGuy; break; case TALK_CURSOR: - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; gnapWalkTo(5, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkHookGuy; break; diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index f26bb30f0b..fae6f83d14 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -111,11 +111,11 @@ void GnapEngine::scene12_run() { _timers[7] = getRandom(100) + 100; if (_prevSceneNum == 15) { - initGnapPos(5, 6, 1); + initGnapPos(5, 6, kDirBottomRight); initBeaverPos(3, 7, 0); endSceneInit(); } else { - initGnapPos(11, 8, 3); + initGnapPos(11, 8, kDirBottomLeft); initBeaverPos(12, 8, 4); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); @@ -171,18 +171,18 @@ void GnapEngine::scene12_run() { if (_grabCursorSpriteIndex == kItemQuarter) { _largeSprite = _gameSys->createSurface(0x141); gnapWalkTo(3, 7, 0, 0x107BC, 9); - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; _gnapActionStatus = kASQuarterToToothGuy; playGnapShowItem(_grabCursorSpriteIndex, 2, 0); setGrabCursorSprite(-1); } else if (_grabCursorSpriteIndex == kItemQuarterWithHole) { gnapWalkTo(3, 7, 0, 0x107BC, 9); - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; _gnapActionStatus = kASQuarterWithHoleToToothGuy; playGnapShowItem(_grabCursorSpriteIndex, 2, 0); } else if (_grabCursorSpriteIndex >= 0) { gnapWalkTo(3, 7, 0, 0x107BC, 9); - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; _gnapActionStatus = kASShowItemToToothGuy; playGnapShowItem(_grabCursorSpriteIndex, 2, 0); } else { @@ -195,7 +195,7 @@ void GnapEngine::scene12_run() { _gnapActionStatus = kASGrabToothGuy; break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(3, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkToothGuy; break; @@ -213,26 +213,26 @@ void GnapEngine::scene12_run() { case kHSBarkeeper: if (_grabCursorSpriteIndex == kItemQuarter || _grabCursorSpriteIndex == kItemQuarterWithHole) { gnapWalkTo(6, 6, 0, 0x107BB, 9); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASQuarterWithBarkeeper; playGnapShowItem(_grabCursorSpriteIndex, 7, 0); } else if (_grabCursorSpriteIndex >= 0) { gnapWalkTo(6, 6, 0, 0x107BB, 9); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASShowItemToBarkeeper; playGnapShowItem(_grabCursorSpriteIndex, 7, 0); } else { switch (_verbCursor) { case LOOK_CURSOR: gnapWalkTo(6, 6, 0, 0x107BB, 1); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASLookBarkeeper; break; case GRAB_CURSOR: playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(6, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkBarkeeper; break; @@ -248,24 +248,24 @@ void GnapEngine::scene12_run() { case kHSBeardGuy: if (_grabCursorSpriteIndex >= 0) { gnapWalkTo(7, 6, 0, 0x107BB, 9); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASShowItemToBeardGuy; playGnapShowItem(_grabCursorSpriteIndex, 8, 0); } else { switch (_verbCursor) { case LOOK_CURSOR: gnapWalkTo(7, 6, 0, 0x107BB, 1); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASLookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. gnapWalkTo(7, 6, 0, 0x107BB, 1); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASGrabBeardGuy; break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(7, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkBeardGuy; break; diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 4d7b6d01c6..c1e9bab43e 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -107,10 +107,10 @@ void GnapEngine::scene13_run() { _gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 14) { - initGnapPos(6, 6, 3); + initGnapPos(6, 6, kDirBottomLeft); initBeaverPos(9, 8, 0); } else { - initGnapPos(3, 7, 1); + initGnapPos(3, 7, kDirBottomRight); initBeaverPos(2, 7, 0); } @@ -190,12 +190,12 @@ void GnapEngine::scene13_run() { 9, 0, 0, 0); _gnapActionStatus = kASWait; _gnapSequenceId = _s13_backToiletCtr + 0xA3; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapSequenceDatNum = 0; } else { gnapWalkTo(5, 5, 0, 0x107BB, 1); _gnapActionStatus = kASBackToilet; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; } break; case PLAT_CURSOR: @@ -216,7 +216,7 @@ void GnapEngine::scene13_run() { case PLAT_CURSOR: gnapWalkTo(6, 7, 0, 0xA9, 5); _gnapActionStatus = kASFrontToilet; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; break; } } @@ -230,13 +230,13 @@ void GnapEngine::scene13_run() { case LOOK_CURSOR: gnapWalkTo(7, 7, 0, 0x107BB, 1); _gnapActionStatus = kASLookScribble; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; break; case GRAB_CURSOR: playGnapScratchingHead(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(7, 7, -1, getGnapSequenceId(gskBrainPulsating, 0, 0), 1); break; case PLAT_CURSOR: @@ -415,7 +415,7 @@ void GnapEngine::scene13_updateAnimations() { _gameSys->removeSequence(0xAA, 256, true); _gnapSequenceId = 0xAB; _gnapId = 160; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; _gnapSequenceDatNum = 0; _gnapX = 4; _gnapY = 8; @@ -434,7 +434,7 @@ void GnapEngine::scene13_updateAnimations() { _gameSys->insertSequence(0xA2, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0xA2; _gnapId = 120; - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; _gnapSequenceDatNum = 0; _gnapX = 4; _gnapY = 6; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index 322cdd62dd..04eb5f3140 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -177,13 +177,13 @@ void GnapEngine::scene17_run() { if (_prevSceneNum == 53 || _prevSceneNum == 18 || _prevSceneNum == 20 || _prevSceneNum == 19) { if (_prevSceneNum == 20) { - initGnapPos(4, 6, 1); + initGnapPos(4, 6, kDirBottomRight); initBeaverPos(5, 6, 0); endSceneInit(); platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); } else if (isFlag(27)) { - initGnapPos(3, 9, 5); + initGnapPos(3, 9, kDirUpLeft); _platX = _hotspotsWalkPos[2].x; _platY = _hotspotsWalkPos[2].y; _beaverId = 20 * _hotspotsWalkPos[2].y; @@ -220,7 +220,7 @@ void GnapEngine::scene17_run() { clearFlag(15); clearFlag(16); _sceneWaiting = true; - initGnapPos(3, 9, 5); + initGnapPos(3, 9, kDirUpLeft); _platX = _hotspotsWalkPos[2].x; _platY = _hotspotsWalkPos[2].y; _beaverId = 20 * _hotspotsWalkPos[2].y; @@ -234,18 +234,18 @@ void GnapEngine::scene17_run() { _beaverActionStatus = kASPlatPhoningAssistant; scene17_updateHotspots(); } else if (_prevSceneNum == 18) { - initGnapPos(6, 6, 1); + initGnapPos(6, 6, kDirBottomRight); initBeaverPos(5, 6, 0); endSceneInit(); platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { if (isFlag(15)) { - initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1); + initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, kDirBottomRight); initBeaverPos(1, 9, 0); endSceneInit(); } else { - initGnapPos(3, 7, 1); + initGnapPos(3, 7, kDirBottomRight); initBeaverPos(1, 7, 0); endSceneInit(); } @@ -259,7 +259,7 @@ void GnapEngine::scene17_run() { _gnapId = 120; _gnapSequenceId = 0x23D; _gnapSequenceDatNum = 0; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0, 0, kSeqNone, 0, 0, 0); _platX = -1; _platY = 8; @@ -417,7 +417,7 @@ void GnapEngine::scene17_run() { if (isFlag(18)) { scene17_platHangUpPhone(); _isLeavingScene = true; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGnapUsePhone; setFlag(15); @@ -449,7 +449,7 @@ void GnapEngine::scene17_run() { if (_gnapActionStatus < 0) { _isLeavingScene = true; _newSceneNum = 18; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107BB, 1); _gnapActionStatus = kASLeaveScene; if (_beaverActionStatus != kASPlatPhoningAssistant) @@ -462,7 +462,7 @@ void GnapEngine::scene17_run() { scene17_platHangUpPhone(); _isLeavingScene = true; _newSceneNum = 20; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 5466360c11..53a89e019a 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -210,9 +210,9 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, } if (direction == 1) - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; else - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; _gnapId = 20 * _gnapY + 1; @@ -233,13 +233,13 @@ void GnapEngine::scene18_putDownGarbageCan(int animationIndex) { while (_gameSys->getAnimationStatus(animationIndex) != 2) gameUpdateTick(); } - if (_gnapIdleFacing != 0 && _gnapIdleFacing != 1 && _gnapIdleFacing != 7) + if (_gnapIdleFacing != kDirNone && _gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) _s18_garbageCanPos = _gnapX - 1; else _s18_garbageCanPos = _gnapX + 1; clearFlag(10); scene18_updateHotspots(); - if (_gnapIdleFacing != 0 && _gnapIdleFacing != 1 && _gnapIdleFacing != 7) { + if (_gnapIdleFacing != kDirNone && _gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { _gameSys->insertSequence(0x107BA, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); @@ -348,9 +348,9 @@ void GnapEngine::scene18_run() { if (isFlag(26)) { if (_prevSceneNum == 17) - initGnapPos(4, 11, 1); + initGnapPos(4, 11, kDirBottomRight); else - initGnapPos(4, 7, 1); + initGnapPos(4, 7, kDirBottomRight); _s18_platPhoneCtr = getRandom(5); if (isFlag(27)) { _gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -379,19 +379,19 @@ void GnapEngine::scene18_run() { _prevSceneNum = 19; } if (_prevSceneNum == 17) { - initGnapPos(4, 11, 1); + initGnapPos(4, 11, kDirBottomRight); initBeaverPos(5, 11, 0); endSceneInit(); gnapWalkTo(4, 8, -1, 0x107B9, 1); platypusWalkTo(5, 9, -1, 0x107C2, 1); } else if (_prevSceneNum == 19) { - initGnapPos(7, 7, 1); + initGnapPos(7, 7, kDirBottomRight); initBeaverPos(8, 7, 0); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { - initGnapPos(-1, 10, 1); + initGnapPos(-1, 10, kDirBottomRight); initBeaverPos(-1, 10, 0); endSceneInit(); gnapWalkTo(3, 7, -1, 0x107B9, 1); @@ -785,7 +785,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { case kASGrabGarbageCanFromStreet: - if (_gnapIdleFacing != 7 && _gnapIdleFacing != 1) { + if (_gnapIdleFacing != kDirUpRight && _gnapIdleFacing != kDirBottomRight) { _gameSys->insertSequence(0x1FC, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 75 * _gnapX - 675, 0); diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index 60208bc381..2f588f2995 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -110,7 +110,7 @@ void GnapEngine::scene19_run() { _gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(26)) { - initGnapPos(3, 6, 1); + initGnapPos(3, 6, kDirBottomRight); _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[getRandom(5)]; _s19_nextShopAssistantSequenceId = _s19_currShopAssistantSequenceId; _gameSys->setAnimation(_s19_currShopAssistantSequenceId, 20, 4); @@ -126,7 +126,7 @@ void GnapEngine::scene19_run() { _gameSys->setAnimation(0x6D, 20, 4); _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _timers[6] = getRandom(40) + 50; - initGnapPos(3, 6, 1); + initGnapPos(3, 6, kDirBottomRight); initBeaverPos(4, 6, 0); endSceneInit(); gnapWalkTo(4, 9, -1, 0x107B9, 1); @@ -227,7 +227,7 @@ void GnapEngine::scene19_run() { playGnapScratchingHead(6, 2); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkShopAssistant; break; diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 788a7fac0b..990ceca499 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -228,42 +228,42 @@ void GnapEngine::scene20_run() { // checkGameAppStatus(); gameUpdateTick(); } - initGnapPos(11, 8, 3); + initGnapPos(11, 8, kDirBottomLeft); initBeaverPos(11, 9, 4); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); } else { switch (_prevSceneNum) { case 17: - initGnapPos(5, 11, 1); + initGnapPos(5, 11, kDirBottomRight); initBeaverPos(6, 11, 0); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107B9, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 18: - initGnapPos(11, 8, 3); + initGnapPos(11, 8, kDirBottomLeft); initBeaverPos(11, 9, 4); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 21: - initGnapPos(-1, 8, 3); + initGnapPos(-1, 8, kDirBottomLeft); initBeaverPos(-1, 9, 4); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107B9, 1); platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 22: - initGnapPos(7, 6, 1); + initGnapPos(7, 6, kDirBottomRight); initBeaverPos(8, 6, 0); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107B9, 1); platypusWalkTo(9, 9, -1, 0x107C2, 1); break; default: - initGnapPos(8, 6, 3); + initGnapPos(8, 6, kDirBottomLeft); initBeaverPos(9, 6, 4); endSceneInit(); _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; @@ -394,7 +394,7 @@ void GnapEngine::scene20_run() { playGnapMoan2(5, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_s20_stonerGuyShowingJoint) _gnapActionStatus = kASGrabJoint; @@ -402,7 +402,7 @@ void GnapEngine::scene20_run() { playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); if (isFlag(17)) _gnapActionStatus = kASTalkStonerGuyNoJoint; @@ -428,12 +428,12 @@ void GnapEngine::scene20_run() { break; case GRAB_CURSOR: _s20_stonerGuyShowingJoint = false; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabGroceryStoreGuy; break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkGroceryStoreGuy; break; @@ -448,7 +448,7 @@ void GnapEngine::scene20_run() { case kHSGroceryStoreHat: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemCowboyHat) { - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreHat].x, _hotspotsWalkPos[kHSGroceryStoreHat].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASSwitchGroceryStoreHat; } else if (_grabCursorSpriteIndex >= 0) { @@ -460,7 +460,7 @@ void GnapEngine::scene20_run() { break; case GRAB_CURSOR: _s20_stonerGuyShowingJoint = false; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabGroceryStoreHat; break; @@ -650,7 +650,7 @@ void GnapEngine::scene20_updateAnimations() { removeFullScreenSprite(); showCursor(); setGrabCursorSprite(kItemGroceryStoreHat); - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(3, 8, -1, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = -1; break; diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index 6f1f406ad2..415c82f893 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -77,7 +77,7 @@ void GnapEngine::scene21_run() { if (isFlag(3)) { if (isFlag(5)) { - initGnapPos(5, 8, 1); + initGnapPos(5, 8, kDirBottomRight); initBeaverPos(6, 8, 0); _gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!isFlag(4)) @@ -85,7 +85,7 @@ void GnapEngine::scene21_run() { endSceneInit(); clearFlag(5); } else { - initGnapPos(5, 11, 1); + initGnapPos(5, 11, kDirBottomRight); initBeaverPos(6, 11, 0); if (!isFlag(4)) _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); @@ -94,7 +94,7 @@ void GnapEngine::scene21_run() { platypusWalkTo(6, 8, -1, 0x107C2, 1); } } else { - initGnapPos(5, 11, 1); + initGnapPos(5, 11, kDirBottomRight); initBeaverPos(6, 11, 0); _s21_currOldLadySequenceId = 0x89; _gameSys->setAnimation(0x89, 79, 3); @@ -186,14 +186,14 @@ void GnapEngine::scene21_run() { playGnapScratchingHead(7, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(7, 6, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabOldLady; _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSOldLady].x, _hotspotsWalkPos[kHSOldLady].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkOldLady; break; diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index 65b7bc618d..c0e6d2b14f 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -71,11 +71,11 @@ void GnapEngine::scene22_run() { queueInsertDeviceIcon(); if (_prevSceneNum == 20) { - initGnapPos(2, 8, 1); + initGnapPos(2, 8, kDirBottomRight); initBeaverPos(1, 8, 0); endSceneInit(); } else { - initGnapPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y, 1); + initGnapPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y, kDirBottomRight); initBeaverPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, 0); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107B9, 1); @@ -193,7 +193,7 @@ void GnapEngine::scene22_run() { playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSCashier].x, _hotspotsWalkPos[kHSCashier].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkCashier; diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index 7257ab1753..62a3c8bcbf 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -69,7 +69,7 @@ void GnapEngine::scene23_run() { queueInsertDeviceIcon(); - initGnapPos(-1, 7, 1); + initGnapPos(-1, 7, kDirBottomRight); initBeaverPos(-2, 7, 0); _gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); @@ -151,7 +151,7 @@ void GnapEngine::scene23_run() { if (isFlag(11)) playGnapImpossible(0, 0); else { - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); setFlag(11); diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp index b7660a3723..7546b45ab6 100644 --- a/engines/gnap/scenes/scene24.cpp +++ b/engines/gnap/scenes/scene24.cpp @@ -84,13 +84,13 @@ void GnapEngine::scene24_run() { queueInsertDeviceIcon(); if (_prevSceneNum == 20) { - initGnapPos(1, 8, 1); + initGnapPos(1, 8, kDirBottomRight); initBeaverPos(2, 8, 0); endSceneInit(); gnapWalkTo(1, 9, -1, 0x107B9, 1); platypusWalkTo(2, 9, -1, 0x107C2, 1); } else { - initGnapPos(8, 8, 3); + initGnapPos(8, 8, kDirBottomLeft); initBeaverPos(8, 8, 4); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107BA, 1); @@ -156,7 +156,7 @@ void GnapEngine::scene24_run() { if (_gnapActionStatus < 0) { _isLeavingScene = true; _newSceneNum = 20; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index b1bbfb40e8..5a6d7d325a 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -121,13 +121,13 @@ void GnapEngine::scene25_run() { queueInsertDeviceIcon(); if (_prevSceneNum == 24) { - initGnapPos(5, 11, 5); + initGnapPos(5, 11, kDirUpLeft); initBeaverPos(6, 11, 4); endSceneInit(); gnapWalkTo(5, 7, -1, 0x107BA, 1); platypusWalkTo(6, 7, -1, 0x107C2, 1); } else { - initGnapPos(5, 6, 1); + initGnapPos(5, 6, kDirBottomRight); initBeaverPos(6, 6, 0); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107B9, 1); @@ -195,7 +195,7 @@ void GnapEngine::scene25_run() { _s25_nextTicketVendorSequenceId = (getRandom(2) == 1) ? 0x59 : 0x56; break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkTicketVendor; break; @@ -249,11 +249,11 @@ void GnapEngine::scene25_run() { case LOOK_CURSOR: gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, -1, -1, 1); if (_sceneClickedHotspot == 5 || _sceneClickedHotspot == 6) - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; else if (_sceneClickedHotspot == 8) - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; else - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; playGnapIdle(0, 0); scene25_playAnims(8 - _sceneClickedHotspot + 1); break; diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index 974525d55a..bef046c2bc 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -81,13 +81,13 @@ void GnapEngine::scene26_run() { _gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); if (_prevSceneNum == 25) { - initGnapPos(-1, 8, 1); + initGnapPos(-1, 8, kDirBottomRight); initBeaverPos(-2, 8, 0); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); } else { - initGnapPos(2, 8, 1); + initGnapPos(2, 8, kDirBottomRight); initBeaverPos(3, 8, 0); endSceneInit(); } diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index d241daf04d..e36098113c 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -92,28 +92,28 @@ void GnapEngine::scene27_run() { switch (_prevSceneNum) { case 26: - initGnapPos(7, 12, 1); + initGnapPos(7, 12, kDirBottomRight); initBeaverPos(6, 12, 0); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); break; case 29: - initGnapPos(-1, 8, 1); + initGnapPos(-1, 8, kDirBottomRight); initBeaverPos(-1, 9, 0); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107B9, 1); platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 31: - initGnapPos(12, 8, 3); + initGnapPos(12, 8, kDirBottomLeft); initBeaverPos(12, 9, 4); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(8, 9, -1, 0x107C2, 1); break; default: - initGnapPos(6, 8, 1); + initGnapPos(6, 8, kDirBottomRight); initBeaverPos(5, 9, 0); endSceneInit(); break; @@ -166,7 +166,7 @@ void GnapEngine::scene27_run() { case kHSJanitor: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemPicture) { - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; if (gnapWalkTo(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 0, 0x107BC, 1)) _gnapActionStatus = kASShowPictureToJanitor; } else if (_grabCursorSpriteIndex >= 0) { @@ -177,7 +177,7 @@ void GnapEngine::scene27_run() { playGnapScratchingHead(6, 3); break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkJanitor; break; @@ -200,7 +200,7 @@ void GnapEngine::scene27_run() { playGnapScratchingHead(3, 3); break; case GRAB_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBucket].x, _hotspotsWalkPos[kHSBucket].y) | 0x10000, 1); _gnapActionStatus = kASGrabBucket; break; diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index e39bb8d92d..0d04e2ed0b 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -94,12 +94,12 @@ void GnapEngine::scene28_run() { _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _timers[4] = getRandom(20) + 80; } - initGnapPos(8, 8, 3); + initGnapPos(8, 8, kDirBottomLeft); initBeaverPos(9, 8, 4); endSceneInit(); } else { _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - initGnapPos(8, 8, 3); + initGnapPos(8, 8, kDirBottomLeft); initBeaverPos(9, 8, 4); endSceneInit(); playSequences(0xF7, 0x121, 0x122, 0x123); @@ -176,7 +176,7 @@ void GnapEngine::scene28_run() { _gnapActionStatus = kASGrabHornSuccess; } } else { - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(2, 8, 0, 0x107BB, 1); _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); @@ -201,13 +201,13 @@ void GnapEngine::scene28_run() { else playGnapImpossible(0, 0); } else if (_grabCursorSpriteIndex == kItemBucketWithBeer) { - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); _gnapActionStatus = kASUseBeerBucketWithClown; } else if (_grabCursorSpriteIndex == kItemBucketWithPill) { - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); @@ -220,7 +220,7 @@ void GnapEngine::scene28_run() { playGnapScratchingHead(5, 2); break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkClown; break; diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 666ec9e845..98215d4728 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -85,13 +85,13 @@ void GnapEngine::scene29_run() { _gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); if (_prevSceneNum == 27) { - initGnapPos(12, 7, 1); + initGnapPos(12, 7, kDirBottomRight); initBeaverPos(12, 8, 0); endSceneInit(); gnapWalkTo(8, 7, -1, 0x107B9, 1); platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { - initGnapPos(-1, 7, 1); + initGnapPos(-1, 7, kDirBottomRight); initBeaverPos(-2, 7, 0); endSceneInit(); gnapWalkTo(2, 7, -1, 0x107B9, 1); @@ -144,7 +144,7 @@ void GnapEngine::scene29_run() { case kHSMonkey: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemBanana) { - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASUseBananaWithMonkey; _newSceneNum = 51; diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 48b97bdaae..9a641739b2 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -75,7 +75,7 @@ void GnapEngine::scene30_run() { _timers[4] = getRandom(100) + 300; _s30_kidSequenceId = 0x101; - initGnapPos(7, 12, 1); + initGnapPos(7, 12, kDirBottomRight); initBeaverPos(6, 12, 0); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 17cde86db4..b39b61bcdb 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -79,13 +79,13 @@ void GnapEngine::scene31_run() { _timers[5] = getRandom(50) + 180; if (_prevSceneNum == 27) { - initGnapPos(-1, 8, 3); + initGnapPos(-1, 8, kDirBottomLeft); initBeaverPos(-1, 9, 4); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107BA, 1); platypusWalkTo(3, 9, -1, 0x107D2, 1); } else { - initGnapPos(7, 12, 1); + initGnapPos(7, 12, kDirBottomRight); initBeaverPos(6, 12, 0); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107BA, 1); @@ -203,7 +203,7 @@ void GnapEngine::scene31_run() { } else { gnapWalkTo(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); _gnapActionStatus = kASUseBeerBarrel; - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; } break; case TALK_CURSOR: @@ -322,7 +322,7 @@ void GnapEngine::scene31_updateAnimations() { _gnapActionStatus = kASFillEmptyBucketWithBeerDone; break; case kASFillEmptyBucketWithBeerDone: - _gnapIdleFacing = 3; + _gnapIdleFacing = kDirBottomLeft; playGnapPullOutDevice(0, 0); playGnapUseDevice(0, 0); _gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index fca05ee7b4..b91e1be7ad 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -72,13 +72,13 @@ void GnapEngine::scene32_run() { _timers[4] = getRandom(100) + 300; if (_prevSceneNum == 33) { - initGnapPos(11, 6, 3); + initGnapPos(11, 6, kDirBottomLeft); initBeaverPos(12, 6, 4); endSceneInit(); platypusWalkTo(9, 6, -1, 0x107D2, 1); gnapWalkTo(8, 6, -1, 0x107BA, 1); } else { - initGnapPos(1, 6, 1); + initGnapPos(1, 6, kDirBottomRight); initBeaverPos(1, 7, 0); endSceneInit(); } diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index b601d5fab1..ed56b68613 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -77,26 +77,26 @@ void GnapEngine::scene33_run() { switch (_prevSceneNum) { case 34: - initGnapPos(11, 7, 3); + initGnapPos(11, 7, kDirBottomLeft); initBeaverPos(12, 7, 4); endSceneInit(); gnapWalkTo(8, 7, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); break; case 37: - initGnapPos(7, 7, 1); + initGnapPos(7, 7, kDirBottomRight); initBeaverPos(8, 7, 0); endSceneInit(); break; case 32: - initGnapPos(-1, 6, 1); + initGnapPos(-1, 6, kDirBottomRight); initBeaverPos(-1, 7, 0); endSceneInit(); platypusWalkTo(2, 7, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); break; default: - initGnapPos(3, 7, 1); + initGnapPos(3, 7, kDirBottomRight); initBeaverPos(2, 7, 0); endSceneInit(); break; @@ -151,14 +151,14 @@ void GnapEngine::scene33_run() { } else { switch (_verbCursor) { case GRAB_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; if (gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _gnapActionStatus = kASUseChicken; else _gnapActionStatus = -1; break; case TALK_CURSOR: - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkChicken; break; diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index a53d5b0691..f5351fe2c5 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -97,10 +97,10 @@ void GnapEngine::scene38_run() { _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 39) { - initGnapPos(3, 7, 3); + initGnapPos(3, 7, kDirBottomLeft); initBeaverPos(4, 7, 4); } else { - initGnapPos(3, 8, 1); + initGnapPos(3, 8, kDirBottomRight); initBeaverPos(4, 8, 0); } endSceneInit(); @@ -304,7 +304,7 @@ void GnapEngine::scene38_updateAnimations() { _gnapSequenceDatNum = 0; _gnapX = 3; _gnapY = 6; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; if (_isLeavingScene) { _sceneWaiting = false; gnapWalkTo(5, 7, 0, 0x107BB, 1); @@ -319,7 +319,7 @@ void GnapEngine::scene38_updateAnimations() { _gnapSequenceDatNum = 0; _gnapX = 3; _gnapY = 6; - _gnapIdleFacing = 1; + _gnapIdleFacing = kDirBottomRight; _gameSys->setAnimation(0x9E, _gnapId, 0); _sceneWaiting = false; scene38_updateHotspots(); diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index b8a5f1e724..94bdcb5a0e 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -70,11 +70,11 @@ void GnapEngine::scene39_run() { _s39_nextGuySequenceId = -1; if (_prevSceneNum == 38) { - initGnapPos(3, 7, 7); + initGnapPos(3, 7, kDirUpRight); initBeaverPos(2, 7, 5); endSceneInit(); } else { - initGnapPos(4, 7, 1); + initGnapPos(4, 7, kDirBottomRight); initBeaverPos(5, 7, 0); endSceneInit(); } diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index ca5c677264..ab49458cb4 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -133,7 +133,7 @@ void GnapEngine::scene41_run() { if (isFlag(12)) { _gnapSequenceId = 0x120; _gnapSequenceDatNum = 0; - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapX = 7; _gnapY = 7; _gnapId = 140; @@ -142,19 +142,19 @@ void GnapEngine::scene41_run() { initBeaverPos(8, 10, 3); endSceneInit(); } else if (_prevSceneNum == 45) { - initGnapPos(-1, 8, 7); + initGnapPos(-1, 8, kDirUpRight); initBeaverPos(-2, 8, 5); endSceneInit(); platypusWalkTo(1, 8, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_prevSceneNum == 42) { - initGnapPos(11, 8, 7); + initGnapPos(11, 8, kDirUpRight); initBeaverPos(11, 9, 5); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - initGnapPos(5, 8, 1); + initGnapPos(5, 8, kDirBottomRight); initBeaverPos(6, 8, 3); endSceneInit(); } @@ -287,7 +287,7 @@ void GnapEngine::scene41_run() { playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkToyVendor; break; @@ -301,7 +301,7 @@ void GnapEngine::scene41_run() { case kHSKid: if (_grabCursorSpriteIndex == kItemChickenBucket) { gnapWalkTo(7, 7, 0, 0x107BB, 1); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASUseChickenBucketWithKid; } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(7, 7, 8, 0); @@ -312,11 +312,11 @@ void GnapEngine::scene41_run() { break; case GRAB_CURSOR: gnapWalkTo(7, 7, 0, 0x107BB, 1); - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; _gnapActionStatus = kASGrabKid; break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(7, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case PLAT_CURSOR: diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 3826f7b29b..4ebcec6650 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -125,19 +125,19 @@ void GnapEngine::scene42_run() { if (_toyUfoSequenceId == 0x872) setGrabCursorSprite(-1); } else if (_prevSceneNum == 41) { - initGnapPos(-1, 8, 7); + initGnapPos(-1, 8, kDirUpRight); initBeaverPos(-1, 9, 5); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); } else if (_prevSceneNum == 43) { - initGnapPos(11, 8, 7); + initGnapPos(11, 8, kDirUpRight); initBeaverPos(11, 9, 5); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - initGnapPos(5, 11, 7); + initGnapPos(5, 11, kDirUpRight); initBeaverPos(6, 11, 5); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); @@ -266,7 +266,7 @@ void GnapEngine::scene42_run() { playGnapScratchingHead(_hotspotsWalkPos[kHSBBQVendor].x - 1, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = kASTalkBBQVendor; break; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 957aea3ec6..2484a62227 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -113,27 +113,27 @@ void GnapEngine::scene43_run() { } else { switch (_prevSceneNum) { case 42: - initGnapPos(-1, 8, 7); + initGnapPos(-1, 8, kDirUpRight); initBeaverPos(-1, 9, 5); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 44: - initGnapPos(11, 8, 7); + initGnapPos(11, 8, kDirUpRight); initBeaverPos(11, 9, 5); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); break; case 54: - initGnapPos(4, 7, 3); + initGnapPos(4, 7, kDirBottomLeft); initBeaverPos(11, 8, 5); endSceneInit(); platypusWalkTo(9, 8, -1, 0x107D2, 1); break; default: - initGnapPos(5, 11, 7); + initGnapPos(5, 11, kDirUpRight); initBeaverPos(6, 11, 5); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); @@ -267,7 +267,7 @@ void GnapEngine::scene43_run() { playGnapScratchingHead(7, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = 2; break; @@ -289,7 +289,7 @@ void GnapEngine::scene43_run() { playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(3, 7, 0, 67515, 1); _gnapActionStatus = 1; break; diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 3bcde76fc6..af961ad469 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -127,21 +127,21 @@ void GnapEngine::scene44_run() { } else { switch (_prevSceneNum) { case 43: - initGnapPos(-1, 8, 7); + initGnapPos(-1, 8, kDirUpRight); initBeaverPos(-1, 7, 5); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 46: - initGnapPos(11, 8, 7); + initGnapPos(11, 8, kDirUpRight); initBeaverPos(11, 8, 5); endSceneInit(); gnapWalkTo(6, 8, -1, 0x107BA, 1); platypusWalkTo(7, 8, -1, 0x107D2, 1); break; case 50: - initGnapPos(4, 8, 1); + initGnapPos(4, 8, kDirBottomRight); if (_sceneSavegameLoaded) { initBeaverPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 4); } else if (!isFlag(13)) { @@ -158,7 +158,7 @@ void GnapEngine::scene44_run() { endSceneInit(); break; default: - initGnapPos(5, 11, 7); + initGnapPos(5, 11, kDirUpRight); initBeaverPos(6, 11, 5); endSceneInit(); platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -279,7 +279,7 @@ void GnapEngine::scene44_run() { playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSKissingLady].x, _hotspotsWalkPos[kHSKissingLady].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = 1; break; @@ -333,7 +333,7 @@ void GnapEngine::scene44_run() { playGnapScratchingHead(8, 7); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSSpringGuy].x, _hotspotsWalkPos[kHSSpringGuy].y, -1, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case GRAB_CURSOR: diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 87d52bef4b..1ae51bc220 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -119,19 +119,19 @@ void GnapEngine::scene45_run() { initBeaverPos(4, 8, 0); endSceneInit(); } else if (_prevSceneNum == 46) { - initGnapPos(-1, 8, 7); + initGnapPos(-1, 8, kDirUpRight); initBeaverPos(-1, 9, 5); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107C2, 1); gnapWalkTo(2, 7, -1, 0x107B9, 1); } else if (_prevSceneNum == 41) { - initGnapPos(11, 8, 7); + initGnapPos(11, 8, kDirUpRight); initBeaverPos(11, 9, 5); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107D2, 1); gnapWalkTo(10, 9, -1, 0x107BA, 1); } else { - initGnapPos(2, 11, 7); + initGnapPos(2, 11, kDirUpRight); initBeaverPos(6, 11, 5); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 544829207e..37a000584c 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -101,19 +101,19 @@ void GnapEngine::scene46_run() { _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); endSceneInit(); } else if (_prevSceneNum == 44) { - initGnapPos(-1, 8, 7); + initGnapPos(-1, 8, kDirUpRight); initBeaverPos(-1, 8, 5); endSceneInit(); platypusWalkTo(1, 8, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_prevSceneNum == 45) { - initGnapPos(11, 8, 7); + initGnapPos(11, 8, kDirUpRight); initBeaverPos(12, 8, 5); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - initGnapPos(5, 11, 7); + initGnapPos(5, 11, kDirUpRight); initBeaverPos(6, 11, 5); endSceneInit(); platypusWalkTo(5, 8, -1, 0x107C2, 1); @@ -203,7 +203,7 @@ void GnapEngine::scene46_run() { playGnapMoan1(_hotspotsWalkPos[kHSSackGuy].x + 1, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 5; + _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[kHSSackGuy].x, _hotspotsWalkPos[kHSSackGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = 2; break; @@ -224,7 +224,7 @@ void GnapEngine::scene46_run() { playGnapMoan1(_hotspotsWalkPos[kHSItchyGuy].x - 1, 0); break; case TALK_CURSOR: - _gnapIdleFacing = 7; + _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSItchyGuy].x, _hotspotsWalkPos[kHSItchyGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _gnapActionStatus = 1; break; -- cgit v1.2.3 From 2d63d769ebcb720507602b165eb042ff69e28c24 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 1 Apr 2016 07:52:25 +0200 Subject: GNAP: Refactoring - Use enum for beaver facing --- engines/gnap/gnap.cpp | 24 ++++++++++++------------ engines/gnap/gnap.h | 4 ++-- engines/gnap/grid.cpp | 22 +++++++++++----------- engines/gnap/scenes/scene01.cpp | 4 ++-- engines/gnap/scenes/scene02.cpp | 10 +++++----- engines/gnap/scenes/scene03.cpp | 4 ++-- engines/gnap/scenes/scene04.cpp | 8 ++++---- engines/gnap/scenes/scene05.cpp | 6 +++--- engines/gnap/scenes/scene06.cpp | 4 ++-- engines/gnap/scenes/scene07.cpp | 4 ++-- engines/gnap/scenes/scene08.cpp | 8 ++++---- engines/gnap/scenes/scene09.cpp | 8 ++++---- engines/gnap/scenes/scene10.cpp | 8 ++++---- engines/gnap/scenes/scene11.cpp | 8 ++++---- engines/gnap/scenes/scene12.cpp | 8 ++++---- engines/gnap/scenes/scene13.cpp | 4 ++-- engines/gnap/scenes/scene17.cpp | 16 ++++++++-------- engines/gnap/scenes/scene18.cpp | 8 ++++---- engines/gnap/scenes/scene19.cpp | 2 +- engines/gnap/scenes/scene20.cpp | 16 ++++++++-------- engines/gnap/scenes/scene21.cpp | 6 +++--- engines/gnap/scenes/scene22.cpp | 4 ++-- engines/gnap/scenes/scene23.cpp | 2 +- engines/gnap/scenes/scene24.cpp | 4 ++-- engines/gnap/scenes/scene25.cpp | 4 ++-- engines/gnap/scenes/scene26.cpp | 4 ++-- engines/gnap/scenes/scene27.cpp | 8 ++++---- engines/gnap/scenes/scene28.cpp | 4 ++-- engines/gnap/scenes/scene29.cpp | 4 ++-- engines/gnap/scenes/scene30.cpp | 2 +- engines/gnap/scenes/scene31.cpp | 4 ++-- engines/gnap/scenes/scene32.cpp | 4 ++-- engines/gnap/scenes/scene33.cpp | 8 ++++---- engines/gnap/scenes/scene38.cpp | 4 ++-- engines/gnap/scenes/scene39.cpp | 4 ++-- engines/gnap/scenes/scene41.cpp | 8 ++++---- engines/gnap/scenes/scene42.cpp | 6 +++--- engines/gnap/scenes/scene43.cpp | 8 ++++---- engines/gnap/scenes/scene44.cpp | 12 ++++++------ engines/gnap/scenes/scene45.cpp | 8 ++++---- engines/gnap/scenes/scene46.cpp | 6 +++--- 41 files changed, 145 insertions(+), 145 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index c84583905f..dc677a1889 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1834,7 +1834,7 @@ void GnapEngine::gnapKissPlatypus(int callback) { kSeqSyncWait, getSequenceTotalDuration(0x10847), 75 * _platX - _platGridX, 48 * _platY - _platGridY); _beaverSequenceDatNum = 1; _beaverSequenceId = 0x7CB; - _beaverFacing = 0; + _beaverFacing = kDirNone; playGnapSequence(0x107B5); while (_gameSys->getAnimationStatus(0) != 2) { updateMouseCursor(); @@ -1864,7 +1864,7 @@ void GnapEngine::gnapUseJointOnPlatypus() { kSeqSyncWait, 0, 15 * (5 * _platX - 25), 48 * (_platY - 7)); _beaverSequenceDatNum = 1; _beaverSequenceId = 0x876; - _beaverFacing = 0; + _beaverFacing = kDirNone; playGnapSequence(0x107B5); gnapWalkStep(); while (_gameSys->getAnimationStatus(0) != 2) { @@ -1900,17 +1900,17 @@ int GnapEngine::getBeaverSequenceId(int kind, int gridX, int gridY) { if (gridX > 0 && gridY > 0) { if (gridX < _platX) { sequenceId = 0x7CC; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } else { sequenceId = 0x7CB; - _beaverFacing = 0; + _beaverFacing = kDirNone; } - } else if (_beaverFacing != 0) { + } else if (_beaverFacing != kDirNone) { sequenceId = 0x7CC; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } else { sequenceId = 0x7CB; - _beaverFacing = 0; + _beaverFacing = kDirNone; } return sequenceId | 0x10000; } @@ -1990,20 +1990,20 @@ void GnapEngine::beaverSub426234() { } } -void GnapEngine::initBeaverPos(int gridX, int gridY, int facing) { +void GnapEngine::initBeaverPos(int gridX, int gridY, Facing facing) { _timers[0] = 50; _timers[1] = 20; _platX = gridX; _platY = gridY; - if (facing <= 0) - _beaverFacing = 0; + if (facing == kDirNone) + _beaverFacing = kDirNone; else _beaverFacing = facing; - if (_beaverFacing == 4) { + if (_beaverFacing == kDirUnk4) { _beaverSequenceId = 0x7D1; } else { _beaverSequenceId = 0x7C1; - _beaverFacing = 0; + _beaverFacing = kDirNone; } _beaverId = 20 * _platY; _beaverSequenceDatNum = 1; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 2872f69f20..b96d27d4a1 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -525,14 +525,14 @@ public: void gnapUseDisguiseOnPlatypus(); // Beaver - int _beaverFacing; + Facing _beaverFacing; int _beaverActionStatus; int _beaverSequenceId, _beaverSequenceDatNum, _beaverId; int getBeaverSequenceId(int kind, int gridX, int gridY); void playBeaverSequence(int sequenceId); void updateBeaverIdleSequence(); void beaverSub426234(); - void initBeaverPos(int gridX, int gridY, int facing); + void initBeaverPos(int gridX, int gridY, Facing facing); // Scenes diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 136e8d429e..bfe0a0f89d 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -1295,13 +1295,13 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _beaverSequenceDatNum = datNum; // CHECKME Not sure if this is correct... if (_platWalkNodes[_platWalkNodesCount - 1].deltaX > 0) - _beaverFacing = 0; + _beaverFacing = kDirNone; else if (_platWalkNodes[_platWalkNodesCount - 1].deltaX < 0) - _beaverFacing = 4; + _beaverFacing = kDirUnk4; else if (_platWalkNodes[_platWalkNodesCount - 1].gridX1 % 2) - _beaverFacing = 4; + _beaverFacing = kDirUnk4; else - _beaverFacing = 0; + _beaverFacing = kDirNone; if (animationIndex >= 0) _gameSys->setAnimation(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, animationIndex); } else if (animationIndex >= 0) { @@ -1313,27 +1313,27 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _beaverSequenceId = ridToEntryIndex(sequenceId); _beaverSequenceDatNum = ridToDatIndex(sequenceId); if (_beaverSequenceId == 0x7C2) { - _beaverFacing = 0; + _beaverFacing = kDirNone; } else if (_beaverSequenceId == 0x7D2) { - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } } else { if (_platWalkNodesCount > 0) { if (_platWalkNodes[_platWalkNodesCount - 1].deltaX > 0) { _beaverSequenceId = 0x7C2; - _beaverFacing = 0; + _beaverFacing = kDirNone; } else if (_platWalkNodes[_platWalkNodesCount - 1].deltaX < 0) { _beaverSequenceId = 0x7D2; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } else if (_platWalkNodes[0].deltaX > 0) { _beaverSequenceId = 0x7C2; - _beaverFacing = 0; + _beaverFacing = kDirNone; } else if (_platWalkNodes[0].deltaX < 0) { _beaverSequenceId = 0x7D2; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } else { _beaverSequenceId = 0x7D2; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } } else if (_beaverFacing > 0) { _beaverSequenceId = 0x7D2; diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index ba906b601b..0e90e0bd5a 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -104,7 +104,7 @@ void GnapEngine::scene01_run() { if (_prevSceneNum == 2) { initGnapPos(11, 6, kDirBottomLeft); if (isFlag(0)) - initBeaverPos(12, 6, 4); + initBeaverPos(12, 6, kDirUnk4); endSceneInit(); if (isFlag(0)) platypusWalkTo(9, 6, -1, 0x107C2, 1); @@ -112,7 +112,7 @@ void GnapEngine::scene01_run() { } else { initGnapPos(1, 6, kDirBottomRight); if (isFlag(0)) - initBeaverPos(1, 7, 0); + initBeaverPos(1, 7, kDirNone); endSceneInit(); } diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index 5d254870da..65018e0435 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -101,7 +101,7 @@ void GnapEngine::scene02_run() { case 3: initGnapPos(11, 6, kDirBottomLeft); if (isFlag(0)) - initBeaverPos(12, 6, 4); + initBeaverPos(12, 6, kDirUnk4); endSceneInit(); if (isFlag(0)) platypusWalkTo(9, 6, -1, 0x107C2, 1); @@ -110,7 +110,7 @@ void GnapEngine::scene02_run() { case 4: initGnapPos(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, kDirBottomLeft); if (isFlag(0)) - initBeaverPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 4); + initBeaverPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, kDirUnk4); endSceneInit(); gnapWalkTo(7, 6, 0, 0x107B9, 1); if (isFlag(0)) @@ -121,19 +121,19 @@ void GnapEngine::scene02_run() { case 47: clearFlag(25); initGnapPos(5, 6, kDirBottomLeft); - initBeaverPos(6, 7, 4); + initBeaverPos(6, 7, kDirUnk4); endSceneInit(); break; case 49: initGnapPos(5, 6, kDirBottomRight); if (isFlag(0)) - initBeaverPos(6, 7, 0); + initBeaverPos(6, 7, kDirNone); endSceneInit(); break; default: initGnapPos(-1, 6, kDirBottomRight); if (isFlag(0)) - initBeaverPos(-1, 7, 0); + initBeaverPos(-1, 7, kDirNone); endSceneInit(); if (isFlag(0)) platypusWalkTo(2, 7, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index c7600133d2..930554c3ac 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -104,7 +104,7 @@ void GnapEngine::scene03_run() { _timers[5] = getRandom(100) + 200; if (isFlag(0)) { - initBeaverPos(5, 4, 0); + initBeaverPos(5, 4, kDirNone); } else { _timers[1] = getRandom(40) + 20; _gameSys->setAnimation(0x1C2, 99, 1); @@ -386,7 +386,7 @@ void GnapEngine::scene03_updateAnimations() { _gnapActionStatus = -1; _platX = 6; _platY = 6; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; _beaverId = 120; _gameSys->insertSequence(0x107CA, _beaverId, 0x1BC, 99, kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 164a53f35d..ec3f482ac0 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -128,7 +128,7 @@ void GnapEngine::scene04_run() { clearFlag(10); _beaverSequenceId = 0x20C; _beaverSequenceDatNum = 0; - _beaverFacing = 1; + _beaverFacing = kDirBottomRight; _gnapSequenceId = 0x7B5; _gnapSequenceDatNum = 1; _gameSys->waitForUpdate(); @@ -137,19 +137,19 @@ void GnapEngine::scene04_run() { if (_prevSceneNum == 2) { initGnapPos(5, 11, kDirUpRight); if (isFlag(0)) - initBeaverPos(6, 11, 5); + initBeaverPos(6, 11, kDirUpLeft); endSceneInit(); if (isFlag(0)) platypusWalkTo(5, 8, -1, 0x107C2, 1); gnapWalkTo(6, 9, -1, 0x107BA, 1); } else if (_prevSceneNum == 38) { initGnapPos(5, 7, kDirBottomRight); - initBeaverPos(4, 7, 0); + initBeaverPos(4, 7, kDirNone); endSceneInit(); } else { initGnapPos(12, 9, kDirBottomRight); if (isFlag(0)) - initBeaverPos(12, 8, 0); + initBeaverPos(12, 8, kDirNone); endSceneInit(); if (isFlag(0)) platypusWalkTo(9, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index f13a2a358d..aebd783359 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -98,7 +98,7 @@ void GnapEngine::scene05_run() { if (_prevSceneNum != 6 && _prevSceneNum != 36) { initGnapPos(-1, 8, kDirBottomRight); if (isFlag(0)) - initBeaverPos(-1, 9, 0); + initBeaverPos(-1, 9, kDirNone); endSceneInit(); if (isFlag(0)) platypusWalkTo(2, 8, -1, 0x107C2, 1); @@ -106,7 +106,7 @@ void GnapEngine::scene05_run() { } else { initGnapPos(6, 8, kDirBottomRight); if (isFlag(0)) - initBeaverPos(7, 9, 0); + initBeaverPos(7, 9, kDirNone); endSceneInit(); } @@ -178,7 +178,7 @@ void GnapEngine::scene05_run() { gnapUseDeviceOnBeaver(); if (platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { _beaverActionStatus = kASPlatSearchHaystack; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } if (_gnapX == 4 && (_gnapY == 8 || _gnapY == 7)) gnapWalkStep(); diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index acf309cbab..459d449656 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -107,7 +107,7 @@ void GnapEngine::scene06_run() { queueInsertDeviceIcon(); initGnapPos(5, 12, kDirBottomRight); - initBeaverPos(6, 12, 0); + initBeaverPos(6, 12, kDirNone); endSceneInit(); platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -230,7 +230,7 @@ void GnapEngine::scene06_run() { _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; _gnapIdleFacing = kDirUpLeft; platypusWalkTo(6, 8, 1, 0x107C2, 1); - _beaverFacing = 0; + _beaverFacing = kDirNone; _gnapActionStatus = kASUseTwigOnHorse; setGrabCursorSprite(-1); } else if (_grabCursorSpriteIndex >= 0) { diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index 1b609f8689..b6b5b91a44 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -72,7 +72,7 @@ void GnapEngine::scene07_run() { if (_prevSceneNum == 8) { initGnapPos(7, 7, kDirBottomLeft); - initBeaverPos(9, 7, 4); + initBeaverPos(9, 7, kDirUnk4); endSceneInit(); } else { _gnapX = 6; @@ -89,7 +89,7 @@ void GnapEngine::scene07_run() { _beaverId = 160; _beaverSequenceId = 0x91; _beaverSequenceDatNum = 0; - _beaverFacing = 0; + _beaverFacing = kDirNone; _gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); } diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index 5988114f9a..a1cbe07601 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -117,7 +117,7 @@ void GnapEngine::scene08_run() { _gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); initGnapPos(-1, 8, kDirBottomRight); - initBeaverPos(-1, 7, 0); + initBeaverPos(-1, 7, kDirNone); endSceneInit(); @@ -218,7 +218,7 @@ void GnapEngine::scene08_run() { gnapUseDeviceOnBeaver(); platypusWalkTo(6, 6, 1, 0x107C2, 1); _beaverActionStatus = kASPlatWithMan; - _beaverFacing = 0; + _beaverFacing = kDirNone; playGnapIdle(6, 6); break; } @@ -254,7 +254,7 @@ void GnapEngine::scene08_run() { gnapUseDeviceOnBeaver(); platypusWalkTo(3, 7, 1, 0x107C2, 1); _beaverActionStatus = kASPlatWithDog; - _beaverFacing = 0; + _beaverFacing = kDirNone; playGnapIdle(3, 7); break; } @@ -500,7 +500,7 @@ void GnapEngine::scene08_updateAnimations() { _platY = 8; _beaverId = 160; _beaverSequenceId = 0x148; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; _beaverSequenceDatNum = 0; if (_gnapX == 1 && _gnapY == 8) gnapWalkStep(); diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 2cf57a9a12..d16f3bd6ce 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -68,13 +68,13 @@ void GnapEngine::scene09_run() { if (_prevSceneNum == 8) { initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(12, 7, 4); + initBeaverPos(12, 7, kDirUnk4); endSceneInit(); gnapWalkTo(9, 8, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { initGnapPos(4, 7, kDirBottomRight); - initBeaverPos(5, 7, 0); + initBeaverPos(5, 7, kDirNone); endSceneInit(); } @@ -128,7 +128,7 @@ void GnapEngine::scene09_run() { gnapWalkTo(4, 7, 0, 0x107BF, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(4, 8, -1, 0x107D2, 1); - _beaverFacing = 4; + _beaverFacing = kDirUnk4; break; case kHSExitHouse: @@ -137,7 +137,7 @@ void GnapEngine::scene09_run() { gnapWalkTo(10, -1, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(10, -1, -1, 0x107CD, 1); - _beaverFacing = 4; + _beaverFacing = kDirUnk4; break; case kHSTrash: diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index 0a89682c00..6f5552fbea 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -85,13 +85,13 @@ void GnapEngine::scene10_run() { if (_prevSceneNum == 9) { initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(12, 7, 4); + initBeaverPos(12, 7, kDirUnk4); endSceneInit(); gnapWalkTo(9, 8, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { initGnapPos(-1, 7, kDirBottomRight); - initBeaverPos(-2, 8, 0); + initBeaverPos(-2, 8, kDirNone); endSceneInit(); gnapWalkTo(1, 7, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); @@ -256,7 +256,7 @@ void GnapEngine::scene10_run() { gnapUseDeviceOnBeaver(); platypusWalkTo(7, 6, 1, 0x107D2, 1); _beaverActionStatus = kASPlatWithBox; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; _largeSprite = _gameSys->createSurface(0xC3); playGnapIdle(7, 6); } @@ -397,7 +397,7 @@ void GnapEngine::scene10_updateAnimations() { _s10_nextCookSequenceId = 0x843; _beaverSequenceId = 0x7C9; _beaverId = 160; - _beaverFacing = 0; + _beaverFacing = kDirNone; _beaverSequenceDatNum = 1; break; case 0x843: diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index f3646772d3..95a8df36d9 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -94,22 +94,22 @@ void GnapEngine::scene11_run() { switch (_prevSceneNum) { case 13: initGnapPos(8, 5, kDirBottomLeft); - initBeaverPos(9, 6, 4); + initBeaverPos(9, 6, kDirUnk4); break; case 47: initGnapPos(8, 5, kDirBottomLeft); - initBeaverPos(9, 5, 4); + initBeaverPos(9, 5, kDirUnk4); _s11_currGoggleGuySequenceId = 0x1FA; _s11_currHookGuySequenceId = 0x1FF; _timers[7] = 180; break; case 12: initGnapPos(-1, 9, kDirBottomRight); - initBeaverPos(-2, 8, 0); + initBeaverPos(-2, 8, kDirNone); break; default: initGnapPos(6, 6, kDirBottomLeft); - initBeaverPos(6, 5, 4); + initBeaverPos(6, 5, kDirUnk4); break; } diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index fae6f83d14..c83f0bd2d9 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -112,11 +112,11 @@ void GnapEngine::scene12_run() { if (_prevSceneNum == 15) { initGnapPos(5, 6, kDirBottomRight); - initBeaverPos(3, 7, 0); + initBeaverPos(3, 7, kDirNone); endSceneInit(); } else { initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(12, 8, 4); + initBeaverPos(12, 8, kDirUnk4); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); @@ -203,7 +203,7 @@ void GnapEngine::scene12_run() { gnapUseDeviceOnBeaver(); platypusWalkTo(3, 7, 1, 0x107D2, 1); _beaverActionStatus = kASPlatWithToothGuy; - _beaverFacing = 4; + _beaverFacing = kDirUnk4; playGnapIdle(2, 7); break; } @@ -273,7 +273,7 @@ void GnapEngine::scene12_run() { gnapUseDeviceOnBeaver(); platypusWalkTo(7, 6, 1, 0x107C2, 1); _beaverActionStatus = kASPlatWithBeardGuy; - _beaverFacing = 0; + _beaverFacing = kDirNone; playGnapIdle(7, 6); break; } diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index c1e9bab43e..66e78e8f5b 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -108,10 +108,10 @@ void GnapEngine::scene13_run() { if (_prevSceneNum == 14) { initGnapPos(6, 6, kDirBottomLeft); - initBeaverPos(9, 8, 0); + initBeaverPos(9, 8, kDirNone); } else { initGnapPos(3, 7, kDirBottomRight); - initBeaverPos(2, 7, 0); + initBeaverPos(2, 7, kDirNone); } endSceneInit(); diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index 04eb5f3140..fdfd1fba0f 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -178,7 +178,7 @@ void GnapEngine::scene17_run() { if (_prevSceneNum == 53 || _prevSceneNum == 18 || _prevSceneNum == 20 || _prevSceneNum == 19) { if (_prevSceneNum == 20) { initGnapPos(4, 6, kDirBottomRight); - initBeaverPos(5, 6, 0); + initBeaverPos(5, 6, kDirNone); endSceneInit(); platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); @@ -203,7 +203,7 @@ void GnapEngine::scene17_run() { } else if (isFlag(25)) { clearFlag(15); clearFlag(16); - initBeaverPos(7, 9, 0); + initBeaverPos(7, 9, kDirNone); _gnapX = _hotspotsWalkPos[2].x; _gnapY = _hotspotsWalkPos[2].y; _gnapId = 20 * _hotspotsWalkPos[2].y; @@ -235,18 +235,18 @@ void GnapEngine::scene17_run() { scene17_updateHotspots(); } else if (_prevSceneNum == 18) { initGnapPos(6, 6, kDirBottomRight); - initBeaverPos(5, 6, 0); + initBeaverPos(5, 6, kDirNone); endSceneInit(); platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { if (isFlag(15)) { initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, kDirBottomRight); - initBeaverPos(1, 9, 0); + initBeaverPos(1, 9, kDirNone); endSceneInit(); } else { initGnapPos(3, 7, kDirBottomRight); - initBeaverPos(1, 7, 0); + initBeaverPos(1, 7, kDirNone); endSceneInit(); } clearFlag(15); @@ -273,7 +273,7 @@ void GnapEngine::scene17_run() { endSceneInit(); _beaverSequenceId = 0x7C1; _beaverSequenceDatNum = 1; - _beaverFacing = 1; + _beaverFacing = kDirBottomRight; platypusWalkTo(2, 9, -1, 0x107C2, 1); } @@ -388,7 +388,7 @@ void GnapEngine::scene17_run() { scene17_platHangUpPhone(); _isLeavingScene = true; gnapUseDeviceOnBeaver(); - _beaverFacing = 5; + _beaverFacing = kDirUpLeft; platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); setFlag(16); _beaverActionStatus = kASPlatUsePhone; @@ -432,7 +432,7 @@ void GnapEngine::scene17_run() { scene17_platHangUpPhone(); _isLeavingScene = true; gnapUseDeviceOnBeaver(); - _beaverFacing = 5; + _beaverFacing = kDirUpLeft; platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); setFlag(16); _beaverActionStatus = kASPlatUsePhone; diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 53a89e019a..a7883263a5 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -380,19 +380,19 @@ void GnapEngine::scene18_run() { } if (_prevSceneNum == 17) { initGnapPos(4, 11, kDirBottomRight); - initBeaverPos(5, 11, 0); + initBeaverPos(5, 11, kDirNone); endSceneInit(); gnapWalkTo(4, 8, -1, 0x107B9, 1); platypusWalkTo(5, 9, -1, 0x107C2, 1); } else if (_prevSceneNum == 19) { initGnapPos(7, 7, kDirBottomRight); - initBeaverPos(8, 7, 0); + initBeaverPos(8, 7, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { initGnapPos(-1, 10, kDirBottomRight); - initBeaverPos(-1, 10, 0); + initBeaverPos(-1, 10, kDirNone); endSceneInit(); gnapWalkTo(3, 7, -1, 0x107B9, 1); platypusWalkTo(3, 8, -1, 0x107C2, 1); @@ -736,7 +736,7 @@ void GnapEngine::scene18_run() { if (!_timers[6]) { _beaverActionStatus = -1; _sceneWaiting = false; - initBeaverPos(-1, 10, 0); + initBeaverPos(-1, 10, kDirNone); platypusWalkTo(3, 9, -1, 0x107C2, 1); clearFlag(26); } diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index 2f588f2995..9dfd69eec5 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -127,7 +127,7 @@ void GnapEngine::scene19_run() { _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _timers[6] = getRandom(40) + 50; initGnapPos(3, 6, kDirBottomRight); - initBeaverPos(4, 6, 0); + initBeaverPos(4, 6, kDirNone); endSceneInit(); gnapWalkTo(4, 9, -1, 0x107B9, 1); platypusWalkTo(5, 9, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 990ceca499..beee17be0b 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -229,42 +229,42 @@ void GnapEngine::scene20_run() { gameUpdateTick(); } initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(11, 9, 4); + initBeaverPos(11, 9, kDirUnk4); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); } else { switch (_prevSceneNum) { case 17: initGnapPos(5, 11, kDirBottomRight); - initBeaverPos(6, 11, 0); + initBeaverPos(6, 11, kDirNone); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107B9, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 18: initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(11, 9, 4); + initBeaverPos(11, 9, kDirUnk4); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 21: initGnapPos(-1, 8, kDirBottomLeft); - initBeaverPos(-1, 9, 4); + initBeaverPos(-1, 9, kDirUnk4); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107B9, 1); platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 22: initGnapPos(7, 6, kDirBottomRight); - initBeaverPos(8, 6, 0); + initBeaverPos(8, 6, kDirNone); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107B9, 1); platypusWalkTo(9, 9, -1, 0x107C2, 1); break; default: initGnapPos(8, 6, kDirBottomLeft); - initBeaverPos(9, 6, 4); + initBeaverPos(9, 6, kDirUnk4); endSceneInit(); _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(8, 8, -1, 0x107BA, 1); @@ -329,7 +329,7 @@ void GnapEngine::scene20_run() { gnapWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } break; @@ -368,7 +368,7 @@ void GnapEngine::scene20_run() { gnapWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x, _hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); - _beaverFacing = 4; + _beaverFacing = kDirUnk4; } break; diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index 415c82f893..7d8157bd07 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -78,7 +78,7 @@ void GnapEngine::scene21_run() { if (isFlag(3)) { if (isFlag(5)) { initGnapPos(5, 8, kDirBottomRight); - initBeaverPos(6, 8, 0); + initBeaverPos(6, 8, kDirNone); _gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!isFlag(4)) _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); @@ -86,7 +86,7 @@ void GnapEngine::scene21_run() { clearFlag(5); } else { initGnapPos(5, 11, kDirBottomRight); - initBeaverPos(6, 11, 0); + initBeaverPos(6, 11, kDirNone); if (!isFlag(4)) _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); @@ -95,7 +95,7 @@ void GnapEngine::scene21_run() { } } else { initGnapPos(5, 11, kDirBottomRight); - initBeaverPos(6, 11, 0); + initBeaverPos(6, 11, kDirNone); _s21_currOldLadySequenceId = 0x89; _gameSys->setAnimation(0x89, 79, 3); _gameSys->insertSequence(_s21_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index c0e6d2b14f..01de3e8d55 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -72,11 +72,11 @@ void GnapEngine::scene22_run() { if (_prevSceneNum == 20) { initGnapPos(2, 8, kDirBottomRight); - initBeaverPos(1, 8, 0); + initBeaverPos(1, 8, kDirNone); endSceneInit(); } else { initGnapPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y, kDirBottomRight); - initBeaverPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, 0); + initBeaverPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, kDirNone); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107B9, 1); platypusWalkTo(9, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index 62a3c8bcbf..ebbf46a1da 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -70,7 +70,7 @@ void GnapEngine::scene23_run() { queueInsertDeviceIcon(); initGnapPos(-1, 7, kDirBottomRight); - initBeaverPos(-2, 7, 0); + initBeaverPos(-2, 7, kDirNone); _gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp index 7546b45ab6..ace9043062 100644 --- a/engines/gnap/scenes/scene24.cpp +++ b/engines/gnap/scenes/scene24.cpp @@ -85,13 +85,13 @@ void GnapEngine::scene24_run() { if (_prevSceneNum == 20) { initGnapPos(1, 8, kDirBottomRight); - initBeaverPos(2, 8, 0); + initBeaverPos(2, 8, kDirNone); endSceneInit(); gnapWalkTo(1, 9, -1, 0x107B9, 1); platypusWalkTo(2, 9, -1, 0x107C2, 1); } else { initGnapPos(8, 8, kDirBottomLeft); - initBeaverPos(8, 8, 4); + initBeaverPos(8, 8, kDirUnk4); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107BA, 1); platypusWalkTo(3, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index 5a6d7d325a..c93c194b94 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -122,13 +122,13 @@ void GnapEngine::scene25_run() { if (_prevSceneNum == 24) { initGnapPos(5, 11, kDirUpLeft); - initBeaverPos(6, 11, 4); + initBeaverPos(6, 11, kDirUnk4); endSceneInit(); gnapWalkTo(5, 7, -1, 0x107BA, 1); platypusWalkTo(6, 7, -1, 0x107C2, 1); } else { initGnapPos(5, 6, kDirBottomRight); - initBeaverPos(6, 6, 0); + initBeaverPos(6, 6, kDirNone); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107B9, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index bef046c2bc..fb2e0cca7e 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -82,13 +82,13 @@ void GnapEngine::scene26_run() { if (_prevSceneNum == 25) { initGnapPos(-1, 8, kDirBottomRight); - initBeaverPos(-2, 8, 0); + initBeaverPos(-2, 8, kDirNone); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); } else { initGnapPos(2, 8, kDirBottomRight); - initBeaverPos(3, 8, 0); + initBeaverPos(3, 8, kDirNone); endSceneInit(); } diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index e36098113c..02020d5211 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -93,28 +93,28 @@ void GnapEngine::scene27_run() { switch (_prevSceneNum) { case 26: initGnapPos(7, 12, kDirBottomRight); - initBeaverPos(6, 12, 0); + initBeaverPos(6, 12, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); break; case 29: initGnapPos(-1, 8, kDirBottomRight); - initBeaverPos(-1, 9, 0); + initBeaverPos(-1, 9, kDirNone); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107B9, 1); platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 31: initGnapPos(12, 8, kDirBottomLeft); - initBeaverPos(12, 9, 4); + initBeaverPos(12, 9, kDirUnk4); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(8, 9, -1, 0x107C2, 1); break; default: initGnapPos(6, 8, kDirBottomRight); - initBeaverPos(5, 9, 0); + initBeaverPos(5, 9, kDirNone); endSceneInit(); break; } diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index 0d04e2ed0b..f7226e3a66 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -95,12 +95,12 @@ void GnapEngine::scene28_run() { _timers[4] = getRandom(20) + 80; } initGnapPos(8, 8, kDirBottomLeft); - initBeaverPos(9, 8, 4); + initBeaverPos(9, 8, kDirUnk4); endSceneInit(); } else { _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); initGnapPos(8, 8, kDirBottomLeft); - initBeaverPos(9, 8, 4); + initBeaverPos(9, 8, kDirUnk4); endSceneInit(); playSequences(0xF7, 0x121, 0x122, 0x123); _s28_currClownSequenceId = 0x115; diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 98215d4728..302c031eba 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -86,13 +86,13 @@ void GnapEngine::scene29_run() { if (_prevSceneNum == 27) { initGnapPos(12, 7, kDirBottomRight); - initBeaverPos(12, 8, 0); + initBeaverPos(12, 8, kDirNone); endSceneInit(); gnapWalkTo(8, 7, -1, 0x107B9, 1); platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { initGnapPos(-1, 7, kDirBottomRight); - initBeaverPos(-2, 7, 0); + initBeaverPos(-2, 7, kDirNone); endSceneInit(); gnapWalkTo(2, 7, -1, 0x107B9, 1); platypusWalkTo(1, 7, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 9a641739b2..3e237fd46f 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -76,7 +76,7 @@ void GnapEngine::scene30_run() { _s30_kidSequenceId = 0x101; initGnapPos(7, 12, kDirBottomRight); - initBeaverPos(6, 12, 0); + initBeaverPos(6, 12, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index b39b61bcdb..97c07fc0bb 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -80,13 +80,13 @@ void GnapEngine::scene31_run() { if (_prevSceneNum == 27) { initGnapPos(-1, 8, kDirBottomLeft); - initBeaverPos(-1, 9, 4); + initBeaverPos(-1, 9, kDirUnk4); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107BA, 1); platypusWalkTo(3, 9, -1, 0x107D2, 1); } else { initGnapPos(7, 12, kDirBottomRight); - initBeaverPos(6, 12, 0); + initBeaverPos(6, 12, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107BA, 1); platypusWalkTo(6, 8, -1, 0x107D2, 1); diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index b91e1be7ad..5f91b3f0ab 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -73,13 +73,13 @@ void GnapEngine::scene32_run() { if (_prevSceneNum == 33) { initGnapPos(11, 6, kDirBottomLeft); - initBeaverPos(12, 6, 4); + initBeaverPos(12, 6, kDirUnk4); endSceneInit(); platypusWalkTo(9, 6, -1, 0x107D2, 1); gnapWalkTo(8, 6, -1, 0x107BA, 1); } else { initGnapPos(1, 6, kDirBottomRight); - initBeaverPos(1, 7, 0); + initBeaverPos(1, 7, kDirNone); endSceneInit(); } diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index ed56b68613..7e9823ee60 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -78,26 +78,26 @@ void GnapEngine::scene33_run() { switch (_prevSceneNum) { case 34: initGnapPos(11, 7, kDirBottomLeft); - initBeaverPos(12, 7, 4); + initBeaverPos(12, 7, kDirUnk4); endSceneInit(); gnapWalkTo(8, 7, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); break; case 37: initGnapPos(7, 7, kDirBottomRight); - initBeaverPos(8, 7, 0); + initBeaverPos(8, 7, kDirNone); endSceneInit(); break; case 32: initGnapPos(-1, 6, kDirBottomRight); - initBeaverPos(-1, 7, 0); + initBeaverPos(-1, 7, kDirNone); endSceneInit(); platypusWalkTo(2, 7, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); break; default: initGnapPos(3, 7, kDirBottomRight); - initBeaverPos(2, 7, 0); + initBeaverPos(2, 7, kDirNone); endSceneInit(); break; } diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index f5351fe2c5..c32a0b0eca 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -98,10 +98,10 @@ void GnapEngine::scene38_run() { if (_prevSceneNum == 39) { initGnapPos(3, 7, kDirBottomLeft); - initBeaverPos(4, 7, 4); + initBeaverPos(4, 7, kDirUnk4); } else { initGnapPos(3, 8, kDirBottomRight); - initBeaverPos(4, 8, 0); + initBeaverPos(4, 8, kDirNone); } endSceneInit(); diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index 94bdcb5a0e..2d3ac77a07 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -71,11 +71,11 @@ void GnapEngine::scene39_run() { _s39_nextGuySequenceId = -1; if (_prevSceneNum == 38) { initGnapPos(3, 7, kDirUpRight); - initBeaverPos(2, 7, 5); + initBeaverPos(2, 7, kDirUpLeft); endSceneInit(); } else { initGnapPos(4, 7, kDirBottomRight); - initBeaverPos(5, 7, 0); + initBeaverPos(5, 7, kDirNone); endSceneInit(); } diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index ab49458cb4..efaf1d9d73 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -139,23 +139,23 @@ void GnapEngine::scene41_run() { _gnapId = 140; _gameSys->insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - initBeaverPos(8, 10, 3); + initBeaverPos(8, 10, kDirBottomLeft); endSceneInit(); } else if (_prevSceneNum == 45) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-2, 8, 5); + initBeaverPos(-2, 8, kDirUpLeft); endSceneInit(); platypusWalkTo(1, 8, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_prevSceneNum == 42) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, 5); + initBeaverPos(11, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { initGnapPos(5, 8, kDirBottomRight); - initBeaverPos(6, 8, 3); + initBeaverPos(6, 8, kDirBottomLeft); endSceneInit(); } diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 4ebcec6650..3aaedc8dc0 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -126,19 +126,19 @@ void GnapEngine::scene42_run() { setGrabCursorSprite(-1); } else if (_prevSceneNum == 41) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 9, 5); + initBeaverPos(-1, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); } else if (_prevSceneNum == 43) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, 5); + initBeaverPos(11, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, 5); + initBeaverPos(6, 11, kDirUpLeft); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 2484a62227..b4fe5bb751 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -114,27 +114,27 @@ void GnapEngine::scene43_run() { switch (_prevSceneNum) { case 42: initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 9, 5); + initBeaverPos(-1, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 44: initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, 5); + initBeaverPos(11, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); break; case 54: initGnapPos(4, 7, kDirBottomLeft); - initBeaverPos(11, 8, 5); + initBeaverPos(11, 8, kDirUpLeft); endSceneInit(); platypusWalkTo(9, 8, -1, 0x107D2, 1); break; default: initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, 5); + initBeaverPos(6, 11, kDirUpLeft); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index af961ad469..f6644313c8 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -128,14 +128,14 @@ void GnapEngine::scene44_run() { switch (_prevSceneNum) { case 43: initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 7, 5); + initBeaverPos(-1, 7, kDirUpLeft); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 46: initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 8, 5); + initBeaverPos(11, 8, kDirUpLeft); endSceneInit(); gnapWalkTo(6, 8, -1, 0x107BA, 1); platypusWalkTo(7, 8, -1, 0x107D2, 1); @@ -143,14 +143,14 @@ void GnapEngine::scene44_run() { case 50: initGnapPos(4, 8, kDirBottomRight); if (_sceneSavegameLoaded) { - initBeaverPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 4); + initBeaverPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, kDirUnk4); } else if (!isFlag(13)) { _timers[0] = 50; _timers[1] = 20; _platX = 5; _platY = 8; _beaverSequenceId = 0xFD; - _beaverFacing = 0; + _beaverFacing = kDirNone; _beaverId = 160; _beaverSequenceDatNum = 0; _gameSys->insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); @@ -159,7 +159,7 @@ void GnapEngine::scene44_run() { break; default: initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, 5); + initBeaverPos(6, 11, kDirUpLeft); endSceneInit(); platypusWalkTo(6, 8, -1, 0x107C2, 1); gnapWalkTo(5, 8, -1, 0x107BA, 1); @@ -472,7 +472,7 @@ void GnapEngine::scene44_updateAnimations() { if (_gameSys->getAnimationStatus(2) == 2) { if (_s44_nextKissingLadySequenceId == 0xF6) { _gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - initBeaverPos(5, 8, 0); + initBeaverPos(5, 8, kDirNone); _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; _s44_nextKissingLadySequenceId = -1; _gameSys->setAnimation(0, 0, 2); diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 1ae51bc220..36943623d2 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -116,23 +116,23 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(0x9E, 1, 0); _gnapActionStatus = 1; _gameSys->insertSequence(_gnapSequenceId, _gnapId, 0, 0, kSeqNone, 0, 0, 0); - initBeaverPos(4, 8, 0); + initBeaverPos(4, 8, kDirNone); endSceneInit(); } else if (_prevSceneNum == 46) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 9, 5); + initBeaverPos(-1, 9, kDirUpLeft); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107C2, 1); gnapWalkTo(2, 7, -1, 0x107B9, 1); } else if (_prevSceneNum == 41) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, 5); + initBeaverPos(11, 9, kDirUpLeft); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107D2, 1); gnapWalkTo(10, 9, -1, 0x107BA, 1); } else { initGnapPos(2, 11, kDirUpRight); - initBeaverPos(6, 11, 5); + initBeaverPos(6, 11, kDirUpLeft); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107C2, 1); gnapWalkTo(2, 7, -1, 0x107B9, 1); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 37a000584c..f7fdc87efd 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -102,19 +102,19 @@ void GnapEngine::scene46_run() { endSceneInit(); } else if (_prevSceneNum == 44) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 8, 5); + initBeaverPos(-1, 8, kDirUpLeft); endSceneInit(); platypusWalkTo(1, 8, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_prevSceneNum == 45) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(12, 8, 5); + initBeaverPos(12, 8, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, 5); + initBeaverPos(6, 11, kDirUpLeft); endSceneInit(); platypusWalkTo(5, 8, -1, 0x107C2, 1); gnapWalkTo(6, 8, -1, 0x107BA, 1); -- cgit v1.2.3 From 16051780e01f584b1e5f06c541586dba9a3665fd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 1 Apr 2016 07:55:10 +0200 Subject: GNAP: Some more enum changes --- engines/gnap/gnap.cpp | 6 +++--- engines/gnap/grid.cpp | 2 +- engines/gnap/scenes/scene07.cpp | 2 +- engines/gnap/scenes/scene38.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index dc677a1889..2717a7b7fc 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1751,7 +1751,7 @@ void GnapEngine::gnapInitBrainPulseRndValue() { void GnapEngine::gnapUseDeviceOnBeaver() { playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _platX, _platY))); - if (_beaverFacing != 0) { + if (_beaverFacing != kDirNone) { _gameSys->insertSequence(makeRid(1, 0x7D5), _beaverId, makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); @@ -1930,7 +1930,7 @@ void GnapEngine::updateBeaverIdleSequence() { if (_timers[1] == 0) { _timers[1] = getRandom(20) + 30; int rnd = getRandom(10); - if (_beaverFacing != 0) { + if (_beaverFacing != kDirNone) { if (rnd != 0 || _beaverSequenceId != 0x7CA) { if (rnd != 1 || _beaverSequenceId != 0x7CA) playBeaverSequence(0x107CA); @@ -1967,7 +1967,7 @@ void GnapEngine::beaverSub426234() { if (_timers[0]) { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; - if (_beaverFacing != 0) { + if (_beaverFacing != kDirNone) { if (getRandom(10) >= 2 || _beaverSequenceId != 0x7CA) playBeaverSequence(0x107CA); else diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index bfe0a0f89d..3fce6eec99 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -1335,7 +1335,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _beaverSequenceId = 0x7D2; _beaverFacing = kDirUnk4; } - } else if (_beaverFacing > 0) { + } else if (_beaverFacing != kDirNone) { _beaverSequenceId = 0x7D2; } else { _beaverSequenceId = 0x7C2; diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index b6b5b91a44..671ad9c9c6 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -203,7 +203,7 @@ void GnapEngine::scene07_run() { _timers[1] = getRandom(20) + 30; int _gnapRandomValue = getRandom(20); // TODO Cleanup - if (_beaverFacing != 0) { + if (_beaverFacing != kDirNone) { if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7CA) { if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7CA) { if (_platY == 9) diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index c32a0b0eca..eab5670cb3 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -332,7 +332,7 @@ void GnapEngine::scene38_updateAnimations() { _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x9F, _gnapId, 0); _gnapActionStatus = kASHoldingHuntingTrophy; - if (_beaverFacing) + if (_beaverFacing != kDirNone) playBeaverSequence(0x107D5); else playBeaverSequence(0x107D4); -- cgit v1.2.3 From cd29ffb1c6540cbe6db15337c635928bf3a09c34 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 1 Apr 2016 22:17:41 +0200 Subject: GNAP: Use constants for some more flag values --- engines/gnap/gnap.cpp | 6 ++---- engines/gnap/grid.cpp | 37 ++++++++++++------------------------- engines/gnap/scenes/scene13.cpp | 3 +-- engines/gnap/scenes/scene17.cpp | 3 +-- engines/gnap/scenes/scene18.cpp | 12 ++++-------- 5 files changed, 20 insertions(+), 41 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 2717a7b7fc..95376fdf2b 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1569,10 +1569,9 @@ void GnapEngine::playGnapSequence(int sequenceId) { _timers[2] = getRandom(30) + 20; _timers[3] = 300; gnapIdle(); - // CHECKME: Check the value of the flag _gameSys->insertSequence(sequenceId, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 9, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = ridToEntryIndex(sequenceId); _gnapSequenceDatNum = ridToDatIndex(sequenceId); } @@ -1916,10 +1915,9 @@ int GnapEngine::getBeaverSequenceId(int kind, int gridX, int gridY) { } void GnapEngine::playBeaverSequence(int sequenceId) { - // CHECKME: Check the value of the flag _gameSys->insertSequence(sequenceId, _beaverId, makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, - 9, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _beaverSequenceId = ridToEntryIndex(sequenceId); _beaverSequenceDatNum = ridToDatIndex(sequenceId); } diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 3fce6eec99..20f33563dd 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -581,33 +581,29 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapWalkNodes[index].id = index + 20 * _gnapWalkNodes[index].gridY1; if (_gnapWalkNodes[index].deltaX == 1 && _gnapWalkNodes[index].deltaY == 0) { if (index % 2) { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7AB), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); _gnapWalkNodes[index].sequenceId = 0x7AB; gnapSequenceId = 0x7AB; } else { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7AC), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); _gnapWalkNodes[index].sequenceId = 0x7AC; gnapSequenceId = 0x7AC; } } else if (_gnapWalkNodes[index].deltaX == -1 && _gnapWalkNodes[index].deltaY == 0) { if (index % 2) { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7AF), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); _gnapWalkNodes[index].sequenceId = 0x7AF; gnapSequenceId = 0x7AF; } else { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7B0), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); _gnapWalkNodes[index].sequenceId = 0x7B0; gnapSequenceId = 0x7B0; } @@ -617,10 +613,9 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen else _gnapWalkNodes[index].id += 10; int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index].deltaX, _gnapWalkNodes[index].deltaY); - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index].id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - 9, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); _gnapWalkNodes[index].sequenceId = newSequenceId; gnapSequenceId = newSequenceId; } @@ -699,17 +694,14 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } if (flags & 4) { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - 9, 0, 0, 0); + kSeqScale | kSeqSyncWait, 0, 0, 0); } else { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - 9, 0, 75 * _gnapWalkDestX - _gnapGridX, 48 * _gnapWalkDestY - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkDestX - _gnapGridX, 48 * _gnapWalkDestY - _gnapGridY); } - } _gnapX = _gnapWalkDestX; @@ -1241,33 +1233,29 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platWalkNodes[index].id = index + 20 * _platWalkNodes[index].gridY1; if (_platWalkNodes[index].deltaX == 1 && _platWalkNodes[index].deltaY == 0) { if (index % 2) { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7CD), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); _platWalkNodes[index].sequenceId = 0x7CD; platSequenceId = 0x7CD; } else { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7CE), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); _platWalkNodes[index].sequenceId = 0x7CE; platSequenceId = 0x7CE; } } else if (_platWalkNodes[index].deltaX == -1 && _platWalkNodes[index].deltaY == 0) { if (index % 2) { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7CF), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); _platWalkNodes[index].sequenceId = 0x7CF; platSequenceId = 0x7CF; } else { - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, 0x7D0), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); _platWalkNodes[index].sequenceId = 0x7D0; platSequenceId = 0x7D0; } @@ -1277,10 +1265,9 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se else _platWalkNodes[index].id += 10; int newSequenceId = getBeaverWalkSequenceId(_platWalkNodes[index].deltaX, _platWalkNodes[index].deltaY); - // CHECKME: check the value of the flag _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index].id, makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); _platWalkNodes[index].sequenceId = newSequenceId; platSequenceId = newSequenceId; } diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 66e78e8f5b..a892b84a6d 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -184,10 +184,9 @@ void GnapEngine::scene13_run() { if (_gnapX == 5 && _gnapY == 5) { _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); _gameSys->setAnimation(_s13_backToiletCtr + 0xA3, _gnapId, 0); - // CHECKME: Check the value of the flag _gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - 9, 0, 0, 0); + kSeqScale | kSeqSyncWait, 0, 0, 0); _gnapActionStatus = kASWait; _gnapSequenceId = _s13_backToiletCtr + 0xA3; _gnapIdleFacing = kDirUpRight; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index fdfd1fba0f..ec580b971f 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -265,9 +265,8 @@ void GnapEngine::scene17_run() { _platY = 8; _beaverId = 160; _gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - // CHECKME: Check the value of the flag _gameSys->insertSequence(0x107C1, _beaverId, 0x241, _beaverId, - 9, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); endSceneInit(); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index a7883263a5..b76e43072d 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -219,10 +219,9 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, if (animationIndex >= 0) _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); - // CHECKME: Check the value of the flag _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, - 9, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapX = gnapGridX; @@ -844,8 +843,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); _gameSys->removeSequence(0x20C, 19, true); _gameSys->setAnimation(0x217, 39, 5); - // CHECKME: check the value of the flag - _gameSys->insertSequence(0x217, 39, 0x216, 39, 10, 0, 0, 0); + _gameSys->insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); playSound(0x22B, true); @@ -947,8 +945,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->requestRemoveSequence(0x1F9, 19); _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x213, 39, 5); - // CHECKME: check the value of the flag - _gameSys->insertSequence(0x214, 39, 0x213, 39, 10, 0, 0, 0); + _gameSys->insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); playSound(555, true); @@ -964,8 +961,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x211, 39, 5); - // CHECKME: check the value of the flag - _gameSys->insertSequence(0x212, 39, 0x211, 39, 10, 0, 0, 0); + _gameSys->insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); playSound(0x22B, true); -- cgit v1.2.3 From 9d0caa4bdbf993dfde211c9a8c5c56c34809ae41 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Apr 2016 16:24:19 +0200 Subject: GNAP: fix use of _sceneDone --- engines/gnap/scenes/scene14.cpp | 1 - engines/gnap/scenes/scene53.cpp | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp index 893b850221..1e22c84b57 100644 --- a/engines/gnap/scenes/scene14.cpp +++ b/engines/gnap/scenes/scene14.cpp @@ -52,7 +52,6 @@ void GnapEngine::scene14_updateHotspots() { } void GnapEngine::scene14_run() { - _largeSprite = nullptr; queueInsertDeviceIcon(); diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index 76dc6d716a..daa39b5424 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -138,7 +138,7 @@ void GnapEngine::scene53_runRandomCall() { void GnapEngine::scene53_runChitChatLine() { bool flag = false; - int sequenceId; + int sequenceId = -1; _gameSys->setAnimation(0x6E, 1, 6); _gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); @@ -189,7 +189,7 @@ void GnapEngine::scene53_runChitChatLine() { sequenceId = -1; flag = 1; _isLeavingScene = true; - _sceneDone = 1; + _sceneDone = true; _gnapActionStatus = 0; _newSceneNum = 17; break; @@ -320,18 +320,18 @@ void GnapEngine::scene53_run() { scene53_runChitChatLine(); phoneNumber = 0; phoneNumberLen = 0; - _sceneDone = 1; + _sceneDone = true; _newSceneNum = 17; } else if (phoneNumber != 5556789 || isFlag(20)) { scene53_runRandomCall(); phoneNumber = 0; phoneNumberLen = 0; - _sceneDone = 1; + _sceneDone = true; _newSceneNum = 17; } else { phoneNumber = 0; phoneNumberLen = 0; - _sceneDone = 1; + _sceneDone = true; _newSceneNum = 17; if (_s53_isGnapPhoning) setFlag(25); @@ -359,7 +359,7 @@ void GnapEngine::scene53_run() { _gnapActionStatus = -1; } _isLeavingScene = true; - _sceneDone = 1; + _sceneDone = true; _gnapActionStatus = 0; _newSceneNum = 17; } -- cgit v1.2.3 From 66f5610c74710a298ae6a4166b37f438d25882bd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 3 Apr 2016 17:29:06 +0200 Subject: GNAP: Implement intro, currently disabled. Remove some Debug code. --- engines/gnap/gnap.cpp | 20 ++--- engines/gnap/gnap.h | 1 + engines/gnap/module.mk | 1 + engines/gnap/scenes/scene00.cpp | 174 ++++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/scene01.cpp | 1 - engines/gnap/scenes/scenecore.cpp | 4 - 6 files changed, 184 insertions(+), 17 deletions(-) create mode 100644 engines/gnap/scenes/scene00.cpp diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 95376fdf2b..ce9e680ee3 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -700,14 +700,16 @@ void GnapEngine::initGameFlags(int num) { } //DEBUG! +#if 0 // setFlag(0); // Enable platypus setFlag(25); invClear(); invAdd(kItemMagazine); +#endif #if 0 invAdd(kItemDisguise); #endif -#if 1 +#if 0 //invAdd(kItemGas); invAdd(kItemJoint); //invAdd(kItemKeys); @@ -741,14 +743,14 @@ void GnapEngine::mainLoop() { invClear(); clearFlags(); _grabCursorSpriteIndex = -1; - _grabCursorSprite = 0; + _grabCursorSprite = nullptr; debug("MainLoop #1"); // > DEBUG BEGIN - _currentSceneNum = 53; - _newSceneNum = 48; - _newCursorValue = 3; + _currentSceneNum = 0; + _newSceneNum = 1; + _newCursorValue = 1; // < DEBUG END loadStockDat(); @@ -890,7 +892,7 @@ void GnapEngine::checkGameKeys() { updatePause(); } // TODO? Debug input - debug("facing %d", _gnapIdleFacing); +// debug("facing %d", _gnapIdleFacing); } void GnapEngine::startSoundTimerA(int timerIndex) { @@ -2172,12 +2174,6 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ _gnapSequenceId = sequenceId3; } -// Scene 0 - -int GnapEngine::scene00_init() { - return 0x37C; -} - void GnapEngine::toyUfoSetStatus(int flagNum) { clearFlag(16); clearFlag(17); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index b96d27d4a1..4948c29988 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -550,6 +550,7 @@ public: // Scene 0 int scene00_init(); + void scene00_run(); // Scene 1 int _s01_pigsIdCtr, _s01_smokeIdCtr; diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 78e2cce736..7a3fc3a9a0 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -9,6 +9,7 @@ MODULE_OBJS := \ menu.o \ resource.o \ sound.o \ + scenes/scene00.o \ scenes/scene01.o \ scenes/scene02.o \ scenes/scene03.o \ diff --git a/engines/gnap/scenes/scene00.cpp b/engines/gnap/scenes/scene00.cpp new file mode 100644 index 0000000000..c53f58c99a --- /dev/null +++ b/engines/gnap/scenes/scene00.cpp @@ -0,0 +1,174 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "video/avi_decoder.h" + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" + +namespace Gnap { + +int GnapEngine::scene00_init() { + return 0x37C; +} + +void GnapEngine::scene00_run() { + const int animIdArr[] = { + 0x356, 0x357, 0x358, 0x35A, 0x35F, + 0x360, 0x361, 0x362, 0x363, 0x364, + 0x365, 0x368, 0x369, 0x36B, 0x378, + 0x36C, 0x36D, 0x36E, 0x36F, 0x370, + 0x371, 0x372, 0x373, 0x374, 0x375, + 0x376, 0x377, 0x378, 0x379, 0x37A, + 0x37B, 0}; + + const int backgroundIdArr[] = { + 0x354, 0x355, 0, 1, 3, + 4, 5, 6, 7, 8, + 7, 9, 0xA, 0xB, 0xC, + 0xD, 0xE, 0xF, 0x10, 0x11, + 0x12, 0x13, 0x17, 0x14, 0x19, + 0x1A, 0x14, 0x15, 0x16, 0x14, + 0x19, 0}; + + int index = 0; + bool skip = false; + hideCursor(); + _dat->open(1, "musop_n.dat"); + + Video::VideoDecoder *videoDecoder = new Video::AVIDecoder(); + if (!videoDecoder->loadFile("hoffman.avi")) { + delete videoDecoder; + warning("Unable to open video 'hoffman.avi' - Skipping intro"); + return; + } + videoDecoder->start(); + + int vidPosX = (800 - videoDecoder->getWidth()) / 2; + int vidPosY = (600 - videoDecoder->getHeight()) / 2; + bool skipVideo = false; + + screenEffect(1, 255, 255, 255); + + while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { + if (videoDecoder->needsUpdate()) { + const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + if (frame) { + if (frame->format.bytesPerPixel == 1) { + _system->copyRectToScreen(frame->getPixels(), frame->pitch, vidPosX, vidPosY, frame->w, frame->h); + } else if (frame->format.bytesPerPixel != 4) { + Graphics::Surface *frame1 = frame->convertTo(_system->getScreenFormat()); + _system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); + frame1->free(); + delete frame1; + } else { + // The intro AVI is played upside down, it's the only video played in the English version + for (uint16 y = 0; y < frame->h / 2; y++) { + uint32 *ptrFrom = (uint32*)frame->getBasePtr(0, y); + uint32 *ptrTo = (uint32*)frame->getBasePtr(0, frame->h - y - 1); + for (uint16 x = 0; x < frame->w; x++) { + uint32 t = *ptrFrom; + *ptrFrom = *ptrTo; + *ptrTo = t; + ptrFrom++; + ptrTo++; + } + } + + Graphics::Surface *frame1 = frame->convertTo(_system->getScreenFormat()); + _system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); + frame1->free(); + delete frame1; + } + _system->updateScreen(); + } + } + + Common::Event event; + while (g_system->getEventManager()->pollEvent(event)) { + if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || + event.type == Common::EVENT_LBUTTONUP) + skipVideo = true; + } + + _system->delayMillis(10); + } + + delete videoDecoder; + + _gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); + _gameSys->insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); + _gameSys->setAnimation(0x356, 2, 0); + + while (!_sceneDone) { + gameUpdateTick(); + + if (_gameSys->getAnimationStatus(0) == 2 || skip ) { + skip = false; + _gameSys->requestClear2(false); + _gameSys->requestClear1(); + if ( index == 11 || index == 1 ) + screenEffect(0, 0, 0, 0); + + _gameSys->setAnimation(0, 0, 0); + if (++index >= 31) + _sceneDone = true; + else { + _gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); + if (index == 2) { + playSound(0x10000, 0); + _gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); + } else if (index == 3) + _gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); + else if (index == 12) + _gameSys->insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); + + _gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); + _gameSys->setAnimation(animIdArr[index], 2, 0); + + if (index == 11) + stopSound(0x10000); + } + } + + if (isKeyStatus1(Common::KEYCODE_ESCAPE) || isKeyStatus1(Common::KEYCODE_SPACE) || isKeyStatus1(29)) { + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(Common::KEYCODE_SPACE); + clearKeyStatus1(29); + if (index == 0) { + skip = true; + stopSound(0x3CF); + } else if (index == 1) + skip = true; + else + _sceneDone = true; + } + } + + stopSound(0x10000); + + _newSceneNum = 1; + _newCursorValue = 1; +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 0e90e0bd5a..1d4bfee7be 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -81,7 +81,6 @@ void GnapEngine::scene01_updateHotspots() { } void GnapEngine::scene01_run() { - // NOTE Removed _s01_dword_474380 which was set when the mud was taken // which is also set in the global game flags. diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 2736addb31..0825937fff 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -31,12 +31,10 @@ int GnapEngine::initSceneLogic() { int backgroundId = -1; switch (_currentSceneNum) { -#if 0 // TODO case 0: backgroundId = scene00_init(); _gameSys->setScaleValues(0, 500, 1, 1000); break; -#endif case 1: backgroundId = scene01_init(); scene01_updateHotspots(); @@ -347,12 +345,10 @@ int GnapEngine::initSceneLogic() { void GnapEngine::runSceneLogic() { switch (_currentSceneNum) { case 0: -#if 0 // TODO scene00_run(); if (_newSceneNum == 55) _newSceneNum = 8; break; -#endif case 1: scene01_run(); if (_newSceneNum == 55) -- cgit v1.2.3 From f1738f457f5b3a3c67612f3aa77bf8a1c9a4b129 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Apr 2016 00:27:59 +0200 Subject: GNAP: Add savegames (not fully working yet) --- engines/gnap/detection.cpp | 59 +++--- engines/gnap/gamesys.cpp | 12 ++ engines/gnap/gamesys.h | 1 + engines/gnap/gnap.h | 18 ++ engines/gnap/menu.cpp | 473 +++++++++++++++++++++++++++++---------------- 5 files changed, 360 insertions(+), 203 deletions(-) diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index ecd07a6103..7e4c085503 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -76,11 +76,10 @@ public: bool GnapMetaEngine::hasFeature(MetaEngineFeature f) const { return - false; + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave); #if 0 - (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate); @@ -97,49 +96,39 @@ int GnapMetaEngine::getMaximumSaveSlot() const { return 99; } SaveStateList GnapMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringArray filenames; - Common::String pattern = target; - pattern += ".???"; + Common::String saveDesc; + Common::String pattern = Common::String::format("%s.0##", target); + Gnap::GnapSavegameHeader header; filenames = saveFileMan->listSavefiles(pattern); - sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) SaveStateList saveList; -#if 0 - int slotNum = 0; - for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - slotNum = atoi(filename->c_str() + filename->size() - 3); - - if (slotNum >= 0 && slotNum <= 99) { - Common::InSaveFile *file = saveFileMan->openForLoading(*filename); - if (file) { - int32 version = file->readSint32BE(); - if (version != GNAP_SAVEGAME_VERSION) { - delete file; - continue; - } + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + const char *ext = strrchr(file->c_str(), '.'); + int slot = ext ? atoi(ext + 1) : -1; - // read name - uint16 nameSize = file->readUint16BE(); - if (nameSize >= 255) { - delete file; - continue; - } - char name[256]; - file->read(name, nameSize); - name[nameSize] = 0; + if (slot >= 0 && slot < getMaximumSaveSlot()) { + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); - saveList.push_back(SaveStateDescriptor(slotNum, name)); - delete file; + if (in) { + Gnap::GnapEngine::readSavegameHeader(in, header); + saveList.push_back(SaveStateDescriptor(slot, header._saveName)); + + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + delete in; } } } -#endif + + // Sort saves based on slot number. + Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator()); return saveList; } SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int slot) const { -#if 0 Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); if (file) { @@ -177,7 +166,7 @@ SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int s delete file; return desc; } -#endif + return SaveStateDescriptor(); } diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 6bdeb81f24..fd53005d27 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -300,6 +300,18 @@ void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r } +int GameSys::getTextHeight(const char *text) { + byte height = 0; + for (const char *cp = text; *cp != 0; ++cp) { + byte c = *cp; + if (c < 32 || c > 127) + c = (byte)'_'; + c -= 32; + height = MAX(height, _dejaVuSans9ptCharDescriptors[c]._width); + } + return height; +} + int GameSys::getTextWidth(const char *text) { int width = 0; for (const char *cp = text; *cp != 0; ++cp) { diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index fc137eb65c..a011a616f5 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -119,6 +119,7 @@ public: Graphics::Surface *createSurface(int resourceId); void drawSpriteToSurface(Graphics::Surface *surface, int x, int y, int resourceId); void drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r, byte g, byte b, const char *text); + int getTextHeight(const char *text); int getTextWidth(const char *text); void fillSurface(Graphics::Surface *surface, int x, int y, int width, int height, byte r, byte g, byte b); void setAnimation(int sequenceId, int id, int animationIndex); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 4948c29988..fa33d42dad 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -28,6 +28,8 @@ #include "common/file.h" #include "common/memstream.h" #include "common/random.h" +#include "common/savefile.h" +#include "common/serializer.h" #include "common/str.h" #include "common/substream.h" #include "common/system.h" @@ -49,6 +51,8 @@ class SpriteResource; class GameSys; class SoundMan; +#define GNAP_SAVEGAME_VERSION 1 + struct MouseButtonState { bool _left; bool _right; @@ -244,6 +248,14 @@ enum Facing { kDirUpRight = 7 }; +struct GnapSavegameHeader { + uint8 _version; + Common::String _saveName; + Graphics::Surface *_thumbnail; + int _year, _month, _day; + int _hour, _minute; +}; + class GnapEngine : public Engine { protected: Common::Error run(); @@ -334,6 +346,12 @@ public: int readSavegameDescription(int savegameNum, Common::String &description); int loadSavegame(int savegameNum); + Common::Error saveGameState(int slot, const Common::String &desc); + Common::Error loadGameState(int slot); + Common::String generateSaveName(int slot); + void synchronize(Common::Serializer &s); + void writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeader &header); + static bool readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &header); void delayTicks(int a1); void delayTicksCursor(int a1); diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 1f0fbea88d..df8551e0e6 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -20,6 +20,12 @@ * */ +#include "common/config-manager.h" +#include "common/savefile.h" +#include "common/translation.h" + +#include "gui/saveload.h" + #include "gnap/gnap.h" #include "gnap/datarchive.h" #include "gnap/gamesys.h" @@ -452,6 +458,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (_sceneClickedHotspot != 1 && _sceneClickedHotspot != 0) { if (_sceneClickedHotspot != 2 && _hotspotsCount - 1 != _sceneClickedHotspot) { if (_sceneClickedHotspot == 3) { + // Quit _timers[2] = 10; playSound(0x108F4, 0); _gameSys->removeSpriteDrawItem(_menuSprite1, 262); @@ -461,13 +468,13 @@ void GnapEngine::updateMenuStatusMainMenu() { _menuQuitQuerySprite = _gameSys->createSurface(0x104FC); _gameSys->insertSpriteDrawItem(_menuQuitQuerySprite, 254, 93, 262); } else if (_sceneClickedHotspot == 4) { + // Pause ? playSound(0x108F4, 0); Common::Rect dirtyRect(0, 0, 799, 599); hideCursor(); _largeSprite = _gameSys->allocSurface(800, 600); for (int i = 0; i < 3; ++i) { - _timers[2] = 10; if (i == 0) { @@ -502,6 +509,7 @@ void GnapEngine::updateMenuStatusMainMenu() { deleteSurface(&_largeSprite); showCursor(); } else if (_hotspotsCount - 3 == _sceneClickedHotspot) { + // Button _timers[2] = 10; playSound(0x108F4, 0); initMenuHotspots1(); @@ -517,20 +525,51 @@ void GnapEngine::updateMenuStatusMainMenu() { _gameSys->insertDirtyRect(dirtyRect); } } else { + // Resume playSound(0x108F5, 0); _menuDone = true; } } else { + // Save / Load + _timers[2] = 10; + playSound(0x108F4, 0); + + if (_sceneClickedHotspot == 1) { + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + int16 savegameId = dialog->runModalWithCurrentTarget(); + Common::String savegameDescription = dialog->getResultString(); + delete dialog; + + if (savegameId != -1) { + saveGameState(savegameId, savegameDescription); + } + } else { + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + int16 savegameId = dialog->runModalWithCurrentTarget(); + delete dialog; + + if (savegameId != -1) { + loadGameState(savegameId); + _wasSavegameLoaded = true; + _menuDone = true; + } + } + } + +#if 0 +// Original Code _timers[2] = 10; playSound(0x108F4, 0); _gameSys->removeSpriteDrawItem(_menuSprite1, 262); if (_menuSaveLoadSprite) deleteSurface(&_menuSaveLoadSprite); if (_sceneClickedHotspot == 1) { + // Save _menuStatus = 2; initSaveLoadHotspots(); _menuSaveLoadSprite = _gameSys->createSurface(0x104FB); } else { + // Load _menuStatus = 3; initSaveLoadHotspots(); _menuSaveLoadSprite = _gameSys->createSurface(0x104FA); @@ -550,180 +589,278 @@ void GnapEngine::updateMenuStatusMainMenu() { } _savegameIndex = -1; } +#endif +} + +Common::Error GnapEngine::saveGameState(int slot, const Common::String &desc) { + Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving( + generateSaveName(slot)); + if (!out) + return Common::kCreatingFileFailed; + + GnapSavegameHeader header; + header._saveName = desc; + writeSavegameHeader(out, header); + + Common::Serializer s(nullptr, out); + synchronize(s); + + out->finalize(); + delete out; + + return Common::kNoError; +} + +void GnapEngine::synchronize(Common::Serializer &s) { + s.syncAsSint32LE(_newSceneNum); + s.syncAsSint32LE(_currentSceneNum); + s.syncAsSint32LE(_newCursorValue); + s.syncAsUint32LE(_inventory); + s.syncAsUint32LE(_gameFlags); + + if (s.isLoading() && isFlag(24)) { + _timers[9] = 600; + } +} + +const char *const SAVEGAME_STR = "GNAP"; +#define SAVEGAME_STR_SIZE 4 +void GnapEngine::writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeader &header) { + // Write out a savegame header + out->write(SAVEGAME_STR, SAVEGAME_STR_SIZE + 1); + + out->writeByte(GNAP_SAVEGAME_VERSION); + + // Write savegame name + out->writeString(header._saveName); + out->writeByte('\0'); + + // TODO: Add thumbnail + + // Write out the save date/time + TimeDate td; + g_system->getTimeAndDate(td); + out->writeSint16LE(td.tm_year + 1900); + out->writeSint16LE(td.tm_mon + 1); + out->writeSint16LE(td.tm_mday); + out->writeSint16LE(td.tm_hour); + out->writeSint16LE(td.tm_min); +} + +bool GnapEngine::readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &header) { + char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; + header._thumbnail = nullptr; + + // Validate the header Id + in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); + if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE)) + return false; + + header._version = in->readByte(); + if (header._version > GNAP_SAVEGAME_VERSION) + return false; + + // Read in the string + header._saveName.clear(); + char ch; + while ((ch = (char)in->readByte()) != '\0') + header._saveName += ch; + + // TODO: Get the thumbnail + header._thumbnail = nullptr; + + // Read in save date/time + header._year = in->readSint16LE(); + header._month = in->readSint16LE(); + header._day = in->readSint16LE(); + header._hour = in->readSint16LE(); + header._minute = in->readSint16LE(); + + return true; +} + +Common::Error GnapEngine::loadGameState(int slot) { + Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( + generateSaveName(slot)); + if (!saveFile) + return Common::kReadingFailed; + + Common::Serializer s(saveFile, nullptr); + + // Load the savegame header + GnapSavegameHeader header; + if (!readSavegameHeader(saveFile, header)) + error("Invalid savegame"); + + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + + synchronize(s); + delete saveFile; + + return Common::kNoError; +} + +Common::String GnapEngine::generateSaveName(int slot) { + return Common::String::format("%s.%03d", _targetName.c_str(), slot); } void GnapEngine::updateMenuStatusSaveGame() { -#if 0 // TODO - _hotspots[0].x1 = 288; - _hotspots[0].y1 = 74; - _hotspots[0].x2 = 379; - _hotspots[0].y2 = 96; +#if 1 // TODO + char v43[30]; + int v46; + v43[0] = '\0'; + _hotspots[0]._x1 = 288; + _hotspots[0]._y1 = 74; + _hotspots[0]._x2 = 379; + _hotspots[0]._y2 = 96; _sceneClickedHotspot = -1; + if (!_timers[2]) - _sceneClickedHotspot = getClickedHotspotId(); - if (_hotspotsCount - 3 == _sceneClickedHotspot) - { - _timers[2] = 10; - playSound(0x108F4, 0); - _menuStatus = 1; - writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1); - } - else if (_hotspotsCount - 4 == _sceneClickedHotspot) - { - _timers[2] = 10; - playSound(0x108F5, 0); - _menuStatus = 1; - if (strcmp(&v43, &_savegameFilenames[30 * _savegameIndex]) && _savegameIndex != -1) - { - strcpy((char *)&_savegameFilenames[30 * _savegameIndex], &v43); - if (_savegameSprites[_savegameIndex] != -1) - { - _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); - delayTicksCursor(5); - memFreeHandle(_savegameSprites[_savegameIndex]); - } - v16 = getSpriteWidthById(0x104F9); - _savegameSprites[_savegameIndex] = allocSprite(v16, 40, 128, 0); - } - } - else if (_hotspotsCount - 5 == _sceneClickedHotspot) - { - _timers[2] = 10; - playSound(0x108F4, 0); - if ((signed int)_savegameIndex > -1) - writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1); - _menuStatus = 1; - } - else if (_hotspotsCount - 1 == _sceneClickedHotspot) - { - _menuDone = true; - } - else if (_sceneClickedHotspot != -1 && _hotspotsCount - 2 != _sceneClickedHotspot) - { - _timers[2] = 10; - playSound(0x108F4, 0); - v17 = strcmp(&v43, &_savegameFilenames[30 * _savegameIndex]); - if (!v17) - LOBYTE(v17) = 0; - if ((unsigned int8)v17 & (_savegameIndex < 0xFFFFFFFF)) - { - strcpy((char *)&_savegameFilenames[30 * _savegameIndex], &v43); - if (_savegameSprites[_savegameIndex] != -1) - { - _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); - delayTicksCursor(5); - memFreeHandle(_savegameSprites[_savegameIndex]); - } - v18 = getSpriteWidthById(0x104F9); - _savegameSprites[_savegameIndex] = allocSprite(v18, 40, 128, 0); - drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, &_savegameFilenames[30 * _savegameIndex]); - insertSpriteDrawItem(_savegameSprites[_savegameIndex], 288, _hotspots[_savegameIndex].y1, 263); - } - _savegameIndex = _sceneClickedHotspot; - v46 = strlen(&_savegameFilenames[30 * _sceneClickedHotspot]); - strcpy(&v43, &_savegameFilenames[30 * _sceneClickedHotspot]); - if (_cursorSprite == -1) - { - v19 = getTextHeight("_"); - v20 = getTextWidth("_"); - _cursorSprite = allocSprite(v20, v19, 128, 0); - drawTextToSurface(_cursorSprite, 0, 0, 255, 0, 0, "_"); - } - else - { - _gameSys->removeSpriteDrawItem(_cursorSprite, 264); - } - v21 = _hotspots[_savegameIndex].x2; - v22 = v21 - getTextWidth("_"); - if (v22 > getTextWidth(&_savegameFilenames[30 * _savegameIndex]) + 288) - { - v25 = getTextWidth(&_savegameFilenames[30 * _savegameIndex]) + 288; - insertSpriteDrawItem(_cursorSprite, v25, _hotspots[_savegameIndex].y1, 264); - } - else - { - v23 = _hotspots[_savegameIndex].x2; - v24 = v23 - getTextWidth("_"); - insertSpriteDrawItem(_cursorSprite, v24, _hotspots[_savegameIndex].y1, 264); - } - } - if ((signed int)_savegameIndex > -1 && keybChar) - { - if ((keybChar < 'A' || keybChar > 'Z') && (keybChar < '0' || keybChar > '9') && keybChar != ' ') - { - if (keybChar == 8) - { - if ((signed int)v46 > 0) - --v46; - *(&_savegameFilenames[30 * _savegameIndex] + v46) = 0; - if (_savegameSprites[_savegameIndex] != -1) - { - _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); - memFreeHandle(_savegameSprites[_savegameIndex]); - } - v32 = getSpriteWidthById(0x104F9); - _savegameSprites[_savegameIndex] = allocSprite(v32, 40, 128, 0); - drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, &_savegameFilenames[30 * _savegameIndex]); - insertSpriteDrawItem(_savegameSprites[_savegameIndex], 288, _hotspots[_savegameIndex].y1, 263); - _gameSys->removeSpriteDrawItem(_cursorSprite, 264); - v33 = _hotspots[_savegameIndex].y1; - v34 = getTextWidth(&_savegameFilenames[30 * _savegameIndex]); - insertSpriteDrawItem(_cursorSprite, LOWORD(_hotspots[_savegameIndex].x1) + v34, v33, 264); - } - else if (keybChar == 13) - { - _menuStatus = 1; - writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1); - } - } - else - { - *(&_savegameFilenames[30 * _savegameIndex] + v46) = keybChar; - if ((signed int)v46 < 28) - ++v46; - *(&_savegameFilenames[30 * _savegameIndex] + v46) = 0; - if (getTextWidth(&_savegameFilenames[30 * _savegameIndex]) > 91) - { - --v46; - *(&_savegameFilenames[30 * _savegameIndex] + v46) = 0; - } - drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, &_savegameFilenames[30 * _savegameIndex]); - v26 = getTextWidth(&_savegameFilenames[30 * _savegameIndex]); - rect.right = _hotspots[_savegameIndex].x1 + v26; - v27 = rect.right; - rect.left = v27 - 2 * getTextWidth("W"); - rect.top = _hotspots[_savegameIndex].y1; - rect.bottom = _hotspots[_savegameIndex].y2; - insertDirtyRect(&rect); - _gameSys->removeSpriteDrawItem(_cursorSprite, 264); - v28 = _hotspots[_savegameIndex].x2; - v29 = getTextWidth("_"); - if (v28 - v29 > rect.right) - { - insertSpriteDrawItem(_cursorSprite, SLOWORD(rect.right), SLOWORD(rect.top), 264); - } - else - { - v30 = _hotspots[_savegameIndex].x2; - v31 = v30 - getTextWidth("_"); - insertSpriteDrawItem(_cursorSprite, v31, SLOWORD(rect.top), 264); - } - clearKeyStatus1(8); - } + _sceneClickedHotspot = getClickedHotspotId(); + + if (_hotspotsCount - 3 == _sceneClickedHotspot) { + // Button + _timers[2] = 10; + playSound(0x108F4, 0); + _menuStatus = 1; + warning("writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1);"); + } else if (_hotspotsCount - 4 == _sceneClickedHotspot) { + // Cancel + _timers[2] = 10; + playSound(0x108F5, 0); + _menuStatus = 1; + if (strcmp(v43, _savegameFilenames[_savegameIndex]) && _savegameIndex != -1) { + strcpy(_savegameFilenames[_savegameIndex], v43); + if (_savegameSprites[_savegameIndex] != nullptr) { + _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); + delayTicksCursor(5); + warning("memFreeHandle(_savegameSprites[_savegameIndex]);"); + } + int v16 = _gameSys->getSpriteWidthById(0x104F9); + warning("_savegameSprites[_savegameIndex] = allocSprite(v16, 40, 128, 0);"); + } + } else if (_hotspotsCount - 5 == _sceneClickedHotspot) { + // OK + _timers[2] = 10; + playSound(0x108F4, 0); + if (_savegameIndex != -1) + warning("writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1);"); + _menuStatus = 1; + } else if (_hotspotsCount - 1 == _sceneClickedHotspot) { + // in background + _menuDone = true; + } else if (_sceneClickedHotspot != -1 && _hotspotsCount - 2 != _sceneClickedHotspot) { + // Savegame name + _timers[2] = 10; + playSound(0x108F4, 0); + if (strcmp(v43, _savegameFilenames[_savegameIndex]) & (_savegameIndex != -1)) { + strcpy(_savegameFilenames[_savegameIndex], v43); + if (_savegameSprites[_savegameIndex] != nullptr) { + _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); + delayTicksCursor(5); + warning("memFreeHandle(_savegameSprites[_savegameIndex]);"); + } + int v18 = _gameSys->getSpriteWidthById(0x104F9); + _savegameSprites[_savegameIndex] = _gameSys->allocSurface(v18, 40); + _gameSys->drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, _savegameFilenames[_savegameIndex]); + _gameSys->insertSpriteDrawItem(_savegameSprites[_savegameIndex], 288, _hotspots[_savegameIndex]._y1, 263); + } + _savegameIndex = _sceneClickedHotspot; + v46 = strlen(_savegameFilenames[_sceneClickedHotspot]); + strcpy(v43, _savegameFilenames[_sceneClickedHotspot]); + if (_cursorSprite == nullptr) { + int v19 = _gameSys->getTextHeight("_"); + int v20 = _gameSys->getTextWidth("_"); + _cursorSprite = _gameSys->allocSurface(v20, v19); + _gameSys->drawTextToSurface(_cursorSprite, 0, 0, 255, 0, 0, "_"); + } else { + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + } + int v21 = _hotspots[_savegameIndex]._x2; + int v22 = v21 - _gameSys->getTextWidth("_"); + if (v22 > _gameSys->getTextWidth(_savegameFilenames[_savegameIndex]) + 288) { + int v25 = _gameSys->getTextWidth(_savegameFilenames[_savegameIndex]) + 288; + _gameSys->insertSpriteDrawItem(_cursorSprite, v25, _hotspots[_savegameIndex]._y1, 264); + } else { + int v23 = _hotspots[_savegameIndex]._x2; + int v24 = v23 - _gameSys->getTextWidth("_"); + _gameSys->insertSpriteDrawItem(_cursorSprite, v24, _hotspots[_savegameIndex]._y1, 264); + } } - keybChar = 0; - if (_menuStatus == 1 || _menuDone) - { - _gameSys->removeSpriteDrawItem(_menuSprite2, 262); - _gameSys->removeSpriteDrawItem(_menuSaveLoadSprite, 262); - for (i = 0; i < 7; ++i) - _gameSys->removeSpriteDrawItem(_savegameSprites[i], 263); - _gameSys->removeSpriteDrawItem(_cursorSprite, 264); - if (!_menuDone) - { - initMenuHotspots2(); - insertSpriteDrawItem(_menuSprite1, 288, 79, 262); + + updateEvents(); + Common::Event event; + _eventMan->pollEvent(event); + + Common::KeyCode keycode = event.kbd.keycode; + if (_savegameIndex != -1 && keycode) { + if ((keycode < Common::KEYCODE_a || keycode > Common::KEYCODE_z) && (keycode < Common::KEYCODE_0 || keycode > Common::KEYCODE_9) && keycode != Common::KEYCODE_SPACE) { + if (keycode == Common::KEYCODE_BACKSPACE) { + if (v46 > 0) + --v46; + _savegameFilenames[_savegameIndex][v46] = '\0'; + if (_savegameSprites[_savegameIndex] != nullptr) { + _gameSys->removeSpriteDrawItem(_savegameSprites[_savegameIndex], 263); + warning("memFreeHandle(_savegameSprites[_savegameIndex]);"); + } + int v32 = _gameSys->getSpriteWidthById(0x104F9); + _savegameSprites[_savegameIndex] = _gameSys->allocSurface(v32, 40); + _gameSys->drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, _savegameFilenames[_savegameIndex]); + _gameSys->insertSpriteDrawItem(_savegameSprites[_savegameIndex], 288, _hotspots[_savegameIndex]._y1, 263); + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + int v33 = _hotspots[_savegameIndex]._y1; + int v34 = _gameSys->getTextWidth(_savegameFilenames[_savegameIndex]); + _gameSys->insertSpriteDrawItem(_cursorSprite, _hotspots[_savegameIndex]._x1 + v34, v33, 264); + } else if (keycode == Common::KEYCODE_RETURN) { + _menuStatus = 1; + warning("writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1);"); + } + } else { + _savegameFilenames[_savegameIndex][v46] = event.kbd.ascii; + if (v46 < 28) + ++v46; + _savegameFilenames[_savegameIndex][v46] = '\0'; + if (_gameSys->getTextWidth(_savegameFilenames[_savegameIndex]) > 91) { + --v46; + _savegameFilenames[_savegameIndex][v46] = '\0'; + } + _gameSys->drawTextToSurface(_savegameSprites[_savegameIndex], 0, 0, 255, 0, 0, _savegameFilenames[_savegameIndex]); + int v26 = _gameSys->getTextWidth(_savegameFilenames[_savegameIndex]); + Common::Rect rect; + rect.right = _hotspots[_savegameIndex]._x1 + v26; + int v27 = rect.right; + rect.left = v27 - 2 * _gameSys->getTextWidth("W"); + rect.top = _hotspots[_savegameIndex]._y1; + rect.bottom = _hotspots[_savegameIndex]._y2; + _gameSys->insertDirtyRect(rect); + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + int v28 = _hotspots[_savegameIndex]._x2; + int v29 = _gameSys->getTextWidth("_"); + if (v28 - v29 > rect.right) + _gameSys->insertSpriteDrawItem(_cursorSprite, rect.right, rect.top, 264); + else { + int v30 = _hotspots[_savegameIndex]._x2; + int v31 = v30 - _gameSys->getTextWidth("_"); + _gameSys->insertSpriteDrawItem(_cursorSprite, v31, rect.top, 264); + } + clearKeyStatus1(8); + } } + +// warning("keybChar = 0;"); + if (_menuStatus == 1 || _menuDone) { + _gameSys->removeSpriteDrawItem(_menuSprite2, 262); + _gameSys->removeSpriteDrawItem(_menuSaveLoadSprite, 262); + for (int i = 0; i < 7; ++i) + _gameSys->removeSpriteDrawItem(_savegameSprites[i], 263); + _gameSys->removeSpriteDrawItem(_cursorSprite, 264); + if (!_menuDone) { + initMenuHotspots2(); + _gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262); + } } #endif } -- cgit v1.2.3 From e11ec6a9c18ec908780b30b0a5f54d271904ea8b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Apr 2016 00:38:50 +0200 Subject: GNAP: Some rework of hotspot initialization code --- engines/gnap/menu.cpp | 246 +++++++++++++++++++++++++++----------------------- 1 file changed, 131 insertions(+), 115 deletions(-) diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index df8551e0e6..8c3bcae16a 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -44,88 +44,91 @@ void GnapEngine::freeMenuSprite() { } void GnapEngine::initMenuHotspots1() { - - int v0, v2 = 0; + int curId = 0; for (int i = 0; i < 3; ++i) { - int v1 = 0; - while (v1 < 3) { - _hotspots[v2]._x1 = 87 * v1 + 262; - _hotspots[v2]._y1 = 74 * i + 69; - _hotspots[v2]._x2 = _hotspots[v2]._x1 + 79; - _hotspots[v2]._y2 = _hotspots[v2]._y1 + 66; - _hotspots[v2]._flags = SF_NONE; - _hotspots[v2]._id = v2; - ++v1; - ++v2; + for (int j = 0; j < 3; ++j) { + _hotspots[curId]._x1 = 87 * j + 262; + _hotspots[curId]._y1 = 74 * i + 69; + _hotspots[curId]._x2 = _hotspots[curId]._x1 + 79; + _hotspots[curId]._y2 = _hotspots[curId]._y1 + 66; + _hotspots[curId]._flags = SF_NONE; + _hotspots[curId]._id = curId; + ++curId; } } - _hotspots[v2]._x1 = 330; - _hotspots[v2]._y1 = 350; - _hotspots[v2]._x2 = 430; - _hotspots[v2]._y2 = 460; - _hotspots[v2]._flags = SF_GRAB_CURSOR; - _hotspots[v2]._id = v2; - - v0 = v2 + 1; - _hotspots[v0]._x1 = 180; - _hotspots[v0]._y1 = 15; - _hotspots[v0]._x2 = 620; - _hotspots[v0]._y2 = 580; - _hotspots[v0]._flags = SF_NONE; - _hotspots[v0]._id = v0; - - ++v0; - _hotspots[v0]._x1 = 0; - _hotspots[v0]._y1 = 0; - _hotspots[v0]._x2 = 799; - _hotspots[v0]._y2 = 599; - _hotspots[v0]._flags = SF_NONE; - _hotspots[v0]._id = v0; - - _hotspotsCount = v0 + 1; + _hotspots[curId]._x1 = 330; + _hotspots[curId]._y1 = 350; + _hotspots[curId]._x2 = 430; + _hotspots[curId]._y2 = 460; + _hotspots[curId]._flags = SF_GRAB_CURSOR; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 180; + _hotspots[curId]._y1 = 15; + _hotspots[curId]._x2 = 620; + _hotspots[curId]._y2 = 580; + _hotspots[curId]._flags = SF_NONE; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 0; + _hotspots[curId]._y1 = 0; + _hotspots[curId]._x2 = 799; + _hotspots[curId]._y2 = 599; + _hotspots[curId]._flags = SF_NONE; + _hotspots[curId]._id = curId; + + _hotspotsCount = curId + 1; } void GnapEngine::initMenuHotspots2() { - int i, v0; + int curId = 0; - for (i = 0; i < 4; ++i) { - _hotspots[i]._x1 = 312; - _hotspots[i]._y1 = 48 * i + 85; - _hotspots[i]._x2 = _hotspots[i]._x1 + 153; - _hotspots[i]._y2 = _hotspots[i]._y1 + 37; - _hotspots[i]._flags = SF_GRAB_CURSOR; - _hotspots[i]._id = i; + for (int i = 0; i < 4; ++i) { + _hotspots[curId]._x1 = 312; + _hotspots[curId]._y1 = 48 * i + 85; + _hotspots[curId]._x2 = _hotspots[curId]._x1 + 153; + _hotspots[curId]._y2 = _hotspots[curId]._y1 + 37; + _hotspots[curId]._flags = SF_GRAB_CURSOR; + _hotspots[curId]._id = curId; + ++curId; } - _hotspots[i]._x1 = 500; - _hotspots[i]._y1 = 72; - _hotspots[i]._x2 = 527; - _hotspots[i]._y2 = 99; - _hotspots[i]._flags = SF_DISABLED; - _hotspots[i]._id = i; - v0 = i + 1; - _hotspots[v0]._x1 = 330; - _hotspots[v0]._y1 = 350; - _hotspots[v0]._x2 = 430; - _hotspots[v0]._y2 = 460; - _hotspots[v0]._flags = SF_GRAB_CURSOR; - _hotspots[v0]._id = v0; - ++v0; - _hotspots[v0]._x1 = 180; - _hotspots[v0]._y1 = 15; - _hotspots[v0]._x2 = 620; - _hotspots[v0]._y2 = 580; - _hotspots[v0]._flags = SF_NONE; - _hotspots[v0]._id = v0; - ++v0; - _hotspots[v0]._x1 = 0; - _hotspots[v0]._y1 = 0; - _hotspots[v0]._x2 = 799; - _hotspots[v0]._y2 = 599; - _hotspots[v0]._flags = SF_NONE; - _hotspots[v0]._id = v0; - _hotspotsCount = v0 + 1; + + _hotspots[curId]._x1 = 500; + _hotspots[curId]._y1 = 72; + _hotspots[curId]._x2 = 527; + _hotspots[curId]._y2 = 99; + _hotspots[curId]._flags = SF_DISABLED; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 330; + _hotspots[curId]._y1 = 350; + _hotspots[curId]._x2 = 430; + _hotspots[curId]._y2 = 460; + _hotspots[curId]._flags = SF_GRAB_CURSOR; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 180; + _hotspots[curId]._y1 = 15; + _hotspots[curId]._x2 = 620; + _hotspots[curId]._y2 = 580; + _hotspots[curId]._flags = SF_NONE; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 0; + _hotspots[curId]._y1 = 0; + _hotspots[curId]._x2 = 799; + _hotspots[curId]._y2 = 599; + _hotspots[curId]._flags = SF_NONE; + _hotspots[curId]._id = curId; + + _hotspotsCount = curId + 1; } void GnapEngine::initMenuQuitQueryHotspots() { @@ -135,80 +138,93 @@ void GnapEngine::initMenuQuitQueryHotspots() { _hotspots[0]._y2 = 237; _hotspots[0]._flags = SF_GRAB_CURSOR; _hotspots[0]._id = 0; + _hotspots[1]._x1 = 403; _hotspots[1]._y1 = 197; _hotspots[1]._x2 = 469; _hotspots[1]._y2 = 237; _hotspots[1]._flags = SF_GRAB_CURSOR; _hotspots[1]._id = 1; + _hotspots[2]._x1 = 330; _hotspots[2]._y1 = 350; _hotspots[2]._x2 = 430; _hotspots[2]._y2 = 460; _hotspots[2]._flags = SF_GRAB_CURSOR; _hotspots[2]._id = 2; + _hotspots[3]._x1 = 180; _hotspots[3]._y1 = 15; _hotspots[3]._x2 = 620; _hotspots[3]._y2 = 580; _hotspots[3]._flags = SF_NONE; _hotspots[3]._id = 3; + _hotspots[4]._x1 = 0; _hotspots[4]._y1 = 0; _hotspots[4]._x2 = 799; _hotspots[4]._y2 = 599; _hotspots[4]._flags = SF_NONE; _hotspots[4]._id = 4; + _hotspotsCount = 5; } void GnapEngine::initSaveLoadHotspots() { - int i, v0; - for (i = 0; i < 7; ++i ) { - _hotspots[i]._x1 = 288; - _hotspots[i]._y1 = 31 * i + 74; - _hotspots[i]._x2 = _hotspots[i]._x1 + 91; - _hotspots[i]._y2 = _hotspots[i]._y1 + 22; - _hotspots[i]._flags = SF_GRAB_CURSOR; - _hotspots[i]._id = i; + int curId = 0; + + for (int i = 0; i < 7; ++i ) { + _hotspots[curId]._x1 = 288; + _hotspots[curId]._y1 = 31 * i + 74; + _hotspots[curId]._x2 = _hotspots[curId]._x1 + 91; + _hotspots[curId]._y2 = _hotspots[curId]._y1 + 22; + _hotspots[curId]._flags = SF_GRAB_CURSOR; + _hotspots[curId]._id = curId; + ++curId; } + if (_menuStatus == 2) { - _hotspots[i]._x1 = 416; - _hotspots[i]._y1 = 160; - _hotspots[i]._x2 = 499; - _hotspots[i]._y2 = 188; - _hotspots[i]._flags = SF_GRAB_CURSOR; - _hotspots[i]._id = i; - ++i; + _hotspots[curId]._x1 = 416; + _hotspots[curId]._y1 = 160; + _hotspots[curId]._x2 = 499; + _hotspots[curId]._y2 = 188; + _hotspots[curId]._flags = SF_GRAB_CURSOR; + _hotspots[curId]._id = curId; + ++curId; } - _hotspots[i]._x1 = 416; - _hotspots[i]._y1 = 213; - _hotspots[i]._x2 = 499; - _hotspots[i]._y2 = 241; - _hotspots[i]._flags = SF_GRAB_CURSOR; - _hotspots[i]._id = i; - v0 = i + 1; - _hotspots[v0]._x1 = 330; - _hotspots[v0]._y1 = 350; - _hotspots[v0]._x2 = 430; - _hotspots[v0]._y2 = 460; - _hotspots[v0]._flags = SF_GRAB_CURSOR; - _hotspots[v0]._id = v0; - ++v0; - _hotspots[v0]._x1 = 180; - _hotspots[v0]._y1 = 15; - _hotspots[v0]._x2 = 620; - _hotspots[v0]._y2 = 580; - _hotspots[v0]._flags = SF_NONE; - _hotspots[v0]._id = v0; - ++v0; - _hotspots[v0]._x1 = 0; - _hotspots[v0]._y1 = 0; - _hotspots[v0]._x2 = 799; - _hotspots[v0]._y2 = 599; - _hotspots[v0]._flags = SF_NONE; - _hotspots[v0]._id = v0; - _hotspotsCount = v0 + 1; + + _hotspots[curId]._x1 = 416; + _hotspots[curId]._y1 = 213; + _hotspots[curId]._x2 = 499; + _hotspots[curId]._y2 = 241; + _hotspots[curId]._flags = SF_GRAB_CURSOR; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 330; + _hotspots[curId]._y1 = 350; + _hotspots[curId]._x2 = 430; + _hotspots[curId]._y2 = 460; + _hotspots[curId]._flags = SF_GRAB_CURSOR; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 180; + _hotspots[curId]._y1 = 15; + _hotspots[curId]._x2 = 620; + _hotspots[curId]._y2 = 580; + _hotspots[curId]._flags = SF_NONE; + _hotspots[curId]._id = curId; + + ++curId; + _hotspots[curId]._x1 = 0; + _hotspots[curId]._y1 = 0; + _hotspots[curId]._x2 = 799; + _hotspots[curId]._y2 = 599; + _hotspots[curId]._flags = SF_NONE; + _hotspots[curId]._id = curId; + + _hotspotsCount = curId + 1; } void GnapEngine::drawInventoryFrames() { -- cgit v1.2.3 From 6a55da1504b54d4ac16dcccd3fd6c9811d6e3620 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Apr 2016 11:44:38 +0200 Subject: GNAP: Replace flags values by enums (WIP) --- engines/gnap/gnap.cpp | 20 ++++++++++---------- engines/gnap/gnap.h | 33 ++++++++++++++++++++++++++++++--- engines/gnap/scenes/scene01.cpp | 22 +++++++++++----------- engines/gnap/scenes/scene02.cpp | 30 +++++++++++++++--------------- engines/gnap/scenes/scene03.cpp | 38 +++++++++++++++++++------------------- engines/gnap/scenes/scene04.cpp | 30 +++++++++++++++--------------- engines/gnap/scenes/scene05.cpp | 32 ++++++++++++++++---------------- engines/gnap/scenes/scene06.cpp | 10 +++++----- engines/gnap/scenes/scene07.cpp | 6 +++--- engines/gnap/scenes/scene08.cpp | 6 +++--- engines/gnap/scenes/scene10.cpp | 14 +++++++------- engines/gnap/scenes/scene12.cpp | 2 +- engines/gnap/scenes/scene14.cpp | 12 ++++++------ engines/gnap/scenes/scene17.cpp | 16 ++++++++-------- engines/gnap/scenes/scene18.cpp | 16 ++++++++-------- engines/gnap/scenes/scene21.cpp | 20 ++++++++++---------- engines/gnap/scenes/scene25.cpp | 4 ++-- engines/gnap/scenes/scene27.cpp | 5 ++--- engines/gnap/scenes/scene28.cpp | 4 ++-- engines/gnap/scenes/scene47.cpp | 4 ++-- engines/gnap/scenes/scenecore.cpp | 4 ++-- 21 files changed, 177 insertions(+), 151 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index ce9e680ee3..fad1e57841 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -455,7 +455,7 @@ void GnapEngine::updateMouseCursor() { _mouseClickState._right = false; _timers[3] = 300; _verbCursor = (_verbCursor + 1) % 4; - if (!isFlag(0) && _verbCursor == PLAT_CURSOR && _cursorValue == 1) + if (!isFlag(kGFPlatypus) && _verbCursor == PLAT_CURSOR && _cursorValue == 1) _verbCursor = (_verbCursor + 1) % 4; if (!_isWaiting) setCursor(kDisabledCursors[_verbCursor]); @@ -688,20 +688,20 @@ void GnapEngine::initGameFlags(int num) { invAdd(kItemHorn); invAdd(kItemLightbulb); clearFlags(); - setFlag(0); - setFlag(1); - setFlag(2); - setFlag(3); - setFlag(4); - setFlag(5); - setFlag(6); - setFlag(7); + setFlag(kGFPlatypus); + setFlag(kGFMudTaken); + setFlag(kGFNeedleTaken); + setFlag(kGFTwigTaken); + setFlag(kGFUnk04); + setFlag(kGFKeysTaken); + setFlag(kGFGrassTaken); + setFlag(kGFBarnPadlockOpen); break; } //DEBUG! #if 0 -// setFlag(0); // Enable platypus +// setFlag(kGFPlatypus); // Enable platypus setFlag(25); invClear(); invAdd(kItemMagazine); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index fa33d42dad..75f931d1fa 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -169,9 +169,36 @@ enum { enum { kGFPlatypus = 0, kGFMudTaken = 1, - - - kGFEnd + kGFNeedleTaken = 2, + kGFTwigTaken = 3, + kGFUnk04 = 4, + kGFKeysTaken = 5, + kGFGrassTaken = 6, + kGFBarnPadlockOpen = 7, + kGFTruckFilledWithGas = 8, + kGFTruckKeysUsed = 9, + kGFPlatyPussDisguised = 10, + kGFSceneFlag1 = 11, + kGFGnapControlsToyUFO = 12, + kGFUnk13 = 13, + kGFUnk14 = 14, + kGFSpringTaken = 15, + kGFUnk16 = 16, + kGFJointTaken = 17, + kGFUnk18 = 18, + kGFGroceryStoreHatTaken = 19, + kGFPictureTaken = 20, + kGFUnk21 = 21, + kGFUnk22 = 22, + kGFUnk23 = 23, + kGFUnk24 = 24, + kGFUnk25 = 25, + kGFPlatypusTalkingToAssistant = 26, + kGFUnk27 = 27, + kGFUnk28 = 28, + kGFGasTaken = 29, + kGFUnk30 = 30, + kGFUnk31 = 31 }; /* diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 1d4bfee7be..bb7315c90c 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -73,9 +73,9 @@ void GnapEngine::scene01_updateHotspots() { setHotspot(kHSWalkArea7, 0, 0, 520, 351); setHotspot(kHSWalkArea8, 0, 546, 300, 600); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(1)) + if (isFlag(kGFMudTaken)) _hotspots[kHSMud]._flags = SF_WALKABLE | SF_DISABLED; _hotspotsCount = 14; } @@ -95,22 +95,22 @@ void GnapEngine::scene01_run() { _timers[4] = getRandom(100) + 300; - if (!isFlag(1)) + if (!isFlag(kGFMudTaken)) _gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); queueInsertDeviceIcon(); if (_prevSceneNum == 2) { initGnapPos(11, 6, kDirBottomLeft); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(12, 6, kDirUnk4); endSceneInit(); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(9, 6, -1, 0x107C2, 1); gnapWalkTo(8, 6, -1, 0x107B9, 1); } else { initGnapPos(1, 6, kDirBottomRight); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(1, 7, kDirNone); endSceneInit(); } @@ -134,7 +134,7 @@ void GnapEngine::scene01_run() { break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(0)) { + if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { if (_grabCursorSpriteIndex == kItemDisguise) { gnapUseDisguiseOnPlatypus(); } else if (_grabCursorSpriteIndex >= 0) { @@ -142,7 +142,7 @@ void GnapEngine::scene01_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(5)) + if (isFlag(kGFKeysTaken)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -239,7 +239,7 @@ void GnapEngine::scene01_run() { _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); _newSceneNum = 2; } @@ -272,7 +272,7 @@ void GnapEngine::scene01_run() { playSound(0x1091C, 1); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(0)) + if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) updateBeaverIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); @@ -347,7 +347,7 @@ void GnapEngine::scene01_updateAnimations() { _gameSys->setAnimation(0, 0, 3); invAdd(kItemMud); setGrabCursorSprite(kItemMud); - setFlag(1); + setFlag(kGFMudTaken); scene01_updateHotspots(); } diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index 65018e0435..0688b29dfe 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -78,7 +78,7 @@ void GnapEngine::scene02_updateHotspots() { setHotspot(kHSWalkArea3, 0, 0, 386, 445); setHotspot(kHSWalkArea4, 386, 0, 509, 410); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspotsCount = 14; } @@ -100,20 +100,20 @@ void GnapEngine::scene02_run() { switch (_prevSceneNum) { case 3: initGnapPos(11, 6, kDirBottomLeft); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(12, 6, kDirUnk4); endSceneInit(); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(9, 6, -1, 0x107C2, 1); gnapWalkTo(8, 6, -1, 0x107BA, 1); break; case 4: initGnapPos(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, kDirBottomLeft); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, kDirUnk4); endSceneInit(); gnapWalkTo(7, 6, 0, 0x107B9, 1); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(8, 6, 1, 0x107C2, 1); scene02_updateHotspots(); _gameSys->waitForUpdate(); @@ -126,16 +126,16 @@ void GnapEngine::scene02_run() { break; case 49: initGnapPos(5, 6, kDirBottomRight); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(6, 7, kDirNone); endSceneInit(); break; default: initGnapPos(-1, 6, kDirBottomRight); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(-1, 7, kDirNone); endSceneInit(); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(2, 7, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); break; @@ -162,7 +162,7 @@ void GnapEngine::scene02_run() { break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(0)) { + if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { if (_grabCursorSpriteIndex == kItemDisguise) { gnapUseDisguiseOnPlatypus(); } else if (_grabCursorSpriteIndex >= 0) { @@ -170,7 +170,7 @@ void GnapEngine::scene02_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(5)) + if (isFlag(kGFKeysTaken)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -299,7 +299,7 @@ void GnapEngine::scene02_run() { _isLeavingScene = 1; gnapWalkTo(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 0, 0x107AD, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, -1, 0x107C1, 1); scene02_updateHotspots(); _newSceneNum = 4; @@ -311,7 +311,7 @@ void GnapEngine::scene02_run() { _isLeavingScene = 1; gnapWalkTo(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y, 0, 0x107AD, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[7].x + 1, _hotspotsWalkPos[7].y, -1, 0x107C1, 1); scene02_updateHotspots(); _newSceneNum = 5; @@ -323,7 +323,7 @@ void GnapEngine::scene02_run() { _isLeavingScene = 1; gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, -1, 0x107CD, 1); _newSceneNum = 3; } @@ -334,7 +334,7 @@ void GnapEngine::scene02_run() { _isLeavingScene = 1; gnapWalkTo(_hotspotsWalkPos[9].x, _hotspotsWalkPos[9].y, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[9].x, _hotspotsWalkPos[9].y, -1, 0x107CF, 1); _newSceneNum = 1; } @@ -363,7 +363,7 @@ void GnapEngine::scene02_run() { playSound(0x1091C, 1); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(0)) + if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) updateBeaverIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 930554c3ac..50c985c543 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -69,13 +69,13 @@ void GnapEngine::scene03_updateHotspots() { setHotspot(kHSPlatypusWalkArea, 235, 0, 800, 600); setHotspot(kHSWalkAreas3, 0, 0, 800, 354); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(6)) + if (isFlag(kGFGrassTaken)) _hotspots[kHSGrass]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) _hotspots[kHSTrappedPlatypus]._flags = SF_DISABLED; - if (isFlag(0) || _s03_platypusHypnotized) + if (isFlag(kGFPlatypus) || _s03_platypusHypnotized) _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; _hotspotsCount = 10; } @@ -103,7 +103,7 @@ void GnapEngine::scene03_run() { _timers[4] = getRandom(100) + 300; _timers[5] = getRandom(100) + 200; - if (isFlag(0)) { + if (isFlag(kGFPlatypus)) { initBeaverPos(5, 4, kDirNone); } else { _timers[1] = getRandom(40) + 20; @@ -115,14 +115,14 @@ void GnapEngine::scene03_run() { _gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(6)) + if (!isFlag(kGFGrassTaken)) _gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); queueInsertDeviceIcon(); endSceneInit(); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(4, 7, -1, 0x107C2, 1); gnapWalkTo(3, 6, -1, 0x107B9, 1); @@ -137,7 +137,7 @@ void GnapEngine::scene03_run() { switch (_sceneClickedHotspot) { case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(0)) { + if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { if (_grabCursorSpriteIndex == kItemDisguise) { gnapUseDisguiseOnPlatypus(); } else if (_grabCursorSpriteIndex >= 0) { @@ -145,7 +145,7 @@ void GnapEngine::scene03_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(5)) + if (isFlag(kGFKeysTaken)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -167,7 +167,7 @@ void GnapEngine::scene03_run() { case kHSGrass: if (_gnapActionStatus < 0) { - if (isFlag(6)) { + if (isFlag(kGFGrassTaken)) { gnapWalkTo(-1, -1, -1, -1, 1); } else if (_grabCursorSpriteIndex >= 0) { playGnapShowItem(_grabCursorSpriteIndex, 9, 6); @@ -198,7 +198,7 @@ void GnapEngine::scene03_run() { _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107AD, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, -1, 0x107C2, 1); _hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; if (_cursorValue == 1) @@ -218,11 +218,11 @@ void GnapEngine::scene03_run() { playGnapMoan2(2, 8); break; case GRAB_CURSOR: - if (!isFlag(0)) + if (!isFlag(kGFPlatypus)) _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y + 1) | 0x10000, 1)) _gnapActionStatus = kASGrabCreek; - if (!isFlag(0)) + if (!isFlag(kGFPlatypus)) _hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: @@ -236,7 +236,7 @@ void GnapEngine::scene03_run() { case kHSTrappedPlatypus: if (_gnapActionStatus < 0) { - if (isFlag(0)) { + if (isFlag(kGFPlatypus)) { gnapWalkTo(-1, -1, -1, -1, 1); } else if (_grabCursorSpriteIndex >= 0) { playGnapShowItem(_grabCursorSpriteIndex, 8, 4); @@ -293,7 +293,7 @@ void GnapEngine::scene03_run() { case kHSPlatypusWalkArea: if (_gnapActionStatus < 0) { - if (isFlag(0) || _s03_platypusHypnotized) { + if (isFlag(kGFPlatypus) || _s03_platypusHypnotized) { gnapWalkTo(-1, -1, -1, -1, 1); } else { gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107B5, 1); @@ -320,13 +320,13 @@ void GnapEngine::scene03_run() { playSound(0x10925, 1); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(0)) + if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) updateBeaverIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[1] && !_s03_platypusScared) { _timers[1] = getRandom(40) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && !isFlag(0) && !_s03_platypusHypnotized) + if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && !isFlag(kGFPlatypus) && !_s03_platypusHypnotized) _s03_nextPlatSequenceId = 450; } if (!_timers[6]) { @@ -393,7 +393,7 @@ void GnapEngine::scene03_updateAnimations() { _gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); _beaverSequenceDatNum = 1; _beaverSequenceId = 0x7CA; - setFlag(0); + setFlag(kGFPlatypus); _s03_nextPlatSequenceId = -1; scene03_updateHotspots(); break; @@ -508,7 +508,7 @@ void GnapEngine::scene03_updateAnimations() { _gameSys->setAnimation(0, 0, 5); invAdd(kItemGrass); setGrabCursorSprite(kItemGrass); - setFlag(6); + setFlag(kGFGrassTaken); scene03_updateHotspots(); } diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index ec3f482ac0..8022625154 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -73,9 +73,9 @@ void GnapEngine::scene04_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 562, 461); setHotspot(kHSWalkArea2, 562, 0, 800, 500); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(3)) + if (isFlag(kGFTwigTaken)) _hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; if (isFlag(26) || _cursorValue == 1) _hotspots[kHSAxe]._flags = SF_DISABLED; @@ -102,7 +102,7 @@ void GnapEngine::scene04_run() { if (!isFlag(26) && _cursorValue == 4) _gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(3)) + if (!isFlag(kGFTwigTaken)) _gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); queueInsertDeviceIcon(); @@ -124,7 +124,7 @@ void GnapEngine::scene04_run() { endSceneInit(); invRemove(kItemDisguise); invAdd(kItemKeys); - setFlag(5); + setFlag(kGFKeysTaken); clearFlag(10); _beaverSequenceId = 0x20C; _beaverSequenceDatNum = 0; @@ -136,10 +136,10 @@ void GnapEngine::scene04_run() { _gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 2) { initGnapPos(5, 11, kDirUpRight); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(6, 11, kDirUpLeft); endSceneInit(); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(5, 8, -1, 0x107C2, 1); gnapWalkTo(6, 9, -1, 0x107BA, 1); } else if (_prevSceneNum == 38) { @@ -148,10 +148,10 @@ void GnapEngine::scene04_run() { endSceneInit(); } else { initGnapPos(12, 9, kDirBottomRight); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(12, 8, kDirNone); endSceneInit(); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(9, 8, -1, 0x107C2, 1); gnapWalkTo(9, 9, -1, 0x107BA, 1); } @@ -177,7 +177,7 @@ void GnapEngine::scene04_run() { break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(0)) { + if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { if (_grabCursorSpriteIndex == kItemDisguise) { gnapUseDisguiseOnPlatypus(); } else if (_grabCursorSpriteIndex >= 0) { @@ -185,7 +185,7 @@ void GnapEngine::scene04_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(5)) + if (isFlag(kGFKeysTaken)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -325,7 +325,7 @@ void GnapEngine::scene04_run() { _isLeavingScene = 1; gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, -1, 0x107C7, 1); if (_cursorValue == 1) _newSceneNum = 2; @@ -338,7 +338,7 @@ void GnapEngine::scene04_run() { if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 2, 3); - } else if (isFlag(5)) { + } else if (isFlag(kGFKeysTaken)) { playGnapImpossible(0, 0); } else { switch (_verbCursor) { @@ -369,7 +369,7 @@ void GnapEngine::scene04_run() { _isLeavingScene = 1; gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); if (_cursorValue == 1) _newSceneNum = 5; @@ -399,7 +399,7 @@ void GnapEngine::scene04_run() { playSound(0x1091C, 1); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(0)) + if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) beaverSub426234(); if (_gnapActionStatus < 0) updateGnapIdleSequence2(); @@ -537,7 +537,7 @@ void GnapEngine::scene04_updateAnimations() { _gameSys->setAnimation(0, 0, 2); invAdd(kItemTwig); setGrabCursorSprite(kItemTwig); - setFlag(3); + setFlag(kGFTwigTaken); scene04_updateHotspots(); } diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index aebd783359..805de4f212 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -55,7 +55,7 @@ int GnapEngine::scene05_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); _gameSys->setAnimation(0, 0, 3); - return isFlag(7) ? 0x151 : 0x150; + return isFlag(kGFBarnPadlockOpen) ? 0x151 : 0x150; } void GnapEngine::scene05_updateHotspots() { @@ -69,9 +69,9 @@ void GnapEngine::scene05_updateHotspots() { setHotspot(kHSWalkArea2, 422, 0, 800, 487); setHotspot(kHSWalkArea3, 0, 0, 104, 499); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(7)) + if (isFlag(kGFBarnPadlockOpen)) _hotspots[kHSPadlock]._flags = SF_EXIT_U_CURSOR; _hotspotsCount = 10; } @@ -90,22 +90,22 @@ void GnapEngine::scene05_run() { _timers[5] = getRandom(10) + 30; _timers[6] = getRandom(150) + 300; - if (isFlag(7)) + if (isFlag(kGFBarnPadlockOpen)) _gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); queueInsertDeviceIcon(); if (_prevSceneNum != 6 && _prevSceneNum != 36) { initGnapPos(-1, 8, kDirBottomRight); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(-1, 9, kDirNone); endSceneInit(); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(2, 8, -1, 0x107C2, 1); gnapWalkTo(2, 9, -1, 0x107B9, 1); } else { initGnapPos(6, 8, kDirBottomRight); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) initBeaverPos(7, 9, kDirNone); endSceneInit(); } @@ -130,7 +130,7 @@ void GnapEngine::scene05_run() { break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(0)) { + if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { if (_grabCursorSpriteIndex == kItemDisguise) { gnapUseDisguiseOnPlatypus(); } else if (_grabCursorSpriteIndex >= 0) { @@ -138,7 +138,7 @@ void GnapEngine::scene05_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(5)) + if (isFlag(kGFKeysTaken)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -162,7 +162,7 @@ void GnapEngine::scene05_run() { if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[1].x - 2, _hotspotsWalkPos[1].y, 4, 5); - } else if (isFlag(2)) { + } else if (isFlag(kGFNeedleTaken)) { playGnapImpossible(0, 0); } else { switch (_verbCursor) { @@ -174,7 +174,7 @@ void GnapEngine::scene05_run() { playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(0)) { + if (isFlag(kGFPlatypus)) { gnapUseDeviceOnBeaver(); if (platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { _beaverActionStatus = kASPlatSearchHaystack; @@ -246,7 +246,7 @@ void GnapEngine::scene05_run() { break; case kHSPadlock: - if (isFlag(7)) { + if (isFlag(kGFBarnPadlockOpen)) { _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[2].x - 1, _hotspotsWalkPos[2].y + 1, 0, -1, 1); _gnapActionStatus = kASEnterBarn; @@ -286,7 +286,7 @@ void GnapEngine::scene05_run() { _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(0)) + if (isFlag(kGFPlatypus)) platypusWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); if (_cursorValue == 1) _newSceneNum = 4; @@ -320,7 +320,7 @@ void GnapEngine::scene05_run() { playSound(0x1091C, 1); if (!_isLeavingScene) { - if (isFlag(0)) + if (isFlag(kGFPlatypus)) updateBeaverIdleSequence(); updateGnapIdleSequence(); if (!_timers[5]) { @@ -375,7 +375,7 @@ void GnapEngine::scene05_updateAnimations() { _gameSys->insertSequence(0x147, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x147; _gnapSequenceDatNum = 0; - setFlag(7); + setFlag(kGFBarnPadlockOpen); setFlag(11); setGrabCursorSprite(-1); _newSceneNum = 6; @@ -425,7 +425,7 @@ void GnapEngine::scene05_updateAnimations() { _beaverSequenceDatNum = 1; _beaverId = 20 * _platY; invAdd(kItemNeedle); - setFlag(2); + setFlag(kGFNeedleTaken); setGrabCursorSprite(kItemNeedle); showCursor(); _timers[1] = 30; diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index 459d449656..8a374e1021 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -96,7 +96,7 @@ void GnapEngine::scene06_run() { _timers[4] = getRandom(40) + 25; - if (isFlag(4)) + if (isFlag(kGFUnk04)) _gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); else _gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); @@ -141,7 +141,7 @@ void GnapEngine::scene06_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(5)) + if (isFlag(kGFKeysTaken)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -171,7 +171,7 @@ void GnapEngine::scene06_run() { playGnapScratchingHead(5, 0); break; case GRAB_CURSOR: - if (isFlag(4)) { + if (isFlag(kGFUnk04)) { playGnapImpossible(0, 0); } else if (triedDeviceOnGas) { _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; @@ -185,7 +185,7 @@ void GnapEngine::scene06_run() { break; case TALK_CURSOR: case PLAT_CURSOR: - if (isFlag(4)) + if (isFlag(kGFUnk04)) playGnapImpossible(0, 0); else playGnapScratchingHead(5, 0); @@ -391,7 +391,7 @@ void GnapEngine::scene06_updateAnimations() { _gameSys->insertSequence(0x107C1, _beaverId, 0, 0, kSeqNone, 0, 450 - _platGridX, 384 - _platGridY); _beaverSequenceId = 0x7C1; _beaverSequenceDatNum = 1; - setFlag(4); + setFlag(kGFUnk04); _gnapActionStatus = -1; showCursor(); } diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index 671ad9c9c6..d10c4096cb 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -53,7 +53,7 @@ void GnapEngine::scene07_updateHotspots() { setHotspot(kHSWalkArea2, 325, 0, 799, 445, _isLeavingScene ? SF_WALKABLE : 0); setHotspot(kHSWalkArea3, 160, 0, 325, 495); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(0)) + if (isFlag(kGFPlatypus)) _hotspots[kHSDice]._flags = SF_DISABLED; _hotspotsCount = 7; } @@ -67,7 +67,7 @@ void GnapEngine::scene07_run() { invRemove(kItemGas); invRemove(kItemNeedle); - if (!isFlag(0)) + if (!isFlag(kGFPlatypus)) _gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 8) { @@ -147,7 +147,7 @@ void GnapEngine::scene07_run() { case LOOK_CURSOR: break; case GRAB_CURSOR: - setFlag(0); + setFlag(kGFPlatypus); invAdd(kItemDice); scene07_updateHotspots(); playGnapPullOutDevice(3, 3); diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index a1cbe07601..2dfb4d324f 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -67,7 +67,7 @@ void GnapEngine::scene08_updateHotspots() { setHotspot(kHSWalkArea1, 290, 340, -1, -1); setHotspot(kHSWalkArea2, 0, 0, 799, 420); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(7)) + if (isFlag(kGFBarnPadlockOpen)) _hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED; if (isFlag(8)) _hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED; @@ -107,7 +107,7 @@ void GnapEngine::scene08_run() { _timers[4] = getRandom(50) + 75; - if (!isFlag(7)) + if (!isFlag(kGFBarnPadlockOpen)) _gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); if (!isFlag(8)) @@ -473,7 +473,7 @@ void GnapEngine::scene08_updateAnimations() { _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); switch (_s08_nextDogSequenceId) { case 0x149: - setFlag(7); + setFlag(kGFBarnPadlockOpen); _hotspots[kHSMeat]._flags = SF_DISABLED | SF_WALKABLE; _gameSys->removeSequence(0x144, 1, true); break; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index 6f5552fbea..6f9f47e817 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -78,7 +78,7 @@ void GnapEngine::scene10_run() { _gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); _s10_nextCookSequenceId = 0x106; - if (!isFlag(1)) + if (!isFlag(kGFMudTaken)) _gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); queueInsertDeviceIcon(); @@ -125,7 +125,7 @@ void GnapEngine::scene10_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(1)) + if (isFlag(kGFMudTaken)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -198,13 +198,13 @@ void GnapEngine::scene10_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(1)) + if (isFlag(kGFMudTaken)) playGnapMoan2(-1, -1); else playGnapScratchingHead(4, 3); break; case GRAB_CURSOR: - if (isFlag(1)) + if (isFlag(kGFMudTaken)) playGnapMoan2(-1, -1); else { gnapActionIdle(0x10C); @@ -216,7 +216,7 @@ void GnapEngine::scene10_run() { playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(1)) + if (isFlag(kGFMudTaken)) playGnapMoan2(-1, -1); else { gnapActionIdle(0x10C); @@ -247,11 +247,11 @@ void GnapEngine::scene10_run() { playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(1)) + if (isFlag(kGFMudTaken)) playGnapMoan2(-1, -1); else { invAdd(kItemTongs); - setFlag(1); + setFlag(kGFMudTaken); gnapActionIdle(0x10C); gnapUseDeviceOnBeaver(); platypusWalkTo(7, 6, 1, 0x107D2, 1); diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index c83f0bd2d9..df26e4d0e1 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -497,7 +497,7 @@ void GnapEngine::scene12_updateAnimations() { kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7B7; _gnapSequenceDatNum = 1; - setFlag(3); + setFlag(kGFTwigTaken); invAdd(kItemQuarterWithHole); invRemove(kItemQuarter); } diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp index 1e22c84b57..47bb12f563 100644 --- a/engines/gnap/scenes/scene14.cpp +++ b/engines/gnap/scenes/scene14.cpp @@ -46,7 +46,7 @@ void GnapEngine::scene14_updateHotspots() { setHotspot(kHSCoin, 330, 390, 375, 440, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); setHotspot(kHSToilet, 225, 250, 510, 500, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(2)) + if (isFlag(kGFNeedleTaken)) _hotspots[kHSCoin]._flags = SF_DISABLED; _hotspotsCount = 5; } @@ -56,15 +56,15 @@ void GnapEngine::scene14_run() { queueInsertDeviceIcon(); - if (!isFlag(2)) + if (!isFlag(kGFNeedleTaken)) _gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); - if (!isFlag(2) && invHas(kItemTongs)) + if (!isFlag(kGFNeedleTaken) && invHas(kItemTongs)) _largeSprite = _gameSys->createSurface(1); - if (!isFlag(2)) { + if (!isFlag(kGFNeedleTaken)) { _gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x24; _timers[2] = getRandom(40) + 50; @@ -95,7 +95,7 @@ void GnapEngine::scene14_run() { case kHSCoin: if (_grabCursorSpriteIndex == kItemTongs) { invAdd(kItemQuarter); - setFlag(2); + setFlag(kGFNeedleTaken); setGrabCursorSprite(-1); hideCursor(); _gameSys->setAnimation(0x26, 10, 0); @@ -151,7 +151,7 @@ void GnapEngine::scene14_run() { checkGameKeys(); - if (!isFlag(2) && !_timers[2]) { + if (!isFlag(kGFNeedleTaken) && !_timers[2]) { _gameSys->insertSequence(0x24, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x24; _timers[2] = getRandom(40) + 50; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index ec580b971f..c502649c1d 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -72,7 +72,7 @@ void GnapEngine::scene17_updateHotspots() { setHotspot(kHSWalkArea2, 541, 0, 800, 600); setHotspot(kHSWalkArea3, 0, 204, 173, 468); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(6)) + if (isFlag(kGFGrassTaken)) _hotspots[kHSWrench]._flags = SF_NONE; if (isFlag(26)) { _hotspots[kHSDevice]._flags = SF_DISABLED; @@ -150,7 +150,7 @@ void GnapEngine::scene17_run() { queueInsertDeviceIcon(); - if (isFlag(6)) + if (isFlag(kGFGrassTaken)) _s17_currWrenchSequenceId = 0x22D; else _s17_currWrenchSequenceId = 0x22F; @@ -163,7 +163,7 @@ void GnapEngine::scene17_run() { _gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); _gameSys->insertSequence(_s17_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(6)) { + if (isFlag(kGFGrassTaken)) { _gameSys->setAnimation(0, 0, 3); } else { _gameSys->setAnimation(_s17_currCarWindowSequenceId, 40, 3); @@ -296,7 +296,7 @@ void GnapEngine::scene17_run() { case kHSPlatypus: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex == kItemJoint) { - if (isFlag(6)) { + if (isFlag(kGFGrassTaken)) { gnapUseJointOnPlatypus(); } else { gnapUseDeviceOnBeaver(); @@ -330,7 +330,7 @@ void GnapEngine::scene17_run() { case kHSWrench: if (_gnapActionStatus < 0) { - if (isFlag(6)) { + if (isFlag(kGFGrassTaken)) { playGnapImpossible(0, 0); } else if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 8, 7); @@ -515,7 +515,7 @@ void GnapEngine::scene17_run() { } if (_beaverActionStatus < 0 && !_timers[5]) { _timers[5] = getRandom(30) + 80; - if (isFlag(6) && _s17_nextWrenchSequenceId == -1) { + if (isFlag(kGFGrassTaken) && _s17_nextWrenchSequenceId == -1) { _s17_nextWrenchSequenceId = 0x236; } else if (_s17_canTryGetWrench) { switch (getRandom(6)) { @@ -565,7 +565,7 @@ void GnapEngine::scene17_run() { } if (!_timers[6]) { _timers[6] = getRandom(30) + 200; - if (_s17_nextCarWindowSequenceId == -1 && !isFlag(6)) + if (_s17_nextCarWindowSequenceId == -1 && !isFlag(kGFGrassTaken)) _s17_nextCarWindowSequenceId = 0x246; } playSoundA(); @@ -832,7 +832,7 @@ void GnapEngine::scene17_updateAnimations() { _s17_nextCarWindowSequenceId = -1; _s17_currWrenchSequenceId = 0x22D; _s17_nextWrenchSequenceId = -1; - setFlag(6); + setFlag(kGFGrassTaken); _gnapActionStatus = -1; _beaverActionStatus = 2; scene17_updateHotspots(); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index b76e43072d..3e2301e96b 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -97,7 +97,7 @@ void GnapEngine::scene18_updateHotspots() { } else { _hotspots[kHSHydrantTopValve]._y1 = 246; } - } else if (isFlag(7)) { + } else if (isFlag(kGFBarnPadlockOpen)) { _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; _hotspots[kHSHydrantTopValve]._x1 = 105; _hotspots[kHSHydrantTopValve]._x2 = 192; @@ -294,7 +294,7 @@ void GnapEngine::scene18_closeHydrantValve() { _gnapActionStatus = kASCloseRightValveNoGarbageCan; scene18_waitForGnapAction(); } - } else if (isFlag(7)) { + } else if (isFlag(kGFBarnPadlockOpen)) { gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); _gnapActionStatus = kASCloseTopValve; scene18_waitForGnapAction(); @@ -338,7 +338,7 @@ void GnapEngine::scene18_run() { _gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); playSound(0x22B, true); - } else if (isFlag(7)) { + } else if (isFlag(kGFBarnPadlockOpen)) { _gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); _gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); playSound(0x22B, true); @@ -542,7 +542,7 @@ void GnapEngine::scene18_run() { if (isFlag(8)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); _gnapActionStatus = kASPutGarbageCanOnRunningHydrant; - } else if (!isFlag(7)) { + } else if (!isFlag(kGFBarnPadlockOpen)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); _gnapActionStatus = kASPutGarbageCanOnHydrant; } else { @@ -571,7 +571,7 @@ void GnapEngine::scene18_run() { playGnapScratchingHead(1, 5); break; case GRAB_CURSOR: - if (isFlag(7)) { + if (isFlag(kGFBarnPadlockOpen)) { _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; @@ -723,7 +723,7 @@ void GnapEngine::scene18_run() { if (!isSoundPlaying(0x10940)) playSound(0x10940, true); - if ((isFlag(8) || isFlag(7)) && !isSoundPlaying(0x22B) && + if ((isFlag(8) || isFlag(kGFBarnPadlockOpen)) && !isSoundPlaying(0x22B) && _gnapActionStatus != kASOpenRightValveNoGarbageCanDone && _gnapActionStatus != kASOpenRightValveNoGarbageCan && _gnapActionStatus != kASOpenTopValve && _gnapActionStatus != kASOpenTopValveDone && _gnapActionStatus != kASOpenRightValveWithGarbageCan && _gnapActionStatus != kASOpenRightValveWithGarbageCanDone) @@ -827,7 +827,7 @@ void GnapEngine::scene18_updateAnimations() { _gnapActionStatus = -1; break; case kASOpenTopValve: - setFlag(7); + setFlag(kGFBarnPadlockOpen); scene18_updateHotspots(); playGnapPullOutDevice(2, 7); playGnapUseDevice(0, 0); @@ -862,7 +862,7 @@ void GnapEngine::scene18_updateAnimations() { stopSound(0x22B); _gnapSequenceDatNum = 0; _gnapSequenceId = 0x206; - clearFlag(7); + clearFlag(kGFBarnPadlockOpen); invAdd(kItemWrench); setGrabCursorSprite(kItemWrench); scene18_updateHotspots(); diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index 7d8157bd07..a6f42e10fa 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -48,7 +48,7 @@ enum { int GnapEngine::scene21_init() { _gameSys->setAnimation(0, 0, 3); - return isFlag(3) ? 0x94 : 0x93; + return isFlag(kGFTwigTaken) ? 0x94 : 0x93; } void GnapEngine::scene21_updateHotspots() { @@ -59,9 +59,9 @@ void GnapEngine::scene21_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 800, 440); setHotspot(kHSWalkArea2, 698, 0, 800, 600); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(4) || !isFlag(3)) + if (isFlag(kGFUnk04) || !isFlag(kGFTwigTaken)) _hotspots[kHSBanana]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(3)) + if (isFlag(kGFTwigTaken)) _hotspots[kHSOldLady]._flags = SF_DISABLED; _hotspotsCount = 7; } @@ -75,19 +75,19 @@ void GnapEngine::scene21_run() { queueInsertDeviceIcon(); - if (isFlag(3)) { - if (isFlag(5)) { + if (isFlag(kGFTwigTaken)) { + if (isFlag(kGFKeysTaken)) { initGnapPos(5, 8, kDirBottomRight); initBeaverPos(6, 8, kDirNone); _gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(4)) + if (!isFlag(kGFUnk04)) _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); - clearFlag(5); + clearFlag(kGFKeysTaken); } else { initGnapPos(5, 11, kDirBottomRight); initBeaverPos(6, 11, kDirNone); - if (!isFlag(4)) + if (!isFlag(kGFUnk04)) _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107B9, 1); @@ -237,7 +237,7 @@ void GnapEngine::scene21_run() { if (!_isLeavingScene) { updateBeaverIdleSequence(); updateGnapIdleSequence(); - if (!isFlag(3) && !_timers[4] && _s21_nextOldLadySequenceId == -1 && _gnapActionStatus == -1) { + if (!isFlag(kGFTwigTaken) && !_timers[4] && _s21_nextOldLadySequenceId == -1 && _gnapActionStatus == -1) { _timers[4] = getRandom(30) + 50; switch (getRandom(5)) { case 0: @@ -284,7 +284,7 @@ void GnapEngine::scene21_updateAnimations() { case kASGrabBanana: _gameSys->setAnimation(0x8C, 59, 0); _gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); - setFlag(4); + setFlag(kGFUnk04); invAdd(kItemBanana); scene21_updateHotspots(); _gnapActionStatus = kASGrabBananaDone; diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index c93c194b94..42df9bd35e 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -220,7 +220,7 @@ void GnapEngine::scene25_run() { case kHSExitInsideCircusWorld: if (_gnapActionStatus < 0) { - if (isFlag(2)) { + if (isFlag(kGFNeedleTaken)) { _isLeavingScene = true; _newSceneNum = 26; _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; @@ -368,7 +368,7 @@ void GnapEngine::scene25_updateAnimations() { case kASShowTicketToVendor: setGrabCursorSprite(-1); invRemove(kItemTickets); - setFlag(2); + setFlag(kGFNeedleTaken); _gameSys->setAnimation(0x61, 40, 0); _gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); _gnapActionStatus = kASShowTicketToVendorDone; diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 02020d5211..e891e255d7 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -245,7 +245,7 @@ void GnapEngine::scene27_run() { case kHSExitClown: if (_gnapActionStatus < 0) { - if (isFlag(0)) { + if (isFlag(kGFPlatypus)) { _isLeavingScene = true; _newSceneNum = 28; gnapWalkTo(_hotspotsWalkPos[kHSExitClown].x, _hotspotsWalkPos[kHSExitClown].y, 0, 0x107AD, 1); @@ -404,7 +404,7 @@ void GnapEngine::scene27_updateAnimations() { _gnapActionStatus = kASEnterClownTent; _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; _s27_nextJanitorSequenceId = -1; - setFlag(0); + setFlag(kGFPlatypus); setGrabCursorSprite(-1); invRemove(kItemPicture); _newSceneNum = 28; @@ -417,7 +417,6 @@ void GnapEngine::scene27_updateAnimations() { break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index f7226e3a66..a2831e9f5b 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -81,7 +81,7 @@ void GnapEngine::scene28_run() { if (isFlag(22)) _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(1)) { + if (isFlag(kGFMudTaken)) { if (isFlag(21)) { _gameSys->setAnimation(0x11C, 39, 3); _gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); @@ -104,7 +104,7 @@ void GnapEngine::scene28_run() { endSceneInit(); playSequences(0xF7, 0x121, 0x122, 0x123); _s28_currClownSequenceId = 0x115; - setFlag(1); + setFlag(kGFMudTaken); _gameSys->setAnimation(0x115, 39, 3); _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _s28_nextClownSequenceId = -1; diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index d692e1d83d..37077e2876 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -130,7 +130,7 @@ void GnapEngine::scene47_initCutscene7() { _s99_sequenceIdArr[2] = 0x314; _s99_sequenceIdArr[3] = 0x31B; int v1 = 4; - if (!isFlag(3)) { + if (!isFlag(kGFTwigTaken)) { _s99_sequenceIdArr[4] = 0x31C; v1 = 5; } @@ -144,7 +144,7 @@ void GnapEngine::scene47_initCutscene7() { _s99_sequenceIdArr[v0++] = 0x312; _s99_sequenceIdArr[v0] = 0x31A; v2 = v0 + 1; - if (!isFlag(3)) + if (!isFlag(kGFTwigTaken)) _s99_sequenceIdArr[v2++] = 0x31C; if (!isFlag(26)) _s99_sequenceIdArr[v2++] = 0x31D; diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 0825937fff..734c7371a9 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -599,8 +599,8 @@ void GnapEngine::runSceneLogic() { } else if (_prevSceneNum == 21) { scene47_initCutscene5(); _newSceneNum = 21; - setFlag(3); - setFlag(5); + setFlag(kGFTwigTaken); + setFlag(kGFKeysTaken); } else if (_prevSceneNum == 30) { scene47_initCutscene6(); _newSceneNum = 26; -- cgit v1.2.3 From 6dfa316b2454e34252225be399a08f56b78e274f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Apr 2016 12:02:08 +0200 Subject: GNAP: Replace more flags values by enums (WIP) --- engines/gnap/gnap.cpp | 6 +-- engines/gnap/gnap.h | 2 +- engines/gnap/scenes/scene02.cpp | 18 +++---- engines/gnap/scenes/scene04.cpp | 4 +- engines/gnap/scenes/scene05.cpp | 2 +- engines/gnap/scenes/scene06.cpp | 4 +- engines/gnap/scenes/scene08.cpp | 16 +++--- engines/gnap/scenes/scene13.cpp | 2 +- engines/gnap/scenes/scene15.cpp | 20 +++---- engines/gnap/scenes/scene17.cpp | 4 +- engines/gnap/scenes/scene18.cpp | 106 +++++++++++++++++++------------------- engines/gnap/scenes/scene20.cpp | 4 +- engines/gnap/scenes/scene22.cpp | 2 +- engines/gnap/scenes/scene23.cpp | 6 +-- engines/gnap/scenes/scene27.cpp | 6 +-- engines/gnap/scenes/scene30.cpp | 2 +- engines/gnap/scenes/scene41.cpp | 27 +++++----- engines/gnap/scenes/scene42.cpp | 12 ++--- engines/gnap/scenes/scene43.cpp | 26 +++++----- engines/gnap/scenes/scene44.cpp | 21 ++++---- engines/gnap/scenes/scene45.cpp | 12 ++--- engines/gnap/scenes/scene46.cpp | 12 ++--- engines/gnap/scenes/scene50.cpp | 2 +- engines/gnap/scenes/scenecore.cpp | 4 +- 24 files changed, 156 insertions(+), 164 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index fad1e57841..631f70c333 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -839,7 +839,7 @@ void GnapEngine::initScene() { _gameSys->drawBitmap(backgroundId); } - if ((_cursorValue == 4 && isFlag(12)) || _currentSceneNum == 41) + if ((_cursorValue == 4 && isFlag(kGFGnapControlsToyUFO)) || _currentSceneNum == 41) playSound(makeRid(1, 0x8F6), true); } @@ -1887,7 +1887,7 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { _newSceneNum = 47; _isLeavingScene = true; _sceneDone = true; - setFlag(10); + setFlag(kGFPlatyPussDisguised); } // CHECKME: The 3 parameters are always 0 @@ -2195,7 +2195,7 @@ int GnapEngine::toyUfoGetSequenceId() { } bool GnapEngine::toyUfoCheckTimer() { - if (!isFlag(12) || isFlag(18) || _timers[9] || + if (!isFlag(kGFGnapControlsToyUFO) || isFlag(18) || _timers[9] || _toyUfoSequenceId == 0x870 || _toyUfoSequenceId == 0x871 || _toyUfoSequenceId == 0x872 || _toyUfoSequenceId == 0x873) return false; _sceneDone = true; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 75f931d1fa..aa6e8d57e4 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -180,7 +180,7 @@ enum { kGFPlatyPussDisguised = 10, kGFSceneFlag1 = 11, kGFGnapControlsToyUFO = 12, - kGFUnk13 = 13, + kGFUnk13 = 13, // Tongue Fight Won? kGFUnk14 = 14, kGFSpringTaken = 15, kGFUnk16 = 16, diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index 0688b29dfe..b285972c98 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -60,7 +60,7 @@ enum { int GnapEngine::scene02_init() { _gameSys->setAnimation(0, 0, 0); - return isFlag(9) ? 0x15A : 0x15B; + return isFlag(kGFTruckKeysUsed) ? 0x15A : 0x15B; } void GnapEngine::scene02_updateHotspots() { @@ -231,7 +231,7 @@ void GnapEngine::scene02_run() { if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { setGrabCursorSprite(-1); invRemove(kItemKeys); - if (isFlag(8)) + if (isFlag(kGFTruckFilledWithGas)) _gnapActionStatus = kASUseTruckGas; else _gnapActionStatus = kASUseTruckNoGas; @@ -249,9 +249,9 @@ void GnapEngine::scene02_run() { playGnapScratchingHead(2, 2); break; case GRAB_CURSOR: - if (isFlag(9)) { + if (isFlag(kGFTruckKeysUsed)) { if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { - if (isFlag(8)) + if (isFlag(kGFTruckFilledWithGas)) _gnapActionStatus = kASUseTruckGas; else _gnapActionStatus = kASUseTruckNoGas; @@ -419,7 +419,7 @@ void GnapEngine::scene02_updateAnimations() { _gnapSequenceDatNum = 0; invRemove(kItemGas); setGrabCursorSprite(-1); - setFlag(8); + setFlag(kGFTruckFilledWithGas); _gnapActionStatus = kASUseGasWithTruckDone; break; case kASUseTruckGas: @@ -427,10 +427,10 @@ void GnapEngine::scene02_updateAnimations() { _timers[4] = 9999; hideCursor(); setGrabCursorSprite(-1); - if (!isFlag(9)) { + if (!isFlag(kGFTruckKeysUsed)) { _gameSys->insertSequence(0x14F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->waitForUpdate(); - setFlag(9); + setFlag(kGFTruckKeysUsed); _gnapSequenceId = 0x14F; _gnapSequenceDatNum = 0; invRemove(kItemKeys); @@ -443,10 +443,10 @@ void GnapEngine::scene02_updateAnimations() { hideCursor(); setGrabCursorSprite(-1); _timers[4] = 250; - if (!isFlag(9)) { + if (!isFlag(kGFTruckKeysUsed)) { _gameSys->insertSequence(0x14F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->waitForUpdate(); - setFlag(9); + setFlag(kGFTruckKeysUsed); _gnapSequenceId = 0x14F; _gnapSequenceDatNum = 0; invRemove(kItemKeys); diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 8022625154..b85bbe7f36 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -107,7 +107,7 @@ void GnapEngine::scene04_run() { queueInsertDeviceIcon(); - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { _timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); setGrabCursorSprite(kItemKeys); @@ -125,7 +125,7 @@ void GnapEngine::scene04_run() { invRemove(kItemDisguise); invAdd(kItemKeys); setFlag(kGFKeysTaken); - clearFlag(10); + clearFlag(kGFPlatyPussDisguised); _beaverSequenceId = 0x20C; _beaverSequenceDatNum = 0; _beaverFacing = kDirBottomRight; diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index 805de4f212..03534b1318 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -376,7 +376,7 @@ void GnapEngine::scene05_updateAnimations() { _gnapSequenceId = 0x147; _gnapSequenceDatNum = 0; setFlag(kGFBarnPadlockOpen); - setFlag(11); + setFlag(kGFSceneFlag1); setGrabCursorSprite(-1); _newSceneNum = 6; _timers[2] = 100; diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index 8a374e1021..13c6108d7c 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -53,9 +53,9 @@ int GnapEngine::scene06_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); _gameSys->setAnimation(0, 0, 2); - if (isFlag(11)) { + if (isFlag(kGFSceneFlag1)) { playSound(0x11B, 0); - clearFlag(11); + clearFlag(kGFSceneFlag1); } return 0x101; } diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index 2dfb4d324f..d01355a44d 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -69,9 +69,9 @@ void GnapEngine::scene08_updateHotspots() { setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(kGFBarnPadlockOpen)) _hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(8)) + if (isFlag(kGFTruckFilledWithGas)) _hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(9)) + if (isFlag(kGFTruckKeysUsed)) _hotspots[kHSToy]._flags = SF_WALKABLE | SF_DISABLED; _hotspotsCount = 11; } @@ -110,10 +110,10 @@ void GnapEngine::scene08_run() { if (!isFlag(kGFBarnPadlockOpen)) _gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(8)) + if (!isFlag(kGFTruckFilledWithGas)) _gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(9)) + if (!isFlag(kGFTruckKeysUsed)) _gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); initGnapPos(-1, 8, kDirBottomRight); @@ -156,7 +156,7 @@ void GnapEngine::scene08_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(11)) + if (isFlag(kGFSceneFlag1)) playGnapMoan1(_platX, _platY); else playGnapScratchingHead(_platX, _platY); @@ -249,7 +249,7 @@ void GnapEngine::scene08_run() { _gnapActionStatus = kASTalkDog; break; case PLAT_CURSOR: - setFlag(11); + setFlag(kGFSceneFlag1); gnapActionIdle(0x14D); gnapUseDeviceOnBeaver(); platypusWalkTo(3, 7, 1, 0x107C2, 1); @@ -478,12 +478,12 @@ void GnapEngine::scene08_updateAnimations() { _gameSys->removeSequence(0x144, 1, true); break; case 0x14A: - setFlag(8); + setFlag(kGFTruckFilledWithGas); _hotspots[kHSBone]._flags = SF_DISABLED | SF_WALKABLE; _gameSys->removeSequence(0x145, 1, true); break; case 0x14B: - setFlag(9); + setFlag(kGFTruckKeysUsed); _hotspots[kHSToy]._flags = SF_DISABLED | SF_WALKABLE; _gameSys->removeSequence(0x146, 1, true); break; diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index a892b84a6d..bfffcbdcc9 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -165,7 +165,7 @@ void GnapEngine::scene13_run() { gnapWalkTo(2, 7, 0, 0x107C0, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(2, 8, -1, -1, 1); - if (isFlag(14) || isFlag(15)) { + if (isFlag(kGFUnk14) || isFlag(15)) { _newSceneNum = 11; } else { setFlag(15); diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp index f9fb3efbe6..4323253a8c 100644 --- a/engines/gnap/scenes/scene15.cpp +++ b/engines/gnap/scenes/scene15.cpp @@ -148,13 +148,13 @@ void GnapEngine::scene15_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(12) || isFlag(13)) + if (isFlag(kGFGnapControlsToyUFO) || isFlag(kGFUnk13)) playSound(0x108E9, 0); else _s15_nextSlotSequenceId = 0xDA; break; case GRAB_CURSOR: - if (isFlag(12) || isFlag(13)) + if (isFlag(kGFGnapControlsToyUFO) || isFlag(kGFUnk13)) _s15_nextSlotSequenceId = 0xD9; else _s15_nextSlotSequenceId = 0xDA; @@ -259,22 +259,22 @@ void GnapEngine::scene15_updateAnimations() { invRemove(kItemQuarter); } else { invRemove(kItemQuarterWithHole); - setFlag(13); + setFlag(kGFUnk13); } setGrabCursorSprite(-1); break; case 0xDB: - setFlag(14); + setFlag(kGFUnk14); setGrabCursorSprite(-1); _s15_nextSlotSequenceId = 0xD8; break; case 0xD9: - if (isFlag(12)) { - clearFlag(12); + if (isFlag(kGFGnapControlsToyUFO)) { + clearFlag(kGFGnapControlsToyUFO); invAdd(kItemQuarter); _newGrabCursorSpriteIndex = kItemQuarter; - } else if (isFlag(13)) { - clearFlag(13); + } else if (isFlag(kGFUnk13)) { + clearFlag(kGFUnk13); invAdd(kItemQuarterWithHole); _newGrabCursorSpriteIndex = kItemQuarterWithHole; } @@ -315,7 +315,7 @@ void GnapEngine::scene15_updateAnimations() { _gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, _s15_currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _s15_currUpperButtonSequenceId = _s15_nextUpperButtonSequenceId; _s15_nextUpperButtonSequenceId = -1; - if (_s15_currLowerButtonSequenceId != -1 && isFlag(14)) { + if (_s15_currLowerButtonSequenceId != -1 && isFlag(kGFUnk14)) { if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) _s15_nextRecordSequenceId = 0xD3; else @@ -329,7 +329,7 @@ void GnapEngine::scene15_updateAnimations() { _gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, _s15_currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _s15_currLowerButtonSequenceId = _s15_nextLowerButtonSequenceId; _s15_nextLowerButtonSequenceId = -1; - if (_s15_currUpperButtonSequenceId != -1 && isFlag(14)) { + if (_s15_currUpperButtonSequenceId != -1 && isFlag(kGFUnk14)) { if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) _s15_nextRecordSequenceId = 0xD3; else diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index c502649c1d..8c07a0aff7 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -129,7 +129,7 @@ void GnapEngine::scene17_run() { _timers[6] = getRandom(30) + 200; _timers[7] = getRandom(100) + 100; - if (isFlag(9)) { + if (isFlag(kGFTruckKeysUsed)) { _gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); } else { if (_s18_garbageCanPos >= 8) { @@ -157,7 +157,7 @@ void GnapEngine::scene17_run() { _s17_currCarWindowSequenceId = 0x244; - if (isFlag(14)) + if (isFlag(kGFUnk14)) _gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); _gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 3e2301e96b..755a9f7585 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -86,8 +86,8 @@ void GnapEngine::scene18_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 800, 448); setHotspot(kHSWalkArea2, 0, 0, 214, 515); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(8)) { - if (isFlag(9)) { + if (isFlag(kGFTruckFilledWithGas)) { + if (isFlag(kGFTruckKeysUsed)) { _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; _hotspots[kHSHydrantRightValve]._x1 = 148; _hotspots[kHSHydrantRightValve]._y1 = 403; @@ -101,7 +101,7 @@ void GnapEngine::scene18_updateHotspots() { _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; _hotspots[kHSHydrantTopValve]._x1 = 105; _hotspots[kHSHydrantTopValve]._x2 = 192; - } else if (isFlag(9)) { + } else if (isFlag(kGFTruckKeysUsed)) { _hotspots[kHSGarbageCan]._x1 = 115; _hotspots[kHSGarbageCan]._y1 = 365; _hotspots[kHSGarbageCan]._x2 = 168; @@ -110,7 +110,7 @@ void GnapEngine::scene18_updateHotspots() { _hotspotsWalkPos[kHSGarbageCan].x = 3; _hotspotsWalkPos[kHSGarbageCan].y = 7; } - if (isFlag(10)) + if (isFlag(kGFPlatyPussDisguised)) _hotspots[kHSGarbageCan]._flags = SF_DISABLED; if (isFlag(26)) { _hotspots[kHSDevice]._flags = SF_DISABLED; @@ -118,7 +118,7 @@ void GnapEngine::scene18_updateHotspots() { _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; _hotspots[kHSPlatypus]._flags = SF_DISABLED; } - if (isFlag(14)) { + if (isFlag(kGFUnk14)) { _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; _hotspots[kHSCowboyHat]._flags = SF_DISABLED; } @@ -236,7 +236,7 @@ void GnapEngine::scene18_putDownGarbageCan(int animationIndex) { _s18_garbageCanPos = _gnapX - 1; else _s18_garbageCanPos = _gnapX + 1; - clearFlag(10); + clearFlag(kGFPlatyPussDisguised); scene18_updateHotspots(); if (_gnapIdleFacing != kDirNone && _gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { _gameSys->insertSequence(0x107BA, _gnapId, @@ -285,9 +285,9 @@ void GnapEngine::scene18_platEndPhoning(bool platFl) { void GnapEngine::scene18_closeHydrantValve() { _gnapActionStatus = kASLeaveScene; updateMouseCursor(); - if (isFlag(8)) { + if (isFlag(kGFTruckFilledWithGas)) { gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - if (isFlag(9)) { + if (isFlag(kGFTruckKeysUsed)) { _gnapActionStatus = kASCloseRightValveWithGarbageCan; scene18_waitForGnapAction(); } else { @@ -319,13 +319,13 @@ void GnapEngine::scene18_run() { queueInsertDeviceIcon(); - clearFlag(10); + clearFlag(kGFPlatyPussDisguised); - if (!isFlag(14)) + if (!isFlag(kGFUnk14)) _gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(9)) { - if (isFlag(8)) { + if (isFlag(kGFTruckKeysUsed)) { + if (isFlag(kGFTruckFilledWithGas)) { _gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); playSound(0x22B, true); @@ -334,7 +334,7 @@ void GnapEngine::scene18_run() { } } else { _gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _s18_garbageCanPos - 40), 0); - if (isFlag(8)) { + if (isFlag(kGFTruckFilledWithGas)) { _gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); playSound(0x22B, true); @@ -372,8 +372,8 @@ void GnapEngine::scene18_run() { } gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { - if (isFlag(12)) { - clearFlag(12); + if (isFlag(kGFGnapControlsToyUFO)) { + clearFlag(kGFGnapControlsToyUFO); setGrabCursorSprite(kItemCowboyHat); _prevSceneNum = 19; } @@ -422,7 +422,7 @@ void GnapEngine::scene18_run() { case kHSPlatypus: if (_gnapActionStatus < 0) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } @@ -455,7 +455,7 @@ void GnapEngine::scene18_run() { _gnapActionStatus = kASGrabCowboyHat; _sceneWaiting = 0; } else if (_gnapActionStatus < 0) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } @@ -480,7 +480,7 @@ void GnapEngine::scene18_run() { case kHSGarbageCan: if (_gnapActionStatus < 0) { - if (isFlag(14)) { + if (isFlag(kGFUnk14)) { if (_grabCursorSpriteIndex >= 0) playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 1, 5); else @@ -489,7 +489,7 @@ void GnapEngine::scene18_run() { if (isFlag(26)) scene18_platEndPhoning(true); if (_grabCursorSpriteIndex >= 0) { - if (!isFlag(9)) + if (!isFlag(kGFTruckKeysUsed)) playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), _hotspotsWalkPos[kHSGarbageCan].y, _hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y); else @@ -497,18 +497,18 @@ void GnapEngine::scene18_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (!isFlag(9)) + if (!isFlag(kGFTruckKeysUsed)) playGnapScratchingHead(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), _hotspotsWalkPos[kHSGarbageCan].y); - else if (!isFlag(8)) + else if (!isFlag(kGFTruckFilledWithGas)) playGnapScratchingHead(2, 4); break; case GRAB_CURSOR: - if (!isFlag(9)) { + if (!isFlag(kGFTruckKeysUsed)) { gnapWalkTo(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), _hotspotsWalkPos[kHSGarbageCan].y, -1, -1, 1); gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _s18_garbageCanPos, _gnapY) | 0x10000, 1); _gnapActionStatus = kASGrabGarbageCanFromStreet; - } else if (!isFlag(8)) { + } else if (!isFlag(kGFTruckFilledWithGas)) { if (gnapWalkTo(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 0, -1, 1)) _gnapActionStatus = kASGrabGarbageCanFromHydrant; } @@ -525,7 +525,7 @@ void GnapEngine::scene18_run() { case kHSHydrantTopValve: if (_gnapActionStatus < 0) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { // While carrying garbage can if (_grabCursorSpriteIndex >= 0) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); @@ -539,7 +539,7 @@ void GnapEngine::scene18_run() { playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (isFlag(8)) { + if (isFlag(kGFTruckFilledWithGas)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); _gnapActionStatus = kASPutGarbageCanOnRunningHydrant; } else if (!isFlag(kGFBarnPadlockOpen)) { @@ -591,20 +591,20 @@ void GnapEngine::scene18_run() { case kHSHydrantRightValve: if (_gnapActionStatus < 0) { - if (isFlag(14)) { + if (isFlag(kGFUnk14)) { if (_grabCursorSpriteIndex == -1) { playGnapImpossible(0, 0); } else { playGnapShowCurrItem(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); } } else { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } if (_grabCursorSpriteIndex == kItemWrench) { gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); - if (isFlag(9)) + if (isFlag(kGFTruckKeysUsed)) _gnapActionStatus = kASOpenRightValveWithGarbageCan; else _gnapActionStatus = kASOpenRightValveNoGarbageCan; @@ -616,9 +616,9 @@ void GnapEngine::scene18_run() { playGnapScratchingHead(1, 5); break; case GRAB_CURSOR: - if (isFlag(8)) { + if (isFlag(kGFTruckFilledWithGas)) { gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - if (isFlag(9)) + if (isFlag(kGFTruckKeysUsed)) _gnapActionStatus = kASCloseRightValveWithGarbageCan; else _gnapActionStatus = kASCloseRightValveNoGarbageCan; @@ -636,7 +636,7 @@ void GnapEngine::scene18_run() { case kHSExitToyStore: if (_gnapActionStatus < 0) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } @@ -655,7 +655,7 @@ void GnapEngine::scene18_run() { case kHSExitPhoneBooth: if (_gnapActionStatus < 0) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } @@ -673,7 +673,7 @@ void GnapEngine::scene18_run() { case kHSExitGrubCity: if (_gnapActionStatus < 0) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } @@ -694,7 +694,7 @@ void GnapEngine::scene18_run() { case kHSWalkArea1: case kHSWalkArea2: if (_gnapActionStatus < 0) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } else { @@ -706,7 +706,7 @@ void GnapEngine::scene18_run() { default: if (_gnapActionStatus != kASStandingOnHydrant && _mouseClickState._left) { - if (isFlag(10)) { + if (isFlag(kGFPlatyPussDisguised)) { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } else { @@ -723,7 +723,7 @@ void GnapEngine::scene18_run() { if (!isSoundPlaying(0x10940)) playSound(0x10940, true); - if ((isFlag(8) || isFlag(kGFBarnPadlockOpen)) && !isSoundPlaying(0x22B) && + if ((isFlag(kGFTruckFilledWithGas) || isFlag(kGFBarnPadlockOpen)) && !isSoundPlaying(0x22B) && _gnapActionStatus != kASOpenRightValveNoGarbageCanDone && _gnapActionStatus != kASOpenRightValveNoGarbageCan && _gnapActionStatus != kASOpenTopValve && _gnapActionStatus != kASOpenTopValveDone && _gnapActionStatus != kASOpenRightValveWithGarbageCan && _gnapActionStatus != kASOpenRightValveWithGarbageCanDone) @@ -757,7 +757,7 @@ void GnapEngine::scene18_run() { } playSoundA(); } - if (!isFlag(10)) + if (!isFlag(kGFPlatyPussDisguised)) updateGnapIdleSequence(); } @@ -773,7 +773,7 @@ void GnapEngine::scene18_run() { } - if (isFlag(12)) + if (isFlag(kGFGnapControlsToyUFO)) deleteSurface(&_s18_cowboyHatSurface); } @@ -798,7 +798,7 @@ void GnapEngine::scene18_updateAnimations() { _gnapSequenceId = 0x1FD; } _gameSys->removeSequence(0x1FA, 19, true); - setFlag(10); + setFlag(kGFPlatyPussDisguised); scene18_updateHotspots(); _gnapActionStatus = -1; break; @@ -807,8 +807,8 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->removeSequence(0x1F9, 19, true); _gnapSequenceDatNum = 0; _gnapSequenceId = 0x1FE; - clearFlag(9); - setFlag(10); + clearFlag(kGFTruckKeysUsed); + setFlag(kGFPlatyPussDisguised); scene18_updateHotspots(); _gnapActionStatus = -1; break; @@ -820,7 +820,7 @@ void GnapEngine::scene18_updateAnimations() { stopSound(0x22B); _gnapSequenceDatNum = 0; _gnapSequenceId = 0x205; - clearFlag(8); + clearFlag(kGFTruckFilledWithGas); invAdd(kItemWrench); setGrabCursorSprite(kItemWrench); scene18_updateHotspots(); @@ -886,11 +886,11 @@ void GnapEngine::scene18_updateAnimations() { _newSceneNum = 18; invAdd(kItemCowboyHat); invAdd(kItemWrench); - setFlag(12); - setFlag(14); - clearFlag(8); - setFlag(9); - setFlag(14); + setFlag(kGFGnapControlsToyUFO); + setFlag(kGFUnk14); + clearFlag(kGFTruckFilledWithGas); + setFlag(kGFTruckKeysUsed); + setFlag(kGFUnk14); // CHECKME - Set 2 times? scene18_updateHotspots(); _gnapActionStatus = kASLeaveScene; break; @@ -899,8 +899,8 @@ void GnapEngine::scene18_updateAnimations() { _gnapActionStatus = -1; break; case kASPutGarbageCanOnRunningHydrant: - setFlag(9); - clearFlag(10); + setFlag(kGFTruckKeysUsed); + clearFlag(kGFPlatyPussDisguised); _gameSys->requestRemoveSequence(0x211, 39); _gameSys->requestRemoveSequence(0x212, 39); _gameSys->insertSequence(0x210, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); @@ -925,7 +925,7 @@ void GnapEngine::scene18_updateAnimations() { break; case kASOpenRightValveNoGarbageCan: case kASOpenRightValveWithGarbageCan: - setFlag(8); + setFlag(kGFTruckFilledWithGas); scene18_updateHotspots(); playGnapPullOutDevice(2, 7); playGnapUseDevice(0, 0); @@ -978,7 +978,7 @@ void GnapEngine::scene18_updateAnimations() { stopSound(0x22B); _gameSys->setAnimation(0x1F9, 19, 0); _gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); - clearFlag(8); + clearFlag(kGFTruckFilledWithGas); invAdd(kItemWrench); setGrabCursorSprite(kItemWrench); _gameSys->insertSequence(0x107B5, _gnapId, 517, _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); @@ -991,8 +991,8 @@ void GnapEngine::scene18_updateAnimations() { _gnapActionStatus = -1; break; case kASPutGarbageCanOnHydrant: - setFlag(9); - clearFlag(10); + setFlag(kGFTruckKeysUsed); + clearFlag(kGFPlatyPussDisguised); _gameSys->insertSequence(0x20F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(0x20F, _gnapId, 0); _gnapSequenceDatNum = 0; diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index beee17be0b..dd8dcfbeb5 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -219,8 +219,8 @@ void GnapEngine::scene20_run() { queueInsertDeviceIcon(); - if (isFlag(11)) { - clearFlag(11); + if (isFlag(kGFSceneFlag1)) { + clearFlag(kGFSceneFlag1); endSceneInit(); _gameSys->setAnimation(0x182, 140, 0); _gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index 01de3e8d55..a01c7e4b77 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -82,7 +82,7 @@ void GnapEngine::scene22_run() { platypusWalkTo(9, 8, -1, 0x107C2, 1); } - if (isFlag(11)) { + if (isFlag(kGFSceneFlag1)) { int storeDetectiveSeqId; setGrabCursorSprite(-1); invRemove(kItemCereals); diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index ebbf46a1da..3ad17c5fa2 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -139,7 +139,7 @@ void GnapEngine::scene23_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(11)) + if (isFlag(kGFSceneFlag1)) playGnapMoan2(0, 0); else { gnapWalkTo(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, @@ -148,13 +148,13 @@ void GnapEngine::scene23_run() { } break; case GRAB_CURSOR: - if (isFlag(11)) + if (isFlag(kGFSceneFlag1)) playGnapImpossible(0, 0); else { _gnapIdleFacing = kDirBottomRight; gnapWalkTo(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - setFlag(11); + setFlag(kGFSceneFlag1); _gnapActionStatus = kASGrabCereals; invAdd(kItemCereals); } diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index e891e255d7..2b7666b4ee 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -63,7 +63,7 @@ void GnapEngine::scene27_updateHotspots() { setHotspot(kHSExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); setHotspot(kHSWalkArea1, 0, 0, 800, 507); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(13)) + if (isFlag(kGFUnk13)) _hotspots[kHSBucket]._flags = SF_DISABLED; _hotspotsCount = 9; } @@ -75,7 +75,7 @@ void GnapEngine::scene27_run() { _timers[7] = getRandom(100) + 300; queueInsertDeviceIcon(); - if (!isFlag(13)) + if (!isFlag(kGFUnk13)) _gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); if (_debugLevel == 4) @@ -339,7 +339,7 @@ void GnapEngine::scene27_updateAnimations() { playGnapUseDevice(0, 0); _hotspots[kHSBucket]._flags = SF_DISABLED; invAdd(kItemEmptyBucket); - setFlag(13); + setFlag(kGFUnk13); _gameSys->setAnimation(0xD2, 39, 0); _gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); _gnapActionStatus = kASGrabBucketDone; diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 3e237fd46f..cad83ae6dd 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -67,7 +67,7 @@ void GnapEngine::scene30_run() { if (isFlag(23)) _gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(13)) + if (!isFlag(kGFUnk13)) _gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); _timers[5] = getRandom(50) + 180; diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index efaf1d9d73..6c50a34706 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -66,7 +66,7 @@ int GnapEngine::scene41_init() { } void GnapEngine::scene41_updateHotspots() { - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); setHotspot(kHSUfoExitLeft, 0, 0, 10, 500, SF_EXIT_L_CURSOR | SF_DISABLED); setHotspot(kHSUfoExitRight, 790, 0, 799, 500, SF_EXIT_R_CURSOR); @@ -88,10 +88,9 @@ void GnapEngine::scene41_updateHotspots() { } void GnapEngine::scene41_run() { - queueInsertDeviceIcon(); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoX = 770; if (_toyUfoY < 0 || _toyUfoY > 300) _toyUfoY = 150; @@ -113,7 +112,7 @@ void GnapEngine::scene41_run() { _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); _gameSys->insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); - if (isFlag(12)) + if (isFlag(kGFGnapControlsToyUFO)) _s41_currKidSequenceId = 0x11B; else _s41_currKidSequenceId = 0x11D; @@ -130,7 +129,7 @@ void GnapEngine::scene41_run() { _gameSys->insertSequence(_s41_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _gnapSequenceId = 0x120; _gnapSequenceDatNum = 0; _gnapIdleFacing = kDirUpRight; @@ -163,11 +162,10 @@ void GnapEngine::scene41_run() { _timers[5] = getRandom(30) + 20; while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) playSound(0x1094B, 1); - if (!isFlag(12)) { + if (!isFlag(kGFGnapControlsToyUFO)) { _hotspots[kHSToyUfo]._x1 = _toyUfoX - 25; _hotspots[kHSToyUfo]._y1 = _toyUfoY - 20; _hotspots[kHSToyUfo]._x2 = _toyUfoX + 25; @@ -182,7 +180,7 @@ void GnapEngine::scene41_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { switch (_sceneClickedHotspot) { @@ -339,10 +337,9 @@ void GnapEngine::scene41_run() { gnapWalkTo(-1, -1, -1, -1, 1); break; } - } - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { if (!_timers[9] && _gnapActionStatus < 0) { _gnapActionStatus = kASGiveBackToyUfo; if (_gnapSequenceId == 0x121 || _gnapSequenceId == 0x122) { @@ -356,7 +353,7 @@ void GnapEngine::scene41_run() { if (_mouseClickState._left && _gnapActionStatus < 0) { _mouseClickState._left = false; - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { int sequenceId; if (_leftClickMouseX >= 400) { if (_gnapSequenceId == 0x11F || _gnapSequenceId == 0x120 || _gnapSequenceId == 0x123 || _gnapSequenceId == 0x126) @@ -389,7 +386,7 @@ void GnapEngine::scene41_run() { if (!_isLeavingScene) { if (_beaverActionStatus < 0) updateBeaverIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(12)) + if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(100) + 100; @@ -412,7 +409,7 @@ void GnapEngine::scene41_run() { if (!_timers[5]) { _timers[5] = getRandom(30) + 20; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { - if (isFlag(12)) + if (isFlag(kGFGnapControlsToyUFO)) _s41_nextKidSequenceId = 0x11B; else if (getRandom(3) != 0) _s41_nextKidSequenceId = 0x11D; @@ -481,7 +478,7 @@ void GnapEngine::scene41_updateAnimations() { _s41_nextKidSequenceId = 0x11B; _timers[5] = getRandom(30) + 20; _gnapActionStatus = -1; - setFlag(12); + setFlag(kGFGnapControlsToyUFO); scene41_updateHotspots(); _timers[9] = 600; } @@ -532,7 +529,7 @@ void GnapEngine::scene41_updateAnimations() { _s41_nextKidSequenceId = -1; _timers[5] = getRandom(30) + 20; _gnapActionStatus = -1; - clearFlag(12); + clearFlag(kGFGnapControlsToyUFO); scene41_updateHotspots(); } break; diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 3aaedc8dc0..94a59e7eb4 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -66,7 +66,7 @@ int GnapEngine::scene42_init() { } void GnapEngine::scene42_updateHotspots() { - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); @@ -99,7 +99,7 @@ void GnapEngine::scene42_run() { _gameSys->setAnimation(0x14A, 1, 2); _gameSys->insertSequence(_s42_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoId = 0; _toyUfoActionStatus = -1; if (_prevSceneNum == 43 && isFlag(18)) { @@ -157,7 +157,7 @@ void GnapEngine::scene42_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { switch (_sceneClickedHotspot) { @@ -310,7 +310,7 @@ void GnapEngine::scene42_run() { if (_mouseClickState._left && _gnapActionStatus < 0) { _mouseClickState._left = false; - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoActionStatus = kASToyUfoRefresh; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { @@ -323,9 +323,9 @@ void GnapEngine::scene42_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(12)) + if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateBeaverIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(12)) + if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 30; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index b4fe5bb751..47931857ed 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -55,7 +55,7 @@ int GnapEngine::scene43_init() { } void GnapEngine::scene43_updateHotspots() { - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); @@ -65,7 +65,7 @@ void GnapEngine::scene43_updateHotspots() { if (isFlag(19)) _hotspots[kHSUfoBucket]._flags = SF_GRAB_CURSOR; // NOTE Bug in the original. Key hotspot wasn't disabled. - if (isFlag(14)) + if (isFlag(kGFUnk14)) _hotspots[kHSUfoKey]._flags = SF_DISABLED; _hotspotsCount = 6; } else { @@ -79,7 +79,7 @@ void GnapEngine::scene43_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 800, 445); setHotspot(kHSWalkArea2, 465, 0, 800, 493); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(14)) + if (isFlag(kGFUnk14)) _hotspots[kHSKey]._flags = SF_DISABLED; _hotspotsCount = 10; } @@ -89,7 +89,7 @@ void GnapEngine::scene43_run() { queueInsertDeviceIcon(); - if (!isFlag(14)) + if (!isFlag(kGFUnk14)) _gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); _s43_currTwoHeadedGuySequenceId = 0x13C; @@ -98,7 +98,7 @@ void GnapEngine::scene43_run() { _gameSys->setAnimation(0x13C, 1, 2); _gameSys->insertSequence(_s43_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoId = 0; _toyUfoActionStatus = -1; _toyUfoSequenceId = toyUfoGetSequenceId(); @@ -155,7 +155,7 @@ void GnapEngine::scene43_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { switch (_sceneClickedHotspot) { @@ -306,14 +306,12 @@ void GnapEngine::scene43_run() { if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); break; - } - } if (_mouseClickState._left && _gnapActionStatus < 0) { _mouseClickState._left = false; - if (isFlag(12) && (_toyUfoActionStatus == 5 || _toyUfoActionStatus == -1)) { + if (isFlag(kGFGnapControlsToyUFO) && (_toyUfoActionStatus == 5 || _toyUfoActionStatus == -1)) { _toyUfoActionStatus = 5; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { @@ -326,11 +324,11 @@ void GnapEngine::scene43_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(12)) + if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateBeaverIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(12)) + if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); - if (!_timers[4] && (!isFlag(12) || !isFlag(19))) { + if (!_timers[4] && (!isFlag(kGFGnapControlsToyUFO) || !isFlag(19))) { _timers[4] = getRandom(100) + 100; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { switch (getRandom(5)) { @@ -370,7 +368,7 @@ void GnapEngine::scene43_run() { } if (_newSceneNum == 54) - clearFlag(12); + clearFlag(kGFGnapControlsToyUFO); } @@ -439,7 +437,7 @@ void GnapEngine::scene43_updateAnimations() { case 6: _gameSys->insertSequence(0x10871, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); _gameSys->removeSequence(0x1086F, 1, true); - setFlag(14); + setFlag(kGFUnk14); scene43_updateHotspots(); toyUfoSetStatus(18); _toyUfoSequenceId = 0x871; diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index f6644313c8..6e8a12ada8 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -54,7 +54,7 @@ int GnapEngine::scene44_init() { } void GnapEngine::scene44_updateHotspots() { - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); @@ -71,7 +71,7 @@ void GnapEngine::scene44_updateHotspots() { setHotspot(kHSWalkArea1, 0, 0, 800, 445); setHotspot(kHSWalkArea2, 617, 0, 800, 600); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(13)) + if (isFlag(kGFUnk13)) _hotspots[kHSKissingLady]._flags = SF_DISABLED; if (isFlag(15)) _hotspots[kHSSpring]._flags = SF_DISABLED; @@ -94,7 +94,7 @@ void GnapEngine::scene44_run() { _gameSys->setAnimation(_s44_currSpringGuySequenceId, 1, 4); _gameSys->insertSequence(_s44_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(13)) { + if (isFlag(kGFUnk13)) { if (_prevSceneNum != 50 || _sceneSavegameLoaded) { _s44_currKissingLadySequenceId = 0xF6; _s44_nextKissingLadySequenceId = -1; @@ -112,7 +112,7 @@ void GnapEngine::scene44_run() { _gameSys->insertSequence(_s44_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoId = 0; _toyUfoActionStatus = -1; _toyUfoSequenceId = toyUfoGetSequenceId(); @@ -144,7 +144,7 @@ void GnapEngine::scene44_run() { initGnapPos(4, 8, kDirBottomRight); if (_sceneSavegameLoaded) { initBeaverPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, kDirUnk4); - } else if (!isFlag(13)) { + } else if (!isFlag(kGFUnk13)) { _timers[0] = 50; _timers[1] = 20; _platX = 5; @@ -179,10 +179,8 @@ void GnapEngine::scene44_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (isFlag(12)) { - + if (isFlag(kGFGnapControlsToyUFO)) { switch (_sceneClickedHotspot) { - case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { _isLeavingScene = 1; @@ -351,12 +349,11 @@ void GnapEngine::scene44_run() { break; } - } if (_mouseClickState._left && _gnapActionStatus < 0) { _mouseClickState._left = false; - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoActionStatus = 7; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { @@ -369,9 +366,9 @@ void GnapEngine::scene44_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(12) && _s44_currKissingLadySequenceId != 0xF5) + if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO) && _s44_currKissingLadySequenceId != 0xF5) updateBeaverIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(12)) + if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 20; diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 36943623d2..55f6326577 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -54,7 +54,7 @@ int GnapEngine::scene45_init() { } void GnapEngine::scene45_updateHotspots() { - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); setHotspot(kHSUfoExitRight, 794, 0, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED); @@ -97,7 +97,7 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(_s45_currDancerSequenceId, 1, 2); _gameSys->insertSequence(_s45_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoId = 0; _toyUfoActionStatus = -1; _toyUfoSequenceId = toyUfoGetSequenceId(); @@ -138,7 +138,7 @@ void GnapEngine::scene45_run() { gnapWalkTo(2, 7, -1, 0x107B9, 1); } - if (!isFlag(21) && !isFlag(12)) { + if (!isFlag(21) && !isFlag(kGFGnapControlsToyUFO)) { setFlag(21); setGrabCursorSprite(-1); _gameSys->setAnimation(0x9D, _gnapId, 0); @@ -193,7 +193,7 @@ void GnapEngine::scene45_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { switch (_sceneClickedHotspot) { @@ -328,7 +328,7 @@ void GnapEngine::scene45_run() { if (_mouseClickState._left && _gnapActionStatus < 0) { _mouseClickState._left = false; - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoActionStatus = 3; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); } else { @@ -339,7 +339,7 @@ void GnapEngine::scene45_run() { scene45_updateAnimations(); toyUfoCheckTimer(); - if (!_isLeavingScene && _gnapActionStatus < 0 && !isFlag(12)) + if (!_isLeavingScene && _gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); checkGameKeys(); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index f7fdc87efd..29a8608273 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -53,7 +53,7 @@ int GnapEngine::scene46_init() { } void GnapEngine::scene46_updateHotspots() { - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); @@ -88,7 +88,7 @@ void GnapEngine::scene46_run() { _gameSys->setAnimation(0x47, 1, 4); _gameSys->insertSequence(_s46_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoId = 0; _toyUfoActionStatus = -1; _toyUfoSequenceId = toyUfoGetSequenceId(); @@ -136,7 +136,7 @@ void GnapEngine::scene46_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { switch (_sceneClickedHotspot) { @@ -268,7 +268,7 @@ void GnapEngine::scene46_run() { if (_mouseClickState._left && _gnapActionStatus < 0) { _mouseClickState._left = false; - if (isFlag(12)) { + if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoActionStatus = 4; toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { @@ -281,9 +281,9 @@ void GnapEngine::scene46_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(12)) + if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateBeaverIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(12)) + if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(50) + 80; diff --git a/engines/gnap/scenes/scene50.cpp b/engines/gnap/scenes/scene50.cpp index cd5b700b9f..2ec842af7a 100644 --- a/engines/gnap/scenes/scene50.cpp +++ b/engines/gnap/scenes/scene50.cpp @@ -61,7 +61,7 @@ void GnapEngine::scene50_playWinAnim(int tongueNum, bool fightOver) { scene50_waitForAnim(6); scene50_waitForAnim(5); invAdd(kItemGum); - setFlag(13); + setFlag(kGFUnk13); } else { _gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 734c7371a9..20d591fa9f 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -588,7 +588,7 @@ void GnapEngine::runSceneLogic() { } else if (_prevSceneNum == 13) { scene47_initCutscene2(); _newSceneNum = 11; - } else if (!isFlag(10) && _prevSceneNum == 2) {//CHECKME + } else if (!isFlag(kGFPlatyPussDisguised) && _prevSceneNum == 2) {//CHECKME if (isFlag(25)) { scene47_initCutscene3(); _newSceneNum = 2; @@ -604,7 +604,7 @@ void GnapEngine::runSceneLogic() { } else if (_prevSceneNum == 30) { scene47_initCutscene6(); _newSceneNum = 26; - } else if (isFlag(10) && _cursorValue == 1) { + } else if (isFlag(kGFPlatyPussDisguised) && _cursorValue == 1) { scene47_initCutscene7(); _newSceneNum = 4; } -- cgit v1.2.3 From 11c0fa8fed6d19bddc112a9d378f7895d4b7e21f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Apr 2016 21:34:28 +0200 Subject: GNAP: Replace more flags values by enums (WIP) --- engines/gnap/gnap.cpp | 26 +++++++++++++------------- engines/gnap/scenes/scene13.cpp | 4 ++-- engines/gnap/scenes/scene17.cpp | 40 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene18.cpp | 2 +- engines/gnap/scenes/scene19.cpp | 8 ++++---- engines/gnap/scenes/scene20.cpp | 8 ++++---- engines/gnap/scenes/scene26.cpp | 2 +- engines/gnap/scenes/scene28.cpp | 22 +++++++++++----------- engines/gnap/scenes/scene30.cpp | 12 ++++++------ engines/gnap/scenes/scene40.cpp | 2 +- engines/gnap/scenes/scene41.cpp | 2 +- engines/gnap/scenes/scene42.cpp | 10 +++++----- engines/gnap/scenes/scene43.cpp | 10 +++++----- engines/gnap/scenes/scene44.cpp | 12 ++++++------ engines/gnap/scenes/scene45.cpp | 18 +++++++++--------- engines/gnap/scenes/scene53.cpp | 12 ++++++------ engines/gnap/scenes/scene54.cpp | 2 +- 17 files changed, 96 insertions(+), 96 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 631f70c333..e408cd821d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2175,27 +2175,27 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ } void GnapEngine::toyUfoSetStatus(int flagNum) { - clearFlag(16); - clearFlag(17); - clearFlag(18); - clearFlag(19); + clearFlag(kGFUnk16); + clearFlag(kGFJointTaken); + clearFlag(kGFUnk18); + clearFlag(kGFGroceryStoreHatTaken); setFlag(flagNum); } int GnapEngine::toyUfoGetSequenceId() { - if (isFlag(16)) + if (isFlag(kGFUnk16)) return 0x84E; - if (isFlag(17)) + if (isFlag(kGFJointTaken)) return 0x84B; - if (isFlag(18)) + if (isFlag(kGFUnk18)) return 0x84D; - if (isFlag(19)) + if (isFlag(kGFGroceryStoreHatTaken)) return 0x84C; return 0x84E; } bool GnapEngine::toyUfoCheckTimer() { - if (!isFlag(kGFGnapControlsToyUFO) || isFlag(18) || _timers[9] || + if (!isFlag(kGFGnapControlsToyUFO) || isFlag(kGFUnk18) || _timers[9] || _toyUfoSequenceId == 0x870 || _toyUfoSequenceId == 0x871 || _toyUfoSequenceId == 0x872 || _toyUfoSequenceId == 0x873) return false; _sceneDone = true; @@ -2273,13 +2273,13 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, if (i - 1 > 0) { int seqId; - if (isFlag(16)) + if (isFlag(kGFUnk16)) seqId = 0x867; - else if (isFlag(17)) + else if (isFlag(kGFJointTaken)) seqId = 0x84F; - else if (isFlag(18)) + else if (isFlag(kGFUnk18)) seqId = 0x85F; - else if (isFlag(19)) + else if (isFlag(kGFGroceryStoreHatTaken)) seqId = 0x857; v16[0].sequenceId = seqId; v16[0].id = 0; diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index bfffcbdcc9..8a04b2dda9 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -165,10 +165,10 @@ void GnapEngine::scene13_run() { gnapWalkTo(2, 7, 0, 0x107C0, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(2, 8, -1, -1, 1); - if (isFlag(kGFUnk14) || isFlag(15)) { + if (isFlag(kGFUnk14) || isFlag(kGFSpringTaken)) { _newSceneNum = 11; } else { - setFlag(15); + setFlag(kGFSpringTaken); _newSceneNum = 47; } break; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index 8c07a0aff7..fa18a225ac 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -145,7 +145,7 @@ void GnapEngine::scene17_run() { } } - if (isFlag(19)) + if (isFlag(kGFGroceryStoreHatTaken)) _gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); queueInsertDeviceIcon(); @@ -172,7 +172,7 @@ void GnapEngine::scene17_run() { _s17_canTryGetWrench = true; - if (isFlag(18)) + if (isFlag(kGFUnk18)) _gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); if (_prevSceneNum == 53 || _prevSceneNum == 18 || _prevSceneNum == 20 || _prevSceneNum == 19) { @@ -192,8 +192,8 @@ void GnapEngine::scene17_run() { _beaverSequenceId = 0x25A; _beaverSequenceDatNum = 0; endSceneInit(); - clearFlag(15); - clearFlag(16); + clearFlag(kGFSpringTaken); + clearFlag(kGFUnk16); _beaverActionStatus = kASPlatPhoningAssistant; scene17_platHangUpPhone(); _gameSys->setAnimation(0, 0, 4); @@ -201,8 +201,8 @@ void GnapEngine::scene17_run() { clearFlag(27); scene17_updateHotspots(); } else if (isFlag(25)) { - clearFlag(15); - clearFlag(16); + clearFlag(kGFSpringTaken); + clearFlag(kGFUnk16); initBeaverPos(7, 9, kDirNone); _gnapX = _hotspotsWalkPos[2].x; _gnapY = _hotspotsWalkPos[2].y; @@ -217,8 +217,8 @@ void GnapEngine::scene17_run() { _gameSys->setAnimation(0x257, 254, 0); _gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); } else if (isFlag(26)) { - clearFlag(15); - clearFlag(16); + clearFlag(kGFSpringTaken); + clearFlag(kGFUnk16); _sceneWaiting = true; initGnapPos(3, 9, kDirUpLeft); _platX = _hotspotsWalkPos[2].x; @@ -240,7 +240,7 @@ void GnapEngine::scene17_run() { platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { - if (isFlag(15)) { + if (isFlag(kGFSpringTaken)) { initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, kDirBottomRight); initBeaverPos(1, 9, kDirNone); endSceneInit(); @@ -249,8 +249,8 @@ void GnapEngine::scene17_run() { initBeaverPos(1, 7, kDirNone); endSceneInit(); } - clearFlag(15); - clearFlag(16); + clearFlag(kGFSpringTaken); + clearFlag(kGFUnk16); endSceneInit(); } } else { @@ -372,7 +372,7 @@ void GnapEngine::scene17_run() { playGnapScratchingHead(1, 3); break; case GRAB_CURSOR: - if (isFlag(18)) { + if (isFlag(kGFUnk18)) { scene17_platHangUpPhone(); gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y) | 0x10000, 1); _gnapActionStatus = kASGetCoinFromPhone; @@ -383,13 +383,13 @@ void GnapEngine::scene17_run() { playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(18)) { + if (isFlag(kGFUnk18)) { scene17_platHangUpPhone(); _isLeavingScene = true; gnapUseDeviceOnBeaver(); _beaverFacing = kDirUpLeft; platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); - setFlag(16); + setFlag(kGFUnk16); _beaverActionStatus = kASPlatUsePhone; _gnapActionStatus = kASPlatUsePhone; } else @@ -413,13 +413,13 @@ void GnapEngine::scene17_run() { playGnapScratchingHead(1, 3); break; case GRAB_CURSOR: - if (isFlag(18)) { + if (isFlag(kGFUnk18)) { scene17_platHangUpPhone(); _isLeavingScene = true; _gnapIdleFacing = kDirUpLeft; gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGnapUsePhone; - setFlag(15); + setFlag(kGFSpringTaken); } else playGnapImpossible(0, 0); break; @@ -427,13 +427,13 @@ void GnapEngine::scene17_run() { playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(18)) { + if (isFlag(kGFUnk18)) { scene17_platHangUpPhone(); _isLeavingScene = true; gnapUseDeviceOnBeaver(); _beaverFacing = kDirUpLeft; platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); - setFlag(16); + setFlag(kGFUnk16); _beaverActionStatus = kASPlatUsePhone; _gnapActionStatus = kASPlatUsePhone; } else @@ -603,7 +603,7 @@ void GnapEngine::scene17_updateAnimations() { _gameSys->setAnimation(0x250, 100, 0); _gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); invAdd(kItemDiceQuarterHole); - clearFlag(18); + clearFlag(kGFUnk18); _gnapActionStatus = kASGetCoinFromPhoneDone; break; case kASGetCoinFromPhoneDone: @@ -617,7 +617,7 @@ void GnapEngine::scene17_updateAnimations() { _gnapSequenceId = 0x24C; invRemove(kItemDiceQuarterHole); setGrabCursorSprite(-1); - setFlag(18); + setFlag(kGFUnk18); _gnapActionStatus = kASPutCoinIntoPhoneDone; break; case kASPutCoinIntoPhoneDone: diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 755a9f7585..3676ada91a 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -640,7 +640,7 @@ void GnapEngine::scene18_run() { scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); scene18_putDownGarbageCan(0); } - if (isFlag(20)) { + if (isFlag(kGFPictureTaken)) { playGnapImpossible(0, 0); } else { _isLeavingScene = 1; diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index 9dfd69eec5..ba6ab19e48 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -106,7 +106,7 @@ void GnapEngine::scene19_run() { _gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(20)) + if (!isFlag(kGFPictureTaken)) _gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(26)) { @@ -203,7 +203,7 @@ void GnapEngine::scene19_run() { playGnapScratchingHead(6, 2); break; case GRAB_CURSOR: - if (!isFlag(20)) { + if (!isFlag(kGFPictureTaken)) { gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y) | 0x10000, 1); _gnapActionStatus = kASGrabPicture; } @@ -316,7 +316,7 @@ void GnapEngine::scene19_run() { _timers[6] = getRandom(40) + 50; if (getRandom(4) != 0) { _s19_nextShopAssistantSequenceId = 0x64; - } else if (isFlag(20)) { + } else if (isFlag(kGFPictureTaken)) { _s19_nextShopAssistantSequenceId = 0x64; } else { _s19_nextShopAssistantSequenceId = 0x6C; @@ -373,7 +373,7 @@ void GnapEngine::scene19_updateAnimations() { _gameSys->setAnimation(0x68, 19, 0); _gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); invAdd(kItemPicture); - setFlag(20); + setFlag(kGFPictureTaken); scene19_updateHotspots(); _gnapActionStatus = kASGrabPictureDone; break; diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index dd8dcfbeb5..2301d2994e 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -96,7 +96,7 @@ void GnapEngine::scene20_updateAnimationsCb() { _s20_currStonerGuySequenceId = 0x16A; _s20_nextStonerGuySequenceId = -1; invAdd(kItemJoint); - setFlag(17); + setFlag(kGFJointTaken); _s20_stonerGuyShowingJoint = false; _gnapActionStatus = kASGrabJointDone; break; @@ -212,7 +212,7 @@ void GnapEngine::scene20_run() { _gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); _timers[5] = getRandom(50) + 130; - if (isFlag(19)) + if (isFlag(kGFGroceryStoreHatTaken)) _gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); else _gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); @@ -404,7 +404,7 @@ void GnapEngine::scene20_run() { case TALK_CURSOR: _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - if (isFlag(17)) + if (isFlag(kGFJointTaken)) _gnapActionStatus = kASTalkStonerGuyNoJoint; else _gnapActionStatus = kASTalkStonerGuyHasJoint; @@ -639,7 +639,7 @@ void GnapEngine::scene20_updateAnimations() { break; case kASSwitchGroceryStoreHatDone: _gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); - setFlag(19); + setFlag(kGFGroceryStoreHatTaken); hideCursor(); setGrabCursorSprite(-1); addFullScreenSprite(0x12C, 255); diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index fb2e0cca7e..55b5b0774a 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -43,7 +43,7 @@ enum { }; int GnapEngine::scene26_init() { - return isFlag(23) ? 0x61 : 0x60; + return isFlag(kGFUnk23) ? 0x61 : 0x60; } void GnapEngine::scene26_updateHotspots() { diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index a2831e9f5b..d175fdfd24 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -66,7 +66,7 @@ void GnapEngine::scene28_updateHotspots() { setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (invHas(kItemHorn)) _hotspots[kHSHorn]._flags = SF_DISABLED; - if (isFlag(22)) + if (isFlag(kGFUnk22)) _hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspotsCount = 8; } @@ -78,11 +78,11 @@ void GnapEngine::scene28_run() { queueInsertDeviceIcon(); _gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(22)) + if (isFlag(kGFUnk22)) _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); if (isFlag(kGFMudTaken)) { - if (isFlag(21)) { + if (isFlag(kGFUnk21)) { _gameSys->setAnimation(0x11C, 39, 3); _gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); if (!invHas(kItemHorn)) @@ -170,7 +170,7 @@ void GnapEngine::scene28_run() { playGnapScratchingHead(2, 4); break; case GRAB_CURSOR: - if (isFlag(21)) { + if (isFlag(kGFUnk21)) { if (!invHas(kItemHorn)) { gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); _gnapActionStatus = kASGrabHornSuccess; @@ -195,7 +195,7 @@ void GnapEngine::scene28_run() { case kHSClown: if (_gnapActionStatus < 0) { - if (isFlag(21)) { + if (isFlag(kGFUnk21)) { if (_verbCursor == LOOK_CURSOR) playGnapScratchingHead(5, 2); else @@ -249,7 +249,7 @@ void GnapEngine::scene28_run() { if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex >= 0) { playGnapShowItem(_grabCursorSpriteIndex, 8, 6); - } else if (isFlag(21)) { + } else if (isFlag(kGFUnk21)) { playGnapImpossible(8, 6); } else { switch (_verbCursor) { @@ -294,7 +294,7 @@ void GnapEngine::scene28_run() { updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 80; - if (_gnapActionStatus < 0 && !isFlag(21)) + if (_gnapActionStatus < 0 && !isFlag(kGFUnk21)) _s28_nextClownSequenceId = 0x114; } } @@ -319,7 +319,7 @@ void GnapEngine::scene28_updateAnimations() { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { case kASUseBeerBucketWithClown: - setFlag(22); + setFlag(kGFUnk22); _s28_nextClownSequenceId = 0x113; invRemove(kItemBucketWithBeer); scene28_updateHotspots(); @@ -327,8 +327,8 @@ void GnapEngine::scene28_updateAnimations() { case kASUsePillBucketWithClown: _s28_nextClownSequenceId = 0x116; invRemove(kItemBucketWithPill); - setFlag(22); - setFlag(21); + setFlag(kGFUnk22); + setFlag(kGFUnk21); scene28_updateHotspots(); break; case kASGrabHornFails: @@ -365,7 +365,7 @@ void GnapEngine::scene28_updateAnimations() { break; case kASGrabEmptyBucketDone: setGrabCursorSprite(kItemEmptyBucket); - clearFlag(22);; + clearFlag(kGFUnk22);; scene28_updateHotspots(); invAdd(kItemEmptyBucket); _gnapActionStatus = -1; diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index cad83ae6dd..6b9504d615 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -44,7 +44,7 @@ enum { }; int GnapEngine::scene30_init() { - return isFlag(23) ? 0x10B : 0x10A; + return isFlag(kGFUnk23) ? 0x10B : 0x10A; } void GnapEngine::scene30_updateHotspots() { @@ -64,7 +64,7 @@ void GnapEngine::scene30_run() { queueInsertDeviceIcon(); - if (isFlag(23)) + if (isFlag(kGFUnk23)) _gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); if (!isFlag(kGFUnk13)) @@ -126,7 +126,7 @@ void GnapEngine::scene30_run() { case kHSPillMachine: if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDiceQuarterHole && !isFlag(23)) { + if (_grabCursorSpriteIndex == kItemDiceQuarterHole && !isFlag(kGFUnk23)) { _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; @@ -203,7 +203,7 @@ void GnapEngine::scene30_run() { if (!_timers[5]) { _timers[5] = getRandom(50) + 180; if (_gnapActionStatus < 0) { - if (!isFlag(23) || hasTakenPill) + if (!isFlag(kGFUnk23) || hasTakenPill) _gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else _gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); @@ -257,7 +257,7 @@ void GnapEngine::scene30_updateAnimations() { showCursor(); _gnapActionStatus = kASUsePillMachine3; invAdd(kItemPill); - setFlag(23); + setFlag(kGFUnk23); break; case kASUsePillMachine3: _gameSys->setAnimation(0x104, _gnapId, 0); @@ -273,7 +273,7 @@ void GnapEngine::scene30_updateAnimations() { _gnapActionStatus = -1; break; case kASLookPillMachine: - if (isFlag(23)) + if (isFlag(kGFUnk23)) showFullScreenSprite(0xE3); else showFullScreenSprite(0xE2); diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index 99b62f6330..fe95742f0f 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -41,7 +41,7 @@ enum { int GnapEngine::scene40_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); - return isFlag(23) ? 0x01 : 0x00; + return isFlag(kGFUnk23) ? 0x01 : 0x00; } void GnapEngine::scene40_updateHotspots() { diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 6c50a34706..92222b5f60 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -97,7 +97,7 @@ void GnapEngine::scene41_run() { if (!_timers[9]) _gnapActionStatus = kASGiveBackToyUfo; } else { - if (!isFlag(16) && !isFlag(17) && !isFlag(18) && !isFlag(19)) + if (!isFlag(kGFUnk16) && !isFlag(kGFJointTaken) && !isFlag(kGFUnk18) && !isFlag(kGFGroceryStoreHatTaken)) toyUfoSetStatus(16); _toyUfoX = 600; _toyUfoY = 200; diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 94a59e7eb4..7e032e4808 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -60,7 +60,7 @@ int GnapEngine::scene42_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); _gameSys->setAnimation(0, 0, 2); - if (isFlag(20) || (isFlag(18) && isFlag(23))) + if (isFlag(kGFPictureTaken) || (isFlag(kGFUnk18) && isFlag(kGFUnk23))) return 0x153; return 0x152; } @@ -72,7 +72,7 @@ void GnapEngine::scene42_updateHotspots() { setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); setHotspot(kHSUfoHotSauce, 335, 110, 440, 175, SF_DISABLED); setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - if ((isFlag(20) || isFlag(18)) && isFlag(23) && !isFlag(24)) + if ((isFlag(kGFPictureTaken) || isFlag(kGFUnk18)) && isFlag(kGFUnk23) && !isFlag(24)) _hotspots[kHSUfoHotSauce]._flags = SF_GRAB_CURSOR; _hotspotsCount = 5; } else { @@ -102,14 +102,14 @@ void GnapEngine::scene42_run() { if (isFlag(kGFGnapControlsToyUFO)) { _toyUfoId = 0; _toyUfoActionStatus = -1; - if (_prevSceneNum == 43 && isFlag(18)) { + if (_prevSceneNum == 43 && isFlag(kGFUnk18)) { _toyUfoSequenceId = 0x872; _toyUfoNextSequenceId = toyUfoGetSequenceId(); _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, 0, 0); _toyUfoX = 317; _toyUfoY = 61; toyUfoSetStatus(17); - setFlag(20); + setFlag(kGFPictureTaken); _timers[9] = 600; } else { _toyUfoSequenceId = toyUfoGetSequenceId(); @@ -180,7 +180,7 @@ void GnapEngine::scene42_run() { break; case kHSUfoHotSauce: - if (isFlag(17)) { + if (isFlag(kGFJointTaken)) { _toyUfoActionStatus = kASToyUfoPickUpHotSauce; toyUfoFlyTo(384, 77, 0, 799, 0, 300, 3); _timers[9] = 600; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 47931857ed..a421482ce3 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -62,7 +62,7 @@ void GnapEngine::scene43_updateHotspots() { setHotspot(kHSUfoKey, 140, 170, 185, 260, SF_GRAB_CURSOR); setHotspot(kHSUfoBucket, 475, 290, 545, 365, SF_DISABLED); setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - if (isFlag(19)) + if (isFlag(kGFGroceryStoreHatTaken)) _hotspots[kHSUfoBucket]._flags = SF_GRAB_CURSOR; // NOTE Bug in the original. Key hotspot wasn't disabled. if (isFlag(kGFUnk14)) @@ -184,7 +184,7 @@ void GnapEngine::scene43_run() { break; case kHSUfoKey: - if (isFlag(17)) { + if (isFlag(kGFJointTaken)) { _toyUfoActionStatus = 6; toyUfoFlyTo(163, 145, 0, 799, 0, 300, 3); } else { @@ -328,7 +328,7 @@ void GnapEngine::scene43_run() { updateBeaverIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); - if (!_timers[4] && (!isFlag(kGFGnapControlsToyUFO) || !isFlag(19))) { + if (!_timers[4] && (!isFlag(kGFGnapControlsToyUFO) || !isFlag(kGFGroceryStoreHatTaken))) { _timers[4] = getRandom(100) + 100; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { switch (getRandom(5)) { @@ -407,7 +407,7 @@ void GnapEngine::scene43_updateAnimations() { if (_gameSys->getAnimationStatus(2) == 2) { if (_s43_currTwoHeadedGuySequenceId == 0x13A) { - if (isFlag(19)) { + if (isFlag(kGFGroceryStoreHatTaken)) { _s43_nextTwoHeadedGuySequenceId = 0x13E; stopSound(0x108F6); } else if (getRandom(2) != 0) { @@ -451,7 +451,7 @@ void GnapEngine::scene43_updateAnimations() { _toyUfoSequenceId = 0x874; _gameSys->setAnimation(0x10874, _toyUfoId, 3); _toyUfoActionStatus = 8; - setFlag(17); + setFlag(kGFJointTaken); _gnapActionStatus = 3; break; case 8: diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 6e8a12ada8..48dd1fdee1 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -73,7 +73,7 @@ void GnapEngine::scene44_updateHotspots() { setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(kGFUnk13)) _hotspots[kHSKissingLady]._flags = SF_DISABLED; - if (isFlag(15)) + if (isFlag(kGFSpringTaken)) _hotspots[kHSSpring]._flags = SF_DISABLED; _hotspotsCount = 10; } @@ -85,7 +85,7 @@ void GnapEngine::scene44_run() { _gameSys->insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); _gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(15)) + if (isFlag(kGFSpringTaken)) _s44_currSpringGuySequenceId = 0xF8; else _s44_currSpringGuySequenceId = 0xF9; @@ -306,7 +306,7 @@ void GnapEngine::scene44_run() { playGnapUseDevice(8, 0); _s44_nextSpringGuySequenceId = 0xFB; invAdd(kItemSpring); - setFlag(15); + setFlag(kGFSpringTaken); scene44_updateHotspots(); break; case TALK_CURSOR: @@ -325,7 +325,7 @@ void GnapEngine::scene44_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - if (isFlag(15)) + if (isFlag(kGFSpringTaken)) playGnapMoan1(8, 7); else playGnapScratchingHead(8, 7); @@ -401,10 +401,10 @@ void GnapEngine::scene44_run() { _timers[5] = getRandom(20) + 20; if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { if (getRandom(5) != 0) { - if (!isFlag(15)) + if (!isFlag(kGFSpringTaken)) _s44_nextSpringGuySequenceId = 0xF9; } else { - if (isFlag(15)) + if (isFlag(kGFSpringTaken)) _s44_nextSpringGuySequenceId = 0xF8; else _s44_nextSpringGuySequenceId = 0xFA; diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 55f6326577..daad788055 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -50,7 +50,7 @@ int GnapEngine::scene45_init() { _gameSys->setAnimation(0, 0, 3); _gameSys->setAnimation(0, 0, 4); _gameSys->setAnimation(0, 0, 5); - return isFlag(23) ? 0xA2 : 0xA1; + return isFlag(kGFUnk23) ? 0xA2 : 0xA1; } void GnapEngine::scene45_updateHotspots() { @@ -69,14 +69,14 @@ void GnapEngine::scene45_updateHotspots() { setHotspot(kHSDiscoBall, 370, 10, 470, 125, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); setHotspot(kHSWalkArea1, 0, 0, 800, 472); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(22)) { + if (isFlag(kGFUnk22)) { _hotspots[kHSPlatypus]._flags = SF_DISABLED; _hotspots[kHSExitUfoParty]._flags = SF_DISABLED; _hotspots[kHSExitShoe]._flags = SF_DISABLED; _hotspots[kHSExitRight]._flags = SF_DISABLED; _hotspots[kHSExitDiscoBall]._flags = SF_EXIT_U_CURSOR; } - if (isFlag(23) || isFlag(22)) + if (isFlag(kGFUnk23) || isFlag(kGFUnk22)) _hotspots[kHSDiscoBall]._flags = SF_DISABLED; _hotspotsCount = 8; } @@ -109,7 +109,7 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 5); _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); endSceneInit(); - } else if (isFlag(22)) { + } else if (isFlag(kGFUnk22)) { _gnapSequenceId = 0x9E; _gnapSequenceDatNum = 0; _gnapId = 1; @@ -138,8 +138,8 @@ void GnapEngine::scene45_run() { gnapWalkTo(2, 7, -1, 0x107B9, 1); } - if (!isFlag(21) && !isFlag(kGFGnapControlsToyUFO)) { - setFlag(21); + if (!isFlag(kGFUnk21) && !isFlag(kGFGnapControlsToyUFO)) { + setFlag(kGFUnk21); setGrabCursorSprite(-1); _gameSys->setAnimation(0x9D, _gnapId, 0); _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); @@ -287,8 +287,8 @@ void GnapEngine::scene45_run() { break; case kHSExitDiscoBall: - clearFlag(22); - setFlag(23); + clearFlag(kGFUnk22); + setFlag(kGFUnk23); _sceneDone = true; _newSceneNum = 54; break; @@ -368,7 +368,7 @@ void GnapEngine::scene45_updateAnimations() { break; case 1: _sceneWaiting = 1; - setFlag(22); + setFlag(kGFUnk22); scene45_updateHotspots(); _gameSys->insertSequence(0x9E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x9E; diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index daa39b5424..5d73528282 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -151,7 +151,7 @@ void GnapEngine::scene53_runChitChatLine() { } _gnapActionStatus = -1; - if (isFlag(15)) { + if (isFlag(kGFSpringTaken)) { _gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s53_currHandSequenceId = 0x45; } else { @@ -236,7 +236,7 @@ void GnapEngine::scene53_runChitChatLine() { _gnapActionStatus = 1; - if (isFlag(15)) { + if (isFlag(kGFSpringTaken)) { _gameSys->setAnimation(0x73, 40, 6); _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); while (_gameSys->getAnimationStatus(6) != 2) { @@ -256,7 +256,7 @@ void GnapEngine::scene53_run() { queueInsertDeviceIcon(); - if (isFlag(15)) { + if (isFlag(kGFSpringTaken)) { _s53_currHandSequenceId = 0x45; _s53_isGnapPhoning = true; } else { @@ -305,7 +305,7 @@ void GnapEngine::scene53_run() { debug("phoneNumber: %d", phoneNumber); if (phoneNumberLen == 7) { _gnapActionStatus = 1; - if (isFlag(15)) { + if (isFlag(kGFSpringTaken)) { _gameSys->setAnimation(0x73, 40, 6); _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); while (_gameSys->getAnimationStatus(6) != 2) { @@ -322,7 +322,7 @@ void GnapEngine::scene53_run() { phoneNumberLen = 0; _sceneDone = true; _newSceneNum = 17; - } else if (phoneNumber != 5556789 || isFlag(20)) { + } else if (phoneNumber != 5556789 || isFlag(kGFPictureTaken)) { scene53_runRandomCall(); phoneNumber = 0; phoneNumberLen = 0; @@ -347,7 +347,7 @@ void GnapEngine::scene53_run() { case 14: if (_gnapActionStatus < 0) { _gnapActionStatus = 1; - if (isFlag(15)) { + if (isFlag(kGFSpringTaken)) { _gameSys->setAnimation(0x73, 40, 6); _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); while (_gameSys->getAnimationStatus(6) != 2) { diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp index 387b17c28c..b6e4be9fcb 100644 --- a/engines/gnap/scenes/scene54.cpp +++ b/engines/gnap/scenes/scene54.cpp @@ -36,7 +36,7 @@ void GnapEngine::scene54_initCutscene1() { _s99_resourceIdArr[0] = 0x3C; _s99_resourceIdArr[1] = 0x43; _s99_resourceIdArr[2] = 0x44; - if (isFlag(20)) + if (isFlag(kGFPictureTaken)) _s99_resourceIdArr[3] = 0x47; else _s99_resourceIdArr[3] = 0x46; -- cgit v1.2.3 From efa9466c815c6e1eaf913af0211a242d70c50e74 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Apr 2016 21:50:31 +0200 Subject: GNAP: Replace more flags values by enums --- engines/gnap/gnap.cpp | 4 ++-- engines/gnap/menu.cpp | 2 +- engines/gnap/scenes/scene02.cpp | 4 ++-- engines/gnap/scenes/scene04.cpp | 6 +++--- engines/gnap/scenes/scene06.cpp | 10 +++++----- engines/gnap/scenes/scene17.cpp | 18 +++++++++--------- engines/gnap/scenes/scene18.cpp | 30 +++++++++++++++--------------- engines/gnap/scenes/scene19.cpp | 14 +++++++------- engines/gnap/scenes/scene23.cpp | 4 ++-- engines/gnap/scenes/scene32.cpp | 2 +- engines/gnap/scenes/scene33.cpp | 2 +- engines/gnap/scenes/scene42.cpp | 12 ++++++------ engines/gnap/scenes/scene47.cpp | 4 ++-- engines/gnap/scenes/scene53.cpp | 4 ++-- engines/gnap/scenes/scenecore.cpp | 2 +- 15 files changed, 59 insertions(+), 59 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e408cd821d..08b8f95843 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -674,7 +674,7 @@ void GnapEngine::initGameFlags(int num) { invAdd(kItemMagazine); switch (num) { case 1: - setFlag(26); + setFlag(kGFPlatypusTalkingToAssistant); break; case 2: clearFlags(); @@ -702,7 +702,7 @@ void GnapEngine::initGameFlags(int num) { //DEBUG! #if 0 // setFlag(kGFPlatypus); // Enable platypus - setFlag(25); + setFlag(kGFUnk25); invClear(); invAdd(kItemMagazine); #endif diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 8c3bcae16a..e8de9da3e4 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -634,7 +634,7 @@ void GnapEngine::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_inventory); s.syncAsUint32LE(_gameFlags); - if (s.isLoading() && isFlag(24)) { + if (s.isLoading() && isFlag(kGFUnk24)) { _timers[9] = 600; } } diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index b285972c98..e1b4d2a135 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -119,7 +119,7 @@ void GnapEngine::scene02_run() { _gameSys->waitForUpdate(); break; case 47: - clearFlag(25); + clearFlag(kGFUnk25); initGnapPos(5, 6, kDirBottomLeft); initBeaverPos(6, 7, kDirUnk4); endSceneInit(); @@ -454,7 +454,7 @@ void GnapEngine::scene02_updateAnimations() { } _newSceneNum = 47; _sceneDone = true; - setFlag(25); + setFlag(kGFUnk25); break; case kASGrabTruckGrill: switch (_s02_truckGrillCtr) { diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index b85bbe7f36..6204971dee 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -77,7 +77,7 @@ void GnapEngine::scene04_updateHotspots() { _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (isFlag(kGFTwigTaken)) _hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(26) || _cursorValue == 1) + if (isFlag(kGFPlatypusTalkingToAssistant) || _cursorValue == 1) _hotspots[kHSAxe]._flags = SF_DISABLED; _hotspotsCount = 11; } @@ -99,7 +99,7 @@ void GnapEngine::scene04_run() { _timers[7] = getRandom(150) + 200; _timers[8] = getRandom(150) + 400; - if (!isFlag(26) && _cursorValue == 4) + if (!isFlag(kGFPlatypusTalkingToAssistant) && _cursorValue == 4) _gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); if (!isFlag(kGFTwigTaken)) @@ -245,7 +245,7 @@ void GnapEngine::scene04_run() { _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _gnapActionStatus = kASGrabAxe; - setFlag(26); + setFlag(kGFPlatypusTalkingToAssistant); scene04_updateHotspots(); break; case TALK_CURSOR: diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index 13c6108d7c..c051f800b4 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -72,7 +72,7 @@ void GnapEngine::scene06_updateHotspots() { setHotspot(kHSWalkArea4, 475, 469, 800, 505); setHotspot(kHSWalkArea5, 0, 0, 800, 504); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(29)) + if (isFlag(kGFGasTaken)) _hotspots[kHSLadder]._flags = SF_DISABLED; if (_cursorValue == 4) { _hotspots[kHSLadder]._flags = SF_DISABLED; @@ -101,7 +101,7 @@ void GnapEngine::scene06_run() { else _gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(29) && _cursorValue != 4) + if (!isFlag(kGFGasTaken) && _cursorValue != 4) _gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); queueInsertDeviceIcon(); @@ -205,12 +205,12 @@ void GnapEngine::scene06_run() { playGnapScratchingHead(8, 4); break; case GRAB_CURSOR: - if (isFlag(29)) + if (isFlag(kGFGasTaken)) playGnapImpossible(0, 0); else { gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107BB, 1); _gnapActionStatus = kASTryToClimbLadder; - setFlag(29); + setFlag(kGFGasTaken); } break; case TALK_CURSOR: @@ -382,7 +382,7 @@ void GnapEngine::scene06_updateAnimations() { if (_beaverSequenceId == 0xFA) { _gameSys->setAnimation(0, 0, 1); invAdd(kItemGas); - setFlag(29); + setFlag(kGFGasTaken); _hotspots[kHSLadder]._flags = SF_DISABLED; setGrabCursorSprite(kItemGas); _beaverActionStatus = -1; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index fa18a225ac..849e06329c 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -74,7 +74,7 @@ void GnapEngine::scene17_updateHotspots() { setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(kGFGrassTaken)) _hotspots[kHSWrench]._flags = SF_NONE; - if (isFlag(26)) { + if (isFlag(kGFPlatypusTalkingToAssistant)) { _hotspots[kHSDevice]._flags = SF_DISABLED; _hotspots[kHSPlatypus]._flags = SF_DISABLED; } @@ -109,7 +109,7 @@ void GnapEngine::scene17_platHangUpPhone() { _beaverSequenceDatNum = 0; _s17_currPhoneSequenceId = -1; _s17_nextPhoneSequenceId = -1; - clearFlag(26); + clearFlag(kGFPlatypusTalkingToAssistant); while (_gameSys->getAnimationStatus(1) != 2) gameUpdateTick(); _gnapActionStatus = savedGnapActionStatus; @@ -182,7 +182,7 @@ void GnapEngine::scene17_run() { endSceneInit(); platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); - } else if (isFlag(27)) { + } else if (isFlag(kGFUnk27)) { initGnapPos(3, 9, kDirUpLeft); _platX = _hotspotsWalkPos[2].x; _platY = _hotspotsWalkPos[2].y; @@ -197,10 +197,10 @@ void GnapEngine::scene17_run() { _beaverActionStatus = kASPlatPhoningAssistant; scene17_platHangUpPhone(); _gameSys->setAnimation(0, 0, 4); - clearFlag(26); - clearFlag(27); + clearFlag(kGFPlatypusTalkingToAssistant); + clearFlag(kGFUnk27); scene17_updateHotspots(); - } else if (isFlag(25)) { + } else if (isFlag(kGFUnk25)) { clearFlag(kGFSpringTaken); clearFlag(kGFUnk16); initBeaverPos(7, 9, kDirNone); @@ -211,12 +211,12 @@ void GnapEngine::scene17_run() { _gnapSequenceDatNum = 0; _gnapSequenceId = 601; _gnapActionStatus = kASGnapHangUpPhone; - clearFlag(25); + clearFlag(kGFUnk25); _gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); _gameSys->setAnimation(0x257, 254, 0); _gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); - } else if (isFlag(26)) { + } else if (isFlag(kGFPlatypusTalkingToAssistant)) { clearFlag(kGFSpringTaken); clearFlag(kGFUnk16); _sceneWaiting = true; @@ -683,7 +683,7 @@ void GnapEngine::scene17_updateAnimations() { _beaverSequenceDatNum = 0; _beaverSequenceId = 0x25B; _beaverActionStatus = -1; - clearFlag(26); + clearFlag(kGFPlatypusTalkingToAssistant); _sceneWaiting = false; scene17_updateHotspots(); } else { diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 3676ada91a..8faeb64853 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -112,7 +112,7 @@ void GnapEngine::scene18_updateHotspots() { } if (isFlag(kGFPlatyPussDisguised)) _hotspots[kHSGarbageCan]._flags = SF_DISABLED; - if (isFlag(26)) { + if (isFlag(kGFPlatypusTalkingToAssistant)) { _hotspots[kHSDevice]._flags = SF_DISABLED; _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; @@ -258,7 +258,7 @@ void GnapEngine::scene18_putDownGarbageCan(int animationIndex) { } void GnapEngine::scene18_platEndPhoning(bool platFl) { - if (isFlag(26)) { + if (isFlag(kGFPlatypusTalkingToAssistant)) { _s18_platPhoneIter = 0; _s18_platPhoneCtr = 0; _beaverActionStatus = -1; @@ -270,7 +270,7 @@ void GnapEngine::scene18_platEndPhoning(bool platFl) { } _gameSys->removeSequence(0x21F, 254, true); _gameSys->setAnimation(0, 0, 3); - clearFlag(26); + clearFlag(kGFPlatypusTalkingToAssistant); if (platFl) { _beaverActionStatus = kASPlatComesHere; _timers[6] = 50; @@ -345,18 +345,18 @@ void GnapEngine::scene18_run() { } } - if (isFlag(26)) { + if (isFlag(kGFPlatypusTalkingToAssistant)) { if (_prevSceneNum == 17) initGnapPos(4, 11, kDirBottomRight); else initGnapPos(4, 7, kDirBottomRight); _s18_platPhoneCtr = getRandom(5); - if (isFlag(27)) { + if (isFlag(kGFUnk27)) { _gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); _s18_currPhoneSequenceId = -1; scene18_platEndPhoning(true); - clearFlag(27); + clearFlag(kGFUnk27); } else { _s18_currPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr]; _s18_platPhoneIter = 0; @@ -364,9 +364,9 @@ void GnapEngine::scene18_run() { _gameSys->insertSequence(_s18_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); } - if (isFlag(27)) { + if (isFlag(kGFUnk27)) { scene18_platEndPhoning(true); - clearFlag(27); + clearFlag(kGFUnk27); } else { _gameSys->setAnimation(_s18_currPhoneSequenceId, 254, 3); } @@ -486,7 +486,7 @@ void GnapEngine::scene18_run() { else playGnapImpossible(0, 0); } else { - if (isFlag(26)) + if (isFlag(kGFPlatypusTalkingToAssistant)) scene18_platEndPhoning(true); if (_grabCursorSpriteIndex >= 0) { if (!isFlag(kGFTruckKeysUsed)) @@ -647,7 +647,7 @@ void GnapEngine::scene18_run() { _newSceneNum = 19; gnapWalkTo(_hotspotsWalkPos[kHSExitToyStore].x, _hotspotsWalkPos[kHSExitToyStore].y, 0, 0x107C0, 1); _gnapActionStatus = kASLeaveScene; - if (!isFlag(26)) + if (!isFlag(kGFPlatypusTalkingToAssistant)) platypusWalkTo(_hotspotsWalkPos[kHSExitToyStore].x + 1, _hotspotsWalkPos[kHSExitToyStore].y, -1, 0x107C2, 1); } } @@ -664,8 +664,8 @@ void GnapEngine::scene18_run() { _newSceneNum = 17; gnapWalkTo(_hotspotsWalkPos[kHSExitPhoneBooth].x, _hotspotsWalkPos[kHSExitPhoneBooth].y, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(26)) - setFlag(27); + if (isFlag(kGFPlatypusTalkingToAssistant)) + setFlag(kGFUnk27); else platypusWalkTo(_hotspotsWalkPos[kHSExitPhoneBooth].x + 1, _hotspotsWalkPos[kHSExitPhoneBooth].y, -1, 0x107C2, 1); } @@ -683,7 +683,7 @@ void GnapEngine::scene18_run() { _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(26)) + if (isFlag(kGFPlatypusTalkingToAssistant)) scene18_platEndPhoning(false); else platypusWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y - 1, -1, 0x107CF, 1); @@ -730,14 +730,14 @@ void GnapEngine::scene18_run() { playSound(0x22B, true); if (!_isLeavingScene) { - if (!isFlag(26)) { + if (!isFlag(kGFPlatypusTalkingToAssistant)) { if (_beaverActionStatus == kASPlatComesHere) { if (!_timers[6]) { _beaverActionStatus = -1; _sceneWaiting = false; initBeaverPos(-1, 10, kDirNone); platypusWalkTo(3, 9, -1, 0x107C2, 1); - clearFlag(26); + clearFlag(kGFPlatypusTalkingToAssistant); } } else { _hotspots[kHSWalkArea1]._y2 += 48; diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index ba6ab19e48..da295583f4 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -60,7 +60,7 @@ enum { int GnapEngine::scene19_init() { playSound(0x79, 0); - return isFlag(26) ? 0x77 : 0x76; + return isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; } void GnapEngine::scene19_updateHotspots() { @@ -80,7 +80,7 @@ void GnapEngine::scene19_updateHotspots() { setHotspot(kHSWalkArea2, 622, 0, 800, 600); setHotspot(kHSWalkArea3, 0, 0, 800, 437); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(26)) { + if (isFlag(kGFPlatypusTalkingToAssistant)) { _hotspots[kHSToy1]._flags = SF_DISABLED; _hotspots[kHSToy2]._flags = SF_DISABLED; _hotspots[kHSToy3]._flags = SF_DISABLED; @@ -109,7 +109,7 @@ void GnapEngine::scene19_run() { if (!isFlag(kGFPictureTaken)) _gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(26)) { + if (isFlag(kGFPlatypusTalkingToAssistant)) { initGnapPos(3, 6, kDirBottomRight); _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[getRandom(5)]; _s19_nextShopAssistantSequenceId = _s19_currShopAssistantSequenceId; @@ -185,8 +185,8 @@ void GnapEngine::scene19_run() { _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107B2, 1); _gnapActionStatus = kASLeaveScene; - if (isFlag(26)) - setFlag(27); + if (isFlag(kGFPlatypusTalkingToAssistant)) + setFlag(kGFUnk27); else platypusWalkTo(_hotspotsWalkPos[1].x + 1, _hotspotsWalkPos[1].y, -1, 0x107C5, 1); _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; @@ -310,7 +310,7 @@ void GnapEngine::scene19_run() { if (!_isLeavingScene) { updateGnapIdleSequence(); - if (!isFlag(26)) { + if (!isFlag(kGFPlatypusTalkingToAssistant)) { updateBeaverIdleSequence(); if (!_timers[6] && _s19_nextShopAssistantSequenceId == -1) { _timers[6] = getRandom(40) + 50; @@ -387,7 +387,7 @@ void GnapEngine::scene19_updateAnimations() { // checkGameAppStatus(); gameUpdateTick(); } - setFlag(27); + setFlag(kGFUnk27); showCursor(); _newSceneNum = 17; _isLeavingScene = true; diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index 3ad17c5fa2..e3e793962a 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -77,14 +77,14 @@ void GnapEngine::scene23_run() { platypusWalkTo(1, 7, -1, 0x107C2, 1); - if (isFlag(24)) { + if (isFlag(kGFUnk24)) { gnapWalkTo(2, 7, -1, 0x107B9, 1); } else { gnapWalkTo(2, 7, 0, 0x107B9, 1); while (_gameSys->getAnimationStatus(0) != 2) gameUpdateTick(); playSequences(0x48, 0xBA, 0xBB, 0xBC); - setFlag(24); + setFlag(kGFUnk24); } while (!_sceneDone) { diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index 5f91b3f0ab..ed735ccef0 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -46,7 +46,7 @@ enum { int GnapEngine::scene32_init() { _gameSys->setAnimation(0, 0, 0); - return isFlag(26) ? 0xF : 0x10; + return isFlag(kGFPlatypusTalkingToAssistant) ? 0xF : 0x10; } void GnapEngine::scene32_updateHotspots() { diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index 7e9823ee60..99e9dbc6d4 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -46,7 +46,7 @@ enum { }; int GnapEngine::scene33_init() { - return isFlag(26) ? 0x84 : 0x85; + return isFlag(kGFPlatypusTalkingToAssistant) ? 0x84 : 0x85; } void GnapEngine::scene33_updateHotspots() { diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 7e032e4808..b1cca2b7ba 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -72,7 +72,7 @@ void GnapEngine::scene42_updateHotspots() { setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); setHotspot(kHSUfoHotSauce, 335, 110, 440, 175, SF_DISABLED); setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - if ((isFlag(kGFPictureTaken) || isFlag(kGFUnk18)) && isFlag(kGFUnk23) && !isFlag(24)) + if ((isFlag(kGFPictureTaken) || isFlag(kGFUnk18)) && isFlag(kGFUnk23) && !isFlag(kGFUnk24)) _hotspots[kHSUfoHotSauce]._flags = SF_GRAB_CURSOR; _hotspotsCount = 5; } else { @@ -392,17 +392,17 @@ void GnapEngine::scene42_updateAnimations() { setGrabCursorSprite(-1); sequenceId = 0x150; _s42_nextBBQVendorSequenceId = 0x148; - } else if (isFlag(27)) { - if (isFlag(28)) { + } else if (isFlag(kGFUnk27)) { + if (isFlag(kGFUnk28)) { sequenceId = 0x7B7; _s42_nextBBQVendorSequenceId = 0x145; } else { - setFlag(28); + setFlag(kGFUnk28); sequenceId = 0x14F; _s42_nextBBQVendorSequenceId = 0x147; } } else { - setFlag(27); + setFlag(kGFUnk27); sequenceId = 0x14E; _s42_nextBBQVendorSequenceId = 0x146; } @@ -463,7 +463,7 @@ void GnapEngine::scene42_updateAnimations() { break; case kASToyUfoPickUpHotSauce: _gameSys->insertSequence(0x10870, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); - setFlag(24); + setFlag(kGFUnk24); scene42_updateHotspots(); toyUfoSetStatus(19); _toyUfoSequenceId = 0x870; diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index 37077e2876..50c8c39f22 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -134,7 +134,7 @@ void GnapEngine::scene47_initCutscene7() { _s99_sequenceIdArr[4] = 0x31C; v1 = 5; } - if (!isFlag(26)) + if (!isFlag(kGFPlatypusTalkingToAssistant)) _s99_sequenceIdArr[v1++] = 0x31D; v4 = v1; _s99_sequenceIdArr[v1] = 0x319; @@ -146,7 +146,7 @@ void GnapEngine::scene47_initCutscene7() { v2 = v0 + 1; if (!isFlag(kGFTwigTaken)) _s99_sequenceIdArr[v2++] = 0x31C; - if (!isFlag(26)) + if (!isFlag(kGFPlatypusTalkingToAssistant)) _s99_sequenceIdArr[v2++] = 0x31D; _s99_sequenceIdArr[v2] = 0x313; _s99_sequenceIdArr[v2 + 1] = 0x315; diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index 5d73528282..0b06f55e09 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -334,9 +334,9 @@ void GnapEngine::scene53_run() { _sceneDone = true; _newSceneNum = 17; if (_s53_isGnapPhoning) - setFlag(25); + setFlag(kGFUnk25); else - setFlag(26); + setFlag(kGFPlatypusTalkingToAssistant); } } break; diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 20d591fa9f..ba1ea40d21 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -589,7 +589,7 @@ void GnapEngine::runSceneLogic() { scene47_initCutscene2(); _newSceneNum = 11; } else if (!isFlag(kGFPlatyPussDisguised) && _prevSceneNum == 2) {//CHECKME - if (isFlag(25)) { + if (isFlag(kGFUnk25)) { scene47_initCutscene3(); _newSceneNum = 2; } else { -- cgit v1.2.3 From ff43147ee3e7c80d156cd5f145519cfb33a50811 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Apr 2016 22:05:31 +0200 Subject: GNAP: Fix some remaining flags --- engines/gnap/scenes/scene08.cpp | 3 --- engines/gnap/scenes/scene41.cpp | 4 ++-- engines/gnap/scenes/scene42.cpp | 4 ++-- engines/gnap/scenes/scene43.cpp | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index d01355a44d..4b5c564187 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -395,9 +395,7 @@ void GnapEngine::scene08_run() { } gameUpdateTick(); - } - } void GnapEngine::scene08_updateAnimations() { @@ -521,7 +519,6 @@ void GnapEngine::scene08_updateAnimations() { } } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 92222b5f60..20751129e0 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -98,7 +98,7 @@ void GnapEngine::scene41_run() { _gnapActionStatus = kASGiveBackToyUfo; } else { if (!isFlag(kGFUnk16) && !isFlag(kGFJointTaken) && !isFlag(kGFUnk18) && !isFlag(kGFGroceryStoreHatTaken)) - toyUfoSetStatus(16); + toyUfoSetStatus(kGFUnk16); _toyUfoX = 600; _toyUfoY = 200; } @@ -547,7 +547,7 @@ void GnapEngine::scene41_updateAnimations() { kSeqSyncWait, 0, _toyUfoX - 365, _toyUfoY - 128); _toyUfoSequenceId = _toyUfoNextSequenceId; _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 2); - toyUfoSetStatus(17); + toyUfoSetStatus(kGFJointTaken); break; default: _toyUfoNextSequenceId = toyUfoGetSequenceId(); diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index b1cca2b7ba..04f372f56f 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -108,7 +108,7 @@ void GnapEngine::scene42_run() { _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, 0, 0); _toyUfoX = 317; _toyUfoY = 61; - toyUfoSetStatus(17); + toyUfoSetStatus(kGFJointTaken); setFlag(kGFPictureTaken); _timers[9] = 600; } else { @@ -465,7 +465,7 @@ void GnapEngine::scene42_updateAnimations() { _gameSys->insertSequence(0x10870, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); setFlag(kGFUnk24); scene42_updateHotspots(); - toyUfoSetStatus(19); + toyUfoSetStatus(kGFGroceryStoreHatTaken); _toyUfoSequenceId = 0x870; _gameSys->setAnimation(0x10870, _toyUfoId, 3); _toyUfoActionStatus = -1; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index a421482ce3..83b11b7697 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -439,7 +439,7 @@ void GnapEngine::scene43_updateAnimations() { _gameSys->removeSequence(0x1086F, 1, true); setFlag(kGFUnk14); scene43_updateHotspots(); - toyUfoSetStatus(18); + toyUfoSetStatus(kGFUnk18); _toyUfoSequenceId = 0x871; _gameSys->setAnimation(0x10871, _toyUfoId, 3); _toyUfoActionStatus = -1; -- cgit v1.2.3 From 192bc349350e33e44d15f59e548dcecd4a7b253c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 11 Apr 2016 00:17:17 +0200 Subject: GNAP: Fix savegames --- engines/gnap/menu.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index e8de9da3e4..1ffd7ab1c5 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -547,6 +547,7 @@ void GnapEngine::updateMenuStatusMainMenu() { } } else { // Save / Load +#if 1 _timers[2] = 10; playSound(0x108F4, 0); @@ -568,12 +569,15 @@ void GnapEngine::updateMenuStatusMainMenu() { loadGameState(savegameId); _wasSavegameLoaded = true; _menuDone = true; + _sceneDone = true; + playSound(0x108F4, 0); + } else { + playSound(0x108F5, 0); } } } - -#if 0 -// Original Code +#else + // Original Code _timers[2] = 10; playSound(0x108F4, 0); _gameSys->removeSpriteDrawItem(_menuSprite1, 262); @@ -628,14 +632,21 @@ Common::Error GnapEngine::saveGameState(int slot, const Common::String &desc) { } void GnapEngine::synchronize(Common::Serializer &s) { - s.syncAsSint32LE(_newSceneNum); - s.syncAsSint32LE(_currentSceneNum); - s.syncAsSint32LE(_newCursorValue); - s.syncAsUint32LE(_inventory); - s.syncAsUint32LE(_gameFlags); - - if (s.isLoading() && isFlag(kGFUnk24)) { - _timers[9] = 600; + if (s.isSaving()) { + s.syncAsSint32LE(_currentSceneNum); + s.syncAsSint32LE(_prevSceneNum); + s.syncAsSint32LE(_cursorValue); + s.syncAsUint32LE(_inventory); + s.syncAsUint32LE(_gameFlags); + } else { + s.syncAsSint32LE(_newSceneNum); + s.syncAsSint32LE(_currentSceneNum); + s.syncAsSint32LE(_newCursorValue); + s.syncAsUint32LE(_inventory); + s.syncAsUint32LE(_gameFlags); + + if (isFlag(kGFUnk24)) + _timers[9] = 600; } } -- cgit v1.2.3 From 558ab62fd7e526af549f82b92cc820f46faf2fcd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 11 Apr 2016 23:37:24 +0200 Subject: GNAP: Enforce the use of a boolean when calling playSound() --- engines/gnap/gnap.cpp | 16 +++++++------- engines/gnap/menu.cpp | 48 ++++++++++++++++++++--------------------- engines/gnap/scenes/scene00.cpp | 2 +- engines/gnap/scenes/scene01.cpp | 10 ++++----- engines/gnap/scenes/scene02.cpp | 4 ++-- engines/gnap/scenes/scene03.cpp | 5 ++--- engines/gnap/scenes/scene04.cpp | 5 ++--- engines/gnap/scenes/scene05.cpp | 4 ++-- engines/gnap/scenes/scene06.cpp | 2 +- engines/gnap/scenes/scene07.cpp | 2 +- engines/gnap/scenes/scene08.cpp | 2 +- engines/gnap/scenes/scene09.cpp | 2 +- engines/gnap/scenes/scene10.cpp | 6 +++--- engines/gnap/scenes/scene11.cpp | 4 ++-- engines/gnap/scenes/scene13.cpp | 16 +++++++------- engines/gnap/scenes/scene14.cpp | 10 ++++----- engines/gnap/scenes/scene15.cpp | 16 +++++++------- engines/gnap/scenes/scene17.cpp | 5 ++--- engines/gnap/scenes/scene18.cpp | 3 +-- engines/gnap/scenes/scene19.cpp | 2 +- engines/gnap/scenes/scene20.cpp | 4 ++-- engines/gnap/scenes/scene21.cpp | 8 ++----- engines/gnap/scenes/scene23.cpp | 6 +++--- engines/gnap/scenes/scene24.cpp | 4 ++-- engines/gnap/scenes/scene25.cpp | 3 +-- engines/gnap/scenes/scene26.cpp | 4 ++-- engines/gnap/scenes/scene27.cpp | 4 ++-- engines/gnap/scenes/scene28.cpp | 5 ++--- engines/gnap/scenes/scene29.cpp | 4 ++-- engines/gnap/scenes/scene30.cpp | 10 +++------ engines/gnap/scenes/scene31.cpp | 5 ++--- engines/gnap/scenes/scene32.cpp | 7 ++---- engines/gnap/scenes/scene33.cpp | 5 ++--- engines/gnap/scenes/scene39.cpp | 2 +- engines/gnap/scenes/scene40.cpp | 2 +- engines/gnap/scenes/scene41.cpp | 2 +- engines/gnap/scenes/scene42.cpp | 2 +- engines/gnap/scenes/scene43.cpp | 8 +------ engines/gnap/scenes/scene44.cpp | 2 +- engines/gnap/scenes/scene45.cpp | 6 ++---- engines/gnap/scenes/scene46.cpp | 3 +-- engines/gnap/scenes/scene49.cpp | 8 +++---- engines/gnap/scenes/scene51.cpp | 12 +++++------ engines/gnap/scenes/scene52.cpp | 18 ++++++++-------- engines/gnap/scenes/scene53.cpp | 3 +-- 45 files changed, 136 insertions(+), 165 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 08b8f95843..a755c9841f 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -911,7 +911,7 @@ int GnapEngine::playSoundA() { if (!_timers[_soundTimerIndexA]) { _timers[_soundTimerIndexA] = getRandom(50) + 100; soundId = kSoundIdsA[getRandom(11)]; - playSound(soundId | 0x10000, 0); + playSound(soundId | 0x10000, false); } return soundId; } @@ -935,7 +935,7 @@ int GnapEngine::playSoundB() { if (!_timers[_soundTimerIndexB]) { _timers[_soundTimerIndexB] = getRandom(50) + 150; soundId = kSoundIdsB[getRandom(19)]; - playSound(soundId | 0x10000, 0); + playSound(soundId | 0x10000, false); } return soundId; } @@ -957,7 +957,7 @@ int GnapEngine::playSoundC() { if (!_timers[_soundTimerIndexC]) { _timers[_soundTimerIndexC] = getRandom(50) + 150; soundId = kSoundIdsC[getRandom(7)] ; - playSound(soundId | 0x10000, 0); + playSound(soundId | 0x10000, false); } return soundId; } @@ -2134,16 +2134,16 @@ void GnapEngine::sceneXX_playRandomSound(int timerIndex) { _timers[timerIndex] = getRandom(40) + 50; switch (getRandom(4)) { case 0: - playSound(0x1091B, 0); + playSound(0x1091B, false); break; case 1: - playSound(0x10921, 0); + playSound(0x10921, false); break; case 2: - playSound(0x10927, 0); + playSound(0x10927, false); break; case 3: - playSound(0x1091D, 0); + playSound(0x1091D, false); break; } } @@ -2326,7 +2326,7 @@ void GnapEngine::cutscene_run() { } if (soundId != -1) - playSound(soundId, 0); + playSound(soundId, false); hideCursor(); diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 1ffd7ab1c5..82e45dedbe 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -406,7 +406,7 @@ void GnapEngine::updateMenuStatusInventory() { if (_sceneClickedHotspot == _hotspotsCount - 3) { if (_grabCursorSpriteIndex == -1) { _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); _menuStatus = 1; Common::Rect dirtyRect(_hotspots[0]._x1, _hotspots[0]._y1, _hotspots[2]._x2, _hotspots[_hotspotsCount - 4]._y2); drawInventoryFrames(); @@ -417,11 +417,11 @@ void GnapEngine::updateMenuStatusInventory() { _gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262); _gameSys->insertDirtyRect(dirtyRect); } else { - playSound(0x108F5, 0); + playSound(0x108F5, false); } } else if (_sceneClickedHotspot == _hotspotsCount - 1) { _timers[2] = 10; - playSound(0x108F5, 0); + playSound(0x108F5, false); _menuDone = true; } } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] != -1 && _grabCursorSpriteIndex == -1) { @@ -448,7 +448,7 @@ void GnapEngine::updateMenuStatusInventory() { invRemove(kCombineItems[combineIndex].item1); invRemove(kCombineItems[combineIndex].item2); invAdd(kCombineItems[combineIndex].resultItem); - playSound(0x108AE, 0); + playSound(0x108AE, false); deleteSurface(&_spriteHandle); // CHECKME _spriteHandle = _gameSys->createSurface(0x10001); _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1]._x1, _hotspots[_menuSpritesIndex - 1]._y1, 261); @@ -457,7 +457,7 @@ void GnapEngine::updateMenuStatusInventory() { insertInventorySprites(); delayTicksCursor(5); } else { - playSound(0x108F5, 0); + playSound(0x108F5, false); } } } @@ -476,7 +476,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (_sceneClickedHotspot == 3) { // Quit _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); _gameSys->removeSpriteDrawItem(_menuSprite1, 262); initMenuQuitQueryHotspots(); _menuStatus = 4; @@ -485,7 +485,7 @@ void GnapEngine::updateMenuStatusMainMenu() { _gameSys->insertSpriteDrawItem(_menuQuitQuerySprite, 254, 93, 262); } else if (_sceneClickedHotspot == 4) { // Pause ? - playSound(0x108F4, 0); + playSound(0x108F4, false); Common::Rect dirtyRect(0, 0, 799, 599); hideCursor(); _largeSprite = _gameSys->allocSurface(800, 600); @@ -513,7 +513,7 @@ void GnapEngine::updateMenuStatusMainMenu() { gameUpdateTick(); } - playSound(0x108F5, 0); + playSound(0x108F5, false); _mouseClickState._left = false; clearKeyStatus1(28); clearKeyStatus1(29); @@ -527,7 +527,7 @@ void GnapEngine::updateMenuStatusMainMenu() { } else if (_hotspotsCount - 3 == _sceneClickedHotspot) { // Button _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); initMenuHotspots1(); /* TODO if (_mouseX < 93 || _mouseX > 638 || _mouseY < 0 || _mouseY > 600) @@ -542,14 +542,14 @@ void GnapEngine::updateMenuStatusMainMenu() { } } else { // Resume - playSound(0x108F5, 0); + playSound(0x108F5, false); _menuDone = true; } } else { // Save / Load #if 1 _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); if (_sceneClickedHotspot == 1) { GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); @@ -570,16 +570,16 @@ void GnapEngine::updateMenuStatusMainMenu() { _wasSavegameLoaded = true; _menuDone = true; _sceneDone = true; - playSound(0x108F4, 0); + playSound(0x108F4, false); } else { - playSound(0x108F5, 0); + playSound(0x108F5, false); } } } #else // Original Code _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); _gameSys->removeSpriteDrawItem(_menuSprite1, 262); if (_menuSaveLoadSprite) deleteSurface(&_menuSaveLoadSprite); @@ -751,13 +751,13 @@ void GnapEngine::updateMenuStatusSaveGame() { if (_hotspotsCount - 3 == _sceneClickedHotspot) { // Button _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); _menuStatus = 1; warning("writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1);"); } else if (_hotspotsCount - 4 == _sceneClickedHotspot) { // Cancel _timers[2] = 10; - playSound(0x108F5, 0); + playSound(0x108F5, false); _menuStatus = 1; if (strcmp(v43, _savegameFilenames[_savegameIndex]) && _savegameIndex != -1) { strcpy(_savegameFilenames[_savegameIndex], v43); @@ -772,7 +772,7 @@ void GnapEngine::updateMenuStatusSaveGame() { } else if (_hotspotsCount - 5 == _sceneClickedHotspot) { // OK _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); if (_savegameIndex != -1) warning("writeSavegame(_savegameIndex + 1, (int)&_savegameFilenames[30 * _savegameIndex], 1);"); _menuStatus = 1; @@ -782,7 +782,7 @@ void GnapEngine::updateMenuStatusSaveGame() { } else if (_sceneClickedHotspot != -1 && _hotspotsCount - 2 != _sceneClickedHotspot) { // Savegame name _timers[2] = 10; - playSound(0x108F4, 0); + playSound(0x108F4, false); if (strcmp(v43, _savegameFilenames[_savegameIndex]) & (_savegameIndex != -1)) { strcpy(_savegameFilenames[_savegameIndex], v43); if (_savegameSprites[_savegameIndex] != nullptr) { @@ -903,7 +903,7 @@ void GnapEngine::updateMenuStatusLoadGame() { if (_sceneClickedHotspot != -1 && _hotspotsCount - 2 != _sceneClickedHotspot) { _timers[2] = 10; if (_hotspotsCount - 4 <= _sceneClickedHotspot) { - playSound(0x108F5, 0); + playSound(0x108F5, false); _gameSys->removeSpriteDrawItem(_menuSprite2, 262); _gameSys->removeSpriteDrawItem(_menuSaveLoadSprite, 262); for (int i = 0; i < 7; ++i) @@ -916,9 +916,9 @@ void GnapEngine::updateMenuStatusLoadGame() { _gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262); } } else if (loadSavegame(_sceneClickedHotspot + 1)) { - playSound(0x108F5, 0); + playSound(0x108F5, false); } else { - playSound(0x108F4, 0); + playSound(0x108F4, false); _sceneDone = true; } } @@ -946,18 +946,18 @@ void GnapEngine::updateMenuStatusQueryQuit() { if (_sceneClickedHotspot == 0) { // Quit the game - playSound(0x108F5, 0); + playSound(0x108F5, false); _gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262); _sceneDone = true; _gameDone = true; } else if (_sceneClickedHotspot == 4) { // Exit the device - playSound(0x108F4, 0); + playSound(0x108F4, false); _gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262); _menuDone = true; } else if (_sceneClickedHotspot != -1) { // Return to the main menu - playSound(0x108F4, 0); + playSound(0x108F4, false); _gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262); _timers[2] = 10; _menuStatus = 1; diff --git a/engines/gnap/scenes/scene00.cpp b/engines/gnap/scenes/scene00.cpp index c53f58c99a..8291546691 100644 --- a/engines/gnap/scenes/scene00.cpp +++ b/engines/gnap/scenes/scene00.cpp @@ -136,7 +136,7 @@ void GnapEngine::scene00_run() { else { _gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); if (index == 2) { - playSound(0x10000, 0); + playSound(0x10000, false); _gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); } else if (index == 3) _gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index bb7315c90c..30e649186f 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -84,7 +84,7 @@ void GnapEngine::scene01_run() { // NOTE Removed _s01_dword_474380 which was set when the mud was taken // which is also set in the global game flags. - playSound(0x1091C, 1); + playSound(0x1091C, true); startSoundTimerC(5); _gameSys->setAnimation(134, 20, 4); @@ -269,7 +269,7 @@ void GnapEngine::scene01_run() { scene01_updateAnimations(); if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, 1); + playSound(0x1091C, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) @@ -329,9 +329,9 @@ void GnapEngine::scene01_updateAnimations() { _gnapActionStatus = -1; break; case kASLookPigs: - playSound(138, 0); - playSound(139, 0); - playSound(140, 0); + playSound(138, false); + playSound(139, false); + playSound(140, false); _gnapActionStatus = -1; break; case kASUsePigs: diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index e1b4d2a135..d214f3b412 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -84,7 +84,7 @@ void GnapEngine::scene02_updateHotspots() { } void GnapEngine::scene02_run() { - playSound(0x1091C, 1); + playSound(0x1091C, true); startSoundTimerC(6); _s02_currChickenSequenceId = 0x14B; @@ -360,7 +360,7 @@ void GnapEngine::scene02_run() { scene02_updateAnimations(); if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, 1); + playSound(0x1091C, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 50c985c543..1916350c35 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -81,8 +81,7 @@ void GnapEngine::scene03_updateHotspots() { } void GnapEngine::scene03_run() { - - playSound(0x10925, 1); + playSound(0x10925, true); startSoundTimerC(7); @@ -317,7 +316,7 @@ void GnapEngine::scene03_run() { scene03_updateAnimations(); if (!isSoundPlaying(0x10925)) - playSound(0x10925, 1); + playSound(0x10925, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 6204971dee..27ed3ac9cd 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -83,8 +83,7 @@ void GnapEngine::scene04_updateHotspots() { } void GnapEngine::scene04_run() { - - playSound(0x1091C, 1); + playSound(0x1091C, true); startSoundTimerC(4); _gameSys->insertSequence(0x210, 139 - _s04_dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); @@ -396,7 +395,7 @@ void GnapEngine::scene04_run() { scene04_updateAnimations(); if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, 1); + playSound(0x1091C, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index 03534b1318..6ef4b357fc 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -78,7 +78,7 @@ void GnapEngine::scene05_updateHotspots() { void GnapEngine::scene05_run() { - playSound(0x1091C, 1); + playSound(0x1091C, true); startSoundTimerC(7); _s05_currChickenSequenceId = 0x142; @@ -317,7 +317,7 @@ void GnapEngine::scene05_run() { scene05_updateAnimations(); if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, 1); + playSound(0x1091C, true); if (!_isLeavingScene) { if (isFlag(kGFPlatypus)) diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index c051f800b4..f89bace54c 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -54,7 +54,7 @@ int GnapEngine::scene06_init() { _gameSys->setAnimation(0, 0, 1); _gameSys->setAnimation(0, 0, 2); if (isFlag(kGFSceneFlag1)) { - playSound(0x11B, 0); + playSound(0x11B, false); clearFlag(kGFSceneFlag1); } return 0x101; diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index d10c4096cb..e2d385df63 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -100,7 +100,7 @@ void GnapEngine::scene07_run() { while (!_sceneDone) { if (!isSoundPlaying(0x10919)) - playSound(0x10919, 1); + playSound(0x10919, true); if (testWalk(0, 1, 8, 7, 6, 7)) scene07_updateHotspots(); diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index 4b5c564187..d8a1c26a08 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -129,7 +129,7 @@ void GnapEngine::scene08_run() { while (!_sceneDone) { if (!isSoundPlaying(0x10919)) - playSound(0x10919, 1); + playSound(0x10919, true); testWalk(0, 0, -1, -1, -1, -1); diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index d16f3bd6ce..368f8fea49 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -84,7 +84,7 @@ void GnapEngine::scene09_run() { while (!_sceneDone) { if (!isSoundPlaying(0x10919)) - playSound(0x10919, 1); + playSound(0x10919, true); testWalk(0, 0, -1, -1, -1, -1); diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index 6f9f47e817..b5f9cb1577 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -103,10 +103,10 @@ void GnapEngine::scene10_run() { while (!_sceneDone) { if (!isSoundPlaying(0x1091E)) - playSound(0x1091E, 1); + playSound(0x1091E, true); if (!isSoundPlaying(0x1091A)) - playSound(0x1091A, 1); + playSound(0x1091A, true); updateMouseCursor(); @@ -325,7 +325,7 @@ void GnapEngine::scene10_run() { updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(80) + 150; - playSound(0x12B, 0); + playSound(0x12B, false); } if (!_timers[5]) { _timers[5] = getRandom(100) + 100; diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 95a8df36d9..3e2a75757c 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -57,8 +57,8 @@ int GnapEngine::scene11_init() { _gameSys->setAnimation(0, 0, 3); _gameSys->setAnimation(0, 0, 2); if (_prevSceneNum == 10 || _prevSceneNum == 13) { - playSound(0x108EC, 0); - playSound(0x10928, 0); + playSound(0x108EC, false); + playSound(0x10928, false); } return 0x209; } diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 8a04b2dda9..58bdba1ade 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -58,7 +58,7 @@ enum { }; int GnapEngine::scene13_init() { - playSound(0x108EC, 0); + playSound(0x108EC, false); return 0xAC; } @@ -122,7 +122,7 @@ void GnapEngine::scene13_run() { while (!_sceneDone) { if (!isSoundPlaying(0x1091A)) - playSound(0x1091A, 1); + playSound(0x1091A, true); testWalk(0, 0, -1, -1, -1, -1); @@ -325,19 +325,19 @@ void GnapEngine::scene13_run() { _timers[4] = getRandom(20) + 20; switch (getRandom(5)) { case 0: - playSound(0xD2, 0); + playSound(0xD2, false); break; case 1: - playSound(0xD3, 0); + playSound(0xD3, false); break; case 2: - playSound(0xD4, 0); + playSound(0xD4, false); break; case 3: - playSound(0xD5, 0); + playSound(0xD5, false); break; case 4: - playSound(0xD6, 0); + playSound(0xD6, false); break; } } @@ -362,7 +362,7 @@ void GnapEngine::scene13_run() { break; } if (newSoundId != currSoundId) { - playSound(newSoundId, 0); + playSound(newSoundId, false); currSoundId = newSoundId; } } diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp index 47bb12f563..25db3a68ea 100644 --- a/engines/gnap/scenes/scene14.cpp +++ b/engines/gnap/scenes/scene14.cpp @@ -101,11 +101,11 @@ void GnapEngine::scene14_run() { _gameSys->setAnimation(0x26, 10, 0); _gameSys->insertSequence(0x26, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); } else if (_grabCursorSpriteIndex >= 0) { - playSound(0x108E9, 0); + playSound(0x108E9, false); } else { switch (_verbCursor) { case LOOK_CURSOR: - playSound(0x108E9, 0); + playSound(0x108E9, false); break; case GRAB_CURSOR: _gameSys->insertSequence(0x25, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); @@ -113,7 +113,7 @@ void GnapEngine::scene14_run() { _gnapSequenceId = 0x23; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + playSound((getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); @@ -129,10 +129,10 @@ void GnapEngine::scene14_run() { switch (_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playSound(0x108B1, 0); + playSound(0x108B1, false); break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + playSound((getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp index 4323253a8c..89ca126c01 100644 --- a/engines/gnap/scenes/scene15.cpp +++ b/engines/gnap/scenes/scene15.cpp @@ -130,10 +130,10 @@ void GnapEngine::scene15_run() { switch (_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playSound(0x108E9, 0); + playSound(0x108E9, false); break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + playSound((getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); @@ -149,7 +149,7 @@ void GnapEngine::scene15_run() { switch (_verbCursor) { case LOOK_CURSOR: if (isFlag(kGFGnapControlsToyUFO) || isFlag(kGFUnk13)) - playSound(0x108E9, 0); + playSound(0x108E9, false); else _s15_nextSlotSequenceId = 0xDA; break; @@ -160,7 +160,7 @@ void GnapEngine::scene15_run() { _s15_nextSlotSequenceId = 0xDA; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + playSound((getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); @@ -180,13 +180,13 @@ void GnapEngine::scene15_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - playSound(0x108E9, 0); + playSound(0x108E9, false); break; case GRAB_CURSOR: _s15_nextUpperButtonSequenceId = _sceneClickedHotspot + 0xC5; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + playSound((getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); @@ -206,13 +206,13 @@ void GnapEngine::scene15_run() { } else { switch (_verbCursor) { case LOOK_CURSOR: - playSound(0x108E9, 0); + playSound(0x108E9, false); break; case GRAB_CURSOR: _s15_nextLowerButtonSequenceId = _sceneClickedHotspot + 0xC5; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, 0); + playSound((getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index 849e06329c..aa08255cd6 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -119,8 +119,7 @@ void GnapEngine::scene17_platHangUpPhone() { } void GnapEngine::scene17_run() { - - playSound(0x10940, 1); + playSound(0x10940, true); startSoundTimerA(8); _sceneWaiting = false; _timers[4] = getRandom(100) + 200; @@ -486,7 +485,7 @@ void GnapEngine::scene17_run() { scene17_updateAnimations(); if (!isSoundPlaying(0x10940)) - playSound(0x10940, 1); + playSound(0x10940, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0) diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 8faeb64853..b338b4c3fc 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -309,10 +309,9 @@ void GnapEngine::scene18_waitForGnapAction() { } void GnapEngine::scene18_run() { - _s18_cowboyHatSurface = 0; - playSound(0x10940, 1); + playSound(0x10940, true); startSoundTimerA(4); _timers[5] = getRandom(100) + 100; diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index da295583f4..ddc977fb7b 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -59,7 +59,7 @@ enum { }; int GnapEngine::scene19_init() { - playSound(0x79, 0); + playSound(0x79, false); return isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; } diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 2301d2994e..dd49b4c0bf 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -180,7 +180,7 @@ void GnapEngine::scene20_stopSounds() { void GnapEngine::scene20_run() { - playSound(0x10940, 1); + playSound(0x10940, true); startSoundTimerA(8); @@ -490,7 +490,7 @@ void GnapEngine::scene20_run() { scene20_updateAnimations(); if (!isSoundPlaying(0x10940)) - playSound(0x10940, 1); + playSound(0x10940, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0) { diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index a6f42e10fa..c04b7c43cf 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -67,8 +67,7 @@ void GnapEngine::scene21_updateHotspots() { } void GnapEngine::scene21_run() { - - playSound(0x10940, 1); + playSound(0x10940, true); startSoundTimerA(6); _timers[5] = getRandom(100) + 100; @@ -232,7 +231,7 @@ void GnapEngine::scene21_run() { scene21_updateAnimations(); if (!isSoundPlaying(0x10940)) - playSound(0x10940, 1); + playSound(0x10940, true); if (!_isLeavingScene) { updateBeaverIdleSequence(); @@ -267,13 +266,10 @@ void GnapEngine::scene21_run() { } gameUpdateTick(); - } - } void GnapEngine::scene21_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index e3e793962a..9a16ce42ff 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -217,13 +217,13 @@ void GnapEngine::scene23_run() { _timers[5] = getRandom(100) + 200; switch (getRandom(3)) { case 0: - playSound(0xCE, 0); + playSound(0xCE, false); break; case 1: - playSound(0xD0, 0); + playSound(0xD0, false); break; case 2: - playSound(0xCF, 0); + playSound(0xCF, false); break; } } diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp index ace9043062..dcfeb181ac 100644 --- a/engines/gnap/scenes/scene24.cpp +++ b/engines/gnap/scenes/scene24.cpp @@ -58,7 +58,7 @@ void GnapEngine::scene24_updateHotspots() { void GnapEngine::scene24_run() { int counter = 0; - playSound(0x10940, 1); + playSound(0x10940, true); startSoundTimerA(9); @@ -182,7 +182,7 @@ void GnapEngine::scene24_run() { scene24_updateAnimations(); if (!isSoundPlaying(0x10940)) - playSound(0x10940, 1); + playSound(0x10940, true); if (!_isLeavingScene) { updateBeaverIdleSequence(); diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index 42df9bd35e..cf95acafb7 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -106,8 +106,7 @@ void GnapEngine::scene25_playAnims(int index) { } void GnapEngine::scene25_run() { - - playSound(0x10940, 1); + playSound(0x10940, true); startSoundTimerA(5); diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index 55b5b0774a..7da339358e 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -62,7 +62,7 @@ void GnapEngine::scene26_updateHotspots() { void GnapEngine::scene26_run() { startSoundTimerB(7); - playSound(0x1093B, 1); + playSound(0x1093B, true); _s26_currKidSequenceId = 0x5B; _s26_nextKidSequenceId = -1; @@ -198,7 +198,7 @@ void GnapEngine::scene26_run() { scene26_updateAnimations(); if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, 1); + playSound(0x1093B, true); if (!_isLeavingScene) { updateBeaverIdleSequence(); diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 2b7666b4ee..0466940267 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -70,7 +70,7 @@ void GnapEngine::scene27_updateHotspots() { void GnapEngine::scene27_run() { - playSound(0x1093B, 1); + playSound(0x1093B, true); startSoundTimerB(4); _timers[7] = getRandom(100) + 300; queueInsertDeviceIcon(); @@ -277,7 +277,7 @@ void GnapEngine::scene27_run() { scene27_updateAnimations(); if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, 1); + playSound(0x1093B, true); if (!_isLeavingScene) { updateBeaverIdleSequence(); diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index d175fdfd24..5f4dc74bd2 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -72,8 +72,7 @@ void GnapEngine::scene28_updateHotspots() { } void GnapEngine::scene28_run() { - - playSound(0x1093C, 1); + playSound(0x1093C, true); _s28_nextClownSequenceId = -1; queueInsertDeviceIcon(); _gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -287,7 +286,7 @@ void GnapEngine::scene28_run() { scene28_updateAnimations(); if (!isSoundPlaying(0x1093C)) - playSound(0x1093C, 1); + playSound(0x1093C, true); if (!_isLeavingScene) { updateBeaverIdleSequence(); diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 302c031eba..e4cea83bbd 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -60,7 +60,7 @@ void GnapEngine::scene29_updateHotspots() { void GnapEngine::scene29_run() { - playSound(0x1093B, 1); + playSound(0x1093B, true); startSoundTimerB(6); queueInsertDeviceIcon(); @@ -231,7 +231,7 @@ void GnapEngine::scene29_run() { scene29_updateAnimations(); if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, 1); + playSound(0x1093B, true); if (!_isLeavingScene) { if (_gnapActionStatus < 0) { diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 6b9504d615..5344d3f724 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -59,7 +59,7 @@ void GnapEngine::scene30_updateHotspots() { void GnapEngine::scene30_run() { bool hasTakenPill = false; - playSound(0x1093B, 1); + playSound(0x1093B, true); startSoundTimerB(6); queueInsertDeviceIcon(); @@ -182,7 +182,7 @@ void GnapEngine::scene30_run() { scene30_updateAnimations(); if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, 1); + playSound(0x1093B, true); if (!_isLeavingScene) { updateBeaverIdleSequence(); @@ -221,13 +221,10 @@ void GnapEngine::scene30_run() { } gameUpdateTick(); - } - } -void GnapEngine::scene30_updateAnimations() { - +void GnapEngine::scene30_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { @@ -281,7 +278,6 @@ void GnapEngine::scene30_updateAnimations() { break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 97c07fc0bb..084a12733b 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -61,8 +61,7 @@ void GnapEngine::scene31_updateHotspots() { } void GnapEngine::scene31_run() { - - playSound(0x1093B, 1); + playSound(0x1093B, true); startSoundTimerB(6); queueInsertDeviceIcon(); @@ -251,7 +250,7 @@ void GnapEngine::scene31_run() { scene31_updateAnimations(); if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, 1); + playSound(0x1093B, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0) diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index ed735ccef0..0822dc41ed 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -65,8 +65,7 @@ void GnapEngine::scene32_updateHotspots() { } void GnapEngine::scene32_run() { - - playSound(0x1091C, 1); + playSound(0x1091C, true); startSoundTimerC(5); queueInsertDeviceIcon(); _timers[4] = getRandom(100) + 300; @@ -84,7 +83,6 @@ void GnapEngine::scene32_run() { } while (!_sceneDone) { - updateMouseCursor(); updateCursorByHotspot(); testWalk(0, 0, -1, -1, -1, -1); @@ -93,7 +91,6 @@ void GnapEngine::scene32_run() { updateGrabCursorSprite(0, 0); switch (_sceneClickedHotspot) { - case kHSDevice: if (_gnapActionStatus < 0) { runMenu(); @@ -158,7 +155,7 @@ void GnapEngine::scene32_run() { scene32_updateAnimations(); if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, 1); + playSound(0x1091C, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0) diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index 99e9dbc6d4..3069dba025 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -63,8 +63,7 @@ void GnapEngine::scene33_updateHotspots() { } void GnapEngine::scene33_run() { - - playSound(0x1091C, 1); + playSound(0x1091C, true); startSoundTimerC(6); queueInsertDeviceIcon(); @@ -233,7 +232,7 @@ void GnapEngine::scene33_run() { scene33_updateAnimations(); if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, 1); + playSound(0x1091C, true); if (!_isLeavingScene) { if (_beaverActionStatus < 0) diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index 2d3ac77a07..4950717d16 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -82,7 +82,7 @@ void GnapEngine::scene39_run() { while (!_sceneDone) { if (!isSoundPlaying(0x1094B)) { - playSound(0x1094B, 1); + playSound(0x1094B, true); setSoundVolume(0x1094B, 60); } diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index fe95742f0f..cbbae71729 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -65,7 +65,7 @@ void GnapEngine::scene40_run() { while (!_sceneDone) { if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, 1); + playSound(0x1094B, true); updateMouseCursor(); updateCursorByHotspot(); diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 20751129e0..41480bf3ce 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -163,7 +163,7 @@ void GnapEngine::scene41_run() { while (!_sceneDone) { if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, 1); + playSound(0x1094B, true); if (!isFlag(kGFGnapControlsToyUFO)) { _hotspots[kHSToyUfo]._x1 = _toyUfoX - 25; diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 04f372f56f..906d84f040 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -147,7 +147,7 @@ void GnapEngine::scene42_run() { while (!_sceneDone) { if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, 1); + playSound(0x1094B, true); updateMouseCursor(); updateCursorByHotspot(); diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 83b11b7697..45b52a7adb 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -143,9 +143,8 @@ void GnapEngine::scene43_run() { } while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, 1); + playSound(0x1094B, true); updateMouseCursor(); updateCursorByHotspot(); @@ -199,11 +198,8 @@ void GnapEngine::scene43_run() { _timers[9] = 600; break; } - } else { - switch (_sceneClickedHotspot) { - case kHSDevice: runMenu(); scene43_updateHotspots(); @@ -364,12 +360,10 @@ void GnapEngine::scene43_run() { } gameUpdateTick(); - } if (_newSceneNum == 54) clearFlag(kGFGnapControlsToyUFO); - } void GnapEngine::scene43_updateAnimations() { diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 48dd1fdee1..dad63016a5 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -169,7 +169,7 @@ void GnapEngine::scene44_run() { while (!_sceneDone) { if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, 1); + playSound(0x1094B, true); updateMouseCursor(); updateCursorByHotspot(); diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index daad788055..3f8f790518 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -83,9 +83,8 @@ void GnapEngine::scene45_updateHotspots() { } void GnapEngine::scene45_run() { - if (!isSoundPlaying(0x1094A)) - playSound(0x1094A, 1); + playSound(0x1094A, true); queueInsertDeviceIcon(); @@ -181,9 +180,8 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(_beaverSequenceId, _beaverId, 1); while (!_sceneDone) { - if (!isSoundPlaying(0x1094A)) - playSound(0x1094A, 1); + playSound(0x1094A, true); updateMouseCursor(); updateCursorByHotspot(); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 29a8608273..d0c8965d86 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -124,9 +124,8 @@ void GnapEngine::scene46_run() { _timers[5] = getRandom(50) + 80; while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, 1); + playSound(0x1094B, true); updateMouseCursor(); updateCursorByHotspot(); diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index 9a4714529d..2c92919a8b 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -172,7 +172,7 @@ void GnapEngine::scene49_updateObstacle(int id) { obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; - playSound(224, 0); + playSound(224, false); scene49_increaseScore(30); } else if ((obstacle._laneNum == 1 && _s49_truckSequenceId == 0xB0) || (obstacle._laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || @@ -194,7 +194,7 @@ void GnapEngine::scene49_updateObstacle(int id) { _s49_truckSequenceId = obstacle._collisionSequenceId; _s49_truckId = 256; obstacle._currSequenceId = obstacle._passedSequenceId; - playSound(225, 0); + playSound(225, false); scene49_decreaseScore(30); } } else { @@ -212,7 +212,7 @@ void GnapEngine::scene49_updateObstacle(int id) { obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; - playSound(224, 0); + playSound(224, false); scene49_increaseScore(30); } } else if (obstacle._splashSequenceId) { @@ -275,7 +275,7 @@ void GnapEngine::scene49_run() { bool streetAnimToggle = false; bool bgAnimToggle = false; - playSound(0xE2, 1); + playSound(0xE2, true); setSoundVolume(0xE2, 75); hideCursor(); diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index d93506ff00..1d9e177989 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -323,7 +323,7 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { } else { _gameSys->removeSequence(item->_currSequenceId, item->_id, true); _gameSys->setAnimation(0, 0, index + 1); - playSound(218, 0); + playSound(218, false); if (scene51_incCashAmount(item->_currSequenceId) == 1995) { scene51_winMinigame(); _sceneDone = true; @@ -523,7 +523,7 @@ void GnapEngine::scene51_playIntroAnim() { _s51_platypusSequenceId = _s51_platypusNextSequenceId; ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, 0); + playSound(214, false); } _s51_platypusNextSequenceId = 0x75; @@ -541,7 +541,7 @@ void GnapEngine::scene51_playIntroAnim() { } else { ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, 0); + playSound(214, false); } } @@ -604,7 +604,7 @@ int GnapEngine::scene51_incCashAmount(int sequenceId) { void GnapEngine::scene51_winMinigame() { scene51_updateCash(1995); - playSound(218, 0); + playSound(218, false); // TODO delayTicksA(1, 5); _newSceneNum = 48; invRemove(kItemBanana); @@ -781,7 +781,7 @@ void GnapEngine::scene51_run() { } else { ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, 0); + playSound(214, false); } } } else { @@ -833,7 +833,7 @@ void GnapEngine::scene51_run() { } else { ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, 0); + playSound(214, false); } } } else { diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index 0b00b4299a..0caf7a83e8 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -47,7 +47,7 @@ void GnapEngine::scene52_update() { if (_s52_liveAlienRows == 0 && !_s52_alienSingle) { _s52_alienWave = false; - playSound(48, 0); + playSound(48, false); ++_s52_alienCounter; if (_s52_alienCounter != 3) { _timers[0] = 50; @@ -172,7 +172,7 @@ void GnapEngine::scene52_fireShipCannon(int posX) { _s52_shipCannonPosY = _s52_shipCannonTopY; _gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8); _gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); - playSound(0x2D, 0); + playSound(0x2D, false); if (scene52_shipCannonHitShield(cannonNum)) { _gameSys->setAnimation(0, 0, cannonNum + 8); _gameSys->removeSequence(0x23, cannonNum + 256, true); @@ -421,7 +421,7 @@ int GnapEngine::scene52_updateHitAlien() { if (hitAlienNum != -1 && _s52_items[rowNum][hitAlienNum] >= 0) { _s52_gameScore = ((_s52_items[rowNum][hitAlienNum] - 24) % 3 + _s52_gameScore + 1) % 1000; _s52_items[rowNum][hitAlienNum] = -2; - playSound(44, 0); + playSound(44, false); _gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_alienLeftX + hitAlienNum * _s52_alienWidth + _s52_alienRowXOfs[rowNum] - 10, ya - _s52_alienHeight); result = 1; @@ -540,7 +540,7 @@ int GnapEngine::scene52_alienCannonHitShield(int cannonNum) { } _gameSys->setAnimation(0, 0, cannonNum + 9); _gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[cannonNum] - 18, _s52_arcadeScreenBottom - 44); - playSound(0x2C, 0); + playSound(0x2C, false); result = 1; } @@ -583,7 +583,7 @@ int GnapEngine::scene52_shipCannonHitShield(int cannonNum) { _s52_shieldSpriteIds[shieldNum] = -1; } _gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_shipCannonPosX - 18, _s52_arcadeScreenBottom - 44); - playSound(0x2C, 0); + playSound(0x2C, false); result = 1; } @@ -639,10 +639,10 @@ void GnapEngine::scene52_shipExplode() { if (!_s52_aliensCount) { _gameSys->setAnimation(0, 0, 7); _gameSys->removeSequence(_s52_ufoSequenceId, 256, true); - playSound(44, 0); + playSound(44, false); _gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_aliensCount = 1; - playSound(0x31, 0); + playSound(0x31, false); } } @@ -735,10 +735,10 @@ void GnapEngine::scene52_initAlienSize() { void GnapEngine::scene52_playSound() { if (_s52_soundToggle) { - playSound(0x2F, 0); + playSound(0x2F, false); _s52_soundToggle = false; } else { - playSound(0x2E, 0); + playSound(0x2E, false); _s52_soundToggle = true; } } diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index 0b06f55e09..9b2867ac12 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -270,10 +270,9 @@ void GnapEngine::scene53_run() { setVerbCursor(GRAB_CURSOR); - playSound(0xA0, 1); + playSound(0xA0, true); while (!_sceneDone) { - updateMouseCursor(); updateCursorByHotspot(); -- cgit v1.2.3 From 03027be392de3dbf698361abf2395f3d7cc4e53e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Apr 2016 06:57:12 +0200 Subject: GNAP: Fix hasFeature --- engines/gnap/detection.cpp | 15 +++++++++++---- engines/gnap/gnap.cpp | 5 ----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 7e4c085503..69628f9cb1 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -78,14 +78,21 @@ bool GnapMetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave); + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportCreationDate); #if 0 - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate); + (f == kSavesSupportThumbnail) || #endif } +bool Gnap::GnapEngine::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +} + void GnapMetaEngine::removeSaveState(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index a755c9841f..19dd353667 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -221,11 +221,6 @@ Common::Error GnapEngine::run() { return Common::kNoError; } -bool GnapEngine::hasFeature(EngineFeature f) const { - return - false; -} - void GnapEngine::updateEvents() { Common::Event event; -- cgit v1.2.3 From 52f0712b66fff3351ae6c2b5fd8e1abcdaad6001 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Apr 2016 07:26:30 +0200 Subject: GNAP: Add debugger --- engines/gnap/debugger.cpp | 42 ++++++++++++++++++++++++++++++++++++ engines/gnap/debugger.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++ engines/gnap/gnap.cpp | 25 +++++++++++++++------- engines/gnap/gnap.h | 2 ++ engines/gnap/module.mk | 1 + 5 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 engines/gnap/debugger.cpp create mode 100644 engines/gnap/debugger.h diff --git a/engines/gnap/debugger.cpp b/engines/gnap/debugger.cpp new file mode 100644 index 0000000000..07f3f6714c --- /dev/null +++ b/engines/gnap/debugger.cpp @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/debugger.h" +#include "gnap/gnap.h" + +namespace Gnap { + +Debugger::Debugger(GnapEngine *vm) : GUI::Debugger(), _vm(vm) { + // Register methods + registerCmd("hotspots", WRAP_METHOD(Debugger, Cmd_Hotspots)); + + // Set fields + _showHotspotNumber = false; +} + +bool Debugger::Cmd_Hotspots(int argc, const char **argv) { + _showHotspotNumber ^= 1; + + return true; +} + +} // End of namespace Gnap diff --git a/engines/gnap/debugger.h b/engines/gnap/debugger.h new file mode 100644 index 0000000000..ac83cc5504 --- /dev/null +++ b/engines/gnap/debugger.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_DEBUGGER_H +#define GNAP_DEBUGGER_H + +#include "common/scummsys.h" +#include "gui/debugger.h" + +namespace Gnap { + +class GnapEngine; + +class Debugger : public GUI::Debugger { +private: + GnapEngine *_vm; +public: + /* + * Specifies whether to show the hotspot IDs + */ + bool _showHotspotNumber; +protected: + /** + * List the active hotspots during the current time period + */ + bool Cmd_Hotspots(int argc, const char **argv); + +public: + Debugger(GnapEngine *vm); + virtual ~Debugger() {} +}; + +} // End of namespace Gnap + +#endif diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 19dd353667..793cc2f3e7 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -139,7 +139,8 @@ Common::Error GnapEngine::run() { _sequenceCache = new SequenceCache(_dat); _gameSys = new GameSys(this); _soundMan = new SoundMan(this); - + _debugger = new Debugger(this); + _menuBackgroundSurface = nullptr; initGlobalSceneVars(); @@ -213,6 +214,7 @@ Common::Error GnapEngine::run() { delete _soundCache; delete _spriteCache; delete _dat; + delete _debugger; delete _exe; @@ -227,6 +229,13 @@ void GnapEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: + // Check for debugger + if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _debugger->attach(); + _debugger->onFrame(); + } + _keyPressState[event.kbd.keycode] = 1; _keyDownState[event.kbd.keycode] = 1; break; @@ -387,13 +396,13 @@ void GnapEngine::updateCursorByHotspot() { if (!_isWaiting) { int hotspotIndex = getHotspotIndexAtPos(_mouseX, _mouseY); -#if 1 - // NOTE This causes some display glitches so don't worry - char t[256]; - sprintf(t, "hotspot = %d", hotspotIndex); - _gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0); - _gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t); -#endif + if (_debugger->_showHotspotNumber) { + // NOTE This causes some display glitches so don't worry + char t[256]; + sprintf(t, "hotspot = %d", hotspotIndex); + _gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0); + _gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t); + } if (hotspotIndex < 0) setCursor(kDisabledCursors[_verbCursor]); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index aa6e8d57e4..2773845542 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -39,6 +39,7 @@ #include "graphics/pixelformat.h" #include "graphics/wincursor.h" +#include "gnap/debugger.h" #include "gnap/resource.h" struct ADGameDescription; @@ -304,6 +305,7 @@ public: SequenceCache *_sequenceCache; GameSys *_gameSys; SoundMan *_soundMan; + Debugger *_debugger; int _lastUpdateClock; diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 7a3fc3a9a0..a2e5c77c82 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -2,6 +2,7 @@ MODULE := engines/gnap MODULE_OBJS := \ datarchive.o \ + debugger.o \ detection.o \ gamesys.o \ gnap.o \ -- cgit v1.2.3 From 43c65df52620bc7f8cf013c460e77620d331836e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Apr 2016 08:00:11 +0200 Subject: GNAP: Use debug channels --- engines/gnap/datarchive.cpp | 6 +++-- engines/gnap/gamesys.cpp | 51 ++++++++++++++++++++--------------------- engines/gnap/gnap.cpp | 23 ++++++------------- engines/gnap/gnap.h | 4 ++++ engines/gnap/grid.cpp | 2 +- engines/gnap/resource.cpp | 13 ++++++----- engines/gnap/resource.h | 6 ++--- engines/gnap/scenes/scene15.cpp | 10 +------- engines/gnap/scenes/scene18.cpp | 6 +---- engines/gnap/scenes/scene53.cpp | 2 +- 10 files changed, 53 insertions(+), 70 deletions(-) diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp index a0423c1f29..0f6faee6df 100644 --- a/engines/gnap/datarchive.cpp +++ b/engines/gnap/datarchive.cpp @@ -24,6 +24,8 @@ #include "common/file.h" #include "common/stream.h" #include "common/substream.h" + +#include "gnap/gnap.h" #include "gnap/datarchive.h" #include "engines/util.h" @@ -40,7 +42,7 @@ DatArchive::DatArchive(const char *filename) { _fd->skip(2); // Skip unknown _fd->skip(2); // Skip unknown _entriesCount = _fd->readUint32LE(); - debug(1, "_entriesCount: %d", _entriesCount); + debugC(kDebugBasic, "_entriesCount: %d", _entriesCount); _fd->skip(4); // Skip unknown _entries = new DatEntry[_entriesCount]; for (int i = 0; i < _entriesCount; ++i) { @@ -59,7 +61,7 @@ DatArchive::~DatArchive() { byte *DatArchive::load(int index) { _fd->seek(_entries[index]._ofs); - debug(1, "_entries[index].outSize2: %d; _entries[index].outSize1: %d", _entries[index]._outSize2, _entries[index]._outSize1); + debugC(kDebugBasic, "_entries[index].outSize2: %d; _entries[index].outSize1: %d", _entries[index]._outSize2, _entries[index]._outSize1); byte *buffer = new byte[_entries[index]._outSize1]; if (!Common::decompressDCL(_fd, buffer, _entries[index]._outSize2, _entries[index]._outSize1)) error("DatArchive::load() Error during decompression of entry %d", index); diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index fd53005d27..ef0a265456 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -69,7 +69,7 @@ GameSys::~GameSys() { } void GameSys::insertSequence(int sequenceId, int id, int sequenceId2, int id2, int flags, int totalDuration, int16 x, int16 y) { - debug(0, "GameSys::insertSequence() [%08X, %d] -> [%08X, %d] (%d, %d)", sequenceId, id, sequenceId2, id2, x, y); + debugC(kDebugBasic, "GameSys::insertSequence() [%08X, %d] -> [%08X, %d] (%d, %d)", sequenceId, id, sequenceId2, id2, x, y); Sequence sequence; SequenceResource *sequenceResource = _vm->_sequenceCache->get(sequenceId); sequenceResource->_sequenceId = sequenceId; @@ -168,7 +168,7 @@ int GameSys::isSequenceActive(int sequenceId, int id) { } void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, int a6, int a7) { - debug(1, "GameSys::setBackgroundSurface() Setting background image"); + debugC(kDebugBasic, "GameSys::setBackgroundSurface() Setting background image"); _backgroundSurface = surface; if (!_backgroundSurface) { @@ -177,7 +177,7 @@ void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, i } if (!_frontSurface || _frontSurface->w != surface->w || _frontSurface->h != surface->h) { - debug(1, "GameSys::setBackgroundSurface() Creating background working surface"); + debugC(kDebugBasic, "GameSys::setBackgroundSurface() Creating background working surface"); if (_frontSurface) _frontSurface->free(); delete _frontSurface; @@ -244,7 +244,7 @@ Graphics::Surface *GameSys::allocSurface(int width, int height) { } Graphics::Surface *GameSys::createSurface(int resourceId) { - debug(0, "GameSys::createSurface() resourceId: %08X", resourceId); + debugC(kDebugBasic, "GameSys::createSurface() resourceId: %08X", resourceId); SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); Graphics::Surface *surface = allocSurface(spriteResource->_width, spriteResource->_height); @@ -364,7 +364,7 @@ int GameSys::getSpriteHeightById(int resourceId) { } Graphics::Surface *GameSys::loadBitmap(int resourceId) { - debug("GameSys::loadBitmap() resourceId: %08X", resourceId); + debugC(kDebugBasic, "GameSys::loadBitmap() resourceId: %08X", resourceId); if (_vm->_dat->getResourceType(resourceId) != 1) return nullptr; byte *resourceData = _vm->_dat->loadResource(resourceId); @@ -382,12 +382,12 @@ Graphics::Surface *GameSys::loadBitmap(int resourceId) { void GameSys::drawBitmap(int resourceId) { Graphics::Surface *bmpSurface = loadBitmap(resourceId); if (!bmpSurface || !_backgroundSurface) { - debug("GameSys::drawBitmap() Error loading the bitmap"); + debugC(kDebugBasic, "GameSys::drawBitmap() Error loading the bitmap"); return; } if (bmpSurface->format != _backgroundSurface->format || bmpSurface->w != _backgroundSurface->w || bmpSurface->h != _backgroundSurface->h) { - debug("GameSys::drawBitmap() Different bitmap properties than current background"); + debugC(kDebugBasic, "GameSys::drawBitmap() Different bitmap properties than current background"); } else { byte *src = (byte*)bmpSurface->getPixels(); byte *dst = (byte*)_backgroundSurface->getPixels(); @@ -452,7 +452,7 @@ void GameSys::seqInsertGfx(int index, int duration) { GfxItem *gfxItem = &_gfxItems[i + gfxIndex]; SequenceAnimation *animation = &sequenceResource->_animations[i]; - debug(0, "GameSys::seqInsertGfx() seqItem->sequenceId: %08X", seqItem->_sequenceId); + debugC(kDebugBasic, "GameSys::seqInsertGfx() seqItem->sequenceId: %08X", seqItem->_sequenceId); gfxItem->_sequenceId = seqItem->_sequenceId; gfxItem->_id = seqItem->_id; @@ -737,14 +737,14 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f } void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &frame, Common::Rect *subRect) { - debug(1, "GameSys::seqDrawStaticFrame() rect: (%d, %d, %d, %d)", + debugC(kDebugBasic, "GameSys::seqDrawStaticFrame() rect: (%d, %d, %d, %d)", frame._rect.left, frame._rect.top, frame._rect.right, frame._rect.bottom); Common::Rect srcRect = subRect ? *subRect : frame._rect; Common::Rect clipRect; if (!intersectRect(clipRect, srcRect, _screenRect)) { - debug(1, "GameSys::seqDrawStaticFrame() Surface not inside screen"); + debugC(kDebugBasic, "GameSys::seqDrawStaticFrame() Surface not inside screen"); return; } @@ -757,14 +757,14 @@ void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &fram } void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame &frame, Common::Rect *subRect) { - debug(1, "GameSys::seqDrawSpriteFrame() spriteId: %04X; rect: (%d, %d, %d, %d)", + debugC(kDebugBasic, "GameSys::seqDrawSpriteFrame() spriteId: %04X; rect: (%d, %d, %d, %d)", frame._spriteId, frame._rect.left, frame._rect.top, frame._rect.right, frame._rect.bottom); Common::Rect srcRect = subRect ? *subRect : frame._rect; Common::Rect clipRect; if (!intersectRect(clipRect, srcRect, _screenRect)) { - debug(1, "GameSys::seqDrawSpriteFrame() Sprite not inside screen"); + debugC(kDebugBasic, "GameSys::seqDrawSpriteFrame() Sprite not inside screen"); return; } @@ -773,7 +773,7 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & const int x = clipRect.left, y = clipRect.top; - debug(1, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame._isScaled ? 1 : 0); + debugC(kDebugBasic, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame._isScaled ? 1 : 0); // 32bit sprite drawing if (frame._isScaled) { @@ -786,7 +786,7 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & } void GameSys::drawSprites() { - debug(1, "GameSys::drawSprites() _gfxItemsCount: %d", _gfxItemsCount); + debugC(kDebugBasic, "GameSys::drawSprites() _gfxItemsCount: %d", _gfxItemsCount); // TODO Split into multiple functions for clarity @@ -847,14 +847,13 @@ void GameSys::drawSprites() { for (int m = 0; m < _gfxItemsCount; ++m) { GfxItem *gfxItem5 = &_gfxItems[m]; - debug(0, "DrawGfxItem(%d) updFlag: %d; currFrame.spriteId: %04X; updRectsCount: %d; flags: %04X; sequenceId: %08X", + debugC(kDebugBasic, "DrawGfxItem(%d) updFlag: %d; currFrame.spriteId: %04X; updRectsCount: %d; flags: %04X; sequenceId: %08X", m, gfxItem5->_updFlag, gfxItem5->_currFrame._spriteId, gfxItem5->_updRectsCount, gfxItem5->_flags, gfxItem5->_sequenceId); if (gfxItem5->_updFlag) { if (gfxItem5->_currFrame._spriteId != -1) { if (gfxItem5->_flags & 1) { seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, nullptr); - //debug("seqDrawStaticFrame"); } else if (gfxItem5->_flags & 2) { // TODO seqDrawAviFrame(gfxItem5->currFrame.spriteId, &gfxItem5->currFrame, 0, gfxItem5->flags & 8); } else { @@ -884,11 +883,11 @@ void GameSys::drawSprites() { } } - debug(1, "GameSys::drawSprites() OK"); + debugC(kDebugBasic, "GameSys::drawSprites() OK"); } void GameSys::updateRect(const Common::Rect &r) { - debug(1, "GameSys::updateRect() %d, %d, %d, %d [%d, %d]", r.left, r.top, r.right, r.bottom, r.width(), r.height()); + debugC(kDebugBasic, "GameSys::updateRect() %d, %d, %d, %d [%d, %d]", r.left, r.top, r.right, r.bottom, r.width(), r.height()); if (r.width() > 0 && r.height() > 0) { byte *pixels = (byte*)_frontSurface->getBasePtr(r.left, r.top); _vm->_system->copyRectToScreen(pixels, _frontSurface->pitch, r.left, r.top, @@ -897,7 +896,7 @@ void GameSys::updateRect(const Common::Rect &r) { } void GameSys::updateScreen() { - debug(1, "GameSys::updateScreen()"); + debugC(kDebugBasic, "GameSys::updateScreen()"); for (uint i = 0; i < _dirtyRects.size(); ++i) updateRect(_dirtyRects[i]); @@ -931,7 +930,7 @@ void GameSys::updateScreen() { updateRect(Common::Rect(0, 0, 800, 600)); - debug(1, "GameSys::updateScreen() OK"); + debugC(kDebugBasic, "GameSys::updateScreen() OK"); } void GameSys::handleReqRemoveSequenceItem() { @@ -1003,12 +1002,12 @@ void GameSys::handleReqRemoveSpriteDrawItems() { void GameSys::fatUpdateFrame() { - debug(1, "GameSys::fatUpdateFrame()"); + debugC(kDebugBasic, "GameSys::fatUpdateFrame()"); int32 clockDelta = _gameSysClock - _lastUpdateClock; _lastUpdateClock = _gameSysClock; - debug(1, "GameSys::fatUpdateFrame() clockDelta: %d", clockDelta); + debugC(kDebugBasic, "GameSys::fatUpdateFrame() clockDelta: %d", clockDelta); if (clockDelta <= 0) return; @@ -1129,7 +1128,7 @@ void GameSys::fatUpdateFrame() { } if (_newSpriteDrawItemsCount > 0) { - debug(0, "_newSpriteDrawItemsCount: %d", _newSpriteDrawItemsCount); + debugC(kDebugBasic, "_newSpriteDrawItemsCount: %d", _newSpriteDrawItemsCount); for (int k = 0; k < _newSpriteDrawItemsCount; ++k) { if (_gfxItemsCount < 50) { int insertIndex; @@ -1183,7 +1182,7 @@ void GameSys::fatUpdateFrame() { // NOTE Skipped avi code (reqAviStart) - debug(1, "GameSys::fatUpdateFrame() _fatSequenceItems.size(): %d", _fatSequenceItems.size()); + debugC(kDebugBasic, "GameSys::fatUpdateFrame() _fatSequenceItems.size(): %d", _fatSequenceItems.size()); for (uint i = 0; i < _fatSequenceItems.size(); ++i) { Sequence *seqItem = &_fatSequenceItems[i]; @@ -1238,7 +1237,7 @@ void GameSys::fatUpdateFrame() { } } - debug(1, "GameSys::fatUpdateFrame() _seqItems.size(): %d", _seqItems.size()); + debugC(kDebugBasic, "GameSys::fatUpdateFrame() _seqItems.size(): %d", _seqItems.size()); for (uint i = 0; i < _seqItems.size(); ++i) { Sequence *seqItem = &_seqItems[i]; @@ -1260,7 +1259,7 @@ void GameSys::fatUpdateFrame() { } void GameSys::fatUpdate() { - debug(1, "GameSys::fatUpdate() _gfxItemsCount: %d", _gfxItemsCount); + debugC(kDebugBasic, "GameSys::fatUpdate() _gfxItemsCount: %d", _gfxItemsCount); for (int i = 0; i < _gfxItemsCount; ++i) { _gfxItems[i]._updFlag = false; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 793cc2f3e7..6e81af9d15 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -95,6 +95,7 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : Engine(syst), _gameDescription(gd) { _random = new Common::RandomSource("gnap"); + DebugMan.addDebugChannel(kDebugBasic, "basic", "Basic debug level"); Engine::syncSoundSettings(); } @@ -218,8 +219,6 @@ Common::Error GnapEngine::run() { delete _exe; - debug("run() done"); - return Common::kNoError; } @@ -655,7 +654,7 @@ bool GnapEngine::isSoundPlaying(int resourceId) { } void GnapEngine::playSound(int resourceId, bool looping) { - debug(0, "playSound(%08X, %d)", resourceId, looping); + debugC(kDebugBasic, "playSound(%08X, %d)", resourceId, looping); _soundMan->playSound(resourceId, looping); } @@ -749,8 +748,6 @@ void GnapEngine::mainLoop() { _grabCursorSpriteIndex = -1; _grabCursorSprite = nullptr; - debug("MainLoop #1"); - // > DEBUG BEGIN _currentSceneNum = 0; _newSceneNum = 1; @@ -760,16 +757,15 @@ void GnapEngine::mainLoop() { loadStockDat(); while (!_gameDone) { - - debug("New scene: %d", _newSceneNum); - + debugC(kDebugBasic, "New scene: %d", _newSceneNum); + _prevSceneNum = _currentSceneNum; _currentSceneNum = _newSceneNum; - debug("GnapEngine::mainLoop() _prevSceneNum: %d; _currentSceneNum: %d", _prevSceneNum, _currentSceneNum); + debugC(kDebugBasic, "GnapEngine::mainLoop() _prevSceneNum: %d; _currentSceneNum: %d", _prevSceneNum, _currentSceneNum); if (_newCursorValue != _cursorValue) { - debug("_newCursorValue: %d", _newCursorValue); + debugC(kDebugBasic, "_newCursorValue: %d", _newCursorValue); _cursorValue = _newCursorValue; if (!_wasSavegameLoaded) initGameFlags(_cursorValue); @@ -803,8 +799,6 @@ void GnapEngine::mainLoop() { _dat->close(1); // TODO freeMenuSprite(); // TODO freeFont(); - - debug("MainLoop #XXX2"); } void GnapEngine::initScene() { @@ -824,7 +818,7 @@ void GnapEngine::initScene() { datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); - debug("GnapEngine::initScene() datFilename: %s", datFilename.c_str()); + debugC(kDebugBasic, "GnapEngine::initScene() datFilename: %s", datFilename.c_str()); _dat->open(0, datFilename.c_str()); @@ -896,7 +890,6 @@ void GnapEngine::checkGameKeys() { updatePause(); } // TODO? Debug input -// debug("facing %d", _gnapIdleFacing); } void GnapEngine::startSoundTimerA(int timerIndex) { @@ -2273,8 +2266,6 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, _toyUfoX = clippedDestX; _toyUfoY = clippedDestY; -// debug("v21: %d", v21); - if (i - 1 > 0) { int seqId; if (isFlag(kGFUnk16)) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 2773845542..d40b26aac4 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -83,6 +83,10 @@ struct GridStruct { const int kMaxGridStructs = 30; const int kMaxTimers = 10; +enum GnapDebugChannels { + kDebugBasic = 1 << 0 +}; + enum { SF_NONE = 0x0000, SF_LOOK_CURSOR = 0x0001, diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 20f33563dd..5bb1e06a92 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -575,7 +575,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen int gnapId = _gnapId; int gnapSequenceDatNum = _gnapSequenceDatNum; - debug(0, "_gnapWalkNodesCount: %d", _gnapWalkNodesCount); + debugC(kDebugBasic, "_gnapWalkNodesCount: %d", _gnapWalkNodesCount); for (int index = 0; index < _gnapWalkNodesCount; ++index) { _gnapWalkNodes[index].id = index + 20 * _gnapWalkNodes[index].gridY1; diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index eb07d96fdb..ee9f14b602 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -20,6 +20,7 @@ * */ +#include "gnap/gnap.h" #include "gnap/resource.h" namespace Gnap { @@ -36,8 +37,8 @@ void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) { _spriteId = stream.readUint32LE(); _soundId = stream.readUint32LE(); _unusedVal = stream.readUint32LE(); - //isScaled = 0;//DEBUG - debug(1, "SequenceFrame() spriteId: %d; soundId: %d", _spriteId, _soundId); + + debugC(kDebugBasic, "SequenceFrame() spriteId: %d; soundId: %d", _spriteId, _soundId); } // SequenceAnimation @@ -48,7 +49,7 @@ void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) { _additionalDelay = stream.readUint32LE(); _framesCount = stream.readUint16LE(); _maxTotalDuration = stream.readUint16LE(); - debug(1, "SequenceAnimation() framesCount: %d", _framesCount); + debugC(kDebugBasic, "SequenceAnimation() framesCount: %d", _framesCount); frames = new SequenceFrame[_framesCount]; for (int i = 0; i < _framesCount; ++i) frames[i].loadFromStream(stream); @@ -69,10 +70,10 @@ SequenceResource::SequenceResource(int resourceId, byte *data, uint32 size) { _yOffs = stream.readUint16LE(); _animationsCount = stream.readUint32LE(); _animations = new SequenceAnimation[_animationsCount]; - debug(1, "SequenceResource() _animationsCount: %d", _animationsCount); + debugC(kDebugBasic, "SequenceResource() _animationsCount: %d", _animationsCount); for (int i = 0; i < _animationsCount; ++i) { uint32 animationOffs = stream.readUint32LE(); - debug(1, "animationOffs: %08X", animationOffs); + debugC(kDebugBasic, "animationOffs: %08X", animationOffs); uint32 oldOffs = stream.pos(); stream.seek(animationOffs); _animations[i].loadFromStream(stream); @@ -97,7 +98,7 @@ SpriteResource::SpriteResource(int resourceId, byte *data, uint32 size) { _colorsCount = READ_LE_UINT16(_data + 10); _palette = (uint32*)(_data + 12); _pixels = _data + 12 + _colorsCount * 4; - debug(1, "SpriteResource() width: %d; height: %d; colorsCount: %d", _width, _height, _colorsCount); + debugC(kDebugBasic, "SpriteResource() width: %d; height: %d; colorsCount: %d", _width, _height, _colorsCount); } SpriteResource::~SpriteResource() { diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index b689869d2e..dc67097adf 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -122,11 +122,11 @@ public: ResourceClass *get(int resourceId) { Resource *resource = find(resourceId); if (!resource) { - debug(1, "Loading resource type %d with ID %08X from disk", ResourceType, resourceId); + debugC(kDebugBasic, "Loading resource type %d with ID %08X from disk", ResourceType, resourceId); resource = new Resource(load(resourceId)); _cache[resourceId] = resource; } else { - debug(1, "Resource type %d with ID %08X was in cache", ResourceType, resourceId); + debugC(kDebugBasic, "Resource type %d with ID %08X was in cache", ResourceType, resourceId); } resource->_isLocked = true; return resource->_obj; @@ -139,7 +139,6 @@ public: } void purge(bool force = false) { - debug("Count before purge: %d", _cache.size()); for (CacheMapIterator it = _cache.begin(); it != _cache.end(); ++it) { Resource *resource = it->_value; if (force || !resource->_isLocked) { @@ -147,7 +146,6 @@ public: _cache.erase(it); } } - debug("Count after purge: %d", _cache.size()); } protected: diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp index 89ca126c01..7bdfc8174d 100644 --- a/engines/gnap/scenes/scene15.cpp +++ b/engines/gnap/scenes/scene15.cpp @@ -102,11 +102,7 @@ void GnapEngine::scene15_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (_sceneClickedHotspot >= 0) - debug("_sceneClickedHotspot: %d; _verbCursor: %d", _sceneClickedHotspot, _verbCursor); - switch (_sceneClickedHotspot) { - case kHSDevice: if (_gnapActionStatus < 0) { runMenu(); @@ -238,13 +234,10 @@ void GnapEngine::scene15_run() { } gameUpdateTick(); - } - } -void GnapEngine::scene15_updateAnimations() { - +void GnapEngine::scene15_updateAnimations() { if (_gameSys->getAnimationStatus(0) == 2) { if (_isLeavingScene) { _sceneDone = true; @@ -337,7 +330,6 @@ void GnapEngine::scene15_updateAnimations() { } } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index b338b4c3fc..4bd75f59a4 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -309,7 +309,7 @@ void GnapEngine::scene18_waitForGnapAction() { } void GnapEngine::scene18_run() { - _s18_cowboyHatSurface = 0; + _s18_cowboyHatSurface = nullptr; playSound(0x10940, true); startSoundTimerA(4); @@ -398,7 +398,6 @@ void GnapEngine::scene18_run() { } while (!_sceneDone) { - updateMouseCursor(); updateCursorByHotspot(); @@ -407,9 +406,6 @@ void GnapEngine::scene18_run() { _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - if (_sceneClickedHotspot >= 0) - debug("_sceneClickedHotspot: %d", _sceneClickedHotspot); - switch (_sceneClickedHotspot) { case kHSDevice: diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index 9b2867ac12..a21641e505 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -301,7 +301,7 @@ void GnapEngine::scene53_run() { stopSound(0xA0); ++phoneNumberLen; phoneNumber = scene53_pressPhoneNumberButton(phoneNumber, _sceneClickedHotspot - 1); - debug("phoneNumber: %d", phoneNumber); + debugC(kDebugBasic, "phoneNumber: %d", phoneNumber); if (phoneNumberLen == 7) { _gnapActionStatus = 1; if (isFlag(kGFSpringTaken)) { -- cgit v1.2.3 From 0577aae277db3521f0068dc23418b39b49cfaa5d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Apr 2016 13:40:00 +0200 Subject: GNAP: Fix compilation --- engines/gnap/resource.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index dc67097adf..73cee761c6 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -122,11 +122,11 @@ public: ResourceClass *get(int resourceId) { Resource *resource = find(resourceId); if (!resource) { - debugC(kDebugBasic, "Loading resource type %d with ID %08X from disk", ResourceType, resourceId); + debug(9, "Loading resource type %d with ID %08X from disk", ResourceType, resourceId); resource = new Resource(load(resourceId)); _cache[resourceId] = resource; } else { - debugC(kDebugBasic, "Resource type %d with ID %08X was in cache", ResourceType, resourceId); + debug(9, "Resource type %d with ID %08X was in cache", ResourceType, resourceId); } resource->_isLocked = true; return resource->_obj; @@ -156,10 +156,10 @@ protected: Resource(ResourceClass *obj) : _obj(obj), _isLocked(false) {} ~Resource() { delete _obj; } }; - + typedef Common::HashMap CacheMap; typedef typename CacheMap::iterator CacheMapIterator; - + DatManager *_dat; CacheMap _cache; @@ -169,7 +169,7 @@ protected: return it->_value; return nullptr; } - + ResourceClass *load(int resourceId) { if (_dat->getResourceType(resourceId) != ResourceType) { error("ResourceCache::load() Wrong resource type: Expected %d, got %d", ResourceType, _dat->getResourceType(resourceId)); -- cgit v1.2.3 From 5c072b859e3e7ffaa45125f18cd1ff2c21aaf980 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Apr 2016 13:41:50 +0200 Subject: GNAP: Fix warning --- engines/gnap/gnap.cpp | 112 ++++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 6e81af9d15..2dfd0b1b72 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -93,10 +93,10 @@ static const char *kSceneNames[] = { GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : Engine(syst), _gameDescription(gd) { - + _random = new Common::RandomSource("gnap"); DebugMan.addDebugChannel(kDebugBasic, "basic", "Basic debug level"); - + Engine::syncSoundSettings(); } @@ -112,9 +112,9 @@ Common::Error GnapEngine::run() { // We do not support color conversion yet if (_system->getScreenFormat() != format) return Common::kUnsupportedColorMode; - + _lastUpdateClock = 0; - + // >>>>> Variable initialization _cursorIndex = -1; _verbCursor = 1; @@ -143,7 +143,7 @@ Common::Error GnapEngine::run() { _debugger = new Debugger(this); _menuBackgroundSurface = nullptr; - + initGlobalSceneVars(); #if 1 @@ -151,23 +151,23 @@ Common::Error GnapEngine::run() { mainLoop(); #else - + Graphics::Surface *testBack = new Graphics::Surface(); testBack->create(800, 600, _system->getScreenFormat()); //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - + _currentSceneNum = 41; Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); _dat->open(0, datFilename.c_str()); - + _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); _gameSys->insertSequence(0x11b, 100, -1, -1, kSeqNone, 0, 0, 0); CursorMan.showMouse(true); - + while (!shouldQuit()) { Common::Event event; @@ -188,7 +188,7 @@ Common::Error GnapEngine::run() { break; } } - + _gameSys->fatUpdate(); _gameSys->drawSprites(); _gameSys->updateScreen(); @@ -201,7 +201,7 @@ Common::Error GnapEngine::run() { } _dat->close(0); - + testBack->free(); delete testBack; @@ -216,7 +216,7 @@ Common::Error GnapEngine::run() { delete _spriteCache; delete _dat; delete _debugger; - + delete _exe; return Common::kNoError; @@ -637,7 +637,7 @@ void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int } int GnapEngine::getSequenceTotalDuration(int resourceId) { - SequenceResource *sequenceResource = _sequenceCache->get(resourceId); + SequenceResource *sequenceResource = _sequenceCache->get(resourceId); int maxValue = 0; for (int i = 0; i < sequenceResource->_animationsCount; ++i) { SequenceAnimation *animation = &sequenceResource->_animations[i]; @@ -737,7 +737,7 @@ void GnapEngine::loadStockDat() { } void GnapEngine::mainLoop() { - + _newCursorValue = 1; _cursorValue = -1; _newSceneNum = 0; @@ -757,11 +757,11 @@ void GnapEngine::mainLoop() { loadStockDat(); while (!_gameDone) { - debugC(kDebugBasic, "New scene: %d", _newSceneNum); + debugC(kDebugBasic, "New scene: %d", _newSceneNum); _prevSceneNum = _currentSceneNum; _currentSceneNum = _newSceneNum; - + debugC(kDebugBasic, "GnapEngine::mainLoop() _prevSceneNum: %d; _currentSceneNum: %d", _prevSceneNum, _currentSceneNum); if (_newCursorValue != _cursorValue) { @@ -775,10 +775,10 @@ void GnapEngine::mainLoop() { _wasSavegameLoaded = false; initScene(); - + runSceneLogic(); afterScene(); - + _soundMan->stopAll(); // Force purge all resources @@ -795,7 +795,7 @@ void GnapEngine::mainLoop() { if (_backgroundSurface) deleteSurface(&_backgroundSurface); - + _dat->close(1); // TODO freeMenuSprite(); // TODO freeFont(); @@ -803,7 +803,7 @@ void GnapEngine::mainLoop() { void GnapEngine::initScene() { Common::String datFilename; - + _isLeavingScene = false; _sceneDone = false; _newSceneNum = 55; @@ -851,7 +851,7 @@ void GnapEngine::endSceneInit() { void GnapEngine::afterScene() { if (_gameDone) return; - + if (_newCursorValue == _cursorValue && _newSceneNum != 0 && _newSceneNum != 16 && _newSceneNum != 47 && _newSceneNum != 48 && _newSceneNum != 54 && _newSceneNum != 49 && _newSceneNum != 50 && _newSceneNum != 51 && _newSceneNum != 52) @@ -904,7 +904,7 @@ int GnapEngine::playSoundA() { }; int soundId = -1; - + if (!_timers[_soundTimerIndexA]) { _timers[_soundTimerIndexA] = getRandom(50) + 100; soundId = kSoundIdsA[getRandom(11)]; @@ -928,7 +928,7 @@ int GnapEngine::playSoundB() { }; int soundId = -1; - + if (!_timers[_soundTimerIndexB]) { _timers[_soundTimerIndexB] = getRandom(50) + 150; soundId = kSoundIdsB[getRandom(19)]; @@ -1019,7 +1019,7 @@ void GnapEngine::deleteSurface(Graphics::Surface **surface) { int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { int sequenceId = 0; - + switch (kind) { case gskPullOutDevice: if (gridX > 0 && gridY > 0) { @@ -1278,6 +1278,9 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case kDirUpRight: sequenceId = 0x82F; break; + case kDirNone: + case kDirUnk4: + break; } } break; @@ -1296,6 +1299,9 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case kDirUpRight: sequenceId = 0x83E; break; + case kDirNone: + case kDirUnk4: + break; } break; @@ -1788,7 +1794,7 @@ void GnapEngine::doCallback(int callback) { bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) { bool result = false; - + if (_gnapActionStatus <= -1 && _beaverActionStatus <= -1) { _gnapActionStatus = 100; if (isPointBlocked(_platX + gridX, _platY + gridY) && (_platX + gridX != _gnapX || _platY + gridY != _gnapY)) @@ -2017,32 +2023,32 @@ void GnapEngine::initGlobalSceneVars() { _s01_pigsIdCtr = 0; _s01_smokeIdCtr = 0; _s01_spaceshipSurface = 0; - + // Scene 2 _s02_truckGrillCtr = 0; - + // Scene 3 _s03_nextPlatSequenceId = -1; _s03_platypusScared = false; _s03_platypusHypnotized = false; - + // Scene 4 _s04_dogIdCtr = 0; //_s04_triedWindow = true;//?? _s04_triedWindow = false; - + // Scene 5 _s05_nextChickenSequenceId = -1; - + // Scene 6 _s06_nextPlatSequenceId = -1; - + // Scene 11 _s11_billardBallCtr = 0; - + // Scene 13 _s13_backToiletCtr = -1; - + // Scene 17 _s17_platTryGetWrenchCtr = 0; _s17_wrenchCtr = 2; @@ -2052,14 +2058,14 @@ void GnapEngine::initGlobalSceneVars() { _s17_platPhoneCtr = 0; _s17_nextPhoneSequenceId = -1; _s17_currPhoneSequenceId = -1; - + // Scene 18 _s18_garbageCanPos = 8; _s18_platPhoneCtr = 0; _s18_platPhoneIter = 0; _s18_nextPhoneSequenceId = -1; _s18_currPhoneSequenceId = -1; - + // Scene 19 _s19_toyGrabCtr = 0; _s19_pictureSurface = 0; @@ -2069,11 +2075,11 @@ void GnapEngine::initGlobalSceneVars() { _s20_stonerGuyCtr = 3; _s20_stonerGuyShowingJoint = false; _s20_groceryStoreGuyCtr = 0; - + // Scene 22 _s22_caughtBefore = false; _s22_cashierCtr = 3; - + // Scene 31 _s31_beerGuyDistracted = false; _s31_clerkMeasureMaxCtr = 3; @@ -2086,13 +2092,13 @@ void GnapEngine::initGlobalSceneVars() { _s50_leftTongueNextIdCtr = 0; _s50_rightTongueEnergyBarPos = 10; _s50_rightTongueNextIdCtr = 0; - + // Scene 52 _s52_gameScore = 0; _s52_aliensInitialized = false; _s52_alienDirection = 0; _s52_soundToggle = false; - + // Scene 53 _s53_callsMadeCtr = 0; _s53_callsRndUsed = 0; @@ -2202,15 +2208,15 @@ bool GnapEngine::toyUfoCheckTimer() { void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex) { GridStruct v16[34]; - + if (destX == -1) destX = _leftClickMouseX; - + if (destY == -1) destY = _leftClickMouseY; //CHECKME - + int clippedDestX = CLIP(destX, minX, maxX); int clippedDestY = CLIP(destY, minY, maxY); int dirX, dirY; // 0, -1 or 1 @@ -2219,12 +2225,12 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, dirX = 0; else dirX = (clippedDestX - _toyUfoX) / ABS(clippedDestX - _toyUfoX); - + if (clippedDestY == _toyUfoY) dirY = 0; else dirY = (clippedDestY - _toyUfoY) / ABS(clippedDestY - _toyUfoY); - + int deltaX = ABS(clippedDestX - _toyUfoX); int deltaY = ABS(clippedDestY - _toyUfoY); @@ -2262,10 +2268,10 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, } int v21 = i - 1; - + _toyUfoX = clippedDestX; _toyUfoY = clippedDestY; - + if (i - 1 > 0) { int seqId; if (isFlag(kGFUnk16)) @@ -2289,13 +2295,13 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, kSeqSyncWait, 0, v16[i].gridX1 - 365, v16[i].gridY1 - 128); } - + _toyUfoSequenceId = v16[v21 - 1].sequenceId; _toyUfoId = v16[v21 - 1].id; - + if (animationIndex >= 0) _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, animationIndex); - + } } @@ -2307,7 +2313,7 @@ int GnapEngine::cutscene_init() { } void GnapEngine::cutscene_run() { - + int itemIndex = 0; int soundId = -1; int volume = 100; @@ -2330,13 +2336,13 @@ void GnapEngine::cutscene_run() { for (int j = 0; j < _s99_sequenceCountArr[0]; ++j) _gameSys->insertSequence(_s99_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); _gameSys->setAnimation(_s99_sequenceIdArr[0], 2, 0); - + clearKeyStatus1(Common::KEYCODE_ESCAPE); clearKeyStatus1(Common::KEYCODE_SPACE); clearKeyStatus1(29); _mouseClickState._left = false; - + int firstSequenceIndex = 0; while (!_sceneDone) { gameUpdateTick(); @@ -2375,7 +2381,7 @@ void GnapEngine::cutscene_run() { } if (soundId != -1) - stopSound(soundId); + stopSound(soundId); } } // End of namespace Gnap -- cgit v1.2.3 From 7762c494324075170ce3b84761bdaba31a390228 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Apr 2016 13:48:21 +0200 Subject: GNAP: Fix another warning and adding a catching condition --- engines/gnap/gnap.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 2dfd0b1b72..c42dc2b97f 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2273,7 +2273,7 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, _toyUfoY = clippedDestY; if (i - 1 > 0) { - int seqId; + int seqId = 0; if (isFlag(kGFUnk16)) seqId = 0x867; else if (isFlag(kGFJointTaken)) @@ -2282,6 +2282,8 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, seqId = 0x85F; else if (isFlag(kGFGroceryStoreHatTaken)) seqId = 0x857; + else + error("Unhandled flag in GnapEngine::toyUfoFlyTo(): 0x%x", _gameFlags); v16[0].sequenceId = seqId; v16[0].id = 0; _gameSys->insertSequence(seqId | 0x10000, 0, -- cgit v1.2.3 From f4fc5e251a79bb7ee7d6ba69251fc7db05747853 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Apr 2016 13:48:48 +0200 Subject: GNAP: Add missing newlines at the end --- engines/gnap/scenes/scene32.cpp | 21 ++++++++++----------- engines/gnap/scenes/scene33.cpp | 29 ++++++++++++++--------------- engines/gnap/scenes/scene38.cpp | 19 +++++++++---------- 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index 0822dc41ed..659ce0e7f5 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -81,15 +81,15 @@ void GnapEngine::scene32_run() { initBeaverPos(1, 7, kDirNone); endSceneInit(); } - + while (!_sceneDone) { updateMouseCursor(); updateCursorByHotspot(); testWalk(0, 0, -1, -1, -1, -1); - + _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - + switch (_sceneClickedHotspot) { case kHSDevice: if (_gnapActionStatus < 0) { @@ -153,10 +153,10 @@ void GnapEngine::scene32_run() { } scene32_updateAnimations(); - + if (!isSoundPlaying(0x1091C)) playSound(0x1091C, true); - + if (!_isLeavingScene) { if (_beaverActionStatus < 0) updateBeaverIdleSequence(); @@ -171,19 +171,19 @@ void GnapEngine::scene32_run() { } playSoundC(); } - + checkGameKeys(); - + if (isKeyStatus1(8)) { clearKeyStatus1(8); runMenu(); scene32_updateHotspots(); } - + gameUpdateTick(); - + } - + } void GnapEngine::scene32_updateAnimations() { @@ -197,4 +197,3 @@ void GnapEngine::scene32_updateAnimations() { } } // End of namespace Gnap - \ No newline at end of file diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index 3069dba025..72588329a9 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -106,10 +106,10 @@ void GnapEngine::scene33_run() { updateMouseCursor(); updateCursorByHotspot(); testWalk(0, 0, 7, 6, 8, 6); - + _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - + switch (_sceneClickedHotspot) { case kHSDevice: @@ -169,7 +169,7 @@ void GnapEngine::scene33_run() { } } break; - + case kHSExitHouse: if (_gnapActionStatus < 0) { _isLeavingScene = true; @@ -181,7 +181,7 @@ void GnapEngine::scene33_run() { gnapWalkTo(6, 7, 0, 0x107B1, 1); } break; - + case kHSExitBarn: if (_gnapActionStatus < 0) { _isLeavingScene = true; @@ -203,7 +203,7 @@ void GnapEngine::scene33_run() { _newSceneNum = 34; } break; - + case kHSExitPigpen: if (_gnapActionStatus < 0) { _isLeavingScene = true; @@ -213,13 +213,13 @@ void GnapEngine::scene33_run() { _newSceneNum = 32; } break; - + case kHSWalkArea1: case kHSWalkArea2: if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_mouseClickState._left && _gnapActionStatus < 0) { gnapWalkTo(-1, -1, -1, -1, 1); @@ -228,12 +228,12 @@ void GnapEngine::scene33_run() { break; } - + scene33_updateAnimations(); - + if (!isSoundPlaying(0x1091C)) playSound(0x1091C, true); - + if (!_isLeavingScene) { if (_beaverActionStatus < 0) updateBeaverIdleSequence(); @@ -257,17 +257,17 @@ void GnapEngine::scene33_run() { } playSoundC(); } - + checkGameKeys(); - + if (isKeyStatus1(8)) { clearKeyStatus1(8); runMenu(); scene33_updateHotspots(); } - + gameUpdateTick(); - + } } @@ -328,4 +328,3 @@ void GnapEngine::scene33_updateAnimations() { } } // End of namespace Gnap - \ No newline at end of file diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index eab5670cb3..3650c63634 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -95,7 +95,7 @@ void GnapEngine::scene38_run() { queueInsertDeviceIcon(); _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - + if (_prevSceneNum == 39) { initGnapPos(3, 7, kDirBottomLeft); initBeaverPos(4, 7, kDirUnk4); @@ -106,13 +106,13 @@ void GnapEngine::scene38_run() { endSceneInit(); while (!_sceneDone) { - + updateMouseCursor(); updateCursorByHotspot(); _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - + switch (_sceneClickedHotspot) { case kHSDevice: @@ -222,7 +222,7 @@ void GnapEngine::scene38_run() { else if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_mouseClickState._left) { if (_gnapActionStatus == kASHoldingHuntingTrophy) @@ -236,22 +236,22 @@ void GnapEngine::scene38_run() { } scene38_updateAnimations(); - + if (!_isLeavingScene) { updateBeaverIdleSequence(); updateGnapIdleSequence(); } - + checkGameKeys(); - + if (isKeyStatus1(8)) { clearKeyStatus1(8); runMenu(); scene38_updateHotspots(); } - + gameUpdateTick(); - + } } @@ -362,4 +362,3 @@ void GnapEngine::scene38_updateAnimations() { } } // End of namespace Gnap - \ No newline at end of file -- cgit v1.2.3 From bd72968ccbfbb5f91843068b508f0e3db7c47665 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 14 Apr 2016 07:18:47 +0200 Subject: GNAP: Rename members of GridStruct --- engines/gnap/gnap.cpp | 28 +- engines/gnap/gnap.h | 8 +- engines/gnap/grid.cpp | 732 +++++++++++++++++++++++++------------------------- 3 files changed, 384 insertions(+), 384 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index c42dc2b97f..2188bda703 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2246,8 +2246,8 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, v15 = MAX(6, v15 - 3); } v14 += v15; - v16[i].gridX1 = _toyUfoX + dirX * deltaX * v14 / deltaY; - v16[i].gridY1 = _toyUfoY + dirY * v14; + v16[i]._gridX1 = _toyUfoX + dirX * deltaX * v14 / deltaY; + v16[i]._gridY1 = _toyUfoY + dirY * v14; ++i; } } else { @@ -2261,8 +2261,8 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, v17 = MAX(6, v17 - 3); } v14 += v17; - v16[i].gridX1 = _toyUfoX + dirX * v14; - v16[i].gridY1 = _toyUfoY + dirY * deltaY * v14 / deltaX; + v16[i]._gridX1 = _toyUfoX + dirX * v14; + v16[i]._gridY1 = _toyUfoY + dirY * deltaY * v14 / deltaX; ++i; } } @@ -2284,22 +2284,22 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, seqId = 0x857; else error("Unhandled flag in GnapEngine::toyUfoFlyTo(): 0x%x", _gameFlags); - v16[0].sequenceId = seqId; - v16[0].id = 0; + v16[0]._sequenceId = seqId; + v16[0]._id = 0; _gameSys->insertSequence(seqId | 0x10000, 0, _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, v16[0].gridX1 - 365, v16[0].gridY1 - 128); + kSeqSyncWait, 0, v16[0]._gridX1 - 365, v16[0]._gridY1 - 128); for (i = 1; i < v21; ++i) { - v16[i].sequenceId = seqId + (i % 8); - v16[i].id = i; - _gameSys->insertSequence(v16[i].sequenceId | 0x10000, v16[i].id, - v16[i - 1].sequenceId | 0x10000, v16[i - 1].id, + v16[i]._sequenceId = seqId + (i % 8); + v16[i]._id = i; + _gameSys->insertSequence(v16[i]._sequenceId | 0x10000, v16[i]._id, + v16[i - 1]._sequenceId | 0x10000, v16[i - 1]._id, kSeqSyncWait, 0, - v16[i].gridX1 - 365, v16[i].gridY1 - 128); + v16[i]._gridX1 - 365, v16[i]._gridY1 - 128); } - _toyUfoSequenceId = v16[v21 - 1].sequenceId; - _toyUfoId = v16[v21 - 1].id; + _toyUfoSequenceId = v16[v21 - 1]._sequenceId; + _toyUfoId = v16[v21 - 1]._id; if (animationIndex >= 0) _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, animationIndex); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index d40b26aac4..53ca33d247 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -74,10 +74,10 @@ struct Hotspot { }; struct GridStruct { - int deltaX, deltaY; - int gridX1, gridY1; - int sequenceId; - int id; + int _deltaX, _deltaY; + int _gridX1, _gridY1; + int _sequenceId; + int _id; }; const int kMaxGridStructs = 30; diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 5bb1e06a92..99add51bfb 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -110,21 +110,21 @@ bool GnapEngine::gridSub41F08B(int gridX, int gridY) { _gnapWalkDirY = 0; while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirXIncr; ++_gnapWalkDirYIncr; } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { - if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; - } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; } else { _gnapWalkDeltaX = _gnapWalkDirXIncr; @@ -132,13 +132,13 @@ bool GnapEngine::gridSub41F08B(int gridX, int gridY) { --_gnapWalkNodesCount; } } else { - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; - } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; } else { _gnapWalkDeltaX = _gnapWalkDirXIncr; @@ -150,11 +150,11 @@ bool GnapEngine::gridSub41F08B(int gridX, int gridY) { } while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = _gnapWalkDestY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDestY)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = _gnapWalkDestY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDestY)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; ++_gnapWalkNodesCount; } else { @@ -163,11 +163,11 @@ bool GnapEngine::gridSub41F08B(int gridX, int gridY) { } while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = _gnapWalkDestX; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = _gnapWalkDestX; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; ++_gnapWalkNodesCount; } else { @@ -204,32 +204,32 @@ bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { _gnapWalkDirY = 0; while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirXIncr; ++_gnapWalkDirYIncr; } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { - if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; - } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; } else return false; } else { - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; - } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; } else return false; @@ -238,11 +238,11 @@ bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { } while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = _gnapWalkDestY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDestY)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = _gnapWalkDestY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDestY)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; ++_gnapWalkNodesCount; } else @@ -250,11 +250,11 @@ bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { } while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = _gnapWalkDestX; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = _gnapWalkDestX; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; ++_gnapWalkNodesCount; } else @@ -282,11 +282,11 @@ bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { _gnapWalkDirY = 0; while (_gnapWalkDeltaY < _gnapWalkDeltaX - _gnapWalkDirXIncr) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, gridY)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, gridY)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; ++_gnapWalkNodesCount; } else @@ -294,11 +294,11 @@ bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { } while (_gnapWalkDeltaX < _gnapWalkDeltaY - _gnapWalkDirYIncr) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(gridX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(gridX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; ++_gnapWalkNodesCount; } else @@ -306,32 +306,32 @@ bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { } while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirXIncr; ++_gnapWalkDirYIncr; } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { - if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; - } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; } else return false; } else { - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; - } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; } else return false; @@ -340,11 +340,11 @@ bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { } while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = _gnapWalkDestY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount].gridX1, _gnapWalkDestY)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = _gnapWalkDestY; + if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDestY)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; ++_gnapWalkDirXIncr; ++_gnapWalkNodesCount; } else @@ -352,11 +352,11 @@ bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { } while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount].gridX1 = _gnapWalkDestX; - _gnapWalkNodes[_gnapWalkNodesCount].gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount].gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount].deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount].deltaY = _gnapWalkDirY; + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = _gnapWalkDestX; + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; + if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { + _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; + _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; ++_gnapWalkDirYIncr; ++_gnapWalkNodesCount; } else @@ -373,160 +373,160 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { while (!done && gridIncr < _gridMaxX) { if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41F5FC(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX + i; - _gnapWalkNodes[i].gridY1 = gridY; - _gnapWalkNodes[i].deltaX = 1; - _gnapWalkNodes[i].deltaY = 0; + _gnapWalkNodes[i]._gridX1 = gridX + i; + _gnapWalkNodes[i]._gridY1 = gridY; + _gnapWalkNodes[i]._deltaX = 1; + _gnapWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41F5FC(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX - i; - _gnapWalkNodes[i].gridY1 = gridY; - _gnapWalkNodes[i].deltaX = -1; - _gnapWalkNodes[i].deltaY = 0; + _gnapWalkNodes[i]._gridX1 = gridX - i; + _gnapWalkNodes[i]._gridY1 = gridY; + _gnapWalkNodes[i]._deltaX = -1; + _gnapWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41F5FC(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX; - _gnapWalkNodes[i].gridY1 = gridY + i; - _gnapWalkNodes[i].deltaX = 0; - _gnapWalkNodes[i].deltaY = 1; + _gnapWalkNodes[i]._gridX1 = gridX; + _gnapWalkNodes[i]._gridY1 = gridY + i; + _gnapWalkNodes[i]._deltaX = 0; + _gnapWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41F5FC(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX; - _gnapWalkNodes[i].gridY1 = gridY - i; - _gnapWalkNodes[i].deltaX = 0; - _gnapWalkNodes[i].deltaY = -1; + _gnapWalkNodes[i]._gridX1 = gridX; + _gnapWalkNodes[i]._gridY1 = gridY - i; + _gnapWalkNodes[i]._deltaX = 0; + _gnapWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX + i; - _gnapWalkNodes[i].gridY1 = gridY + i; - _gnapWalkNodes[i].deltaX = 1; - _gnapWalkNodes[i].deltaY = 1; + _gnapWalkNodes[i]._gridX1 = gridX + i; + _gnapWalkNodes[i]._gridY1 = gridY + i; + _gnapWalkNodes[i]._deltaX = 1; + _gnapWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX - i; - _gnapWalkNodes[i].gridY1 = gridY + i; - _gnapWalkNodes[i].deltaX = -1; - _gnapWalkNodes[i].deltaY = 1; + _gnapWalkNodes[i]._gridX1 = gridX - i; + _gnapWalkNodes[i]._gridY1 = gridY + i; + _gnapWalkNodes[i]._deltaX = -1; + _gnapWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX + i; - _gnapWalkNodes[i].gridY1 = gridY - i; - _gnapWalkNodes[i].deltaX = 1; - _gnapWalkNodes[i].deltaY = -1; + _gnapWalkNodes[i]._gridX1 = gridX + i; + _gnapWalkNodes[i]._gridY1 = gridY - i; + _gnapWalkNodes[i]._deltaX = 1; + _gnapWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX - i; - _gnapWalkNodes[i].gridY1 = gridY - i; - _gnapWalkNodes[i].deltaX = -1; - _gnapWalkNodes[i].deltaY = -1; + _gnapWalkNodes[i]._gridX1 = gridX - i; + _gnapWalkNodes[i]._gridY1 = gridY - i; + _gnapWalkNodes[i]._deltaX = -1; + _gnapWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41FAD5(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX + i; - _gnapWalkNodes[i].gridY1 = gridY; - _gnapWalkNodes[i].deltaX = 1; - _gnapWalkNodes[i].deltaY = 0; + _gnapWalkNodes[i]._gridX1 = gridX + i; + _gnapWalkNodes[i]._gridY1 = gridY; + _gnapWalkNodes[i]._deltaX = 1; + _gnapWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41FAD5(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX - i; - _gnapWalkNodes[i].gridY1 = gridY; - _gnapWalkNodes[i].deltaX = -1; - _gnapWalkNodes[i].deltaY = 0; + _gnapWalkNodes[i]._gridX1 = gridX - i; + _gnapWalkNodes[i]._gridY1 = gridY; + _gnapWalkNodes[i]._deltaX = -1; + _gnapWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41FAD5(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX; - _gnapWalkNodes[i].gridY1 = gridY + i; - _gnapWalkNodes[i].deltaX = 0; - _gnapWalkNodes[i].deltaY = 1; + _gnapWalkNodes[i]._gridX1 = gridX; + _gnapWalkNodes[i]._gridY1 = gridY + i; + _gnapWalkNodes[i]._deltaX = 0; + _gnapWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41FAD5(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX; - _gnapWalkNodes[i].gridY1 = gridY - i; - _gnapWalkNodes[i].deltaX = 0; - _gnapWalkNodes[i].deltaY = -1; + _gnapWalkNodes[i]._gridX1 = gridX; + _gnapWalkNodes[i]._gridY1 = gridY - i; + _gnapWalkNodes[i]._deltaX = 0; + _gnapWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX + i; - _gnapWalkNodes[i].gridY1 = gridY + i; - _gnapWalkNodes[i].deltaX = 1; - _gnapWalkNodes[i].deltaY = 1; + _gnapWalkNodes[i]._gridX1 = gridX + i; + _gnapWalkNodes[i]._gridY1 = gridY + i; + _gnapWalkNodes[i]._deltaX = 1; + _gnapWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX - i; - _gnapWalkNodes[i].gridY1 = gridY + i; - _gnapWalkNodes[i].deltaX = -1; - _gnapWalkNodes[i].deltaY = 1; + _gnapWalkNodes[i]._gridX1 = gridX - i; + _gnapWalkNodes[i]._gridY1 = gridY + i; + _gnapWalkNodes[i]._deltaX = -1; + _gnapWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX + i; - _gnapWalkNodes[i].gridY1 = gridY - i; - _gnapWalkNodes[i].deltaX = 1; - _gnapWalkNodes[i].deltaY = -1; + _gnapWalkNodes[i]._gridX1 = gridX + i; + _gnapWalkNodes[i]._gridY1 = gridY - i; + _gnapWalkNodes[i]._deltaX = 1; + _gnapWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i].gridX1 = gridX - i; - _gnapWalkNodes[i].gridY1 = gridY - i; - _gnapWalkNodes[i].deltaX = -1; - _gnapWalkNodes[i].deltaY = -1; + _gnapWalkNodes[i]._gridX1 = gridX - i; + _gnapWalkNodes[i]._gridY1 = gridY - i; + _gnapWalkNodes[i]._deltaX = -1; + _gnapWalkNodes[i]._deltaY = -1; } done = true; break; @@ -578,48 +578,48 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen debugC(kDebugBasic, "_gnapWalkNodesCount: %d", _gnapWalkNodesCount); for (int index = 0; index < _gnapWalkNodesCount; ++index) { - _gnapWalkNodes[index].id = index + 20 * _gnapWalkNodes[index].gridY1; - if (_gnapWalkNodes[index].deltaX == 1 && _gnapWalkNodes[index].deltaY == 0) { + _gnapWalkNodes[index]._id = index + 20 * _gnapWalkNodes[index]._gridY1; + if (_gnapWalkNodes[index]._deltaX == 1 && _gnapWalkNodes[index]._deltaY == 0) { if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7AB), _gnapWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7AB), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); - _gnapWalkNodes[index].sequenceId = 0x7AB; + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + _gnapWalkNodes[index]._sequenceId = 0x7AB; gnapSequenceId = 0x7AB; } else { - _gameSys->insertSequence(makeRid(datNum, 0x7AC), _gnapWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7AC), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); - _gnapWalkNodes[index].sequenceId = 0x7AC; + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + _gnapWalkNodes[index]._sequenceId = 0x7AC; gnapSequenceId = 0x7AC; } - } else if (_gnapWalkNodes[index].deltaX == -1 && _gnapWalkNodes[index].deltaY == 0) { + } else if (_gnapWalkNodes[index]._deltaX == -1 && _gnapWalkNodes[index]._deltaY == 0) { if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7AF), _gnapWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7AF), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); - _gnapWalkNodes[index].sequenceId = 0x7AF; + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + _gnapWalkNodes[index]._sequenceId = 0x7AF; gnapSequenceId = 0x7AF; } else { - _gameSys->insertSequence(makeRid(datNum, 0x7B0), _gnapWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7B0), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); - _gnapWalkNodes[index].sequenceId = 0x7B0; + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + _gnapWalkNodes[index]._sequenceId = 0x7B0; gnapSequenceId = 0x7B0; } } else { - if (_gnapWalkNodes[index].deltaY == -1) - _gnapWalkNodes[index].id -= 10; + if (_gnapWalkNodes[index]._deltaY == -1) + _gnapWalkNodes[index]._id -= 10; else - _gnapWalkNodes[index].id += 10; - int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index].deltaX, _gnapWalkNodes[index].deltaY); - _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index].id, + _gnapWalkNodes[index]._id += 10; + int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index]._deltaX, _gnapWalkNodes[index]._deltaY); + _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index].gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index].gridY1 - _gnapGridY); - _gnapWalkNodes[index].sequenceId = newSequenceId; + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + _gnapWalkNodes[index]._sequenceId = newSequenceId; gnapSequenceId = newSequenceId; } - gnapId = _gnapWalkNodes[index].id; + gnapId = _gnapWalkNodes[index]._id; gnapSequenceDatNum = datNum; } @@ -627,7 +627,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen if (_gnapWalkNodesCount > 0) { _gnapSequenceId = gnapSequenceId; _gnapId = gnapId; - _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1].deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1].deltaY); + _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); _gnapSequenceDatNum = datNum; if (animationIndex >= 0) _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); @@ -656,8 +656,8 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } } else { if (_gnapWalkNodesCount > 0) { - _gnapSequenceId = getGnapWalkStopSequenceId(_gnapWalkNodes[_gnapWalkNodesCount - 1].deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1].deltaY); - _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1].deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1].deltaY); + _gnapSequenceId = getGnapWalkStopSequenceId(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); + _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); } else if (gridX >= 0 || gridY >= 0) { switch (_gnapIdleFacing) { case kDirBottomRight: @@ -767,21 +767,21 @@ bool GnapEngine::gridSub423750(int gridX, int gridY) { _platWalkDirY = 0; while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirXIncr; ++_platWalkDirYIncr; } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { - if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; - } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; } else { _platWalkDeltaX = _platWalkDirXIncr; @@ -789,13 +789,13 @@ bool GnapEngine::gridSub423750(int gridX, int gridY) { --_platWalkNodesCount; } } else { - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; - } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; } else { _platWalkDeltaX = _platWalkDirXIncr; @@ -807,11 +807,11 @@ bool GnapEngine::gridSub423750(int gridX, int gridY) { } while (_platWalkDirXIncr < _platWalkDeltaX) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount].gridY1 = _platWalkDestY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDestY)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount]._gridY1 = _platWalkDestY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDestY)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; ++_platWalkNodesCount; } else { @@ -820,11 +820,11 @@ bool GnapEngine::gridSub423750(int gridX, int gridY) { } while (_platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount].gridX1 = _platWalkDestX; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + _platWalkNodes[_platWalkNodesCount]._gridX1 = _platWalkDestX; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; ++_platWalkNodesCount; } else { @@ -861,32 +861,32 @@ bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { _platWalkDirY = 0; while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirXIncr; ++_platWalkDirYIncr; } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { - if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; - } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; } else return false; } else { - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; - } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; } else return false; @@ -895,11 +895,11 @@ bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { } while (_platWalkDirXIncr < _platWalkDeltaX) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount].gridY1 = _platWalkDestY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDestY)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount]._gridY1 = _platWalkDestY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDestY)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; ++_platWalkNodesCount; } else @@ -907,11 +907,11 @@ bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { } while (_platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount].gridX1 = _platWalkDestX; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + _platWalkNodes[_platWalkNodesCount]._gridX1 = _platWalkDestX; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; ++_platWalkNodesCount; } else @@ -939,11 +939,11 @@ bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { _platWalkDirY = 0; while (_platWalkDeltaY < _platWalkDeltaX - _platWalkDirXIncr) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, gridY)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, gridY)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; ++_platWalkNodesCount; } else @@ -951,11 +951,11 @@ bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { } while (_platWalkDeltaX < _platWalkDeltaY - _platWalkDirYIncr) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(gridX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(gridX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; ++_platWalkNodesCount; } else @@ -963,32 +963,32 @@ bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { } while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirXIncr; ++_platWalkDirYIncr; } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { - if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; - } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; } else return false; } else { - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; - } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; } else return false; @@ -997,11 +997,11 @@ bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { } while (_platWalkDirXIncr < _platWalkDeltaX) { - _platWalkNodes[_platWalkNodesCount].gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount].gridY1 = _platWalkDestY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount].gridX1, _platWalkDestY)) { - _platWalkNodes[_platWalkNodesCount].deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount].deltaY = 0; + _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; + _platWalkNodes[_platWalkNodesCount]._gridY1 = _platWalkDestY; + if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDestY)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; + _platWalkNodes[_platWalkNodesCount]._deltaY = 0; ++_platWalkDirXIncr; ++_platWalkNodesCount; } else @@ -1009,11 +1009,11 @@ bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { } while (_platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount].gridX1 = _platWalkDestX; - _platWalkNodes[_platWalkNodesCount].gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount].gridY1)) { - _platWalkNodes[_platWalkNodesCount].deltaX = 0; - _platWalkNodes[_platWalkNodesCount].deltaY = _platWalkDirY; + _platWalkNodes[_platWalkNodesCount]._gridX1 = _platWalkDestX; + _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; + if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { + _platWalkNodes[_platWalkNodesCount]._deltaX = 0; + _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; ++_platWalkDirYIncr; ++_platWalkNodesCount; } else @@ -1030,160 +1030,160 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { while (!done && gridIncr < _gridMaxX) { if (!isPointBlocked(_platX + gridIncr, _platY) && gridSub423CC1(_platX + gridIncr, _platY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX + i; - _platWalkNodes[i].gridY1 = _platY; - _platWalkNodes[i].deltaX = 1; - _platWalkNodes[i].deltaY = 0; + _platWalkNodes[i]._gridX1 = _platX + i; + _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._deltaX = 1; + _platWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(_platX - gridIncr, _platY) && gridSub423CC1(_platX - gridIncr, _platY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX - i; - _platWalkNodes[i].gridY1 = _platY; - _platWalkNodes[i].deltaX = -1; - _platWalkNodes[i].deltaY = 0; + _platWalkNodes[i]._gridX1 = _platX - i; + _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._deltaX = -1; + _platWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(_platX, _platY + gridIncr) && gridSub423CC1(_platX, _platY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX; - _platWalkNodes[i].gridY1 = _platY + i; - _platWalkNodes[i].deltaX = 0; - _platWalkNodes[i].deltaY = 1; + _platWalkNodes[i]._gridX1 = _platX; + _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._deltaX = 0; + _platWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(_platX, _platY - gridIncr) && gridSub423CC1(_platX, _platY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX; - _platWalkNodes[i].gridY1 = _platY - i; - _platWalkNodes[i].deltaX = 0; - _platWalkNodes[i].deltaY = -1; + _platWalkNodes[i]._gridX1 = _platX; + _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._deltaX = 0; + _platWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(_platX + gridIncr, _platY + gridIncr) && gridSub423CC1(_platX + gridIncr, _platY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX + i; - _platWalkNodes[i].gridY1 = _platY + i; - _platWalkNodes[i].deltaX = 1; - _platWalkNodes[i].deltaY = 1; + _platWalkNodes[i]._gridX1 = _platX + i; + _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._deltaX = 1; + _platWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(_platX - gridIncr, _platY + gridIncr) && gridSub423CC1(_platX - gridIncr, _platY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX - i; - _platWalkNodes[i].gridY1 = _platY + i; - _platWalkNodes[i].deltaX = -1; - _platWalkNodes[i].deltaY = 1; + _platWalkNodes[i]._gridX1 = _platX - i; + _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._deltaX = -1; + _platWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(_platX + gridIncr, _platY - gridIncr) && gridSub423CC1(_platX + gridIncr, _platY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX + i; - _platWalkNodes[i].gridY1 = _platY - i; - _platWalkNodes[i].deltaX = 1; - _platWalkNodes[i].deltaY = -1; + _platWalkNodes[i]._gridX1 = _platX + i; + _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._deltaX = 1; + _platWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(_platX - gridIncr, _platY - gridIncr) && gridSub423CC1(_platX - gridIncr, _platY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX - i; - _platWalkNodes[i].gridY1 = _platY - i; - _platWalkNodes[i].deltaX = -1; - _platWalkNodes[i].deltaY = -1; + _platWalkNodes[i]._gridX1 = _platX - i; + _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._deltaX = -1; + _platWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(_platX + gridIncr, _platY) && gridSub42419A(_platX + gridIncr, _platY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX + i; - _platWalkNodes[i].gridY1 = _platY; - _platWalkNodes[i].deltaX = 1; - _platWalkNodes[i].deltaY = 0; + _platWalkNodes[i]._gridX1 = _platX + i; + _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._deltaX = 1; + _platWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(_platX - gridIncr, _platY) && gridSub42419A(_platX - gridIncr, _platY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX - i; - _platWalkNodes[i].gridY1 = _platY; - _platWalkNodes[i].deltaX = -1; - _platWalkNodes[i].deltaY = 0; + _platWalkNodes[i]._gridX1 = _platX - i; + _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._deltaX = -1; + _platWalkNodes[i]._deltaY = 0; } done = true; break; } if (!isPointBlocked(_platX, _platY + gridIncr) && gridSub42419A(_platX, _platY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX; - _platWalkNodes[i].gridY1 = _platY + i; - _platWalkNodes[i].deltaX = 0; - _platWalkNodes[i].deltaY = 1; + _platWalkNodes[i]._gridX1 = _platX; + _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._deltaX = 0; + _platWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(_platX, _platY - gridIncr) && gridSub42419A(_platX, _platY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX; - _platWalkNodes[i].gridY1 = _platY - i; - _platWalkNodes[i].deltaX = 0; - _platWalkNodes[i].deltaY = -1; + _platWalkNodes[i]._gridX1 = _platX; + _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._deltaX = 0; + _platWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(_platX + gridIncr, _platY + gridIncr) && gridSub42419A(_platX + gridIncr, _platY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX + i; - _platWalkNodes[i].gridY1 = _platY + i; - _platWalkNodes[i].deltaX = 1; - _platWalkNodes[i].deltaY = 1; + _platWalkNodes[i]._gridX1 = _platX + i; + _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._deltaX = 1; + _platWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(_platX - gridIncr, _platY + gridIncr) && gridSub42419A(_platX - gridIncr, _platY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX - i; - _platWalkNodes[i].gridY1 = _platY + i; - _platWalkNodes[i].deltaX = -1; - _platWalkNodes[i].deltaY = 1; + _platWalkNodes[i]._gridX1 = _platX - i; + _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._deltaX = -1; + _platWalkNodes[i]._deltaY = 1; } done = true; break; } if (!isPointBlocked(_platX + gridIncr, _platY - gridIncr) && gridSub42419A(_platX + gridIncr, _platY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX + i; - _platWalkNodes[i].gridY1 = _platY - i; - _platWalkNodes[i].deltaX = 1; - _platWalkNodes[i].deltaY = -1; + _platWalkNodes[i]._gridX1 = _platX + i; + _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._deltaX = 1; + _platWalkNodes[i]._deltaY = -1; } done = true; break; } if (!isPointBlocked(_platX - gridIncr, _platY - gridIncr) && gridSub42419A(_platX - gridIncr, _platY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i].gridX1 = _platX - i; - _platWalkNodes[i].gridY1 = _platY - i; - _platWalkNodes[i].deltaX = -1; - _platWalkNodes[i].deltaY = -1; + _platWalkNodes[i]._gridX1 = _platX - i; + _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._deltaX = -1; + _platWalkNodes[i]._deltaY = -1; } done = true; break; @@ -1230,48 +1230,48 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se int platSequenceDatNum = _beaverSequenceDatNum; for (int index = 0; index < _platWalkNodesCount; ++index) { - _platWalkNodes[index].id = index + 20 * _platWalkNodes[index].gridY1; - if (_platWalkNodes[index].deltaX == 1 && _platWalkNodes[index].deltaY == 0) { + _platWalkNodes[index]._id = index + 20 * _platWalkNodes[index]._gridY1; + if (_platWalkNodes[index]._deltaX == 1 && _platWalkNodes[index]._deltaY == 0) { if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7CD), _platWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7CD), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); - _platWalkNodes[index].sequenceId = 0x7CD; + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + _platWalkNodes[index]._sequenceId = 0x7CD; platSequenceId = 0x7CD; } else { - _gameSys->insertSequence(makeRid(datNum, 0x7CE), _platWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7CE), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); - _platWalkNodes[index].sequenceId = 0x7CE; + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + _platWalkNodes[index]._sequenceId = 0x7CE; platSequenceId = 0x7CE; } - } else if (_platWalkNodes[index].deltaX == -1 && _platWalkNodes[index].deltaY == 0) { + } else if (_platWalkNodes[index]._deltaX == -1 && _platWalkNodes[index]._deltaY == 0) { if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7CF), _platWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7CF), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); - _platWalkNodes[index].sequenceId = 0x7CF; + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + _platWalkNodes[index]._sequenceId = 0x7CF; platSequenceId = 0x7CF; } else { - _gameSys->insertSequence(makeRid(datNum, 0x7D0), _platWalkNodes[index].id, + _gameSys->insertSequence(makeRid(datNum, 0x7D0), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); - _platWalkNodes[index].sequenceId = 0x7D0; + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + _platWalkNodes[index]._sequenceId = 0x7D0; platSequenceId = 0x7D0; } } else { - if (_platWalkNodes[index].deltaY == -1) - _platWalkNodes[index].id -= 10; + if (_platWalkNodes[index]._deltaY == -1) + _platWalkNodes[index]._id -= 10; else - _platWalkNodes[index].id += 10; - int newSequenceId = getBeaverWalkSequenceId(_platWalkNodes[index].deltaX, _platWalkNodes[index].deltaY); - _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index].id, + _platWalkNodes[index]._id += 10; + int newSequenceId = getBeaverWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); + _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index].gridX1 - _platGridX, 48 * _platWalkNodes[index].gridY1 - _platGridY); - _platWalkNodes[index].sequenceId = newSequenceId; + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + _platWalkNodes[index]._sequenceId = newSequenceId; platSequenceId = newSequenceId; } - platId = _platWalkNodes[index].id; + platId = _platWalkNodes[index]._id; platSequenceDatNum = datNum; } @@ -1281,11 +1281,11 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _beaverId = platId; _beaverSequenceDatNum = datNum; // CHECKME Not sure if this is correct... - if (_platWalkNodes[_platWalkNodesCount - 1].deltaX > 0) + if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) _beaverFacing = kDirNone; - else if (_platWalkNodes[_platWalkNodesCount - 1].deltaX < 0) + else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) _beaverFacing = kDirUnk4; - else if (_platWalkNodes[_platWalkNodesCount - 1].gridX1 % 2) + else if (_platWalkNodes[_platWalkNodesCount - 1]._gridX1 % 2) _beaverFacing = kDirUnk4; else _beaverFacing = kDirNone; @@ -1306,16 +1306,16 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se } } else { if (_platWalkNodesCount > 0) { - if (_platWalkNodes[_platWalkNodesCount - 1].deltaX > 0) { + if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) { _beaverSequenceId = 0x7C2; _beaverFacing = kDirNone; - } else if (_platWalkNodes[_platWalkNodesCount - 1].deltaX < 0) { + } else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) { _beaverSequenceId = 0x7D2; _beaverFacing = kDirUnk4; - } else if (_platWalkNodes[0].deltaX > 0) { + } else if (_platWalkNodes[0]._deltaX > 0) { _beaverSequenceId = 0x7C2; _beaverFacing = kDirNone; - } else if (_platWalkNodes[0].deltaX < 0) { + } else if (_platWalkNodes[0]._deltaX < 0) { _beaverSequenceId = 0x7D2; _beaverFacing = kDirUnk4; } else { -- cgit v1.2.3 From e340538f5cce72619e8773e97797e4fb8d467980 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 14 Apr 2016 07:30:34 +0200 Subject: GNAP: Rename variables in toyUfoFlyTo --- engines/gnap/gnap.cpp | 80 ++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 2188bda703..bfb4978e94 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2207,7 +2207,7 @@ bool GnapEngine::toyUfoCheckTimer() { } void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex) { - GridStruct v16[34]; + GridStruct flyNodes[34]; if (destX == -1) destX = _leftClickMouseX; @@ -2216,19 +2216,14 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, destY = _leftClickMouseY; //CHECKME - int clippedDestX = CLIP(destX, minX, maxX); int clippedDestY = CLIP(destY, minY, maxY); - int dirX, dirY; // 0, -1 or 1 + int dirX = 0, dirY = 0; // 0, -1 or 1 - if (clippedDestX == _toyUfoX) - dirX = 0; - else + if (clippedDestX != _toyUfoX) dirX = (clippedDestX - _toyUfoX) / ABS(clippedDestX - _toyUfoX); - if (clippedDestY == _toyUfoY) - dirY = 0; - else + if (clippedDestY != _toyUfoY) dirY = (clippedDestY - _toyUfoY) / ABS(clippedDestY - _toyUfoY); int deltaX = ABS(clippedDestX - _toyUfoX); @@ -2236,43 +2231,43 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int i = 0; if (deltaY > deltaX) { - int v15 = 32; - int v22 = deltaY / v15; - int v14 = 0; - while (v14 < deltaY && i < 34) { - if (v22 - 5 >= i) { - v15 = MIN(36, 8 * i + 8); + int flyDirYIncr = 32; + int gridDistY = deltaY / flyDirYIncr; + int curMove = 0; + while (curMove < deltaY && i < 34) { + if (gridDistY - 5 >= i) { + flyDirYIncr = MIN(36, 8 * i + 8); } else { - v15 = MAX(6, v15 - 3); + flyDirYIncr = MAX(6, flyDirYIncr - 3); } - v14 += v15; - v16[i]._gridX1 = _toyUfoX + dirX * deltaX * v14 / deltaY; - v16[i]._gridY1 = _toyUfoY + dirY * v14; + curMove += flyDirYIncr; + flyNodes[i]._gridX1 = _toyUfoX + dirX * deltaX * curMove / deltaY; + flyNodes[i]._gridY1 = _toyUfoY + dirY * curMove; ++i; } } else { - int v17 = 36; - int v22 = deltaX / v17; - int v14 = 0; - while (v14 < deltaX && i < 34) { - if (v22 - 5 >= i) { - v17 = MIN(38, 8 * i + 8); + int flyDirXIncr = 36; + int gridDistX = deltaX / flyDirXIncr; + int curMove = 0; + while (curMove < deltaX && i < 34) { + if (gridDistX - 5 >= i) { + flyDirXIncr = MIN(38, 8 * i + 8); } else { - v17 = MAX(6, v17 - 3); + flyDirXIncr = MAX(6, flyDirXIncr - 3); } - v14 += v17; - v16[i]._gridX1 = _toyUfoX + dirX * v14; - v16[i]._gridY1 = _toyUfoY + dirY * deltaY * v14 / deltaX; + curMove += flyDirXIncr; + flyNodes[i]._gridX1 = _toyUfoX + dirX * curMove; + flyNodes[i]._gridY1 = _toyUfoY + dirY * deltaY * curMove / deltaX; ++i; } } - int v21 = i - 1; + int nodesCount = i - 1; _toyUfoX = clippedDestX; _toyUfoY = clippedDestY; - if (i - 1 > 0) { + if (nodesCount > 0) { int seqId = 0; if (isFlag(kGFUnk16)) seqId = 0x867; @@ -2284,28 +2279,27 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, seqId = 0x857; else error("Unhandled flag in GnapEngine::toyUfoFlyTo(): 0x%x", _gameFlags); - v16[0]._sequenceId = seqId; - v16[0]._id = 0; + flyNodes[0]._sequenceId = seqId; + flyNodes[0]._id = 0; _gameSys->insertSequence(seqId | 0x10000, 0, _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, v16[0]._gridX1 - 365, v16[0]._gridY1 - 128); - for (i = 1; i < v21; ++i) { - v16[i]._sequenceId = seqId + (i % 8); - v16[i]._id = i; - _gameSys->insertSequence(v16[i]._sequenceId | 0x10000, v16[i]._id, - v16[i - 1]._sequenceId | 0x10000, v16[i - 1]._id, + kSeqSyncWait, 0, flyNodes[0]._gridX1 - 365, flyNodes[0]._gridY1 - 128); + for (i = 1; i < nodesCount; ++i) { + flyNodes[i]._sequenceId = seqId + (i % 8); + flyNodes[i]._id = i; + _gameSys->insertSequence(flyNodes[i]._sequenceId | 0x10000, flyNodes[i]._id, + flyNodes[i - 1]._sequenceId | 0x10000, flyNodes[i - 1]._id, kSeqSyncWait, 0, - v16[i]._gridX1 - 365, v16[i]._gridY1 - 128); + flyNodes[i]._gridX1 - 365, flyNodes[i]._gridY1 - 128); } - _toyUfoSequenceId = v16[v21 - 1]._sequenceId; - _toyUfoId = v16[v21 - 1]._id; + _toyUfoSequenceId = flyNodes[nodesCount - 1]._sequenceId; + _toyUfoId = flyNodes[nodesCount - 1]._id; if (animationIndex >= 0) _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, animationIndex); } - } // Scene 99 -- cgit v1.2.3 From d90b948b22bb1c46e2ae1c807b17f5d07744cd6e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Apr 2016 07:01:04 +0200 Subject: GNAP: Some renaming in scene 52 --- engines/gnap/gnap.h | 6 +-- engines/gnap/scenes/scene52.cpp | 95 +++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 54 deletions(-) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 53ca33d247..5b183cbc83 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -1118,10 +1118,10 @@ public: int scene52_getHitAlienNum(int rowNum); int scene52_alienCannonHitShip(int cannonNum); int scene52_alienCannonHitShield(int cannonNum); - int scene52_shipCannonHitShield(int cannonNum); - int scene52_shipCannonHitAlien(); + bool scene52_shipCannonHitShield(int cannonNum); + bool scene52_shipCannonHitAlien(); void scene52_shipExplode(); - int scene52_checkAlienRow(int rowNum); + bool scene52_checkAlienRow(int rowNum); void scene52_updateAlienRowXOfs(); void scene52_initAlienSize(); void scene52_playSound(); diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index 0caf7a83e8..3d74538b27 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -547,33 +547,33 @@ int GnapEngine::scene52_alienCannonHitShield(int cannonNum) { return result; } -int GnapEngine::scene52_shipCannonHitShield(int cannonNum) { - int result = 0; +bool GnapEngine::scene52_shipCannonHitShield(int cannonNum) { + bool result = false; if (_s52_shipCannonPosX < _s52_shieldPosX[0]) - return 0; + return result; if (_s52_shipCannonPosX > _s52_shieldPosX[2] + 33) - return 0; + return result; int shieldNum = -1; if (_s52_shipCannonPosX < _s52_shieldPosX[0] + 33) shieldNum = 0; if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1]) - return 0; + return result; if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1] + 33) shieldNum = 1; if (shieldNum < 0) { if (_s52_shipCannonPosX < _s52_shieldPosX[2]) - return 0; + return result; shieldNum = 2; } if (_s52_shieldSpriteIds[shieldNum] == -1) { - result = 0; + result = false; } else { ++_s52_shieldSpriteIds[shieldNum]; if (_s52_shieldSpriteIds[shieldNum] <= 21) { @@ -584,52 +584,49 @@ int GnapEngine::scene52_shipCannonHitShield(int cannonNum) { } _gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_shipCannonPosX - 18, _s52_arcadeScreenBottom - 44); playSound(0x2C, false); - result = 1; + result = true; } return result; } -int GnapEngine::scene52_shipCannonHitAlien() { - int result = 0; +bool GnapEngine::scene52_shipCannonHitAlien() { + bool result = false; - if (_s52_aliensCount) { - result = 0; - } else if (scene52_checkAlienRow(0)) { - result = 0; - } else { - int v1 = _s52_alienLeftX + _s52_alienRowXOfs[0]; - if (_s52_shipMidX + _s52_shipPosX >= _s52_alienLeftX + _s52_alienRowXOfs[0]) { - int v7 = _s52_alienWidth / 2 - 15; - if (v1 + 5 * _s52_alienWidth - v7 >= _s52_shipPosX) { - int v2 = v1 + _s52_alienWidth; - if (_s52_items[0][0] <= -1 || v2 - v7 <= _s52_shipPosX) { - int v3 = v2 + _s52_alienWidth; - if (_s52_items[0][1] <= -1 || v3 - v7 <= _s52_shipPosX) { - int v4 = v3 + _s52_alienWidth; - if (_s52_items[0][2] <= -1 || v4 - v7 <= _s52_shipPosX) { - int v5 = v4 + _s52_alienWidth; - if (_s52_items[0][3] <= -1 || v5 - v7 <= _s52_shipPosX) { - int v6 = v5 + _s52_alienWidth; - result = _s52_items[0][4] > -1 && v6 - v7 > _s52_shipPosX; - } else { - result = 1; - } + if (_s52_aliensCount || scene52_checkAlienRow(0)) + return false; + + int alienNextX = _s52_alienLeftX + _s52_alienRowXOfs[0]; + if (_s52_shipMidX + _s52_shipPosX >= alienNextX) { + int startX = _s52_alienWidth / 2 - 15; + if (alienNextX + 5 * _s52_alienWidth - startX >= _s52_shipPosX) { + int alienNextDeltaX = alienNextX + _s52_alienWidth; + if (_s52_items[0][0] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { + alienNextDeltaX += _s52_alienWidth; + if (_s52_items[0][1] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { + alienNextDeltaX += _s52_alienWidth; + if (_s52_items[0][2] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { + alienNextDeltaX += _s52_alienWidth; + if (_s52_items[0][3] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { + alienNextDeltaX += _s52_alienWidth; + result = _s52_items[0][4] > -1 && alienNextDeltaX - startX > _s52_shipPosX; } else { - result = 1; + result = true; } } else { - result = 1; + result = true; } } else { - result = 1; + result = true; } } else { - result = 0; + result = true; } } else { - result = 0; + result = false; } + } else { + result = false; } return result; @@ -646,21 +643,22 @@ void GnapEngine::scene52_shipExplode() { } } -int GnapEngine::scene52_checkAlienRow(int rowNum) { - for (int i = 0; i < 5; ++i) +bool GnapEngine::scene52_checkAlienRow(int rowNum) { + for (int i = 0; i < 5; ++i) { if (_s52_items[rowNum][i] >= 0) - return 0; + return false; + } - int v4 = 0; + bool found = false; for (int j = 0; j < 5; ++j) if (_s52_items[rowNum][j] == -2) { _gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, true); _s52_items[rowNum][j] = -1; --_s52_alienSpeed; - v4 = 1; + found = true; } - if (v4) { + if (found) { _gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); --_s52_liveAlienRows; } @@ -668,7 +666,7 @@ int GnapEngine::scene52_checkAlienRow(int rowNum) { if (_s52_liveAlienRows < 0) _s52_liveAlienRows = 0; - return 1; + return true; } void GnapEngine::scene52_updateAlienRowXOfs() { @@ -699,11 +697,9 @@ void GnapEngine::scene52_updateAlienRowXOfs() { } } } - } void GnapEngine::scene52_initAlienSize() { - _s52_alienWidth = _gameSys->getSpriteWidthById(0); if (_gameSys->getSpriteWidthById(1) > _s52_alienWidth) _s52_alienWidth = _gameSys->getSpriteWidthById(1); @@ -750,9 +746,10 @@ void GnapEngine::scene52_updateAliens() { void GnapEngine::scene52_updateAlien(int rowNum) { if (_s52_alienRowKind[rowNum] >= 0 && !scene52_checkAlienRow(rowNum)) { - for (int i = 0; i < 5; ++i) + for (int i = 0; i < 5; ++i) { if (_s52_items[rowNum][i] >= 0) _s52_items[rowNum][i] = -2; + } scene52_checkAlienRow(rowNum); } } @@ -791,7 +788,6 @@ void GnapEngine::scene52_drawScore(int score) { } void GnapEngine::scene52_run() { - _timers[1] = 0; hideCursor(); @@ -847,7 +843,6 @@ void GnapEngine::scene52_run() { _s52_alienWave = true; while (!_sceneDone) { - gameUpdateTick(); while (isKeyStatus2(Common::KEYCODE_RIGHT)) { @@ -893,13 +888,11 @@ void GnapEngine::scene52_run() { clearKeyStatus1(30); _sceneDone = true; } - } // TODO freeFont(); _gameSys->waitForUpdate(); - } } // End of namespace Gnap -- cgit v1.2.3 From d6e4b67dca52c4cf7aae156ba5cb7523a60a0595 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Apr 2016 07:27:13 +0200 Subject: GNAP: Add load from launcher --- engines/gnap/gnap.cpp | 18 +++++++++++++++++- engines/gnap/gnap.h | 2 ++ engines/gnap/menu.cpp | 10 ++-------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index bfb4978e94..b9519110ac 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -118,8 +118,14 @@ Common::Error GnapEngine::run() { // >>>>> Variable initialization _cursorIndex = -1; _verbCursor = 1; + + _loadGameSlot = -1; + if (ConfMan.hasKey("save_slot")) + _loadGameSlot = ConfMan.getInt("save_slot"); + invClear(); clearFlags(); + _grabCursorSprite = nullptr; _newGrabCursorSpriteIndex = -1; _backgroundSurface = nullptr; @@ -737,7 +743,6 @@ void GnapEngine::loadStockDat() { } void GnapEngine::mainLoop() { - _newCursorValue = 1; _cursorValue = -1; _newSceneNum = 0; @@ -748,14 +753,25 @@ void GnapEngine::mainLoop() { _grabCursorSpriteIndex = -1; _grabCursorSprite = nullptr; +#if 0 // > DEBUG BEGIN _currentSceneNum = 0; _newSceneNum = 1; _newCursorValue = 1; // < DEBUG END +#endif loadStockDat(); + if (_loadGameSlot != -1) { + // Load a savegame + int slot = _loadGameSlot; + _loadGameSlot = -1; + loadGameState(slot); + + showCursor(); + } + while (!_gameDone) { debugC(kDebugBasic, "New scene: %d", _newSceneNum); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 5b183cbc83..5318e3fa7d 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -298,6 +298,8 @@ public: private: const ADGameDescription *_gameDescription; Graphics::PixelFormat _pixelFormat; + int _loadGameSlot; + public: Common::RandomSource *_random; diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 82e45dedbe..d1701d7d0e 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -233,7 +233,6 @@ void GnapEngine::drawInventoryFrames() { } void GnapEngine::insertInventorySprites() { - for (int i = 0; i < 9; ++i) { _menuInventoryIndices[i] = -1; _gameSys->removeSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], 261); @@ -258,7 +257,6 @@ void GnapEngine::insertInventorySprites() { ++_menuSpritesIndex; } } - } void GnapEngine::removeInventorySprites() { @@ -313,7 +311,6 @@ void GnapEngine::runMenu() { _timers[2] = 10; while (!isKeyStatus1(8) && !isKeyStatus1(28) && !_sceneDone && !_menuDone) { - updateCursorByHotspot(); switch (_menuStatus) { @@ -335,7 +332,6 @@ void GnapEngine::runMenu() { } gameUpdateTick(); - } removeInventorySprites(); @@ -385,7 +381,6 @@ void GnapEngine::runMenu() { } void GnapEngine::updateMenuStatusInventory() { - static const struct { int item1, item2, resultItem; } kCombineItems[] = { @@ -727,6 +722,7 @@ Common::Error GnapEngine::loadGameState(int slot) { synchronize(s); delete saveFile; + _loadGameSlot = slot; return Common::kNoError; } @@ -735,7 +731,7 @@ Common::String GnapEngine::generateSaveName(int slot) { } void GnapEngine::updateMenuStatusSaveGame() { -#if 1 // TODO +#if 0 // TODO char v43[30]; int v46; v43[0] = '\0'; @@ -925,7 +921,6 @@ void GnapEngine::updateMenuStatusLoadGame() { } void GnapEngine::updateMenuStatusQueryQuit() { - _hotspots[0]._x1 = 311; _hotspots[0]._y1 = 197; _hotspots[0]._x2 = 377; @@ -964,7 +959,6 @@ void GnapEngine::updateMenuStatusQueryQuit() { initMenuHotspots2(); _gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262); } - } } // End of namespace Gnap -- cgit v1.2.3 From 63a13bc2c05ed9e24aaf8294e8a03d6ff9043d45 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 16 Apr 2016 00:51:27 +0200 Subject: GNAP: Add some code to fix the transition from intro to game --- engines/gnap/scenes/scene00.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/gnap/scenes/scene00.cpp b/engines/gnap/scenes/scene00.cpp index 8291546691..7be508e674 100644 --- a/engines/gnap/scenes/scene00.cpp +++ b/engines/gnap/scenes/scene00.cpp @@ -169,6 +169,8 @@ void GnapEngine::scene00_run() { _newSceneNum = 1; _newCursorValue = 1; + + _dat->open(1, "stock_n.dat"); } } // End of namespace Gnap -- cgit v1.2.3 From 08ba28db7ffa2db9dbd8bb660260e0e78e5a45fb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 16 Apr 2016 00:51:49 +0200 Subject: GNAP: Cosmetic changes --- engines/gnap/datarchive.cpp | 4 ++-- engines/gnap/gnap.cpp | 1 - engines/gnap/scenes/scene18.cpp | 3 --- engines/gnap/scenes/scene42.cpp | 42 +++++++++++++++++------------------------ 4 files changed, 19 insertions(+), 31 deletions(-) diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp index 0f6faee6df..a2de0b38e0 100644 --- a/engines/gnap/datarchive.cpp +++ b/engines/gnap/datarchive.cpp @@ -72,7 +72,7 @@ byte *DatArchive::load(int index) { DatManager::DatManager() { for (int i = 0; i < kMaxDatArchives; ++i) - _datArchives[i] = 0; + _datArchives[i] = nullptr; } DatManager::~DatManager() { @@ -87,7 +87,7 @@ void DatManager::open(int index, const char *filename) { void DatManager::close(int index) { delete _datArchives[index]; - _datArchives[index] = 0; + _datArchives[index] = nullptr; } byte *DatManager::loadResource(int resourceId) { diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index b9519110ac..79cab3dc08 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -959,7 +959,6 @@ void GnapEngine::startSoundTimerC(int timerIndex) { } int GnapEngine::playSoundC() { - static const int kSoundIdsC[] = { 0x918, 0x91F, 0x920, 0x922, 0x923, 0x924, 0x926 diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 4bd75f59a4..a13432d8fa 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -770,11 +770,9 @@ void GnapEngine::scene18_run() { if (isFlag(kGFGnapControlsToyUFO)) deleteSurface(&_s18_cowboyHatSurface); - } void GnapEngine::scene18_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { _gameSys->setAnimation(0, 0, 0); switch (_gnapActionStatus) { @@ -1016,7 +1014,6 @@ void GnapEngine::scene18_updateAnimations() { scene18_platEndPhoning(true); } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 906d84f040..5685f5cda6 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -145,22 +145,19 @@ void GnapEngine::scene42_run() { } while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) playSound(0x1094B, true); - + updateMouseCursor(); updateCursorByHotspot(); - + testWalk(0, 0, -1, -1, -1, -1); - + _sceneClickedHotspot = getClickedHotspotId(); updateGrabCursorSprite(0, 0); - - if (isFlag(kGFGnapControlsToyUFO)) { + if (isFlag(kGFGnapControlsToyUFO)) { switch (_sceneClickedHotspot) { - case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { _isLeavingScene = true; @@ -194,7 +191,6 @@ void GnapEngine::scene42_run() { runMenu(); scene42_updateHotspots(); break; - } } else { switch (_sceneClickedHotspot) { @@ -203,7 +199,7 @@ void GnapEngine::scene42_run() { scene42_updateHotspots(); _timers[4] = getRandom(20) + 30; break; - + case kHSPlatypus: if (_gnapActionStatus < 0) { if (_grabCursorSpriteIndex >= 0) { @@ -277,7 +273,7 @@ void GnapEngine::scene42_run() { } } break; - + case kHSChickenLeg: if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[kHSChickenLeg].x, _hotspotsWalkPos[kHSChickenLeg].y, _hotspotsWalkPos[kHSChickenLeg].x - 1, 0); @@ -297,17 +293,16 @@ void GnapEngine::scene42_run() { } } break; - + case kHSWalkArea1: case kHSWalkArea2: if (_gnapActionStatus < 0) gnapWalkTo(-1, -1, -1, -1, 1); break; - + } - } - + if (_mouseClickState._left && _gnapActionStatus < 0) { _mouseClickState._left = false; if (isFlag(kGFGnapControlsToyUFO)) { @@ -317,11 +312,11 @@ void GnapEngine::scene42_run() { gnapWalkTo(-1, -1, -1, -1, 1); } } - + scene42_updateAnimations(); - + toyUfoCheckTimer(); - + if (!_isLeavingScene) { if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateBeaverIdleSequence(); @@ -353,20 +348,18 @@ void GnapEngine::scene42_run() { } } } - + checkGameKeys(); - + if (isKeyStatus1(8)) { clearKeyStatus1(8); runMenu(); scene42_updateHotspots(); _timers[4] = getRandom(20) + 30; } - + gameUpdateTick(); - } - } void GnapEngine::scene42_updateAnimations() { @@ -447,7 +440,7 @@ void GnapEngine::scene42_updateAnimations() { break; } } - + if (_gameSys->getAnimationStatus(2) == 2 && _s42_nextBBQVendorSequenceId != -1) { _gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); @@ -455,7 +448,7 @@ void GnapEngine::scene42_updateAnimations() { _s42_nextBBQVendorSequenceId = -1; _timers[4] = getRandom(20) + 30; } - + if (_gameSys->getAnimationStatus(3) == 2) { switch (_toyUfoActionStatus) { case kASToyUfoLeaveScene: @@ -494,7 +487,6 @@ void GnapEngine::scene42_updateAnimations() { } _toyUfoActionStatus = -1; } - } } // End of namespace Gnap -- cgit v1.2.3 From c144b884c3141554db8098f2ebd2c6dc6ceacbb3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 16 Apr 2016 11:14:58 +0200 Subject: GNAP: Fix phone keys hotspots --- engines/gnap/scenes/scene53.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index a21641e505..bf3b06d9c9 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -34,19 +34,20 @@ int GnapEngine::scene53_init() { void GnapEngine::scene53_updateHotspots() { setHotspot(0, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(2, 336, 361, 238, 270, SF_GRAB_CURSOR); - setHotspot(3, 376, 405, 243, 274, SF_GRAB_CURSOR); - setHotspot(4, 415, 441, 248, 276, SF_GRAB_CURSOR); - setHotspot(5, 329, 358, 276, 303, SF_GRAB_CURSOR); - setHotspot(6, 378, 408, 282, 311, SF_GRAB_CURSOR); - setHotspot(7, 417, 446, 286, 319, SF_GRAB_CURSOR); - setHotspot(8, 332, 361, 311, 342, SF_GRAB_CURSOR); - setHotspot(9, 376, 407, 318, 349, SF_GRAB_CURSOR); - setHotspot(10, 417, 447, 320, 353, SF_GRAB_CURSOR); - setHotspot(11, 377, 405, 352, 384, SF_GRAB_CURSOR); - setHotspot(12, 419, 450, 358, 394, SF_GRAB_CURSOR); - setHotspot(13, 328, 359, 346, 379, SF_GRAB_CURSOR); - setHotspot(14, 150, 650, 585, 600, SF_EXIT_D_CURSOR); + setHotspot(2, 336, 238, 361, 270, SF_GRAB_CURSOR); + setHotspot(3, 376, 243, 405, 274, SF_GRAB_CURSOR); + setHotspot(4, 415, 248, 441, 276, SF_GRAB_CURSOR); + setHotspot(5, 329, 276, 358, 303, SF_GRAB_CURSOR); + setHotspot(6, 378, 282, 408, 311, SF_GRAB_CURSOR); + setHotspot(7, 417, 286, 446, 319, SF_GRAB_CURSOR); + setHotspot(8, 332, 311, 361, 342, SF_GRAB_CURSOR); + setHotspot(9, 376, 318, 407, 349, SF_GRAB_CURSOR); + setHotspot(10, 417, 320, 447, 353, SF_GRAB_CURSOR); + setHotspot(11, 377, 352, 405, 384, SF_GRAB_CURSOR); + setHotspot(12, 419, 358, 450, 394, SF_GRAB_CURSOR); + setHotspot(13, 328, 346, 359, 379, SF_GRAB_CURSOR); + setHotspot(14, 150, 585, 650, 600, SF_EXIT_D_CURSOR); + setDeviceHotspot(1, -1, -1, -1, -1); _hotspotsCount = 15; } @@ -374,9 +375,7 @@ void GnapEngine::scene53_run() { } gameUpdateTick(); - } - } } // End of namespace Gnap -- cgit v1.2.3 From ba20d63573a7db596a4c7532e99508621fafad84 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 17 Apr 2016 11:02:28 +0200 Subject: GNAP: Fix a crash after disco ball animation --- engines/gnap/scenes/scene45.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 3f8f790518..0281b7cbaa 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -391,7 +391,7 @@ void GnapEngine::scene45_updateAnimations() { if (_gameSys->getAnimationStatus(2) == 2) { _gameSys->setAnimation(0, 0, 2); int newSeqId = getRandom(7) + 0x8F; - _gameSys->insertSequence(newSeqId + 0x8F, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(newSeqId, 1, 2); _s45_currDancerSequenceId = newSeqId; } -- cgit v1.2.3 From be10dd378cea478c958d68aea2bda9232ae4ce75 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 17 Apr 2016 11:03:05 +0200 Subject: GNAP: Remove useless return after an error --- engines/gnap/resource.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 73cee761c6..7235351f65 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -171,10 +171,9 @@ protected: } ResourceClass *load(int resourceId) { - if (_dat->getResourceType(resourceId) != ResourceType) { + if (_dat->getResourceType(resourceId) != ResourceType) error("ResourceCache::load() Wrong resource type: Expected %d, got %d", ResourceType, _dat->getResourceType(resourceId)); - return nullptr; - } + byte *resourceData = _dat->loadResource(resourceId); uint32 resourceSize = _dat->getResourceSize(resourceId); ResourceClass *obj = new ResourceClass(resourceId, resourceData, resourceSize); -- cgit v1.2.3 From 82db01550a5427408eb6922c715348c2767f3da2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 17 Apr 2016 21:41:56 +0200 Subject: GNAP: Fix hotspots in scene 30 --- engines/gnap/scenes/scene30.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 5344d3f724..089e50e134 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -50,8 +50,8 @@ int GnapEngine::scene30_init() { void GnapEngine::scene30_updateHotspots() { setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); setHotspot(kHSPillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); - setHotspot(kHSExitCircus, 100, 590, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitCircus, 0, 0, 800, 514); + setHotspot(kHSExitCircus, 100, 590 - _deviceY1, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + setHotspot(kHSWalkArea1, 0, 0, 800, 514); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); _hotspotsCount = 5; } @@ -82,7 +82,6 @@ void GnapEngine::scene30_run() { platypusWalkTo(6, 8, -1, 0x107C2, 1); while (!_sceneDone) { - updateMouseCursor(); updateCursorByHotspot(); @@ -90,7 +89,6 @@ void GnapEngine::scene30_run() { updateGrabCursorSprite(0, 0); switch (_sceneClickedHotspot) { - case kHSDevice: if (_gnapActionStatus < 0) { runMenu(); -- cgit v1.2.3 From 0f58e9481da3ef9a4015e5eac70cbb4521956135 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Apr 2016 00:06:24 +0200 Subject: GNAP: Rename hotspots in scene 53 --- engines/gnap/scenes/scene53.cpp | 56 +++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index bf3b06d9c9..f76f608273 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -26,6 +26,24 @@ namespace Gnap { +enum { + kHSPlatypus = 0, + kHSDevice = 1, + kHSPhoneKey1 = 2, + kHSPhoneKey2 = 3, + kHSPhoneKey3 = 4, + kHSPhoneKey4 = 5, + kHSPhoneKey5 = 6, + kHSPhoneKey6 = 7, + kHSPhoneKey7 = 8, + kHSPhoneKey8 = 9, + kHSPhoneKey9 = 10, + kHSPhoneKey0 = 11, + kHSPhoneKeySharp = 12, + kHSPhoneKeyStar = 13, + kHSPhoneExit = 14 +}; + int GnapEngine::scene53_init() { _gameSys->setAnimation(0, 0, 0); _gameSys->setAnimation(0, 0, 1); @@ -33,27 +51,26 @@ int GnapEngine::scene53_init() { } void GnapEngine::scene53_updateHotspots() { - setHotspot(0, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(2, 336, 238, 361, 270, SF_GRAB_CURSOR); - setHotspot(3, 376, 243, 405, 274, SF_GRAB_CURSOR); - setHotspot(4, 415, 248, 441, 276, SF_GRAB_CURSOR); - setHotspot(5, 329, 276, 358, 303, SF_GRAB_CURSOR); - setHotspot(6, 378, 282, 408, 311, SF_GRAB_CURSOR); - setHotspot(7, 417, 286, 446, 319, SF_GRAB_CURSOR); - setHotspot(8, 332, 311, 361, 342, SF_GRAB_CURSOR); - setHotspot(9, 376, 318, 407, 349, SF_GRAB_CURSOR); - setHotspot(10, 417, 320, 447, 353, SF_GRAB_CURSOR); - setHotspot(11, 377, 352, 405, 384, SF_GRAB_CURSOR); - setHotspot(12, 419, 358, 450, 394, SF_GRAB_CURSOR); - setHotspot(13, 328, 346, 359, 379, SF_GRAB_CURSOR); - setHotspot(14, 150, 585, 650, 600, SF_EXIT_D_CURSOR); + setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + setHotspot(kHSPhoneKey1, 336, 238, 361, 270, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey2, 376, 243, 405, 274, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey3, 415, 248, 441, 276, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey4, 329, 276, 358, 303, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey5, 378, 282, 408, 311, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey6, 417, 286, 446, 319, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey7, 332, 311, 361, 342, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey8, 376, 318, 407, 349, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey9, 417, 320, 447, 353, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKey0, 377, 352, 405, 384, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKeySharp, 419, 358, 450, 394, SF_GRAB_CURSOR); + setHotspot(kHSPhoneKeyStar, 328, 346, 359, 379, SF_GRAB_CURSOR); + setHotspot(kHSPhoneExit, 150, 585, 650, 600, SF_EXIT_D_CURSOR); - setDeviceHotspot(1, -1, -1, -1, -1); + setDeviceHotspot(kHSDevice, -1, -1, -1, -1); _hotspotsCount = 15; } int GnapEngine::scene53_pressPhoneNumberButton(int phoneNumber, int buttonNum) { - static const int kGnapHandSequenceIds[13] = { 0x00, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, @@ -104,7 +121,6 @@ int GnapEngine::scene53_getRandomCallIndex() { } void GnapEngine::scene53_runRandomCall() { - static const int kCallSequenceIds[15] = { 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, @@ -134,7 +150,6 @@ void GnapEngine::scene53_runRandomCall() { gameUpdateTick(); } _gnapActionStatus = -1; - } void GnapEngine::scene53_runChitChatLine() { @@ -160,10 +175,9 @@ void GnapEngine::scene53_runChitChatLine() { _s53_currHandSequenceId = 0x5E; } - _hotspots[1]._flags = SF_DISABLED; + _hotspots[kHSDevice]._flags = SF_DISABLED; while (!flag) { - updateMouseCursor(); updateCursorByHotspot(); @@ -230,7 +244,6 @@ void GnapEngine::scene53_runChitChatLine() { } _gnapActionStatus = -1; } - } scene53_updateHotspots(); @@ -248,7 +261,6 @@ void GnapEngine::scene53_runChitChatLine() { _s53_currHandSequenceId = 0x73; _gnapActionStatus = -1; } - } void GnapEngine::scene53_run() { -- cgit v1.2.3 From de17d92199c5351b29a83efb7a04ce1d8805b976 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Apr 2016 07:37:02 +0200 Subject: GNAP: Remove unused variable in fatUpdateFrame --- engines/gnap/gamesys.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index ef0a265456..e983440c92 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -1001,7 +1001,6 @@ void GameSys::handleReqRemoveSpriteDrawItems() { } void GameSys::fatUpdateFrame() { - debugC(kDebugBasic, "GameSys::fatUpdateFrame()"); int32 clockDelta = _gameSysClock - _lastUpdateClock; @@ -1012,7 +1011,6 @@ void GameSys::fatUpdateFrame() { if (clockDelta <= 0) return; - bool updFlag = true; int duration, currFrameNum; // NOTE Skipped avi code (reqAviStart) @@ -1029,7 +1027,6 @@ void GameSys::fatUpdateFrame() { } else { Sequence *seqItem = seqFind(gfxItem->_sequenceId, gfxItem->_id, 0); if (!animation) { - updFlag = false; gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; gfxItem->_currFrame._duration = 0; @@ -1038,7 +1035,6 @@ void GameSys::fatUpdateFrame() { gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else if (!seqItem) { - updFlag = false; gfxItem->_animation = nullptr; gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; @@ -1046,7 +1042,6 @@ void GameSys::fatUpdateFrame() { gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else if ((seqItem->_flags & 4) && clockDelta > 1) { - updFlag = false; if (gfxItem->_delayTicks < clockDelta) { duration = clockDelta - gfxItem->_delayTicks; gfxItem->_delayTicks = 0; @@ -1072,7 +1067,6 @@ void GameSys::fatUpdateFrame() { } currFrameNum = gfxItem->_currFrameNum; if (animation->_framesCount > currFrameNum) { - updFlag = false; while (animation->_framesCount > currFrameNum && animation->frames[currFrameNum]._duration <= duration) { if (animation->frames[currFrameNum]._soundId != -1) @@ -1109,12 +1103,10 @@ void GameSys::fatUpdateFrame() { gfxItem->_updFlag = false; } } else { - updFlag = false; gfxItem->_prevFrame._duration -= duration; gfxItem->_updFlag = false; } } else { - updFlag = false; gfxItem->_delayTicks -= clockDelta; gfxItem->_updFlag = false; } @@ -1202,7 +1194,6 @@ void GameSys::fatUpdateFrame() { found = true; } if (found) { - updFlag = false; seqRemoveGfx(seqItem->_sequenceId2, seqItem->_id2); seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); _fatSequenceItems.remove_at(i); @@ -1211,7 +1202,6 @@ void GameSys::fatUpdateFrame() { } } } else { - updFlag = false; if (seqItem->_totalDuration < clockDelta) { int index; bool found = false; @@ -1245,7 +1235,6 @@ void GameSys::fatUpdateFrame() { updateAnimationsStatus(seqItem->_sequenceId, seqItem->_id); if (seqItem->_flags & 2) { int gfxDuration; - updFlag = false; if (updateSequenceDuration(seqItem->_sequenceId, seqItem->_id, &gfxDuration)) { seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); seqInsertGfx(i, gfxDuration); -- cgit v1.2.3 From ff7f8aa26d69918c66f6431fb7863d7205e23d81 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Apr 2016 07:49:27 +0200 Subject: GNAP: Refactor getBeaverSequenceId --- engines/gnap/gnap.cpp | 24 ++++++------------------ engines/gnap/gnap.h | 2 +- engines/gnap/scenes/scene01.cpp | 2 +- engines/gnap/scenes/scene02.cpp | 2 +- engines/gnap/scenes/scene03.cpp | 2 +- engines/gnap/scenes/scene04.cpp | 2 +- engines/gnap/scenes/scene05.cpp | 2 +- engines/gnap/scenes/scene06.cpp | 2 +- engines/gnap/scenes/scene07.cpp | 2 +- engines/gnap/scenes/scene08.cpp | 2 +- engines/gnap/scenes/scene09.cpp | 2 +- engines/gnap/scenes/scene10.cpp | 2 +- engines/gnap/scenes/scene11.cpp | 2 +- engines/gnap/scenes/scene12.cpp | 2 +- engines/gnap/scenes/scene13.cpp | 2 +- engines/gnap/scenes/scene17.cpp | 2 +- engines/gnap/scenes/scene18.cpp | 2 +- engines/gnap/scenes/scene19.cpp | 2 +- engines/gnap/scenes/scene20.cpp | 2 +- engines/gnap/scenes/scene21.cpp | 2 +- engines/gnap/scenes/scene22.cpp | 2 +- engines/gnap/scenes/scene23.cpp | 2 +- engines/gnap/scenes/scene24.cpp | 2 +- engines/gnap/scenes/scene25.cpp | 2 +- engines/gnap/scenes/scene26.cpp | 2 +- engines/gnap/scenes/scene27.cpp | 2 +- engines/gnap/scenes/scene28.cpp | 2 +- engines/gnap/scenes/scene29.cpp | 2 +- engines/gnap/scenes/scene30.cpp | 2 +- engines/gnap/scenes/scene31.cpp | 2 +- engines/gnap/scenes/scene32.cpp | 2 +- engines/gnap/scenes/scene33.cpp | 2 +- engines/gnap/scenes/scene38.cpp | 2 +- engines/gnap/scenes/scene39.cpp | 2 +- engines/gnap/scenes/scene40.cpp | 2 +- engines/gnap/scenes/scene41.cpp | 2 +- engines/gnap/scenes/scene42.cpp | 2 +- engines/gnap/scenes/scene43.cpp | 2 +- engines/gnap/scenes/scene44.cpp | 2 +- engines/gnap/scenes/scene45.cpp | 2 +- engines/gnap/scenes/scene46.cpp | 2 +- 41 files changed, 46 insertions(+), 58 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 79cab3dc08..8e4bc90661 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1908,29 +1908,17 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { setFlag(kGFPlatyPussDisguised); } -// CHECKME: The 3 parameters are always 0 -int GnapEngine::getBeaverSequenceId(int kind, int gridX, int gridY) { - int sequenceId; +int GnapEngine::getBeaverSequenceId() { + // The original had 3 parameters, all always set to 0. + // The code to handle the other values has been removed. - // TODO kind is always 0, remove that parameter - if (kind != 0) - return 0; + int sequenceId = 0x7CB; - if (gridX > 0 && gridY > 0) { - if (gridX < _platX) { - sequenceId = 0x7CC; - _beaverFacing = kDirUnk4; - } else { - sequenceId = 0x7CB; - _beaverFacing = kDirNone; - } - } else if (_beaverFacing != kDirNone) { + if (_beaverFacing != kDirNone) { sequenceId = 0x7CC; _beaverFacing = kDirUnk4; - } else { - sequenceId = 0x7CB; - _beaverFacing = kDirNone; } + return sequenceId | 0x10000; } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 5318e3fa7d..9e389bcea1 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -581,7 +581,7 @@ public: Facing _beaverFacing; int _beaverActionStatus; int _beaverSequenceId, _beaverSequenceDatNum, _beaverId; - int getBeaverSequenceId(int kind, int gridX, int gridY); + int getBeaverSequenceId(); void playBeaverSequence(int sequenceId); void updateBeaverIdleSequence(); void beaverSub426234(); diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 30e649186f..08c807d1cd 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -152,7 +152,7 @@ void GnapEngine::scene01_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index d214f3b412..3831c68b2c 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -180,7 +180,7 @@ void GnapEngine::scene02_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 1916350c35..974b0d24a2 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -154,7 +154,7 @@ void GnapEngine::scene03_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 27ed3ac9cd..0f86eed02c 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -197,7 +197,7 @@ void GnapEngine::scene04_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index 6ef4b357fc..4a60292808 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -148,7 +148,7 @@ void GnapEngine::scene05_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index f89bace54c..cbe4fb44e1 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -151,7 +151,7 @@ void GnapEngine::scene06_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index e2d385df63..d240378eca 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -123,7 +123,7 @@ void GnapEngine::scene07_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index d8a1c26a08..ed67669d5d 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -167,7 +167,7 @@ void GnapEngine::scene08_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 368f8fea49..cf1af00ca2 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -115,7 +115,7 @@ void GnapEngine::scene09_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index b5f9cb1577..5650dd1d16 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -135,7 +135,7 @@ void GnapEngine::scene10_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 3e2a75757c..68a261bf72 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -163,7 +163,7 @@ void GnapEngine::scene11_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index df26e4d0e1..dcd62a36a6 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -152,7 +152,7 @@ void GnapEngine::scene12_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 58bdba1ade..cff04bba2f 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -153,7 +153,7 @@ void GnapEngine::scene13_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0)); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index aa08255cd6..37427bd34f 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -317,7 +317,7 @@ void GnapEngine::scene17_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index a13432d8fa..d1683b6380 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -435,7 +435,7 @@ void GnapEngine::scene18_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index ddc977fb7b..fd8b421331 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -168,7 +168,7 @@ void GnapEngine::scene19_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index dd49b4c0bf..9298fc1f62 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -310,7 +310,7 @@ void GnapEngine::scene20_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index c04b7c43cf..9d2b1719a8 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -138,7 +138,7 @@ void GnapEngine::scene21_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index a01c7e4b77..3a196dacd5 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -150,7 +150,7 @@ void GnapEngine::scene22_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index 9a16ce42ff..70437eb6c7 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -122,7 +122,7 @@ void GnapEngine::scene23_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp index dcfeb181ac..1c67c50de0 100644 --- a/engines/gnap/scenes/scene24.cpp +++ b/engines/gnap/scenes/scene24.cpp @@ -132,7 +132,7 @@ void GnapEngine::scene24_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index cf95acafb7..427536be1d 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -166,7 +166,7 @@ void GnapEngine::scene25_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index 7da339358e..f2ced59d2d 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -125,7 +125,7 @@ void GnapEngine::scene26_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 0466940267..ad25092620 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -153,7 +153,7 @@ void GnapEngine::scene27_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index 5f4dc74bd2..86df88bd1f 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -149,7 +149,7 @@ void GnapEngine::scene28_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index e4cea83bbd..6ab5744a93 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -131,7 +131,7 @@ void GnapEngine::scene29_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 089e50e134..b394baf7d9 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -112,7 +112,7 @@ void GnapEngine::scene30_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 084a12733b..3adfcbd46e 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -124,7 +124,7 @@ void GnapEngine::scene31_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index 659ce0e7f5..ff526044bc 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -112,7 +112,7 @@ void GnapEngine::scene32_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index 72588329a9..bad0f88a4e 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -133,7 +133,7 @@ void GnapEngine::scene33_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index 3650c63634..b60c8327e1 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -135,7 +135,7 @@ void GnapEngine::scene38_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index 4950717d16..a89fea8f0e 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -116,7 +116,7 @@ void GnapEngine::scene39_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index cbbae71729..c2b829100a 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -96,7 +96,7 @@ void GnapEngine::scene40_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 41480bf3ce..23ac6ca4de 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -236,7 +236,7 @@ void GnapEngine::scene41_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 5685f5cda6..6b719d2761 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -214,7 +214,7 @@ void GnapEngine::scene42_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 45b52a7adb..dcf03cb671 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -220,7 +220,7 @@ void GnapEngine::scene43_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index dad63016a5..3b2633bc83 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -231,7 +231,7 @@ void GnapEngine::scene44_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 0281b7cbaa..8581e551e5 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -245,7 +245,7 @@ void GnapEngine::scene45_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index d0c8965d86..4a1ba2535f 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -183,7 +183,7 @@ void GnapEngine::scene46_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId(0, 0, 0) | 0x10000); + playBeaverSequence(getBeaverSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); -- cgit v1.2.3 From 90c7e1db014633a905993feaf6a8d0f152e11d2b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Apr 2016 07:57:41 +0200 Subject: GNAP: Rename members of GnapEngine from beaver to platypus for consistency --- engines/gnap/gnap.cpp | 146 ++++++++++++++++++------------------- engines/gnap/gnap.h | 26 +++---- engines/gnap/grid.cpp | 80 ++++++++++----------- engines/gnap/scenes/scene01.cpp | 10 +-- engines/gnap/scenes/scene02.cpp | 16 ++--- engines/gnap/scenes/scene03.cpp | 62 ++++++++-------- engines/gnap/scenes/scene04.cpp | 20 +++--- engines/gnap/scenes/scene05.cpp | 36 +++++----- engines/gnap/scenes/scene06.cpp | 32 ++++----- engines/gnap/scenes/scene07.cpp | 40 +++++------ engines/gnap/scenes/scene08.cpp | 36 +++++----- engines/gnap/scenes/scene09.cpp | 12 ++-- engines/gnap/scenes/scene10.cpp | 44 ++++++------ engines/gnap/scenes/scene11.cpp | 16 ++--- engines/gnap/scenes/scene12.cpp | 40 +++++------ engines/gnap/scenes/scene13.cpp | 10 +-- engines/gnap/scenes/scene17.cpp | 154 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene18.cpp | 24 +++---- engines/gnap/scenes/scene19.cpp | 6 +- engines/gnap/scenes/scene20.cpp | 24 +++---- engines/gnap/scenes/scene21.cpp | 10 +-- engines/gnap/scenes/scene22.cpp | 10 +-- engines/gnap/scenes/scene23.cpp | 6 +- engines/gnap/scenes/scene24.cpp | 8 +-- engines/gnap/scenes/scene25.cpp | 8 +-- engines/gnap/scenes/scene26.cpp | 8 +-- engines/gnap/scenes/scene27.cpp | 12 ++-- engines/gnap/scenes/scene28.cpp | 8 +-- engines/gnap/scenes/scene29.cpp | 8 +-- engines/gnap/scenes/scene30.cpp | 6 +- engines/gnap/scenes/scene31.cpp | 18 ++--- engines/gnap/scenes/scene32.cpp | 10 +-- engines/gnap/scenes/scene33.cpp | 14 ++-- engines/gnap/scenes/scene38.cpp | 56 +++++++-------- engines/gnap/scenes/scene39.cpp | 10 +-- engines/gnap/scenes/scene40.cpp | 2 +- engines/gnap/scenes/scene41.cpp | 18 ++--- engines/gnap/scenes/scene42.cpp | 14 ++-- engines/gnap/scenes/scene43.cpp | 16 ++--- engines/gnap/scenes/scene44.cpp | 46 ++++++------ engines/gnap/scenes/scene45.cpp | 24 +++---- engines/gnap/scenes/scene46.cpp | 16 ++--- 42 files changed, 581 insertions(+), 581 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 8e4bc90661..15c949ab77 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -470,10 +470,10 @@ void GnapEngine::updateMouseCursor() { setCursor(kDisabledCursors[_verbCursor]); setGrabCursorSprite(-1); } - if (_isWaiting && ((_gnapActionStatus < 0 && _beaverActionStatus < 0) || _sceneWaiting)) { + if (_isWaiting && ((_gnapActionStatus < 0 && _platypusActionStatus < 0) || _sceneWaiting)) { setCursor(kDisabledCursors[_verbCursor]); _isWaiting = false; - } else if (!_isWaiting && (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) && !_sceneWaiting) { + } else if (!_isWaiting && (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) && !_sceneWaiting) { setCursor(WAIT_CURSOR); _isWaiting = true; } @@ -824,7 +824,7 @@ void GnapEngine::initScene() { _sceneDone = false; _newSceneNum = 55; _gnapActionStatus = -1; - _beaverActionStatus = -1; + _platypusActionStatus = -1; gnapInitBrainPulseRndValue(); hideCursor(); clearAllKeyStatus1(); @@ -1638,7 +1638,7 @@ void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { if (_platX == gridX && _platY == gridY) - beaverMakeRoom(); + platypusMakeRoom(); gnapWalkTo(gridX, gridY, -1, -1, 1); playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); } @@ -1732,7 +1732,7 @@ bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gr _isLeavingScene = false; _gameSys->setAnimation(0, 0, animationIndex); _gnapActionStatus = -1; - _beaverActionStatus = -1; + _platypusActionStatus = -1; gnapWalkTo(gridX1, gridY1, -1, -1, 1); platypusWalkTo(gridX2, gridY2, -1, -1, 1); _mouseClickState._left = false; @@ -1767,21 +1767,21 @@ void GnapEngine::gnapInitBrainPulseRndValue() { _gnapBrainPulseRndValue = 2 * getRandom(10); } -void GnapEngine::gnapUseDeviceOnBeaver() { +void GnapEngine::gnapUseDeviceOnPlatypuss() { playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _platX, _platY))); - if (_beaverFacing != kDirNone) { - _gameSys->insertSequence(makeRid(1, 0x7D5), _beaverId, - makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + if (_platypusFacing != kDirNone) { + _gameSys->insertSequence(makeRid(1, 0x7D5), _platypusId, + makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _beaverSequenceId = 0x7D5; - _beaverSequenceDatNum = 1; + _platypusSequenceId = 0x7D5; + _platypusSequenceDatNum = 1; } else { - _gameSys->insertSequence(makeRid(1, 0x7D4), _beaverId, - makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + _gameSys->insertSequence(makeRid(1, 0x7D4), _platypusId, + makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _beaverSequenceId = 0x7D4; - _beaverSequenceDatNum = 1; + _platypusSequenceId = 0x7D4; + _platypusSequenceDatNum = 1; } int newSequenceId = getGnapSequenceId(gskUseDevice, 0, 0); @@ -1810,7 +1810,7 @@ void GnapEngine::doCallback(int callback) { bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) { bool result = false; - if (_gnapActionStatus <= -1 && _beaverActionStatus <= -1) { + if (_gnapActionStatus <= -1 && _platypusActionStatus <= -1) { _gnapActionStatus = 100; if (isPointBlocked(_platX + gridX, _platY + gridY) && (_platX + gridX != _gnapX || _platY + gridY != _gnapY)) platypusWalkStep(); @@ -1823,8 +1823,8 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in } _gameSys->setAnimation(0, 0, 0); if (_platX + gridX == _gnapX && _platY + gridY == _gnapY) { - _gameSys->setAnimation(platSequenceId, _beaverId, 1); - playBeaverSequence(platSequenceId); + _gameSys->setAnimation(platSequenceId, _platypusId, 1); + playPlatypusSequence(platSequenceId); while (_gameSys->getAnimationStatus(1) != 2) { updateMouseCursor(); doCallback(callback); @@ -1848,12 +1848,12 @@ void GnapEngine::gnapKissPlatypus(int callback) { kSeqSyncWait, 0, 15 * (5 * _gnapX - 20) - (21 - _gridMinX), 48 * (_gnapY - 6) - (146 - _gridMinY)); _gnapSequenceDatNum = 1; _gnapSequenceId = 0x847; - _gameSys->insertSequence(0x107CB, _beaverId, - makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + _gameSys->insertSequence(0x107CB, _platypusId, + makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, kSeqSyncWait, getSequenceTotalDuration(0x10847), 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _beaverSequenceDatNum = 1; - _beaverSequenceId = 0x7CB; - _beaverFacing = kDirNone; + _platypusSequenceDatNum = 1; + _platypusSequenceId = 0x7CB; + _platypusFacing = kDirNone; playGnapSequence(0x107B5); while (_gameSys->getAnimationStatus(0) != 2) { updateMouseCursor(); @@ -1872,18 +1872,18 @@ void GnapEngine::gnapUseJointOnPlatypus() { if (gnapPlatypusAction(1, 0, 0x107C1, 0)) { _gnapActionStatus = 100; _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0x10876, _beaverId, 0); + _gameSys->setAnimation(0x10876, _platypusId, 0); _gameSys->insertSequence(0x10875, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 15 * (5 * _gnapX - 30), 48 * (_gnapY - 7)); _gnapSequenceDatNum = 1; _gnapSequenceId = 0x875; - _gameSys->insertSequence(0x10876, _beaverId, - _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + _gameSys->insertSequence(0x10876, _platypusId, + _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 15 * (5 * _platX - 25), 48 * (_platY - 7)); - _beaverSequenceDatNum = 1; - _beaverSequenceId = 0x876; - _beaverFacing = kDirNone; + _platypusSequenceDatNum = 1; + _platypusSequenceId = 0x876; + _platypusFacing = kDirNone; playGnapSequence(0x107B5); gnapWalkStep(); while (_gameSys->getAnimationStatus(0) != 2) { @@ -1908,59 +1908,59 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { setFlag(kGFPlatyPussDisguised); } -int GnapEngine::getBeaverSequenceId() { +int GnapEngine::getPlatypusSequenceId() { // The original had 3 parameters, all always set to 0. // The code to handle the other values has been removed. int sequenceId = 0x7CB; - if (_beaverFacing != kDirNone) { + if (_platypusFacing != kDirNone) { sequenceId = 0x7CC; - _beaverFacing = kDirUnk4; + _platypusFacing = kDirUnk4; } return sequenceId | 0x10000; } -void GnapEngine::playBeaverSequence(int sequenceId) { - _gameSys->insertSequence(sequenceId, _beaverId, - makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, +void GnapEngine::playPlatypusSequence(int sequenceId) { + _gameSys->insertSequence(sequenceId, _platypusId, + makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, kSeqScale | kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _beaverSequenceId = ridToEntryIndex(sequenceId); - _beaverSequenceDatNum = ridToDatIndex(sequenceId); + _platypusSequenceId = ridToEntryIndex(sequenceId); + _platypusSequenceDatNum = ridToDatIndex(sequenceId); } -void GnapEngine::updateBeaverIdleSequence() { - if (_beaverActionStatus < 0 && _gnapActionStatus < 0) { +void GnapEngine::updatePlatypusIdleSequence() { + if (_platypusActionStatus < 0 && _gnapActionStatus < 0) { if (_timers[0] > 0) { if (_timers[1] == 0) { _timers[1] = getRandom(20) + 30; int rnd = getRandom(10); - if (_beaverFacing != kDirNone) { - if (rnd != 0 || _beaverSequenceId != 0x7CA) { - if (rnd != 1 || _beaverSequenceId != 0x7CA) - playBeaverSequence(0x107CA); + if (_platypusFacing != kDirNone) { + if (rnd != 0 || _platypusSequenceId != 0x7CA) { + if (rnd != 1 || _platypusSequenceId != 0x7CA) + playPlatypusSequence(0x107CA); else - playBeaverSequence(0x10845); + playPlatypusSequence(0x10845); } else { - playBeaverSequence(0x107CC); + playPlatypusSequence(0x107CC); } - } else if (rnd != 0 || _beaverSequenceId != 0x7C9) { - if (rnd != 1 || _beaverSequenceId != 0x7C9) { - if (rnd != 2 || _beaverSequenceId != 0x7C9) - playBeaverSequence(0x107C9); + } else if (rnd != 0 || _platypusSequenceId != 0x7C9) { + if (rnd != 1 || _platypusSequenceId != 0x7C9) { + if (rnd != 2 || _platypusSequenceId != 0x7C9) + playPlatypusSequence(0x107C9); else - playBeaverSequence(0x108A4); + playPlatypusSequence(0x108A4); } else { - playBeaverSequence(0x10844); + playPlatypusSequence(0x10844); } } else { - playBeaverSequence(0x107CB); + playPlatypusSequence(0x107CB); } } } else { _timers[0] = getRandom(75) + 75; - beaverMakeRoom(); + platypusMakeRoom(); } } else { _timers[0] = 100; @@ -1968,27 +1968,27 @@ void GnapEngine::updateBeaverIdleSequence() { } } -void GnapEngine::beaverSub426234() { - if (_beaverActionStatus < 0 && _gnapActionStatus < 0) { +void GnapEngine::platypusSub426234() { + if (_platypusActionStatus < 0 && _gnapActionStatus < 0) { if (_timers[0]) { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; - if (_beaverFacing != kDirNone) { - if (getRandom(10) >= 2 || _beaverSequenceId != 0x7CA) - playBeaverSequence(0x107CA); + if (_platypusFacing != kDirNone) { + if (getRandom(10) >= 2 || _platypusSequenceId != 0x7CA) + playPlatypusSequence(0x107CA); else - playBeaverSequence(0x107CC); + playPlatypusSequence(0x107CC); } else { - if (getRandom(10) >= 2 || _beaverSequenceId != 0x7C9) { - playBeaverSequence(0x107C9); + if (getRandom(10) >= 2 || _platypusSequenceId != 0x7C9) { + playPlatypusSequence(0x107C9); } else { - playBeaverSequence(0x107CB); + playPlatypusSequence(0x107CB); } } } } else { _timers[0] = getRandom(75) + 75; - beaverMakeRoom(); + platypusMakeRoom(); } } else { _timers[0] = 100; @@ -1996,24 +1996,24 @@ void GnapEngine::beaverSub426234() { } } -void GnapEngine::initBeaverPos(int gridX, int gridY, Facing facing) { +void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { _timers[0] = 50; _timers[1] = 20; _platX = gridX; _platY = gridY; if (facing == kDirNone) - _beaverFacing = kDirNone; + _platypusFacing = kDirNone; else - _beaverFacing = facing; - if (_beaverFacing == kDirUnk4) { - _beaverSequenceId = 0x7D1; + _platypusFacing = facing; + if (_platypusFacing == kDirUnk4) { + _platypusSequenceId = 0x7D1; } else { - _beaverSequenceId = 0x7C1; - _beaverFacing = kDirNone; + _platypusSequenceId = 0x7C1; + _platypusFacing = kDirNone; } - _beaverId = 20 * _platY; - _beaverSequenceDatNum = 1; - _gameSys->insertSequence(makeRid(1, _beaverSequenceId), 20 * _platY, + _platypusId = 20 * _platY; + _platypusSequenceDatNum = 1; + _gameSys->insertSequence(makeRid(1, _platypusSequenceId), 20 * _platY, 0, 0, kSeqScale, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 9e389bcea1..3517838951 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -528,21 +528,21 @@ public: bool gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void gnapWalkStep(); - // Beaver walking + // Platypus walking int _platWalkNodesCount; GridStruct _platWalkNodes[kMaxGridStructs]; int _platX, _platY; int _platWalkDestX, _platWalkDestY; int _platWalkDeltaX, _platWalkDeltaY, _platWalkDirX, _platWalkDirY, _platWalkDirXIncr, _platWalkDirYIncr; - int getBeaverWalkSequenceId(int deltaX, int deltaY); + int getPlatypusWalkSequenceId(int deltaX, int deltaY); bool gridSub423750(int gridX, int gridY); bool gridSub423CC1(int gridX, int gridY, int index); bool gridSub42419A(int gridX, int gridY, int index); bool platFindPath3(int gridX, int gridY); bool platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void platypusWalkStep(); - void beaverMakeRoom(); + void platypusMakeRoom(); // Gnap Facing _gnapIdleFacing; @@ -570,22 +570,22 @@ public: void updateGnapIdleSequence2(); void initGnapPos(int gridX, int gridY, Facing facing); void gnapInitBrainPulseRndValue(); - void gnapUseDeviceOnBeaver(); + void gnapUseDeviceOnPlatypuss(); void doCallback(int callback); bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); void gnapKissPlatypus(int callback); void gnapUseJointOnPlatypus(); void gnapUseDisguiseOnPlatypus(); - // Beaver - Facing _beaverFacing; - int _beaverActionStatus; - int _beaverSequenceId, _beaverSequenceDatNum, _beaverId; - int getBeaverSequenceId(); - void playBeaverSequence(int sequenceId); - void updateBeaverIdleSequence(); - void beaverSub426234(); - void initBeaverPos(int gridX, int gridY, Facing facing); + // Platypus + Facing _platypusFacing; + int _platypusActionStatus; + int _platypusSequenceId, _platypusSequenceDatNum, _platypusId; + int getPlatypusSequenceId(); + void playPlatypusSequence(int sequenceId); + void updatePlatypusIdleSequence(); + void platypusSub426234(); + void initPlatypusPos(int gridX, int gridY, Facing facing); // Scenes diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 99add51bfb..88e9693113 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -555,7 +555,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); if (animationIndex >= 0 && _gnapWalkDestX == _platX && _gnapWalkDestY == _platY) - beaverMakeRoom(); + platypusMakeRoom(); if (gridSub41F5FC(_gnapX, _gnapY, 0)) done = true; @@ -737,7 +737,7 @@ void GnapEngine::gnapWalkStep() { //////////////////////////////////////////////////////////////////////////////// -int GnapEngine::getBeaverWalkSequenceId(int deltaX, int deltaY) { +int GnapEngine::getPlatypusWalkSequenceId(int deltaX, int deltaY) { static const int _beaverWalkSequenceIds[9] = { 0x7C5, 0x000, 0x7C8, 0x7C4, 0x000, 0x7C7, @@ -1225,9 +1225,9 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (!done) gridSub423750(_platX, _platY); - int platSequenceId = _beaverSequenceId; - int platId = _beaverId; - int platSequenceDatNum = _beaverSequenceDatNum; + int platSequenceId = _platypusSequenceId; + int platId = _platypusId; + int platSequenceDatNum = _platypusSequenceDatNum; for (int index = 0; index < _platWalkNodesCount; ++index) { _platWalkNodes[index]._id = index + 20 * _platWalkNodes[index]._gridY1; @@ -1264,7 +1264,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platWalkNodes[index]._id -= 10; else _platWalkNodes[index]._id += 10; - int newSequenceId = getBeaverWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); + int newSequenceId = getPlatypusWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); @@ -1277,72 +1277,72 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (flags & 8) { if (_platWalkNodesCount > 0) { - _beaverSequenceId = platSequenceId; - _beaverId = platId; - _beaverSequenceDatNum = datNum; + _platypusSequenceId = platSequenceId; + _platypusId = platId; + _platypusSequenceDatNum = datNum; // CHECKME Not sure if this is correct... if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) - _beaverFacing = kDirNone; + _platypusFacing = kDirNone; else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) - _beaverFacing = kDirUnk4; + _platypusFacing = kDirUnk4; else if (_platWalkNodes[_platWalkNodesCount - 1]._gridX1 % 2) - _beaverFacing = kDirUnk4; + _platypusFacing = kDirUnk4; else - _beaverFacing = kDirNone; + _platypusFacing = kDirNone; if (animationIndex >= 0) - _gameSys->setAnimation(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, animationIndex); + _gameSys->setAnimation(makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, animationIndex); } else if (animationIndex >= 0) { _gameSys->setAnimation(0x107D3, 1, animationIndex); _gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); } } else { if (sequenceId >= 0 && sequenceId != -1) { - _beaverSequenceId = ridToEntryIndex(sequenceId); - _beaverSequenceDatNum = ridToDatIndex(sequenceId); - if (_beaverSequenceId == 0x7C2) { - _beaverFacing = kDirNone; - } else if (_beaverSequenceId == 0x7D2) { - _beaverFacing = kDirUnk4; + _platypusSequenceId = ridToEntryIndex(sequenceId); + _platypusSequenceDatNum = ridToDatIndex(sequenceId); + if (_platypusSequenceId == 0x7C2) { + _platypusFacing = kDirNone; + } else if (_platypusSequenceId == 0x7D2) { + _platypusFacing = kDirUnk4; } } else { if (_platWalkNodesCount > 0) { if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) { - _beaverSequenceId = 0x7C2; - _beaverFacing = kDirNone; + _platypusSequenceId = 0x7C2; + _platypusFacing = kDirNone; } else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) { - _beaverSequenceId = 0x7D2; - _beaverFacing = kDirUnk4; + _platypusSequenceId = 0x7D2; + _platypusFacing = kDirUnk4; } else if (_platWalkNodes[0]._deltaX > 0) { - _beaverSequenceId = 0x7C2; - _beaverFacing = kDirNone; + _platypusSequenceId = 0x7C2; + _platypusFacing = kDirNone; } else if (_platWalkNodes[0]._deltaX < 0) { - _beaverSequenceId = 0x7D2; - _beaverFacing = kDirUnk4; + _platypusSequenceId = 0x7D2; + _platypusFacing = kDirUnk4; } else { - _beaverSequenceId = 0x7D2; - _beaverFacing = kDirUnk4; + _platypusSequenceId = 0x7D2; + _platypusFacing = kDirUnk4; } - } else if (_beaverFacing != kDirNone) { - _beaverSequenceId = 0x7D2; + } else if (_platypusFacing != kDirNone) { + _platypusSequenceId = 0x7D2; } else { - _beaverSequenceId = 0x7C2; + _platypusSequenceId = 0x7C2; } - _beaverSequenceDatNum = datNum; + _platypusSequenceDatNum = datNum; } if (animationIndex < 0) { - _beaverId = 20 * _platWalkDestY; + _platypusId = 20 * _platWalkDestY; } else { - _beaverId = animationIndex + 20 * _platWalkDestY; - _gameSys->setAnimation(makeRid(_beaverSequenceDatNum, _beaverSequenceId), animationIndex + 20 * _platWalkDestY, animationIndex); + _platypusId = animationIndex + 20 * _platWalkDestY; + _gameSys->setAnimation(makeRid(_platypusSequenceDatNum, _platypusSequenceId), animationIndex + 20 * _platWalkDestY, animationIndex); } if (flags & 4) - _gameSys->insertSequence(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + _gameSys->insertSequence(makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 0, 0); else - _gameSys->insertSequence(makeRid(_beaverSequenceDatNum, _beaverSequenceId), _beaverId, + _gameSys->insertSequence(makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 75 * _platWalkDestX - _platGridX, 48 * _platWalkDestY - _platGridY); } @@ -1378,7 +1378,7 @@ void GnapEngine::platypusWalkStep() { } } -void GnapEngine::beaverMakeRoom() { +void GnapEngine::platypusMakeRoom() { int rndGridX, rndGridY; do { rndGridY = getRandom(_gridMaxY); diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 08c807d1cd..808c190af1 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -103,7 +103,7 @@ void GnapEngine::scene01_run() { if (_prevSceneNum == 2) { initGnapPos(11, 6, kDirBottomLeft); if (isFlag(kGFPlatypus)) - initBeaverPos(12, 6, kDirUnk4); + initPlatypusPos(12, 6, kDirUnk4); endSceneInit(); if (isFlag(kGFPlatypus)) platypusWalkTo(9, 6, -1, 0x107C2, 1); @@ -111,7 +111,7 @@ void GnapEngine::scene01_run() { } else { initGnapPos(1, 6, kDirBottomRight); if (isFlag(kGFPlatypus)) - initBeaverPos(1, 7, kDirNone); + initPlatypusPos(1, 7, kDirNone); endSceneInit(); } @@ -152,7 +152,7 @@ void GnapEngine::scene01_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -272,8 +272,8 @@ void GnapEngine::scene01_run() { playSound(0x1091C, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (_timers[4] == 0) { diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index 3831c68b2c..d7b542545a 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -101,7 +101,7 @@ void GnapEngine::scene02_run() { case 3: initGnapPos(11, 6, kDirBottomLeft); if (isFlag(kGFPlatypus)) - initBeaverPos(12, 6, kDirUnk4); + initPlatypusPos(12, 6, kDirUnk4); endSceneInit(); if (isFlag(kGFPlatypus)) platypusWalkTo(9, 6, -1, 0x107C2, 1); @@ -110,7 +110,7 @@ void GnapEngine::scene02_run() { case 4: initGnapPos(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, kDirBottomLeft); if (isFlag(kGFPlatypus)) - initBeaverPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, kDirUnk4); + initPlatypusPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, kDirUnk4); endSceneInit(); gnapWalkTo(7, 6, 0, 0x107B9, 1); if (isFlag(kGFPlatypus)) @@ -121,19 +121,19 @@ void GnapEngine::scene02_run() { case 47: clearFlag(kGFUnk25); initGnapPos(5, 6, kDirBottomLeft); - initBeaverPos(6, 7, kDirUnk4); + initPlatypusPos(6, 7, kDirUnk4); endSceneInit(); break; case 49: initGnapPos(5, 6, kDirBottomRight); if (isFlag(kGFPlatypus)) - initBeaverPos(6, 7, kDirNone); + initPlatypusPos(6, 7, kDirNone); endSceneInit(); break; default: initGnapPos(-1, 6, kDirBottomRight); if (isFlag(kGFPlatypus)) - initBeaverPos(-1, 7, kDirNone); + initPlatypusPos(-1, 7, kDirNone); endSceneInit(); if (isFlag(kGFPlatypus)) platypusWalkTo(2, 7, -1, 0x107C2, 1); @@ -180,7 +180,7 @@ void GnapEngine::scene02_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -363,8 +363,8 @@ void GnapEngine::scene02_run() { playSound(0x1091C, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[4]) { diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 974b0d24a2..c5af2f3e7d 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -103,13 +103,13 @@ void GnapEngine::scene03_run() { _timers[5] = getRandom(100) + 200; if (isFlag(kGFPlatypus)) { - initBeaverPos(5, 4, kDirNone); + initPlatypusPos(5, 4, kDirNone); } else { _timers[1] = getRandom(40) + 20; _gameSys->setAnimation(0x1C2, 99, 1); _gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); - _beaverSequenceId = 0x1C2; - _beaverSequenceDatNum = 0; + _platypusSequenceId = 0x1C2; + _platypusSequenceDatNum = 0; } _gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -154,7 +154,7 @@ void GnapEngine::scene03_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -319,18 +319,18 @@ void GnapEngine::scene03_run() { playSound(0x10925, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[1] && !_s03_platypusScared) { _timers[1] = getRandom(40) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && !isFlag(kGFPlatypus) && !_s03_platypusHypnotized) + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && !isFlag(kGFPlatypus) && !_s03_platypusHypnotized) _s03_nextPlatSequenceId = 450; } if (!_timers[6]) { _timers[6] = getRandom(20) + 30; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s03_nextFrogSequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s03_nextFrogSequenceId == -1) { if (getRandom(5) == 1) _s03_nextFrogSequenceId = 0x1C6; else @@ -340,12 +340,12 @@ void GnapEngine::scene03_run() { if (!_timers[4]) { // Update bird animation _timers[4] = getRandom(100) + 300; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0) + if (_gnapActionStatus < 0 && _platypusActionStatus < 0) _gameSys->insertSequence(getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); } if (!_timers[5]) { _timers[5] = getRandom(100) + 200; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { _gameSys->setAnimation(0x1C5, 253, 4); _gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } @@ -385,13 +385,13 @@ void GnapEngine::scene03_updateAnimations() { _gnapActionStatus = -1; _platX = 6; _platY = 6; - _beaverFacing = kDirUnk4; - _beaverId = 120; - _gameSys->insertSequence(0x107CA, _beaverId, 0x1BC, 99, + _platypusFacing = kDirUnk4; + _platypusId = 120; + _gameSys->insertSequence(0x107CA, _platypusId, 0x1BC, 99, kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); - _beaverSequenceDatNum = 1; - _beaverSequenceId = 0x7CA; + _platypusSequenceDatNum = 1; + _platypusSequenceId = 0x7CA; setFlag(kGFPlatypus); _s03_nextPlatSequenceId = -1; scene03_updateHotspots(); @@ -405,16 +405,16 @@ void GnapEngine::scene03_updateAnimations() { gameUpdateTick(); removeFullScreenSprite(); _gameSys->setAnimation(0x1BA, 99, 1); - _gameSys->insertSequence(0x1BA, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _beaverSequenceDatNum = 0; - _beaverSequenceId = 0x1BA; + _gameSys->insertSequence(0x1BA, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + _platypusSequenceDatNum = 0; + _platypusSequenceId = 0x1BA; _gnapActionStatus = -1; _s03_platypusHypnotized = true; scene03_updateHotspots(); break; case kASHypnotizeScaredPlat: playGnapBrainPulsating(0, 0); - _gameSys->insertSequence(0x1BF, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x1BF, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _gameSys->setAnimation(0x1BF, 99, 1); while (_gameSys->getAnimationStatus(1) != 2) gameUpdateTick(); @@ -426,8 +426,8 @@ void GnapEngine::scene03_updateAnimations() { removeFullScreenSprite(); _gameSys->setAnimation(0x1BA, 99, 1); _gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); - _beaverSequenceDatNum = 0; - _beaverSequenceId = 0x1BA; + _platypusSequenceDatNum = 0; + _platypusSequenceId = 0x1BA; _gnapActionStatus = -1; _s03_platypusHypnotized = true; scene03_updateHotspots(); @@ -458,12 +458,12 @@ void GnapEngine::scene03_updateAnimations() { _gameSys->setAnimation(0, 0, 1); _s03_platypusScared = true; _gameSys->insertSequence(0x1B5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s03_nextPlatSequenceId, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(_s03_nextPlatSequenceId, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x1B5; _gnapSequenceDatNum = 0; _gnapIdleFacing = kDirNone; - _beaverSequenceId = _s03_nextPlatSequenceId; - _beaverSequenceDatNum = 0; + _platypusSequenceId = _s03_nextPlatSequenceId; + _platypusSequenceDatNum = 0; _gameSys->setAnimation(_s03_nextPlatSequenceId, 99, 1); _s03_nextPlatSequenceId = -1; _gnapActionStatus = -1; @@ -471,7 +471,7 @@ void GnapEngine::scene03_updateAnimations() { _gnapX = 3; _gnapY = 6; _gameSys->insertSequence(0x1B6, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x1BC, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x1BC, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _gameSys->setAnimation(0x1BC, 99, 0); _gnapId = 20 * _gnapY; _gnapSequenceId = 0x1B6; @@ -481,17 +481,17 @@ void GnapEngine::scene03_updateAnimations() { _s03_nextPlatSequenceId = -1; } else if (_s03_nextPlatSequenceId == 0x1C2 && !_s03_platypusScared) { _gameSys->setAnimation(0, 0, 1); - _gameSys->insertSequence(0x1C2, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _beaverSequenceId = 0x1C2; - _beaverSequenceDatNum = 0; + _gameSys->insertSequence(0x1C2, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _platypusSequenceId = 0x1C2; + _platypusSequenceDatNum = 0; _gameSys->setAnimation(0x1C2, 99, 1); _s03_nextPlatSequenceId = -1; } else if (_s03_nextPlatSequenceId == -1 && _s03_platypusScared && !_s03_platypusHypnotized) { _gameSys->setAnimation(0, 0, 1); _gameSys->setAnimation(0x1BE, 99, 1); - _gameSys->insertSequence(0x1BE, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _beaverSequenceId = 0x1BE; - _beaverSequenceDatNum = 0; + _gameSys->insertSequence(0x1BE, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _platypusSequenceId = 0x1BE; + _platypusSequenceDatNum = 0; _s03_nextPlatSequenceId = -1; } } diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 0f86eed02c..a233152242 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -115,7 +115,7 @@ void GnapEngine::scene04_run() { _gnapId = 140; _platX = 6; _platY = 7; - _beaverId = 141; + _platypusId = 141; _gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _gnapGridX, 336 - _gnapGridY); _gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); @@ -125,9 +125,9 @@ void GnapEngine::scene04_run() { invAdd(kItemKeys); setFlag(kGFKeysTaken); clearFlag(kGFPlatyPussDisguised); - _beaverSequenceId = 0x20C; - _beaverSequenceDatNum = 0; - _beaverFacing = kDirBottomRight; + _platypusSequenceId = 0x20C; + _platypusSequenceDatNum = 0; + _platypusFacing = kDirBottomRight; _gnapSequenceId = 0x7B5; _gnapSequenceDatNum = 1; _gameSys->waitForUpdate(); @@ -136,19 +136,19 @@ void GnapEngine::scene04_run() { if (_prevSceneNum == 2) { initGnapPos(5, 11, kDirUpRight); if (isFlag(kGFPlatypus)) - initBeaverPos(6, 11, kDirUpLeft); + initPlatypusPos(6, 11, kDirUpLeft); endSceneInit(); if (isFlag(kGFPlatypus)) platypusWalkTo(5, 8, -1, 0x107C2, 1); gnapWalkTo(6, 9, -1, 0x107BA, 1); } else if (_prevSceneNum == 38) { initGnapPos(5, 7, kDirBottomRight); - initBeaverPos(4, 7, kDirNone); + initPlatypusPos(4, 7, kDirNone); endSceneInit(); } else { initGnapPos(12, 9, kDirBottomRight); if (isFlag(kGFPlatypus)) - initBeaverPos(12, 8, kDirNone); + initPlatypusPos(12, 8, kDirNone); endSceneInit(); if (isFlag(kGFPlatypus)) platypusWalkTo(9, 8, -1, 0x107C2, 1); @@ -197,7 +197,7 @@ void GnapEngine::scene04_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -398,8 +398,8 @@ void GnapEngine::scene04_run() { playSound(0x1091C, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && isFlag(kGFPlatypus)) - beaverSub426234(); + if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) + platypusSub426234(); if (_gnapActionStatus < 0) updateGnapIdleSequence2(); if (!_timers[5]) { diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index 4a60292808..405bd2aba3 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -98,7 +98,7 @@ void GnapEngine::scene05_run() { if (_prevSceneNum != 6 && _prevSceneNum != 36) { initGnapPos(-1, 8, kDirBottomRight); if (isFlag(kGFPlatypus)) - initBeaverPos(-1, 9, kDirNone); + initPlatypusPos(-1, 9, kDirNone); endSceneInit(); if (isFlag(kGFPlatypus)) platypusWalkTo(2, 8, -1, 0x107C2, 1); @@ -106,7 +106,7 @@ void GnapEngine::scene05_run() { } else { initGnapPos(6, 8, kDirBottomRight); if (isFlag(kGFPlatypus)) - initBeaverPos(7, 9, kDirNone); + initPlatypusPos(7, 9, kDirNone); endSceneInit(); } @@ -148,7 +148,7 @@ void GnapEngine::scene05_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -159,7 +159,7 @@ void GnapEngine::scene05_run() { break; case kHSHaystack: - if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { if (_grabCursorSpriteIndex >= 0) { playGnapShowCurrItem(_hotspotsWalkPos[1].x - 2, _hotspotsWalkPos[1].y, 4, 5); } else if (isFlag(kGFNeedleTaken)) { @@ -175,10 +175,10 @@ void GnapEngine::scene05_run() { break; case PLAT_CURSOR: if (isFlag(kGFPlatypus)) { - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); if (platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { - _beaverActionStatus = kASPlatSearchHaystack; - _beaverFacing = kDirUnk4; + _platypusActionStatus = kASPlatSearchHaystack; + _platypusFacing = kDirUnk4; } if (_gnapX == 4 && (_gnapY == 8 || _gnapY == 7)) gnapWalkStep(); @@ -321,7 +321,7 @@ void GnapEngine::scene05_run() { if (!_isLeavingScene) { if (isFlag(kGFPlatypus)) - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[5]) { _timers[5] = getRandom(20) + 30; @@ -417,28 +417,28 @@ void GnapEngine::scene05_updateAnimations() { } if (_gameSys->getAnimationStatus(1) == 2) { - if (_beaverSequenceId == 0x146) { + if (_platypusSequenceId == 0x146) { _platX = 4; _platY = 8; _gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _platGridX, 384 - _platGridY); - _beaverSequenceId = 0x7C1; - _beaverSequenceDatNum = 1; - _beaverId = 20 * _platY; + _platypusSequenceId = 0x7C1; + _platypusSequenceDatNum = 1; + _platypusId = 20 * _platY; invAdd(kItemNeedle); setFlag(kGFNeedleTaken); setGrabCursorSprite(kItemNeedle); showCursor(); _timers[1] = 30; - _beaverActionStatus = -1; + _platypusActionStatus = -1; } - if (_beaverActionStatus == kASPlatSearchHaystack) { + if (_platypusActionStatus == kASPlatSearchHaystack) { _gameSys->setAnimation(0, 0, 1); - _gameSys->insertSequence(0x145, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x146, 256, 0x145, _beaverId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x145, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x146, 256, 0x145, _platypusId, kSeqSyncWait, 0, 0, 0); hideCursor(); setGrabCursorSprite(-1); - _beaverSequenceId = 0x146; - _beaverSequenceDatNum = 0; + _platypusSequenceId = 0x146; + _platypusSequenceDatNum = 0; _gameSys->setAnimation(0x146, 256, 1); _timers[1] = 300; } diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index cbe4fb44e1..a07c218f00 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -107,7 +107,7 @@ void GnapEngine::scene06_run() { queueInsertDeviceIcon(); initGnapPos(5, 12, kDirBottomRight); - initBeaverPos(6, 12, kDirNone); + initPlatypusPos(6, 12, kDirNone); endSceneInit(); platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -151,7 +151,7 @@ void GnapEngine::scene06_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -230,7 +230,7 @@ void GnapEngine::scene06_run() { _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; _gnapIdleFacing = kDirUpLeft; platypusWalkTo(6, 8, 1, 0x107C2, 1); - _beaverFacing = kDirNone; + _platypusFacing = kDirNone; _gnapActionStatus = kASUseTwigOnHorse; setGrabCursorSprite(-1); } else if (_grabCursorSpriteIndex >= 0) { @@ -294,13 +294,13 @@ void GnapEngine::scene06_run() { scene06_updateAnimations(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(40) + 25; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s06_nextHorseSequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s06_nextHorseSequenceId == -1) { if (_s06_horseTurnedBack) { _s06_nextHorseSequenceId = 0xF5; } else { @@ -379,18 +379,18 @@ void GnapEngine::scene06_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - if (_beaverSequenceId == 0xFA) { + if (_platypusSequenceId == 0xFA) { _gameSys->setAnimation(0, 0, 1); invAdd(kItemGas); setFlag(kGFGasTaken); _hotspots[kHSLadder]._flags = SF_DISABLED; setGrabCursorSprite(kItemGas); - _beaverActionStatus = -1; + _platypusActionStatus = -1; _platX = 6; _platY = 8; - _gameSys->insertSequence(0x107C1, _beaverId, 0, 0, kSeqNone, 0, 450 - _platGridX, 384 - _platGridY); - _beaverSequenceId = 0x7C1; - _beaverSequenceDatNum = 1; + _gameSys->insertSequence(0x107C1, _platypusId, 0, 0, kSeqNone, 0, 450 - _platGridX, 384 - _platGridY); + _platypusSequenceId = 0x7C1; + _platypusSequenceDatNum = 1; setFlag(kGFUnk04); _gnapActionStatus = -1; showCursor(); @@ -398,7 +398,7 @@ void GnapEngine::scene06_updateAnimations() { if (_s06_nextPlatSequenceId == 0xFB) { _gameSys->setAnimation(0, 0, 1); _s06_nextHorseSequenceId = 0xF2; - _beaverActionStatus = 6; + _platypusActionStatus = 6; } } @@ -411,10 +411,10 @@ void GnapEngine::scene06_updateAnimations() { _gameSys->insertSequence(0xF2, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0x100, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xFB, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xFA, 256, 0xFB, _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceId = 0xFA; - _beaverSequenceDatNum = 0; + _gameSys->insertSequence(0xFB, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0xFA, 256, 0xFB, _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceId = 0xFA; + _platypusSequenceDatNum = 0; _gameSys->insertSequence(0x107B7, _gnapId, 0x100, _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = 0x7B7; diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index d240378eca..3d392d6b74 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -72,7 +72,7 @@ void GnapEngine::scene07_run() { if (_prevSceneNum == 8) { initGnapPos(7, 7, kDirBottomLeft); - initBeaverPos(9, 7, kDirUnk4); + initPlatypusPos(9, 7, kDirUnk4); endSceneInit(); } else { _gnapX = 6; @@ -86,10 +86,10 @@ void GnapEngine::scene07_run() { _gnapActionStatus = kASWait; _platX = 3; _platY = 8; - _beaverId = 160; - _beaverSequenceId = 0x91; - _beaverSequenceDatNum = 0; - _beaverFacing = kDirNone; + _platypusId = 160; + _platypusSequenceId = 0x91; + _platypusSequenceDatNum = 0; + _platypusFacing = kDirNone; _gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); } @@ -123,7 +123,7 @@ void GnapEngine::scene07_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -197,38 +197,38 @@ void GnapEngine::scene07_run() { if (!_isLeavingScene) { updateGnapIdleSequence(); - if (_beaverActionStatus < 0 && _gnapActionStatus < 0) { + if (_platypusActionStatus < 0 && _gnapActionStatus < 0) { if (_timers[0]) { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; int _gnapRandomValue = getRandom(20); // TODO Cleanup - if (_beaverFacing != kDirNone) { - if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7CA) { - if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7CA) { + if (_platypusFacing != kDirNone) { + if (_gnapRandomValue != 0 || _platypusSequenceId != 0x7CA) { + if (_gnapRandomValue != 1 || _platypusSequenceId != 0x7CA) { if (_platY == 9) - playBeaverSequence(0x107CA); + playPlatypusSequence(0x107CA); } else { - playBeaverSequence(0x10845); + playPlatypusSequence(0x10845); } } else { - playBeaverSequence(0x107CC); + playPlatypusSequence(0x107CC); } - } else if (_gnapRandomValue != 0 || _beaverSequenceId != 0x7C9) { - if (_gnapRandomValue != 1 || _beaverSequenceId != 0x7C9) { + } else if (_gnapRandomValue != 0 || _platypusSequenceId != 0x7C9) { + if (_gnapRandomValue != 1 || _platypusSequenceId != 0x7C9) { if (_platY == 9) - playBeaverSequence(0x107C9); + playPlatypusSequence(0x107C9); } else { - playBeaverSequence(0x10844); + playPlatypusSequence(0x10844); } } else { - playBeaverSequence(0x107CB); + playPlatypusSequence(0x107CB); } - _gameSys->setAnimation(_beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, 1); + _gameSys->setAnimation(_platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, 1); } } else { _timers[0] = getRandom(75) + 75; - beaverMakeRoom(); + platypusMakeRoom(); } } else { _timers[0] = 100; diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index ed67669d5d..f31c05d0c3 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -117,7 +117,7 @@ void GnapEngine::scene08_run() { _gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); initGnapPos(-1, 8, kDirBottomRight); - initBeaverPos(-1, 7, kDirNone); + initPlatypusPos(-1, 7, kDirNone); endSceneInit(); @@ -167,7 +167,7 @@ void GnapEngine::scene08_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -215,10 +215,10 @@ void GnapEngine::scene08_run() { break; case PLAT_CURSOR: gnapActionIdle(0x14D); - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(6, 6, 1, 0x107C2, 1); - _beaverActionStatus = kASPlatWithMan; - _beaverFacing = kDirNone; + _platypusActionStatus = kASPlatWithMan; + _platypusFacing = kDirNone; playGnapIdle(6, 6); break; } @@ -251,10 +251,10 @@ void GnapEngine::scene08_run() { case PLAT_CURSOR: setFlag(kGFSceneFlag1); gnapActionIdle(0x14D); - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(3, 7, 1, 0x107C2, 1); - _beaverActionStatus = kASPlatWithDog; - _beaverFacing = kDirNone; + _platypusActionStatus = kASPlatWithDog; + _platypusFacing = kDirNone; playGnapIdle(3, 7); break; } @@ -358,11 +358,11 @@ void GnapEngine::scene08_run() { scene08_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(50) + 125; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s08_nextManSequenceId == -1 && + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s08_nextManSequenceId == -1 && (_s08_currDogSequenceId == 0x134 || _s08_currDogSequenceId == 0x135)) { int _gnapRandomValue = getRandom(4); switch (_gnapRandomValue) { @@ -438,13 +438,13 @@ void GnapEngine::scene08_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - switch (_beaverActionStatus) { + switch (_platypusActionStatus) { case kASPlatWithDog: _s08_nextDogSequenceId = 0x147; break; case kASPlatWithMan: _s08_nextManSequenceId = 0x140; - _beaverActionStatus = -1; + _platypusActionStatus = -1; break; } } @@ -458,7 +458,7 @@ void GnapEngine::scene08_updateAnimations() { if (_gameSys->getAnimationStatus(3) == 2) { if (_s08_currDogSequenceId == 0x147) - _beaverActionStatus = -1; + _platypusActionStatus = -1; if (_s08_currDogSequenceId == 0x149 || _s08_currDogSequenceId == 0x14A || _s08_currDogSequenceId == 0x14B) { if (getRandom(2) != 0) _s08_nextManSequenceId = 0x13D; @@ -491,15 +491,15 @@ void GnapEngine::scene08_updateAnimations() { } else if (_s08_nextDogSequenceId == 0x147) { _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x148, 160, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x148, 160, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); _s08_currDogSequenceId = _s08_nextDogSequenceId; _s08_nextDogSequenceId = 0x134; _platX = 1; _platY = 8; - _beaverId = 160; - _beaverSequenceId = 0x148; - _beaverFacing = kDirUnk4; - _beaverSequenceDatNum = 0; + _platypusId = 160; + _platypusSequenceId = 0x148; + _platypusFacing = kDirUnk4; + _platypusSequenceDatNum = 0; if (_gnapX == 1 && _gnapY == 8) gnapWalkStep(); } else if (_s08_nextDogSequenceId != -1) { diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index cf1af00ca2..7d9a4a9576 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -68,13 +68,13 @@ void GnapEngine::scene09_run() { if (_prevSceneNum == 8) { initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(12, 7, kDirUnk4); + initPlatypusPos(12, 7, kDirUnk4); endSceneInit(); gnapWalkTo(9, 8, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { initGnapPos(4, 7, kDirBottomRight); - initBeaverPos(5, 7, kDirNone); + initPlatypusPos(5, 7, kDirNone); endSceneInit(); } @@ -115,7 +115,7 @@ void GnapEngine::scene09_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -128,7 +128,7 @@ void GnapEngine::scene09_run() { gnapWalkTo(4, 7, 0, 0x107BF, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(4, 8, -1, 0x107D2, 1); - _beaverFacing = kDirUnk4; + _platypusFacing = kDirUnk4; break; case kHSExitHouse: @@ -137,7 +137,7 @@ void GnapEngine::scene09_run() { gnapWalkTo(10, -1, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(10, -1, -1, 0x107CD, 1); - _beaverFacing = kDirUnk4; + _platypusFacing = kDirUnk4; break; case kHSTrash: @@ -178,7 +178,7 @@ void GnapEngine::scene09_run() { scene09_updateAnimations(); if (!_isLeavingScene && _gnapActionStatus != 1 && _gnapActionStatus != 2) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(150) + 100; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index 5650dd1d16..b750ea4ed4 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -85,13 +85,13 @@ void GnapEngine::scene10_run() { if (_prevSceneNum == 9) { initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(12, 7, kDirUnk4); + initPlatypusPos(12, 7, kDirUnk4); endSceneInit(); gnapWalkTo(9, 8, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { initGnapPos(-1, 7, kDirBottomRight); - initBeaverPos(-2, 8, kDirNone); + initPlatypusPos(-2, 8, kDirNone); endSceneInit(); gnapWalkTo(1, 7, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); @@ -135,7 +135,7 @@ void GnapEngine::scene10_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -183,7 +183,7 @@ void GnapEngine::scene10_run() { break; case PLAT_CURSOR: gnapActionIdle(0x10C); - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(4, 6, -1, -1, 1); gnapWalkTo(4, 8, 0, 0x107BB, 1); _gnapActionStatus = kASAnnoyCook; @@ -220,7 +220,7 @@ void GnapEngine::scene10_run() { playGnapMoan2(-1, -1); else { gnapActionIdle(0x10C); - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(3, 7, -1, -1, 1); gnapWalkTo(4, 8, 0, 0x107BB, 1); _gnapActionStatus = kASAnnoyCook; @@ -253,10 +253,10 @@ void GnapEngine::scene10_run() { invAdd(kItemTongs); setFlag(kGFMudTaken); gnapActionIdle(0x10C); - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(7, 6, 1, 0x107D2, 1); - _beaverActionStatus = kASPlatWithBox; - _beaverFacing = kDirUnk4; + _platypusActionStatus = kASPlatWithBox; + _platypusFacing = kDirUnk4; _largeSprite = _gameSys->createSurface(0xC3); playGnapIdle(7, 6); } @@ -321,7 +321,7 @@ void GnapEngine::scene10_run() { scene10_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(80) + 150; @@ -374,7 +374,7 @@ void GnapEngine::scene10_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - switch (_beaverActionStatus) { + switch (_platypusActionStatus) { case kASPlatWithBox: _s10_nextCookSequenceId = 0x109; break; @@ -389,16 +389,16 @@ void GnapEngine::scene10_updateAnimations() { _platY = 8; _gameSys->insertSequence(0x109, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0x107C9, 160, - _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, getSequenceTotalDuration(0x109) + getSequenceTotalDuration(0x10A) + getSequenceTotalDuration(0x10843), 75 * _platX - _platGridX, 48 * _platY - _platGridY); _gameSys->removeSequence(0x107, 100, true); _s10_currCookSequenceId = 0x109; _s10_nextCookSequenceId = 0x843; - _beaverSequenceId = 0x7C9; - _beaverId = 160; - _beaverFacing = kDirNone; - _beaverSequenceDatNum = 1; + _platypusSequenceId = 0x7C9; + _platypusId = 160; + _platypusFacing = kDirNone; + _platypusSequenceDatNum = 1; break; case 0x843: hideCursor(); @@ -416,8 +416,8 @@ void GnapEngine::scene10_updateAnimations() { delayTicksCursor(5); deleteSurface(&_largeSprite); setGrabCursorSprite(kItemTongs); - if (_beaverActionStatus == kASPlatWithBox) - _beaverActionStatus = -1; + if (_platypusActionStatus == kASPlatWithBox) + _platypusActionStatus = -1; if (_gnapX == 4 && _gnapY == 8) gnapWalkStep(); break; @@ -431,7 +431,7 @@ void GnapEngine::scene10_updateAnimations() { case 0x106: { // TODO: Refactor into a if + a switch int rnd = getRandom(7); - if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; else if (rnd == 0) _s10_nextCookSequenceId = 0x104; @@ -445,7 +445,7 @@ void GnapEngine::scene10_updateAnimations() { } break; case 0x103: - if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; else if (getRandom(7) == 0) _s10_nextCookSequenceId = 0x104; @@ -453,7 +453,7 @@ void GnapEngine::scene10_updateAnimations() { _s10_nextCookSequenceId = 0x106; break; case 0x104: - if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; else if (getRandom(7) == 0) _s10_nextCookSequenceId = 0x103; @@ -463,7 +463,7 @@ void GnapEngine::scene10_updateAnimations() { case 0x105: { // TODO: Refactor into a if + a switch int rnd = getRandom(7); - if (_gnapActionStatus >= 0 || _beaverActionStatus >= 0) + if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; else if (rnd == 0) _s10_nextCookSequenceId = 0x104; @@ -478,7 +478,7 @@ void GnapEngine::scene10_updateAnimations() { _gnapIdleFacing = kDirUpRight; _gnapSequenceDatNum = 0; _gnapActionStatus = -1; - _beaverActionStatus = -1; + _platypusActionStatus = -1; } break; } diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 68a261bf72..35a575cd27 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -94,22 +94,22 @@ void GnapEngine::scene11_run() { switch (_prevSceneNum) { case 13: initGnapPos(8, 5, kDirBottomLeft); - initBeaverPos(9, 6, kDirUnk4); + initPlatypusPos(9, 6, kDirUnk4); break; case 47: initGnapPos(8, 5, kDirBottomLeft); - initBeaverPos(9, 5, kDirUnk4); + initPlatypusPos(9, 5, kDirUnk4); _s11_currGoggleGuySequenceId = 0x1FA; _s11_currHookGuySequenceId = 0x1FF; _timers[7] = 180; break; case 12: initGnapPos(-1, 9, kDirBottomRight); - initBeaverPos(-2, 8, kDirNone); + initPlatypusPos(-2, 8, kDirNone); break; default: initGnapPos(6, 6, kDirBottomLeft); - initBeaverPos(6, 5, kDirUnk4); + initPlatypusPos(6, 5, kDirUnk4); break; } @@ -163,7 +163,7 @@ void GnapEngine::scene11_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -306,11 +306,11 @@ void GnapEngine::scene11_run() { _gameSys->setAnimation(0x207, 257, 4); _gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } - beaverSub426234(); + platypusSub426234(); updateGnapIdleSequence2(); if (!_timers[5]) { _timers[5] = getRandom(100) + 75; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) { if (getRandom(2)) _s11_nextGoggleGuySequenceId = 0x1F6; else @@ -319,7 +319,7 @@ void GnapEngine::scene11_run() { } if (!_timers[4]) { _timers[4] = getRandom(40) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s11_nextHookGuySequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s11_nextHookGuySequenceId == -1) { if (_s11_currHookGuySequenceId == 0x201) { switch (getRandom(7)) { case 0: diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index dcd62a36a6..a60e6a2dfa 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -112,11 +112,11 @@ void GnapEngine::scene12_run() { if (_prevSceneNum == 15) { initGnapPos(5, 6, kDirBottomRight); - initBeaverPos(3, 7, kDirNone); + initPlatypusPos(3, 7, kDirNone); endSceneInit(); } else { initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(12, 8, kDirUnk4); + initPlatypusPos(12, 8, kDirUnk4); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); @@ -152,7 +152,7 @@ void GnapEngine::scene12_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -200,10 +200,10 @@ void GnapEngine::scene12_run() { _gnapActionStatus = kASTalkToothGuy; break; case PLAT_CURSOR: - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(3, 7, 1, 0x107D2, 1); - _beaverActionStatus = kASPlatWithToothGuy; - _beaverFacing = kDirUnk4; + _platypusActionStatus = kASPlatWithToothGuy; + _platypusFacing = kDirUnk4; playGnapIdle(2, 7); break; } @@ -270,10 +270,10 @@ void GnapEngine::scene12_run() { _gnapActionStatus = kASTalkBeardGuy; break; case PLAT_CURSOR: - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(7, 6, 1, 0x107C2, 1); - _beaverActionStatus = kASPlatWithBeardGuy; - _beaverFacing = kDirNone; + _platypusActionStatus = kASPlatWithBeardGuy; + _platypusFacing = kDirNone; playGnapIdle(7, 6); break; } @@ -307,12 +307,12 @@ void GnapEngine::scene12_run() { scene12_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = 15; if (_s12_nextToothGuySequenceId == -1) { - if (v18 == 0 && _s12_currBeardGuySequenceId == 0x202 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (v18 == 0 && _s12_currBeardGuySequenceId == 0x202 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { if (getRandom(2) != 0) _s12_nextToothGuySequenceId = 0x1EC; else @@ -324,8 +324,8 @@ void GnapEngine::scene12_run() { } if (!_timers[5]) { _timers[5] = getRandom(30) + 20; - if (_s12_nextBarkeeperSequenceId == -1 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { - if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBeardGuySequenceId == 0x202 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (_s12_nextBarkeeperSequenceId == -1 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { + if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBeardGuySequenceId == 0x202 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { if (getRandom(2) != 0) _s12_nextBarkeeperSequenceId = 0x208; else @@ -337,8 +337,8 @@ void GnapEngine::scene12_run() { } if (!_timers[6]) { _timers[6] = getRandom(30) + 15; - if (_s12_nextBeardGuySequenceId == -1 && _gnapActionStatus < 0 && _beaverActionStatus < 0) { - if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _beaverActionStatus < 0) + if (_s12_nextBeardGuySequenceId == -1 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { + if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _platypusActionStatus < 0) _s12_nextBeardGuySequenceId = 0x1F2; else _s12_nextBeardGuySequenceId = 0x202; @@ -475,7 +475,7 @@ void GnapEngine::scene12_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - switch (_beaverActionStatus) { + switch (_platypusActionStatus) { case kASPlatWithToothGuy: _s12_nextToothGuySequenceId = 0x1EB; break; @@ -523,8 +523,8 @@ void GnapEngine::scene12_updateAnimations() { if (_gnapActionStatus >= kASTalkToothGuy && _gnapActionStatus <= kASQuarterToToothGuy && _s12_currToothGuySequenceId != 0x1E9 && _s12_currToothGuySequenceId != 0x1EC && _s12_currToothGuySequenceId != 0x200) _gnapActionStatus = -1; - if (_beaverActionStatus == kASPlatWithToothGuy) - _beaverActionStatus = -1; + if (_platypusActionStatus == kASPlatWithToothGuy) + _platypusActionStatus = -1; } } @@ -554,8 +554,8 @@ void GnapEngine::scene12_updateAnimations() { _timers[6] = getRandom(30) + 20; if (_gnapActionStatus >= kASTalkBeardGuy && _gnapActionStatus <= kASShowItemToBeardGuy && _s12_currBeardGuySequenceId != 0x202 && _s12_currBeardGuySequenceId != 0x1F2) _gnapActionStatus = -1; - if (_beaverActionStatus == kASPlatWithBeardGuy) - _beaverActionStatus = -1; + if (_platypusActionStatus == kASPlatWithBeardGuy) + _platypusActionStatus = -1; } } diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index cff04bba2f..007c3806b5 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -108,10 +108,10 @@ void GnapEngine::scene13_run() { if (_prevSceneNum == 14) { initGnapPos(6, 6, kDirBottomLeft); - initBeaverPos(9, 8, kDirNone); + initPlatypusPos(9, 8, kDirNone); } else { initGnapPos(3, 7, kDirBottomRight); - initBeaverPos(2, 7, kDirNone); + initPlatypusPos(2, 7, kDirNone); } endSceneInit(); @@ -153,7 +153,7 @@ void GnapEngine::scene13_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -316,7 +316,7 @@ void GnapEngine::scene13_run() { scene13_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); if (_platY == 5 || _platY == 6) platypusWalkTo(-1, 7, -1, -1, 1); if (_gnapActionStatus < 0) @@ -445,7 +445,7 @@ void GnapEngine::scene13_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - _beaverActionStatus = -1; + _platypusActionStatus = -1; } } diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index 37427bd34f..cf5945dde8 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -94,19 +94,19 @@ void GnapEngine::scene17_update() { void GnapEngine::scene17_platHangUpPhone() { int savedGnapActionStatus = _gnapActionStatus; - if (_beaverActionStatus == kASPlatPhoningAssistant) { + if (_platypusActionStatus == kASPlatPhoningAssistant) { _gnapActionStatus = kASPlatHangUpPhone; updateMouseCursor(); _s17_platPhoneCtr = 0; - _beaverActionStatus = -1; + _platypusActionStatus = -1; _gameSys->setAnimation(0x257, 254, 4); _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (_gameSys->getAnimationStatus(4) != 2) gameUpdateTick(); - _gameSys->setAnimation(0x25B, _beaverId, 1); - _gameSys->insertSequence(0x25B, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceId = 0x25B; - _beaverSequenceDatNum = 0; + _gameSys->setAnimation(0x25B, _platypusId, 1); + _gameSys->insertSequence(0x25B, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceId = 0x25B; + _platypusSequenceDatNum = 0; _s17_currPhoneSequenceId = -1; _s17_nextPhoneSequenceId = -1; clearFlag(kGFPlatypusTalkingToAssistant); @@ -177,7 +177,7 @@ void GnapEngine::scene17_run() { if (_prevSceneNum == 53 || _prevSceneNum == 18 || _prevSceneNum == 20 || _prevSceneNum == 19) { if (_prevSceneNum == 20) { initGnapPos(4, 6, kDirBottomRight); - initBeaverPos(5, 6, kDirNone); + initPlatypusPos(5, 6, kDirNone); endSceneInit(); platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); @@ -185,15 +185,15 @@ void GnapEngine::scene17_run() { initGnapPos(3, 9, kDirUpLeft); _platX = _hotspotsWalkPos[2].x; _platY = _hotspotsWalkPos[2].y; - _beaverId = 20 * _hotspotsWalkPos[2].y; + _platypusId = 20 * _hotspotsWalkPos[2].y; _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); - _beaverSequenceId = 0x25A; - _beaverSequenceDatNum = 0; + _platypusSequenceId = 0x25A; + _platypusSequenceDatNum = 0; endSceneInit(); clearFlag(kGFSpringTaken); clearFlag(kGFUnk16); - _beaverActionStatus = kASPlatPhoningAssistant; + _platypusActionStatus = kASPlatPhoningAssistant; scene17_platHangUpPhone(); _gameSys->setAnimation(0, 0, 4); clearFlag(kGFPlatypusTalkingToAssistant); @@ -202,7 +202,7 @@ void GnapEngine::scene17_run() { } else if (isFlag(kGFUnk25)) { clearFlag(kGFSpringTaken); clearFlag(kGFUnk16); - initBeaverPos(7, 9, kDirNone); + initPlatypusPos(7, 9, kDirNone); _gnapX = _hotspotsWalkPos[2].x; _gnapY = _hotspotsWalkPos[2].y; _gnapId = 20 * _hotspotsWalkPos[2].y; @@ -222,30 +222,30 @@ void GnapEngine::scene17_run() { initGnapPos(3, 9, kDirUpLeft); _platX = _hotspotsWalkPos[2].x; _platY = _hotspotsWalkPos[2].y; - _beaverId = 20 * _hotspotsWalkPos[2].y; + _platypusId = 20 * _hotspotsWalkPos[2].y; _s17_currPhoneSequenceId = 0x251; _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(_s17_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - _beaverSequenceId = 0x25A; - _beaverSequenceDatNum = 0; + _platypusSequenceId = 0x25A; + _platypusSequenceDatNum = 0; endSceneInit(); _gameSys->setAnimation(_s17_currPhoneSequenceId, 254, 1); - _beaverActionStatus = kASPlatPhoningAssistant; + _platypusActionStatus = kASPlatPhoningAssistant; scene17_updateHotspots(); } else if (_prevSceneNum == 18) { initGnapPos(6, 6, kDirBottomRight); - initBeaverPos(5, 6, kDirNone); + initPlatypusPos(5, 6, kDirNone); endSceneInit(); platypusWalkTo(5, 9, -1, 0x107C2, 1); gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { if (isFlag(kGFSpringTaken)) { initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, kDirBottomRight); - initBeaverPos(1, 9, kDirNone); + initPlatypusPos(1, 9, kDirNone); endSceneInit(); } else { initGnapPos(3, 7, kDirBottomRight); - initBeaverPos(1, 7, kDirNone); + initPlatypusPos(1, 7, kDirNone); endSceneInit(); } clearFlag(kGFSpringTaken); @@ -262,16 +262,16 @@ void GnapEngine::scene17_run() { _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0, 0, kSeqNone, 0, 0, 0); _platX = -1; _platY = 8; - _beaverId = 160; + _platypusId = 160; _gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x107C1, _beaverId, 0x241, _beaverId, + _gameSys->insertSequence(0x107C1, _platypusId, 0x241, _platypusId, kSeqScale | kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); endSceneInit(); - _beaverSequenceId = 0x7C1; - _beaverSequenceDatNum = 1; - _beaverFacing = kDirBottomRight; + _platypusSequenceId = 0x7C1; + _platypusSequenceDatNum = 1; + _platypusFacing = kDirBottomRight; platypusWalkTo(2, 9, -1, 0x107C2, 1); } @@ -298,10 +298,10 @@ void GnapEngine::scene17_run() { if (isFlag(kGFGrassTaken)) { gnapUseJointOnPlatypus(); } else { - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); gnapWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 0, 0x107BA, 1); - _beaverActionStatus = kASGetWrench1; + _platypusActionStatus = kASGetWrench1; _gnapActionStatus = kASGetWrench1; _timers[5] = getRandom(30) + 80; setGrabCursorSprite(-1); @@ -317,7 +317,7 @@ void GnapEngine::scene17_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -345,9 +345,9 @@ void GnapEngine::scene17_run() { case PLAT_CURSOR: if (_s17_canTryGetWrench) { scene17_platHangUpPhone(); - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); - _beaverActionStatus = kASTryGetWrench; + _platypusActionStatus = kASTryGetWrench; _gnapActionStatus = kASTryGetWrench; _timers[5] = getRandom(30) + 80; } else @@ -385,11 +385,11 @@ void GnapEngine::scene17_run() { if (isFlag(kGFUnk18)) { scene17_platHangUpPhone(); _isLeavingScene = true; - gnapUseDeviceOnBeaver(); - _beaverFacing = kDirUpLeft; + gnapUseDeviceOnPlatypuss(); + _platypusFacing = kDirUpLeft; platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); setFlag(kGFUnk16); - _beaverActionStatus = kASPlatUsePhone; + _platypusActionStatus = kASPlatUsePhone; _gnapActionStatus = kASPlatUsePhone; } else playGnapImpossible(0, 0); @@ -429,11 +429,11 @@ void GnapEngine::scene17_run() { if (isFlag(kGFUnk18)) { scene17_platHangUpPhone(); _isLeavingScene = true; - gnapUseDeviceOnBeaver(); - _beaverFacing = kDirUpLeft; + gnapUseDeviceOnPlatypuss(); + _platypusFacing = kDirUpLeft; platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); setFlag(kGFUnk16); - _beaverActionStatus = kASPlatUsePhone; + _platypusActionStatus = kASPlatUsePhone; _gnapActionStatus = kASPlatUsePhone; } else playGnapImpossible(0, 0); @@ -450,7 +450,7 @@ void GnapEngine::scene17_run() { _gnapIdleFacing = kDirUpRight; gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107BB, 1); _gnapActionStatus = kASLeaveScene; - if (_beaverActionStatus != kASPlatPhoningAssistant) + if (_platypusActionStatus != kASPlatPhoningAssistant) platypusWalkTo(_hotspotsWalkPos[5].x - 1, _hotspotsWalkPos[5].y, -1, 0x107C2, 1); } break; @@ -488,17 +488,17 @@ void GnapEngine::scene17_run() { playSound(0x10940, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) - beaverSub426234(); + if (_platypusActionStatus < 0) + platypusSub426234(); updateGnapIdleSequence2(); if (!_timers[4]) { _timers[4] = getRandom(100) + 200; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0) + if (_gnapActionStatus < 0 && _platypusActionStatus < 0) _gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } if (!_timers[7]) { _timers[7] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { switch (getRandom(3)) { case 0: _gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -512,7 +512,7 @@ void GnapEngine::scene17_run() { } } } - if (_beaverActionStatus < 0 && !_timers[5]) { + if (_platypusActionStatus < 0 && !_timers[5]) { _timers[5] = getRandom(30) + 80; if (isFlag(kGFGrassTaken) && _s17_nextWrenchSequenceId == -1) { _s17_nextWrenchSequenceId = 0x236; @@ -643,9 +643,9 @@ void GnapEngine::scene17_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - switch (_beaverActionStatus) { + switch (_platypusActionStatus) { case kASTryGetWrench: - _beaverActionStatus = -1; + _platypusActionStatus = -1; ++_s17_platTryGetWrenchCtr; if (_s17_platTryGetWrenchCtr % 2 != 0) _s17_nextWrenchSequenceId = 0x233; @@ -660,16 +660,16 @@ void GnapEngine::scene17_updateAnimations() { _s17_nextCarWindowSequenceId = 0x249; break; case kASGetWrenchDone: - _beaverActionStatus = -1; + _platypusActionStatus = -1; invAdd(kItemWrench); setGrabCursorSprite(kItemWrench); break; case kASPlatUsePhone: - _gameSys->setAnimation(0x24E, _beaverId, 1); - _gameSys->insertSequence(0x24E, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceDatNum = 0; - _beaverSequenceId = 0x24E; - _beaverActionStatus = kASLeaveScene; + _gameSys->setAnimation(0x24E, _platypusId, 1); + _gameSys->insertSequence(0x24E, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceDatNum = 0; + _platypusSequenceId = 0x24E; + _platypusActionStatus = kASLeaveScene; _newSceneNum = 53; break; case kASPlatPhoningAssistant: @@ -678,10 +678,10 @@ void GnapEngine::scene17_updateAnimations() { _s17_platPhoneCtr = 0; _s17_nextPhoneSequenceId = -1; _s17_currPhoneSequenceId = -1; - _gameSys->insertSequence(0x25B, _beaverId, 0x25A, _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceDatNum = 0; - _beaverSequenceId = 0x25B; - _beaverActionStatus = -1; + _gameSys->insertSequence(0x25B, _platypusId, 0x25A, _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceDatNum = 0; + _platypusSequenceId = 0x25B; + _platypusActionStatus = -1; clearFlag(kGFPlatypusTalkingToAssistant); _sceneWaiting = false; scene17_updateHotspots(); @@ -689,9 +689,9 @@ void GnapEngine::scene17_updateAnimations() { _s17_nextPhoneSequenceId = kPlatPhoneSequenceIds[_s17_platPhoneCtr]; _gameSys->setAnimation(_s17_nextPhoneSequenceId, 254, 1); _gameSys->insertSequence(_s17_nextPhoneSequenceId, 254, _s17_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x25A, _beaverId, 0x25A, _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceDatNum = 0; - _beaverSequenceId = 0x25A; + _gameSys->insertSequence(0x25A, _platypusId, 0x25A, _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceDatNum = 0; + _platypusSequenceId = 0x25A; _s17_currPhoneSequenceId = _s17_nextPhoneSequenceId; } break; @@ -705,27 +705,27 @@ void GnapEngine::scene17_updateAnimations() { switch (_s17_nextWrenchSequenceId) { case 0x233: _gnapActionStatus = -1; - _gameSys->insertSequence(0x243, _beaverId, - _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + _gameSys->insertSequence(0x243, _platypusId, + _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; - _beaverSequenceId = 0x243; - _beaverSequenceDatNum = 0; - _gameSys->setAnimation(0x243, _beaverId, 1); + _platypusSequenceId = 0x243; + _platypusSequenceDatNum = 0; + _gameSys->setAnimation(0x243, _platypusId, 1); break; case 0x234: _gnapActionStatus = -1; - _gameSys->insertSequence(0x242, _beaverId, - _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + _gameSys->insertSequence(0x242, _platypusId, + _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; - _beaverSequenceId = 0x242; - _beaverSequenceDatNum = 0; - _gameSys->setAnimation(0x242, _beaverId, 1); + _platypusSequenceId = 0x242; + _platypusSequenceDatNum = 0; + _gameSys->setAnimation(0x242, _platypusId, 1); break; case 0x231: if (getRandom(2) != 0) @@ -758,17 +758,17 @@ void GnapEngine::scene17_updateAnimations() { _s17_currWrenchSequenceId = 0x22E; _s17_canTryGetWrench = false; } - _gameSys->setAnimation(0x23F, _beaverId, 1); + _gameSys->setAnimation(0x23F, _platypusId, 1); _gameSys->insertSequence(0x10875, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x23F, _beaverId, - _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, + _gameSys->insertSequence(0x23F, _platypusId, + _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); _gnapSequenceDatNum = 1; - _beaverSequenceDatNum = 0; + _platypusSequenceDatNum = 0; _gnapSequenceId = 0x875; - _beaverSequenceId = 0x23F; + _platypusSequenceId = 0x23F; gnapWalkTo(3, 8, -1, 0x107B9, 1); - _beaverActionStatus = kASGetWrench2; + _platypusActionStatus = kASGetWrench2; } break; default: @@ -806,15 +806,15 @@ void GnapEngine::scene17_updateAnimations() { break; case 0x249: _gameSys->setAnimation(0x230, 40, 2); - _gameSys->setAnimation(0x240, _beaverId, 1); + _gameSys->setAnimation(0x240, _platypusId, 1); _gameSys->insertSequence(0x230, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x240, _beaverId, _beaverSequenceId, _beaverId, kSeqSyncWait, 0, 0, 0); + _gameSys->insertSequence(0x240, _platypusId, _platypusSequenceId, _platypusId, kSeqSyncWait, 0, 0, 0); _gameSys->insertSequence(0x23E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x23E; _gnapSequenceDatNum = 0; - _beaverSequenceId = 0x240; - _beaverSequenceDatNum = 0; + _platypusSequenceId = 0x240; + _platypusSequenceDatNum = 0; _gameSys->setAnimation(0x24A, 40, 3); _gameSys->insertSequence(0x24A, 40, _s17_nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); while (_gameSys->getAnimationStatus(2) != 2) { @@ -833,7 +833,7 @@ void GnapEngine::scene17_updateAnimations() { _s17_nextWrenchSequenceId = -1; setFlag(kGFGrassTaken); _gnapActionStatus = -1; - _beaverActionStatus = 2; + _platypusActionStatus = 2; scene17_updateHotspots(); _timers[5] = getRandom(30) + 80; break; diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index d1683b6380..0e8065cc33 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -168,9 +168,9 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, if (_gnapY == _platY) { if (v12 >= _gnapX) { if (v12 >= _platX && _gnapX <= _platX) - beaverMakeRoom(); + platypusMakeRoom(); } else if (v12 <= _platX && _gnapX >= _platX) { - beaverMakeRoom(); + platypusMakeRoom(); } } gnapSeqId = _gnapSequenceId; @@ -261,7 +261,7 @@ void GnapEngine::scene18_platEndPhoning(bool platFl) { if (isFlag(kGFPlatypusTalkingToAssistant)) { _s18_platPhoneIter = 0; _s18_platPhoneCtr = 0; - _beaverActionStatus = -1; + _platypusActionStatus = -1; if (_s18_currPhoneSequenceId != -1) { _gameSys->setAnimation(0x21E, 254, 3); _gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); @@ -272,7 +272,7 @@ void GnapEngine::scene18_platEndPhoning(bool platFl) { _gameSys->setAnimation(0, 0, 3); clearFlag(kGFPlatypusTalkingToAssistant); if (platFl) { - _beaverActionStatus = kASPlatComesHere; + _platypusActionStatus = kASPlatComesHere; _timers[6] = 50; _sceneWaiting = true; } @@ -378,19 +378,19 @@ void GnapEngine::scene18_run() { } if (_prevSceneNum == 17) { initGnapPos(4, 11, kDirBottomRight); - initBeaverPos(5, 11, kDirNone); + initPlatypusPos(5, 11, kDirNone); endSceneInit(); gnapWalkTo(4, 8, -1, 0x107B9, 1); platypusWalkTo(5, 9, -1, 0x107C2, 1); } else if (_prevSceneNum == 19) { initGnapPos(7, 7, kDirBottomRight); - initBeaverPos(8, 7, kDirNone); + initPlatypusPos(8, 7, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { initGnapPos(-1, 10, kDirBottomRight); - initBeaverPos(-1, 10, kDirNone); + initPlatypusPos(-1, 10, kDirNone); endSceneInit(); gnapWalkTo(3, 7, -1, 0x107B9, 1); platypusWalkTo(3, 8, -1, 0x107C2, 1); @@ -435,7 +435,7 @@ void GnapEngine::scene18_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -726,18 +726,18 @@ void GnapEngine::scene18_run() { if (!_isLeavingScene) { if (!isFlag(kGFPlatypusTalkingToAssistant)) { - if (_beaverActionStatus == kASPlatComesHere) { + if (_platypusActionStatus == kASPlatComesHere) { if (!_timers[6]) { - _beaverActionStatus = -1; + _platypusActionStatus = -1; _sceneWaiting = false; - initBeaverPos(-1, 10, kDirNone); + initPlatypusPos(-1, 10, kDirNone); platypusWalkTo(3, 9, -1, 0x107C2, 1); clearFlag(kGFPlatypusTalkingToAssistant); } } else { _hotspots[kHSWalkArea1]._y2 += 48; _hotspots[kHSWalkArea2]._x1 += 75; - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); _hotspots[kHSWalkArea2]._x1 -= 75; _hotspots[kHSWalkArea1]._y2 -= 48; } diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index fd8b421331..4de51f8ca4 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -127,7 +127,7 @@ void GnapEngine::scene19_run() { _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _timers[6] = getRandom(40) + 50; initGnapPos(3, 6, kDirBottomRight); - initBeaverPos(4, 6, kDirNone); + initPlatypusPos(4, 6, kDirNone); endSceneInit(); gnapWalkTo(4, 9, -1, 0x107B9, 1); platypusWalkTo(5, 9, -1, 0x107C2, 1); @@ -168,7 +168,7 @@ void GnapEngine::scene19_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -311,7 +311,7 @@ void GnapEngine::scene19_run() { if (!_isLeavingScene) { updateGnapIdleSequence(); if (!isFlag(kGFPlatypusTalkingToAssistant)) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); if (!_timers[6] && _s19_nextShopAssistantSequenceId == -1) { _timers[6] = getRandom(40) + 50; if (getRandom(4) != 0) { diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 9298fc1f62..7982b076ec 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -229,42 +229,42 @@ void GnapEngine::scene20_run() { gameUpdateTick(); } initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(11, 9, kDirUnk4); + initPlatypusPos(11, 9, kDirUnk4); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); } else { switch (_prevSceneNum) { case 17: initGnapPos(5, 11, kDirBottomRight); - initBeaverPos(6, 11, kDirNone); + initPlatypusPos(6, 11, kDirNone); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107B9, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 18: initGnapPos(11, 8, kDirBottomLeft); - initBeaverPos(11, 9, kDirUnk4); + initPlatypusPos(11, 9, kDirUnk4); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 21: initGnapPos(-1, 8, kDirBottomLeft); - initBeaverPos(-1, 9, kDirUnk4); + initPlatypusPos(-1, 9, kDirUnk4); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107B9, 1); platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 22: initGnapPos(7, 6, kDirBottomRight); - initBeaverPos(8, 6, kDirNone); + initPlatypusPos(8, 6, kDirNone); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107B9, 1); platypusWalkTo(9, 9, -1, 0x107C2, 1); break; default: initGnapPos(8, 6, kDirBottomLeft); - initBeaverPos(9, 6, kDirUnk4); + initPlatypusPos(9, 6, kDirUnk4); endSceneInit(); _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(8, 8, -1, 0x107BA, 1); @@ -310,7 +310,7 @@ void GnapEngine::scene20_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -329,7 +329,7 @@ void GnapEngine::scene20_run() { gnapWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); - _beaverFacing = kDirUnk4; + _platypusFacing = kDirUnk4; } break; @@ -368,7 +368,7 @@ void GnapEngine::scene20_run() { gnapWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x, _hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); - _beaverFacing = kDirUnk4; + _platypusFacing = kDirUnk4; } break; @@ -493,9 +493,9 @@ void GnapEngine::scene20_run() { playSound(0x10940, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) { + if (_platypusActionStatus < 0) { _hotspots[kHSWalkArea1]._y2 += 48; - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); _hotspots[kHSWalkArea1]._y2 -= 48; } if (_gnapActionStatus < 0) @@ -509,7 +509,7 @@ void GnapEngine::scene20_run() { } if (!_timers[7]) { _timers[7] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { switch (getRandom(3)) { case 0: _gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index 9d2b1719a8..b04c8c92b5 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -77,7 +77,7 @@ void GnapEngine::scene21_run() { if (isFlag(kGFTwigTaken)) { if (isFlag(kGFKeysTaken)) { initGnapPos(5, 8, kDirBottomRight); - initBeaverPos(6, 8, kDirNone); + initPlatypusPos(6, 8, kDirNone); _gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!isFlag(kGFUnk04)) _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); @@ -85,7 +85,7 @@ void GnapEngine::scene21_run() { clearFlag(kGFKeysTaken); } else { initGnapPos(5, 11, kDirBottomRight); - initBeaverPos(6, 11, kDirNone); + initPlatypusPos(6, 11, kDirNone); if (!isFlag(kGFUnk04)) _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); @@ -94,7 +94,7 @@ void GnapEngine::scene21_run() { } } else { initGnapPos(5, 11, kDirBottomRight); - initBeaverPos(6, 11, kDirNone); + initPlatypusPos(6, 11, kDirNone); _s21_currOldLadySequenceId = 0x89; _gameSys->setAnimation(0x89, 79, 3); _gameSys->insertSequence(_s21_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); @@ -138,7 +138,7 @@ void GnapEngine::scene21_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -234,7 +234,7 @@ void GnapEngine::scene21_run() { playSound(0x10940, true); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!isFlag(kGFTwigTaken) && !_timers[4] && _s21_nextOldLadySequenceId == -1 && _gnapActionStatus == -1) { _timers[4] = getRandom(30) + 50; diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index 3a196dacd5..80f3843f30 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -72,11 +72,11 @@ void GnapEngine::scene22_run() { if (_prevSceneNum == 20) { initGnapPos(2, 8, kDirBottomRight); - initBeaverPos(1, 8, kDirNone); + initPlatypusPos(1, 8, kDirNone); endSceneInit(); } else { initGnapPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y, kDirBottomRight); - initBeaverPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, kDirNone); + initPlatypusPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, kDirNone); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107B9, 1); platypusWalkTo(9, 8, -1, 0x107C2, 1); @@ -150,7 +150,7 @@ void GnapEngine::scene22_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -199,7 +199,7 @@ void GnapEngine::scene22_run() { _gnapActionStatus = kASTalkCashier; break; case PLAT_CURSOR: - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); break; } } @@ -223,7 +223,7 @@ void GnapEngine::scene22_run() { scene22_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[6] && _s22_nextCashierSequenceId == -1) { _timers[6] = getRandom(30) + 20; diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index 70437eb6c7..a6b4c1fd80 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -70,7 +70,7 @@ void GnapEngine::scene23_run() { queueInsertDeviceIcon(); initGnapPos(-1, 7, kDirBottomRight); - initBeaverPos(-2, 7, kDirNone); + initPlatypusPos(-2, 7, kDirNone); _gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); _gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); endSceneInit(); @@ -122,7 +122,7 @@ void GnapEngine::scene23_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -196,7 +196,7 @@ void GnapEngine::scene23_run() { scene23_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4] && _gnapActionStatus == -1) { _timers[4] = getRandom(100) + 200; diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp index 1c67c50de0..e244a0d325 100644 --- a/engines/gnap/scenes/scene24.cpp +++ b/engines/gnap/scenes/scene24.cpp @@ -85,13 +85,13 @@ void GnapEngine::scene24_run() { if (_prevSceneNum == 20) { initGnapPos(1, 8, kDirBottomRight); - initBeaverPos(2, 8, kDirNone); + initPlatypusPos(2, 8, kDirNone); endSceneInit(); gnapWalkTo(1, 9, -1, 0x107B9, 1); platypusWalkTo(2, 9, -1, 0x107C2, 1); } else { initGnapPos(8, 8, kDirBottomLeft); - initBeaverPos(8, 8, kDirUnk4); + initPlatypusPos(8, 8, kDirUnk4); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107BA, 1); platypusWalkTo(3, 8, -1, 0x107C2, 1); @@ -132,7 +132,7 @@ void GnapEngine::scene24_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -185,7 +185,7 @@ void GnapEngine::scene24_run() { playSound(0x10940, true); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 50; diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index 427536be1d..fe6c7d85ca 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -121,13 +121,13 @@ void GnapEngine::scene25_run() { if (_prevSceneNum == 24) { initGnapPos(5, 11, kDirUpLeft); - initBeaverPos(6, 11, kDirUnk4); + initPlatypusPos(6, 11, kDirUnk4); endSceneInit(); gnapWalkTo(5, 7, -1, 0x107BA, 1); platypusWalkTo(6, 7, -1, 0x107C2, 1); } else { initGnapPos(5, 6, kDirBottomRight); - initBeaverPos(6, 6, kDirNone); + initPlatypusPos(6, 6, kDirNone); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107B9, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -166,7 +166,7 @@ void GnapEngine::scene25_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -284,7 +284,7 @@ void GnapEngine::scene25_run() { scene25_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _gnapActionStatus == -1) { _timers[4] = getRandom(20) + 20; diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index f2ced59d2d..b446fbb337 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -82,13 +82,13 @@ void GnapEngine::scene26_run() { if (_prevSceneNum == 25) { initGnapPos(-1, 8, kDirBottomRight); - initBeaverPos(-2, 8, kDirNone); + initPlatypusPos(-2, 8, kDirNone); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); } else { initGnapPos(2, 8, kDirBottomRight); - initBeaverPos(3, 8, kDirNone); + initPlatypusPos(3, 8, kDirNone); endSceneInit(); } @@ -125,7 +125,7 @@ void GnapEngine::scene26_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -201,7 +201,7 @@ void GnapEngine::scene26_run() { playSound(0x1093B, true); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[5] && _s26_nextKidSequenceId == -1) { _timers[5] = getRandom(20) + 50; diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index ad25092620..2c5a8f1174 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -93,28 +93,28 @@ void GnapEngine::scene27_run() { switch (_prevSceneNum) { case 26: initGnapPos(7, 12, kDirBottomRight); - initBeaverPos(6, 12, kDirNone); + initPlatypusPos(6, 12, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); break; case 29: initGnapPos(-1, 8, kDirBottomRight); - initBeaverPos(-1, 9, kDirNone); + initPlatypusPos(-1, 9, kDirNone); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107B9, 1); platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 31: initGnapPos(12, 8, kDirBottomLeft); - initBeaverPos(12, 9, kDirUnk4); + initPlatypusPos(12, 9, kDirUnk4); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(8, 9, -1, 0x107C2, 1); break; default: initGnapPos(6, 8, kDirBottomRight); - initBeaverPos(5, 9, kDirNone); + initPlatypusPos(5, 9, kDirNone); endSceneInit(); break; } @@ -153,7 +153,7 @@ void GnapEngine::scene27_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -280,7 +280,7 @@ void GnapEngine::scene27_run() { playSound(0x1093B, true); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (_debugLevel == 4) diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index 86df88bd1f..93723e65f6 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -94,12 +94,12 @@ void GnapEngine::scene28_run() { _timers[4] = getRandom(20) + 80; } initGnapPos(8, 8, kDirBottomLeft); - initBeaverPos(9, 8, kDirUnk4); + initPlatypusPos(9, 8, kDirUnk4); endSceneInit(); } else { _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); initGnapPos(8, 8, kDirBottomLeft); - initBeaverPos(9, 8, kDirUnk4); + initPlatypusPos(9, 8, kDirUnk4); endSceneInit(); playSequences(0xF7, 0x121, 0x122, 0x123); _s28_currClownSequenceId = 0x115; @@ -149,7 +149,7 @@ void GnapEngine::scene28_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -289,7 +289,7 @@ void GnapEngine::scene28_run() { playSound(0x1093C, true); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 80; diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 6ab5744a93..3528141de4 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -86,13 +86,13 @@ void GnapEngine::scene29_run() { if (_prevSceneNum == 27) { initGnapPos(12, 7, kDirBottomRight); - initBeaverPos(12, 8, kDirNone); + initPlatypusPos(12, 8, kDirNone); endSceneInit(); gnapWalkTo(8, 7, -1, 0x107B9, 1); platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { initGnapPos(-1, 7, kDirBottomRight); - initBeaverPos(-2, 7, kDirNone); + initPlatypusPos(-2, 7, kDirNone); endSceneInit(); gnapWalkTo(2, 7, -1, 0x107B9, 1); platypusWalkTo(1, 7, -1, 0x107C2, 1); @@ -131,7 +131,7 @@ void GnapEngine::scene29_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -236,7 +236,7 @@ void GnapEngine::scene29_run() { if (!_isLeavingScene) { if (_gnapActionStatus < 0) { updateGnapIdleSequence(); - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); } if (!_timers[4]) { if (invHas(kItemHorn)) { diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index b394baf7d9..33a374c134 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -76,7 +76,7 @@ void GnapEngine::scene30_run() { _s30_kidSequenceId = 0x101; initGnapPos(7, 12, kDirBottomRight); - initBeaverPos(6, 12, kDirNone); + initPlatypusPos(6, 12, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107B9, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -112,7 +112,7 @@ void GnapEngine::scene30_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -183,7 +183,7 @@ void GnapEngine::scene30_run() { playSound(0x1093B, true); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[4]) { diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 3adfcbd46e..027a4b5d80 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -79,13 +79,13 @@ void GnapEngine::scene31_run() { if (_prevSceneNum == 27) { initGnapPos(-1, 8, kDirBottomLeft); - initBeaverPos(-1, 9, kDirUnk4); + initPlatypusPos(-1, 9, kDirUnk4); endSceneInit(); gnapWalkTo(3, 8, -1, 0x107BA, 1); platypusWalkTo(3, 9, -1, 0x107D2, 1); } else { initGnapPos(7, 12, kDirBottomRight); - initBeaverPos(6, 12, kDirNone); + initPlatypusPos(6, 12, kDirNone); endSceneInit(); gnapWalkTo(7, 8, -1, 0x107BA, 1); platypusWalkTo(6, 8, -1, 0x107D2, 1); @@ -124,7 +124,7 @@ void GnapEngine::scene31_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(0, 0); @@ -161,12 +161,12 @@ void GnapEngine::scene31_run() { break; case PLAT_CURSOR: if (!invHas(kItemBucketWithBeer)) { - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, 1, 0x107C2, 1); _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _beaverActionStatus = kASPlatMeasuringClown; + _platypusActionStatus = kASPlatMeasuringClown; _gnapActionStatus = kASPlatMeasuringClown; _timers[4] = 300; } else @@ -253,8 +253,8 @@ void GnapEngine::scene31_run() { playSound(0x1093B, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[4]) { @@ -343,7 +343,7 @@ void GnapEngine::scene31_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - if (_beaverActionStatus == kASPlatMeasuringClown) { + if (_platypusActionStatus == kASPlatMeasuringClown) { _sceneWaiting = true; _s31_beerGuyDistracted = true; _s28_nextClerkSequenceId = 0xFA; @@ -364,7 +364,7 @@ void GnapEngine::scene31_updateAnimations() { ++_s31_clerkMeasureCtr; if (_s31_clerkMeasureCtr >= _s31_clerkMeasureMaxCtr) { if (_gnapActionStatus != 5) - _beaverActionStatus = -1; + _platypusActionStatus = -1; _timers[0] = 40; _gameSys->insertSequence(0xFD, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _s28_currClerkSequenceId = 0xFD; diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index ff526044bc..6eac47ee6e 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -72,13 +72,13 @@ void GnapEngine::scene32_run() { if (_prevSceneNum == 33) { initGnapPos(11, 6, kDirBottomLeft); - initBeaverPos(12, 6, kDirUnk4); + initPlatypusPos(12, 6, kDirUnk4); endSceneInit(); platypusWalkTo(9, 6, -1, 0x107D2, 1); gnapWalkTo(8, 6, -1, 0x107BA, 1); } else { initGnapPos(1, 6, kDirBottomRight); - initBeaverPos(1, 7, kDirNone); + initPlatypusPos(1, 7, kDirNone); endSceneInit(); } @@ -112,7 +112,7 @@ void GnapEngine::scene32_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -158,8 +158,8 @@ void GnapEngine::scene32_run() { playSound(0x1091C, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[4]) { diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index bad0f88a4e..3c24dd2088 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -77,26 +77,26 @@ void GnapEngine::scene33_run() { switch (_prevSceneNum) { case 34: initGnapPos(11, 7, kDirBottomLeft); - initBeaverPos(12, 7, kDirUnk4); + initPlatypusPos(12, 7, kDirUnk4); endSceneInit(); gnapWalkTo(8, 7, -1, 0x107BA, 1); platypusWalkTo(9, 7, -1, 0x107D2, 1); break; case 37: initGnapPos(7, 7, kDirBottomRight); - initBeaverPos(8, 7, kDirNone); + initPlatypusPos(8, 7, kDirNone); endSceneInit(); break; case 32: initGnapPos(-1, 6, kDirBottomRight); - initBeaverPos(-1, 7, kDirNone); + initPlatypusPos(-1, 7, kDirNone); endSceneInit(); platypusWalkTo(2, 7, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); break; default: initGnapPos(3, 7, kDirBottomRight); - initBeaverPos(2, 7, kDirNone); + initPlatypusPos(2, 7, kDirNone); endSceneInit(); break; } @@ -133,7 +133,7 @@ void GnapEngine::scene33_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -235,8 +235,8 @@ void GnapEngine::scene33_run() { playSound(0x1091C, true); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[4]) { diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index b60c8327e1..ce8f1c700d 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -72,21 +72,21 @@ void GnapEngine::scene38_updateHotspots() { setHotspot(kHSWalkArea5, 770, 0, 799, 445); setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) _hotspots[kHSWalkArea6]._flags = SF_NONE; _hotspotsCount = 13; } @@ -98,10 +98,10 @@ void GnapEngine::scene38_run() { if (_prevSceneNum == 39) { initGnapPos(3, 7, kDirBottomLeft); - initBeaverPos(4, 7, kDirUnk4); + initPlatypusPos(4, 7, kDirUnk4); } else { initGnapPos(3, 8, kDirBottomRight); - initBeaverPos(4, 8, kDirNone); + initPlatypusPos(4, 8, kDirNone); } endSceneInit(); @@ -135,7 +135,7 @@ void GnapEngine::scene38_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -158,9 +158,9 @@ void GnapEngine::scene38_run() { case kHSExitCave: if (_gnapActionStatus == kASHoldingHuntingTrophy) { _gnapActionStatus = kASReleaseHuntingTrophy; - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) _isLeavingScene = true; - } else if (_beaverActionStatus == kASBeaverHoldingTrapDoor) { + } else if (_platypusActionStatus == kASBeaverHoldingTrapDoor) { _sceneWaiting = false; _isLeavingScene = true; gnapWalkTo(5, 7, 0, 0x107BB, 1); @@ -172,7 +172,7 @@ void GnapEngine::scene38_run() { case kHSTrapDoorLid1: case kHSTrapDoorLid2: if (_gnapActionStatus == kASHoldingHuntingTrophy) { - if (_verbCursor == PLAT_CURSOR && _beaverActionStatus != kASBeaverHoldingTrapDoor) + if (_verbCursor == PLAT_CURSOR && _platypusActionStatus != kASBeaverHoldingTrapDoor) _gnapActionStatus = kASUseBeaverWithTrapDoor; else _gnapActionStatus = kASReleaseHuntingTrophy; @@ -189,7 +189,7 @@ void GnapEngine::scene38_run() { playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) playGnapImpossible(0, 0); else { gnapWalkTo(3, 6, 0, 0x107BB, 1); @@ -238,7 +238,7 @@ void GnapEngine::scene38_run() { scene38_updateAnimations(); if (!_isLeavingScene) { - updateBeaverIdleSequence(); + updatePlatypusIdleSequence(); updateGnapIdleSequence(); } @@ -265,7 +265,7 @@ void GnapEngine::scene38_updateAnimations() { _sceneDone = true; break; case kASExitCave: - _gameSys->removeSequence(_beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, true); + _gameSys->removeSequence(_platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, true); _gameSys->insertSequence(0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0xA3; _gnapSequenceDatNum = 0; @@ -282,7 +282,7 @@ void GnapEngine::scene38_updateAnimations() { scene38_updateHotspots(); break; case kASHoldingHuntingTrophy: - if (_beaverActionStatus != kASBeaverHoldingTrapDoor) + if (_platypusActionStatus != kASBeaverHoldingTrapDoor) _sceneWaiting = true; if (_gnapSequenceId == 0xA4) { _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); @@ -298,7 +298,7 @@ void GnapEngine::scene38_updateAnimations() { if (_gnapSequenceId == 0x9E) { _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); _gnapActionStatus = -1; - } else if (_beaverActionStatus == kASBeaverHoldingTrapDoor) { + } else if (_platypusActionStatus == kASBeaverHoldingTrapDoor) { _gameSys->insertSequence(0xA0, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0xA0; _gnapSequenceDatNum = 0; @@ -332,17 +332,17 @@ void GnapEngine::scene38_updateAnimations() { _gnapSequenceDatNum = 0; _gameSys->setAnimation(0x9F, _gnapId, 0); _gnapActionStatus = kASHoldingHuntingTrophy; - if (_beaverFacing != kDirNone) - playBeaverSequence(0x107D5); + if (_platypusFacing != kDirNone) + playPlatypusSequence(0x107D5); else - playBeaverSequence(0x107D4); + playPlatypusSequence(0x107D4); platypusWalkTo(8, 7, -1, 0x107D2, 1); - _gameSys->insertSequence(0xA1, _gnapId + 1, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceId = 0xA1; - _beaverSequenceDatNum = 0; - _beaverId = _gnapId + 1; + _gameSys->insertSequence(0xA1, _gnapId + 1, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceId = 0xA1; + _platypusSequenceDatNum = 0; + _platypusId = _gnapId + 1; _gameSys->setAnimation(0xA1, _gnapId + 1, 1); - _beaverActionStatus = kASBeaverHoldingTrapDoor; + _platypusActionStatus = kASBeaverHoldingTrapDoor; scene38_updateHotspots(); break; } @@ -350,10 +350,10 @@ void GnapEngine::scene38_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - if (_beaverActionStatus == kASBeaverHoldingTrapDoor) { - _gameSys->insertSequence(0xA2, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceId = 0xA2; - _beaverSequenceDatNum = 0; + if (_platypusActionStatus == kASBeaverHoldingTrapDoor) { + _gameSys->insertSequence(0xA2, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceId = 0xA2; + _platypusSequenceDatNum = 0; scene38_updateHotspots(); _sceneWaiting = true; } diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index a89fea8f0e..bc506c1bcf 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -71,11 +71,11 @@ void GnapEngine::scene39_run() { _s39_nextGuySequenceId = -1; if (_prevSceneNum == 38) { initGnapPos(3, 7, kDirUpRight); - initBeaverPos(2, 7, kDirUpLeft); + initPlatypusPos(2, 7, kDirUpLeft); endSceneInit(); } else { initGnapPos(4, 7, kDirBottomRight); - initBeaverPos(5, 7, kDirNone); + initPlatypusPos(5, 7, kDirNone); endSceneInit(); } @@ -116,7 +116,7 @@ void GnapEngine::scene39_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -183,8 +183,8 @@ void GnapEngine::scene39_run() { scene39_updateAnimations(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0) updateGnapIdleSequence(); if (!_timers[5]) { diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index c2b829100a..001a923272 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -96,7 +96,7 @@ void GnapEngine::scene40_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 23ac6ca4de..c7f278990a 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -138,23 +138,23 @@ void GnapEngine::scene41_run() { _gnapId = 140; _gameSys->insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - initBeaverPos(8, 10, kDirBottomLeft); + initPlatypusPos(8, 10, kDirBottomLeft); endSceneInit(); } else if (_prevSceneNum == 45) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-2, 8, kDirUpLeft); + initPlatypusPos(-2, 8, kDirUpLeft); endSceneInit(); platypusWalkTo(1, 8, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_prevSceneNum == 42) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, kDirUpLeft); + initPlatypusPos(11, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { initGnapPos(5, 8, kDirBottomRight); - initBeaverPos(6, 8, kDirBottomLeft); + initPlatypusPos(6, 8, kDirBottomLeft); endSceneInit(); } @@ -236,7 +236,7 @@ void GnapEngine::scene41_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -384,13 +384,13 @@ void GnapEngine::scene41_run() { scene41_updateAnimations(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { switch (getRandom(3)) { case 0: _s41_nextToyVendorSequenceId = 0x113; @@ -408,7 +408,7 @@ void GnapEngine::scene41_run() { } if (!_timers[5]) { _timers[5] = getRandom(30) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { if (isFlag(kGFGnapControlsToyUFO)) _s41_nextKidSequenceId = 0x11B; else if (getRandom(3) != 0) diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 6b719d2761..2ecce592d6 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -126,19 +126,19 @@ void GnapEngine::scene42_run() { setGrabCursorSprite(-1); } else if (_prevSceneNum == 41) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 9, kDirUpLeft); + initPlatypusPos(-1, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); } else if (_prevSceneNum == 43) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, kDirUpLeft); + initPlatypusPos(11, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, kDirUpLeft); + initPlatypusPos(6, 11, kDirUpLeft); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -214,7 +214,7 @@ void GnapEngine::scene42_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -318,13 +318,13 @@ void GnapEngine::scene42_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 30; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { switch (getRandom(8)) { case 0: _s42_nextBBQVendorSequenceId = 0x14C; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index dcf03cb671..e371d4aa6b 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -114,27 +114,27 @@ void GnapEngine::scene43_run() { switch (_prevSceneNum) { case 42: initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 9, kDirUpLeft); + initPlatypusPos(-1, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 44: initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, kDirUpLeft); + initPlatypusPos(11, 9, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); break; case 54: initGnapPos(4, 7, kDirBottomLeft); - initBeaverPos(11, 8, kDirUpLeft); + initPlatypusPos(11, 8, kDirUpLeft); endSceneInit(); platypusWalkTo(9, 8, -1, 0x107D2, 1); break; default: initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, kDirUpLeft); + initPlatypusPos(6, 11, kDirUpLeft); endSceneInit(); gnapWalkTo(5, 8, -1, 0x107BA, 1); platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -220,7 +220,7 @@ void GnapEngine::scene43_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -320,13 +320,13 @@ void GnapEngine::scene43_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4] && (!isFlag(kGFGnapControlsToyUFO) || !isFlag(kGFGroceryStoreHatTaken))) { _timers[4] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { switch (getRandom(5)) { case 0: _s43_nextTwoHeadedGuySequenceId = 0x13C; diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 3b2633bc83..5b53f114ec 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -128,14 +128,14 @@ void GnapEngine::scene44_run() { switch (_prevSceneNum) { case 43: initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 7, kDirUpLeft); + initPlatypusPos(-1, 7, kDirUpLeft); endSceneInit(); gnapWalkTo(2, 8, -1, 0x107B9, 1); platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 46: initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 8, kDirUpLeft); + initPlatypusPos(11, 8, kDirUpLeft); endSceneInit(); gnapWalkTo(6, 8, -1, 0x107BA, 1); platypusWalkTo(7, 8, -1, 0x107D2, 1); @@ -143,23 +143,23 @@ void GnapEngine::scene44_run() { case 50: initGnapPos(4, 8, kDirBottomRight); if (_sceneSavegameLoaded) { - initBeaverPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, kDirUnk4); + initPlatypusPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, kDirUnk4); } else if (!isFlag(kGFUnk13)) { _timers[0] = 50; _timers[1] = 20; _platX = 5; _platY = 8; - _beaverSequenceId = 0xFD; - _beaverFacing = kDirNone; - _beaverId = 160; - _beaverSequenceDatNum = 0; + _platypusSequenceId = 0xFD; + _platypusFacing = kDirNone; + _platypusId = 160; + _platypusSequenceDatNum = 0; _gameSys->insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); } endSceneInit(); break; default: initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, kDirUpLeft); + initPlatypusPos(6, 11, kDirUpLeft); endSceneInit(); platypusWalkTo(6, 8, -1, 0x107C2, 1); gnapWalkTo(5, 8, -1, 0x107BA, 1); @@ -231,7 +231,7 @@ void GnapEngine::scene44_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -282,12 +282,12 @@ void GnapEngine::scene44_run() { _gnapActionStatus = 1; break; case PLAT_CURSOR: - gnapUseDeviceOnBeaver(); + gnapUseDeviceOnPlatypuss(); platypusWalkTo(6, 7, 1, 0x107D2, 1); if (_gnapX == 7 && _gnapY == 7) gnapWalkStep(); playGnapIdle(5, 7); - _beaverActionStatus = 4; + _platypusActionStatus = 4; break; } } @@ -366,13 +366,13 @@ void GnapEngine::scene44_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO) && _s44_currKissingLadySequenceId != 0xF5) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO) && _s44_currKissingLadySequenceId != 0xF5) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { switch (getRandom(20)) { case 0: _s44_nextKissingLadySequenceId = 0xED; @@ -399,7 +399,7 @@ void GnapEngine::scene44_run() { } if (!_timers[5]) { _timers[5] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { if (getRandom(5) != 0) { if (!isFlag(kGFSpringTaken)) _s44_nextSpringGuySequenceId = 0xF9; @@ -445,15 +445,15 @@ void GnapEngine::scene44_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - switch (_beaverActionStatus) { + switch (_platypusActionStatus) { case 4: if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->insertSequence(0xFE, _beaverId, _beaverSequenceId | (_beaverSequenceDatNum << 16), _beaverId, kSeqSyncWait, 0, 0, 0); - _beaverSequenceId = 0xFE; - _beaverSequenceDatNum = 0; - _gameSys->setAnimation(0xFE, _beaverId, 1); + _gameSys->insertSequence(0xFE, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _platypusSequenceId = 0xFE; + _platypusSequenceDatNum = 0; + _gameSys->setAnimation(0xFE, _platypusId, 1); _gameSys->removeSequence(_s44_currKissingLadySequenceId, 1, true); - _beaverActionStatus = 5; + _platypusActionStatus = 5; } break; case 5: @@ -461,7 +461,7 @@ void GnapEngine::scene44_updateAnimations() { _newSceneNum = 50; break; default: - _beaverActionStatus = -1; + _platypusActionStatus = -1; break; } } @@ -469,7 +469,7 @@ void GnapEngine::scene44_updateAnimations() { if (_gameSys->getAnimationStatus(2) == 2) { if (_s44_nextKissingLadySequenceId == 0xF6) { _gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - initBeaverPos(5, 8, kDirNone); + initPlatypusPos(5, 8, kDirNone); _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; _s44_nextKissingLadySequenceId = -1; _gameSys->setAnimation(0, 0, 2); diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 8581e551e5..e8d421405a 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -115,23 +115,23 @@ void GnapEngine::scene45_run() { _gameSys->setAnimation(0x9E, 1, 0); _gnapActionStatus = 1; _gameSys->insertSequence(_gnapSequenceId, _gnapId, 0, 0, kSeqNone, 0, 0, 0); - initBeaverPos(4, 8, kDirNone); + initPlatypusPos(4, 8, kDirNone); endSceneInit(); } else if (_prevSceneNum == 46) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 9, kDirUpLeft); + initPlatypusPos(-1, 9, kDirUpLeft); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107C2, 1); gnapWalkTo(2, 7, -1, 0x107B9, 1); } else if (_prevSceneNum == 41) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(11, 9, kDirUpLeft); + initPlatypusPos(11, 9, kDirUpLeft); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107D2, 1); gnapWalkTo(10, 9, -1, 0x107BA, 1); } else { initGnapPos(2, 11, kDirUpRight); - initBeaverPos(6, 11, kDirUpLeft); + initPlatypusPos(6, 11, kDirUpLeft); endSceneInit(); platypusWalkTo(4, 8, -1, 0x107C2, 1); gnapWalkTo(2, 7, -1, 0x107B9, 1); @@ -176,8 +176,8 @@ void GnapEngine::scene45_run() { _gnapSequenceDatNum = 1; } - playBeaverSequence(0x9A); - _gameSys->setAnimation(_beaverSequenceId, _beaverId, 1); + playPlatypusSequence(0x9A); + _gameSys->setAnimation(_platypusSequenceId, _platypusId, 1); while (!_sceneDone) { if (!isSoundPlaying(0x1094A)) @@ -240,12 +240,12 @@ void GnapEngine::scene45_run() { break; case GRAB_CURSOR: gnapKissPlatypus(0); - playBeaverSequence(0x9A); - _gameSys->setAnimation(_beaverSequenceId, _beaverId, 1); + playPlatypusSequence(0x9A); + _gameSys->setAnimation(_platypusSequenceId, _platypusId, 1); break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -382,10 +382,10 @@ void GnapEngine::scene45_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); if (getRandom(2) != 0) - playBeaverSequence(0x9B); + playPlatypusSequence(0x9B); else - playBeaverSequence(0x9C); - _gameSys->setAnimation(_beaverSequenceId, _beaverId, 1); + playPlatypusSequence(0x9C); + _gameSys->setAnimation(_platypusSequenceId, _platypusId, 1); } if (_gameSys->getAnimationStatus(2) == 2) { diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 4a1ba2535f..26a3be0b34 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -102,19 +102,19 @@ void GnapEngine::scene46_run() { endSceneInit(); } else if (_prevSceneNum == 44) { initGnapPos(-1, 8, kDirUpRight); - initBeaverPos(-1, 8, kDirUpLeft); + initPlatypusPos(-1, 8, kDirUpLeft); endSceneInit(); platypusWalkTo(1, 8, -1, 0x107C2, 1); gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_prevSceneNum == 45) { initGnapPos(11, 8, kDirUpRight); - initBeaverPos(12, 8, kDirUpLeft); + initPlatypusPos(12, 8, kDirUpLeft); endSceneInit(); gnapWalkTo(8, 8, -1, 0x107BA, 1); platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { initGnapPos(5, 11, kDirUpRight); - initBeaverPos(6, 11, kDirUpLeft); + initPlatypusPos(6, 11, kDirUpLeft); endSceneInit(); platypusWalkTo(5, 8, -1, 0x107C2, 1); gnapWalkTo(6, 8, -1, 0x107BA, 1); @@ -183,7 +183,7 @@ void GnapEngine::scene46_run() { break; case TALK_CURSOR: playGnapBrainPulsating(_platX, _platY); - playBeaverSequence(getBeaverSequenceId()); + playPlatypusSequence(getPlatypusSequenceId()); break; case PLAT_CURSOR: playGnapImpossible(_platX, _platY); @@ -280,13 +280,13 @@ void GnapEngine::scene46_run() { toyUfoCheckTimer(); if (!_isLeavingScene) { - if (_beaverActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateBeaverIdleSequence(); + if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) + updatePlatypusIdleSequence(); if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) updateGnapIdleSequence(); if (!_timers[4]) { _timers[4] = getRandom(50) + 80; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { if (getRandom(2) != 0) _s46_nextItchyGuySequenceId = 0x49; else @@ -295,7 +295,7 @@ void GnapEngine::scene46_run() { } if (!_timers[5]) { _timers[5] = getRandom(50) + 80; - if (_gnapActionStatus < 0 && _beaverActionStatus < 0 && _s46_nextSackGuySequenceId == -1) + if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s46_nextSackGuySequenceId == -1) _s46_nextSackGuySequenceId = 0x4C; } } -- cgit v1.2.3 From 70fec4db2cbc89893c45beb27c54dc87699a7265 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Apr 2016 21:33:29 +0200 Subject: GNAP: More renaming of 'beaver' variables --- engines/gnap/grid.cpp | 4 ++-- engines/gnap/scenes/scene38.cpp | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 88e9693113..0e10a715e8 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -738,13 +738,13 @@ void GnapEngine::gnapWalkStep() { //////////////////////////////////////////////////////////////////////////////// int GnapEngine::getPlatypusWalkSequenceId(int deltaX, int deltaY) { - static const int _beaverWalkSequenceIds[9] = { + static const int _platypusWalkSequenceIds[9] = { 0x7C5, 0x000, 0x7C8, 0x7C4, 0x000, 0x7C7, 0x7C3, 0x000, 0x7C6 }; // CHECKME This is a little weird - return _beaverWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; + return _platypusWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; } bool GnapEngine::gridSub423750(int gridX, int gridY) { diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index ce8f1c700d..81da7642b4 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -48,8 +48,8 @@ enum { kASUseHuntingTrophy = 2, kASHoldingHuntingTrophy = 3, kASReleaseHuntingTrophy = 4, - kASUseBeaverWithTrapDoor = 5, - kASBeaverHoldingTrapDoor = 6 + kASUsePlatypusWithTrapDoor = 5, + kASPlatypusHoldingTrapDoor = 6 }; int GnapEngine::scene38_init() { @@ -72,21 +72,21 @@ void GnapEngine::scene38_updateHotspots() { setHotspot(kHSWalkArea5, 770, 0, 799, 445); setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) _hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) _hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; else if (_gnapActionStatus == kASHoldingHuntingTrophy) _hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) _hotspots[kHSWalkArea6]._flags = SF_NONE; _hotspotsCount = 13; } @@ -158,9 +158,9 @@ void GnapEngine::scene38_run() { case kHSExitCave: if (_gnapActionStatus == kASHoldingHuntingTrophy) { _gnapActionStatus = kASReleaseHuntingTrophy; - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) _isLeavingScene = true; - } else if (_platypusActionStatus == kASBeaverHoldingTrapDoor) { + } else if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { _sceneWaiting = false; _isLeavingScene = true; gnapWalkTo(5, 7, 0, 0x107BB, 1); @@ -172,8 +172,8 @@ void GnapEngine::scene38_run() { case kHSTrapDoorLid1: case kHSTrapDoorLid2: if (_gnapActionStatus == kASHoldingHuntingTrophy) { - if (_verbCursor == PLAT_CURSOR && _platypusActionStatus != kASBeaverHoldingTrapDoor) - _gnapActionStatus = kASUseBeaverWithTrapDoor; + if (_verbCursor == PLAT_CURSOR && _platypusActionStatus != kASPlatypusHoldingTrapDoor) + _gnapActionStatus = kASUsePlatypusWithTrapDoor; else _gnapActionStatus = kASReleaseHuntingTrophy; } @@ -189,7 +189,7 @@ void GnapEngine::scene38_run() { playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) playGnapImpossible(0, 0); else { gnapWalkTo(3, 6, 0, 0x107BB, 1); @@ -282,7 +282,7 @@ void GnapEngine::scene38_updateAnimations() { scene38_updateHotspots(); break; case kASHoldingHuntingTrophy: - if (_platypusActionStatus != kASBeaverHoldingTrapDoor) + if (_platypusActionStatus != kASPlatypusHoldingTrapDoor) _sceneWaiting = true; if (_gnapSequenceId == 0xA4) { _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); @@ -298,7 +298,7 @@ void GnapEngine::scene38_updateAnimations() { if (_gnapSequenceId == 0x9E) { _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); _gnapActionStatus = -1; - } else if (_platypusActionStatus == kASBeaverHoldingTrapDoor) { + } else if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { _gameSys->insertSequence(0xA0, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0xA0; _gnapSequenceDatNum = 0; @@ -325,7 +325,7 @@ void GnapEngine::scene38_updateAnimations() { scene38_updateHotspots(); } break; - case kASUseBeaverWithTrapDoor: + case kASUsePlatypusWithTrapDoor: _sceneWaiting = false; _gameSys->insertSequence(0x9F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); _gnapSequenceId = 0x9F; @@ -342,7 +342,7 @@ void GnapEngine::scene38_updateAnimations() { _platypusSequenceDatNum = 0; _platypusId = _gnapId + 1; _gameSys->setAnimation(0xA1, _gnapId + 1, 1); - _platypusActionStatus = kASBeaverHoldingTrapDoor; + _platypusActionStatus = kASPlatypusHoldingTrapDoor; scene38_updateHotspots(); break; } @@ -350,7 +350,7 @@ void GnapEngine::scene38_updateAnimations() { if (_gameSys->getAnimationStatus(1) == 2) { _gameSys->setAnimation(0, 0, 1); - if (_platypusActionStatus == kASBeaverHoldingTrapDoor) { + if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { _gameSys->insertSequence(0xA2, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); _platypusSequenceId = 0xA2; _platypusSequenceDatNum = 0; -- cgit v1.2.3 From 145b3751199219c4707e8f3462e2c63916b46460 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Apr 2016 07:57:07 +0200 Subject: GNAP: Refactor Scene01 (WIP) --- engines/gnap/gnap.cpp | 7 +- engines/gnap/gnap.h | 14 +- engines/gnap/scenes/scene01.cpp | 357 +++++++++++++++++++------------------- engines/gnap/scenes/scene01.h | 49 ++++++ engines/gnap/scenes/scenecore.cpp | 11 +- engines/gnap/scenes/scenecore.h | 48 +++++ 6 files changed, 292 insertions(+), 194 deletions(-) create mode 100644 engines/gnap/scenes/scene01.h create mode 100644 engines/gnap/scenes/scenecore.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 15c949ab77..dbe081c636 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -98,6 +98,7 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : DebugMan.addDebugChannel(kDebugBasic, "basic", "Basic debug level"); Engine::syncSoundSettings(); + _scene = nullptr; } GnapEngine::~GnapEngine() { @@ -2021,12 +2022,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - - // Scene 1 - _s01_pigsIdCtr = 0; - _s01_smokeIdCtr = 0; - _s01_spaceshipSurface = 0; - // Scene 2 _s02_truckGrillCtr = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 3517838951..a56df314b0 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -41,6 +41,7 @@ #include "gnap/debugger.h" #include "gnap/resource.h" +#include "gnap/scenes/scenecore.h" struct ADGameDescription; @@ -312,7 +313,8 @@ public: GameSys *_gameSys; SoundMan *_soundMan; Debugger *_debugger; - + Scene *_scene; + int _lastUpdateClock; int _debugLevel; @@ -604,15 +606,7 @@ public: // Scene 0 int scene00_init(); void scene00_run(); - - // Scene 1 - int _s01_pigsIdCtr, _s01_smokeIdCtr; - Graphics::Surface *_s01_spaceshipSurface; - int scene01_init(); - void scene01_updateHotspots(); - void scene01_run(); - void scene01_updateAnimations(); - + // Scene 2 int _s02_truckGrillCtr; int _s02_nextChickenSequenceId, _s02_currChickenSequenceId; diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 808c190af1..be104a2649 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene01.h" namespace Gnap { @@ -52,110 +53,115 @@ enum { kASUsePigs = 7 }; -int GnapEngine::scene01_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 3); +Scene01::Scene01(GnapEngine *vm) : Scene(vm) { + _s01_pigsIdCtr = 0; + _s01_smokeIdCtr = 0; + _s01_spaceshipSurface = nullptr; +} + +int Scene01::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 3); return 0x88; } -void GnapEngine::scene01_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); - setHotspot(kHSMud, 138, 282, 204, 318, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); - setHotspot(kHSPigs, 408, 234, 578, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 4); - setHotspot(kHSSpaceship, 0, 200, 94, 292, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); - setHotspot(kHSWalkArea1, 0, 0, 162, 426); - setHotspot(kHSWalkArea2, 162, 0, 237, 396); - setHotspot(kHSWalkArea3, 237, 0, 319, 363); - setHotspot(kHSWalkArea4, 520, 0, 800, 404); - setHotspot(kHSWalkArea5, 300, 447, 800, 600); - setHotspot(kHSWalkArea6, 678, 0, 800, 404); - setHotspot(kHSWalkArea7, 0, 0, 520, 351); - setHotspot(kHSWalkArea8, 0, 546, 300, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypus)) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(kGFMudTaken)) - _hotspots[kHSMud]._flags = SF_WALKABLE | SF_DISABLED; - _hotspotsCount = 14; +void Scene01::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + _vm->setHotspot(kHSMud, 138, 282, 204, 318, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + _vm->setHotspot(kHSPigs, 408, 234, 578, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 4); + _vm->setHotspot(kHSSpaceship, 0, 200, 94, 292, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + _vm->setHotspot(kHSWalkArea1, 0, 0, 162, 426); + _vm->setHotspot(kHSWalkArea2, 162, 0, 237, 396); + _vm->setHotspot(kHSWalkArea3, 237, 0, 319, 363); + _vm->setHotspot(kHSWalkArea4, 520, 0, 800, 404); + _vm->setHotspot(kHSWalkArea5, 300, 447, 800, 600); + _vm->setHotspot(kHSWalkArea6, 678, 0, 800, 404); + _vm->setHotspot(kHSWalkArea7, 0, 0, 520, 351); + _vm->setHotspot(kHSWalkArea8, 0, 546, 300, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFMudTaken)) + _vm->_hotspots[kHSMud]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspotsCount = 14; } -void GnapEngine::scene01_run() { +void Scene01::run() { // NOTE Removed _s01_dword_474380 which was set when the mud was taken // which is also set in the global game flags. - playSound(0x1091C, true); - startSoundTimerC(5); + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(5); - _gameSys->setAnimation(134, 20, 4); - _gameSys->insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(134, 20, 4); + _vm->_gameSys->insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x7F, 40, 2); - _gameSys->insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x7F, 40, 2); + _vm->_gameSys->insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); - _timers[4] = getRandom(100) + 300; + _vm->_timers[4] = _vm->getRandom(100) + 300; - if (!isFlag(kGFMudTaken)) - _gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFMudTaken)) + _vm->_gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (_prevSceneNum == 2) { - initGnapPos(11, 6, kDirBottomLeft); - if (isFlag(kGFPlatypus)) - initPlatypusPos(12, 6, kDirUnk4); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(9, 6, -1, 0x107C2, 1); - gnapWalkTo(8, 6, -1, 0x107B9, 1); + if (_vm->_prevSceneNum == 2) { + _vm->initGnapPos(11, 6, kDirBottomLeft); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); + _vm->gnapWalkTo(8, 6, -1, 0x107B9, 1); } else { - initGnapPos(1, 6, kDirBottomRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(1, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(1, 6, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); - testWalk(0, 3, -1, -1, -1, -1); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->testWalk(0, 3, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene01_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { - if (_grabCursorSpriteIndex == kItemDisguise) { - gnapUseDisguiseOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFKeysTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -163,20 +169,20 @@ void GnapEngine::scene01_run() { break; case kHSSpaceship: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - if (gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _gnapActionStatus = kASLookSpaceship; + _vm->_gnapIdleFacing = kDirUpLeft; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kASLookSpaceship; break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -184,21 +190,21 @@ void GnapEngine::scene01_run() { break; case kHSMud: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 2, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(3, 3); + _vm->playGnapScratchingHead(3, 3); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); - _gnapActionStatus = kASTakeMud; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); + _vm->_gnapActionStatus = kASTakeMud; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -206,28 +212,28 @@ void GnapEngine::scene01_run() { break; case kHSPigs: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 7, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _gnapActionStatus = kASLookPigs; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnapActionStatus = kASLookPigs; break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _gnapActionStatus = kASUsePigs; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnapActionStatus = kASUsePigs; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); - _gnapActionStatus = kASLookPigs; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); + _vm->_gnapActionStatus = kASLookPigs; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -235,13 +241,13 @@ void GnapEngine::scene01_run() { break; case kHSExitTruck: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); - _newSceneNum = 2; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); + _vm->_newSceneNum = 2; } break; @@ -253,120 +259,121 @@ void GnapEngine::scene01_run() { case kHSWalkArea6: case kHSWalkArea7: case kHSWalkArea8: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene01_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, true); + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (_timers[4] == 0) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_timers[4] == 0) { // Update bird animation - _timers[4] = getRandom(100) + 300; - if (getRandom(1) == 0) - _gameSys->insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(1) == 0) + _vm->_gameSys->insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene01_updateHotspots(); + _vm->checkGameKeys(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene01_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene01::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLookSpaceship: - _s01_spaceshipSurface = _gameSys->createSurface(47); - _gameSys->insertSpriteDrawItem(_s01_spaceshipSurface, 0, 0, 255); - _gameSys->setAnimation(133, 256, 0); - _gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = kASLookSpaceshipDone; + _s01_spaceshipSurface = _vm->_gameSys->createSurface(47); + _vm->_gameSys->insertSpriteDrawItem(_s01_spaceshipSurface, 0, 0, 255); + _vm->_gameSys->setAnimation(133, 256, 0); + _vm->_gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = kASLookSpaceshipDone; break; + case kASLookSpaceshipDone: - _gameSys->removeSequence(133, 256, true); - _gameSys->removeSpriteDrawItem(_s01_spaceshipSurface, 255); - deleteSurface(&_s01_spaceshipSurface); - _gnapActionStatus = -1; + _vm->_gameSys->removeSequence(133, 256, true); + _vm->_gameSys->removeSpriteDrawItem(_s01_spaceshipSurface, 255); + _vm->deleteSurface(&_s01_spaceshipSurface); + _vm->_gnapActionStatus = -1; break; + case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; + case kASTakeMud: - playGnapPullOutDevice(2, 3); - playGnapUseDevice(0, 0); - _gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(128, 40, 3); - _gnapActionStatus = -1; + _vm->playGnapPullOutDevice(2, 3); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(128, 40, 3); + _vm->_gnapActionStatus = -1; break; + case kASLookPigs: - playSound(138, false); - playSound(139, false); - playSound(140, false); - _gnapActionStatus = -1; + _vm->playSound(138, false); + _vm->playSound(139, false); + _vm->playSound(140, false); + _vm->_gnapActionStatus = -1; break; + case kASUsePigs: - playGnapPullOutDevice(7, 2); - playGnapUseDevice(0, 0); - _gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, getRandom(140) - 40, 0); - _gnapActionStatus = -1; + _vm->playGnapPullOutDevice(7, 2); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { - _gameSys->setAnimation(0, 0, 3); - invAdd(kItemMud); - setGrabCursorSprite(kItemMud); - setFlag(kGFMudTaken); - scene01_updateHotspots(); + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->invAdd(kItemMud); + _vm->setGrabCursorSprite(kItemMud); + _vm->setFlag(kGFMudTaken); + updateHotspots(); } - if (_gameSys->getAnimationStatus(4) == 2) { + if (_vm->_gameSys->getAnimationStatus(4) == 2) { _s01_smokeIdCtr = (_s01_smokeIdCtr + 1) % 2; - _gameSys->setAnimation(0x86, _s01_smokeIdCtr + 20, 4); - _gameSys->insertSequence(0x86, _s01_smokeIdCtr + 20, + _vm->_gameSys->setAnimation(0x86, _s01_smokeIdCtr + 20, 4); + _vm->_gameSys->insertSequence(0x86, _s01_smokeIdCtr + 20, 0x86, (_s01_smokeIdCtr + 1) % 2 + 20, kSeqSyncWait, 0, 0, 0); } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { _s01_pigsIdCtr = (_s01_pigsIdCtr + 1) % 2; - _gameSys->setAnimation(0x7F, _s01_pigsIdCtr + 40, 2); - _gameSys->insertSequence(0x7F, _s01_pigsIdCtr + 40, + _vm->_gameSys->setAnimation(0x7F, _s01_pigsIdCtr + 40, 2); + _vm->_gameSys->insertSequence(0x7F, _s01_pigsIdCtr + 40, 0x7F, (_s01_pigsIdCtr + 1) % 2 + 40, kSeqSyncWait, 0, 0, 0); } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene01.h b/engines/gnap/scenes/scene01.h new file mode 100644 index 0000000000..b24ae53132 --- /dev/null +++ b/engines/gnap/scenes/scene01.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE01_H +#define GNAP_SCENE01_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene01: public Scene { +public: + Scene01(GnapEngine *vm); + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: + int _s01_pigsIdCtr, _s01_smokeIdCtr; + Graphics::Surface *_s01_spaceshipSurface; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE01_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index ba1ea40d21..104eea06e0 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -23,6 +23,9 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scenecore.h" + +#include "gnap/scenes/scene01.h" namespace Gnap { @@ -36,8 +39,9 @@ int GnapEngine::initSceneLogic() { _gameSys->setScaleValues(0, 500, 1, 1000); break; case 1: - backgroundId = scene01_init(); - scene01_updateHotspots(); + _scene = new Scene01(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -350,7 +354,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 8; break; case 1: - scene01_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 4; break; diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h new file mode 100644 index 0000000000..a97bf5c8e4 --- /dev/null +++ b/engines/gnap/scenes/scenecore.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENECORE_H +#define GNAP_SCENECORE_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; + +class Scene { +public: + Scene(GnapEngine *vm) : _vm(vm) {}; + ~Scene() {}; + + virtual int init() = 0; + virtual void updateHotspots() = 0; + virtual void run() = 0; + virtual void updateAnimations() = 0; + +protected: + GnapEngine *_vm; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENECORE_H -- cgit v1.2.3 From a176945b606197462bdd3cda157b295d298f986b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Apr 2016 21:10:12 +0200 Subject: GNAP: Refactor scene 0 --- engines/gnap/scenes/scene00.cpp | 89 ++++++++++++++++++++++------------------- engines/gnap/scenes/scene00.h | 46 +++++++++++++++++++++ 2 files changed, 93 insertions(+), 42 deletions(-) create mode 100644 engines/gnap/scenes/scene00.h diff --git a/engines/gnap/scenes/scene00.cpp b/engines/gnap/scenes/scene00.cpp index 7be508e674..9ee0eb38f2 100644 --- a/engines/gnap/scenes/scene00.cpp +++ b/engines/gnap/scenes/scene00.cpp @@ -25,14 +25,18 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene00.h" namespace Gnap { -int GnapEngine::scene00_init() { +Scene00::Scene00(GnapEngine *vm) : Scene(vm) { +} + +int Scene00::init() { return 0x37C; } -void GnapEngine::scene00_run() { +void Scene00::run() { const int animIdArr[] = { 0x356, 0x357, 0x358, 0x35A, 0x35F, 0x360, 0x361, 0x362, 0x363, 0x364, @@ -53,8 +57,9 @@ void GnapEngine::scene00_run() { int index = 0; bool skip = false; - hideCursor(); - _dat->open(1, "musop_n.dat"); + + _vm->hideCursor(); + _vm->_dat->open(1, "musop_n.dat"); Video::VideoDecoder *videoDecoder = new Video::AVIDecoder(); if (!videoDecoder->loadFile("hoffman.avi")) { @@ -68,17 +73,17 @@ void GnapEngine::scene00_run() { int vidPosY = (600 - videoDecoder->getHeight()) / 2; bool skipVideo = false; - screenEffect(1, 255, 255, 255); + _vm->screenEffect(1, 255, 255, 255); - while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { + while (!_vm->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { if (videoDecoder->needsUpdate()) { const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); if (frame) { if (frame->format.bytesPerPixel == 1) { - _system->copyRectToScreen(frame->getPixels(), frame->pitch, vidPosX, vidPosY, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, vidPosX, vidPosY, frame->w, frame->h); } else if (frame->format.bytesPerPixel != 4) { - Graphics::Surface *frame1 = frame->convertTo(_system->getScreenFormat()); - _system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); + Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getScreenFormat()); + _vm->_system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); frame1->free(); delete frame1; } else { @@ -95,12 +100,12 @@ void GnapEngine::scene00_run() { } } - Graphics::Surface *frame1 = frame->convertTo(_system->getScreenFormat()); - _system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); + Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getScreenFormat()); + _vm->_system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); frame1->free(); delete frame1; } - _system->updateScreen(); + _vm->_system->updateScreen(); } } @@ -111,66 +116,66 @@ void GnapEngine::scene00_run() { skipVideo = true; } - _system->delayMillis(10); + _vm->_system->delayMillis(10); } delete videoDecoder; - _gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _gameSys->insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x356, 2, 0); + _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); + _vm->_gameSys->insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x356, 2, 0); - while (!_sceneDone) { - gameUpdateTick(); + while (!_vm->_sceneDone) { + _vm->gameUpdateTick(); - if (_gameSys->getAnimationStatus(0) == 2 || skip ) { + if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip ) { skip = false; - _gameSys->requestClear2(false); - _gameSys->requestClear1(); + _vm->_gameSys->requestClear2(false); + _vm->_gameSys->requestClear1(); if ( index == 11 || index == 1 ) - screenEffect(0, 0, 0, 0); + _vm->screenEffect(0, 0, 0, 0); - _gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 0); if (++index >= 31) - _sceneDone = true; + _vm->_sceneDone = true; else { - _gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); if (index == 2) { - playSound(0x10000, false); - _gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); + _vm->playSound(0x10000, false); + _vm->_gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); } else if (index == 3) - _gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); else if (index == 12) - _gameSys->insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _gameSys->setAnimation(animIdArr[index], 2, 0); + _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); + _vm->_gameSys->setAnimation(animIdArr[index], 2, 0); if (index == 11) - stopSound(0x10000); + _vm->stopSound(0x10000); } } - if (isKeyStatus1(Common::KEYCODE_ESCAPE) || isKeyStatus1(Common::KEYCODE_SPACE) || isKeyStatus1(29)) { - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(Common::KEYCODE_SPACE); - clearKeyStatus1(29); + if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(29)) { + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(29); if (index == 0) { skip = true; - stopSound(0x3CF); + _vm->stopSound(0x3CF); } else if (index == 1) skip = true; else - _sceneDone = true; + _vm->_sceneDone = true; } } - stopSound(0x10000); + _vm->stopSound(0x10000); - _newSceneNum = 1; - _newCursorValue = 1; + _vm->_newSceneNum = 1; + _vm->_newCursorValue = 1; - _dat->open(1, "stock_n.dat"); + _vm->_dat->open(1, "stock_n.dat"); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene00.h b/engines/gnap/scenes/scene00.h new file mode 100644 index 0000000000..7edcab4207 --- /dev/null +++ b/engines/gnap/scenes/scene00.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE00_H +#define GNAP_SCENE00_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene00: public Scene { +public: + Scene00(GnapEngine *vm); + ~Scene00() {} + + virtual int init(); + virtual void updateHotspots() {} + virtual void run(); + virtual void updateAnimations() {} +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE00_H -- cgit v1.2.3 From 65f8a72b16e19a7c14528e918549bdbbfa79dac3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Apr 2016 21:10:45 +0200 Subject: GNAP: REfactor scene 2 --- engines/gnap/gnap.cpp | 3 - engines/gnap/gnap.h | 13 - engines/gnap/scenes/scene02.cpp | 554 +++++++++++++++++++------------------- engines/gnap/scenes/scene02.h | 52 ++++ engines/gnap/scenes/scenecore.cpp | 14 +- 5 files changed, 338 insertions(+), 298 deletions(-) create mode 100644 engines/gnap/scenes/scene02.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index dbe081c636..251ce55644 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2022,9 +2022,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 2 - _s02_truckGrillCtr = 0; - // Scene 3 _s03_nextPlatSequenceId = -1; _s03_platypusScared = false; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index a56df314b0..e62677136a 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,19 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 0 - int scene00_init(); - void scene00_run(); - - // Scene 2 - int _s02_truckGrillCtr; - int _s02_nextChickenSequenceId, _s02_currChickenSequenceId; - int _s02_gnapTruckSequenceId; - int scene02_init(); - void scene02_updateHotspots(); - void scene02_run(); - void scene02_updateAnimations(); - // Scene 3 bool _s03_platypusHypnotized; bool _s03_platypusScared; diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index d7b542545a..6d5991fa5c 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene02.h" namespace Gnap { @@ -58,132 +59,136 @@ enum { kASUseTwigWithChicken = 16 }; -int GnapEngine::scene02_init() { - _gameSys->setAnimation(0, 0, 0); - return isFlag(kGFTruckKeysUsed) ? 0x15A : 0x15B; +Scene02::Scene02(GnapEngine *vm) : Scene(vm) { + _s02_truckGrillCtr = 0; + _s02_nextChickenSequenceId = 0; + _s02_currChickenSequenceId = 0; + _s02_gnapTruckSequenceId = 0; } -void GnapEngine::scene02_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE); - setHotspot(kHSChicken, 606, 455, 702, 568, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - setHotspot(kHSTruck1, 385, 258, 464, 304, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 5); - setHotspot(kHSTruck2, 316, 224, 390, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 6); - setHotspot(kHSTruckGrill, 156, 318, 246, 390, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 7); - setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 5); - setHotspot(kHSExitBarn, 610, 0, 800, 164, SF_EXIT_U_CURSOR, 10, 5); - setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - setHotspot(kHSWalkArea1, 92, 140, 304, 430, 0, 3, 1); - setHotspot(kHSWalkArea2, 0, 0, 800, 380); - setHotspot(kHSWalkArea3, 0, 0, 386, 445); - setHotspot(kHSWalkArea4, 386, 0, 509, 410); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypus)) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _hotspotsCount = 14; +int Scene02::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + return _vm->isFlag(kGFTruckKeysUsed) ? 0x15A : 0x15B; } -void GnapEngine::scene02_run() { - playSound(0x1091C, true); - startSoundTimerC(6); +void Scene02::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE); + _vm->setHotspot(kHSChicken, 606, 455, 702, 568, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHSTruck1, 385, 258, 464, 304, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 5); + _vm->setHotspot(kHSTruck2, 316, 224, 390, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 6); + _vm->setHotspot(kHSTruckGrill, 156, 318, 246, 390, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 7); + _vm->setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 5); + _vm->setHotspot(kHSExitBarn, 610, 0, 800, 164, SF_EXIT_U_CURSOR, 10, 5); + _vm->setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHSWalkArea1, 92, 140, 304, 430, 0, 3, 1); + _vm->setHotspot(kHSWalkArea2, 0, 0, 800, 380); + _vm->setHotspot(kHSWalkArea3, 0, 0, 386, 445); + _vm->setHotspot(kHSWalkArea4, 386, 0, 509, 410); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 14; +} + +void Scene02::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(6); _s02_currChickenSequenceId = 0x14B; - _gameSys->setAnimation(0x14B, 179, 2); - _gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x14B, 179, 2); + _vm->_gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); _s02_nextChickenSequenceId = -1; - _timers[5] = getRandom(20) + 30; - _timers[4] = getRandom(100) + 300; + _vm->_timers[5] = _vm->getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(100) + 300; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 3: - initGnapPos(11, 6, kDirBottomLeft); - if (isFlag(kGFPlatypus)) - initPlatypusPos(12, 6, kDirUnk4); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(9, 6, -1, 0x107C2, 1); - gnapWalkTo(8, 6, -1, 0x107BA, 1); + _vm->initGnapPos(11, 6, kDirBottomLeft); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); + _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); break; case 4: - initGnapPos(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, kDirBottomLeft); - if (isFlag(kGFPlatypus)) - initPlatypusPos(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, kDirUnk4); - endSceneInit(); - gnapWalkTo(7, 6, 0, 0x107B9, 1); - if (isFlag(kGFPlatypus)) - platypusWalkTo(8, 6, 1, 0x107C2, 1); - scene02_updateHotspots(); - _gameSys->waitForUpdate(); + _vm->initGnapPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 6, 0, 0x107B9, 1); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(8, 6, 1, 0x107C2, 1); + updateHotspots(); + _vm->_gameSys->waitForUpdate(); break; case 47: - clearFlag(kGFUnk25); - initGnapPos(5, 6, kDirBottomLeft); - initPlatypusPos(6, 7, kDirUnk4); - endSceneInit(); + _vm->clearFlag(kGFUnk25); + _vm->initGnapPos(5, 6, kDirBottomLeft); + _vm->initPlatypusPos(6, 7, kDirUnk4); + _vm->endSceneInit(); break; case 49: - initGnapPos(5, 6, kDirBottomRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(6, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(5, 6, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(6, 7, kDirNone); + _vm->endSceneInit(); break; default: - initGnapPos(-1, 6, kDirBottomRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(-1, 7, kDirNone); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(2, 7, -1, 0x107C2, 1); - gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->initGnapPos(-1, 6, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); break; } - while (!_sceneDone) { - - updateMouseCursor(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - updateCursorByHotspot(); + _vm->testWalk(0, 6, 7, 6, 8, 6); - testWalk(0, 6, 7, 6, 8, 6); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene02_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { - if (_grabCursorSpriteIndex == kItemDisguise) { - gnapUseDisguiseOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFKeysTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -191,33 +196,33 @@ void GnapEngine::scene02_run() { break; case kHSChicken: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemTwig) { - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, - 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASUseTwigWithChicken; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y + 1, 9, 8); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTwig) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASUseTwigWithChicken; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(9, 8); + _vm->playGnapMoan2(9, 8); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirBottomRight; - if (gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _gnapActionStatus = kASGrabChicken; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kASGrabChicken; else - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case TALK_CURSOR: - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkChicken; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkChicken; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -226,45 +231,45 @@ void GnapEngine::scene02_run() { case kHSTruck1: case kHSTruck2: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemKeys) { - if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { - setGrabCursorSprite(-1); - invRemove(kItemKeys); - if (isFlag(kGFTruckFilledWithGas)) - _gnapActionStatus = kASUseTruckGas; + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemKeys) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemKeys); + if (_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_gnapActionStatus = kASUseTruckGas; else - _gnapActionStatus = kASUseTruckNoGas; + _vm->_gnapActionStatus = kASUseTruckNoGas; } - } else if (_grabCursorSpriteIndex == kItemGas) { - _hotspots[kHSWalkArea4]._flags |= SF_WALKABLE; - if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _gnapActionStatus = kASUseGasWithTruck; - _hotspots[kHSWalkArea4]._flags &= ~SF_WALKABLE; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 2, 2); + } else if (_vm->_grabCursorSpriteIndex == kItemGas) { + _vm->_hotspots[kHSWalkArea4]._flags |= SF_WALKABLE; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + _vm->_gnapActionStatus = kASUseGasWithTruck; + _vm->_hotspots[kHSWalkArea4]._flags &= ~SF_WALKABLE; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(2, 2); + _vm->playGnapScratchingHead(2, 2); break; case GRAB_CURSOR: - if (isFlag(kGFTruckKeysUsed)) { - if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { - if (isFlag(kGFTruckFilledWithGas)) - _gnapActionStatus = kASUseTruckGas; + if (_vm->isFlag(kGFTruckKeysUsed)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_gnapActionStatus = kASUseTruckGas; else - _gnapActionStatus = kASUseTruckNoGas; + _vm->_gnapActionStatus = kASUseTruckNoGas; } } else { - _gnapIdleFacing = kDirUnk4; - if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _gnapActionStatus = kASUseTruckNoKeys; + _vm->_gnapIdleFacing = kDirUnk4; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + _vm->_gnapActionStatus = kASUseTruckNoKeys; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -272,22 +277,22 @@ void GnapEngine::scene02_run() { break; case kHSTruckGrill: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 2, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(2, 4); + _vm->playGnapMoan2(2, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabTruckGrill; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabTruckGrill; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -295,48 +300,48 @@ void GnapEngine::scene02_run() { break; case kHSExitHouse: - if (_gnapActionStatus < 0) { - _isLeavingScene = 1; - gnapWalkTo(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 0, 0x107AD, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, -1, 0x107C1, 1); - scene02_updateHotspots(); - _newSceneNum = 4; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = 1; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, -1, 0x107C1, 1); + updateHotspots(); + _vm->_newSceneNum = 4; } break; case kHSExitBarn: - if (_gnapActionStatus < 0) { - _isLeavingScene = 1; - gnapWalkTo(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y, 0, 0x107AD, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[7].x + 1, _hotspotsWalkPos[7].y, -1, 0x107C1, 1); - scene02_updateHotspots(); - _newSceneNum = 5; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = 1; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7].x + 1, _vm->_hotspotsWalkPos[7].y, -1, 0x107C1, 1); + updateHotspots(); + _vm->_newSceneNum = 5; } break; case kHSExitCreek: - if (_gnapActionStatus < 0) { - _isLeavingScene = 1; - gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, -1, 0x107CD, 1); - _newSceneNum = 3; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = 1; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 3; } break; case kHSExitPigpen: - if (_gnapActionStatus < 0) { - _isLeavingScene = 1; - gnapWalkTo(_hotspotsWalkPos[9].x, _hotspotsWalkPos[9].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[9].x, _hotspotsWalkPos[9].y, -1, 0x107CF, 1); - _newSceneNum = 1; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = 1; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 1; } break; @@ -344,117 +349,113 @@ void GnapEngine::scene02_run() { case kHSWalkArea2: case kHSWalkArea3: case kHSWalkArea4: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene02_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, true); + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[4]) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { // Update bird animation - _timers[4] = getRandom(100) + 300; - if (getRandom(2) != 0) - _gameSys->insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[5] && _s02_nextChickenSequenceId == -1 && _gnapActionStatus != 7 && _gnapActionStatus != 8) { - if (getRandom(6) != 0) { + if (!_vm->_timers[5] && _s02_nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { + if (_vm->getRandom(6) != 0) { _s02_nextChickenSequenceId = 0x14B; - _timers[5] = getRandom(20) + 30; + _vm->_timers[5] = _vm->getRandom(20) + 30; } else { _s02_nextChickenSequenceId = 0x14D; - _timers[5] = getRandom(20) + 50; + _vm->_timers[5] = _vm->getRandom(20) + 50; } } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene02_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene02_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - switch (_gnapActionStatus) { +void Scene02::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { case kASUseTruckNoKeys: - _gameSys->insertSequence(0x14E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x14E, _gnapId, 0); - _gnapSequenceId = 0x14E; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASUseTruckNoKeysDone; + _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x14E, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x14E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASUseTruckNoKeysDone; break; case kASUseGasWithTruck: - _gameSys->insertSequence(0x151, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x151, _gnapId, 0); - _gnapSequenceId = 0x151; - _gnapSequenceDatNum = 0; - invRemove(kItemGas); - setGrabCursorSprite(-1); - setFlag(kGFTruckFilledWithGas); - _gnapActionStatus = kASUseGasWithTruckDone; + _vm->_gameSys->insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x151, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x151; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemGas); + _vm->setGrabCursorSprite(-1); + _vm->setFlag(kGFTruckFilledWithGas); + _vm->_gnapActionStatus = kASUseGasWithTruckDone; break; case kASUseTruckGas: - _timers[5] = 9999; - _timers[4] = 9999; - hideCursor(); - setGrabCursorSprite(-1); - if (!isFlag(kGFTruckKeysUsed)) { - _gameSys->insertSequence(0x14F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->waitForUpdate(); - setFlag(kGFTruckKeysUsed); - _gnapSequenceId = 0x14F; - _gnapSequenceDatNum = 0; - invRemove(kItemKeys); - setGrabCursorSprite(-1); + _vm->_timers[5] = 9999; + _vm->_timers[4] = 9999; + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + if (!_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->waitForUpdate(); + _vm->setFlag(kGFTruckKeysUsed); + _vm->_gnapSequenceId = 0x14F; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemKeys); + _vm->setGrabCursorSprite(-1); } - _newSceneNum = 47; - _sceneDone = true; + _vm->_newSceneNum = 47; + _vm->_sceneDone = true; break; case kASUseTruckNoGas: - hideCursor(); - setGrabCursorSprite(-1); - _timers[4] = 250; - if (!isFlag(kGFTruckKeysUsed)) { - _gameSys->insertSequence(0x14F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->waitForUpdate(); - setFlag(kGFTruckKeysUsed); - _gnapSequenceId = 0x14F; - _gnapSequenceDatNum = 0; - invRemove(kItemKeys); - setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->_timers[4] = 250; + if (!_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->waitForUpdate(); + _vm->setFlag(kGFTruckKeysUsed); + _vm->_gnapSequenceId = 0x14F; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemKeys); + _vm->setGrabCursorSprite(-1); } - _newSceneNum = 47; - _sceneDone = true; - setFlag(kGFUnk25); + _vm->_newSceneNum = 47; + _vm->_sceneDone = true; + _vm->setFlag(kGFUnk25); break; case kASGrabTruckGrill: switch (_s02_truckGrillCtr) { @@ -469,70 +470,69 @@ void GnapEngine::scene02_updateAnimations() { break; } _s02_truckGrillCtr = (_s02_truckGrillCtr + 1) % 3; - _gameSys->insertSequence(_s02_gnapTruckSequenceId, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s02_gnapTruckSequenceId, _gnapId, 0); - _gnapSequenceId = _s02_gnapTruckSequenceId; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(_s02_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s02_gnapTruckSequenceId, _vm->_gnapId, 0); + _vm->_gnapSequenceId = _s02_gnapTruckSequenceId; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASTalkChicken: _s02_nextChickenSequenceId = 0x14C; break; case kASGrabChicken: _s02_nextChickenSequenceId = 0x150; - _timers[2] = 100; + _vm->_timers[2] = 100; break; case kASGrabChickenDone: - _gameSys->insertSequence(0x107B5, _gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; _s02_currChickenSequenceId = 0x14B; - _gameSys->setAnimation(0x14B, 179, 2); - _gameSys->insertSequence(_s02_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = -1; - _timers[5] = 30; + _vm->_gameSys->setAnimation(0x14B, 179, 2); + _vm->_gameSys->insertSequence(_s02_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->_timers[5] = 30; break; case kASUseTwigWithChicken: - playGnapShowItem(5, 0, 0); - _gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); + _vm->playGnapShowItem(5, 0, 0); + _vm->_gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _s02_currChickenSequenceId = 0x155; _s02_nextChickenSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASUseTruckNoKeysDone: case kASUseGasWithTruckDone: default: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { if (_s02_nextChickenSequenceId == 0x150) { - _gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 0); - _gameSys->insertSequence(_s02_nextChickenSequenceId, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(_s02_currChickenSequenceId, 179, true); + _vm->_gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 0); + _vm->_gameSys->insertSequence(_s02_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(_s02_currChickenSequenceId, 179, true); _s02_nextChickenSequenceId = -1; _s02_currChickenSequenceId = -1; - _gnapActionStatus = kASGrabChickenDone; - _timers[5] = 500; + _vm->_gnapActionStatus = kASGrabChickenDone; + _vm->_timers[5] = 500; } else if (_s02_nextChickenSequenceId == 0x14C) { - _gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); - _gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _s02_currChickenSequenceId = _s02_nextChickenSequenceId; _s02_nextChickenSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } else if (_s02_nextChickenSequenceId != -1) { - _gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); - _gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _s02_currChickenSequenceId = _s02_nextChickenSequenceId; _s02_nextChickenSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene02.h b/engines/gnap/scenes/scene02.h new file mode 100644 index 0000000000..70f0591bcc --- /dev/null +++ b/engines/gnap/scenes/scene02.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE02_H +#define GNAP_SCENE02_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene02: public Scene { +public: + Scene02(GnapEngine *vm); + ~Scene02() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: + int _s02_truckGrillCtr; + int _s02_nextChickenSequenceId; + int _s02_currChickenSequenceId; + int _s02_gnapTruckSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE02_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 104eea06e0..7d37793e48 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -25,6 +25,7 @@ #include "gnap/resource.h" #include "gnap/scenes/scenecore.h" +#include "gnap/scenes/scene00.h" #include "gnap/scenes/scene01.h" namespace Gnap { @@ -35,7 +36,8 @@ int GnapEngine::initSceneLogic() { switch (_currentSceneNum) { case 0: - backgroundId = scene00_init(); + _scene = new Scene00(this); + backgroundId = _scene->init(); _gameSys->setScaleValues(0, 500, 1, 1000); break; case 1: @@ -46,8 +48,8 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 2: - backgroundId = scene02_init(); - scene02_updateHotspots(); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -349,7 +351,8 @@ int GnapEngine::initSceneLogic() { void GnapEngine::runSceneLogic() { switch (_currentSceneNum) { case 0: - scene00_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 8; break; @@ -360,7 +363,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 4; break; case 2: - scene02_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 4; break; -- cgit v1.2.3 From 880bc07ae1dd18049078ad664ff5fb3c932d0fb6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Apr 2016 21:11:47 +0200 Subject: GNAP: Add destructor to scene 1 --- engines/gnap/scenes/scene01.cpp | 4 ++++ engines/gnap/scenes/scene01.h | 1 + 2 files changed, 5 insertions(+) diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index be104a2649..39d21fc320 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -59,6 +59,10 @@ Scene01::Scene01(GnapEngine *vm) : Scene(vm) { _s01_spaceshipSurface = nullptr; } +Scene01::~Scene01() { + delete _s01_spaceshipSurface; +} + int Scene01::init() { _vm->_gameSys->setAnimation(0, 0, 0); _vm->_gameSys->setAnimation(0, 0, 3); diff --git a/engines/gnap/scenes/scene01.h b/engines/gnap/scenes/scene01.h index b24ae53132..e7d3a335b2 100644 --- a/engines/gnap/scenes/scene01.h +++ b/engines/gnap/scenes/scene01.h @@ -33,6 +33,7 @@ class GnapEngine; class Scene01: public Scene { public: Scene01(GnapEngine *vm); + ~Scene01(); virtual int init(); virtual void updateHotspots(); -- cgit v1.2.3 From 55618fa005b40cbbed75cbee30f7513ec5fd6d94 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Apr 2016 21:20:49 +0200 Subject: GNAP: Enforce the use of boolean values for _isLeavingScene --- engines/gnap/scenes/scene02.cpp | 8 ++++---- engines/gnap/scenes/scene03.cpp | 2 +- engines/gnap/scenes/scene04.cpp | 4 ++-- engines/gnap/scenes/scene06.cpp | 2 +- engines/gnap/scenes/scene07.cpp | 1 - engines/gnap/scenes/scene08.cpp | 4 ++-- engines/gnap/scenes/scene09.cpp | 4 ++-- engines/gnap/scenes/scene10.cpp | 4 ++-- engines/gnap/scenes/scene12.cpp | 4 ++-- engines/gnap/scenes/scene13.cpp | 2 +- engines/gnap/scenes/scene18.cpp | 6 +++--- engines/gnap/scenes/scene20.cpp | 10 +++++----- engines/gnap/scenes/scene21.cpp | 2 +- engines/gnap/scenes/scene22.cpp | 4 ++-- engines/gnap/scenes/scene27.cpp | 2 +- engines/gnap/scenes/scene31.cpp | 4 ++-- engines/gnap/scenes/scene43.cpp | 10 +++++----- engines/gnap/scenes/scene44.cpp | 10 +++++----- engines/gnap/scenes/scene45.cpp | 10 +++++----- engines/gnap/scenes/scene46.cpp | 10 +++++----- 20 files changed, 51 insertions(+), 52 deletions(-) diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index 6d5991fa5c..47ac5578d0 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -301,7 +301,7 @@ void Scene02::run() { case kHSExitHouse: if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = 1; + _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 0, 0x107AD, 1); _vm->_gnapActionStatus = kASLeaveScene; if (_vm->isFlag(kGFPlatypus)) @@ -313,7 +313,7 @@ void Scene02::run() { case kHSExitBarn: if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = 1; + _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, 0x107AD, 1); _vm->_gnapActionStatus = kASLeaveScene; if (_vm->isFlag(kGFPlatypus)) @@ -325,7 +325,7 @@ void Scene02::run() { case kHSExitCreek: if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = 1; + _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); _vm->_gnapActionStatus = kASLeaveScene; if (_vm->isFlag(kGFPlatypus)) @@ -336,7 +336,7 @@ void Scene02::run() { case kHSExitPigpen: if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = 1; + _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, 0, 0x107AF, 1); _vm->_gnapActionStatus = kASLeaveScene; if (_vm->isFlag(kGFPlatypus)) diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index c5af2f3e7d..77a9adefaa 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -193,7 +193,7 @@ void GnapEngine::scene03_run() { case kHSExitTruck: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107AD, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index a233152242..cbe5d05034 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -321,7 +321,7 @@ void GnapEngine::scene04_run() { case kHSExitTruck: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; if (isFlag(kGFPlatypus)) @@ -365,7 +365,7 @@ void GnapEngine::scene04_run() { case kHSExitBarn: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; if (isFlag(kGFPlatypus)) diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index a07c218f00..f908b1d25a 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -262,7 +262,7 @@ void GnapEngine::scene06_run() { case kHSExitOutsideBarn: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; if (_cursorValue == 1) diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index 3d392d6b74..953dbeb1e0 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -59,7 +59,6 @@ void GnapEngine::scene07_updateHotspots() { } void GnapEngine::scene07_run() { - queueInsertDeviceIcon(); _gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); _gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index f31c05d0c3..ca777aa11e 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -176,7 +176,7 @@ void GnapEngine::scene08_run() { break; case kHSExitBackdoor: - _isLeavingScene = 1; + _isLeavingScene = true; gnapActionIdle(0x14D); gnapWalkTo(0, 6, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; @@ -185,7 +185,7 @@ void GnapEngine::scene08_run() { break; case kHSExitCrash: - _isLeavingScene = 1; + _isLeavingScene = true; gnapActionIdle(0x14D); gnapWalkTo(3, 9, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 7d9a4a9576..4183b34738 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -123,7 +123,7 @@ void GnapEngine::scene09_run() { break; case kHSExitKitchen: - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 10; gnapWalkTo(4, 7, 0, 0x107BF, 1); _gnapActionStatus = kASLeaveScene; @@ -132,7 +132,7 @@ void GnapEngine::scene09_run() { break; case kHSExitHouse: - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 8; gnapWalkTo(10, -1, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index b750ea4ed4..311045db6c 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -144,7 +144,7 @@ void GnapEngine::scene10_run() { break; case kHSExitBar: - _isLeavingScene = 1; + _isLeavingScene = true; gnapActionIdle(0x10C); gnapWalkTo(0, 7, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; @@ -153,7 +153,7 @@ void GnapEngine::scene10_run() { break; case kHSExitBackdoor: - _isLeavingScene = 1; + _isLeavingScene = true; gnapActionIdle(0x10C); gnapWalkTo(2, 9, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index a60e6a2dfa..4d3958cdbf 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -160,7 +160,7 @@ void GnapEngine::scene12_run() { break; case kHSExitRight: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(10, -1, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(10, -1, -1, -1, 1); @@ -282,7 +282,7 @@ void GnapEngine::scene12_run() { case kHSJukebox: _newSceneNum = 15; - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(5, 6, 0, 0x107BC, 1); _gnapActionStatus = kASLeaveScene; break; diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 007c3806b5..d832927978 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -161,7 +161,7 @@ void GnapEngine::scene13_run() { break; case kHSExitBar: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(2, 7, 0, 0x107C0, 1); _gnapActionStatus = kASLeaveScene; platypusWalkTo(2, 8, -1, -1, 1); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 0e8065cc33..c88f7b28f5 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -638,7 +638,7 @@ void GnapEngine::scene18_run() { if (isFlag(kGFPictureTaken)) { playGnapImpossible(0, 0); } else { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 19; gnapWalkTo(_hotspotsWalkPos[kHSExitToyStore].x, _hotspotsWalkPos[kHSExitToyStore].y, 0, 0x107C0, 1); _gnapActionStatus = kASLeaveScene; @@ -655,7 +655,7 @@ void GnapEngine::scene18_run() { scene18_putDownGarbageCan(0); } scene18_closeHydrantValve(); - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 17; gnapWalkTo(_hotspotsWalkPos[kHSExitPhoneBooth].x, _hotspotsWalkPos[kHSExitPhoneBooth].y, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; @@ -673,7 +673,7 @@ void GnapEngine::scene18_run() { scene18_putDownGarbageCan(0); } scene18_closeHydrantValve(); - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 20; _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 7982b076ec..54a8438345 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -324,7 +324,7 @@ void GnapEngine::scene20_run() { if (_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) _timers[4] = 0; - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 21; gnapWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; @@ -337,7 +337,7 @@ void GnapEngine::scene20_run() { if (_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) _timers[4] = 0; - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 17; gnapWalkTo(_hotspotsWalkPos[kHSExitPhone].x, _hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; @@ -349,7 +349,7 @@ void GnapEngine::scene20_run() { if (_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) _timers[4] = 0; - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 18; _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); @@ -363,7 +363,7 @@ void GnapEngine::scene20_run() { if (_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) _timers[4] = 0; - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 22; gnapWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x, _hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); _gnapActionStatus = kASLeaveScene; @@ -376,7 +376,7 @@ void GnapEngine::scene20_run() { if (_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) _timers[4] = 0; - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 24; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index b04c8c92b5..fcc7f51ecd 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -206,7 +206,7 @@ void GnapEngine::scene21_run() { case kHSExitOutsideGrubCity: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 20; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107B3, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index 80f3843f30..364e42f03d 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -162,7 +162,7 @@ void GnapEngine::scene22_run() { case kHSExitOutsideGrubCity: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 20; gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; @@ -172,7 +172,7 @@ void GnapEngine::scene22_run() { case kHSExitBackGrubCity: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 23; gnapWalkTo(_hotspotsWalkPos[kHSExitBackGrubCity].x, _hotspotsWalkPos[kHSExitBackGrubCity].y, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 2c5a8f1174..881007e634 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -235,7 +235,7 @@ void GnapEngine::scene27_run() { case kHSExitBeerStand: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 31; gnapWalkTo(-1, _hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107AB, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 027a4b5d80..7a58c4de28 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -216,7 +216,7 @@ void GnapEngine::scene31_run() { case kHSExitCircus: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 26; gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); _gnapActionStatus = kASLeaveScene; @@ -226,7 +226,7 @@ void GnapEngine::scene31_run() { case kHSExitOutsideClown: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _newSceneNum = 27; gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AF, 1); _gnapActionStatus = kASLeaveScene; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index e371d4aa6b..5f74dfae35 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -166,7 +166,7 @@ void GnapEngine::scene43_run() { case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 4; _newSceneNum = 42; toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); @@ -175,7 +175,7 @@ void GnapEngine::scene43_run() { case kHSUfoExitRight: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 4; _newSceneNum = 44; toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); @@ -231,7 +231,7 @@ void GnapEngine::scene43_run() { break; case kHSExitUfoParty: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); @@ -239,7 +239,7 @@ void GnapEngine::scene43_run() { break; case kHSExitBBQ: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, _gnapY, 0, 0x107AF, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, _hotspotsWalkPos[kHSExitBBQ].y, -1, 0x107CF, 1); @@ -247,7 +247,7 @@ void GnapEngine::scene43_run() { break; case kHSExitKissinBooth: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _gnapY, 0, 0x107AB, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _hotspotsWalkPos[kHSExitKissinBooth].y, -1, 0x107CD, 1); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 5b53f114ec..ffd639d2e5 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -183,7 +183,7 @@ void GnapEngine::scene44_run() { switch (_sceneClickedHotspot) { case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 6; _newSceneNum = 43; toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); @@ -192,7 +192,7 @@ void GnapEngine::scene44_run() { case kHSUfoExitRight: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 6; _newSceneNum = 46; toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); @@ -242,14 +242,14 @@ void GnapEngine::scene44_run() { break; case kHSExitUfoParty: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); _gnapActionStatus = 0; _newSceneNum = 40; break; case kHSExitUfo: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _gnapY, 0, 0x107AF, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _platY, -1, 0x107CF, 1); @@ -257,7 +257,7 @@ void GnapEngine::scene44_run() { break; case kHSExitShow: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitShow].x, _hotspotsWalkPos[kHSExitShow].y, 0, 0x107AB, 1); _gnapActionStatus = 0; _newSceneNum = 46; diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index e8d421405a..1a875060a7 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -197,7 +197,7 @@ void GnapEngine::scene45_run() { case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 2; _newSceneNum = 46; toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 5); @@ -206,7 +206,7 @@ void GnapEngine::scene45_run() { case kHSUfoExitRight: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 2; _newSceneNum = 41; toyUfoFlyTo(835, -1, 0, 835, 0, 300, 5); @@ -257,7 +257,7 @@ void GnapEngine::scene45_run() { case kHSExitUfoParty: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); _gnapActionStatus = 0; _newSceneNum = 40; @@ -266,7 +266,7 @@ void GnapEngine::scene45_run() { case kHSExitShoe: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitShoe].x, _gnapY, 0, 0x107AF, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitShoe].x, _platY, -1, 0x107CF, 1); @@ -276,7 +276,7 @@ void GnapEngine::scene45_run() { case kHSExitRight: if (_gnapActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitRight].x, _gnapY, 0, 0x107AB, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitRight].x, _platY, -1, 0x107CD, 1); diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 26a3be0b34..0f26181093 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -141,7 +141,7 @@ void GnapEngine::scene46_run() { case kHSUfoExitLeft: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 3; _newSceneNum = 44; toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); @@ -150,7 +150,7 @@ void GnapEngine::scene46_run() { case kHSUfoExitRight: if (_toyUfoActionStatus < 0) { - _isLeavingScene = 1; + _isLeavingScene = true; _toyUfoActionStatus = 3; _newSceneNum = 45; toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); @@ -236,14 +236,14 @@ void GnapEngine::scene46_run() { break; case kHSExitUfoParty: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); _gnapActionStatus = 0; _newSceneNum = 40; break; case kHSExitKissinBooth: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _gnapY, 0, 0x107AF, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _platY, -1, 0x107CF, 1); @@ -251,7 +251,7 @@ void GnapEngine::scene46_run() { break; case kHSExitDisco: - _isLeavingScene = 1; + _isLeavingScene = true; gnapWalkTo(_hotspotsWalkPos[kHSExitDisco].x, _gnapY, 0, 0x107AB, 1); _gnapActionStatus = 0; platypusWalkTo(_hotspotsWalkPos[kHSExitDisco].x, _platY, -1, 0x107CD, 1); -- cgit v1.2.3 From 7a6c02ca0470023ae57a1775dbc347ff5f62be1b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Apr 2016 22:10:40 +0200 Subject: GNAP: Refactor scene 3 --- engines/gnap/gnap.cpp | 5 - engines/gnap/gnap.h | 10 - engines/gnap/scenes/scene03.cpp | 547 +++++++++++++++++++------------------- engines/gnap/scenes/scene03.h | 53 ++++ engines/gnap/scenes/scenecore.cpp | 20 +- 5 files changed, 340 insertions(+), 295 deletions(-) create mode 100644 engines/gnap/scenes/scene03.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 251ce55644..cb5c889a6e 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2022,11 +2022,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 3 - _s03_nextPlatSequenceId = -1; - _s03_platypusScared = false; - _s03_platypusHypnotized = false; - // Scene 4 _s04_dogIdCtr = 0; //_s04_triedWindow = true;//?? diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index e62677136a..b6e7425082 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,16 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 3 - bool _s03_platypusHypnotized; - bool _s03_platypusScared; - int _s03_nextPlatSequenceId; - int _s03_nextFrogSequenceId, _s03_currFrogSequenceId; - int scene03_init(); - void scene03_updateHotspots(); - void scene03_run(); - void scene03_updateAnimations(); - // Scene 4 bool _s04_triedWindow; int _s04_dogIdCtr; diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 77a9adefaa..2bcbe40a8f 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -23,7 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" - +#include "gnap/scenes/scene03.h" namespace Gnap { enum { @@ -51,113 +51,118 @@ enum { kASGrabScaredPlatypus = 8 }; -int GnapEngine::scene03_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 5); +Scene03::Scene03(GnapEngine *vm) : Scene(vm) { + _s03_nextPlatSequenceId = -1; + _s03_platypusScared = false; + _s03_platypusHypnotized = false; + _s03_nextFrogSequenceId = -1; + _s03_currFrogSequenceId = -1; +} + +int Scene03::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 5); return 0x1CC; } -void GnapEngine::scene03_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSGrass, 646, 408, 722, 458, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); - setHotspot(kHSExitTruck, 218, 64, 371, 224, SF_EXIT_U_CURSOR | SF_WALKABLE, 4, 4); - setHotspot(kHSCreek, 187, 499, 319, 587, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - setHotspot(kHSTrappedPlatypus, 450, 256, 661, 414, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 5); - setHotspot(kHSWalkAreas1, 0, 500, 300, 600); - setHotspot(kHSWalkAreas2, 300, 447, 800, 600); - setHotspot(kHSPlatypusWalkArea, 235, 0, 800, 600); - setHotspot(kHSWalkAreas3, 0, 0, 800, 354); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypus)) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(kGFGrassTaken)) - _hotspots[kHSGrass]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(kGFPlatypus)) - _hotspots[kHSTrappedPlatypus]._flags = SF_DISABLED; - if (isFlag(kGFPlatypus) || _s03_platypusHypnotized) - _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; - _hotspotsCount = 10; +void Scene03::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSGrass, 646, 408, 722, 458, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + _vm->setHotspot(kHSExitTruck, 218, 64, 371, 224, SF_EXIT_U_CURSOR | SF_WALKABLE, 4, 4); + _vm->setHotspot(kHSCreek, 187, 499, 319, 587, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHSTrappedPlatypus, 450, 256, 661, 414, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 5); + _vm->setHotspot(kHSWalkAreas1, 0, 500, 300, 600); + _vm->setHotspot(kHSWalkAreas2, 300, 447, 800, 600); + _vm->setHotspot(kHSPlatypusWalkArea, 235, 0, 800, 600); + _vm->setHotspot(kHSWalkAreas3, 0, 0, 800, 354); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFGrassTaken)) + _vm->_hotspots[kHSGrass]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSTrappedPlatypus]._flags = SF_DISABLED; + if (_vm->isFlag(kGFPlatypus) || _s03_platypusHypnotized) + _vm->_hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; + _vm->_hotspotsCount = 10; } -void GnapEngine::scene03_run() { - playSound(0x10925, true); - - startSoundTimerC(7); +void Scene03::run() { + _vm->playSound(0x10925, true); + _vm->startSoundTimerC(7); - _gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); _s03_platypusHypnotized = false; - initGnapPos(3, 4, kDirBottomRight); + _vm->initGnapPos(3, 4, kDirBottomRight); - _gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); _s03_currFrogSequenceId = 0x1C6; _s03_nextFrogSequenceId = -1; - _gameSys->setAnimation(0x1C6, 253, 2); + _vm->_gameSys->setAnimation(0x1C6, 253, 2); - _timers[6] = getRandom(20) + 30; - _timers[4] = getRandom(100) + 300; - _timers[5] = getRandom(100) + 200; + _vm->_timers[6] = _vm->getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(100) + 300; + _vm->_timers[5] = _vm->getRandom(100) + 200; - if (isFlag(kGFPlatypus)) { - initPlatypusPos(5, 4, kDirNone); + if (_vm->isFlag(kGFPlatypus)) { + _vm->initPlatypusPos(5, 4, kDirNone); } else { - _timers[1] = getRandom(40) + 20; - _gameSys->setAnimation(0x1C2, 99, 1); - _gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); - _platypusSequenceId = 0x1C2; - _platypusSequenceDatNum = 0; + _vm->_timers[1] = _vm->getRandom(40) + 20; + _vm->_gameSys->setAnimation(0x1C2, 99, 1); + _vm->_gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x1C2; + _vm->_platypusSequenceDatNum = 0; } - _gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); - - if (!isFlag(kGFGrassTaken)) - _gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + if (!_vm->isFlag(kGFGrassTaken)) + _vm->_gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(4, 7, -1, 0x107C2, 1); - gnapWalkTo(3, 6, -1, 0x107B9, 1); + _vm->endSceneInit(); - while (!_sceneDone) { + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(4, 7, -1, 0x107C2, 1); + _vm->gnapWalkTo(3, 6, -1, 0x107B9, 1); - updateMouseCursor(); - updateCursorByHotspot(); - - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { - if (_grabCursorSpriteIndex == kItemDisguise) { - gnapUseDisguiseOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFKeysTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -165,26 +170,26 @@ void GnapEngine::scene03_run() { break; case kHSGrass: - if (_gnapActionStatus < 0) { - if (isFlag(kGFGrassTaken)) { - gnapWalkTo(-1, -1, -1, -1, 1); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 9, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(9, 6); + _vm->playGnapScratchingHead(9, 6); break; case GRAB_CURSOR: - playGnapPullOutDevice(9, 6); - playGnapUseDevice(0, 0); - _gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x1B3, 253, 5); - _hotspots[kHSGrass]._flags |= SF_WALKABLE | SF_DISABLED; + _vm->playGnapPullOutDevice(9, 6); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1B3, 253, 5); + _vm->_hotspots[kHSGrass]._flags |= SF_WALKABLE | SF_DISABLED; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -192,41 +197,41 @@ void GnapEngine::scene03_run() { break; case kHSExitTruck: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107AD, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, -1, 0x107C2, 1); - _hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; - if (_cursorValue == 1) - _newSceneNum = 2; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, -1, 0x107C2, 1); + _vm->_hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 2; else - _newSceneNum = 33; + _vm->_newSceneNum = 33; } break; case kHSCreek: - if (_gnapActionStatus == -1) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus == -1) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(2, 8); + _vm->playGnapMoan2(2, 8); break; case GRAB_CURSOR: - if (!isFlag(kGFPlatypus)) - _hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; - if (gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y + 1) | 0x10000, 1)) - _gnapActionStatus = kASGrabCreek; - if (!isFlag(kGFPlatypus)) - _hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; + if (!_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) + _vm->_gnapActionStatus = kASGrabCreek; + if (!_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -234,42 +239,42 @@ void GnapEngine::scene03_run() { break; case kHSTrappedPlatypus: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatypus)) { - gnapWalkTo(-1, -1, -1, -1, 1); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 8, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatypus)) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(8, 4); + _vm->playGnapScratchingHead(8, 4); break; case GRAB_CURSOR: if (_s03_platypusHypnotized) { - gnapWalkTo(7, 6, 0, 0x107B5, 1); - _gnapActionStatus = kASFreePlatypus; + _vm->gnapWalkTo(7, 6, 0, 0x107B5, 1); + _vm->_gnapActionStatus = kASFreePlatypus; } else { - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_s03_platypusScared) - _gnapActionStatus = kASGrabScaredPlatypus; + _vm->_gnapActionStatus = kASGrabScaredPlatypus; else - _gnapActionStatus = kASGrabPlatypus; + _vm->_gnapActionStatus = kASGrabPlatypus; } break; case TALK_CURSOR: if (_s03_platypusHypnotized) { - playGnapBrainPulsating(8, 4); + _vm->playGnapBrainPulsating(8, 4); } else { - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_s03_platypusScared) - _gnapActionStatus = kASHypnotizeScaredPlat; + _vm->_gnapActionStatus = kASHypnotizeScaredPlat; else - _gnapActionStatus = kASHypnotizePlat; + _vm->_gnapActionStatus = kASHypnotizePlat; } break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -277,160 +282,157 @@ void GnapEngine::scene03_run() { break; case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene03_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSWalkAreas1: case kHSWalkAreas2: case kHSWalkAreas3: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHSPlatypusWalkArea: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatypus) || _s03_platypusHypnotized) { - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatypus) || _s03_platypusHypnotized) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } else { - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107B5, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107B5, 1); if (_s03_platypusScared) - _gnapActionStatus = kASGrabScaredPlatypus; + _vm->_gnapActionStatus = kASGrabScaredPlatypus; else - _gnapActionStatus = kASGrabPlatypus; + _vm->_gnapActionStatus = kASGrabPlatypus; } } break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene03_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10925)) - playSound(0x10925, true); + if (!_vm->isSoundPlaying(0x10925)) + _vm->playSound(0x10925, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[1] && !_s03_platypusScared) { - _timers[1] = getRandom(40) + 20; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && !isFlag(kGFPlatypus) && !_s03_platypusHypnotized) + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[1] && !_s03_platypusScared) { + _vm->_timers[1] = _vm->getRandom(40) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_s03_platypusHypnotized) _s03_nextPlatSequenceId = 450; } - if (!_timers[6]) { - _timers[6] = getRandom(20) + 30; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s03_nextFrogSequenceId == -1) { - if (getRandom(5) == 1) + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(20) + 30; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s03_nextFrogSequenceId == -1) { + if (_vm->getRandom(5) == 1) _s03_nextFrogSequenceId = 0x1C6; else _s03_nextFrogSequenceId = 0x1C7; } } - if (!_timers[4]) { + if (!_vm->_timers[4]) { // Update bird animation - _timers[4] = getRandom(100) + 300; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) - _gameSys->insertSequence(getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + _vm->_gameSys->insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[5]) { - _timers[5] = getRandom(100) + 200; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { - _gameSys->setAnimation(0x1C5, 253, 4); - _gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 200; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + _vm->_gameSys->setAnimation(0x1C5, 253, 4); + _vm->_gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene03_updateHotspots(); - _timers[5] = getRandom(100) + 200; - _timers[4] = getRandom(100) + 300; - _timers[6] = getRandom(20) + 30; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(100) + 200; + _vm->_timers[4] = _vm->getRandom(100) + 300; + _vm->_timers[6] = _vm->getRandom(20) + 30; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene03_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene03::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASFreePlatypus: _s03_nextPlatSequenceId = 0x1BC; break; case kASFreePlatypusDone: - _gnapActionStatus = -1; - _platX = 6; - _platY = 6; - _platypusFacing = kDirUnk4; - _platypusId = 120; - _gameSys->insertSequence(0x107CA, _platypusId, 0x1BC, 99, - kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); - _platypusSequenceDatNum = 1; - _platypusSequenceId = 0x7CA; - setFlag(kGFPlatypus); + _vm->_gnapActionStatus = -1; + _vm->_platX = 6; + _vm->_platY = 6; + _vm->_platypusFacing = kDirUnk4; + _vm->_platypusId = 120; + _vm->_gameSys->insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, + kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + _vm->_gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceDatNum = 1; + _vm->_platypusSequenceId = 0x7CA; + _vm->setFlag(kGFPlatypus); _s03_nextPlatSequenceId = -1; - scene03_updateHotspots(); + updateHotspots(); break; case kASHypnotizePlat: - playGnapBrainPulsating(0, 0); - addFullScreenSprite(0x106, 255); - _gameSys->setAnimation(0x1C9, 256, 1); - _gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(1) != 2) - gameUpdateTick(); - removeFullScreenSprite(); - _gameSys->setAnimation(0x1BA, 99, 1); - _gameSys->insertSequence(0x1BA, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x1BA; - _gnapActionStatus = -1; + _vm->playGnapBrainPulsating(0, 0); + _vm->addFullScreenSprite(0x106, 255); + _vm->_gameSys->setAnimation(0x1C9, 256, 1); + _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->_gameSys->setAnimation(0x1BA, 99, 1); + _vm->_gameSys->insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x1BA; + _vm->_gnapActionStatus = -1; _s03_platypusHypnotized = true; - scene03_updateHotspots(); + updateHotspots(); break; case kASHypnotizeScaredPlat: - playGnapBrainPulsating(0, 0); - _gameSys->insertSequence(0x1BF, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _gameSys->setAnimation(0x1BF, 99, 1); - while (_gameSys->getAnimationStatus(1) != 2) - gameUpdateTick(); - addFullScreenSprite(0x106, 255); - _gameSys->setAnimation(0x1C9, 256, 1); - _gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(1) != 2) - gameUpdateTick(); - removeFullScreenSprite(); - _gameSys->setAnimation(0x1BA, 99, 1); - _gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x1BA; - _gnapActionStatus = -1; + _vm->playGnapBrainPulsating(0, 0); + _vm->_gameSys->insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1BF, 99, 1); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->addFullScreenSprite(0x106, 255); + _vm->_gameSys->setAnimation(0x1C9, 256, 1); + _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->_gameSys->setAnimation(0x1BA, 99, 1); + _vm->_gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x1BA; + _vm->_gnapActionStatus = -1; _s03_platypusHypnotized = true; - scene03_updateHotspots(); + updateHotspots(); break; case kASGrabPlatypus: _s03_nextPlatSequenceId = 0x1BD; @@ -441,76 +443,75 @@ void GnapEngine::scene03_updateAnimations() { _s03_platypusHypnotized = false; break; case kASGrabCreek: - _gameSys->insertSequence(0x1B4, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x1B4, _gnapId, 0); - _gnapSequenceId = 0x1B4; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGrabCreekDone; + _vm->_gameSys->insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1B4, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x1B4; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGrabCreekDone; break; default: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { if (_s03_nextPlatSequenceId == 0x1BD || _s03_nextPlatSequenceId == 0x1C0) { - _gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 1); _s03_platypusScared = true; - _gameSys->insertSequence(0x1B5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s03_nextPlatSequenceId, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x1B5; - _gnapSequenceDatNum = 0; - _gnapIdleFacing = kDirNone; - _platypusSequenceId = _s03_nextPlatSequenceId; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(_s03_nextPlatSequenceId, 99, 1); + _vm->_gameSys->insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s03_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x1B5; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirNone; + _vm->_platypusSequenceId = _s03_nextPlatSequenceId; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(_s03_nextPlatSequenceId, 99, 1); _s03_nextPlatSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } else if (_s03_nextPlatSequenceId == 0x1BC) { - _gnapX = 3; - _gnapY = 6; - _gameSys->insertSequence(0x1B6, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x1BC, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x1BC, 99, 0); - _gnapId = 20 * _gnapY; - _gnapSequenceId = 0x1B6; - _gnapSequenceDatNum = 0; - _gnapIdleFacing = kDirNone; - _gnapActionStatus = kASFreePlatypusDone; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gameSys->insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1BC, 99, 0); + _vm->_gnapId = 20 * _vm->_gnapY; + _vm->_gnapSequenceId = 0x1B6; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirNone; + _vm->_gnapActionStatus = kASFreePlatypusDone; _s03_nextPlatSequenceId = -1; } else if (_s03_nextPlatSequenceId == 0x1C2 && !_s03_platypusScared) { - _gameSys->setAnimation(0, 0, 1); - _gameSys->insertSequence(0x1C2, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0x1C2; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x1C2, 99, 1); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0x1C2; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x1C2, 99, 1); _s03_nextPlatSequenceId = -1; } else if (_s03_nextPlatSequenceId == -1 && _s03_platypusScared && !_s03_platypusHypnotized) { - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0x1BE, 99, 1); - _gameSys->insertSequence(0x1BE, 99, _platypusSequenceId | (_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0x1BE; - _platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0x1BE, 99, 1); + _vm->_gameSys->insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0x1BE; + _vm->_platypusSequenceDatNum = 0; _s03_nextPlatSequenceId = -1; } } - if (_gameSys->getAnimationStatus(2) == 2 && _s03_nextFrogSequenceId != -1) { - _gameSys->setAnimation(_s03_nextFrogSequenceId, 253, 2); - _gameSys->insertSequence(_s03_nextFrogSequenceId, 253, _s03_currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s03_nextFrogSequenceId != -1) { + _vm->_gameSys->setAnimation(_s03_nextFrogSequenceId, 253, 2); + _vm->_gameSys->insertSequence(_s03_nextFrogSequenceId, 253, _s03_currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); _s03_currFrogSequenceId = _s03_nextFrogSequenceId; _s03_nextFrogSequenceId = -1; } - if (_gameSys->getAnimationStatus(5) == 2) { - _gameSys->setAnimation(0, 0, 5); - invAdd(kItemGrass); - setGrabCursorSprite(kItemGrass); - setFlag(kGFGrassTaken); - scene03_updateHotspots(); + if (_vm->_gameSys->getAnimationStatus(5) == 2) { + _vm->_gameSys->setAnimation(0, 0, 5); + _vm->invAdd(kItemGrass); + _vm->setGrabCursorSprite(kItemGrass); + _vm->setFlag(kGFGrassTaken); + updateHotspots(); } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene03.h b/engines/gnap/scenes/scene03.h new file mode 100644 index 0000000000..2ccb1cd542 --- /dev/null +++ b/engines/gnap/scenes/scene03.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE03_H +#define GNAP_SCENE03_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene03: public Scene { +public: + Scene03(GnapEngine *vm); + ~Scene03() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: + bool _s03_platypusHypnotized; + bool _s03_platypusScared; + int _s03_nextPlatSequenceId; + int _s03_nextFrogSequenceId; + int _s03_currFrogSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE03_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 7d37793e48..e88843d9ec 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -27,11 +27,12 @@ #include "gnap/scenes/scene00.h" #include "gnap/scenes/scene01.h" +#include "gnap/scenes/scene02.h" +#include "gnap/scenes/scene03.h" namespace Gnap { int GnapEngine::initSceneLogic() { - int backgroundId = -1; switch (_currentSceneNum) { @@ -48,14 +49,16 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 2: + _scene = new Scene02(this); backgroundId = _scene->init(); _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; case 3: - backgroundId = scene03_init(); - scene03_updateHotspots(); + _scene = new Scene03(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -239,8 +242,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 34: - backgroundId = scene03_init(); - scene03_updateHotspots(); + _scene = new Scene03(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -369,7 +373,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 4; break; case 3: - scene03_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 4; break; @@ -525,7 +530,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 34: - scene03_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 729b82a428adf062894b67263485abe11507c416 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Apr 2016 22:15:59 +0200 Subject: GNAP: Use enum value for a flag instead of number --- engines/gnap/scenes/scene07.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index 953dbeb1e0..dab9051114 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -50,7 +50,7 @@ void GnapEngine::scene07_updateHotspots() { setHotspot(kHSExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); setHotspot(kHSDice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); setHotspot(kHSWalkArea1, 0, 0, 325, 445); - setHotspot(kHSWalkArea2, 325, 0, 799, 445, _isLeavingScene ? SF_WALKABLE : 0); + setHotspot(kHSWalkArea2, 325, 0, 799, 445, _isLeavingScene ? SF_WALKABLE : SF_NONE); setHotspot(kHSWalkArea3, 160, 0, 325, 495); setDeviceHotspot(kHSDevice, -1, -1, -1, -1); if (isFlag(kGFPlatypus)) -- cgit v1.2.3 From 58827530140a94c17053d02774884b23fd1dcab2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Apr 2016 01:34:08 +0200 Subject: GNAP: Refactor scene 4 --- engines/gnap/gnap.cpp | 4 - engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene04.cpp | 610 +++++++++++++++++++------------------- engines/gnap/scenes/scene04.h | 52 ++++ engines/gnap/scenes/scenecore.cpp | 17 +- 5 files changed, 369 insertions(+), 323 deletions(-) create mode 100644 engines/gnap/scenes/scene04.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index cb5c889a6e..f706dd3a3d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2022,10 +2022,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 4 - _s04_dogIdCtr = 0; - //_s04_triedWindow = true;//?? - _s04_triedWindow = false; // Scene 5 _s05_nextChickenSequenceId = -1; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index b6e7425082..ce1a8ab0fc 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,15 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 4 - bool _s04_triedWindow; - int _s04_dogIdCtr; - int _s04_nextDogSequenceId, _s04_currDogSequenceId; - int scene04_init(); - void scene04_updateHotspots(); - void scene04_run(); - void scene04_updateAnimations(); - // Scene 5 int _s05_nextChickenSequenceId, _s05_currChickenSequenceId; int scene05_init(); diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index cbe5d05034..299656c226 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene04.h" namespace Gnap { @@ -54,153 +55,158 @@ enum { kASGrabAxe = 13 }; -int GnapEngine::scene04_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); +Scene04::Scene04(GnapEngine *vm) : Scene(vm) { + _s04_dogIdCtr = 0; + _s04_triedWindow = false; + _s04_nextDogSequenceId = -1; + _s04_currDogSequenceId = -1; +} + +int Scene04::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); return 0x214; } -void GnapEngine::scene04_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSTwig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); - setHotspot(kHSDog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - setHotspot(kHSAxe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - setHotspot(kHSDoor, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - setHotspot(kHSExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSWindow, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - setHotspot(kHSExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); - setHotspot(kHSWalkArea1, 0, 0, 562, 461); - setHotspot(kHSWalkArea2, 562, 0, 800, 500); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypus)) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(kGFTwigTaken)) - _hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(kGFPlatypusTalkingToAssistant) || _cursorValue == 1) - _hotspots[kHSAxe]._flags = SF_DISABLED; - _hotspotsCount = 11; +void Scene04::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSTwig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + _vm->setHotspot(kHSDog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHSAxe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHSDoor, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHSExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSWindow, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHSExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 562, 461); + _vm->setHotspot(kHSWalkArea2, 562, 0, 800, 500); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant) || _vm->_cursorValue == 1) + _vm->_hotspots[kHSAxe]._flags = SF_DISABLED; + _vm->_hotspotsCount = 11; } -void GnapEngine::scene04_run() { - playSound(0x1091C, true); - startSoundTimerC(4); +void Scene04::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(4); - _gameSys->insertSequence(0x210, 139 - _s04_dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x210, 139 - _s04_dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); _s04_currDogSequenceId = 0x210; _s04_nextDogSequenceId = -1; - _gameSys->setAnimation(0x210, 139 - _s04_dogIdCtr, 3); + _vm->_gameSys->setAnimation(0x210, 139 - _s04_dogIdCtr, 3); _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; - _timers[6] = getRandom(20) + 60; - _timers[5] = getRandom(150) + 300; - _timers[7] = getRandom(150) + 200; - _timers[8] = getRandom(150) + 400; + _vm->_timers[6] = _vm->getRandom(20) + 60; + _vm->_timers[5] = _vm->getRandom(150) + 300; + _vm->_timers[7] = _vm->getRandom(150) + 200; + _vm->_timers[8] = _vm->getRandom(150) + 400; - if (!isFlag(kGFPlatypusTalkingToAssistant) && _cursorValue == 4) - _gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant) && _vm->_cursorValue == 4) + _vm->_gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFTwigTaken)) - _gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFTwigTaken)) + _vm->_gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFPlatyPussDisguised)) { - _timers[3] = 300; + if (_vm->isFlag(kGFPlatyPussDisguised)) { + _vm->_timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); - setGrabCursorSprite(kItemKeys); - _gnapX = 4; - _gnapY = 7; - _gnapId = 140; - _platX = 6; - _platY = 7; - _platypusId = 141; - _gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _gnapGridX, 336 - _gnapGridY); - _gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); - endSceneInit(); - invRemove(kItemDisguise); - invAdd(kItemKeys); - setFlag(kGFKeysTaken); - clearFlag(kGFPlatyPussDisguised); - _platypusSequenceId = 0x20C; - _platypusSequenceDatNum = 0; - _platypusFacing = kDirBottomRight; - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gameSys->waitForUpdate(); + _vm->setGrabCursorSprite(kItemKeys); + _vm->_gnapX = 4; + _vm->_gnapY = 7; + _vm->_gnapId = 140; + _vm->_platX = 6; + _vm->_platY = 7; + _vm->_platypusId = 141; + _vm->_gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + _vm->_gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); + _vm->endSceneInit(); + _vm->invRemove(kItemDisguise); + _vm->invAdd(kItemKeys); + _vm->setFlag(kGFKeysTaken); + _vm->clearFlag(kGFPlatyPussDisguised); + _vm->_platypusSequenceId = 0x20C; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusFacing = kDirBottomRight; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->waitForUpdate(); } else { - _gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); - if (_prevSceneNum == 2) { - initGnapPos(5, 11, kDirUpRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(6, 11, kDirUpLeft); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(5, 8, -1, 0x107C2, 1); - gnapWalkTo(6, 9, -1, 0x107BA, 1); - } else if (_prevSceneNum == 38) { - initGnapPos(5, 7, kDirBottomRight); - initPlatypusPos(4, 7, kDirNone); - endSceneInit(); + _vm->_gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->_prevSceneNum == 2) { + _vm->initGnapPos(5, 11, kDirUpRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(6, 9, -1, 0x107BA, 1); + } else if (_vm->_prevSceneNum == 38) { + _vm->initGnapPos(5, 7, kDirBottomRight); + _vm->initPlatypusPos(4, 7, kDirNone); + _vm->endSceneInit(); } else { - initGnapPos(12, 9, kDirBottomRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(12, 8, kDirNone); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(9, 8, -1, 0x107C2, 1); - gnapWalkTo(9, 9, -1, 0x107BA, 1); + _vm->initGnapPos(12, 9, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(12, 8, kDirNone); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(9, 9, -1, 0x107BA, 1); } } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 4, -1, -1, -1, -1); + _vm->testWalk(0, 4, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene04_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { - if (_grabCursorSpriteIndex == kItemDisguise) { - gnapUseDisguiseOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFKeysTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - if (_cursorValue == 4) - gnapKissPlatypus(0); + if (_vm->_cursorValue == 4) + _vm->gnapKissPlatypus(0); else - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -208,23 +214,23 @@ void GnapEngine::scene04_run() { break; case kHSTwig: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 9, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); break; case GRAB_CURSOR: - playGnapPullOutDevice(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); - playGnapUseDevice(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); - _gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x1FD, 100, 2); + _vm->playGnapPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->playGnapUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->_gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1FD, 100, 2); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -232,24 +238,24 @@ void GnapEngine::scene04_run() { break; case kHSAxe: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 9, 5); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y); + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabAxe; - setFlag(kGFPlatypusTalkingToAssistant); - scene04_updateHotspots(); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabAxe; + _vm->setFlag(kGFPlatypusTalkingToAssistant); + updateHotspots(); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -257,31 +263,31 @@ void GnapEngine::scene04_run() { break; case kHSDog: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 9, 7); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (gnapWalkTo(_gnapX, _gnapY, 0, -1, 1)) { - playGnapMoan2(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y); + if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _s04_nextDogSequenceId = 0x20F; } break; case GRAB_CURSOR: - _gnapIdleFacing = kDirBottomRight; - if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _gnapActionStatus = kASGrabDog; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kASGrabDog; break; case TALK_CURSOR: - _gnapIdleFacing = kDirBottomRight; - if (gnapWalkTo(_gnapX, _gnapY, 0, -1, 1)) { - playGnapBrainPulsating(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y); + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _s04_nextDogSequenceId = 0x20E; } break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -289,30 +295,30 @@ void GnapEngine::scene04_run() { break; case kHSDoor: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 4, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case PLAT_CURSOR: - playGnapScratchingHead(4, 3); + _vm->playGnapScratchingHead(4, 3); break; case GRAB_CURSOR: - if (_cursorValue == 1) { - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _gnapActionStatus = kASOpenDoor; - _timers[5] = 300; - _gnapIdleFacing = kDirUpLeft; + if (_vm->_cursorValue == 1) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASOpenDoor; + _vm->_timers[5] = 300; + _vm->_gnapIdleFacing = kDirUpLeft; } else { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 38; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 38; } break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -320,43 +326,43 @@ void GnapEngine::scene04_run() { break; case kHSExitTruck: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, -1, 0x107C7, 1); - if (_cursorValue == 1) - _newSceneNum = 2; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 2; else - _newSceneNum = 33; + _vm->_newSceneNum = 33; } break; case kHSWindow: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 2, 3); - } else if (isFlag(kGFKeysTaken)) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); + } else if (_vm->isFlag(kGFKeysTaken)) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (gnapWalkTo(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y, 0, getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { if (_s04_triedWindow) { - _gnapActionStatus = kASGetKeyAnother; + _vm->_gnapActionStatus = kASGetKeyAnother; } else { - _gnapActionStatus = kASGetKeyFirst; + _vm->_gnapActionStatus = kASGetKeyFirst; _s04_triedWindow = true; } } break; case GRAB_CURSOR: - playGnapScratchingHead(_hotspotsWalkPos[7].x, _hotspotsWalkPos[7].y); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -364,207 +370,203 @@ void GnapEngine::scene04_run() { break; case kHSExitBarn: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[8].x, _hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); - if (_cursorValue == 1) - _newSceneNum = 5; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 5; else - _newSceneNum = 35; + _vm->_newSceneNum = 35; } break; case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene04_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, true); + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && isFlag(kGFPlatypus)) - platypusSub426234(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence2(); - if (!_timers[5]) { - _timers[5] = getRandom(150) + 300; - if (_gnapActionStatus < 0) - _gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->platypusSub426234(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(150) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[7]) { - _timers[7] = getRandom(150) + 200; - _gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(150) + 200; + _vm->_gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[6]) { - _timers[6] = getRandom(20) + 60; + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(20) + 60; if (_s04_nextDogSequenceId == -1) _s04_nextDogSequenceId = 0x210; } - if (!_timers[8]) { - _timers[8] = getRandom(150) + 400; - _gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[8]) { + _vm->_timers[8] = _vm->getRandom(150) + 400; + _vm->_gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene04_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene04_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene04::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASOpenDoor: - _gameSys->insertSequence(0x205, _gnapId, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); - _gnapX = 6; - _gnapY = 7; - _gameSys->insertSequence(0x107B5, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, getSequenceTotalDuration(0x205) - 1, 450 - _gnapGridX, 336 - _gnapGridY); - _gameSys->setAnimation(0x107B5, _gnapId, 0); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gnapActionStatus = kASOpenDoorDone; + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gnapX = 6; + _vm->_gnapY = 7; + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + _vm->_gameSys->setAnimation(0x107B5, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapActionStatus = kASOpenDoorDone; break; case kASOpenDoorDone: - _gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = -1; break; case kASGetKeyFirst: - _gameSys->insertSequence(0x204, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x204, _gnapId, 0); - _gnapSequenceId = 0x204; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyFirst2; + _vm->_gameSys->insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x204, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x204; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyFirst2; break; case kASGetKeyFirst2: - _gameSys->insertSequence(0x206, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x20B, 256, 0); - _gnapSequenceId = 0x206; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyFirstDone; + _vm->_gameSys->insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20B, 256, 0); + _vm->_gnapSequenceId = 0x206; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyFirstDone; break; case kASGetKeyFirstDone: - _gameSys->requestRemoveSequence(0x1FF, 256); - _gameSys->requestRemoveSequence(0x20B, 256); - _gameSys->insertSequence(0x107B5, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapIdleFacing = kDirBottomRight; - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gnapActionStatus = -1; + _vm->_gameSys->requestRemoveSequence(0x1FF, 256); + _vm->_gameSys->requestRemoveSequence(0x20B, 256); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapActionStatus = -1; break; case kASGetKeyAnother: - _gameSys->insertSequence(0x202, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x202, _gnapId, 0); - _gnapSequenceId = 0x202; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyAnother2; + _vm->_gameSys->insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x202, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x202; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyAnother2; break; case kASGetKeyAnother2: - _gameSys->insertSequence(0x203, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x20A, 256, 0); - _gnapSequenceId = 0x203; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASGetKeyAnotherDone; + _vm->_gameSys->insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20A, 256, 0); + _vm->_gnapSequenceId = 0x203; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASGetKeyAnotherDone; break; case kASGetKeyAnotherDone: - _gameSys->removeSequence(0x1FF, 256, true); - _gameSys->removeSequence(0x20A, 256, true); - _gameSys->insertSequence(0x107B5, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gnapIdleFacing = kDirBottomRight; - _gnapActionStatus = -1; + _vm->_gameSys->removeSequence(0x1FF, 256, true); + _vm->_gameSys->removeSequence(0x20A, 256, true); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapActionStatus = -1; break; case kASGrabDog: _s04_nextDogSequenceId = 0x201; break; case kASGrabAxe: - _gameSys->insertSequence(0x211, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->requestRemoveSequence(0x212, 100); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x211; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->requestRemoveSequence(0x212, 100); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x211; + _vm->_gnapActionStatus = -1; break; default: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->setAnimation(0, 0, 2); - invAdd(kItemTwig); - setGrabCursorSprite(kItemTwig); - setFlag(kGFTwigTaken); - scene04_updateHotspots(); + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->invAdd(kItemTwig); + _vm->setGrabCursorSprite(kItemTwig); + _vm->setFlag(kGFTwigTaken); + updateHotspots(); } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_s04_nextDogSequenceId == 0x201) { - _gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, + _vm->_gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x200, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); + _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; _s04_currDogSequenceId = 0x201; - _gnapSequenceId = 0x200; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; - _timers[6] = getRandom(20) + 60; + _vm->_gnapSequenceId = 0x200; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + _vm->_timers[6] = _vm->getRandom(20) + 60; _s04_nextDogSequenceId = -1; } else if (_s04_nextDogSequenceId != -1) { - _gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, + _vm->_gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); + _vm->_gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; _s04_currDogSequenceId = _s04_nextDogSequenceId; _s04_nextDogSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene04.h b/engines/gnap/scenes/scene04.h new file mode 100644 index 0000000000..11a7eeb46e --- /dev/null +++ b/engines/gnap/scenes/scene04.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE04_H +#define GNAP_SCENE04_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene04: public Scene { +public: + Scene04(GnapEngine *vm); + ~Scene04() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: + bool _s04_triedWindow; + int _s04_dogIdCtr; + int _s04_nextDogSequenceId; + int _s04_currDogSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE04_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index e88843d9ec..3837b7caf9 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -29,6 +29,7 @@ #include "gnap/scenes/scene01.h" #include "gnap/scenes/scene02.h" #include "gnap/scenes/scene03.h" +#include "gnap/scenes/scene04.h" namespace Gnap { @@ -63,8 +64,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 4: - backgroundId = scene04_init(); - scene04_updateHotspots(); + _scene = new Scene04(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -261,8 +263,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 37: - backgroundId = scene04_init(); - scene04_updateHotspots(); + _scene = new Scene04(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -379,7 +382,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 4; break; case 4: - scene04_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 4; break; @@ -546,7 +550,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 37: - scene04_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From ca21ed461514939da5a126482c164c089c23051e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Apr 2016 07:21:55 +0200 Subject: GNAP: Refactor scene 5 --- engines/gnap/gnap.cpp | 4 - engines/gnap/gnap.h | 7 - engines/gnap/scenes/scene05.cpp | 485 +++++++++++++++++++------------------- engines/gnap/scenes/scene05.h | 50 ++++ engines/gnap/scenes/scenecore.cpp | 17 +- 5 files changed, 303 insertions(+), 260 deletions(-) create mode 100644 engines/gnap/scenes/scene05.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index f706dd3a3d..b682d02798 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2022,10 +2022,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - - // Scene 5 - _s05_nextChickenSequenceId = -1; - // Scene 6 _s06_nextPlatSequenceId = -1; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index ce1a8ab0fc..ece68359a4 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,13 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 5 - int _s05_nextChickenSequenceId, _s05_currChickenSequenceId; - int scene05_init(); - void scene05_updateHotspots(); - void scene05_run(); - void scene05_updateAnimations(); - // Scene 6 bool _s06_horseTurnedBack; int _s06_nextPlatSequenceId; diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index 405bd2aba3..f28a37daa1 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene05.h" namespace Gnap { @@ -51,107 +52,109 @@ enum { kASLeaveScene = 12 }; -int GnapEngine::scene05_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 3); - return isFlag(kGFBarnPadlockOpen) ? 0x151 : 0x150; +Scene05::Scene05(GnapEngine *vm) : Scene(vm) { + _s05_nextChickenSequenceId = -1; + _s05_currChickenSequenceId = -1; } -void GnapEngine::scene05_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSHaystack, 236, 366, 372, 442, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - setHotspot(kHSPadlock, 386, 230, 626, 481, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - setHotspot(kHSLadder, 108, 222, 207, 444, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - setHotspot(kHSExitHouse, 0, 395, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - setHotspot(kHSChicken, 612, 462, 722, 564, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - setHotspot(kHSWalkArea1, 104, 0, 421, 480); - setHotspot(kHSWalkArea2, 422, 0, 800, 487); - setHotspot(kHSWalkArea3, 0, 0, 104, 499); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypus)) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (isFlag(kGFBarnPadlockOpen)) - _hotspots[kHSPadlock]._flags = SF_EXIT_U_CURSOR; - _hotspotsCount = 10; +int Scene05::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 3); + return _vm->isFlag(kGFBarnPadlockOpen) ? 0x151 : 0x150; } -void GnapEngine::scene05_run() { +void Scene05::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSHaystack, 236, 366, 372, 442, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHSPadlock, 386, 230, 626, 481, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHSLadder, 108, 222, 207, 444, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHSExitHouse, 0, 395, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHSChicken, 612, 462, 722, 564, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHSWalkArea1, 104, 0, 421, 480); + _vm->setHotspot(kHSWalkArea2, 422, 0, 800, 487); + _vm->setHotspot(kHSWalkArea3, 0, 0, 104, 499); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_hotspots[kHSPadlock]._flags = SF_EXIT_U_CURSOR; + _vm->_hotspotsCount = 10; +} - playSound(0x1091C, true); - startSoundTimerC(7); +void Scene05::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(7); _s05_currChickenSequenceId = 0x142; - _gameSys->setAnimation(0x142, 100, 3); - _gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x142, 100, 3); + _vm->_gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); _s05_nextChickenSequenceId = -1; - _timers[5] = getRandom(10) + 30; - _timers[6] = getRandom(150) + 300; + _vm->_timers[5] = _vm->getRandom(10) + 30; + _vm->_timers[6] = _vm->getRandom(150) + 300; - if (isFlag(kGFBarnPadlockOpen)) - _gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (_prevSceneNum != 6 && _prevSceneNum != 36) { - initGnapPos(-1, 8, kDirBottomRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(-1, 9, kDirNone); - endSceneInit(); - if (isFlag(kGFPlatypus)) - platypusWalkTo(2, 8, -1, 0x107C2, 1); - gnapWalkTo(2, 9, -1, 0x107B9, 1); + if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { + _vm->initGnapPos(-1, 8, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(-1, 9, kDirNone); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(2, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 9, -1, 0x107B9, 1); } else { - initGnapPos(6, 8, kDirBottomRight); - if (isFlag(kGFPlatypus)) - initPlatypusPos(7, 9, kDirNone); - endSceneInit(); + _vm->initGnapPos(6, 8, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(7, 9, kDirNone); + _vm->endSceneInit(); } - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->testWalk(0, 12, -1, -1, -1, -1); - testWalk(0, 12, -1, -1, -1, -1); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene05_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0 && isFlag(kGFPlatypus)) { - if (_grabCursorSpriteIndex == kItemDisguise) { - gnapUseDisguiseOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFKeysTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -159,30 +162,30 @@ void GnapEngine::scene05_run() { break; case kHSHaystack: - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[1].x - 2, _hotspotsWalkPos[1].y, 4, 5); - } else if (isFlag(kGFNeedleTaken)) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); + } else if (_vm->isFlag(kGFNeedleTaken)) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y - 1); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); break; case GRAB_CURSOR: case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(kGFPlatypus)) { - gnapUseDeviceOnPlatypuss(); - if (platypusWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { - _platypusActionStatus = kASPlatSearchHaystack; - _platypusFacing = kDirUnk4; + if (_vm->isFlag(kGFPlatypus)) { + _vm->gnapUseDeviceOnPlatypuss(); + if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { + _vm->_platypusActionStatus = kASPlatSearchHaystack; + _vm->_platypusFacing = kDirUnk4; } - if (_gnapX == 4 && (_gnapY == 8 || _gnapY == 7)) - gnapWalkStep(); - playGnapIdle(_platX, _platY); + if (_vm->_gnapX == 4 && (_vm->_gnapY == 8 || _vm->_gnapY == 7)) + _vm->gnapWalkStep(); + _vm->playGnapIdle(_vm->_platX, _vm->_platY); } break; } @@ -191,31 +194,31 @@ void GnapEngine::scene05_run() { break; case kHSChicken: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemTwig) { - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, - 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASUseTwigWithChicken; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y + 1, 9, 7); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTwig) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASUseTwigWithChicken; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(9, 7); + _vm->playGnapMoan2(9, 7); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabChicken; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabChicken; break; case TALK_CURSOR: - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkChicken; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkChicken; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -223,22 +226,22 @@ void GnapEngine::scene05_run() { break; case kHSLadder: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 2, 5); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(2, 4); + _vm->playGnapMoan2(2, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirBottomLeft; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabLadder; + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabLadder; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -246,35 +249,35 @@ void GnapEngine::scene05_run() { break; case kHSPadlock: - if (isFlag(kGFBarnPadlockOpen)) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[2].x - 1, _hotspotsWalkPos[2].y + 1, 0, -1, 1); - _gnapActionStatus = kASEnterBarn; - if (_cursorValue == 1) - _newSceneNum = 6; + if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x - 1, _vm->_hotspotsWalkPos[2].y + 1, 0, -1, 1); + _vm->_gnapActionStatus = kASEnterBarn; + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 6; else - _newSceneNum = 36; - } else if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemNeedle) { - if (gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, - getGnapSequenceId(gskIdle, _hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y) | 0x10000, 1)) - _gnapActionStatus = kASPickPadlock; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 7, 4); + _vm->_newSceneNum = 36; + } else if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemNeedle) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, + _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) + _vm->_gnapActionStatus = kASPickPadlock; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(7, 4); + _vm->playGnapScratchingHead(7, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, - 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTryPickPadlock; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTryPickPadlock; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -282,23 +285,23 @@ void GnapEngine::scene05_run() { break; case kHSExitHouse: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypus)) - platypusWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); - if (_cursorValue == 1) - _newSceneNum = 4; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 4; else - _newSceneNum = 37; + _vm->_newSceneNum = 37; } break; case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHSWalkArea3: @@ -306,162 +309,158 @@ void GnapEngine::scene05_run() { break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene05_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, true); + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); - if (!_isLeavingScene) { - if (isFlag(kGFPlatypus)) - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[5]) { - _timers[5] = getRandom(20) + 30; - if (_gnapActionStatus != kASTalkChicken && _s05_nextChickenSequenceId == -1) { - if (getRandom(4) != 0) + if (!_vm->_isLeavingScene) { + if (_vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 30; + if (_vm->_gnapActionStatus != kASTalkChicken && _s05_nextChickenSequenceId == -1) { + if (_vm->getRandom(4) != 0) _s05_nextChickenSequenceId = 0x142; else _s05_nextChickenSequenceId = 0x143; } } - if (!_timers[6]) { - _timers[6] = getRandom(150) + 300; - if (_gnapActionStatus < 0) - _gameSys->insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(150) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene05_updateHotspots(); - _timers[5] = getRandom(20) + 30; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 30; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene05_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene05::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; case kASTryPickPadlock: - _gameSys->insertSequence(0x148, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x148; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x148; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; break; case kASPickPadlock: - _gameSys->setAnimation(0x147, _gnapId, 0); - _gameSys->insertSequence(0x147, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x147; - _gnapSequenceDatNum = 0; - setFlag(kGFBarnPadlockOpen); - setFlag(kGFSceneFlag1); - setGrabCursorSprite(-1); - _newSceneNum = 6; - _timers[2] = 100; - invRemove(kItemNeedle); - _gnapActionStatus = kASLeaveScene; + _vm->_gameSys->setAnimation(0x147, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x147; + _vm->_gnapSequenceDatNum = 0; + _vm->setFlag(kGFBarnPadlockOpen); + _vm->setFlag(kGFSceneFlag1); + _vm->setGrabCursorSprite(-1); + _vm->_newSceneNum = 6; + _vm->_timers[2] = 100; + _vm->invRemove(kItemNeedle); + _vm->_gnapActionStatus = kASLeaveScene; break; case kASTalkChicken: _s05_nextChickenSequenceId = 0x144; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASGrabChicken: _s05_nextChickenSequenceId = 0x14B; break; case kASGrabLadder: - while (_gameSys->isSequenceActive(0x149, 39)) - gameUpdateTick(); - _gameSys->insertSequence(0x14E, _gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x14D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x14D; - _gnapSequenceDatNum = 0; - _timers[2] = 200; - _timers[6] = 300; - _gnapActionStatus = -1; + while (_vm->_gameSys->isSequenceActive(0x149, 39)) + _vm->gameUpdateTick(); + _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x14D; + _vm->_gnapSequenceDatNum = 0; + _vm->_timers[2] = 200; + _vm->_timers[6] = 300; + _vm->_gnapActionStatus = -1; break; case kASEnterBarn: - _gameSys->insertSequence(0x107B1, 1, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gameSys->setAnimation(0x107B1, 1, 0); - _gnapActionStatus = kASLeaveScene; + _vm->_gameSys->insertSequence(0x107B1, 1, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gameSys->setAnimation(0x107B1, 1, 0); + _vm->_gnapActionStatus = kASLeaveScene; break; case kASUseTwigWithChicken: - playGnapShowItem(5, 0, 0); + _vm->playGnapShowItem(5, 0, 0); _s05_nextChickenSequenceId = 0x14F; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - if (_platypusSequenceId == 0x146) { - _platX = 4; - _platY = 8; - _gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _platGridX, 384 - _platGridY); - _platypusSequenceId = 0x7C1; - _platypusSequenceDatNum = 1; - _platypusId = 20 * _platY; - invAdd(kItemNeedle); - setFlag(kGFNeedleTaken); - setGrabCursorSprite(kItemNeedle); - showCursor(); - _timers[1] = 30; - _platypusActionStatus = -1; + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (_vm->_platypusSequenceId == 0x146) { + _vm->_platX = 4; + _vm->_platY = 8; + _vm->_gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); + _vm->_platypusSequenceId = 0x7C1; + _vm->_platypusSequenceDatNum = 1; + _vm->_platypusId = 20 * _vm->_platY; + _vm->invAdd(kItemNeedle); + _vm->setFlag(kGFNeedleTaken); + _vm->setGrabCursorSprite(kItemNeedle); + _vm->showCursor(); + _vm->_timers[1] = 30; + _vm->_platypusActionStatus = -1; } - if (_platypusActionStatus == kASPlatSearchHaystack) { - _gameSys->setAnimation(0, 0, 1); - _gameSys->insertSequence(0x145, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x146, 256, 0x145, _platypusId, kSeqSyncWait, 0, 0, 0); - hideCursor(); - setGrabCursorSprite(-1); - _platypusSequenceId = 0x146; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x146, 256, 1); - _timers[1] = 300; + if (_vm->_platypusActionStatus == kASPlatSearchHaystack) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->_platypusSequenceId = 0x146; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x146, 256, 1); + _vm->_timers[1] = 300; } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_s05_nextChickenSequenceId == 0x14B) { - _gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); - _gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x14C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x14C; + _vm->_gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x14C; _s05_currChickenSequenceId = _s05_nextChickenSequenceId; _s05_nextChickenSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } else if (_s05_nextChickenSequenceId != -1) { - _gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); - _gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); _s05_currChickenSequenceId = _s05_nextChickenSequenceId; _s05_nextChickenSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene05.h b/engines/gnap/scenes/scene05.h new file mode 100644 index 0000000000..f79adc0e41 --- /dev/null +++ b/engines/gnap/scenes/scene05.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE05_H +#define GNAP_SCENE05_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene05: public Scene { +public: + Scene05(GnapEngine *vm); + ~Scene05() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: + int _s05_nextChickenSequenceId; + int _s05_currChickenSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE05_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 3837b7caf9..81834191dd 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -30,6 +30,7 @@ #include "gnap/scenes/scene02.h" #include "gnap/scenes/scene03.h" #include "gnap/scenes/scene04.h" +#include "gnap/scenes/scene05.h" namespace Gnap { @@ -71,8 +72,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 5: - backgroundId = scene05_init(); - scene05_updateHotspots(); + _scene = new Scene05(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -251,8 +253,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 35: - backgroundId = scene05_init(); - scene05_updateHotspots(); + _scene = new Scene05(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -388,7 +391,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 4; break; case 5: - scene05_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 4; break; @@ -540,7 +544,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 35: - scene05_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From aea51e0d40a0be2a724e7a6650382b7157b01952 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Apr 2016 07:39:18 +0200 Subject: GNAP: Refactor scene 6 --- engines/gnap/gnap.cpp | 3 - engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene06.cpp | 418 +++++++++++++++++++------------------- engines/gnap/scenes/scene06.h | 52 +++++ engines/gnap/scenes/scenecore.cpp | 17 +- 5 files changed, 272 insertions(+), 227 deletions(-) create mode 100644 engines/gnap/scenes/scene06.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index b682d02798..ddaa9f6a8e 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2022,9 +2022,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 6 - _s06_nextPlatSequenceId = -1; - // Scene 11 _s11_billardBallCtr = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index ece68359a4..43b2f6ae05 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,15 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 6 - bool _s06_horseTurnedBack; - int _s06_nextPlatSequenceId; - int _s06_nextHorseSequenceId, _s06_currHorseSequenceId; - int scene06_init(); - void scene06_updateHotspots(); - void scene06_run(); - void scene06_updateAnimations(); - // Scene 7 int scene07_init(); void scene07_updateHotspots(); diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index f908b1d25a..3bd79fd1dd 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene06.h" namespace Gnap { @@ -49,112 +50,116 @@ enum { kASLeaveScene = 5 }; -int GnapEngine::scene06_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); - if (isFlag(kGFSceneFlag1)) { - playSound(0x11B, false); - clearFlag(kGFSceneFlag1); +Scene06::Scene06(GnapEngine *vm) : Scene(vm) { + _s06_horseTurnedBack = false;; + _s06_nextPlatSequenceId = -1; + _s06_nextHorseSequenceId = -1; + _s06_currHorseSequenceId = -1; +} + +int Scene06::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + if (_vm->isFlag(kGFSceneFlag1)) { + _vm->playSound(0x11B, false); + _vm->clearFlag(kGFSceneFlag1); } return 0x101; } -void GnapEngine::scene06_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSGas, 300, 120, 440, 232, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - setHotspot(kHSLadder, 497, 222, 614, 492, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - setHotspot(kHSHorse, 90, 226, 259, 376, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - setHotspot(kHSExitOutsideBarn, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - setHotspot(kHSWalkArea1, 0, 0, 200, 515); - setHotspot(kHSWalkArea2, 200, 0, 285, 499); - setHotspot(kHSWalkArea3, 688, 0, 800, 499); - setHotspot(kHSWalkArea4, 475, 469, 800, 505); - setHotspot(kHSWalkArea5, 0, 0, 800, 504); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFGasTaken)) - _hotspots[kHSLadder]._flags = SF_DISABLED; - if (_cursorValue == 4) { - _hotspots[kHSLadder]._flags = SF_DISABLED; - _hotspots[kHSGas]._flags = SF_DISABLED; +void Scene06::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSGas, 300, 120, 440, 232, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHSLadder, 497, 222, 614, 492, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHSHorse, 90, 226, 259, 376, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHSExitOutsideBarn, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHSWalkArea1, 0, 0, 200, 515); + _vm->setHotspot(kHSWalkArea2, 200, 0, 285, 499); + _vm->setHotspot(kHSWalkArea3, 688, 0, 800, 499); + _vm->setHotspot(kHSWalkArea4, 475, 469, 800, 505); + _vm->setHotspot(kHSWalkArea5, 0, 0, 800, 504); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFGasTaken)) + _vm->_hotspots[kHSLadder]._flags = SF_DISABLED; + if (_vm->_cursorValue == 4) { + _vm->_hotspots[kHSLadder]._flags = SF_DISABLED; + _vm->_hotspots[kHSGas]._flags = SF_DISABLED; } - _hotspotsCount = 11; + _vm->_hotspotsCount = 11; } -void GnapEngine::scene06_run() { +void Scene06::run() { bool triedDeviceOnGas = false; - startSoundTimerC(7); + _vm->startSoundTimerC(7); _s06_horseTurnedBack = false; - _gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); _s06_currHorseSequenceId = 0xF1; _s06_nextHorseSequenceId = -1; - _gameSys->setAnimation(0xF1, 120, 2); - - _timers[4] = getRandom(40) + 25; + _vm->_gameSys->setAnimation(0xF1, 120, 2); + _vm->_timers[4] = _vm->getRandom(40) + 25; - if (isFlag(kGFUnk04)) - _gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFGasTaken) && _cursorValue != 4) - _gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFGasTaken) && _vm->_cursorValue != 4) + _vm->_gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - initGnapPos(5, 12, kDirBottomRight); - initPlatypusPos(6, 12, kDirNone); - endSceneInit(); + _vm->initGnapPos(5, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); - platypusWalkTo(6, 8, -1, 0x107C2, 1); - gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 5, -1, -1, -1, -1); + _vm->testWalk(0, 5, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene06_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDisguise) { - gnapUseDisguiseOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFKeysTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -162,33 +167,33 @@ void GnapEngine::scene06_run() { break; case kHSGas: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 5, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(5, 0); + _vm->playGnapScratchingHead(5, 0); break; case GRAB_CURSOR: - if (isFlag(kGFUnk04)) { - playGnapImpossible(0, 0); + if (_vm->isFlag(kGFUnk04)) { + _vm->playGnapImpossible(0, 0); } else if (triedDeviceOnGas) { - _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107BC, 1); - _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASTryToGetGas; + _vm->_hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107BC, 1); + _vm->_hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASTryToGetGas; } else { triedDeviceOnGas = true; - playGnapPullOutDeviceNonWorking(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y); + _vm->playGnapPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); } break; case TALK_CURSOR: case PLAT_CURSOR: - if (isFlag(kGFUnk04)) - playGnapImpossible(0, 0); + if (_vm->isFlag(kGFUnk04)) + _vm->playGnapImpossible(0, 0); else - playGnapScratchingHead(5, 0); + _vm->playGnapScratchingHead(5, 0); break; } } @@ -196,26 +201,26 @@ void GnapEngine::scene06_run() { break; case kHSLadder: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 8, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(8, 4); + _vm->playGnapScratchingHead(8, 4); break; case GRAB_CURSOR: - if (isFlag(kGFGasTaken)) - playGnapImpossible(0, 0); + if (_vm->isFlag(kGFGasTaken)) + _vm->playGnapImpossible(0, 0); else { - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, 0x107BB, 1); - _gnapActionStatus = kASTryToClimbLadder; - setFlag(kGFGasTaken); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASTryToClimbLadder; + _vm->setFlag(kGFGasTaken); } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -223,37 +228,37 @@ void GnapEngine::scene06_run() { break; case kHSHorse: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemTwig && _s06_horseTurnedBack) { - _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; - _gnapIdleFacing = kDirUpLeft; - platypusWalkTo(6, 8, 1, 0x107C2, 1); - _platypusFacing = kDirNone; - _gnapActionStatus = kASUseTwigOnHorse; - setGrabCursorSprite(-1); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 3, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTwig && _s06_horseTurnedBack) { + _vm->_hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _vm->_hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); + _vm->_platypusFacing = kDirNone; + _vm->_gnapActionStatus = kASUseTwigOnHorse; + _vm->setGrabCursorSprite(-1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(3, 2); + _vm->playGnapScratchingHead(3, 2); break; case TALK_CURSOR: if (_s06_horseTurnedBack) { - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { - _gnapIdleFacing = kDirBottomLeft; - _hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASTalkToHorse; + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASTalkToHorse; } break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -261,14 +266,14 @@ void GnapEngine::scene06_run() { break; case kHSExitOutsideBarn: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - if (_cursorValue == 1) - _newSceneNum = 5; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 5; else - _newSceneNum = 35; + _vm->_newSceneNum = 35; } break; @@ -277,34 +282,33 @@ void GnapEngine::scene06_run() { case kHSWalkArea3: case kHSWalkArea4: case kHSWalkArea5: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } + + updateAnimations(); - - scene06_updateAnimations(); - - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(40) + 25; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s06_nextHorseSequenceId == -1) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(40) + 25; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s06_nextHorseSequenceId == -1) { if (_s06_horseTurnedBack) { _s06_nextHorseSequenceId = 0xF5; } else { - switch (getRandom(5)) { + switch (_vm->getRandom(5)) { case 0: case 1: case 2: @@ -320,50 +324,47 @@ void GnapEngine::scene06_run() { } } } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene06_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene06_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene06::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; case kASTryToGetGas: - _gameSys->insertSequence(0xFC, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xFC; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xFC; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; break; case kASTryToClimbLadder: - _gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0xFD, _gnapId, 0); - _gameSys->insertSequence(0xFD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xFD; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASTryToClimbLadderDone; + _vm->_gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xFD, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xFD; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASTryToClimbLadderDone; break; case kASTryToClimbLadderDone: - _gnapX = 6; - _gnapY = 7; - _gnapActionStatus = -1; + _vm->_gnapX = 6; + _vm->_gnapY = 7; + _vm->_gnapActionStatus = -1; break; case kASTalkToHorse: _s06_nextHorseSequenceId = 0xF6; @@ -372,75 +373,74 @@ void GnapEngine::scene06_updateAnimations() { _s06_nextPlatSequenceId = 0xFB; break; default: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - if (_platypusSequenceId == 0xFA) { - _gameSys->setAnimation(0, 0, 1); - invAdd(kItemGas); - setFlag(kGFGasTaken); - _hotspots[kHSLadder]._flags = SF_DISABLED; - setGrabCursorSprite(kItemGas); - _platypusActionStatus = -1; - _platX = 6; - _platY = 8; - _gameSys->insertSequence(0x107C1, _platypusId, 0, 0, kSeqNone, 0, 450 - _platGridX, 384 - _platGridY); - _platypusSequenceId = 0x7C1; - _platypusSequenceDatNum = 1; - setFlag(kGFUnk04); - _gnapActionStatus = -1; - showCursor(); + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusSequenceId == 0xFA) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->invAdd(kItemGas); + _vm->setFlag(kGFGasTaken); + _vm->_hotspots[kHSLadder]._flags = SF_DISABLED; + _vm->setGrabCursorSprite(kItemGas); + _vm->_platypusActionStatus = -1; + _vm->_platX = 6; + _vm->_platY = 8; + _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); + _vm->_platypusSequenceId = 0x7C1; + _vm->_platypusSequenceDatNum = 1; + _vm->setFlag(kGFUnk04); + _vm->_gnapActionStatus = -1; + _vm->showCursor(); } if (_s06_nextPlatSequenceId == 0xFB) { - _gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 1); _s06_nextHorseSequenceId = 0xF2; - _platypusActionStatus = 6; + _vm->_platypusActionStatus = 6; } } - if (_gameSys->getAnimationStatus(2) == 2 && _s06_nextHorseSequenceId != -1) { + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s06_nextHorseSequenceId != -1) { switch (_s06_nextHorseSequenceId) { case 0xF2: - setGrabCursorSprite(-1); - hideCursor(); - _gameSys->setAnimation(0xFA, 256, 1); - _gameSys->insertSequence(0xF2, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x100, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xFB, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xFA, 256, 0xFB, _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0xFA; - _platypusSequenceDatNum = 0; - _gameSys->insertSequence(0x107B7, _gnapId, 0x100, _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B7; - _gnapSequenceDatNum = 1; + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->_gameSys->setAnimation(0xFA, 256, 1); + _vm->_gameSys->insertSequence(0xF2, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xFA; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B7; + _vm->_gnapSequenceDatNum = 1; _s06_currHorseSequenceId = _s06_nextHorseSequenceId; _s06_nextHorseSequenceId = -1; _s06_nextPlatSequenceId = -1; - invRemove(kItemTwig); + _vm->invRemove(kItemTwig); break; case 0xF6: - _gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); - _gameSys->insertSequence(0xF6, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); + _vm->_gameSys->insertSequence(0xF6, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _s06_horseTurnedBack = true; _s06_currHorseSequenceId = _s06_nextHorseSequenceId; _s06_nextHorseSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; default: - _gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); - _gameSys->insertSequence(_s06_nextHorseSequenceId, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); + _vm->_gameSys->insertSequence(_s06_nextHorseSequenceId, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _s06_currHorseSequenceId = _s06_nextHorseSequenceId; _s06_nextHorseSequenceId = -1; break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene06.h b/engines/gnap/scenes/scene06.h new file mode 100644 index 0000000000..43f7f8c678 --- /dev/null +++ b/engines/gnap/scenes/scene06.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE06_H +#define GNAP_SCENE06_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene06: public Scene { +public: + Scene06(GnapEngine *vm); + ~Scene06() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: + bool _s06_horseTurnedBack; + int _s06_nextPlatSequenceId; + int _s06_nextHorseSequenceId; + int _s06_currHorseSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE05_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 81834191dd..f5d82ce512 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -31,6 +31,7 @@ #include "gnap/scenes/scene03.h" #include "gnap/scenes/scene04.h" #include "gnap/scenes/scene05.h" +#include "gnap/scenes/scene06.h" namespace Gnap { @@ -79,8 +80,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 6: - backgroundId = scene06_init(); - scene06_updateHotspots(); + _scene = new Scene06(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -260,8 +262,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 36: - backgroundId = scene06_init(); - scene06_updateHotspots(); + _scene = new Scene06(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -397,7 +400,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 4; break; case 6: - scene06_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 4; break; @@ -550,7 +554,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 36: - scene06_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 0f43db94a201864ea596e82660831f9ea634dd42 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Apr 2016 21:19:02 +0200 Subject: GNAP: Refactor scene 7 --- engines/gnap/gnap.h | 6 - engines/gnap/scenes/scene07.cpp | 273 +++++++++++++++++++------------------- engines/gnap/scenes/scene07.h | 48 +++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 189 insertions(+), 147 deletions(-) create mode 100644 engines/gnap/scenes/scene07.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 43b2f6ae05..651d24e227 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,12 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 7 - int scene07_init(); - void scene07_updateHotspots(); - void scene07_run(); - void scene07_updateAnimations(); - // Scene 8 int _s08_nextDogSequenceId, _s08_currDogSequenceId; int _s08_nextManSequenceId, _s08_currManSequenceId; diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index dab9051114..c94408297e 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -24,6 +24,8 @@ #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene07.h" + namespace Gnap { enum { @@ -41,88 +43,89 @@ enum { kASLeaveScene = 1 }; -int GnapEngine::scene07_init() { +Scene07::Scene07(GnapEngine *vm) : Scene(vm) { +} + +int Scene07::init() { return 0x92; } -void GnapEngine::scene07_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); - setHotspot(kHSDice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 0, 0, 325, 445); - setHotspot(kHSWalkArea2, 325, 0, 799, 445, _isLeavingScene ? SF_WALKABLE : SF_NONE); - setHotspot(kHSWalkArea3, 160, 0, 325, 495); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypus)) - _hotspots[kHSDice]._flags = SF_DISABLED; - _hotspotsCount = 7; +void Scene07::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); + _vm->setHotspot(kHSDice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 0, 0, 325, 445); + _vm->setHotspot(kHSWalkArea2, 325, 0, 799, 445, _vm->_isLeavingScene ? SF_WALKABLE : SF_NONE); + _vm->setHotspot(kHSWalkArea3, 160, 0, 325, 495); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHSDice]._flags = SF_DISABLED; + _vm->_hotspotsCount = 7; } -void GnapEngine::scene07_run() { - queueInsertDeviceIcon(); - _gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); +void Scene07::run() { + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); - invRemove(kItemGas); - invRemove(kItemNeedle); + _vm->invRemove(kItemGas); + _vm->invRemove(kItemNeedle); - if (!isFlag(kGFPlatypus)) - _gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFPlatypus)) + _vm->_gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); - if (_prevSceneNum == 8) { - initGnapPos(7, 7, kDirBottomLeft); - initPlatypusPos(9, 7, kDirUnk4); - endSceneInit(); + if (_vm->_prevSceneNum == 8) { + _vm->initGnapPos(7, 7, kDirBottomLeft); + _vm->initPlatypusPos(9, 7, kDirUnk4); + _vm->endSceneInit(); } else { - _gnapX = 6; - _gnapY = 7; - _gnapId = 140; - _gnapSequenceId = 0x8F; - _gnapSequenceDatNum = 0; - _gnapIdleFacing = kDirBottomRight; - _gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - _gnapActionStatus = kASWait; - _platX = 3; - _platY = 8; - _platypusId = 160; - _platypusSequenceId = 0x91; - _platypusSequenceDatNum = 0; - _platypusFacing = kDirNone; - _gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->_gnapX = 6; + _vm->_gnapY = 7; + _vm->_gnapId = 140; + _vm->_gnapSequenceId = 0x8F; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASWait; + _vm->_platX = 3; + _vm->_platY = 8; + _vm->_platypusId = 160; + _vm->_platypusSequenceId = 0x91; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusFacing = kDirNone; + _vm->_gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); } - _timers[3] = 600; - _timers[4] = getRandom(40) + 50; - - while (!_sceneDone) { - - if (!isSoundPlaying(0x10919)) - playSound(0x10919, true); + _vm->_timers[3] = 600; + _vm->_timers[4] = _vm->getRandom(40) + 50; - if (testWalk(0, 1, 8, 7, 6, 7)) - scene07_updateHotspots(); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x10919)) + _vm->playSound(0x10919, true); - updateMouseCursor(); - updateCursorByHotspot(); + if (_vm->testWalk(0, 1, 8, 7, 6, 7)) + updateHotspots(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSPlatypus: - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -130,53 +133,53 @@ void GnapEngine::scene07_run() { break; case kHSExitHouse: - _isLeavingScene = true; - if (_gnapX > 8) - gnapWalkTo(_gnapX, 7, 0, 0x107AD, 1); + _vm->_isLeavingScene = true; + if (_vm->_gnapX > 8) + _vm->gnapWalkTo(_vm->_gnapX, 7, 0, 0x107AD, 1); else - gnapWalkTo(8, 7, 0, 0x107AD, 1); - _gnapActionStatus = kASLeaveScene; + _vm->gnapWalkTo(8, 7, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kASLeaveScene; break; case kHSDice: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(4, 8, 3, 3); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 8, 3, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: break; case GRAB_CURSOR: - setFlag(kGFPlatypus); - invAdd(kItemDice); - scene07_updateHotspots(); - playGnapPullOutDevice(3, 3); - _gameSys->setAnimation(0x8E, 1, 2); - _gameSys->insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = getGnapSequenceId(gskUseDevice, 0, 0); - _gnapSequenceDatNum = 1; + _vm->setFlag(kGFPlatypus); + _vm->invAdd(kItemDice); + updateHotspots(); + _vm->playGnapPullOutDevice(3, 3); + _vm->_gameSys->setAnimation(0x8E, 1, 2); + _vm->_gameSys->insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = _vm->getGnapSequenceId(gskUseDevice, 0, 0); + _vm->_gnapSequenceDatNum = 1; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene07_updateHotspots(); - _timers[4] = getRandom(40) + 50; + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(40) + 50; } break; case kHSWalkArea1: case kHSWalkArea2: - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHSWalkArea3: @@ -184,91 +187,85 @@ void GnapEngine::scene07_run() { break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene07_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updateGnapIdleSequence(); - if (_platypusActionStatus < 0 && _gnapActionStatus < 0) { - if (_timers[0]) { - if (!_timers[1]) { - _timers[1] = getRandom(20) + 30; - int _gnapRandomValue = getRandom(20); + if (!_vm->_isLeavingScene) { + _vm->updateGnapIdleSequence(); + if (_vm->_platypusActionStatus < 0 && _vm->_gnapActionStatus < 0) { + if (_vm->_timers[0]) { + if (!_vm->_timers[1]) { + _vm->_timers[1] = _vm->getRandom(20) + 30; + int gnapRandomValue = _vm->getRandom(20); // TODO Cleanup - if (_platypusFacing != kDirNone) { - if (_gnapRandomValue != 0 || _platypusSequenceId != 0x7CA) { - if (_gnapRandomValue != 1 || _platypusSequenceId != 0x7CA) { - if (_platY == 9) - playPlatypusSequence(0x107CA); + if (_vm->_platypusFacing != kDirNone) { + if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7CA) { + if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7CA) { + if (_vm->_platY == 9) + _vm->playPlatypusSequence(0x107CA); } else { - playPlatypusSequence(0x10845); + _vm->playPlatypusSequence(0x10845); } } else { - playPlatypusSequence(0x107CC); + _vm->playPlatypusSequence(0x107CC); } - } else if (_gnapRandomValue != 0 || _platypusSequenceId != 0x7C9) { - if (_gnapRandomValue != 1 || _platypusSequenceId != 0x7C9) { - if (_platY == 9) - playPlatypusSequence(0x107C9); + } else if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7C9) { + if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7C9) { + if (_vm->_platY == 9) + _vm->playPlatypusSequence(0x107C9); } else { - playPlatypusSequence(0x10844); + _vm->playPlatypusSequence(0x10844); } } else { - playPlatypusSequence(0x107CB); + _vm->playPlatypusSequence(0x107CB); } - _gameSys->setAnimation(_platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, 1); + _vm->_gameSys->setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); } } else { - _timers[0] = getRandom(75) + 75; - platypusMakeRoom(); + _vm->_timers[0] = _vm->getRandom(75) + 75; + _vm->platypusMakeRoom(); } } else { - _timers[0] = 100; - _timers[1] = 35; + _vm->_timers[0] = 100; + _vm->_timers[1] = 35; } - sceneXX_playRandomSound(4); + _vm->sceneXX_playRandomSound(4); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene07_updateHotspots(); - _timers[4] = getRandom(40) + 50; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(40) + 50; } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene07_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene07::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _newSceneNum = 8; - _sceneDone = true; + _vm->_newSceneNum = 8; + _vm->_sceneDone = true; break; } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->setAnimation(0, 0, 2); - setGrabCursorSprite(kItemDice); + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->setGrabCursorSprite(kItemDice); } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene07.h b/engines/gnap/scenes/scene07.h new file mode 100644 index 0000000000..08fdab2f3f --- /dev/null +++ b/engines/gnap/scenes/scene07.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE07_H +#define GNAP_SCENE07_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene07: public Scene { +public: + Scene07(GnapEngine *vm); + ~Scene07() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + +private: +}; + +} // End of namespace Gnap + +#endif // GNAP_SCENE05_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index f5d82ce512..ba14f1260e 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -32,6 +32,7 @@ #include "gnap/scenes/scene04.h" #include "gnap/scenes/scene05.h" #include "gnap/scenes/scene06.h" +#include "gnap/scenes/scene07.h" namespace Gnap { @@ -87,8 +88,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 7: - backgroundId = scene07_init(); - scene07_updateHotspots(); + _scene = new Scene07(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -406,7 +408,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 4; break; case 7: - scene07_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 8; break; -- cgit v1.2.3 From 84bd15a525aa630d12551eac259abc3e3b6ad217 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Apr 2016 22:59:17 +0200 Subject: GNAP: Refactor scene 8, Add updateAnimationsCb to Scene --- engines/gnap/gnap.cpp | 6 +- engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene00.h | 1 + engines/gnap/scenes/scene01.h | 1 + engines/gnap/scenes/scene02.h | 1 + engines/gnap/scenes/scene03.h | 1 + engines/gnap/scenes/scene04.h | 1 + engines/gnap/scenes/scene05.h | 1 + engines/gnap/scenes/scene06.h | 3 +- engines/gnap/scenes/scene07.h | 5 +- engines/gnap/scenes/scene08.cpp | 461 +++++++++++++++++++------------------- engines/gnap/scenes/scene08.h | 52 +++++ engines/gnap/scenes/scenecore.cpp | 9 +- engines/gnap/scenes/scenecore.h | 1 + 14 files changed, 302 insertions(+), 250 deletions(-) create mode 100644 engines/gnap/scenes/scene08.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index ddaa9f6a8e..d0bbd8db5b 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1797,13 +1797,9 @@ void GnapEngine::gnapUseDeviceOnPlatypuss() { void GnapEngine::doCallback(int callback) { switch (callback) { case 8: - scene08_updateAnimationsCb(); - break; case 10: - scene10_updateAnimationsCb(); - break; case 20: - scene20_updateAnimationsCb(); + _scene->updateAnimationsCb(); break; } } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 651d24e227..fbc97fe0ee 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,15 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 8 - int _s08_nextDogSequenceId, _s08_currDogSequenceId; - int _s08_nextManSequenceId, _s08_currManSequenceId; - int scene08_init(); - void scene08_updateHotspots(); - void scene08_updateAnimationsCb(); - void scene08_run(); - void scene08_updateAnimations(); - // Scene 9 int scene09_init(); void scene09_updateHotspots(); diff --git a/engines/gnap/scenes/scene00.h b/engines/gnap/scenes/scene00.h index 7edcab4207..d71722bcbc 100644 --- a/engines/gnap/scenes/scene00.h +++ b/engines/gnap/scenes/scene00.h @@ -39,6 +39,7 @@ public: virtual void updateHotspots() {} virtual void run(); virtual void updateAnimations() {} + virtual void updateAnimationsCb() {} }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene01.h b/engines/gnap/scenes/scene01.h index e7d3a335b2..c6de546954 100644 --- a/engines/gnap/scenes/scene01.h +++ b/engines/gnap/scenes/scene01.h @@ -39,6 +39,7 @@ public: virtual void updateHotspots(); virtual void run(); virtual void updateAnimations(); + virtual void updateAnimationsCb() {} private: int _s01_pigsIdCtr, _s01_smokeIdCtr; diff --git a/engines/gnap/scenes/scene02.h b/engines/gnap/scenes/scene02.h index 70f0591bcc..d9c341ce45 100644 --- a/engines/gnap/scenes/scene02.h +++ b/engines/gnap/scenes/scene02.h @@ -39,6 +39,7 @@ public: virtual void updateHotspots(); virtual void run(); virtual void updateAnimations(); + virtual void updateAnimationsCb() {} private: int _s02_truckGrillCtr; diff --git a/engines/gnap/scenes/scene03.h b/engines/gnap/scenes/scene03.h index 2ccb1cd542..e8a7ccf716 100644 --- a/engines/gnap/scenes/scene03.h +++ b/engines/gnap/scenes/scene03.h @@ -39,6 +39,7 @@ public: virtual void updateHotspots(); virtual void run(); virtual void updateAnimations(); + virtual void updateAnimationsCb() {} private: bool _s03_platypusHypnotized; diff --git a/engines/gnap/scenes/scene04.h b/engines/gnap/scenes/scene04.h index 11a7eeb46e..519799b48c 100644 --- a/engines/gnap/scenes/scene04.h +++ b/engines/gnap/scenes/scene04.h @@ -39,6 +39,7 @@ public: virtual void updateHotspots(); virtual void run(); virtual void updateAnimations(); + virtual void updateAnimationsCb() {} private: bool _s04_triedWindow; diff --git a/engines/gnap/scenes/scene05.h b/engines/gnap/scenes/scene05.h index f79adc0e41..083abe5f2d 100644 --- a/engines/gnap/scenes/scene05.h +++ b/engines/gnap/scenes/scene05.h @@ -39,6 +39,7 @@ public: virtual void updateHotspots(); virtual void run(); virtual void updateAnimations(); + virtual void updateAnimationsCb() {} private: int _s05_nextChickenSequenceId; diff --git a/engines/gnap/scenes/scene06.h b/engines/gnap/scenes/scene06.h index 43f7f8c678..1f15be54f6 100644 --- a/engines/gnap/scenes/scene06.h +++ b/engines/gnap/scenes/scene06.h @@ -39,6 +39,7 @@ public: virtual void updateHotspots(); virtual void run(); virtual void updateAnimations(); + virtual void updateAnimationsCb() {} private: bool _s06_horseTurnedBack; @@ -49,4 +50,4 @@ private: } // End of namespace Gnap -#endif // GNAP_SCENE05_H +#endif // GNAP_SCENE06_H diff --git a/engines/gnap/scenes/scene07.h b/engines/gnap/scenes/scene07.h index 08fdab2f3f..1afc1f8f12 100644 --- a/engines/gnap/scenes/scene07.h +++ b/engines/gnap/scenes/scene07.h @@ -39,10 +39,9 @@ public: virtual void updateHotspots(); virtual void run(); virtual void updateAnimations(); - -private: + virtual void updateAnimationsCb() {} }; } // End of namespace Gnap -#endif // GNAP_SCENE05_H +#endif // GNAP_SCENE07_H diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index ca777aa11e..d13f763a19 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene08.h" namespace Gnap { @@ -51,123 +52,127 @@ enum { kASPlatWithDog = 7 }; -int GnapEngine::scene08_init() { +Scene08::Scene08(GnapEngine *vm) : Scene(vm) { + _s08_nextDogSequenceId = -1; + _s08_currDogSequenceId = -1; + _s08_nextManSequenceId = -1; + _s08_currManSequenceId = -1; +} + +int Scene08::init() { return 0x150; } -void GnapEngine::scene08_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE); - setHotspot(kHSExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); - setHotspot(kHSMan, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSDoor, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSMeat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSBone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSToy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 290, 340, -1, -1); - setHotspot(kHSWalkArea2, 0, 0, 799, 420); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFBarnPadlockOpen)) - _hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(kGFTruckFilledWithGas)) - _hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(kGFTruckKeysUsed)) - _hotspots[kHSToy]._flags = SF_WALKABLE | SF_DISABLED; - _hotspotsCount = 11; +void Scene08::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHSExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHSMan, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSDoor, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSMeat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSBone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSToy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 290, 340, -1, -1); + _vm->setHotspot(kHSWalkArea2, 0, 0, 799, 420); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFTruckKeysUsed)) + _vm->_hotspots[kHSToy]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspotsCount = 11; } -void GnapEngine::scene08_updateAnimationsCb() { - if (_gameSys->getAnimationStatus(3) == 2) { - _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); +void Scene08::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); _s08_currDogSequenceId = _s08_nextDogSequenceId; if ( _s08_nextDogSequenceId != 0x135 ) _s08_nextDogSequenceId = 0x134; } } -void GnapEngine::scene08_run() { - - queueInsertDeviceIcon(); +void Scene08::run() { + _vm->queueInsertDeviceIcon(); - _gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); _s08_currDogSequenceId = 0x135; _s08_nextDogSequenceId = 0x135; - _gameSys->setAnimation(0x135, 100, 3); - _gameSys->insertSequence(_s08_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x135, 100, 3); + _vm->_gameSys->insertSequence(_s08_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); _s08_currManSequenceId = 0x140; _s08_nextManSequenceId = -1; - _gameSys->setAnimation(0x140, 100, 2); - _gameSys->insertSequence(_s08_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); - - _timers[4] = getRandom(50) + 75; + _vm->_gameSys->setAnimation(0x140, 100, 2); + _vm->_gameSys->insertSequence(_s08_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFBarnPadlockOpen)) - _gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(50) + 75; - if (!isFlag(kGFTruckFilledWithGas)) - _gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFTruckKeysUsed)) - _gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); - initGnapPos(-1, 8, kDirBottomRight); - initPlatypusPos(-1, 7, kDirNone); + if (!_vm->isFlag(kGFTruckKeysUsed)) + _vm->_gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-1, 7, kDirNone); - gnapWalkTo(1, 8, -1, 0x107B9, 1); - platypusWalkTo(1, 7, -1, 0x107C2, 1); + _vm->endSceneInit(); - _timers[5] = getRandom(40) + 50; + _vm->gnapWalkTo(1, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - while (!_sceneDone) { + _vm->_timers[5] = _vm->getRandom(40) + 50; - if (!isSoundPlaying(0x10919)) - playSound(0x10919, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x10919)) + _vm->playSound(0x10919, true); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene08_updateHotspots(); - _timers[4] = getRandom(50) + 75; - _timers[5] = getRandom(40) + 50; + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(50) + 75; + _vm->_timers[5] = _vm->getRandom(40) + 50; } break; case kHSPlatypus: - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFSceneFlag1)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapActionIdle(0x14D); - gnapKissPlatypus(8); + _vm->gnapActionIdle(0x14D); + _vm->gnapKissPlatypus(8); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -176,164 +181,164 @@ void GnapEngine::scene08_run() { break; case kHSExitBackdoor: - _isLeavingScene = true; - gnapActionIdle(0x14D); - gnapWalkTo(0, 6, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(0, 7, 1, 0x107CF, 1); - _newSceneNum = 9; + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(0, 6, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1); + _vm->_newSceneNum = 9; break; case kHSExitCrash: - _isLeavingScene = true; - gnapActionIdle(0x14D); - gnapWalkTo(3, 9, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(4, 9, 1, 0x107C1, 1); - _newSceneNum = 7; + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(3, 9, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1); + _vm->_newSceneNum = 7; break; case kHSMan: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(6, 6, 7, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 6, 7, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapActionIdle(0x14D); - gnapWalkTo(6, 6, 0, 0x107BB, 1); - _gnapActionStatus = kASLookMan; - _gnapIdleFacing = kDirUpRight; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLookMan; + _vm->_gnapIdleFacing = kDirUpRight; break; case GRAB_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapActionIdle(0x14D); - gnapWalkTo(8, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkMan; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkMan; break; case PLAT_CURSOR: - gnapActionIdle(0x14D); - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(6, 6, 1, 0x107C2, 1); - _platypusActionStatus = kASPlatWithMan; - _platypusFacing = kDirNone; - playGnapIdle(6, 6); + _vm->gnapActionIdle(0x14D); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kASPlatWithMan; + _vm->_platypusFacing = kDirNone; + _vm->playGnapIdle(6, 6); break; } } break; case kHSDoor: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(4, 7, 5, 0); - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - _gnapActionStatus = kASGrabDog; + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 7, 5, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASGrabDog; } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 0); - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - _gnapActionStatus = kASLookDog; + _vm->playGnapScratchingHead(6, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASLookDog; break; case GRAB_CURSOR: - gnapWalkTo(4, 7, 0, 0x107BB, 1); - _gnapActionStatus = kASGrabDog; - _gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASGrabDog; + _vm->_gnapIdleFacing = kDirUpRight; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapActionIdle(0x14D); - gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkDog; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkDog; break; case PLAT_CURSOR: - setFlag(kGFSceneFlag1); - gnapActionIdle(0x14D); - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(3, 7, 1, 0x107C2, 1); - _platypusActionStatus = kASPlatWithDog; - _platypusFacing = kDirNone; - playGnapIdle(3, 7); + _vm->setFlag(kGFSceneFlag1); + _vm->gnapActionIdle(0x14D); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kASPlatWithDog; + _vm->_platypusFacing = kDirNone; + _vm->playGnapIdle(3, 7); break; } } break; case kHSMeat: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(6, 8, 5, 6); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 8, 5, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 7); + _vm->playGnapScratchingHead(6, 7); break; case GRAB_CURSOR: if (_s08_currDogSequenceId == 0x135) { - playGnapScratchingHead(6, 7); + _vm->playGnapScratchingHead(6, 7); } else { - gnapActionIdle(0x14D); - playGnapPullOutDevice(6, 7); - playGnapUseDevice(0, 0); + _vm->gnapActionIdle(0x14D); + _vm->playGnapPullOutDevice(6, 7); + _vm->playGnapUseDevice(0, 0); _s08_nextDogSequenceId = 0x149; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSBone: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(2, 7, 3, 6); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(2, 7, 3, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(3, 6); + _vm->playGnapScratchingHead(3, 6); break; case GRAB_CURSOR: if (_s08_currDogSequenceId == 0x135) { - playGnapScratchingHead(3, 6); + _vm->playGnapScratchingHead(3, 6); } else { - gnapActionIdle(0x14D); - playGnapPullOutDevice(3, 6); - playGnapUseDevice(0, 0); + _vm->gnapActionIdle(0x14D); + _vm->playGnapPullOutDevice(3, 6); + _vm->playGnapUseDevice(0, 0); _s08_nextDogSequenceId = 0x14A; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSToy: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(8, 7, 7, 6); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(8, 7, 7, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(7, 6); + _vm->playGnapScratchingHead(7, 6); break; case GRAB_CURSOR: if (_s08_currDogSequenceId == 0x135) { - playGnapScratchingHead(7, 6); + _vm->playGnapScratchingHead(7, 6); } else { - gnapActionIdle(0x14D); - playGnapPullOutDevice(7, 6); - playGnapUseDevice(0, 0); + _vm->gnapActionIdle(0x14D); + _vm->playGnapPullOutDevice(7, 6); + _vm->playGnapUseDevice(0, 0); _s08_nextDogSequenceId = 0x14B; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -341,30 +346,29 @@ void GnapEngine::scene08_run() { case kHSWalkArea1: case kHSWalkArea2: - gnapActionIdle(0x14D); - gnapWalkTo(-1, 6, -1, -1, 1); + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(-1, 6, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapActionIdle(0x14D); - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene08_updateAnimations(); - - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(50) + 125; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s08_nextManSequenceId == -1 && + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(50) + 125; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s08_nextManSequenceId == -1 && (_s08_currDogSequenceId == 0x134 || _s08_currDogSequenceId == 0x135)) { - int _gnapRandomValue = getRandom(4); + int _gnapRandomValue = _vm->getRandom(4); switch (_gnapRandomValue) { case 0: _s08_nextManSequenceId = 0x138; @@ -381,141 +385,140 @@ void GnapEngine::scene08_run() { } } } - sceneXX_playRandomSound(5); + _vm->sceneXX_playRandomSound(5); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene08_updateHotspots(); - _timers[4] = getRandom(50) + 75; - _timers[5] = getRandom(40) + 50; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(50) + 75; + _vm->_timers[5] = _vm->getRandom(40) + 50; } - gameUpdateTick(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene08_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene08::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; case kASTalkMan: _s08_nextManSequenceId = 0x13F; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASLookMan: _s08_nextManSequenceId = 0x140; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASLookDog: _s08_nextManSequenceId = 0x137; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASGrabDog: if (_s08_currDogSequenceId == 0x135) _s08_nextDogSequenceId = 0x133; else _s08_nextDogSequenceId = 0x13C; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASTalkDog: if (_s08_currDogSequenceId == 0x135) _s08_nextDogSequenceId = 0x133; else _s08_nextDogSequenceId = 0x13C; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - switch (_platypusActionStatus) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { case kASPlatWithDog: _s08_nextDogSequenceId = 0x147; break; case kASPlatWithMan: _s08_nextManSequenceId = 0x140; - _platypusActionStatus = -1; + _vm->_platypusActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2 && _s08_nextManSequenceId != -1) { - _gameSys->setAnimation(_s08_nextManSequenceId, 100, 2); - _gameSys->insertSequence(_s08_nextManSequenceId, 100, _s08_currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s08_nextManSequenceId != -1) { + _vm->_gameSys->setAnimation(_s08_nextManSequenceId, 100, 2); + _vm->_gameSys->insertSequence(_s08_nextManSequenceId, 100, _s08_currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); _s08_currManSequenceId = _s08_nextManSequenceId; _s08_nextManSequenceId = -1; } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_s08_currDogSequenceId == 0x147) - _platypusActionStatus = -1; + _vm->_platypusActionStatus = -1; if (_s08_currDogSequenceId == 0x149 || _s08_currDogSequenceId == 0x14A || _s08_currDogSequenceId == 0x14B) { - if (getRandom(2) != 0) + if (_vm->getRandom(2) != 0) _s08_nextManSequenceId = 0x13D; else _s08_nextManSequenceId = 0x13E; } else if (_s08_currDogSequenceId == 0x133) _s08_nextManSequenceId = 0x139; if (_s08_nextDogSequenceId == 0x149 || _s08_nextDogSequenceId == 0x14A || _s08_nextDogSequenceId == 0x14B) { - _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); switch (_s08_nextDogSequenceId) { case 0x149: - setFlag(kGFBarnPadlockOpen); - _hotspots[kHSMeat]._flags = SF_DISABLED | SF_WALKABLE; - _gameSys->removeSequence(0x144, 1, true); + _vm->setFlag(kGFBarnPadlockOpen); + _vm->_hotspots[kHSMeat]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_gameSys->removeSequence(0x144, 1, true); break; case 0x14A: - setFlag(kGFTruckFilledWithGas); - _hotspots[kHSBone]._flags = SF_DISABLED | SF_WALKABLE; - _gameSys->removeSequence(0x145, 1, true); + _vm->setFlag(kGFTruckFilledWithGas); + _vm->_hotspots[kHSBone]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_gameSys->removeSequence(0x145, 1, true); break; case 0x14B: - setFlag(kGFTruckKeysUsed); - _hotspots[kHSToy]._flags = SF_DISABLED | SF_WALKABLE; - _gameSys->removeSequence(0x146, 1, true); + _vm->setFlag(kGFTruckKeysUsed); + _vm->_hotspots[kHSToy]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_gameSys->removeSequence(0x146, 1, true); break; } _s08_currDogSequenceId = _s08_nextDogSequenceId; _s08_nextDogSequenceId = 0x134; } else if (_s08_nextDogSequenceId == 0x147) { - _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x148, 160, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _s08_currDogSequenceId = _s08_nextDogSequenceId; _s08_nextDogSequenceId = 0x134; - _platX = 1; - _platY = 8; - _platypusId = 160; - _platypusSequenceId = 0x148; - _platypusFacing = kDirUnk4; - _platypusSequenceDatNum = 0; - if (_gnapX == 1 && _gnapY == 8) - gnapWalkStep(); + _vm->_platX = 1; + _vm->_platY = 8; + _vm->_platypusId = 160; + _vm->_platypusSequenceId = 0x148; + _vm->_platypusFacing = kDirUnk4; + _vm->_platypusSequenceDatNum = 0; + if (_vm->_gnapX == 1 && _vm->_gnapY == 8) + _vm->gnapWalkStep(); } else if (_s08_nextDogSequenceId != -1) { - _gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); _s08_currDogSequenceId = _s08_nextDogSequenceId; if (_s08_nextDogSequenceId != 0x135) _s08_nextDogSequenceId = 0x134; if (_s08_currDogSequenceId == 0x133) { - _timers[2] = getRandom(30) + 20; - _timers[3] = getRandom(50) + 200; - _gameSys->insertSequence(0x14D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x14D; - _gnapIdleFacing = kDirUpRight; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x14D; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; } } } diff --git a/engines/gnap/scenes/scene08.h b/engines/gnap/scenes/scene08.h new file mode 100644 index 0000000000..ab538ce29a --- /dev/null +++ b/engines/gnap/scenes/scene08.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE08_H +#define GNAP_SCENE08_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene08: public Scene { +public: + Scene08(GnapEngine *vm); + ~Scene08() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _s08_nextDogSequenceId; + int _s08_currDogSequenceId; + int _s08_nextManSequenceId; + int _s08_currManSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE08_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index ba14f1260e..f93f995f78 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -33,6 +33,7 @@ #include "gnap/scenes/scene05.h" #include "gnap/scenes/scene06.h" #include "gnap/scenes/scene07.h" +#include "gnap/scenes/scene08.h" namespace Gnap { @@ -95,8 +96,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 8: - backgroundId = scene08_init(); - scene08_updateHotspots(); + _scene = new Scene08(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -414,7 +416,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 8; break; case 8: - scene08_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 9; break; diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index a97bf5c8e4..63f11b9c8b 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -38,6 +38,7 @@ public: virtual void updateHotspots() = 0; virtual void run() = 0; virtual void updateAnimations() = 0; + virtual void updateAnimationsCb() = 0; protected: GnapEngine *_vm; -- cgit v1.2.3 From 4e8119b262df0a933d67646f561ba630cb9cf746 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Apr 2016 23:33:42 +0200 Subject: GNAP: Refactor scene 9 --- engines/gnap/gnap.h | 6 - engines/gnap/scenes/scene09.cpp | 224 +++++++++++++++++++------------------- engines/gnap/scenes/scene09.h | 48 ++++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 164 insertions(+), 123 deletions(-) create mode 100644 engines/gnap/scenes/scene09.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index fbc97fe0ee..4331029946 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,12 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 9 - int scene09_init(); - void scene09_updateHotspots(); - void scene09_run(); - void scene09_updateAnimations(); - // Scene 10 int _s10_nextCookSequenceId, _s10_currCookSequenceId; int scene10_init(); diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 4183b34738..ac0b1be342 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene09.h" namespace Gnap { @@ -43,79 +44,79 @@ enum { kASSearchTrashDone = 2 }; -int GnapEngine::scene09_init() { +Scene09::Scene09(GnapEngine *vm) : Scene(vm) { +} + +int Scene09::init() { return 0x4E; } -void GnapEngine::scene09_updateHotspots() { - setHotspot(kHSPlatypus, 0, 200, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitKitchen, 280, 200, 380, 400, SF_EXIT_U_CURSOR); - setHotspot(kHSExitHouse, 790, 200, 799, 450, SF_EXIT_R_CURSOR | SF_WALKABLE); - setHotspot(kHSTrash, 440, 310, 680, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 0, 0, 799, 400); - setHotspot(kHSWalkArea2, 0, 0, 630, 450); - setHotspot(kHSWalkArea2, 0, 0, 175, 495); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 8; +void Scene09::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 200, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitKitchen, 280, 200, 380, 400, SF_EXIT_U_CURSOR); + _vm->setHotspot(kHSExitHouse, 790, 200, 799, 450, SF_EXIT_R_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHSTrash, 440, 310, 680, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 0, 0, 799, 400); + _vm->setHotspot(kHSWalkArea2, 0, 0, 630, 450); + _vm->setHotspot(kHSWalkArea2, 0, 0, 175, 495); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 8; } -void GnapEngine::scene09_run() { +void Scene09::run() { + _vm->queueInsertDeviceIcon(); - queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); - - if (_prevSceneNum == 8) { - initGnapPos(11, 8, kDirBottomLeft); - initPlatypusPos(12, 7, kDirUnk4); - endSceneInit(); - gnapWalkTo(9, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 7, -1, 0x107D2, 1); + if (_vm->_prevSceneNum == 8) { + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { - initGnapPos(4, 7, kDirBottomRight); - initPlatypusPos(5, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(4, 7, kDirBottomRight); + _vm->initPlatypusPos(5, 7, kDirNone); + _vm->endSceneInit(); } - _timers[4] = getRandom(150) + 50; - _timers[5] = getRandom(40) + 50; + _vm->_timers[4] = _vm->getRandom(150) + 50; + _vm->_timers[5] = _vm->getRandom(40) + 50; - while (!_sceneDone) { - - if (!isSoundPlaying(0x10919)) - playSound(0x10919, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x10919)) + _vm->playSound(0x10919, true); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene09_updateHotspots(); - _timers[4] = getRandom(150) + 50; - _timers[5] = getRandom(40) + 50; + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(150) + 50; + _vm->_timers[5] = _vm->getRandom(40) + 50; } break; case kHSPlatypus: - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -123,38 +124,38 @@ void GnapEngine::scene09_run() { break; case kHSExitKitchen: - _isLeavingScene = true; - _newSceneNum = 10; - gnapWalkTo(4, 7, 0, 0x107BF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(4, 8, -1, 0x107D2, 1); - _platypusFacing = kDirUnk4; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 10; + _vm->gnapWalkTo(4, 7, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); + _vm->_platypusFacing = kDirUnk4; break; case kHSExitHouse: - _isLeavingScene = true; - _newSceneNum = 8; - gnapWalkTo(10, -1, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(10, -1, -1, 0x107CD, 1); - _platypusFacing = kDirUnk4; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 8; + _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); + _vm->_platypusFacing = kDirUnk4; break; case kHSTrash: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(9, 6, 8, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(9, 6, 8, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(8, 3); + _vm->playGnapScratchingHead(8, 3); break; case GRAB_CURSOR: - _gnapActionStatus = kASSearchTrash; - gnapWalkTo(9, 6, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASSearchTrash; + _vm->gnapWalkTo(9, 6, 0, 0x107BC, 1); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -163,79 +164,74 @@ void GnapEngine::scene09_run() { case kHSWalkArea1: case kHSWalkArea2: case kHSWalkArea3: - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene09_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene && _gnapActionStatus != 1 && _gnapActionStatus != 2) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(150) + 100; - if (_timers[4] & 1) - _gameSys->insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_isLeavingScene && _vm->_gnapActionStatus != 1 && _vm->_gnapActionStatus != 2) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(150) + 100; + if (_vm->_timers[4] & 1) + _vm->_gameSys->insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); } - sceneXX_playRandomSound(5); + _vm->sceneXX_playRandomSound(5); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene09_updateHotspots(); - _timers[4] = getRandom(150) + 50; - _timers[5] = getRandom(40) + 50; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(150) + 50; + _vm->_timers[5] = _vm->getRandom(40) + 50; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene09_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene09::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; case kASSearchTrash: - _gameSys->setAnimation(0x4C, 120, 0); - _gameSys->insertSequence(0x4C, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x4B, 2, true); - _gnapSequenceId = 0x4C; - _gnapId = 120; - _gnapIdleFacing = kDirUpLeft; - _gnapSequenceDatNum = 0; - _gnapX = 9; - _gnapY = 6; - _gnapActionStatus = kASSearchTrashDone; + _vm->_gameSys->setAnimation(0x4C, 120, 0); + _vm->_gameSys->insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x4B, 2, true); + _vm->_gnapSequenceId = 0x4C; + _vm->_gnapId = 120; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 9; + _vm->_gnapY = 6; + _vm->_gnapActionStatus = kASSearchTrashDone; break; case kASSearchTrashDone: - _gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); - _timers[2] = 360; - _timers[4] = getRandom(150) + 100; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[2] = 360; + _vm->_timers[4] = _vm->getRandom(150) + 100; + _vm->_gnapActionStatus = -1; break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene09.h b/engines/gnap/scenes/scene09.h new file mode 100644 index 0000000000..c914d16aa9 --- /dev/null +++ b/engines/gnap/scenes/scene09.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE09_H +#define GNAP_SCENE09_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene09: public Scene { +public: + Scene09(GnapEngine *vm); + ~Scene09() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} + +private: +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE09_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index f93f995f78..3c0c89eddf 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -34,6 +34,7 @@ #include "gnap/scenes/scene06.h" #include "gnap/scenes/scene07.h" #include "gnap/scenes/scene08.h" +#include "gnap/scenes/scene09.h" namespace Gnap { @@ -103,8 +104,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 9: - backgroundId = scene09_init(); - scene09_updateHotspots(); + _scene = new Scene09(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -422,7 +424,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 9; break; case 9: - scene09_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 10; break; -- cgit v1.2.3 From 076d23fdb6494285cb54b6cbb0c0cd27d085a0db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Apr 2016 00:09:44 +0200 Subject: GNAP: Refactor scene 10 --- engines/gnap/gnap.h | 8 - engines/gnap/scenes/scene10.cpp | 459 +++++++++++++++++++------------------- engines/gnap/scenes/scene10.h | 50 +++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 285 insertions(+), 241 deletions(-) create mode 100644 engines/gnap/scenes/scene10.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 4331029946..4b95dbcac6 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,14 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 10 - int _s10_nextCookSequenceId, _s10_currCookSequenceId; - int scene10_init(); - void scene10_updateHotspots(); - void scene10_run(); - void scene10_updateAnimations(); - void scene10_updateAnimationsCb(); - // Scene 11 int _s11_billardBallCtr; int _s11_nextHookGuySequenceId, _s11_currHookGuySequenceId; diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp index 311045db6c..9f987ba7bc 100644 --- a/engines/gnap/scenes/scene10.cpp +++ b/engines/gnap/scenes/scene10.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene10.h" namespace Gnap { @@ -47,95 +48,97 @@ enum { kASPlatWithBox = 4 }; -int GnapEngine::scene10_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); - return 0x10F; +Scene10::Scene10(GnapEngine *vm) : Scene(vm) { + _s10_nextCookSequenceId = -1; + _s10_currCookSequenceId = -1; } -void GnapEngine::scene10_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitBar, 0, 75, 85, 455, SF_EXIT_NW_CURSOR); - setHotspot(kHSExitBackdoor, 75, 590, 500, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); - setHotspot(kHSCook, 370, 205, 495, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSTongs, 250, 290, 350, 337, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSBox, 510, 275, 565, 330, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSOven, 690, 280, 799, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 59, 0, 495, 460); - setHotspot(kHSWalkArea2, 495, 0, 650, 420); - setHotspot(kHSWalkArea3, 651, 0, 725, 400); - setHotspot(kHSWalkArea4, 725, 0, 799, 441); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 12; +int Scene10::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + return 0x10F; } -void GnapEngine::scene10_run() { +void Scene10::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitBar, 0, 75, 85, 455, SF_EXIT_NW_CURSOR); + _vm->setHotspot(kHSExitBackdoor, 75, 590, 500, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHSCook, 370, 205, 495, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSTongs, 250, 290, 350, 337, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSBox, 510, 275, 565, 330, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSOven, 690, 280, 799, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 59, 0, 495, 460); + _vm->setHotspot(kHSWalkArea2, 495, 0, 650, 420); + _vm->setHotspot(kHSWalkArea3, 651, 0, 725, 400); + _vm->setHotspot(kHSWalkArea4, 725, 0, 799, 441); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 12; +} +void Scene10::run() { _s10_currCookSequenceId = 0x103; - _gameSys->setAnimation(0x103, 100, 2); - _gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x103, 100, 2); + _vm->_gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); _s10_nextCookSequenceId = 0x106; - if (!isFlag(kGFMudTaken)) - _gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFMudTaken)) + _vm->_gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (_prevSceneNum == 9) { - initGnapPos(11, 8, kDirBottomLeft); - initPlatypusPos(12, 7, kDirUnk4); - endSceneInit(); - gnapWalkTo(9, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 7, -1, 0x107D2, 1); + if (_vm->_prevSceneNum == 9) { + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { - initGnapPos(-1, 7, kDirBottomRight); - initPlatypusPos(-2, 8, kDirNone); - endSceneInit(); - gnapWalkTo(1, 7, -1, 0x107B9, 1); - platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(1, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } - _timers[4] = getRandom(80) + 150; - _timers[5] = getRandom(100) + 100; + _vm->_timers[4] = _vm->getRandom(80) + 150; + _vm->_timers[5] = _vm->getRandom(100) + 100; - while (!_sceneDone) { + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1091E)) + _vm->playSound(0x1091E, true); - if (!isSoundPlaying(0x1091E)) - playSound(0x1091E, true); + if (!_vm->isSoundPlaying(0x1091A)) + _vm->playSound(0x1091A, true); - if (!isSoundPlaying(0x1091A)) - playSound(0x1091A, true); + _vm->updateMouseCursor(); - updateMouseCursor(); + _vm->testWalk(0, 0, -1, -1, -1, -1); - testWalk(0, 0, -1, -1, -1, -1); + _vm->updateCursorByHotspot(); - updateCursorByHotspot(); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSPlatypus: - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFMudTaken)) - playGnapMoan1(_platX, _platY); + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); else - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(10); + _vm->gnapKissPlatypus(10); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -144,86 +147,86 @@ void GnapEngine::scene10_run() { break; case kHSExitBar: - _isLeavingScene = true; - gnapActionIdle(0x10C); - gnapWalkTo(0, 7, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(0, 7, -1, 0x107CF, 1); - _newSceneNum = 11; + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(0, 7, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(0, 7, -1, 0x107CF, 1); + _vm->_newSceneNum = 11; break; case kHSExitBackdoor: - _isLeavingScene = true; - gnapActionIdle(0x10C); - gnapWalkTo(2, 9, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(3, 9, -1, 0x107C7, 1); - _newSceneNum = 9; + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(2, 9, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(3, 9, -1, 0x107C7, 1); + _vm->_newSceneNum = 9; break; case kHSCook: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(4, 8, 6, 0); - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - _gnapActionStatus = kASAnnoyCook; + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 8, 6, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASAnnoyCook; } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 0); + _vm->playGnapScratchingHead(6, 0); break; case GRAB_CURSOR: - playGnapImpossible(0, 0); - _gnapIdleFacing = kDirBottomRight; + _vm->playGnapImpossible(0, 0); + _vm->_gnapIdleFacing = kDirBottomRight; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapActionIdle(0x10C); - gnapWalkTo(4, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASAnnoyCook; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(4, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASAnnoyCook; break; case PLAT_CURSOR: - gnapActionIdle(0x10C); - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(4, 6, -1, -1, 1); - gnapWalkTo(4, 8, 0, 0x107BB, 1); - _gnapActionStatus = kASAnnoyCook; + _vm->gnapActionIdle(0x10C); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(4, 6, -1, -1, 1); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASAnnoyCook; break; } } break; case kHSTongs: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(3, 7, 4, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 7, 4, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFMudTaken)) - playGnapMoan2(-1, -1); + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); else - playGnapScratchingHead(4, 3); + _vm->playGnapScratchingHead(4, 3); break; case GRAB_CURSOR: - if (isFlag(kGFMudTaken)) - playGnapMoan2(-1, -1); + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); else { - gnapActionIdle(0x10C); - gnapWalkTo(4, 8, 0, 0x107BB, 1); - _gnapActionStatus = kASAnnoyCook; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASAnnoyCook; } break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(kGFMudTaken)) - playGnapMoan2(-1, -1); + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); else { - gnapActionIdle(0x10C); - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(3, 7, -1, -1, 1); - gnapWalkTo(4, 8, 0, 0x107BB, 1); - _gnapActionStatus = kASAnnoyCook; + _vm->gnapActionIdle(0x10C); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(3, 7, -1, -1, 1); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASAnnoyCook; } break; } @@ -231,34 +234,34 @@ void GnapEngine::scene10_run() { break; case kHSBox: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(7, 6, 6, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 6, 6, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(7, 3); + _vm->playGnapScratchingHead(7, 3); break; case GRAB_CURSOR: - gnapActionIdle(0x10C); - gnapWalkTo(4, 8, 0, 0x107BB, 1); - _gnapActionStatus = kASAnnoyCook; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASAnnoyCook; break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(kGFMudTaken)) - playGnapMoan2(-1, -1); + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); else { - invAdd(kItemTongs); - setFlag(kGFMudTaken); - gnapActionIdle(0x10C); - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(7, 6, 1, 0x107D2, 1); - _platypusActionStatus = kASPlatWithBox; - _platypusFacing = kDirUnk4; - _largeSprite = _gameSys->createSurface(0xC3); - playGnapIdle(7, 6); + _vm->invAdd(kItemTongs); + _vm->setFlag(kGFMudTaken); + _vm->gnapActionIdle(0x10C); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); + _vm->_platypusActionStatus = kASPlatWithBox; + _vm->_platypusFacing = kDirUnk4; + _vm->_largeSprite = _vm->_gameSys->createSurface(0xC3); + _vm->playGnapIdle(7, 6); } break; } @@ -266,28 +269,28 @@ void GnapEngine::scene10_run() { break; case kHSOven: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(9, 6, 10, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(9, 6, 10, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapSequence(getGnapSequenceId(gskDeflect, 10, 5) | 0x10000); + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 10, 5) | 0x10000); break; case GRAB_CURSOR: - gnapActionIdle(0x10C); - gnapWalkTo(9, 6, 0, 0x107BB, 1); - _gameSys->insertSequence(0x10E, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x10E; - _gnapId = 120; - _gnapIdleFacing = kDirUpRight; - _gnapSequenceDatNum = 0; - _gnapX = 9; - _gnapY = 6; - _timers[2] = 360; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(9, 6, 0, 0x107BB, 1); + _vm->_gameSys->insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x10E; + _vm->_gnapId = 120; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 9; + _vm->_gnapY = 6; + _vm->_timers[2] = 360; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -297,39 +300,38 @@ void GnapEngine::scene10_run() { case kHSWalkArea2: case kHSWalkArea3: case kHSWalkArea4: - gnapActionIdle(0x10C); - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene10_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; default: - if (_mouseClickState._left) { - gnapActionIdle(0x10C); - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene10_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(80) + 150; - playSound(0x12B, false); + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(80) + 150; + _vm->playSound(0x12B, false); } - if (!_timers[5]) { - _timers[5] = getRandom(100) + 100; - int _gnapRandomValue = getRandom(4); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 100; + int _gnapRandomValue = _vm->getRandom(4); if (_gnapRandomValue) { int sequenceId; if (_gnapRandomValue == 1) { @@ -339,32 +341,29 @@ void GnapEngine::scene10_run() { } else { sequenceId = 0x8A7; } - _gameSys->insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); } } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene10_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene10_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene10::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASAnnoyCook: _s10_nextCookSequenceId = 0x105; @@ -372,57 +371,57 @@ void GnapEngine::scene10_updateAnimations() { } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - switch (_platypusActionStatus) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { case kASPlatWithBox: _s10_nextCookSequenceId = 0x109; break; } } - if (_gameSys->getAnimationStatus(2) == 2 && _s10_nextCookSequenceId != -1) { + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s10_nextCookSequenceId != -1) { switch (_s10_nextCookSequenceId) { case 0x109: - _platX = 4; - _platY = 8; - _gameSys->insertSequence(0x109, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x107C9, 160, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, - kSeqSyncWait, getSequenceTotalDuration(0x109) + getSequenceTotalDuration(0x10A) + getSequenceTotalDuration(0x10843), - 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _gameSys->removeSequence(0x107, 100, true); + _vm->_platX = 4; + _vm->_platY = 8; + _vm->_gameSys->insertSequence(0x109, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107C9, 160, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), + 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + _vm->_gameSys->removeSequence(0x107, 100, true); _s10_currCookSequenceId = 0x109; _s10_nextCookSequenceId = 0x843; - _platypusSequenceId = 0x7C9; - _platypusId = 160; - _platypusFacing = kDirNone; - _platypusSequenceDatNum = 1; + _vm->_platypusSequenceId = 0x7C9; + _vm->_platypusId = 160; + _vm->_platypusFacing = kDirNone; + _vm->_platypusSequenceDatNum = 1; break; case 0x843: - hideCursor(); - _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); - _gameSys->insertSequence(0x10843, 301, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->hideCursor(); + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_gameSys->insertSequence(0x10843, 301, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _s10_currCookSequenceId = 0x843; _s10_nextCookSequenceId = 0x10A; break; case 0x10A: - _gameSys->insertSequence(_s10_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s10_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); _s10_currCookSequenceId = _s10_nextCookSequenceId; _s10_nextCookSequenceId = 0x104; - showCursor(); - _gameSys->removeSpriteDrawItem(_largeSprite, 300); - delayTicksCursor(5); - deleteSurface(&_largeSprite); - setGrabCursorSprite(kItemTongs); - if (_platypusActionStatus == kASPlatWithBox) - _platypusActionStatus = -1; - if (_gnapX == 4 && _gnapY == 8) - gnapWalkStep(); + _vm->showCursor(); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->delayTicksCursor(5); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->setGrabCursorSprite(kItemTongs); + if (_vm->_platypusActionStatus == kASPlatWithBox) + _vm->_platypusActionStatus = -1; + if (_vm->_gnapX == 4 && _vm->_gnapY == 8) + _vm->gnapWalkStep(); break; default: - _gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _s10_currCookSequenceId = _s10_nextCookSequenceId; break; } @@ -430,8 +429,8 @@ void GnapEngine::scene10_updateAnimations() { switch (_s10_currCookSequenceId) { case 0x106: { // TODO: Refactor into a if + a switch - int rnd = getRandom(7); - if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) + int rnd = _vm->getRandom(7); + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; else if (rnd == 0) _s10_nextCookSequenceId = 0x104; @@ -439,31 +438,31 @@ void GnapEngine::scene10_updateAnimations() { _s10_nextCookSequenceId = 0x103; else if (rnd == 2) { _s10_nextCookSequenceId = 0x106; - _gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); } else _s10_nextCookSequenceId = 0x106; } break; case 0x103: - if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; - else if (getRandom(7) == 0) + else if (_vm->getRandom(7) == 0) _s10_nextCookSequenceId = 0x104; else _s10_nextCookSequenceId = 0x106; break; case 0x104: - if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; - else if (getRandom(7) == 0) + else if (_vm->getRandom(7) == 0) _s10_nextCookSequenceId = 0x103; else _s10_nextCookSequenceId = 0x106; break; case 0x105: { // TODO: Refactor into a if + a switch - int rnd = getRandom(7); - if (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) + int rnd = _vm->getRandom(7); + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) _s10_nextCookSequenceId = 0x106; else if (rnd == 0) _s10_nextCookSequenceId = 0x104; @@ -471,28 +470,28 @@ void GnapEngine::scene10_updateAnimations() { _s10_nextCookSequenceId = 0x103; else _s10_nextCookSequenceId = 0x106; - _timers[2] = getRandom(30) + 20; - _timers[3] = 300; - _gameSys->insertSequence(0x10C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x10C; - _gnapIdleFacing = kDirUpRight; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; - _platypusActionStatus = -1; + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 300; + _vm->_gameSys->insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x10C; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + _vm->_platypusActionStatus = -1; } break; } if (_s10_currCookSequenceId == 0x843) - _gameSys->setAnimation(_s10_currCookSequenceId | 0x10000, 301, 2); + _vm->_gameSys->setAnimation(_s10_currCookSequenceId | 0x10000, 301, 2); else - _gameSys->setAnimation(_s10_currCookSequenceId, 100, 2); + _vm->_gameSys->setAnimation(_s10_currCookSequenceId, 100, 2); } } -void GnapEngine::scene10_updateAnimationsCb() { - if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->setAnimation(_s10_nextCookSequenceId, 100, 2); - _gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); +void Scene10::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(_s10_nextCookSequenceId, 100, 2); + _vm->_gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _s10_currCookSequenceId = _s10_nextCookSequenceId; _s10_nextCookSequenceId = 0x106; } diff --git a/engines/gnap/scenes/scene10.h b/engines/gnap/scenes/scene10.h new file mode 100644 index 0000000000..987c059098 --- /dev/null +++ b/engines/gnap/scenes/scene10.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE10_H +#define GNAP_SCENE10_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene10: public Scene { +public: + Scene10(GnapEngine *vm); + ~Scene10() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _s10_nextCookSequenceId; + int _s10_currCookSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE10_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 3c0c89eddf..508c163fb8 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -35,6 +35,7 @@ #include "gnap/scenes/scene07.h" #include "gnap/scenes/scene08.h" #include "gnap/scenes/scene09.h" +#include "gnap/scenes/scene10.h" namespace Gnap { @@ -111,8 +112,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 10: - backgroundId = scene10_init(); - scene10_updateHotspots(); + _scene = new Scene10(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -430,7 +432,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 10; break; case 10: - scene10_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 11; break; -- cgit v1.2.3 From b535ef3abe397d4ce8457fb95e3a8ab89d94ae9e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Apr 2016 07:11:15 +0200 Subject: GNAP: Refactor scene 11 --- engines/gnap/gnap.cpp | 3 - engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene11.cpp | 419 +++++++++++++++++++------------------- engines/gnap/scenes/scene11.h | 53 +++++ engines/gnap/scenes/scenecore.cpp | 8 +- 5 files changed, 268 insertions(+), 224 deletions(-) create mode 100644 engines/gnap/scenes/scene11.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index d0bbd8db5b..daf8308321 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2018,9 +2018,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 11 - _s11_billardBallCtr = 0; - // Scene 13 _s13_backToiletCtr = -1; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 4b95dbcac6..939212aa2b 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,15 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 11 - int _s11_billardBallCtr; - int _s11_nextHookGuySequenceId, _s11_currHookGuySequenceId; - int _s11_nextGoggleGuySequenceId, _s11_currGoggleGuySequenceId; - int scene11_init(); - void scene11_updateHotspots(); - void scene11_run(); - void scene11_updateAnimations(); - // Scene 12 int _s12_nextBeardGuySequenceId, _s12_currBeardGuySequenceId; int _s12_nextToothGuySequenceId, _s12_currToothGuySequenceId; diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp index 35a575cd27..ae264dcccf 100644 --- a/engines/gnap/scenes/scene11.cpp +++ b/engines/gnap/scenes/scene11.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene11.h" namespace Gnap { @@ -52,118 +53,122 @@ enum { kASGrabBillardBall = 11 }; -int GnapEngine::scene11_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 3); - _gameSys->setAnimation(0, 0, 2); - if (_prevSceneNum == 10 || _prevSceneNum == 13) { - playSound(0x108EC, false); - playSound(0x10928, false); +Scene11::Scene11(GnapEngine *vm) : Scene(vm) { + _s11_billardBallCtr = 0; + _s11_nextHookGuySequenceId = -1; + _s11_currHookGuySequenceId = -1; + _s11_nextGoggleGuySequenceId = -1; + _s11_currGoggleGuySequenceId = -1; +} + +int Scene11::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 2); + if (_vm->_prevSceneNum == 10 || _vm->_prevSceneNum == 13) { + _vm->playSound(0x108EC, false); + _vm->playSound(0x10928, false); } return 0x209; } -void GnapEngine::scene11_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitKitchen, 420, 140, 520, 345, SF_EXIT_U_CURSOR); - setHotspot(kHSExitToilet, 666, 130, 740, 364, SF_EXIT_R_CURSOR); - setHotspot(kHSExitLeft, 0, 350, 10, 599, SF_EXIT_L_CURSOR | SF_WALKABLE); - setHotspot(kHSGoggleGuy, 90, 185, 185, 340, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSHookGuy, 210, 240, 340, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSBillard, 640, 475, 700, 530, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 0, 0, 365, 453); - setHotspot(kHSWalkArea2, 0, 0, 629, 353); - setHotspot(kHSWalkArea3, 629, 0, 799, 364); - setHotspot(kHSWalkArea4, 735, 0, 799, 397); - setHotspot(kHSWalkArea5, 510, 540, 799, 599); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 13; +void Scene11::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitKitchen, 420, 140, 520, 345, SF_EXIT_U_CURSOR); + _vm->setHotspot(kHSExitToilet, 666, 130, 740, 364, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHSExitLeft, 0, 350, 10, 599, SF_EXIT_L_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHSGoggleGuy, 90, 185, 185, 340, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSHookGuy, 210, 240, 340, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSBillard, 640, 475, 700, 530, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 0, 0, 365, 453); + _vm->setHotspot(kHSWalkArea2, 0, 0, 629, 353); + _vm->setHotspot(kHSWalkArea3, 629, 0, 799, 364); + _vm->setHotspot(kHSWalkArea4, 735, 0, 799, 397); + _vm->setHotspot(kHSWalkArea5, 510, 540, 799, 599); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 13; } -void GnapEngine::scene11_run() { +void Scene11::run() { bool flag = true; - _timers[7] = 50; - - _hotspots[kHSBillard]._flags |= SF_DISABLED; + _vm->_timers[7] = 50; + _vm->_hotspots[kHSBillard]._flags |= SF_DISABLED; _s11_currGoggleGuySequenceId = 0x1F9; - _s11_currHookGuySequenceId = 0x201; - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 13: - initGnapPos(8, 5, kDirBottomLeft); - initPlatypusPos(9, 6, kDirUnk4); + _vm->initGnapPos(8, 5, kDirBottomLeft); + _vm->initPlatypusPos(9, 6, kDirUnk4); break; case 47: - initGnapPos(8, 5, kDirBottomLeft); - initPlatypusPos(9, 5, kDirUnk4); + _vm->initGnapPos(8, 5, kDirBottomLeft); + _vm->initPlatypusPos(9, 5, kDirUnk4); _s11_currGoggleGuySequenceId = 0x1FA; _s11_currHookGuySequenceId = 0x1FF; - _timers[7] = 180; + _vm->_timers[7] = 180; break; case 12: - initGnapPos(-1, 9, kDirBottomRight); - initPlatypusPos(-2, 8, kDirNone); + _vm->initGnapPos(-1, 9, kDirBottomRight); + _vm->initPlatypusPos(-2, 8, kDirNone); break; default: - initGnapPos(6, 6, kDirBottomLeft); - initPlatypusPos(6, 5, kDirUnk4); + _vm->initGnapPos(6, 6, kDirBottomLeft); + _vm->initPlatypusPos(6, 5, kDirUnk4); break; } - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - _gameSys->insertSequence(_s11_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s11_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); _s11_nextHookGuySequenceId = -1; - _gameSys->setAnimation(_s11_currHookGuySequenceId, 120, 3); - _gameSys->insertSequence(_s11_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s11_currHookGuySequenceId, 120, 3); + _vm->_gameSys->insertSequence(_s11_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); _s11_nextGoggleGuySequenceId = -1; - _gameSys->setAnimation(_s11_currGoggleGuySequenceId, 121, 2); + _vm->_gameSys->setAnimation(_s11_currGoggleGuySequenceId, 121, 2); - _timers[5] = getRandom(100) + 75; - _timers[4] = getRandom(40) + 20; - _timers[6] = getRandom(100) + 100; - endSceneInit(); + _vm->_timers[5] = _vm->getRandom(100) + 75; + _vm->_timers[4] = _vm->getRandom(40) + 20; + _vm->_timers[6] = _vm->getRandom(100) + 100; + _vm->endSceneInit(); - if (_prevSceneNum == 12) { - gnapWalkTo(2, 8, -1, 0x107B9, 1); - platypusWalkTo(1, 8, -1, 0x107C2, 1); + if (_vm->_prevSceneNum == 12) { + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } - _gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); + _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->testWalk(0, 0, -1, -1, -1, -1); - testWalk(0, 0, -1, -1, -1, -1); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSPlatypus: - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -172,50 +177,50 @@ void GnapEngine::scene11_run() { break; case kHSExitKitchen: - _isLeavingScene = true; - gnapWalkTo(6, 5, 0, 0x107BF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(6, 6, -1, -1, 1); - _newSceneNum = 10; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(6, 5, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(6, 6, -1, -1, 1); + _vm->_newSceneNum = 10; break; case kHSExitToilet: - _isLeavingScene = true; - gnapWalkTo(8, 5, 0, 0x107BF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(8, 6, -1, -1, 1); - _newSceneNum = 13; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(8, 5, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(8, 6, -1, -1, 1); + _vm->_newSceneNum = 13; break; case kHSExitLeft: - _isLeavingScene = true; - gnapWalkTo(-1, 8, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(-1, 9, -1, 0x107CF, 1); - _newSceneNum = 12; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(-1, 8, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(-1, 9, -1, 0x107CF, 1); + _vm->_newSceneNum = 12; break; case kHSGoggleGuy: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemMagazine) { - gnapWalkTo(3, 7, 0, 0x107BC, 1); - _gnapActionStatus = kASShowMagazineToGoggleGuy; - playGnapShowItem(_grabCursorSpriteIndex, 2, 0); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(3, 7, 2, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemMagazine) { + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASShowMagazineToGoggleGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 7, 2, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 6); + _vm->playGnapScratchingHead(1, 6); break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(3, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkGoggleGuy; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkGoggleGuy; break; } } @@ -223,28 +228,28 @@ void GnapEngine::scene11_run() { break; case kHSHookGuy: - if (_gnapActionStatus < 0) { - _gnapIdleFacing = kDirUpRight; - if (_grabCursorSpriteIndex >= 0) { - gnapWalkTo(5, 6, 0, 0x107BC, 9); - _gnapActionStatus = kASShowItemToHookGuy; - playGnapShowItem(_grabCursorSpriteIndex, 4, 0); + if (_vm->_gnapActionStatus < 0) { + _vm->_gnapIdleFacing = kDirUpRight; + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(5, 6, 0, 0x107BC, 9); + _vm->_gnapActionStatus = kASShowItemToHookGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapSequence(getGnapSequenceId(gskDeflect, 3, 6) | 0x10000); + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 3, 6) | 0x10000); break; case GRAB_CURSOR: - gnapWalkTo(5, 6, 0, 0x107BC, 1); - _gnapActionStatus = kASGrabHookGuy; + _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASGrabHookGuy; break; case TALK_CURSOR: - _gnapIdleFacing = kDirBottomLeft; - gnapWalkTo(5, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkHookGuy; + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->gnapWalkTo(5, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkHookGuy; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -252,21 +257,21 @@ void GnapEngine::scene11_run() { break; case kHSBillard: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(9, 8); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(9, 8); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(9, 8); + _vm->playGnapScratchingHead(9, 8); break; case GRAB_CURSOR: - gnapWalkTo(9, 8, 0, 0x107BA, 1); - _gnapActionStatus = kASGrabBillardBall; + _vm->gnapWalkTo(9, 8, 0, 0x107BA, 1); + _vm->_gnapActionStatus = kASGrabBillardBall; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(9, 8); + _vm->playGnapImpossible(9, 8); break; } } @@ -278,50 +283,50 @@ void GnapEngine::scene11_run() { case kHSWalkArea3: case kHSWalkArea4: case kHSWalkArea5: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene11_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene11_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - if (flag && !_timers[7]) { + if (!_vm->_isLeavingScene) { + if (flag && !_vm->_timers[7]) { flag = false; - _gameSys->setAnimation(0x207, 257, 4); - _gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x207, 257, 4); + _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } - platypusSub426234(); - updateGnapIdleSequence2(); - if (!_timers[5]) { - _timers[5] = getRandom(100) + 75; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) { - if (getRandom(2)) + _vm->platypusSub426234(); + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 75; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) { + if (_vm->getRandom(2)) _s11_nextGoggleGuySequenceId = 0x1F6; else _s11_nextGoggleGuySequenceId = 0x1F9; } } - if (!_timers[4]) { - _timers[4] = getRandom(40) + 20; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s11_nextHookGuySequenceId == -1) { + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(40) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s11_nextHookGuySequenceId == -1) { if (_s11_currHookGuySequenceId == 0x201) { - switch (getRandom(7)) { + switch (_vm->getRandom(7)) { case 0: _s11_nextHookGuySequenceId = 0x200; break; @@ -340,47 +345,44 @@ void GnapEngine::scene11_run() { } } } - if (!_timers[6]) { - _timers[6] = getRandom(100) + 100; - int _gnapRandomValue = getRandom(3); + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(100) + 100; + int _gnapRandomValue = _vm->getRandom(3); switch (_gnapRandomValue) { case 0: - _gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; } } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene11_updateHotspots(); - _timers[5] = getRandom(50) + 75; - _timers[4] = getRandom(40) + 20; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(50) + 75; + _vm->_timers[4] = _vm->getRandom(40) + 20; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene11_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - if (_gnapActionStatus != kASGrabBillardBall) - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene11::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + if (_vm->_gnapActionStatus != kASGrabBillardBall) + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASShowMagazineToGoggleGuy: _s11_nextGoggleGuySequenceId = 0x1F7; @@ -398,20 +400,20 @@ void GnapEngine::scene11_updateAnimations() { _s11_nextHookGuySequenceId = 0x206; break; case kASGrabBillardBall: - if (_gameSys->getAnimationStatus(2) == 2 && _gameSys->getAnimationStatus(3) == 2) { - _gameSys->setAnimation(0, 0, 0); - _timers[2] = getRandom(30) + 20; - _timers[3] = getRandom(50) + 200; - _gameSys->insertSequence(0x1F4, 255, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x1F4; - _gnapId = 255; - _gnapSequenceDatNum = 0; - _gameSys->removeSequence(0x207, 257, true); - _gameSys->removeSequence(0x208, 256, true); + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->_gameSys->insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x1F4; + _vm->_gnapId = 255; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->removeSequence(0x207, 257, true); + _vm->_gameSys->removeSequence(0x208, 256, true); _s11_nextGoggleGuySequenceId = 0x1F8; - _timers[5] = getRandom(100) + 75; - _gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); + _vm->_timers[5] = _vm->getRandom(100) + 75; + _vm->_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); _s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId; _s11_nextGoggleGuySequenceId = -1; switch (_s11_billardBallCtr) { @@ -426,61 +428,60 @@ void GnapEngine::scene11_updateAnimations() { break; } ++_s11_billardBallCtr; - _gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); + _vm->_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); _s11_currHookGuySequenceId = _s11_nextHookGuySequenceId; _s11_nextHookGuySequenceId = -1; - _timers[4] = getRandom(40) + 20; - _gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, getSequenceTotalDuration(0x1F4) - 5, 0, 0); - _hotspots[kHSBillard]._flags |= SF_DISABLED; - _gameSys->setAnimation(0x207, 257, 4); - _gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, getSequenceTotalDuration(0x1FE), 0, 0); - _gnapActionStatus = -1; + _vm->_timers[4] = _vm->getRandom(40) + 20; + _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0); + _vm->_hotspots[kHSBillard]._flags |= SF_DISABLED; + _vm->_gameSys->setAnimation(0x207, 257, 4); + _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); + _vm->_gnapActionStatus = -1; } break; } } - if (_gameSys->getAnimationStatus(2) == 2 && _s11_nextGoggleGuySequenceId != -1) { - _timers[5] = getRandom(100) + 75; - _gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s11_nextGoggleGuySequenceId != -1) { + _vm->_timers[5] = _vm->getRandom(100) + 75; + _vm->_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); _s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId; _s11_nextGoggleGuySequenceId = -1; - if (_gnapActionStatus >= 1 && _gnapActionStatus <= 4) - _gnapActionStatus = -1; + if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4) + _vm->_gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_s11_nextHookGuySequenceId == 0x204) { - _gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); - _gameSys->insertSequence(0x204, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x1F5, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); + _vm->_gameSys->insertSequence(0x204, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _s11_currHookGuySequenceId = 0x204; _s11_nextHookGuySequenceId = -1; - _gnapSequenceId = 0x1F5; - _gnapSequenceDatNum = 0; - _timers[4] = getRandom(40) + 20; - _timers[2] = getRandom(20) + 70; - _timers[3] = getRandom(50) + 200; - if (_gnapActionStatus == kASGrabHookGuy) - _gnapActionStatus = -1; + _vm->_gnapSequenceId = 0x1F5; + _vm->_gnapSequenceDatNum = 0; + _vm->_timers[4] = _vm->getRandom(40) + 20; + _vm->_timers[2] = _vm->getRandom(20) + 70; + _vm->_timers[3] = _vm->getRandom(50) + 200; + if (_vm->_gnapActionStatus == kASGrabHookGuy) + _vm->_gnapActionStatus = -1; } else if (_s11_nextHookGuySequenceId != -1) { - _gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); + _vm->_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); _s11_currHookGuySequenceId = _s11_nextHookGuySequenceId; _s11_nextHookGuySequenceId = -1; - _timers[4] = getRandom(40) + 20; - if (_gnapActionStatus >= 6 && _gnapActionStatus <= 9) - _gnapActionStatus = -1; + _vm->_timers[4] = _vm->getRandom(40) + 20; + if (_vm->_gnapActionStatus >= 6 && _vm->_gnapActionStatus <= 9) + _vm->_gnapActionStatus = -1; } } - if (_gameSys->getAnimationStatus(4) == 2) { - _gameSys->setAnimation(0, 0, 4); - _hotspots[kHSBillard]._flags &= ~SF_DISABLED; + if (_vm->_gameSys->getAnimationStatus(4) == 2) { + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->_hotspots[kHSBillard]._flags &= ~SF_DISABLED; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene11.h b/engines/gnap/scenes/scene11.h new file mode 100644 index 0000000000..e37f0bdbfa --- /dev/null +++ b/engines/gnap/scenes/scene11.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE11_H +#define GNAP_SCENE11_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene11: public Scene { +public: + Scene11(GnapEngine *vm); + ~Scene11() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s11_billardBallCtr; + int _s11_nextHookGuySequenceId; + int _s11_currHookGuySequenceId; + int _s11_nextGoggleGuySequenceId; + int _s11_currGoggleGuySequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE11_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 508c163fb8..c4b5a55a14 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -36,6 +36,7 @@ #include "gnap/scenes/scene08.h" #include "gnap/scenes/scene09.h" #include "gnap/scenes/scene10.h" +#include "gnap/scenes/scene11.h" namespace Gnap { @@ -119,8 +120,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 11: - backgroundId = scene11_init(); - scene11_updateHotspots(); + _scene = new Scene11(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -438,7 +440,7 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 11; break; case 11: - scene11_run(); + _scene->run(); if (_newSceneNum == 55) _newSceneNum = 12; break; -- cgit v1.2.3 From e8db252fc3cb78d7d07381764000b0a801850a2f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Apr 2016 07:34:48 +0200 Subject: GNAP: Refactor scene 12 --- engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene12.cpp | 499 +++++++++++++++++++------------------- engines/gnap/scenes/scene12.h | 54 +++++ engines/gnap/scenes/scenecore.cpp | 10 +- 4 files changed, 313 insertions(+), 259 deletions(-) create mode 100644 engines/gnap/scenes/scene12.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 939212aa2b..c3458d2ce5 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,15 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 12 - int _s12_nextBeardGuySequenceId, _s12_currBeardGuySequenceId; - int _s12_nextToothGuySequenceId, _s12_currToothGuySequenceId; - int _s12_nextBarkeeperSequenceId, _s12_currBarkeeperSequenceId; - int scene12_init(); - void scene12_updateHotspots(); - void scene12_run(); - void scene12_updateAnimations(); - // Scene 13 int _s13_backToiletCtr; int scene13_init(); diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp index 4d3958cdbf..6b63c9f877 100644 --- a/engines/gnap/scenes/scene12.cpp +++ b/engines/gnap/scenes/scene12.cpp @@ -24,6 +24,8 @@ #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene12.h" + namespace Gnap { enum { @@ -61,98 +63,105 @@ enum { kASPlatWithBeardGuy = 19 }; -int GnapEngine::scene12_init() { +Scene12::Scene12(GnapEngine *vm) : Scene(vm) { + _s12_nextBeardGuySequenceId = -1; + _s12_currBeardGuySequenceId = -1; + _s12_nextToothGuySequenceId = -1; + _s12_currToothGuySequenceId = -1; + _s12_nextBarkeeperSequenceId = -1; + _s12_currBarkeeperSequenceId = -1; +} + +int Scene12::init() { return 0x209; } -void GnapEngine::scene12_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitRight, 790, 360, 799, 599, SF_EXIT_R_CURSOR); - setHotspot(kHSToothGuy, 80, 180, 160, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSBarkeeper, 490, 175, 580, 238, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSBeardGuy, 620, 215, 720, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSJukebox, 300, 170, 410, 355, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 0, 0, 260, 460); - setHotspot(kHSWalkArea2, 0, 0, 380, 410); - setHotspot(kHSWalkArea3, 0, 0, 799, 395); - setHotspot(kHSWalkArea4, 585, 0, 799, 455); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 11; +void Scene12::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitRight, 790, 360, 799, 599, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHSToothGuy, 80, 180, 160, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSBarkeeper, 490, 175, 580, 238, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSBeardGuy, 620, 215, 720, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSJukebox, 300, 170, 410, 355, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 0, 0, 260, 460); + _vm->setHotspot(kHSWalkArea2, 0, 0, 380, 410); + _vm->setHotspot(kHSWalkArea3, 0, 0, 799, 395); + _vm->setHotspot(kHSWalkArea4, 585, 0, 799, 455); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; } -void GnapEngine::scene12_run() { +void Scene12::run() { int v18 = 1; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - _gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); _s12_currToothGuySequenceId = 0x200; _s12_nextToothGuySequenceId = -1; - _gameSys->setAnimation(0x200, 50, 2); - _gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x200, 50, 2); + _vm->_gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); _s12_currBeardGuySequenceId = 0x202; _s12_nextBeardGuySequenceId = -1; - _gameSys->setAnimation(0x202, 50, 4); - _gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x202, 50, 4); + _vm->_gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); _s12_currBarkeeperSequenceId = 0x203; _s12_nextBarkeeperSequenceId = -1; - _gameSys->setAnimation(0x203, 50, 3); + _vm->_gameSys->setAnimation(0x203, 50, 3); - _timers[4] = 30; - _timers[6] = getRandom(30) + 20; - _timers[5] = getRandom(30) + 20; - _timers[7] = getRandom(100) + 100; + _vm->_timers[4] = 30; + _vm->_timers[6] = _vm->getRandom(30) + 20; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_prevSceneNum == 15) { - initGnapPos(5, 6, kDirBottomRight); - initPlatypusPos(3, 7, kDirNone); - endSceneInit(); + if (_vm->_prevSceneNum == 15) { + _vm->initGnapPos(5, 6, kDirBottomRight); + _vm->initPlatypusPos(3, 7, kDirNone); + _vm->endSceneInit(); } else { - initGnapPos(11, 8, kDirBottomLeft); - initPlatypusPos(12, 8, kDirUnk4); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->testWalk(0, 0, -1, -1, -1, -1); - testWalk(0, 0, -1, -1, -1, -1); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->updateGrabCursorSprite(0, 0); - updateMouseCursor(); - updateCursorByHotspot(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene12_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -160,160 +169,160 @@ void GnapEngine::scene12_run() { break; case kHSExitRight: - _isLeavingScene = true; - gnapWalkTo(10, -1, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(10, -1, -1, -1, 1); - _newSceneNum = 11; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(10, -1, -1, -1, 1); + _vm->_newSceneNum = 11; break; case kHSToothGuy: - if (_grabCursorSpriteIndex == kItemQuarter) { - _largeSprite = _gameSys->createSurface(0x141); - gnapWalkTo(3, 7, 0, 0x107BC, 9); - _gnapIdleFacing = kDirUpLeft; - _gnapActionStatus = kASQuarterToToothGuy; - playGnapShowItem(_grabCursorSpriteIndex, 2, 0); - setGrabCursorSprite(-1); - } else if (_grabCursorSpriteIndex == kItemQuarterWithHole) { - gnapWalkTo(3, 7, 0, 0x107BC, 9); - _gnapIdleFacing = kDirUpLeft; - _gnapActionStatus = kASQuarterWithHoleToToothGuy; - playGnapShowItem(_grabCursorSpriteIndex, 2, 0); - } else if (_grabCursorSpriteIndex >= 0) { - gnapWalkTo(3, 7, 0, 0x107BC, 9); - _gnapIdleFacing = kDirUpLeft; - _gnapActionStatus = kASShowItemToToothGuy; - playGnapShowItem(_grabCursorSpriteIndex, 2, 0); + if (_vm->_grabCursorSpriteIndex == kItemQuarter) { + _vm->_largeSprite = _vm->_gameSys->createSurface(0x141); + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapActionStatus = kASQuarterToToothGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + _vm->setGrabCursorSprite(-1); + } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapActionStatus = kASQuarterWithHoleToToothGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapActionStatus = kASShowItemToToothGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 2); + _vm->playGnapScratchingHead(1, 2); break; case GRAB_CURSOR: - gnapWalkTo(3, 7, 0, 0x107BC, 1); - _gnapActionStatus = kASGrabToothGuy; + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASGrabToothGuy; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(3, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkToothGuy; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkToothGuy; break; case PLAT_CURSOR: - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(3, 7, 1, 0x107D2, 1); - _platypusActionStatus = kASPlatWithToothGuy; - _platypusFacing = kDirUnk4; - playGnapIdle(2, 7); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); + _vm->_platypusActionStatus = kASPlatWithToothGuy; + _vm->_platypusFacing = kDirUnk4; + _vm->playGnapIdle(2, 7); break; } } break; case kHSBarkeeper: - if (_grabCursorSpriteIndex == kItemQuarter || _grabCursorSpriteIndex == kItemQuarterWithHole) { - gnapWalkTo(6, 6, 0, 0x107BB, 9); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASQuarterWithBarkeeper; - playGnapShowItem(_grabCursorSpriteIndex, 7, 0); - } else if (_grabCursorSpriteIndex >= 0) { - gnapWalkTo(6, 6, 0, 0x107BB, 9); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASShowItemToBarkeeper; - playGnapShowItem(_grabCursorSpriteIndex, 7, 0); + if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASQuarterWithBarkeeper; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASShowItemToBarkeeper; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapWalkTo(6, 6, 0, 0x107BB, 1); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASLookBarkeeper; + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASLookBarkeeper; break; case GRAB_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(6, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkBarkeeper; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(6, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkBarkeeper; break; case PLAT_CURSOR: - playGnapPullOutDevice(_platX, _platY); - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - _gnapActionStatus = kASPlatWithBarkeeper; + _vm->playGnapPullOutDevice(_vm->_platX, _vm->_platY); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASPlatWithBarkeeper; break; } } break; case kHSBeardGuy: - if (_grabCursorSpriteIndex >= 0) { - gnapWalkTo(7, 6, 0, 0x107BB, 9); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASShowItemToBeardGuy; - playGnapShowItem(_grabCursorSpriteIndex, 8, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(7, 6, 0, 0x107BB, 9); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASShowItemToBeardGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapWalkTo(7, 6, 0, 0x107BB, 1); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASLookBeardGuy; + _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASLookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. - gnapWalkTo(7, 6, 0, 0x107BB, 1); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASGrabBeardGuy; + _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASGrabBeardGuy; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(7, 6, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkBeardGuy; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkBeardGuy; break; case PLAT_CURSOR: - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(7, 6, 1, 0x107C2, 1); - _platypusActionStatus = kASPlatWithBeardGuy; - _platypusFacing = kDirNone; - playGnapIdle(7, 6); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kASPlatWithBeardGuy; + _vm->_platypusFacing = kDirNone; + _vm->playGnapIdle(7, 6); break; } } break; case kHSJukebox: - _newSceneNum = 15; - _isLeavingScene = true; - gnapWalkTo(5, 6, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 15; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; break; case kHSWalkArea1: case kHSWalkArea2: case kHSWalkArea3: case kHSWalkArea4: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene12_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = 15; + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = 15; if (_s12_nextToothGuySequenceId == -1) { - if (v18 == 0 && _s12_currBeardGuySequenceId == 0x202 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { - if (getRandom(2) != 0) + if (v18 == 0 && _s12_currBeardGuySequenceId == 0x202 && _s12_currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->getRandom(2) != 0) _s12_nextToothGuySequenceId = 0x1EC; else _s12_nextToothGuySequenceId = 0x204; @@ -322,11 +331,11 @@ void GnapEngine::scene12_run() { v18 = (v18 + 1) % 15; } } - if (!_timers[5]) { - _timers[5] = getRandom(30) + 20; - if (_s12_nextBarkeeperSequenceId == -1 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { - if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBeardGuySequenceId == 0x202 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { - if (getRandom(2) != 0) + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(30) + 20; + if (_s12_nextBarkeeperSequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBeardGuySequenceId == 0x202 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->getRandom(2) != 0) _s12_nextBarkeeperSequenceId = 0x208; else _s12_nextBarkeeperSequenceId = 0x1FB; @@ -335,62 +344,59 @@ void GnapEngine::scene12_run() { v18 = (v18 + 1) % 15; } } - if (!_timers[6]) { - _timers[6] = getRandom(30) + 15; - if (_s12_nextBeardGuySequenceId == -1 && _gnapActionStatus < 0 && _platypusActionStatus < 0) { - if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBarkeeperSequenceId == 0x203 && _gnapActionStatus < 0 && _platypusActionStatus < 0) + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(30) + 15; + if (_s12_nextBeardGuySequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) _s12_nextBeardGuySequenceId = 0x1F2; else _s12_nextBeardGuySequenceId = 0x202; v18 = (v18 + 1) % 15; } } - if (!_timers[7]) { - _timers[7] = getRandom(100) + 100; - int _gnapRandomValue = getRandom(3); + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + int _gnapRandomValue = _vm->getRandom(3); switch (_gnapRandomValue) { case 0: - _gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; } } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene12_updateHotspots(); - _timers[4] = 30; - _timers[5] = getRandom(30) + 20; - _timers[6] = getRandom(30) + 20; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = 30; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_timers[6] = _vm->getRandom(30) + 20; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene12_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene12::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASTalkToothGuy: - if (isKeyStatus1(Common::KEYCODE_j)) { + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { // Easter egg - clearKeyStatus1(Common::KEYCODE_j); + _vm->clearKeyStatus1(Common::KEYCODE_j); _s12_nextToothGuySequenceId = 0x206; } else { _s12_nextToothGuySequenceId = 0x1EE; @@ -399,43 +405,43 @@ void GnapEngine::scene12_updateAnimations() { case 3: break; case kASGrabToothGuy: - if (isKeyStatus1(Common::KEYCODE_j)) { - clearKeyStatus1(Common::KEYCODE_j); + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); _s12_nextToothGuySequenceId = 0x206; } else { _s12_nextToothGuySequenceId = 0x1EF; } break; case kASShowItemToToothGuy: - if (isKeyStatus1(Common::KEYCODE_j)) { - clearKeyStatus1(Common::KEYCODE_j); + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); _s12_nextToothGuySequenceId = 0x206; } else { _s12_nextToothGuySequenceId = 0x1ED; } break; case kASQuarterWithHoleToToothGuy: - if (isKeyStatus1(Common::KEYCODE_j)) { - clearKeyStatus1(Common::KEYCODE_j); + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); _s12_nextToothGuySequenceId = 0x206; } else { _s12_nextToothGuySequenceId = 0x1EA; } break; case kASQuarterToToothGuy: - if (isKeyStatus1(Common::KEYCODE_j)) { - clearKeyStatus1(Common::KEYCODE_j); + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); _s12_nextToothGuySequenceId = 0x206; } else { _s12_nextToothGuySequenceId = 0x1E9; } break; case kASQuarterToToothGuyDone: - _gnapActionStatus = -1; - showCursor(); - _gameSys->removeSpriteDrawItem(_largeSprite, 300); - deleteSurface(&_largeSprite); - setGrabCursorSprite(kItemQuarterWithHole); + _vm->_gnapActionStatus = -1; + _vm->showCursor(); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->setGrabCursorSprite(kItemQuarterWithHole); break; case kASTalkBeardGuy: _s12_nextBeardGuySequenceId = 0x1F4; @@ -450,7 +456,7 @@ void GnapEngine::scene12_updateAnimations() { _s12_nextBeardGuySequenceId = 0x1F0; break; case kASTalkBarkeeper: - if (getRandom(2) != 0) + if (_vm->getRandom(2) != 0) _s12_nextBarkeeperSequenceId = 0x1FD; else _s12_nextBarkeeperSequenceId = 0x1FF; @@ -473,9 +479,9 @@ void GnapEngine::scene12_updateAnimations() { } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - switch (_platypusActionStatus) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { case kASPlatWithToothGuy: _s12_nextToothGuySequenceId = 0x1EB; break; @@ -485,79 +491,78 @@ void GnapEngine::scene12_updateAnimations() { } } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { if (_s12_currToothGuySequenceId == 0x1E9) { - _gameSys->setAnimation(0, 0, 2); - hideCursor(); - _gameSys->setAnimation(0x10843, 301, 0); - _gnapActionStatus = kASQuarterToToothGuyDone; - _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); - _gameSys->insertSequence(0x10843, 301, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x107B7, _gnapId, 0x10843, 301, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B7; - _gnapSequenceDatNum = 1; - setFlag(kGFTwigTaken); - invAdd(kItemQuarterWithHole); - invRemove(kItemQuarter); + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->hideCursor(); + _vm->_gameSys->setAnimation(0x10843, 301, 0); + _vm->_gnapActionStatus = kASQuarterToToothGuyDone; + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_gameSys->insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B7; + _vm->_gnapSequenceDatNum = 1; + _vm->setFlag(kGFTwigTaken); + _vm->invAdd(kItemQuarterWithHole); + _vm->invRemove(kItemQuarter); } if (_s12_nextToothGuySequenceId == 0x1EF) { - _gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); - _gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); + _vm->_gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _s12_currToothGuySequenceId = _s12_nextToothGuySequenceId; _s12_nextToothGuySequenceId = -1; - _gnapSequenceId = 0x205; - _gnapSequenceDatNum = 0; - _timers[4] = 40; - _timers[2] = getRandom(20) + 70; - _timers[3] = getRandom(50) + 200; - if (_gnapActionStatus == kASGrabToothGuy) - _gnapActionStatus = -1; + _vm->_gnapSequenceId = 0x205; + _vm->_gnapSequenceDatNum = 0; + _vm->_timers[4] = 40; + _vm->_timers[2] = _vm->getRandom(20) + 70; + _vm->_timers[3] = _vm->getRandom(50) + 200; + if (_vm->_gnapActionStatus == kASGrabToothGuy) + _vm->_gnapActionStatus = -1; } else if (_s12_nextToothGuySequenceId != -1) { - _gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); + _vm->_gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); _s12_currToothGuySequenceId = _s12_nextToothGuySequenceId; _s12_nextToothGuySequenceId = -1; - _timers[4] = 50; - if (_gnapActionStatus >= kASTalkToothGuy && _gnapActionStatus <= kASQuarterToToothGuy && _s12_currToothGuySequenceId != 0x1E9 && + _vm->_timers[4] = 50; + if (_vm->_gnapActionStatus >= kASTalkToothGuy && _vm->_gnapActionStatus <= kASQuarterToToothGuy && _s12_currToothGuySequenceId != 0x1E9 && _s12_currToothGuySequenceId != 0x1EC && _s12_currToothGuySequenceId != 0x200) - _gnapActionStatus = -1; - if (_platypusActionStatus == kASPlatWithToothGuy) - _platypusActionStatus = -1; + _vm->_gnapActionStatus = -1; + if (_vm->_platypusActionStatus == kASPlatWithToothGuy) + _vm->_platypusActionStatus = -1; } } - if (_gameSys->getAnimationStatus(3) == 2) { - if (_gnapActionStatus == kASPlatWithBarkeeper && _s12_currBarkeeperSequenceId == 0x1F9) { - _gnapActionStatus = -1; - playGnapIdle(7, 6); - _timers[5] = 0; + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gnapActionStatus == kASPlatWithBarkeeper && _s12_currBarkeeperSequenceId == 0x1F9) { + _vm->_gnapActionStatus = -1; + _vm->playGnapIdle(7, 6); + _vm->_timers[5] = 0; } if (_s12_nextBarkeeperSequenceId != -1) { - _gameSys->insertSequence(_s12_nextBarkeeperSequenceId, 50, _s12_currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s12_nextBarkeeperSequenceId, 50, 3); + _vm->_gameSys->insertSequence(_s12_nextBarkeeperSequenceId, 50, _s12_currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s12_nextBarkeeperSequenceId, 50, 3); _s12_currBarkeeperSequenceId = _s12_nextBarkeeperSequenceId; _s12_nextBarkeeperSequenceId = -1; - _timers[5] = getRandom(30) + 20; - if (_gnapActionStatus >= kASTalkBarkeeper && _gnapActionStatus <= kASQuarterWithBarkeeper && _s12_currBarkeeperSequenceId != 0x203 && + _vm->_timers[5] = _vm->getRandom(30) + 20; + if (_vm->_gnapActionStatus >= kASTalkBarkeeper && _vm->_gnapActionStatus <= kASQuarterWithBarkeeper && _s12_currBarkeeperSequenceId != 0x203 && _s12_currBarkeeperSequenceId != 0x1FB && _s12_currBarkeeperSequenceId != 0x208) - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } } - if (_gameSys->getAnimationStatus(4) == 2 && _s12_nextBeardGuySequenceId != -1) { - _gameSys->insertSequence(_s12_nextBeardGuySequenceId, 50, _s12_currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s12_nextBeardGuySequenceId, 50, 4); + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s12_nextBeardGuySequenceId != -1) { + _vm->_gameSys->insertSequence(_s12_nextBeardGuySequenceId, 50, _s12_currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s12_nextBeardGuySequenceId, 50, 4); _s12_currBeardGuySequenceId = _s12_nextBeardGuySequenceId; _s12_nextBeardGuySequenceId = -1; - _timers[6] = getRandom(30) + 20; - if (_gnapActionStatus >= kASTalkBeardGuy && _gnapActionStatus <= kASShowItemToBeardGuy && _s12_currBeardGuySequenceId != 0x202 && _s12_currBeardGuySequenceId != 0x1F2) - _gnapActionStatus = -1; - if (_platypusActionStatus == kASPlatWithBeardGuy) - _platypusActionStatus = -1; + _vm->_timers[6] = _vm->getRandom(30) + 20; + if (_vm->_gnapActionStatus >= kASTalkBeardGuy && _vm->_gnapActionStatus <= kASShowItemToBeardGuy && _s12_currBeardGuySequenceId != 0x202 && _s12_currBeardGuySequenceId != 0x1F2) + _vm->_gnapActionStatus = -1; + if (_vm->_platypusActionStatus == kASPlatWithBeardGuy) + _vm->_platypusActionStatus = -1; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene12.h b/engines/gnap/scenes/scene12.h new file mode 100644 index 0000000000..505047161d --- /dev/null +++ b/engines/gnap/scenes/scene12.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE12_H +#define GNAP_SCENE12_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene12: public Scene { +public: + Scene12(GnapEngine *vm); + ~Scene12() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s12_nextBeardGuySequenceId; + int _s12_currBeardGuySequenceId; + int _s12_nextToothGuySequenceId; + int _s12_currToothGuySequenceId; + int _s12_nextBarkeeperSequenceId; + int _s12_currBarkeeperSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE12_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c4b5a55a14..2cf75caa25 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -37,6 +37,7 @@ #include "gnap/scenes/scene09.h" #include "gnap/scenes/scene10.h" #include "gnap/scenes/scene11.h" +#include "gnap/scenes/scene12.h" namespace Gnap { @@ -127,8 +128,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 12: - backgroundId = scene12_init(); - scene12_updateHotspots(); + _scene = new Scene12(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -441,11 +443,13 @@ void GnapEngine::runSceneLogic() { break; case 11: _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 12; break; case 12: - scene12_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 11; break; -- cgit v1.2.3 From cc5bfede08504c433f56b2c91e25f409a47ee21a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Apr 2016 07:52:06 +0200 Subject: GNAP: Refactor scene 13 --- engines/gnap/gnap.cpp | 3 - engines/gnap/gnap.h | 8 - engines/gnap/scenes/scene13.cpp | 402 +++++++++++++++++++------------------- engines/gnap/scenes/scene13.h | 51 +++++ engines/gnap/scenes/scenecore.cpp | 9 +- 5 files changed, 257 insertions(+), 216 deletions(-) create mode 100644 engines/gnap/scenes/scene13.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index daf8308321..7d097fdbdc 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2018,9 +2018,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 13 - _s13_backToiletCtr = -1; - // Scene 17 _s17_platTryGetWrenchCtr = 0; _s17_wrenchCtr = 2; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index c3458d2ce5..115015cf36 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -602,14 +602,6 @@ public: bool sceneXX_sub_4466B1(); void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - - // Scene 13 - int _s13_backToiletCtr; - int scene13_init(); - void scene13_updateHotspots(); - void scene13_showScribble(); - void scene13_run(); - void scene13_updateAnimations(); // Scene 14 int scene14_init(); diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index d832927978..a8f89ecbdf 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene13.h" namespace Gnap { @@ -57,103 +58,105 @@ enum { kASGrabUrinal = 13 }; -int GnapEngine::scene13_init() { - playSound(0x108EC, false); +Scene13::Scene13(GnapEngine *vm) : Scene(vm) { + _s13_backToiletCtr = -1; +} + +int Scene13::init() { + _vm->playSound(0x108EC, false); return 0xAC; } -void GnapEngine::scene13_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitBar, 113, 160, 170, 455, SF_EXIT_L_CURSOR); - setHotspot(kHSBackToilet, 385, 195, 478, 367, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSFrontToilet, 497, 182, 545, 432, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSUrinal, 680, 265, 760, 445, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSScribble, 560, 270, 660, 370, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSSink, 310, 520, 560, 599, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 268, 270, 325, 385); - setHotspot(kHSWalkArea2, 0, 0, 52, 599); - setHotspot(kHSWalkArea3, 0, 0, 113, 550); - setHotspot(kHSWalkArea4, 0, 0, 226, 438); - setHotspot(kHSWalkArea5, 0, 0, 268, 400); - setHotspot(kHSWalkArea6, 0, 0, 799, 367); - setHotspot(kHSWalkArea7, 478, 0, 799, 401); - setHotspot(kHSWalkArea8, 545, 0, 799, 473); - setHotspot(kHSWalkArea9, 0, 549, 799, 599); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 17; +void Scene13::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitBar, 113, 160, 170, 455, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHSBackToilet, 385, 195, 478, 367, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSFrontToilet, 497, 182, 545, 432, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSUrinal, 680, 265, 760, 445, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSScribble, 560, 270, 660, 370, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSSink, 310, 520, 560, 599, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 268, 270, 325, 385); + _vm->setHotspot(kHSWalkArea2, 0, 0, 52, 599); + _vm->setHotspot(kHSWalkArea3, 0, 0, 113, 550); + _vm->setHotspot(kHSWalkArea4, 0, 0, 226, 438); + _vm->setHotspot(kHSWalkArea5, 0, 0, 268, 400); + _vm->setHotspot(kHSWalkArea6, 0, 0, 799, 367); + _vm->setHotspot(kHSWalkArea7, 478, 0, 799, 401); + _vm->setHotspot(kHSWalkArea8, 545, 0, 799, 473); + _vm->setHotspot(kHSWalkArea9, 0, 549, 799, 599); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 17; } -void GnapEngine::scene13_showScribble() { - hideCursor(); - _largeSprite = _gameSys->createSurface(0x6F); - _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); - while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && - !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29)) - gameUpdateTick(); - _mouseClickState._left = false; - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(29); - clearKeyStatus1(Common::KEYCODE_SPACE); - _gameSys->removeSpriteDrawItem(_largeSprite, 300); - deleteSurface(&_largeSprite); - showCursor(); +void Scene13::showScribble() { + _vm->hideCursor(); + _vm->_largeSprite = _vm->_gameSys->createSurface(0x6F); + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && + !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) + _vm->gameUpdateTick(); + _vm->_mouseClickState._left = false; + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->showCursor(); } -void GnapEngine::scene13_run() { +void Scene13::run() { int currSoundId = 0; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - _gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - if (_prevSceneNum == 14) { - initGnapPos(6, 6, kDirBottomLeft); - initPlatypusPos(9, 8, kDirNone); + if (_vm->_prevSceneNum == 14) { + _vm->initGnapPos(6, 6, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirNone); } else { - initGnapPos(3, 7, kDirBottomRight); - initPlatypusPos(2, 7, kDirNone); + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(2, 7, kDirNone); } - endSceneInit(); + _vm->endSceneInit(); - _timers[4] = getRandom(20) + 20; - _timers[5] = getRandom(50) + 50; + _vm->_timers[4] = _vm->getRandom(20) + 20; + _vm->_timers[5] = _vm->getRandom(50) + 50; - while (!_sceneDone) { - - if (!isSoundPlaying(0x1091A)) - playSound(0x1091A, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1091A)) + _vm->playSound(0x1091A, true); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene13_updateHotspots(); - _timers[4] = getRandom(20) + 20; - _timers[5] = getRandom(50) + 50; + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; + _vm->_timers[5] = _vm->getRandom(50) + 50; } break; case kHSPlatypus: - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: break; @@ -161,129 +164,129 @@ void GnapEngine::scene13_run() { break; case kHSExitBar: - _isLeavingScene = true; - gnapWalkTo(2, 7, 0, 0x107C0, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(2, 8, -1, -1, 1); - if (isFlag(kGFUnk14) || isFlag(kGFSpringTaken)) { - _newSceneNum = 11; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(2, 7, 0, 0x107C0, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(2, 8, -1, -1, 1); + if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { + _vm->_newSceneNum = 11; } else { - setFlag(kGFSpringTaken); - _newSceneNum = 47; + _vm->setFlag(kGFSpringTaken); + _vm->_newSceneNum = 47; } break; case kHSBackToilet: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(5, 5, 6, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(5, 5, 6, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: case TALK_CURSOR: - if (_gnapX == 5 && _gnapY == 5) { + if (_vm->_gnapX == 5 && _vm->_gnapY == 5) { _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); - _gameSys->setAnimation(_s13_backToiletCtr + 0xA3, _gnapId, 0); - _gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _vm->_gameSys->setAnimation(_s13_backToiletCtr + 0xA3, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqScale | kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASWait; - _gnapSequenceId = _s13_backToiletCtr + 0xA3; - _gnapIdleFacing = kDirUpRight; - _gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASWait; + _vm->_gnapSequenceId = _s13_backToiletCtr + 0xA3; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; } else { - gnapWalkTo(5, 5, 0, 0x107BB, 1); - _gnapActionStatus = kASBackToilet; - _gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(5, 5, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASBackToilet; + _vm->_gnapIdleFacing = kDirUpRight; } break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSFrontToilet: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(6, 7, 7, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 7, 7, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - gnapWalkTo(6, 7, 0, 0xA9, 5); - _gnapActionStatus = kASFrontToilet; - _gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(6, 7, 0, 0xA9, 5); + _vm->_gnapActionStatus = kASFrontToilet; + _vm->_gnapIdleFacing = kDirBottomRight; break; } } break; case kHSScribble: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(7, 7, 8, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 7, 8, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapWalkTo(7, 7, 0, 0x107BB, 1); - _gnapActionStatus = kASLookScribble; - _gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLookScribble; + _vm->_gnapIdleFacing = kDirUpRight; break; case GRAB_CURSOR: - playGnapScratchingHead(0, 0); + _vm->playGnapScratchingHead(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(7, 7, -1, getGnapSequenceId(gskBrainPulsating, 0, 0), 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(7, 7, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0), 1); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSUrinal: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(8, 7, 9, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(8, 7, 9, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapSequence(getGnapSequenceId(gskDeflect, 9, 6)); - gnapWalkTo(_gnapX, _gnapY, 0, -1, 1); - _gnapActionStatus = kASWait; + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 9, 6)); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); + _vm->_gnapActionStatus = kASWait; break; case GRAB_CURSOR: - gnapWalkTo(8, 7, 0, -1, 1); - _gnapActionStatus = kASGrabUrinal; + _vm->gnapWalkTo(8, 7, 0, -1, 1); + _vm->_gnapActionStatus = kASGrabUrinal; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSSink: - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapSequence(getGnapSequenceId(gskDeflect, 5, 9)); - gnapWalkTo(_gnapX, _gnapY, 0, -1, 1); - _gnapActionStatus = kASWait; + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 5, 9)); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); + _vm->_gnapActionStatus = kASWait; break; case GRAB_CURSOR: - gnapWalkTo(4, 8, 0, 0x107B9, 1); - _gnapActionStatus = kASGrabSink; + _vm->gnapWalkTo(4, 8, 0, 0x107B9, 1); + _vm->_gnapActionStatus = kASGrabSink; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -297,7 +300,7 @@ void GnapEngine::scene13_run() { case kHSWalkArea7: case kHSWalkArea8: case kHSWalkArea9: - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHSWalkArea1: @@ -305,49 +308,48 @@ void GnapEngine::scene13_run() { break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene13_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - if (_platY == 5 || _platY == 6) - platypusWalkTo(-1, 7, -1, -1, 1); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(20) + 20; - switch (getRandom(5)) { + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + if (_vm->_platY == 5 || _vm->_platY == 6) + _vm->platypusWalkTo(-1, 7, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 20; + switch (_vm->getRandom(5)) { case 0: - playSound(0xD2, false); + _vm->playSound(0xD2, false); break; case 1: - playSound(0xD3, false); + _vm->playSound(0xD3, false); break; case 2: - playSound(0xD4, false); + _vm->playSound(0xD4, false); break; case 3: - playSound(0xD5, false); + _vm->playSound(0xD5, false); break; case 4: - playSound(0xD6, false); + _vm->playSound(0xD6, false); break; } } - if (!_timers[5]) { + if (!_vm->_timers[5]) { int newSoundId; - _timers[5] = getRandom(50) + 50; - switch (getRandom(7)) { + _vm->_timers[5] = _vm->getRandom(50) + 50; + switch (_vm->getRandom(7)) { case 0: newSoundId = 0xD7; - _timers[5] = 2 * getRandom(50) + 100; + _vm->_timers[5] = 2 * _vm->getRandom(50) + 100; break; case 1: case 2: @@ -362,92 +364,88 @@ void GnapEngine::scene13_run() { break; } if (newSoundId != currSoundId) { - playSound(newSoundId, false); + _vm->playSound(newSoundId, false); currSoundId = newSoundId; } } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene13_updateHotspots(); - _timers[4] = getRandom(20) + 20; - _timers[5] = getRandom(50) + 50; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; + _vm->_timers[5] = _vm->getRandom(50) + 50; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene13_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene13::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; case kASBackToilet: _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); - _gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 9, 0, 0, 0); - _gnapSequenceId = _s13_backToiletCtr + 0xA3; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); + _vm->_gnapSequenceId = _s13_backToiletCtr + 0xA3; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; break; case kASFrontToilet: - _sceneDone = true; - _newSceneNum = 14; + _vm->_sceneDone = true; + _vm->_newSceneNum = 14; break; case kASLookScribble: - _gnapActionStatus = -1; - scene13_showScribble(); + _vm->_gnapActionStatus = -1; + showScribble(); break; case kASGrabSink: - _gameSys->setAnimation(0xAB, 160, 0); - _gameSys->insertSequence(0xAB, 160, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0xAA, 256, true); - _gnapSequenceId = 0xAB; - _gnapId = 160; - _gnapIdleFacing = kDirBottomRight; - _gnapSequenceDatNum = 0; - _gnapX = 4; - _gnapY = 8; - _timers[2] = 360; - _gnapActionStatus = kASGrabSinkDone; + _vm->_gameSys->setAnimation(0xAB, 160, 0); + _vm->_gameSys->insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0xAA, 256, true); + _vm->_gnapSequenceId = 0xAB; + _vm->_gnapId = 160; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 4; + _vm->_gnapY = 8; + _vm->_timers[2] = 360; + _vm->_gnapActionStatus = kASGrabSinkDone; break; case kASGrabSinkDone: - _gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; break; case kASWait: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASGrabUrinal: - _gameSys->setAnimation(0xA2, 120, 0); - _gameSys->insertSequence(0xA2, 120, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xA2; - _gnapId = 120; - _gnapIdleFacing = kDirBottomLeft; - _gnapSequenceDatNum = 0; - _gnapX = 4; - _gnapY = 6; - _timers[2] = 360; - _gnapActionStatus = kASWait; + _vm->_gameSys->setAnimation(0xA2, 120, 0); + _vm->_gameSys->insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA2; + _vm->_gnapId = 120; + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 4; + _vm->_gnapY = 6; + _vm->_timers[2] = 360; + _vm->_gnapActionStatus = kASWait; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - _platypusActionStatus = -1; + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_platypusActionStatus = -1; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene13.h b/engines/gnap/scenes/scene13.h new file mode 100644 index 0000000000..53085dd915 --- /dev/null +++ b/engines/gnap/scenes/scene13.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE13_H +#define GNAP_SCENE13_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene13: public Scene { +public: + Scene13(GnapEngine *vm); + ~Scene13() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s13_backToiletCtr; + + void showScribble(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE13_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 2cf75caa25..c5ba9d26df 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -38,6 +38,7 @@ #include "gnap/scenes/scene10.h" #include "gnap/scenes/scene11.h" #include "gnap/scenes/scene12.h" +#include "gnap/scenes/scene13.h" namespace Gnap { @@ -135,8 +136,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 13: - backgroundId = scene13_init(); - scene13_updateHotspots(); + _scene = new Scene13(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -454,7 +456,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 11; break; case 13: - scene13_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 11; break; -- cgit v1.2.3 From 2409d89eb597587e78f7453ec2f09c10e9b01465 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Apr 2016 20:17:33 +0200 Subject: GNAP: Refactor scene 14 --- engines/gnap/gnap.h | 6 -- engines/gnap/scenes/scene14.cpp | 176 +++++++++++++++++++------------------- engines/gnap/scenes/scene14.h | 48 +++++++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 141 insertions(+), 98 deletions(-) create mode 100644 engines/gnap/scenes/scene14.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 115015cf36..258bba4e15 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,12 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 14 - int scene14_init(); - void scene14_updateHotspots(); - void scene14_run(); - void scene14_updateAnimations(); - // Scene 15 int _s15_nextRecordSequenceId, _s15_currRecordSequenceId; int _s15_nextSlotSequenceId, _s15_currSlotSequenceId; diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp index 25db3a68ea..46e3c6d6be 100644 --- a/engines/gnap/scenes/scene14.cpp +++ b/engines/gnap/scenes/scene14.cpp @@ -24,6 +24,8 @@ #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene14.h" + namespace Gnap { enum { @@ -34,160 +36,156 @@ enum { kHSDevice = 4 }; -int GnapEngine::scene14_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); +Scene14::Scene14(GnapEngine *vm) : Scene(vm) { +} + +int Scene14::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); return 0x27; } -void GnapEngine::scene14_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0); - setHotspot(kHSExit, 0, 590, 799, 599, SF_EXIT_D_CURSOR); - setHotspot(kHSCoin, 330, 390, 375, 440, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSToilet, 225, 250, 510, 500, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFNeedleTaken)) - _hotspots[kHSCoin]._flags = SF_DISABLED; - _hotspotsCount = 5; +void Scene14::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0); + _vm->setHotspot(kHSExit, 0, 590, 799, 599, SF_EXIT_D_CURSOR); + _vm->setHotspot(kHSCoin, 330, 390, 375, 440, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSToilet, 225, 250, 510, 500, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFNeedleTaken)) + _vm->_hotspots[kHSCoin]._flags = SF_DISABLED; + _vm->_hotspotsCount = 5; } -void GnapEngine::scene14_run() { - _largeSprite = nullptr; +void Scene14::run() { + _vm->_largeSprite = nullptr; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (!isFlag(kGFNeedleTaken)) - _gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFNeedleTaken)) + _vm->_gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->endSceneInit(); - if (!isFlag(kGFNeedleTaken) && invHas(kItemTongs)) - _largeSprite = _gameSys->createSurface(1); + if (!_vm->isFlag(kGFNeedleTaken) && _vm->invHas(kItemTongs)) + _vm->_largeSprite = _vm->_gameSys->createSurface(1); - if (!isFlag(kGFNeedleTaken)) { - _gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x24; - _timers[2] = getRandom(40) + 50; + if (!_vm->isFlag(kGFNeedleTaken)) { + _vm->_gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x24; + _vm->_timers[2] = _vm->getRandom(40) + 50; } - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene14_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSExit: - _sceneDone = true; - _newSceneNum = 13; + _vm->_sceneDone = true; + _vm->_newSceneNum = 13; break; case kHSCoin: - if (_grabCursorSpriteIndex == kItemTongs) { - invAdd(kItemQuarter); - setFlag(kGFNeedleTaken); - setGrabCursorSprite(-1); - hideCursor(); - _gameSys->setAnimation(0x26, 10, 0); - _gameSys->insertSequence(0x26, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - } else if (_grabCursorSpriteIndex >= 0) { - playSound(0x108E9, false); + if (_vm->_grabCursorSpriteIndex == kItemTongs) { + _vm->invAdd(kItemQuarter); + _vm->setFlag(kGFNeedleTaken); + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->_gameSys->setAnimation(0x26, 10, 0); + _vm->_gameSys->insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playSound(0x108E9, false); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playSound(0x108E9, false); + _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - _gameSys->insertSequence(0x25, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x23; + _vm->_gameSys->insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x23; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, false); + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } break; case kHSToilet: - if (_grabCursorSpriteIndex >= 0) { - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playSound(0x108B1, false); + _vm->playSound(0x108B1, false); break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, false); + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } break; default: - _mouseClickState._left = false; + _vm->_mouseClickState._left = false; break; - } - scene14_updateAnimations(); - - checkGameKeys(); + updateAnimations(); + _vm->checkGameKeys(); - if (!isFlag(kGFNeedleTaken) && !_timers[2]) { - _gameSys->insertSequence(0x24, 10, _gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x24; - _timers[2] = getRandom(40) + 50; + if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { + _vm->_gameSys->insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x24; + _vm->_timers[2] = _vm->getRandom(40) + 50; } - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene14_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); + _vm->gameUpdateTick(); } - if (_largeSprite) - deleteSurface(&_largeSprite); - + if (_vm->_largeSprite) + _vm->deleteSurface(&_vm->_largeSprite); } -void GnapEngine::scene14_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); - _gameSys->setAnimation(0x10843, 301, 1); - _gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); +void Scene14::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_gameSys->setAnimation(0x10843, 301, 1); + _vm->_gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - _sceneDone = true; - _newSceneNum = 13; - _grabCursorSpriteIndex = kItemQuarter; + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_sceneDone = true; + _vm->_newSceneNum = 13; + _vm->_grabCursorSpriteIndex = kItemQuarter; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene14.h b/engines/gnap/scenes/scene14.h new file mode 100644 index 0000000000..32f0907cb8 --- /dev/null +++ b/engines/gnap/scenes/scene14.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE14_H +#define GNAP_SCENE14_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene14: public Scene { +public: + Scene14(GnapEngine *vm); + ~Scene14() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE14_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c5ba9d26df..9016d8a7c0 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -39,6 +39,7 @@ #include "gnap/scenes/scene11.h" #include "gnap/scenes/scene12.h" #include "gnap/scenes/scene13.h" +#include "gnap/scenes/scene14.h" namespace Gnap { @@ -143,8 +144,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 14: - backgroundId = scene14_init(); - scene14_updateHotspots(); + _scene = new Scene14(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); break; case 15: @@ -462,7 +464,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 11; break; case 14: - scene14_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 13; break; -- cgit v1.2.3 From 4f4c25534c3e7597c67ced3c5d790380b8a1d787 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Apr 2016 20:23:46 +0200 Subject: GNAP: Use a nullptr instead of 0 in deleteSurface() --- engines/gnap/gnap.cpp | 2 +- engines/gnap/scenes/scene14.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 7d097fdbdc..77039c0dcb 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1029,7 +1029,7 @@ void GnapEngine::deleteSurface(Graphics::Surface **surface) { if (surface && *surface) { (*surface)->free(); delete *surface; - *surface = 0; + *surface = nullptr; } } diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp index 46e3c6d6be..6fafc2d66a 100644 --- a/engines/gnap/scenes/scene14.cpp +++ b/engines/gnap/scenes/scene14.cpp @@ -165,7 +165,6 @@ void Scene14::run() { } _vm->gameUpdateTick(); - } if (_vm->_largeSprite) -- cgit v1.2.3 From c30810c933111857a914fc904e71051e861ec125 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Apr 2016 22:36:39 +0200 Subject: GNAP: Refactor scene 15 --- engines/gnap/gnap.h | 10 -- engines/gnap/scenes/scene15.cpp | 251 ++++++++++++++++++++------------------ engines/gnap/scenes/scene15.h | 56 +++++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 192 insertions(+), 134 deletions(-) create mode 100644 engines/gnap/scenes/scene15.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 258bba4e15..137275befd 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,16 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 15 - int _s15_nextRecordSequenceId, _s15_currRecordSequenceId; - int _s15_nextSlotSequenceId, _s15_currSlotSequenceId; - int _s15_nextUpperButtonSequenceId, _s15_currUpperButtonSequenceId; - int _s15_nextLowerButtonSequenceId, _s15_currLowerButtonSequenceId; - int scene15_init(); - void scene15_updateHotspots(); - void scene15_run(); - void scene15_updateAnimations(); - // Scene 16 void scene16_initCutscene(); diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp index 7bdfc8174d..1052d573f4 100644 --- a/engines/gnap/scenes/scene15.cpp +++ b/engines/gnap/scenes/scene15.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene15.h" namespace Gnap { @@ -46,33 +47,43 @@ enum { kHSDevice = 16 }; -int GnapEngine::scene15_init() { +Scene15::Scene15(GnapEngine *vm) : Scene(vm) { + _s15_nextRecordSequenceId = -1; + _s15_currRecordSequenceId = -1; + _s15_nextSlotSequenceId = -1; + _s15_currSlotSequenceId = -1; + _s15_nextUpperButtonSequenceId = -1; + _s15_currUpperButtonSequenceId = -1; + _s15_nextLowerButtonSequenceId = -1; + _s15_currLowerButtonSequenceId = -1; +} + +int Scene15::init() { return 0xDD; } -void GnapEngine::scene15_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - setHotspot(kHSExit, 50, 590, 750, 599, SF_EXIT_D_CURSOR); - setHotspot(kHSButton1, 210, 425, 260, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButton2, 280, 425, 325, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButton3, 340, 425, 385, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButton4, 400, 425, 445, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButton5, 460, 425, 510, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButton6, 520, 425, 560, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButtonA, 205, 480, 250, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButtonB, 270, 480, 320, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButtonC, 335, 480, 380, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButtonD, 395, 480, 445, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButtonE, 460, 480, 505, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSButtonF, 515, 480, 560, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSCoinSlot, 585, 475, 620, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSPlayButton, 622, 431, 650, 482, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 17; +void Scene15::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHSExit, 50, 590, 750, 599, SF_EXIT_D_CURSOR); + _vm->setHotspot(kHSButton1, 210, 425, 260, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButton2, 280, 425, 325, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButton3, 340, 425, 385, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButton4, 400, 425, 445, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButton5, 460, 425, 510, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButton6, 520, 425, 560, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButtonA, 205, 480, 250, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButtonB, 270, 480, 320, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButtonC, 335, 480, 380, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButtonD, 395, 480, 445, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButtonE, 460, 480, 505, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSButtonF, 515, 480, 560, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSCoinSlot, 585, 475, 620, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSPlayButton, 622, 431, 650, 482, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 17; } -void GnapEngine::scene15_run() { - +void Scene15::run() { _s15_currSlotSequenceId = -1; _s15_currUpperButtonSequenceId = -1; _s15_currLowerButtonSequenceId = -1; @@ -82,84 +93,83 @@ void GnapEngine::scene15_run() { _s15_currRecordSequenceId = 0xD5; _s15_nextRecordSequenceId = -1; - _gameSys->setAnimation(0xD5, 1, 0); - _gameSys->insertSequence(_s15_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - queueInsertDeviceIcon(); + _vm->_gameSys->setAnimation(0xD5, 1, 0); + _vm->_gameSys->insertSequence(_s15_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->queueInsertDeviceIcon(); - while (!_sceneDone) { + _vm->endSceneInit(); - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _hotspots[kHSPlatypus]._x1 = 0; - _hotspots[kHSPlatypus]._y1 = 0; - _hotspots[kHSPlatypus]._x2 = 0; - _hotspots[kHSPlatypus]._y2 = 0; + _vm->_hotspots[kHSPlatypus]._x1 = 0; + _vm->_hotspots[kHSPlatypus]._y1 = 0; + _vm->_hotspots[kHSPlatypus]._x2 = 0; + _vm->_hotspots[kHSPlatypus]._y2 = 0; - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene15_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSExit: - _newSceneNum = 12; - _isLeavingScene = true; + _vm->_newSceneNum = 12; + _vm->_isLeavingScene = true; break; case kHSCoinSlot: - if (_grabCursorSpriteIndex == kItemQuarter || _grabCursorSpriteIndex == kItemQuarterWithHole) { + if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { _s15_nextSlotSequenceId = 0xDC; // Insert coin - } else if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { + } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _s15_nextSlotSequenceId = 0xDB; - } else if (_grabCursorSpriteIndex >= 0) { - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playSound(0x108E9, false); + _vm->playSound(0x108E9, false); break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, false); + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } break; case kHSPlayButton: - if (_grabCursorSpriteIndex >= 0) { - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFGnapControlsToyUFO) || isFlag(kGFUnk13)) - playSound(0x108E9, false); + if (_vm->isFlag(kGFGnapControlsToyUFO) || _vm->isFlag(kGFUnk13)) + _vm->playSound(0x108E9, false); else _s15_nextSlotSequenceId = 0xDA; break; case GRAB_CURSOR: - if (isFlag(kGFGnapControlsToyUFO) || isFlag(kGFUnk13)) + if (_vm->isFlag(kGFGnapControlsToyUFO) || _vm->isFlag(kGFUnk13)) _s15_nextSlotSequenceId = 0xD9; else _s15_nextSlotSequenceId = 0xDA; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, false); + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -171,21 +181,21 @@ void GnapEngine::scene15_run() { case kHSButton4: case kHSButton5: case kHSButton6: - if (_grabCursorSpriteIndex >= 0) { - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playSound(0x108E9, false); + _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - _s15_nextUpperButtonSequenceId = _sceneClickedHotspot + 0xC5; + _s15_nextUpperButtonSequenceId = _vm->_sceneClickedHotspot + 0xC5; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, false); + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -197,132 +207,131 @@ void GnapEngine::scene15_run() { case kHSButtonD: case kHSButtonE: case kHSButtonF: - if (_grabCursorSpriteIndex >= 0) { - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playSound(0x108E9, false); + _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - _s15_nextLowerButtonSequenceId = _sceneClickedHotspot + 0xC5; + _s15_nextLowerButtonSequenceId = _vm->_sceneClickedHotspot + 0xC5; break; case TALK_CURSOR: - playSound((getRandom(5) + 0x8D5) | 0x10000, false); + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _gnapGridX, 576 - _gnapGridY); + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } break; default: - _mouseClickState._left = false; + _vm->_mouseClickState._left = false; break; } - scene15_updateAnimations(); - - checkGameKeys(); + updateAnimations(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene15_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene15_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - if (_isLeavingScene) { - _sceneDone = true; +void Scene15::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + if (_vm->_isLeavingScene) { + _vm->_sceneDone = true; } else if (_s15_nextSlotSequenceId != -1) { - _gameSys->setAnimation(_s15_nextSlotSequenceId, 1, 0); - _gameSys->insertSequence(_s15_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s15_nextSlotSequenceId, 1, 0); + _vm->_gameSys->insertSequence(_s15_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _s15_currSlotSequenceId = _s15_nextSlotSequenceId; _s15_nextSlotSequenceId = -1; switch (_s15_currSlotSequenceId) { case 0xDC: - if (_grabCursorSpriteIndex == kItemQuarter) { - invRemove(kItemQuarter); + if (_vm->_grabCursorSpriteIndex == kItemQuarter) { + _vm->invRemove(kItemQuarter); } else { - invRemove(kItemQuarterWithHole); - setFlag(kGFUnk13); + _vm->invRemove(kItemQuarterWithHole); + _vm->setFlag(kGFUnk13); } - setGrabCursorSprite(-1); + _vm->setGrabCursorSprite(-1); break; case 0xDB: - setFlag(kGFUnk14); - setGrabCursorSprite(-1); + _vm->setFlag(kGFUnk14); + _vm->setGrabCursorSprite(-1); _s15_nextSlotSequenceId = 0xD8; break; case 0xD9: - if (isFlag(kGFGnapControlsToyUFO)) { - clearFlag(kGFGnapControlsToyUFO); - invAdd(kItemQuarter); - _newGrabCursorSpriteIndex = kItemQuarter; - } else if (isFlag(kGFUnk13)) { - clearFlag(kGFUnk13); - invAdd(kItemQuarterWithHole); - _newGrabCursorSpriteIndex = kItemQuarterWithHole; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->clearFlag(kGFGnapControlsToyUFO); + _vm->invAdd(kItemQuarter); + _vm->_newGrabCursorSpriteIndex = kItemQuarter; + } else if (_vm->isFlag(kGFUnk13)) { + _vm->clearFlag(kGFUnk13); + _vm->invAdd(kItemQuarterWithHole); + _vm->_newGrabCursorSpriteIndex = kItemQuarterWithHole; } - _newSceneNum = 12; - _isLeavingScene = true; + _vm->_newSceneNum = 12; + _vm->_isLeavingScene = true; break; case 0xD8: case 0xDA: if (_s15_currUpperButtonSequenceId != -1) { - _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); + _vm->_gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); _s15_currUpperButtonSequenceId = -1; } if (_s15_currLowerButtonSequenceId != -1) { - _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); + _vm->_gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); _s15_currLowerButtonSequenceId = -1; } break; } } else if (_s15_nextRecordSequenceId != -1) { - _gameSys->setAnimation(_s15_nextRecordSequenceId, 1, 0); - _gameSys->insertSequence(_s15_nextRecordSequenceId, 1, _s15_currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s15_nextRecordSequenceId, 1, 0); + _vm->_gameSys->insertSequence(_s15_nextRecordSequenceId, 1, _s15_currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); _s15_currRecordSequenceId = _s15_nextRecordSequenceId; _s15_nextRecordSequenceId = -1; if (_s15_currRecordSequenceId == 0xD3) { - invRemove(kItemDiceQuarterHole); - _newSceneNum = 16; - _isLeavingScene = true; + _vm->invRemove(kItemDiceQuarterHole); + _vm->_newSceneNum = 16; + _vm->_isLeavingScene = true; } - _gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); + _vm->_gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); _s15_currUpperButtonSequenceId = -1; - _gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); + _vm->_gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); _s15_currLowerButtonSequenceId = -1; } else if (_s15_nextUpperButtonSequenceId != -1) { - _gameSys->setAnimation(_s15_nextUpperButtonSequenceId, 1, 0); + _vm->_gameSys->setAnimation(_s15_nextUpperButtonSequenceId, 1, 0); if (_s15_currUpperButtonSequenceId == -1) - _gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, _s15_currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, _s15_currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _s15_currUpperButtonSequenceId = _s15_nextUpperButtonSequenceId; _s15_nextUpperButtonSequenceId = -1; - if (_s15_currLowerButtonSequenceId != -1 && isFlag(kGFUnk14)) { + if (_s15_currLowerButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) _s15_nextRecordSequenceId = 0xD3; else _s15_nextRecordSequenceId = 0xD4; } } else if (_s15_nextLowerButtonSequenceId != -1) { - _gameSys->setAnimation(_s15_nextLowerButtonSequenceId, 1, 0); + _vm->_gameSys->setAnimation(_s15_nextLowerButtonSequenceId, 1, 0); if (_s15_currLowerButtonSequenceId == -1) - _gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, _s15_currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, _s15_currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _s15_currLowerButtonSequenceId = _s15_nextLowerButtonSequenceId; _s15_nextLowerButtonSequenceId = -1; - if (_s15_currUpperButtonSequenceId != -1 && isFlag(kGFUnk14)) { + if (_s15_currUpperButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) _s15_nextRecordSequenceId = 0xD3; else diff --git a/engines/gnap/scenes/scene15.h b/engines/gnap/scenes/scene15.h new file mode 100644 index 0000000000..584efbb106 --- /dev/null +++ b/engines/gnap/scenes/scene15.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE15_H +#define GNAP_SCENE15_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene15: public Scene { +public: + Scene15(GnapEngine *vm); + ~Scene15() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s15_nextRecordSequenceId; + int _s15_currRecordSequenceId; + int _s15_nextSlotSequenceId; + int _s15_currSlotSequenceId; + int _s15_nextUpperButtonSequenceId; + int _s15_currUpperButtonSequenceId; + int _s15_nextLowerButtonSequenceId; + int _s15_currLowerButtonSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE15_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 9016d8a7c0..6d54e4babb 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -40,6 +40,7 @@ #include "gnap/scenes/scene12.h" #include "gnap/scenes/scene13.h" #include "gnap/scenes/scene14.h" +#include "gnap/scenes/scene15.h" namespace Gnap { @@ -150,8 +151,9 @@ int GnapEngine::initSceneLogic() { _gameSys->setScaleValues(0, 500, 1, 1000); break; case 15: - backgroundId = scene15_init(); - scene15_updateHotspots(); + _scene = new Scene15(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); break; case 16: @@ -470,7 +472,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 13; break; case 15: - scene15_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 12; break; -- cgit v1.2.3 From 861e5c10677d1493fc00542fec9ed1f0a030cb25 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Apr 2016 00:26:09 +0200 Subject: GNAP: Refactor scenes 16, 47, 48, 54 (cutscenes) --- engines/gnap/gnap.cpp | 81 ------------------------ engines/gnap/gnap.h | 24 -------- engines/gnap/scenes/scene16.cpp | 7 ++- engines/gnap/scenes/scene16.h | 42 +++++++++++++ engines/gnap/scenes/scene47.cpp | 51 ++++++++++++---- engines/gnap/scenes/scene47.h | 89 +++++++++++++++++++++++++++ engines/gnap/scenes/scene48.cpp | 7 ++- engines/gnap/scenes/scene48.h | 42 +++++++++++++ engines/gnap/scenes/scene54.cpp | 15 ++++- engines/gnap/scenes/scene54.h | 49 +++++++++++++++ engines/gnap/scenes/scenecore.cpp | 125 ++++++++++++++++++++++++++++++++------ engines/gnap/scenes/scenecore.h | 20 ++++++ 12 files changed, 414 insertions(+), 138 deletions(-) create mode 100644 engines/gnap/scenes/scene16.h create mode 100644 engines/gnap/scenes/scene47.h create mode 100644 engines/gnap/scenes/scene48.h create mode 100644 engines/gnap/scenes/scene54.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 77039c0dcb..07978cb322 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2077,11 +2077,9 @@ void GnapEngine::initGlobalSceneVars() { _toyUfoActionStatus = -1; _toyUfoX = 0; _toyUfoY = 50; - } bool GnapEngine::sceneXX_sub_4466B1() { - if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { clearKeyStatus1(Common::KEYCODE_ESCAPE); clearKeyStatus1(Common::KEYCODE_UP); @@ -2098,7 +2096,6 @@ bool GnapEngine::sceneXX_sub_4466B1() { } return false; - } void GnapEngine::sceneXX_playRandomSound(int timerIndex) { @@ -2271,82 +2268,4 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, } } -// Scene 99 - -int GnapEngine::cutscene_init() { - return -1; -} - -void GnapEngine::cutscene_run() { - - int itemIndex = 0; - int soundId = -1; - int volume = 100; - int duration = 0; - bool skip = false; - - if (_prevSceneNum == 2) { - soundId = 0x36B; - duration = MAX(1, 300 / getSequenceTotalDuration(_s99_sequenceIdArr[_s99_itemsCount - 1]));//CHECKME - _timers[0] = 0; - } - - if (soundId != -1) - playSound(soundId, false); - - hideCursor(); - - _gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[0]); - - for (int j = 0; j < _s99_sequenceCountArr[0]; ++j) - _gameSys->insertSequence(_s99_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(_s99_sequenceIdArr[0], 2, 0); - - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(Common::KEYCODE_SPACE); - clearKeyStatus1(29); - - _mouseClickState._left = false; - - int firstSequenceIndex = 0; - while (!_sceneDone) { - gameUpdateTick(); - - if (_gameSys->getAnimationStatus(0) == 2 || skip) { - skip = false; - _gameSys->requestClear2(false); - _gameSys->requestClear1(); - _gameSys->setAnimation(0, 0, 0); - firstSequenceIndex += _s99_sequenceCountArr[itemIndex++]; - if (itemIndex >= _s99_itemsCount) { - _sceneDone = true; - } else { - for (int m = 0; m < _s99_sequenceCountArr[itemIndex]; ++m) - _gameSys->insertSequence(_s99_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[itemIndex]); - _gameSys->setAnimation(_s99_sequenceIdArr[firstSequenceIndex], 2, 0); - } - } - - if (isKeyStatus1(Common::KEYCODE_ESCAPE) || isKeyStatus1(Common::KEYCODE_SPACE) || isKeyStatus1(29)) { - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(Common::KEYCODE_SPACE); - clearKeyStatus1(29); - if (_s99_canSkip[itemIndex]) - skip = true; - else - _sceneDone = true; - } - - if (!_timers[0] && itemIndex == _s99_itemsCount - 1) { - _timers[0] = 2; - volume = MAX(1, volume - duration); - setSoundVolume(soundId, volume); - } - } - - if (soundId != -1) - stopSound(soundId); -} - } // End of namespace Gnap diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 137275befd..cbe711a47b 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,9 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 16 - void scene16_initCutscene(); - // Scene 17 bool _s17_canTryGetWrench; int _s17_wrenchCtr, _s17_platPhoneCtr, _s17_platTryGetWrenchCtr; @@ -836,18 +833,6 @@ public: void scene46_run(); void scene46_updateAnimations(); - // Scene 47 - void scene47_initCutscene1(); - void scene47_initCutscene2(); - void scene47_initCutscene3(); - void scene47_initCutscene4(); - void scene47_initCutscene5(); - void scene47_initCutscene6(); - void scene47_initCutscene7(); - - // Scene 48 - void scene48_initCutscene(); - // Scene 49 int _s49_scoreBarPos, _s49_scoreLevel; bool _s49_scoreBarFlash; @@ -1026,15 +1011,6 @@ public: // Scene 54 void scene54_initCutscene1(); void scene54_initCutscene2(); - - // Scene 99 - int _s99_itemsCount; - int _s99_resourceIdArr[16]; - int _s99_sequenceCountArr[16]; - int _s99_sequenceIdArr[50]; - bool _s99_canSkip[16]; - int cutscene_init(); - void cutscene_run(); }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene16.cpp b/engines/gnap/scenes/scene16.cpp index 64db758545..bfe9afaf87 100644 --- a/engines/gnap/scenes/scene16.cpp +++ b/engines/gnap/scenes/scene16.cpp @@ -23,10 +23,13 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene16.h" namespace Gnap { -void GnapEngine::scene16_initCutscene() { +Scene16::Scene16(GnapEngine *vm) : CutScene(vm) {} + +int Scene16::init() { _s99_sequenceIdArr[0] = 0x1F2; _s99_sequenceIdArr[1] = 0x201; _s99_sequenceIdArr[2] = 0x1FC; @@ -77,6 +80,8 @@ void GnapEngine::scene16_initCutscene() { _s99_sequenceCountArr[11] = 1; _s99_sequenceCountArr[12] = 1; _s99_itemsCount = 13; + + return -1; } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene16.h b/engines/gnap/scenes/scene16.h new file mode 100644 index 0000000000..e9d3b7f071 --- /dev/null +++ b/engines/gnap/scenes/scene16.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE16_H +#define GNAP_SCENE16_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene16: public CutScene { +public: + Scene16(GnapEngine *vm); + ~Scene16() {} + + virtual int init(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE16_H diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index 50c8c39f22..ec0be02aeb 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -23,10 +23,13 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene47.h" namespace Gnap { -void GnapEngine::scene47_initCutscene1() { +Scene471::Scene471(GnapEngine *vm) : CutScene(vm) {} + +int Scene471::init() { _s99_sequenceIdArr[0] = 0x301; _s99_sequenceIdArr[1] = 0x305; _s99_sequenceIdArr[2] = 0x302; @@ -48,9 +51,13 @@ void GnapEngine::scene47_initCutscene1() { _s99_canSkip[3] = false; _s99_canSkip[4] = false; _s99_itemsCount = 5; + + return -1; } -void GnapEngine::scene47_initCutscene2() { +Scene472::Scene472(GnapEngine *vm) : CutScene(vm) {} + +int Scene472::init() { _s99_sequenceIdArr[0] = 0x306; _s99_sequenceIdArr[1] = 0x309; _s99_sequenceIdArr[2] = 0x307; @@ -69,9 +76,13 @@ void GnapEngine::scene47_initCutscene2() { _s99_canSkip[2] = false; _s99_canSkip[3] = false; _s99_itemsCount = 4; + + return -1; } -void GnapEngine::scene47_initCutscene3() { +Scene473::Scene473(GnapEngine *vm) : CutScene(vm) {} + +int Scene473::init() { _s99_sequenceIdArr[0] = 0x320; _s99_sequenceIdArr[1] = 0x321; _s99_resourceIdArr[0] = 0x142; @@ -81,9 +92,13 @@ void GnapEngine::scene47_initCutscene3() { _s99_canSkip[0] = false; _s99_canSkip[1] = false; _s99_itemsCount = 2; + + return -1; } -void GnapEngine::scene47_initCutscene4() { +Scene474::Scene474(GnapEngine *vm) : CutScene(vm) {} + +int Scene474::init() { _s99_sequenceIdArr[0] = 0x30C; _s99_sequenceIdArr[1] = 0x30D; _s99_sequenceIdArr[2] = 0x30B; @@ -97,9 +112,13 @@ void GnapEngine::scene47_initCutscene4() { _s99_canSkip[1] = false; _s99_canSkip[2] = false; _s99_itemsCount = 3; + + return -1; } -void GnapEngine::scene47_initCutscene5() { +Scene475::Scene475(GnapEngine *vm) : CutScene(vm) {} + +int Scene475::init() { _s99_sequenceIdArr[0] = 0x30E; _s99_sequenceIdArr[1] = 0x30F; _s99_sequenceIdArr[2] = 0x310; @@ -111,18 +130,26 @@ void GnapEngine::scene47_initCutscene5() { _s99_canSkip[0] = false; _s99_canSkip[1] = false; _s99_itemsCount = 2; + + return -1; } -void GnapEngine::scene47_initCutscene6() { +Scene476::Scene476(GnapEngine *vm) : CutScene(vm) {} + +int Scene476::init() { _s99_sequenceIdArr[0] = 0x31E; _s99_sequenceIdArr[1] = 0x31F; _s99_resourceIdArr[0] = 0x2FA; _s99_sequenceCountArr[0] = 2; _s99_canSkip[0] = false; _s99_itemsCount = 1; + + return -1; } -void GnapEngine::scene47_initCutscene7() { +Scene477::Scene477(GnapEngine *vm) : CutScene(vm) {} + +int Scene477::init() { int v0, v4, v2, v3; _s99_sequenceIdArr[0] = 0x316; @@ -130,11 +157,11 @@ void GnapEngine::scene47_initCutscene7() { _s99_sequenceIdArr[2] = 0x314; _s99_sequenceIdArr[3] = 0x31B; int v1 = 4; - if (!isFlag(kGFTwigTaken)) { + if (!_vm->isFlag(kGFTwigTaken)) { _s99_sequenceIdArr[4] = 0x31C; v1 = 5; } - if (!isFlag(kGFPlatypusTalkingToAssistant)) + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) _s99_sequenceIdArr[v1++] = 0x31D; v4 = v1; _s99_sequenceIdArr[v1] = 0x319; @@ -144,9 +171,9 @@ void GnapEngine::scene47_initCutscene7() { _s99_sequenceIdArr[v0++] = 0x312; _s99_sequenceIdArr[v0] = 0x31A; v2 = v0 + 1; - if (!isFlag(kGFTwigTaken)) + if (!_vm->isFlag(kGFTwigTaken)) _s99_sequenceIdArr[v2++] = 0x31C; - if (!isFlag(kGFPlatypusTalkingToAssistant)) + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) _s99_sequenceIdArr[v2++] = 0x31D; _s99_sequenceIdArr[v2] = 0x313; _s99_sequenceIdArr[v2 + 1] = 0x315; @@ -166,6 +193,8 @@ void GnapEngine::scene47_initCutscene7() { _s99_canSkip[3] = false; _s99_canSkip[4] = false; _s99_itemsCount = 5; + + return -1; } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene47.h b/engines/gnap/scenes/scene47.h new file mode 100644 index 0000000000..f1c1034223 --- /dev/null +++ b/engines/gnap/scenes/scene47.h @@ -0,0 +1,89 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE47_H +#define GNAP_SCENE47_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene471: public CutScene { +public: + Scene471(GnapEngine *vm); + ~Scene471() {} + + virtual int init(); +}; + +class Scene472: public CutScene { +public: + Scene472(GnapEngine *vm); + ~Scene472() {} + + virtual int init(); +}; + +class Scene473: public CutScene { +public: + Scene473(GnapEngine *vm); + ~Scene473() {} + + virtual int init(); +}; + +class Scene474: public CutScene { +public: + Scene474(GnapEngine *vm); + ~Scene474() {} + + virtual int init(); +}; + +class Scene475: public CutScene { +public: + Scene475(GnapEngine *vm); + ~Scene475() {} + + virtual int init(); +}; + +class Scene476: public CutScene { +public: + Scene476(GnapEngine *vm); + ~Scene476() {} + + virtual int init(); +}; + +class Scene477: public CutScene { +public: + Scene477(GnapEngine *vm); + ~Scene477() {} + + virtual int init(); +}; +} // End of namespace Gnap +#endif // GNAP_SCENE47_H diff --git a/engines/gnap/scenes/scene48.cpp b/engines/gnap/scenes/scene48.cpp index a614ca4549..46d624ea3f 100644 --- a/engines/gnap/scenes/scene48.cpp +++ b/engines/gnap/scenes/scene48.cpp @@ -23,10 +23,13 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene48.h" namespace Gnap { -void GnapEngine::scene48_initCutscene() { +Scene48::Scene48(GnapEngine *vm) : CutScene(vm) {} + +int Scene48::init() { _s99_sequenceIdArr[0] = 390; _s99_sequenceIdArr[1] = 391; _s99_sequenceIdArr[2] = 392; @@ -80,6 +83,8 @@ void GnapEngine::scene48_initCutscene() { _s99_canSkip[11] = false; _s99_canSkip[12] = false; _s99_itemsCount = 13; + + return -1; } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene48.h b/engines/gnap/scenes/scene48.h new file mode 100644 index 0000000000..24e54b4462 --- /dev/null +++ b/engines/gnap/scenes/scene48.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE48_H +#define GNAP_SCENE48_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene48: public CutScene { +public: + Scene48(GnapEngine *vm); + ~Scene48() {} + + virtual int init(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE48_H diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp index b6e4be9fcb..935a1668ee 100644 --- a/engines/gnap/scenes/scene54.cpp +++ b/engines/gnap/scenes/scene54.cpp @@ -23,10 +23,13 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene54.h" namespace Gnap { -void GnapEngine::scene54_initCutscene1() { +Scene541::Scene541(GnapEngine *vm) : CutScene(vm) {} + +int Scene541::init() { _s99_sequenceIdArr[0] = 0x1BE; _s99_sequenceIdArr[1] = 0x1BF; _s99_sequenceIdArr[2] = 0x1BA; @@ -36,7 +39,7 @@ void GnapEngine::scene54_initCutscene1() { _s99_resourceIdArr[0] = 0x3C; _s99_resourceIdArr[1] = 0x43; _s99_resourceIdArr[2] = 0x44; - if (isFlag(kGFPictureTaken)) + if (_vm->isFlag(kGFPictureTaken)) _s99_resourceIdArr[3] = 0x47; else _s99_resourceIdArr[3] = 0x46; @@ -52,9 +55,13 @@ void GnapEngine::scene54_initCutscene1() { _s99_canSkip[3] = false; _s99_canSkip[4] = false; _s99_itemsCount = 5; + + return -1; } -void GnapEngine::scene54_initCutscene2() { +Scene542::Scene542(GnapEngine *vm) : CutScene(vm) {} + +int Scene542::init() { _s99_sequenceIdArr[0] = 0x1C9; _s99_sequenceIdArr[1] = 0x1C7; _s99_sequenceIdArr[2] = 0x1CC; @@ -122,6 +129,8 @@ void GnapEngine::scene54_initCutscene2() { _s99_canSkip[14] = true; _s99_canSkip[15] = false; _s99_itemsCount = 16; + + return -1; } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene54.h b/engines/gnap/scenes/scene54.h new file mode 100644 index 0000000000..a27d157da4 --- /dev/null +++ b/engines/gnap/scenes/scene54.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE54_H +#define GNAP_SCENE54_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene541: public CutScene { +public: + Scene541(GnapEngine *vm); + ~Scene541() {} + + virtual int init(); +}; + +class Scene542: public CutScene { +public: + Scene542(GnapEngine *vm); + ~Scene542() {} + + virtual int init(); +}; +} // End of namespace Gnap +#endif // GNAP_SCENE54_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 6d54e4babb..2f93098ebc 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -41,6 +41,10 @@ #include "gnap/scenes/scene13.h" #include "gnap/scenes/scene14.h" #include "gnap/scenes/scene15.h" +#include "gnap/scenes/scene16.h" +#include "gnap/scenes/scene47.h" +#include "gnap/scenes/scene48.h" +#include "gnap/scenes/scene54.h" namespace Gnap { @@ -160,7 +164,7 @@ int GnapEngine::initSceneLogic() { case 47: case 48: case 54: - backgroundId = cutscene_init(); + backgroundId = -1; _gameSys->setScaleValues(0, 500, 1, 1000); break; case 17: @@ -478,10 +482,12 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 12; break; case 16: - scene16_initCutscene(); + _scene = new Scene16(this); + _scene->init(); _newSceneNum = 17; _newCursorValue = 3; - cutscene_run(); + _scene->run(); + delete _scene; break; case 17: scene17_run(); @@ -639,39 +645,49 @@ void GnapEngine::runSceneLogic() { break; case 47: if (_prevSceneNum == 49) { - scene47_initCutscene1(); + _scene = new Scene471(this); + _scene->init(); _newSceneNum = 7; _newCursorValue = 2; } else if (_prevSceneNum == 13) { - scene47_initCutscene2(); + _scene = new Scene472(this); + _scene->init(); _newSceneNum = 11; } else if (!isFlag(kGFPlatyPussDisguised) && _prevSceneNum == 2) {//CHECKME if (isFlag(kGFUnk25)) { - scene47_initCutscene3(); + _scene = new Scene473(this); + _scene->init(); _newSceneNum = 2; } else { - scene47_initCutscene4(); + _scene = new Scene474(this); + _scene->init(); _newSceneNum = 49; } } else if (_prevSceneNum == 21) { - scene47_initCutscene5(); + _scene = new Scene475(this); + _scene->init(); _newSceneNum = 21; setFlag(kGFTwigTaken); setFlag(kGFKeysTaken); } else if (_prevSceneNum == 30) { - scene47_initCutscene6(); + _scene = new Scene476(this); + _scene->init(); _newSceneNum = 26; } else if (isFlag(kGFPlatyPussDisguised) && _cursorValue == 1) { - scene47_initCutscene7(); + _scene = new Scene477(this); + _scene->init(); _newSceneNum = 4; } - cutscene_run(); + _scene->run(); + delete _scene; break; case 48: - scene48_initCutscene(); + _scene = new Scene48(this); + _scene->init(); _newSceneNum = 33; _newCursorValue = 4; - cutscene_run(); + _scene->run(); + delete _scene; break; case 49: scene49_run(); @@ -696,16 +712,91 @@ void GnapEngine::runSceneLogic() { break; case 54: if (_prevSceneNum == 45) { - scene54_initCutscene1(); + _scene = new Scene541(this); + _scene->init(); _newSceneNum = 43; - cutscene_run(); + _scene->run(); + delete _scene; } else { - scene54_initCutscene2(); - cutscene_run(); + _scene = new Scene542(this); + _scene->init(); + _scene->run(); + delete _scene; _gameDone = true; } break; } } +void CutScene::run() { + int itemIndex = 0; + int soundId = -1; + int volume = 100; + int duration = 0; + bool skip = false; + + if (_vm->_prevSceneNum == 2) { + soundId = 0x36B; + duration = MAX(1, 300 / _vm->getSequenceTotalDuration(_s99_sequenceIdArr[_s99_itemsCount - 1]));//CHECKME + _vm->_timers[0] = 0; + } + + if (soundId != -1) + _vm->playSound(soundId, false); + + _vm->hideCursor(); + + _vm->_gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[0]); + + for (int j = 0; j < _s99_sequenceCountArr[0]; ++j) + _vm->_gameSys->insertSequence(_s99_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s99_sequenceIdArr[0], 2, 0); + + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(29); + + _vm->_mouseClickState._left = false; + + int firstSequenceIndex = 0; + while (!_vm->_sceneDone) { + _vm->gameUpdateTick(); + + if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip) { + skip = false; + _vm->_gameSys->requestClear2(false); + _vm->_gameSys->requestClear1(); + _vm->_gameSys->setAnimation(0, 0, 0); + firstSequenceIndex += _s99_sequenceCountArr[itemIndex++]; + if (itemIndex >= _s99_itemsCount) { + _vm->_sceneDone = true; + } else { + for (int m = 0; m < _s99_sequenceCountArr[itemIndex]; ++m) + _vm->_gameSys->insertSequence(_s99_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[itemIndex]); + _vm->_gameSys->setAnimation(_s99_sequenceIdArr[firstSequenceIndex], 2, 0); + } + } + + if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(29)) { + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(29); + if (_s99_canSkip[itemIndex]) + skip = true; + else + _vm->_sceneDone = true; + } + + if (!_vm->_timers[0] && itemIndex == _s99_itemsCount - 1) { + _vm->_timers[0] = 2; + volume = MAX(1, volume - duration); + _vm->setSoundVolume(soundId, volume); + } + } + + if (soundId != -1) + _vm->stopSound(soundId); +} + } // End of namespace Gnap diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index 63f11b9c8b..1f49fd8641 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -44,6 +44,26 @@ protected: GnapEngine *_vm; }; +class CutScene : public Scene { +public: + CutScene(GnapEngine *vm) : Scene(vm) {}; + ~CutScene() {}; + + virtual int init() = 0; + void updateHotspots() {} + void run(); + void updateAnimations() {} + void updateAnimationsCb() {} + +protected: + GnapEngine *_vm; + + int _s99_itemsCount; + int _s99_resourceIdArr[16]; + int _s99_sequenceCountArr[16]; + int _s99_sequenceIdArr[50]; + bool _s99_canSkip[16]; +}; } // End of namespace Gnap #endif // GNAP_SCENECORE_H -- cgit v1.2.3 From 453194b48b5692e7fb8719092d9998e371cbd0e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Apr 2016 07:23:47 +0200 Subject: GNAP: Refactor scene 17 --- engines/gnap/gnap.cpp | 10 - engines/gnap/gnap.h | 13 - engines/gnap/scenes/scene17.cpp | 919 +++++++++++++++++++------------------- engines/gnap/scenes/scene17.h | 61 +++ engines/gnap/scenes/scenecore.cpp | 9 +- 5 files changed, 530 insertions(+), 482 deletions(-) create mode 100644 engines/gnap/scenes/scene17.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 07978cb322..e002bb5ec4 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2018,16 +2018,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 17 - _s17_platTryGetWrenchCtr = 0; - _s17_wrenchCtr = 2; - _s17_nextCarWindowSequenceId = -1; - _s17_nextWrenchSequenceId = -1; - _s17_canTryGetWrench = true; - _s17_platPhoneCtr = 0; - _s17_nextPhoneSequenceId = -1; - _s17_currPhoneSequenceId = -1; - // Scene 18 _s18_garbageCanPos = 8; _s18_platPhoneCtr = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index cbe711a47b..0fa110b383 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,19 +603,6 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 17 - bool _s17_canTryGetWrench; - int _s17_wrenchCtr, _s17_platPhoneCtr, _s17_platTryGetWrenchCtr; - int _s17_nextPhoneSequenceId, _s17_currPhoneSequenceId; - int _s17_nextWrenchSequenceId, _s17_currWrenchSequenceId; - int _s17_nextCarWindowSequenceId, _s17_currCarWindowSequenceId; - int scene17_init(); - void scene17_updateHotspots(); - void scene17_update(); - void scene17_platHangUpPhone(); - void scene17_run(); - void scene17_updateAnimations(); - // Scene 18 int _s18_garbageCanPos; int _s18_platPhoneCtr; diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index cf5945dde8..00b3f19fa5 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene17.h" namespace Gnap { @@ -57,270 +58,279 @@ enum { kASLeaveScene = 15 }; -int GnapEngine::scene17_init() { +Scene17::Scene17(GnapEngine *vm) : Scene(vm) { + _s17_platTryGetWrenchCtr = 0; + _s17_wrenchCtr = 2; + _s17_nextCarWindowSequenceId = -1; + _s17_nextWrenchSequenceId = -1; + _s17_canTryGetWrench = true; + _s17_platPhoneCtr = 0; + _s17_nextPhoneSequenceId = -1; + _s17_currPhoneSequenceId = -1; +} + +int Scene17::init() { return 0x263; } -void GnapEngine::scene17_updateHotspots() { - setHotspot(kHSPlatypus, 1, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSPhone1, 61, 280, 97, 322, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - setHotspot(kHSPhone2, 80, 204, 178, 468, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - setHotspot(kHSExitGrubCity, 196, 207, 280, 304, SF_EXIT_U_CURSOR, 3, 5); - setHotspot(kHSExitToyStore, 567, 211, 716, 322, SF_EXIT_U_CURSOR, 5, 6); - setHotspot(kHSWrench, 586, 455, 681, 547, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - setHotspot(kHSWalkArea1, 0, 0, 800, 434); - setHotspot(kHSWalkArea2, 541, 0, 800, 600); - setHotspot(kHSWalkArea3, 0, 204, 173, 468); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFGrassTaken)) - _hotspots[kHSWrench]._flags = SF_NONE; - if (isFlag(kGFPlatypusTalkingToAssistant)) { - _hotspots[kHSDevice]._flags = SF_DISABLED; - _hotspots[kHSPlatypus]._flags = SF_DISABLED; +void Scene17::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 1, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSPhone1, 61, 280, 97, 322, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHSPhone2, 80, 204, 178, 468, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHSExitGrubCity, 196, 207, 280, 304, SF_EXIT_U_CURSOR, 3, 5); + _vm->setHotspot(kHSExitToyStore, 567, 211, 716, 322, SF_EXIT_U_CURSOR, 5, 6); + _vm->setHotspot(kHSWrench, 586, 455, 681, 547, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 434); + _vm->setHotspot(kHSWalkArea2, 541, 0, 800, 600); + _vm->setHotspot(kHSWalkArea3, 0, 204, 173, 468); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFGrassTaken)) + _vm->_hotspots[kHSWrench]._flags = SF_NONE; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHSDevice]._flags = SF_DISABLED; + _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; } - _hotspotsCount = 10; + _vm->_hotspotsCount = 10; } -void GnapEngine::scene17_update() { - gameUpdateTick(); - updateMouseCursor(); - updateGrabCursorSprite(0, 0); - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; +void Scene17::update() { + _vm->gameUpdateTick(); + _vm->updateMouseCursor(); + _vm->updateGrabCursorSprite(0, 0); + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } } -void GnapEngine::scene17_platHangUpPhone() { - int savedGnapActionStatus = _gnapActionStatus; +void Scene17::platHangUpPhone() { + int savedGnapActionStatus = _vm->_gnapActionStatus; - if (_platypusActionStatus == kASPlatPhoningAssistant) { - _gnapActionStatus = kASPlatHangUpPhone; - updateMouseCursor(); + if (_vm->_platypusActionStatus == kASPlatPhoningAssistant) { + _vm->_gnapActionStatus = kASPlatHangUpPhone; + _vm->updateMouseCursor(); _s17_platPhoneCtr = 0; - _platypusActionStatus = -1; - _gameSys->setAnimation(0x257, 254, 4); - _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_gameSys->getAnimationStatus(4) != 2) - gameUpdateTick(); - _gameSys->setAnimation(0x25B, _platypusId, 1); - _gameSys->insertSequence(0x25B, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0x25B; - _platypusSequenceDatNum = 0; + _vm->_platypusActionStatus = -1; + _vm->_gameSys->setAnimation(0x257, 254, 4); + _vm->_gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) + _vm->gameUpdateTick(); + _vm->_gameSys->setAnimation(0x25B, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0x25B; + _vm->_platypusSequenceDatNum = 0; _s17_currPhoneSequenceId = -1; _s17_nextPhoneSequenceId = -1; - clearFlag(kGFPlatypusTalkingToAssistant); - while (_gameSys->getAnimationStatus(1) != 2) - gameUpdateTick(); - _gnapActionStatus = savedGnapActionStatus; - updateMouseCursor(); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->_gnapActionStatus = savedGnapActionStatus; + _vm->updateMouseCursor(); } - scene17_updateHotspots(); + updateHotspots(); } -void GnapEngine::scene17_run() { - playSound(0x10940, true); - startSoundTimerA(8); - _sceneWaiting = false; - _timers[4] = getRandom(100) + 200; - _timers[3] = 200; - _timers[5] = getRandom(30) + 80; - _timers[6] = getRandom(30) + 200; - _timers[7] = getRandom(100) + 100; - - if (isFlag(kGFTruckKeysUsed)) { - _gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); +void Scene17::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(8); + _vm->_sceneWaiting = false; + _vm->_timers[4] = _vm->getRandom(100) + 200; + _vm->_timers[3] = 200; + _vm->_timers[5] = _vm->getRandom(30) + 80; + _vm->_timers[6] = _vm->getRandom(30) + 200; + _vm->_timers[7] = _vm->getRandom(100) + 100; + + if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); } else { - if (_s18_garbageCanPos >= 8) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); - } else if (_s18_garbageCanPos >= 6) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); - } else if (_s18_garbageCanPos >= 5) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); - } else if (_s18_garbageCanPos >= 4) { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); + if (_vm->_s18_garbageCanPos >= 8) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); + } else if (_vm->_s18_garbageCanPos >= 6) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); + } else if (_vm->_s18_garbageCanPos >= 5) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); + } else if (_vm->_s18_garbageCanPos >= 4) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); } else { - _gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); } } - if (isFlag(kGFGroceryStoreHatTaken)) - _gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFGrassTaken)) + if (_vm->isFlag(kGFGrassTaken)) _s17_currWrenchSequenceId = 0x22D; else _s17_currWrenchSequenceId = 0x22F; _s17_currCarWindowSequenceId = 0x244; - if (isFlag(kGFUnk14)) - _gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFUnk14)) + _vm->_gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFGrassTaken)) { - _gameSys->setAnimation(0, 0, 3); + if (_vm->isFlag(kGFGrassTaken)) { + _vm->_gameSys->setAnimation(0, 0, 3); } else { - _gameSys->setAnimation(_s17_currCarWindowSequenceId, 40, 3); - _gameSys->insertSequence(_s17_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_currCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_s17_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); } _s17_canTryGetWrench = true; - if (isFlag(kGFUnk18)) - _gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - - if (_prevSceneNum == 53 || _prevSceneNum == 18 || _prevSceneNum == 20 || _prevSceneNum == 19) { - if (_prevSceneNum == 20) { - initGnapPos(4, 6, kDirBottomRight); - initPlatypusPos(5, 6, kDirNone); - endSceneInit(); - platypusWalkTo(5, 9, -1, 0x107C2, 1); - gnapWalkTo(4, 8, -1, 0x107B9, 1); - } else if (isFlag(kGFUnk27)) { - initGnapPos(3, 9, kDirUpLeft); - _platX = _hotspotsWalkPos[2].x; - _platY = _hotspotsWalkPos[2].y; - _platypusId = 20 * _hotspotsWalkPos[2].y; - _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); - _platypusSequenceId = 0x25A; - _platypusSequenceDatNum = 0; - endSceneInit(); - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - _platypusActionStatus = kASPlatPhoningAssistant; - scene17_platHangUpPhone(); - _gameSys->setAnimation(0, 0, 4); - clearFlag(kGFPlatypusTalkingToAssistant); - clearFlag(kGFUnk27); - scene17_updateHotspots(); - } else if (isFlag(kGFUnk25)) { - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - initPlatypusPos(7, 9, kDirNone); - _gnapX = _hotspotsWalkPos[2].x; - _gnapY = _hotspotsWalkPos[2].y; - _gnapId = 20 * _hotspotsWalkPos[2].y; - _gameSys->insertSequence(601, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 601; - _gnapActionStatus = kASGnapHangUpPhone; - clearFlag(kGFUnk25); - _gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); - _gameSys->setAnimation(0x257, 254, 0); - _gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); - } else if (isFlag(kGFPlatypusTalkingToAssistant)) { - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - _sceneWaiting = true; - initGnapPos(3, 9, kDirUpLeft); - _platX = _hotspotsWalkPos[2].x; - _platY = _hotspotsWalkPos[2].y; - _platypusId = 20 * _hotspotsWalkPos[2].y; + if (_vm->isFlag(kGFUnk18)) + _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(4, 6, kDirBottomRight); + _vm->initPlatypusPos(5, 6, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else if (_vm->isFlag(kGFUnk27)) { + _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_platX = _vm->_hotspotsWalkPos[2].x; + _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x25A; + _vm->_platypusSequenceDatNum = 0; + _vm->endSceneInit(); + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->_platypusActionStatus = kASPlatPhoningAssistant; + platHangUpPhone(); + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + _vm->clearFlag(kGFUnk27); + updateHotspots(); + } else if (_vm->isFlag(kGFUnk25)) { + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->initPlatypusPos(7, 9, kDirNone); + _vm->_gnapX = _vm->_hotspotsWalkPos[2].x; + _vm->_gnapY = _vm->_hotspotsWalkPos[2].y; + _vm->_gnapId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_gameSys->insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 601; + _vm->_gnapActionStatus = kASGnapHangUpPhone; + _vm->clearFlag(kGFUnk25); + _vm->_gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(0x257, 254, 0); + _vm->_gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); + } else if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->_sceneWaiting = true; + _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_platX = _vm->_hotspotsWalkPos[2].x; + _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; _s17_currPhoneSequenceId = 0x251; - _gameSys->insertSequence(0x25A, 20 * _hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(_s17_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - _platypusSequenceId = 0x25A; - _platypusSequenceDatNum = 0; - endSceneInit(); - _gameSys->setAnimation(_s17_currPhoneSequenceId, 254, 1); - _platypusActionStatus = kASPlatPhoningAssistant; - scene17_updateHotspots(); - } else if (_prevSceneNum == 18) { - initGnapPos(6, 6, kDirBottomRight); - initPlatypusPos(5, 6, kDirNone); - endSceneInit(); - platypusWalkTo(5, 9, -1, 0x107C2, 1); - gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x25A; + _vm->_platypusSequenceDatNum = 0; + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(_s17_currPhoneSequenceId, 254, 1); + _vm->_platypusActionStatus = kASPlatPhoningAssistant; + updateHotspots(); + } else if (_vm->_prevSceneNum == 18) { + _vm->initGnapPos(6, 6, kDirBottomRight); + _vm->initPlatypusPos(5, 6, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { - if (isFlag(kGFSpringTaken)) { - initGnapPos(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, kDirBottomRight); - initPlatypusPos(1, 9, kDirNone); - endSceneInit(); + if (_vm->isFlag(kGFSpringTaken)) { + _vm->initGnapPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); + _vm->initPlatypusPos(1, 9, kDirNone); + _vm->endSceneInit(); } else { - initGnapPos(3, 7, kDirBottomRight); - initPlatypusPos(1, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); } - clearFlag(kGFSpringTaken); - clearFlag(kGFUnk16); - endSceneInit(); + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->endSceneInit(); } } else { - _gnapX = 3; - _gnapY = 6; - _gnapId = 120; - _gnapSequenceId = 0x23D; - _gnapSequenceDatNum = 0; - _gnapIdleFacing = kDirBottomRight; - _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0, 0, kSeqNone, 0, 0, 0); - _platX = -1; - _platY = 8; - _platypusId = 160; - _gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x107C1, _platypusId, 0x241, _platypusId, - kSeqScale | kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); - _gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapId = 120; + _vm->_gnapSequenceId = 0x23D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platX = -1; + _vm->_platY = 8; + _vm->_platypusId = 160; + _vm->_gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, + kSeqScale | kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + _vm->_gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); - endSceneInit(); - _platypusSequenceId = 0x7C1; - _platypusSequenceDatNum = 1; - _platypusFacing = kDirBottomRight; - platypusWalkTo(2, 9, -1, 0x107C2, 1); + _vm->endSceneInit(); + _vm->_platypusSequenceId = 0x7C1; + _vm->_platypusSequenceDatNum = 1; + _vm->_platypusFacing = kDirBottomRight; + _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0 || _gnapActionStatus == 3) { - runMenu(); - scene17_updateHotspots(); + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == 3) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - if (isFlag(kGFGrassTaken)) { - gnapUseJointOnPlatypus(); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->gnapUseJointOnPlatypus(); } else { - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(_hotspotsWalkPos[6].x, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); - gnapWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 0, 0x107BA, 1); - _platypusActionStatus = kASGetWrench1; - _gnapActionStatus = kASGetWrench1; - _timers[5] = getRandom(30) + 80; - setGrabCursorSprite(-1); - invRemove(kItemJoint); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); + _vm->_platypusActionStatus = kASGetWrench1; + _vm->_gnapActionStatus = kASGetWrench1; + _vm->_timers[5] = _vm->getRandom(30) + 80; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemJoint); } - } else if (_grabCursorSpriteIndex >= 0) { - playGnapScratchingHead(_platX, _platY); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -328,30 +338,30 @@ void GnapEngine::scene17_run() { break; case kHSWrench: - if (_gnapActionStatus < 0) { - if (isFlag(kGFGrassTaken)) { - playGnapImpossible(0, 0); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 8, 7); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - playGnapScratchingHead(8, 7); + _vm->playGnapScratchingHead(8, 7); break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: if (_s17_canTryGetWrench) { - scene17_platHangUpPhone(); - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(_hotspotsWalkPos[6].x + 1, _hotspotsWalkPos[6].y, 1, 0x107C2, 1); - _platypusActionStatus = kASTryGetWrench; - _gnapActionStatus = kASTryGetWrench; - _timers[5] = getRandom(30) + 80; + platHangUpPhone(); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kASTryGetWrench; + _vm->_gnapActionStatus = kASTryGetWrench; + _vm->_timers[5] = _vm->getRandom(30) + 80; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -359,40 +369,40 @@ void GnapEngine::scene17_run() { break; case kHSPhone1: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASPutCoinIntoPhone; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASPutCoinIntoPhone; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 3); + _vm->playGnapScratchingHead(1, 3); break; case GRAB_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y) | 0x10000, 1); - _gnapActionStatus = kASGetCoinFromPhone; + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGetCoinFromPhone; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - gnapUseDeviceOnPlatypuss(); - _platypusFacing = kDirUpLeft; - platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); - setFlag(kGFUnk16); - _platypusActionStatus = kASPlatUsePhone; - _gnapActionStatus = kASPlatUsePhone; + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->gnapUseDeviceOnPlatypuss(); + _vm->_platypusFacing = kDirUpLeft; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->setFlag(kGFUnk16); + _vm->_platypusActionStatus = kASPlatUsePhone; + _vm->_gnapActionStatus = kASPlatUsePhone; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -400,43 +410,43 @@ void GnapEngine::scene17_run() { break; case kHSPhone2: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASPutCoinIntoPhone; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASPutCoinIntoPhone; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 3); + _vm->playGnapScratchingHead(1, 3); break; case GRAB_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGnapUsePhone; - setFlag(kGFSpringTaken); + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGnapUsePhone; + _vm->setFlag(kGFSpringTaken); } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (isFlag(kGFUnk18)) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - gnapUseDeviceOnPlatypuss(); - _platypusFacing = kDirUpLeft; - platypusWalkTo(_hotspotsWalkPos[2].x, _hotspotsWalkPos[2].y, 1, 0x107C2, 1); - setFlag(kGFUnk16); - _platypusActionStatus = kASPlatUsePhone; - _gnapActionStatus = kASPlatUsePhone; + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->gnapUseDeviceOnPlatypuss(); + _vm->_platypusFacing = kDirUpLeft; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->setFlag(kGFUnk16); + _vm->_platypusActionStatus = kASPlatUsePhone; + _vm->_gnapActionStatus = kASPlatUsePhone; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -444,80 +454,80 @@ void GnapEngine::scene17_run() { break; case kHSExitToyStore: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 18; - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[5].x, _hotspotsWalkPos[5].y, 0, 0x107BB, 1); - _gnapActionStatus = kASLeaveScene; - if (_platypusActionStatus != kASPlatPhoningAssistant) - platypusWalkTo(_hotspotsWalkPos[5].x - 1, _hotspotsWalkPos[5].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->_platypusActionStatus != kASPlatPhoningAssistant) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); } break; case kHSExitGrubCity: - if (_gnapActionStatus < 0) { - scene17_platHangUpPhone(); - _isLeavingScene = true; - _newSceneNum = 20; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[3].x + 1, _hotspotsWalkPos[3].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); } break; case kHSWalkArea1: case kHSWalkArea2: case kHSWalkArea3: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = 0; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; } break; } - scene17_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10940)) - playSound(0x10940, true); + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - platypusSub426234(); - updateGnapIdleSequence2(); - if (!_timers[4]) { - _timers[4] = getRandom(100) + 200; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) - _gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->platypusSub426234(); + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 200; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + _vm->_gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[7]) { - _timers[7] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { - switch (getRandom(3)) { + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + switch (_vm->getRandom(3)) { case 0: - _gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); break; } } } - if (_platypusActionStatus < 0 && !_timers[5]) { - _timers[5] = getRandom(30) + 80; - if (isFlag(kGFGrassTaken) && _s17_nextWrenchSequenceId == -1) { + if (_vm->_platypusActionStatus < 0 && !_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(30) + 80; + if (_vm->isFlag(kGFGrassTaken) && _s17_nextWrenchSequenceId == -1) { _s17_nextWrenchSequenceId = 0x236; } else if (_s17_canTryGetWrench) { - switch (getRandom(6)) { + switch (_vm->getRandom(6)) { case 0: _s17_nextWrenchSequenceId = 0x231; break; @@ -536,7 +546,7 @@ void GnapEngine::scene17_run() { } else { --_s17_wrenchCtr; if (_s17_wrenchCtr) { - switch (getRandom(6)) { + switch (_vm->getRandom(6)) { case 0: _s17_nextWrenchSequenceId = 0x237; break; @@ -562,90 +572,87 @@ void GnapEngine::scene17_run() { } } } - if (!_timers[6]) { - _timers[6] = getRandom(30) + 200; - if (_s17_nextCarWindowSequenceId == -1 && !isFlag(kGFGrassTaken)) + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(30) + 200; + if (_s17_nextCarWindowSequenceId == -1 && !_vm->isFlag(kGFGrassTaken)) _s17_nextCarWindowSequenceId = 0x246; } - playSoundA(); + _vm->playSoundA(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene17_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene17_updateAnimations() { - +void Scene17::updateAnimations() { static const int kPlatPhoneSequenceIds[] = { 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257 }; - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASGetWrench1: - _gnapActionStatus = kASGetWrenchGnapReady; + _vm->_gnapActionStatus = kASGetWrenchGnapReady; break; case kASGetCoinFromPhone: - playGnapPullOutDevice(1, 3); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x250, 100, 0); - _gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); - invAdd(kItemDiceQuarterHole); - clearFlag(kGFUnk18); - _gnapActionStatus = kASGetCoinFromPhoneDone; + _vm->playGnapPullOutDevice(1, 3); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x250, 100, 0); + _vm->_gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); + _vm->invAdd(kItemDiceQuarterHole); + _vm->clearFlag(kGFUnk18); + _vm->_gnapActionStatus = kASGetCoinFromPhoneDone; break; case kASGetCoinFromPhoneDone: - setGrabCursorSprite(kItemDiceQuarterHole); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemDiceQuarterHole); + _vm->_gnapActionStatus = -1; break; case kASPutCoinIntoPhone: - _gameSys->setAnimation(0x24C, _gnapId, 0); - _gameSys->insertSequence(0x24C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x24C; - invRemove(kItemDiceQuarterHole); - setGrabCursorSprite(-1); - setFlag(kGFUnk18); - _gnapActionStatus = kASPutCoinIntoPhoneDone; + _vm->_gameSys->setAnimation(0x24C, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x24C; + _vm->invRemove(kItemDiceQuarterHole); + _vm->setGrabCursorSprite(-1); + _vm->setFlag(kGFUnk18); + _vm->_gnapActionStatus = kASPutCoinIntoPhoneDone; break; case kASPutCoinIntoPhoneDone: - _gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; break; case kASGnapUsePhone: - _gameSys->setAnimation(0x24D, _gnapId, 0); - _gameSys->insertSequence(0x24D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 53; + _vm->_gameSys->setAnimation(0x24D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 53; break; case kASGnapHangUpPhone: - _gameSys->insertSequence(0x258, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x258; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x258; + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - switch (_platypusActionStatus) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { case kASTryGetWrench: - _platypusActionStatus = -1; + _vm->_platypusActionStatus = -1; ++_s17_platTryGetWrenchCtr; if (_s17_platTryGetWrenchCtr % 2 != 0) _s17_nextWrenchSequenceId = 0x233; @@ -660,17 +667,17 @@ void GnapEngine::scene17_updateAnimations() { _s17_nextCarWindowSequenceId = 0x249; break; case kASGetWrenchDone: - _platypusActionStatus = -1; - invAdd(kItemWrench); - setGrabCursorSprite(kItemWrench); + _vm->_platypusActionStatus = -1; + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); break; case kASPlatUsePhone: - _gameSys->setAnimation(0x24E, _platypusId, 1); - _gameSys->insertSequence(0x24E, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x24E; - _platypusActionStatus = kASLeaveScene; - _newSceneNum = 53; + _vm->_gameSys->setAnimation(0x24E, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x24E; + _vm->_platypusActionStatus = kASLeaveScene; + _vm->_newSceneNum = 53; break; case kASPlatPhoningAssistant: ++_s17_platPhoneCtr; @@ -678,103 +685,103 @@ void GnapEngine::scene17_updateAnimations() { _s17_platPhoneCtr = 0; _s17_nextPhoneSequenceId = -1; _s17_currPhoneSequenceId = -1; - _gameSys->insertSequence(0x25B, _platypusId, 0x25A, _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x25B; - _platypusActionStatus = -1; - clearFlag(kGFPlatypusTalkingToAssistant); - _sceneWaiting = false; - scene17_updateHotspots(); + _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x25B; + _vm->_platypusActionStatus = -1; + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + _vm->_sceneWaiting = false; + updateHotspots(); } else { _s17_nextPhoneSequenceId = kPlatPhoneSequenceIds[_s17_platPhoneCtr]; - _gameSys->setAnimation(_s17_nextPhoneSequenceId, 254, 1); - _gameSys->insertSequence(_s17_nextPhoneSequenceId, 254, _s17_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x25A, _platypusId, 0x25A, _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceDatNum = 0; - _platypusSequenceId = 0x25A; + _vm->_gameSys->setAnimation(_s17_nextPhoneSequenceId, 254, 1); + _vm->_gameSys->insertSequence(_s17_nextPhoneSequenceId, 254, _s17_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x25A; _s17_currPhoneSequenceId = _s17_nextPhoneSequenceId; } break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { switch (_s17_nextWrenchSequenceId) { case 0x233: - _gnapActionStatus = -1; - _gameSys->insertSequence(0x243, _platypusId, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x243, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; - _platypusSequenceId = 0x243; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x243, _platypusId, 1); + _vm->_platypusSequenceId = 0x243; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x243, _vm->_platypusId, 1); break; case 0x234: - _gnapActionStatus = -1; - _gameSys->insertSequence(0x242, _platypusId, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x242, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; - _platypusSequenceId = 0x242; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x242, _platypusId, 1); + _vm->_platypusSequenceId = 0x242; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x242, _vm->_platypusId, 1); break; case 0x231: - if (getRandom(2) != 0) + if (_vm->getRandom(2) != 0) _s17_nextCarWindowSequenceId = 0x245; else _s17_nextCarWindowSequenceId = 0x248; - _gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 2); break; case 0x232: _s17_nextCarWindowSequenceId = 0x247; - _gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 2); break; case 0x22E: case 0x235: if (_s17_nextWrenchSequenceId == 0x235) - _hotspots[kHSWrench]._flags &= ~SF_DISABLED; + _vm->_hotspots[kHSWrench]._flags &= ~SF_DISABLED; else - _hotspots[kHSWrench]._flags |= SF_DISABLED; + _vm->_hotspots[kHSWrench]._flags |= SF_DISABLED; _s17_canTryGetWrench = !_s17_canTryGetWrench; - _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; break; case 0x230: - if (_gnapActionStatus == kASGetWrenchGnapReady) { - _gameSys->setAnimation(0, 0, 2); + if (_vm->_gnapActionStatus == kASGetWrenchGnapReady) { + _vm->_gameSys->setAnimation(0, 0, 2); if (_s17_canTryGetWrench) { - _gameSys->insertSequence(0x22E, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x22E, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = 0x22E; _s17_canTryGetWrench = false; } - _gameSys->setAnimation(0x23F, _platypusId, 1); - _gameSys->insertSequence(0x10875, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x23F, _platypusId, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, + _vm->_gameSys->setAnimation(0x23F, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23F, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 1; - _platypusSequenceDatNum = 0; - _gnapSequenceId = 0x875; - _platypusSequenceId = 0x23F; - gnapWalkTo(3, 8, -1, 0x107B9, 1); - _platypusActionStatus = kASGetWrench2; + _vm->_gnapSequenceDatNum = 1; + _vm->_platypusSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x875; + _vm->_platypusSequenceId = 0x23F; + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->_platypusActionStatus = kASGetWrench2; } break; default: if (_s17_nextWrenchSequenceId != -1) { - _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; } @@ -782,60 +789,60 @@ void GnapEngine::scene17_updateAnimations() { } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_s17_nextCarWindowSequenceId) { case 0x246: - _gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); - _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; _s17_nextCarWindowSequenceId = -1; break; case 0x245: case 0x247: case 0x248: - _gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(2) != 2) - scene17_update(); - _gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); - _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(2) != 2) + update(); + _vm->_gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; _s17_nextCarWindowSequenceId = -1; _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; _s17_nextWrenchSequenceId = -1; break; case 0x249: - _gameSys->setAnimation(0x230, 40, 2); - _gameSys->setAnimation(0x240, _platypusId, 1); - _gameSys->insertSequence(0x230, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x240, _platypusId, _platypusSequenceId, _platypusId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x23E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x23E; - _gnapSequenceDatNum = 0; - _platypusSequenceId = 0x240; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0x24A, 40, 3); - _gameSys->insertSequence(0x24A, 40, _s17_nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(2) != 2) { - scene17_update(); - if (_gameSys->getAnimationStatus(3) == 2) { - _gameSys->setAnimation(0x24A, 40, 3); - _gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x230, 40, 2); + _vm->_gameSys->setAnimation(0x240, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x230, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x23E; + _vm->_gnapSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x240; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x24A, 40, 3); + _vm->_gameSys->insertSequence(0x24A, 40, _s17_nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(2) != 2) { + update(); + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0x24A, 40, 3); + _vm->_gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); } } - _gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x24B, 40, 3); - _gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x24B, 40, 3); + _vm->_gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); _s17_currCarWindowSequenceId = 0x24B; _s17_nextCarWindowSequenceId = -1; _s17_currWrenchSequenceId = 0x22D; _s17_nextWrenchSequenceId = -1; - setFlag(kGFGrassTaken); - _gnapActionStatus = -1; - _platypusActionStatus = 2; - scene17_updateHotspots(); - _timers[5] = getRandom(30) + 80; + _vm->setFlag(kGFGrassTaken); + _vm->_gnapActionStatus = -1; + _vm->_platypusActionStatus = 2; + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(30) + 80; break; } } diff --git a/engines/gnap/scenes/scene17.h b/engines/gnap/scenes/scene17.h new file mode 100644 index 0000000000..108ef952b2 --- /dev/null +++ b/engines/gnap/scenes/scene17.h @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE17_H +#define GNAP_SCENE17_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene17: public Scene { +public: + Scene17(GnapEngine *vm); + ~Scene17() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _s17_canTryGetWrench; + int _s17_wrenchCtr; + int _s17_platPhoneCtr; + int _s17_platTryGetWrenchCtr; + int _s17_nextPhoneSequenceId; + int _s17_currPhoneSequenceId; + int _s17_nextWrenchSequenceId; + int _s17_currWrenchSequenceId; + int _s17_nextCarWindowSequenceId; + int _s17_currCarWindowSequenceId; + + void update(); + void platHangUpPhone(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE15_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 2f93098ebc..68370e25eb 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -42,6 +42,7 @@ #include "gnap/scenes/scene14.h" #include "gnap/scenes/scene15.h" #include "gnap/scenes/scene16.h" +#include "gnap/scenes/scene17.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -168,8 +169,9 @@ int GnapEngine::initSceneLogic() { _gameSys->setScaleValues(0, 500, 1, 1000); break; case 17: - backgroundId = scene17_init(); - scene17_updateHotspots(); + _scene = new Scene17(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -490,7 +492,8 @@ void GnapEngine::runSceneLogic() { delete _scene; break; case 17: - scene17_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From c8f4fce89551cc1332f65ebce2cc02e75d74c332 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 00:43:48 +0200 Subject: GNAP: Refactor scene 18 --- engines/gnap/gnap.cpp | 4 - engines/gnap/gnap.h | 13 - engines/gnap/scenes/scene17.h | 2 +- engines/gnap/scenes/scene18.cpp | 1221 +++++++++++++++++++------------------ engines/gnap/scenes/scene18.h | 60 ++ engines/gnap/scenes/scenecore.cpp | 9 +- 6 files changed, 683 insertions(+), 626 deletions(-) create mode 100644 engines/gnap/scenes/scene18.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e002bb5ec4..82035ebef8 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2020,10 +2020,6 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { void GnapEngine::initGlobalSceneVars() { // Scene 18 _s18_garbageCanPos = 8; - _s18_platPhoneCtr = 0; - _s18_platPhoneIter = 0; - _s18_nextPhoneSequenceId = -1; - _s18_currPhoneSequenceId = -1; // Scene 19 _s19_toyGrabCtr = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 0fa110b383..7d8edd3697 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -605,19 +605,6 @@ public: // Scene 18 int _s18_garbageCanPos; - int _s18_platPhoneCtr; - int _s18_platPhoneIter; - int _s18_nextPhoneSequenceId, _s18_currPhoneSequenceId; - Graphics::Surface *_s18_cowboyHatSurface; - int scene18_init(); - void scene18_updateHotspots(); - void scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5); - void scene18_putDownGarbageCan(int animationIndex); - void scene18_platEndPhoning(bool platFl); - void scene18_closeHydrantValve(); - void scene18_waitForGnapAction(); - void scene18_run(); - void scene18_updateAnimations(); // Scene 19 int _s19_currShopAssistantSequenceId, _s19_nextShopAssistantSequenceId; diff --git a/engines/gnap/scenes/scene17.h b/engines/gnap/scenes/scene17.h index 108ef952b2..a653cca5e7 100644 --- a/engines/gnap/scenes/scene17.h +++ b/engines/gnap/scenes/scene17.h @@ -58,4 +58,4 @@ private: }; } // End of namespace Gnap -#endif // GNAP_SCENE15_H +#endif // GNAP_SCENE17_H diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index c88f7b28f5..0e17531c91 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene18.h" namespace Gnap { @@ -68,64 +69,77 @@ enum { kASLeaveScene = 20 }; -int GnapEngine::scene18_init() { - _gameSys->setAnimation(0, 0, 3); +Scene18::Scene18(GnapEngine *vm) : Scene(vm) { + _s18_cowboyHatSurface = nullptr; + + _s18_platPhoneCtr = 0; + _s18_platPhoneIter = 0; + _s18_nextPhoneSequenceId = -1; + _s18_currPhoneSequenceId = -1; +} + +Scene18::~Scene18() { + delete _s18_cowboyHatSurface; +} + +int Scene18::init() { + _vm->_gameSys->setAnimation(0, 0, 3); return 0x222; } -void GnapEngine::scene18_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSGarbageCan, _gridMinX + 75 * _s18_garbageCanPos - 35, _gridMinY + 230, _gridMinX + 75 * _s18_garbageCanPos + 35, _gridMinY + 318, - SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, _s18_garbageCanPos, 7); - setHotspot(kHSExitToyStore, 460, 238, 592, 442, SF_EXIT_U_CURSOR, 7, 7); - setHotspot(kHSExitPhoneBooth, 275, 585, 525, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - setHotspot(kHSExitGrubCity, 0, 350, 15, 600, SF_EXIT_L_CURSOR, 0, 9); - setHotspot(kHSHydrantTopValve, 100, 345, 182, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 8); - setHotspot(kHSHydrantRightValve, 168, 423, 224, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - setHotspot(kHSCowboyHat, 184, 63, 289, 171, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - setHotspot(kHSWalkArea1, 0, 0, 800, 448); - setHotspot(kHSWalkArea2, 0, 0, 214, 515); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFTruckFilledWithGas)) { - if (isFlag(kGFTruckKeysUsed)) { - _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; - _hotspots[kHSHydrantRightValve]._x1 = 148; - _hotspots[kHSHydrantRightValve]._y1 = 403; - _hotspots[kHSGarbageCan]._flags = SF_DISABLED; - _hotspotsWalkPos[kHSGarbageCan].x = 3; - _hotspotsWalkPos[kHSGarbageCan].y = 7; +void Scene18::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSGarbageCan, _vm->_gridMinX + 75 * _vm->_s18_garbageCanPos - 35, _vm->_gridMinY + 230, _vm->_gridMinX + 75 * _vm->_s18_garbageCanPos + 35, _vm->_gridMinY + 318, + SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, _vm->_s18_garbageCanPos, 7); + _vm->setHotspot(kHSExitToyStore, 460, 238, 592, 442, SF_EXIT_U_CURSOR, 7, 7); + _vm->setHotspot(kHSExitPhoneBooth, 275, 585, 525, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHSExitGrubCity, 0, 350, 15, 600, SF_EXIT_L_CURSOR, 0, 9); + _vm->setHotspot(kHSHydrantTopValve, 100, 345, 182, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 8); + _vm->setHotspot(kHSHydrantRightValve, 168, 423, 224, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHSCowboyHat, 184, 63, 289, 171, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 448); + _vm->setHotspot(kHSWalkArea2, 0, 0, 214, 515); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFTruckFilledWithGas)) { + if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; + _vm->_hotspots[kHSHydrantRightValve]._x1 = 148; + _vm->_hotspots[kHSHydrantRightValve]._y1 = 403; + _vm->_hotspots[kHSGarbageCan]._flags = SF_DISABLED; + _vm->_hotspotsWalkPos[kHSGarbageCan].x = 3; + _vm->_hotspotsWalkPos[kHSGarbageCan].y = 7; } else { - _hotspots[kHSHydrantTopValve]._y1 = 246; + _vm->_hotspots[kHSHydrantTopValve]._y1 = 246; } - } else if (isFlag(kGFBarnPadlockOpen)) { - _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; - _hotspots[kHSHydrantTopValve]._x1 = 105; - _hotspots[kHSHydrantTopValve]._x2 = 192; - } else if (isFlag(kGFTruckKeysUsed)) { - _hotspots[kHSGarbageCan]._x1 = 115; - _hotspots[kHSGarbageCan]._y1 = 365; - _hotspots[kHSGarbageCan]._x2 = 168; - _hotspots[kHSGarbageCan]._y2 = 470; - _hotspots[kHSGarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _hotspotsWalkPos[kHSGarbageCan].x = 3; - _hotspotsWalkPos[kHSGarbageCan].y = 7; + } else if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; + _vm->_hotspots[kHSHydrantTopValve]._x1 = 105; + _vm->_hotspots[kHSHydrantTopValve]._x2 = 192; + } else if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_hotspots[kHSGarbageCan]._x1 = 115; + _vm->_hotspots[kHSGarbageCan]._y1 = 365; + _vm->_hotspots[kHSGarbageCan]._x2 = 168; + _vm->_hotspots[kHSGarbageCan]._y2 = 470; + _vm->_hotspots[kHSGarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsWalkPos[kHSGarbageCan].x = 3; + _vm->_hotspotsWalkPos[kHSGarbageCan].y = 7; } - if (isFlag(kGFPlatyPussDisguised)) - _hotspots[kHSGarbageCan]._flags = SF_DISABLED; - if (isFlag(kGFPlatypusTalkingToAssistant)) { - _hotspots[kHSDevice]._flags = SF_DISABLED; - _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; - _hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; - _hotspots[kHSPlatypus]._flags = SF_DISABLED; + if (_vm->isFlag(kGFPlatyPussDisguised)) + _vm->_hotspots[kHSGarbageCan]._flags = SF_DISABLED; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHSDevice]._flags = SF_DISABLED; + _vm->_hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; + _vm->_hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; + _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; } - if (isFlag(kGFUnk14)) { - _hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; - _hotspots[kHSCowboyHat]._flags = SF_DISABLED; + if (_vm->isFlag(kGFUnk14)) { + _vm->_hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; + _vm->_hotspots[kHSCowboyHat]._flags = SF_DISABLED; } - _hotspotsCount = 11; + _vm->_hotspotsCount = 11; } -void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { +void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { // CHECKME: (x, y) is always set to (-1, -1) // TODO Cleanup @@ -139,8 +153,8 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, if (x >= 0) clippedX = x; else - clippedX = (_leftClickMouseX - _gridMinX + 37) / 75; - if (clippedX >= _gnapX) + clippedX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; + if (clippedX >= _vm->_gnapX) v10 = clippedX - 1; else v10 = clippedX + 1; @@ -151,46 +165,46 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, if (v10 <= a5) v5 = a5; v11 = v5; - v12 = _gridMaxX - 1; - if (_gridMaxX - 1 >= v11) + v12 = _vm->_gridMaxX - 1; + if (_vm->_gridMaxX - 1 >= v11) v12 = v11; - if (v12 == _gnapX) { - gnapSeqId = _gnapSequenceId; - gnapId = _gnapId; - gnapDatNum = _gnapSequenceDatNum; - gnapGridX = _gnapX; - if (_gnapX <= clippedX) + if (v12 == _vm->_gnapX) { + gnapSeqId = _vm->_gnapSequenceId; + gnapId = _vm->_gnapId; + gnapDatNum = _vm->_gnapSequenceDatNum; + gnapGridX = _vm->_gnapX; + if (_vm->_gnapX <= clippedX) direction = 1; else direction = -1; } else { - if (_gnapY == _platY) { - if (v12 >= _gnapX) { - if (v12 >= _platX && _gnapX <= _platX) - platypusMakeRoom(); - } else if (v12 <= _platX && _gnapX >= _platX) { - platypusMakeRoom(); + if (_vm->_gnapY == _vm->_platY) { + if (v12 >= _vm->_gnapX) { + if (v12 >= _vm->_platX && _vm->_gnapX <= _vm->_platX) + _vm->platypusMakeRoom(); + } else if (v12 <= _vm->_platX && _vm->_gnapX >= _vm->_platX) { + _vm->platypusMakeRoom(); } } - gnapSeqId = _gnapSequenceId; - gnapId = _gnapId; - gnapDatNum = _gnapSequenceDatNum; - gnapGridX = _gnapX; + gnapSeqId = _vm->_gnapSequenceId; + gnapId = _vm->_gnapId; + gnapDatNum = _vm->_gnapSequenceDatNum; + gnapGridX = _vm->_gnapX; int seqId = 0; - if (v12 < _gnapX) { + if (v12 < _vm->_gnapX) { direction = -1; seqId = 1; } else direction = 1; - int a2 = 20 * _gnapY + 1; + int a2 = 20 * _vm->_gnapY + 1; do { - if (isPointBlocked(gnapGridX + direction, _gnapY)) + if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnapY)) break; a2 += direction; - _gameSys->insertSequence(kSequenceIds[seqId], a2, + _vm->_gameSys->insertSequence(kSequenceIds[seqId], a2, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqSyncWait, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); gnapSeqId = kSequenceIds[seqId]; gnapId = a2; gnapDatNum = 0; @@ -199,246 +213,245 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, } if (argC >= 0) { - _gnapSequenceId = ridToEntryIndex(argC); - _gnapSequenceDatNum = ridToDatIndex(argC); + _vm->_gnapSequenceId = ridToEntryIndex(argC); + _vm->_gnapSequenceDatNum = ridToDatIndex(argC); } else { if (direction == 1) - _gnapSequenceId = 0x20A; + _vm->_gnapSequenceId = 0x20A; else - _gnapSequenceId = 0x209; - _gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x209; + _vm->_gnapSequenceDatNum = 0; } if (direction == 1) - _gnapIdleFacing = kDirBottomRight; + _vm->_gnapIdleFacing = kDirBottomRight; else - _gnapIdleFacing = kDirBottomLeft; + _vm->_gnapIdleFacing = kDirBottomLeft; - _gnapId = 20 * _gnapY + 1; + _vm->_gnapId = 20 * _vm->_gnapY + 1; if (animationIndex >= 0) - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); - _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _gnapX = gnapGridX; + _vm->_gnapX = gnapGridX; } -void GnapEngine::scene18_putDownGarbageCan(int animationIndex) { +void Scene18::putDownGarbageCan(int animationIndex) { if (animationIndex >= 0) { - while (_gameSys->getAnimationStatus(animationIndex) != 2) - gameUpdateTick(); + while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) + _vm->gameUpdateTick(); } - if (_gnapIdleFacing != kDirNone && _gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) - _s18_garbageCanPos = _gnapX - 1; + if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) + _vm->_s18_garbageCanPos = _vm->_gnapX - 1; else - _s18_garbageCanPos = _gnapX + 1; - clearFlag(kGFPlatyPussDisguised); - scene18_updateHotspots(); - if (_gnapIdleFacing != kDirNone && _gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { - _gameSys->insertSequence(0x107BA, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7BA; + _vm->_s18_garbageCanPos = _vm->_gnapX + 1; + _vm->clearFlag(kGFPlatyPussDisguised); + updateHotspots(); + if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) { + _vm->_gameSys->insertSequence(0x107BA, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7BA; } else { - _gameSys->insertSequence(0x107B9, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B9; + _vm->_gameSys->insertSequence(0x107B9, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B9; } - _gnapSequenceDatNum = 1; - _gameSys->insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _s18_garbageCanPos - 40), 0); - _gameSys->setAnimation(0x1FA, 19, 4); - _gameSys->insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _s18_garbageCanPos - 40), 0); - while (_gameSys->getAnimationStatus(4) != 2) - gameUpdateTick(); + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18_garbageCanPos - 40), 0); + _vm->_gameSys->setAnimation(0x1FA, 19, 4); + _vm->_gameSys->insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18_garbageCanPos - 40), 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) + _vm->gameUpdateTick(); } -void GnapEngine::scene18_platEndPhoning(bool platFl) { - if (isFlag(kGFPlatypusTalkingToAssistant)) { +void Scene18::platEndPhoning(bool platFl) { + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _s18_platPhoneIter = 0; _s18_platPhoneCtr = 0; - _platypusActionStatus = -1; + _vm->_platypusActionStatus = -1; if (_s18_currPhoneSequenceId != -1) { - _gameSys->setAnimation(0x21E, 254, 3); - _gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_gameSys->getAnimationStatus(3) != 2) - gameUpdateTick(); + _vm->_gameSys->setAnimation(0x21E, 254, 3); + _vm->_gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(3) != 2) + _vm->gameUpdateTick(); } - _gameSys->removeSequence(0x21F, 254, true); - _gameSys->setAnimation(0, 0, 3); - clearFlag(kGFPlatypusTalkingToAssistant); + _vm->_gameSys->removeSequence(0x21F, 254, true); + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); if (platFl) { - _platypusActionStatus = kASPlatComesHere; - _timers[6] = 50; - _sceneWaiting = true; + _vm->_platypusActionStatus = kASPlatComesHere; + _vm->_timers[6] = 50; + _vm->_sceneWaiting = true; } _s18_currPhoneSequenceId = -1; _s18_nextPhoneSequenceId = -1; - scene18_updateHotspots(); + updateHotspots(); } } -void GnapEngine::scene18_closeHydrantValve() { - _gnapActionStatus = kASLeaveScene; - updateMouseCursor(); - if (isFlag(kGFTruckFilledWithGas)) { - gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - if (isFlag(kGFTruckKeysUsed)) { - _gnapActionStatus = kASCloseRightValveWithGarbageCan; - scene18_waitForGnapAction(); +void Scene18::closeHydrantValve() { + _vm->_gnapActionStatus = kASLeaveScene; + _vm->updateMouseCursor(); + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); + if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gnapActionStatus = kASCloseRightValveWithGarbageCan; + waitForGnapAction(); } else { - _gnapActionStatus = kASCloseRightValveNoGarbageCan; - scene18_waitForGnapAction(); + _vm->_gnapActionStatus = kASCloseRightValveNoGarbageCan; + waitForGnapAction(); } - } else if (isFlag(kGFBarnPadlockOpen)) { - gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); - _gnapActionStatus = kASCloseTopValve; - scene18_waitForGnapAction(); + } else if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); + _vm->_gnapActionStatus = kASCloseTopValve; + waitForGnapAction(); } } -void GnapEngine::scene18_waitForGnapAction() { - while (_gnapActionStatus >= 0) { - scene18_updateAnimations(); - gameUpdateTick(); +void Scene18::waitForGnapAction() { + while (_vm->_gnapActionStatus >= 0) { + updateAnimations(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene18_run() { +void Scene18::run() { _s18_cowboyHatSurface = nullptr; - playSound(0x10940, true); - startSoundTimerA(4); + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(4); - _timers[5] = getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(100) + 100; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - clearFlag(kGFPlatyPussDisguised); + _vm->clearFlag(kGFPlatyPussDisguised); - if (!isFlag(kGFUnk14)) - _gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); - - if (isFlag(kGFTruckKeysUsed)) { - if (isFlag(kGFTruckFilledWithGas)) { - _gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); - playSound(0x22B, true); + if (!_vm->isFlag(kGFUnk14)) + _vm->_gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFTruckKeysUsed)) { + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->_gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->playSound(0x22B, true); } else { - _gameSys->insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); } } else { - _gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _s18_garbageCanPos - 40), 0); - if (isFlag(kGFTruckFilledWithGas)) { - _gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); - playSound(0x22B, true); - } else if (isFlag(kGFBarnPadlockOpen)) { - _gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); - playSound(0x22B, true); + _vm->_gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18_garbageCanPos - 40), 0); + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->_gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->playSound(0x22B, true); + } else if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->playSound(0x22B, true); } } - if (isFlag(kGFPlatypusTalkingToAssistant)) { - if (_prevSceneNum == 17) - initGnapPos(4, 11, kDirBottomRight); + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + if (_vm->_prevSceneNum == 17) + _vm->initGnapPos(4, 11, kDirBottomRight); else - initGnapPos(4, 7, kDirBottomRight); - _s18_platPhoneCtr = getRandom(5); - if (isFlag(kGFUnk27)) { - _gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->initGnapPos(4, 7, kDirBottomRight); + _s18_platPhoneCtr = _vm->getRandom(5); + if (_vm->isFlag(kGFUnk27)) { + _vm->_gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); _s18_currPhoneSequenceId = -1; - scene18_platEndPhoning(true); - clearFlag(kGFUnk27); + platEndPhoning(true); + _vm->clearFlag(kGFUnk27); } else { _s18_currPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr]; _s18_platPhoneIter = 0; - _gameSys->insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(_s18_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->_gameSys->insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s18_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); } - if (isFlag(kGFUnk27)) { - scene18_platEndPhoning(true); - clearFlag(kGFUnk27); + if (_vm->isFlag(kGFUnk27)) { + platEndPhoning(true); + _vm->clearFlag(kGFUnk27); } else { - _gameSys->setAnimation(_s18_currPhoneSequenceId, 254, 3); + _vm->_gameSys->setAnimation(_s18_currPhoneSequenceId, 254, 3); } - gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { - if (isFlag(kGFGnapControlsToyUFO)) { - clearFlag(kGFGnapControlsToyUFO); - setGrabCursorSprite(kItemCowboyHat); - _prevSceneNum = 19; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->clearFlag(kGFGnapControlsToyUFO); + _vm->setGrabCursorSprite(kItemCowboyHat); + _vm->_prevSceneNum = 19; } - if (_prevSceneNum == 17) { - initGnapPos(4, 11, kDirBottomRight); - initPlatypusPos(5, 11, kDirNone); - endSceneInit(); - gnapWalkTo(4, 8, -1, 0x107B9, 1); - platypusWalkTo(5, 9, -1, 0x107C2, 1); - } else if (_prevSceneNum == 19) { - initGnapPos(7, 7, kDirBottomRight); - initPlatypusPos(8, 7, kDirNone); - endSceneInit(); - gnapWalkTo(7, 8, -1, 0x107B9, 1); - platypusWalkTo(8, 8, -1, 0x107C2, 1); + if (_vm->_prevSceneNum == 17) { + _vm->initGnapPos(4, 11, kDirBottomRight); + _vm->initPlatypusPos(5, 11, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + } else if (_vm->_prevSceneNum == 19) { + _vm->initGnapPos(7, 7, kDirBottomRight); + _vm->initPlatypusPos(8, 7, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { - initGnapPos(-1, 10, kDirBottomRight); - initPlatypusPos(-1, 10, kDirNone); - endSceneInit(); - gnapWalkTo(3, 7, -1, 0x107B9, 1); - platypusWalkTo(3, 8, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 10, kDirBottomRight); + _vm->initPlatypusPos(-1, 10, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); } } - while (!_sceneDone) { - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 20, -1, -1, -1, -1); + _vm->testWalk(0, 20, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene18_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, _platX, _platY); + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -446,27 +459,27 @@ void GnapEngine::scene18_run() { break; case kHSCowboyHat: - if (_gnapActionStatus == kASStandingOnHydrant) { - _gnapActionStatus = kASGrabCowboyHat; - _sceneWaiting = 0; - } else if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->_gnapActionStatus == kASStandingOnHydrant) { + _vm->_gnapActionStatus = kASGrabCowboyHat; + _vm->_sceneWaiting = 0; + } else if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSCowboyHat].x, _hotspotsWalkPos[kHSCowboyHat].y, 3, 2); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCowboyHat].x, _vm->_hotspotsWalkPos[kHSCowboyHat].y, 3, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(3, 2); + _vm->playGnapScratchingHead(3, 2); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[kHSCowboyHat].x, _hotspotsWalkPos[kHSCowboyHat].y, 0, getGnapSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCowboyHat].x, _vm->_hotspotsWalkPos[kHSCowboyHat].y, 0, _vm->getGnapSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -474,43 +487,43 @@ void GnapEngine::scene18_run() { break; case kHSGarbageCan: - if (_gnapActionStatus < 0) { - if (isFlag(kGFUnk14)) { - if (_grabCursorSpriteIndex >= 0) - playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 1, 5); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk14)) { + if (_vm->_grabCursorSpriteIndex >= 0) + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y, 1, 5); else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); } else { - if (isFlag(kGFPlatypusTalkingToAssistant)) - scene18_platEndPhoning(true); - if (_grabCursorSpriteIndex >= 0) { - if (!isFlag(kGFTruckKeysUsed)) - playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), - _hotspotsWalkPos[kHSGarbageCan].y, _hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y); + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + platEndPhoning(true); + if (_vm->_grabCursorSpriteIndex >= 0) { + if (!_vm->isFlag(kGFTruckKeysUsed)) + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGarbageCan].x - (_vm->_gnapX < _vm->_s18_garbageCanPos ? 1 : -1), + _vm->_hotspotsWalkPos[kHSGarbageCan].y, _vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y); else - playGnapShowCurrItem(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 2, 4); + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y, 2, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (!isFlag(kGFTruckKeysUsed)) - playGnapScratchingHead(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), _hotspotsWalkPos[kHSGarbageCan].y); - else if (!isFlag(kGFTruckFilledWithGas)) - playGnapScratchingHead(2, 4); + if (!_vm->isFlag(kGFTruckKeysUsed)) + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHSGarbageCan].x - (_vm->_gnapX < _vm->_s18_garbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHSGarbageCan].y); + else if (!_vm->isFlag(kGFTruckFilledWithGas)) + _vm->playGnapScratchingHead(2, 4); break; case GRAB_CURSOR: - if (!isFlag(kGFTruckKeysUsed)) { - gnapWalkTo(_hotspotsWalkPos[kHSGarbageCan].x - (_gnapX < _s18_garbageCanPos ? 1 : -1), _hotspotsWalkPos[kHSGarbageCan].y, + if (!_vm->isFlag(kGFTruckKeysUsed)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGarbageCan].x - (_vm->_gnapX < _vm->_s18_garbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHSGarbageCan].y, -1, -1, 1); - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _s18_garbageCanPos, _gnapY) | 0x10000, 1); - _gnapActionStatus = kASGrabGarbageCanFromStreet; - } else if (!isFlag(kGFTruckFilledWithGas)) { - if (gnapWalkTo(_hotspotsWalkPos[kHSGarbageCan].x, _hotspotsWalkPos[kHSGarbageCan].y, 0, -1, 1)) - _gnapActionStatus = kASGrabGarbageCanFromHydrant; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_s18_garbageCanPos, _vm->_gnapY) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabGarbageCanFromStreet; + } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y, 0, -1, 1)) + _vm->_gnapActionStatus = kASGrabGarbageCanFromHydrant; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -519,64 +532,64 @@ void GnapEngine::scene18_run() { break; case kHSHydrantTopValve: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatyPussDisguised)) { + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { // While carrying garbage can - if (_grabCursorSpriteIndex >= 0) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); - playGnapShowItem(_grabCursorSpriteIndex, 0, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); - playGnapScratchingHead(0, 0); + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (isFlag(kGFTruckFilledWithGas)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); - _gnapActionStatus = kASPutGarbageCanOnRunningHydrant; - } else if (!isFlag(kGFBarnPadlockOpen)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); - _gnapActionStatus = kASPutGarbageCanOnHydrant; + if (_vm->isFlag(kGFTruckFilledWithGas)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + _vm->_gnapActionStatus = kASPutGarbageCanOnRunningHydrant; + } else if (!_vm->isFlag(kGFBarnPadlockOpen)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + _vm->_gnapActionStatus = kASPutGarbageCanOnHydrant; } else { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); - playGnapImpossible(0, 0); + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapImpossible(0, 0); } break; case TALK_CURSOR: case PLAT_CURSOR: - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); - playGnapImpossible(0, 0); + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapImpossible(0, 0); break; } } } else { - if (_grabCursorSpriteIndex == kItemWrench) { - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); - _gnapActionStatus = kASOpenTopValve; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 1, 5); + if (_vm->_grabCursorSpriteIndex == kItemWrench) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->_gnapActionStatus = kASOpenTopValve; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 1, 5); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 5); + _vm->playGnapScratchingHead(1, 5); break; case GRAB_CURSOR: - if (isFlag(kGFBarnPadlockOpen)) { - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASCloseTopValve; + if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASCloseTopValve; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -585,43 +598,43 @@ void GnapEngine::scene18_run() { break; case kHSHydrantRightValve: - if (_gnapActionStatus < 0) { - if (isFlag(kGFUnk14)) { - if (_grabCursorSpriteIndex == -1) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk14)) { + if (_vm->_grabCursorSpriteIndex == -1) { + _vm->playGnapImpossible(0, 0); } else { - playGnapShowCurrItem(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); } } else { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } - if (_grabCursorSpriteIndex == kItemWrench) { - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); - if (isFlag(kGFTruckKeysUsed)) - _gnapActionStatus = kASOpenRightValveWithGarbageCan; + if (_vm->_grabCursorSpriteIndex == kItemWrench) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + if (_vm->isFlag(kGFTruckKeysUsed)) + _vm->_gnapActionStatus = kASOpenRightValveWithGarbageCan; else - _gnapActionStatus = kASOpenRightValveNoGarbageCan; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); + _vm->_gnapActionStatus = kASOpenRightValveNoGarbageCan; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 5); + _vm->playGnapScratchingHead(1, 5); break; case GRAB_CURSOR: - if (isFlag(kGFTruckFilledWithGas)) { - gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - if (isFlag(kGFTruckKeysUsed)) - _gnapActionStatus = kASCloseRightValveWithGarbageCan; + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); + if (_vm->isFlag(kGFTruckKeysUsed)) + _vm->_gnapActionStatus = kASCloseRightValveWithGarbageCan; else - _gnapActionStatus = kASCloseRightValveNoGarbageCan; + _vm->_gnapActionStatus = kASCloseRightValveNoGarbageCan; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -630,388 +643,386 @@ void GnapEngine::scene18_run() { break; case kHSExitToyStore: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } - if (isFlag(kGFPictureTaken)) { - playGnapImpossible(0, 0); + if (_vm->isFlag(kGFPictureTaken)) { + _vm->playGnapImpossible(0, 0); } else { - _isLeavingScene = true; - _newSceneNum = 19; - gnapWalkTo(_hotspotsWalkPos[kHSExitToyStore].x, _hotspotsWalkPos[kHSExitToyStore].y, 0, 0x107C0, 1); - _gnapActionStatus = kASLeaveScene; - if (!isFlag(kGFPlatypusTalkingToAssistant)) - platypusWalkTo(_hotspotsWalkPos[kHSExitToyStore].x + 1, _hotspotsWalkPos[kHSExitToyStore].y, -1, 0x107C2, 1); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 19; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStore].x, _vm->_hotspotsWalkPos[kHSExitToyStore].y, 0, 0x107C0, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStore].x + 1, _vm->_hotspotsWalkPos[kHSExitToyStore].y, -1, 0x107C2, 1); } } break; case kHSExitPhoneBooth: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } - scene18_closeHydrantValve(); - _isLeavingScene = true; - _newSceneNum = 17; - gnapWalkTo(_hotspotsWalkPos[kHSExitPhoneBooth].x, _hotspotsWalkPos[kHSExitPhoneBooth].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypusTalkingToAssistant)) - setFlag(kGFUnk27); + closeHydrantValve(); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 17; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPhoneBooth].x, _vm->_hotspotsWalkPos[kHSExitPhoneBooth].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _vm->setFlag(kGFUnk27); else - platypusWalkTo(_hotspotsWalkPos[kHSExitPhoneBooth].x + 1, _hotspotsWalkPos[kHSExitPhoneBooth].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPhoneBooth].x + 1, _vm->_hotspotsWalkPos[kHSExitPhoneBooth].y, -1, 0x107C2, 1); } break; case kHSExitGrubCity: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } - scene18_closeHydrantValve(); - _isLeavingScene = true; - _newSceneNum = 20; - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypusTalkingToAssistant)) - scene18_platEndPhoning(false); + closeHydrantValve(); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitGrubCity].x, _vm->_hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + platEndPhoning(false); else - platypusWalkTo(_hotspotsWalkPos[kHSExitGrubCity].x, _hotspotsWalkPos[kHSExitGrubCity].y - 1, -1, 0x107CF, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitGrubCity].x, _vm->_hotspotsWalkPos[kHSExitGrubCity].y - 1, -1, 0x107CF, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; } break; case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } - _mouseClickState._left = false; + _vm->_mouseClickState._left = false; } break; default: - if (_gnapActionStatus != kASStandingOnHydrant && _mouseClickState._left) { - if (isFlag(kGFPlatyPussDisguised)) { - scene18_gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - scene18_putDownGarbageCan(0); + if (_vm->_gnapActionStatus != kASStandingOnHydrant && _vm->_mouseClickState._left) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } - _mouseClickState._left = false; + _vm->_mouseClickState._left = false; } break; - } - scene18_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10940)) - playSound(0x10940, true); + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); - if ((isFlag(kGFTruckFilledWithGas) || isFlag(kGFBarnPadlockOpen)) && !isSoundPlaying(0x22B) && - _gnapActionStatus != kASOpenRightValveNoGarbageCanDone && _gnapActionStatus != kASOpenRightValveNoGarbageCan && - _gnapActionStatus != kASOpenTopValve && _gnapActionStatus != kASOpenTopValveDone && - _gnapActionStatus != kASOpenRightValveWithGarbageCan && _gnapActionStatus != kASOpenRightValveWithGarbageCanDone) - playSound(0x22B, true); + if ((_vm->isFlag(kGFTruckFilledWithGas) || _vm->isFlag(kGFBarnPadlockOpen)) && !_vm->isSoundPlaying(0x22B) && + _vm->_gnapActionStatus != kASOpenRightValveNoGarbageCanDone && _vm->_gnapActionStatus != kASOpenRightValveNoGarbageCan && + _vm->_gnapActionStatus != kASOpenTopValve && _vm->_gnapActionStatus != kASOpenTopValveDone && + _vm->_gnapActionStatus != kASOpenRightValveWithGarbageCan && _vm->_gnapActionStatus != kASOpenRightValveWithGarbageCanDone) + _vm->playSound(0x22B, true); - if (!_isLeavingScene) { - if (!isFlag(kGFPlatypusTalkingToAssistant)) { - if (_platypusActionStatus == kASPlatComesHere) { - if (!_timers[6]) { - _platypusActionStatus = -1; - _sceneWaiting = false; - initPlatypusPos(-1, 10, kDirNone); - platypusWalkTo(3, 9, -1, 0x107C2, 1); - clearFlag(kGFPlatypusTalkingToAssistant); + if (!_vm->_isLeavingScene) { + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + if (_vm->_platypusActionStatus == kASPlatComesHere) { + if (!_vm->_timers[6]) { + _vm->_platypusActionStatus = -1; + _vm->_sceneWaiting = false; + _vm->initPlatypusPos(-1, 10, kDirNone); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); } } else { - _hotspots[kHSWalkArea1]._y2 += 48; - _hotspots[kHSWalkArea2]._x1 += 75; - updatePlatypusIdleSequence(); - _hotspots[kHSWalkArea2]._x1 -= 75; - _hotspots[kHSWalkArea1]._y2 -= 48; + _vm->_hotspots[kHSWalkArea1]._y2 += 48; + _vm->_hotspots[kHSWalkArea2]._x1 += 75; + _vm->updatePlatypusIdleSequence(); + _vm->_hotspots[kHSWalkArea2]._x1 -= 75; + _vm->_hotspots[kHSWalkArea1]._y2 -= 48; } - if (!_timers[5]) { - _timers[5] = getRandom(100) + 100; - if (_gnapActionStatus < 0) { - if (getRandom(2) == 1) - _gameSys->insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(2) == 1) + _vm->_gameSys->insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); } } - playSoundA(); + _vm->playSoundA(); } - if (!isFlag(kGFPlatyPussDisguised)) - updateGnapIdleSequence(); + if (!_vm->isFlag(kGFPlatyPussDisguised)) + _vm->updateGnapIdleSequence(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene18_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - if (isFlag(kGFGnapControlsToyUFO)) - deleteSurface(&_s18_cowboyHatSurface); + if (_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->deleteSurface(&_s18_cowboyHatSurface); } -void GnapEngine::scene18_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene18::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASGrabGarbageCanFromStreet: - if (_gnapIdleFacing != kDirUpRight && _gnapIdleFacing != kDirBottomRight) { - _gameSys->insertSequence(0x1FC, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - 675, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x1FC; + if (_vm->_gnapIdleFacing != kDirUpRight && _vm->_gnapIdleFacing != kDirBottomRight) { + _vm->_gameSys->insertSequence(0x1FC, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - 675, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FC; } else { - _gameSys->insertSequence(0x1FD, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - 525, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x1FD; + _vm->_gameSys->insertSequence(0x1FD, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - 525, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FD; } - _gameSys->removeSequence(0x1FA, 19, true); - setFlag(kGFPlatyPussDisguised); - scene18_updateHotspots(); - _gnapActionStatus = -1; + _vm->_gameSys->removeSequence(0x1FA, 19, true); + _vm->setFlag(kGFPlatyPussDisguised); + updateHotspots(); + _vm->_gnapActionStatus = -1; break; case kASGrabGarbageCanFromHydrant: - _gameSys->insertSequence(0x1FE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x1F9, 19, true); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x1FE; - clearFlag(kGFTruckKeysUsed); - setFlag(kGFPlatyPussDisguised); - scene18_updateHotspots(); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x1F9, 19, true); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FE; + _vm->clearFlag(kGFTruckKeysUsed); + _vm->setFlag(kGFPlatyPussDisguised); + updateHotspots(); + _vm->_gnapActionStatus = -1; break; case kASCloseRightValveNoGarbageCan: - _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x20D, 39, true); - _gameSys->removeSequence(0x212, 39, true); - _gameSys->removeSequence(0x211, 39, true); - stopSound(0x22B); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x205; - clearFlag(kGFTruckFilledWithGas); - invAdd(kItemWrench); - setGrabCursorSprite(kItemWrench); - scene18_updateHotspots(); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x20D, 39, true); + _vm->_gameSys->removeSequence(0x212, 39, true); + _vm->_gameSys->removeSequence(0x211, 39, true); + _vm->stopSound(0x22B); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x205; + _vm->clearFlag(kGFTruckFilledWithGas); + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); + updateHotspots(); + _vm->_gnapActionStatus = -1; break; case kASOpenTopValve: - setFlag(kGFBarnPadlockOpen); - scene18_updateHotspots(); - playGnapPullOutDevice(2, 7); - playGnapUseDevice(0, 0); - _gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSHydrantTopValve].x, _hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BB, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASOpenTopValveDone; + _vm->setFlag(kGFBarnPadlockOpen); + updateHotspots(); + _vm->playGnapPullOutDevice(2, 7); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BB, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASOpenTopValveDone; break; case kASOpenTopValveDone: - setGrabCursorSprite(-1); - _gameSys->insertSequence(0x208, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); - _gameSys->removeSequence(0x20C, 19, true); - _gameSys->setAnimation(0x217, 39, 5); - _gameSys->insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(5) != 2) - gameUpdateTick(); - playSound(0x22B, true); - _gameSys->insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x208; - invRemove(kItemWrench); - setGrabCursorSprite(-1); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); + _vm->_gameSys->removeSequence(0x20C, 19, true); + _vm->_gameSys->setAnimation(0x217, 39, 5); + _vm->_gameSys->insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(5) != 2) + _vm->gameUpdateTick(); + _vm->playSound(0x22B, true); + _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x208; + _vm->invRemove(kItemWrench); + _vm->setGrabCursorSprite(-1); + _vm->_gnapActionStatus = -1; break; case kASCloseTopValve: - _gameSys->insertSequence(0x206, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x20E, 39, true); - _gameSys->removeSequence(0x216, 39, true); - _gameSys->removeSequence(0x217, 39, true); - stopSound(0x22B); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x206; - clearFlag(kGFBarnPadlockOpen); - invAdd(kItemWrench); - setGrabCursorSprite(kItemWrench); - scene18_updateHotspots(); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x20E, 39, true); + _vm->_gameSys->removeSequence(0x216, 39, true); + _vm->_gameSys->removeSequence(0x217, 39, true); + _vm->stopSound(0x22B); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x206; + _vm->clearFlag(kGFBarnPadlockOpen); + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); + updateHotspots(); + _vm->_gnapActionStatus = -1; break; case kASGrabCowboyHat: - _gameSys->setAnimation(0x200, _gnapId, 0); - _gameSys->insertSequence(0x200, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x200; - _gnapActionStatus = kASGrabCowboyHatDone; + _vm->_gameSys->setAnimation(0x200, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x200; + _vm->_gnapActionStatus = kASGrabCowboyHatDone; break; case kASGrabCowboyHatDone: - hideCursor(); - setGrabCursorSprite(-1); - _s18_cowboyHatSurface = addFullScreenSprite(0x1D2, 255); - _gameSys->setAnimation(0x218, 256, 0); - _gameSys->insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - _newSceneNum = 18; - invAdd(kItemCowboyHat); - invAdd(kItemWrench); - setFlag(kGFGnapControlsToyUFO); - setFlag(kGFUnk14); - clearFlag(kGFTruckFilledWithGas); - setFlag(kGFTruckKeysUsed); - setFlag(kGFUnk14); // CHECKME - Set 2 times? - scene18_updateHotspots(); - _gnapActionStatus = kASLeaveScene; + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _s18_cowboyHatSurface = _vm->addFullScreenSprite(0x1D2, 255); + _vm->_gameSys->setAnimation(0x218, 256, 0); + _vm->_gameSys->insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->_newSceneNum = 18; + _vm->invAdd(kItemCowboyHat); + _vm->invAdd(kItemWrench); + _vm->setFlag(kGFGnapControlsToyUFO); + _vm->setFlag(kGFUnk14); + _vm->clearFlag(kGFTruckFilledWithGas); + _vm->setFlag(kGFTruckKeysUsed); + _vm->setFlag(kGFUnk14); // CHECKME - Set 2 times? + updateHotspots(); + _vm->_gnapActionStatus = kASLeaveScene; break; case kASLeaveScene: - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; case kASPutGarbageCanOnRunningHydrant: - setFlag(kGFTruckKeysUsed); - clearFlag(kGFPlatyPussDisguised); - _gameSys->requestRemoveSequence(0x211, 39); - _gameSys->requestRemoveSequence(0x212, 39); - _gameSys->insertSequence(0x210, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - stopSound(0x22B); - _gameSys->setAnimation(0x210, _gnapId, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x210; - _gnapActionStatus = kASPutGarbageCanOnRunningHydrant2; + _vm->setFlag(kGFTruckKeysUsed); + _vm->clearFlag(kGFPlatyPussDisguised); + _vm->_gameSys->requestRemoveSequence(0x211, 39); + _vm->_gameSys->requestRemoveSequence(0x212, 39); + _vm->_gameSys->insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x22B); + _vm->_gameSys->setAnimation(0x210, _vm->_gnapId, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x210; + _vm->_gnapActionStatus = kASPutGarbageCanOnRunningHydrant2; break; case kASPutGarbageCanOnRunningHydrant2: - playSound(0x22B, true); - _gameSys->setAnimation(0x1FF, _gnapId, 0); - _gameSys->insertSequence(0x1FF, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x1FF; - _sceneWaiting = true; - _gnapActionStatus = kASStandingOnHydrant; + _vm->playSound(0x22B, true); + _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FF; + _vm->_sceneWaiting = true; + _vm->_gnapActionStatus = kASStandingOnHydrant; break; case kASStandingOnHydrant: - _gameSys->setAnimation(0x1FF, _gnapId, 0); - _gameSys->insertSequence(0x1FF, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); break; case kASOpenRightValveNoGarbageCan: case kASOpenRightValveWithGarbageCan: - setFlag(kGFTruckFilledWithGas); - scene18_updateHotspots(); - playGnapPullOutDevice(2, 7); - playGnapUseDevice(0, 0); - _gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSHydrantRightValve].x, _hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - if (_gnapActionStatus == kASOpenRightValveNoGarbageCan) - _gnapActionStatus = kASOpenRightValveNoGarbageCanDone; + _vm->setFlag(kGFTruckFilledWithGas); + updateHotspots(); + _vm->playGnapPullOutDevice(2, 7); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + if (_vm->_gnapActionStatus == kASOpenRightValveNoGarbageCan) + _vm->_gnapActionStatus = kASOpenRightValveNoGarbageCanDone; else - _gnapActionStatus = kASOpenRightValveWithGarbageCanDone; + _vm->_gnapActionStatus = kASOpenRightValveWithGarbageCanDone; break; case kASOpenRightValveWithGarbageCanDone: - setGrabCursorSprite(-1); - _gameSys->insertSequence(0x207, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); - _gameSys->requestRemoveSequence(0x1F9, 19); - _gameSys->removeSequence(0x20B, 19, true); - _gameSys->setAnimation(0x213, 39, 5); - _gameSys->insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(5) != 2) - gameUpdateTick(); - playSound(555, true); - _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x207; - invRemove(kItemWrench); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); + _vm->_gameSys->requestRemoveSequence(0x1F9, 19); + _vm->_gameSys->removeSequence(0x20B, 19, true); + _vm->_gameSys->setAnimation(0x213, 39, 5); + _vm->_gameSys->insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(5) != 2) + _vm->gameUpdateTick(); + _vm->playSound(555, true); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x207; + _vm->invRemove(kItemWrench); + _vm->_gnapActionStatus = -1; break; case kASOpenRightValveNoGarbageCanDone: - setGrabCursorSprite(-1); - _gameSys->insertSequence(0x207, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); - _gameSys->removeSequence(0x20B, 19, true); - _gameSys->setAnimation(0x211, 39, 5); - _gameSys->insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(5) != 2) - gameUpdateTick(); - playSound(0x22B, true); - _gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x207; - invRemove(kItemWrench); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); + _vm->_gameSys->removeSequence(0x20B, 19, true); + _vm->_gameSys->setAnimation(0x211, 39, 5); + _vm->_gameSys->insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(5) != 2) + _vm->gameUpdateTick(); + _vm->playSound(0x22B, true); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x207; + _vm->invRemove(kItemWrench); + _vm->_gnapActionStatus = -1; break; case kASCloseRightValveWithGarbageCan: - _gameSys->insertSequence(0x205, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x20D, 39, true); - _gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); - stopSound(0x22B); - _gameSys->setAnimation(0x1F9, 19, 0); - _gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); - clearFlag(kGFTruckFilledWithGas); - invAdd(kItemWrench); - setGrabCursorSprite(kItemWrench); - _gameSys->insertSequence(0x107B5, _gnapId, 517, _gnapId, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - scene18_updateHotspots(); - _gnapSequenceDatNum = 1; - _gnapSequenceId = 0x7B5; - _gnapActionStatus = kASCloseRightValveWithGarbageCanDone; + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x20D, 39, true); + _vm->_gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x22B); + _vm->_gameSys->setAnimation(0x1F9, 19, 0); + _vm->_gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); + _vm->clearFlag(kGFTruckFilledWithGas); + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + updateHotspots(); + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapActionStatus = kASCloseRightValveWithGarbageCanDone; break; case kASCloseRightValveWithGarbageCanDone: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASPutGarbageCanOnHydrant: - setFlag(kGFTruckKeysUsed); - clearFlag(kGFPlatyPussDisguised); - _gameSys->insertSequence(0x20F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x20F, _gnapId, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x20F; - _gnapActionStatus = kASPutGarbageCanOnHydrantDone; + _vm->setFlag(kGFTruckKeysUsed); + _vm->clearFlag(kGFPlatyPussDisguised); + _vm->_gameSys->insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20F, _vm->_gnapId, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x20F; + _vm->_gnapActionStatus = kASPutGarbageCanOnHydrantDone; break; case kASPutGarbageCanOnHydrantDone: - _gameSys->insertSequence(0x1F9, 19, 0x20F, _gnapId, kSeqNone, 0, 0, 0); - scene18_updateHotspots(); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); + updateHotspots(); + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { - _gameSys->setAnimation(0, 0, 3); + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0, 0, 3); ++_s18_platPhoneIter; if (_s18_platPhoneIter <= 4) { ++_s18_platPhoneCtr; _s18_nextPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr % 5]; - _gameSys->setAnimation(_s18_nextPhoneSequenceId, 254, 3); - _gameSys->insertSequence(_s18_nextPhoneSequenceId, 254, _s18_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s18_nextPhoneSequenceId, 254, 3); + _vm->_gameSys->insertSequence(_s18_nextPhoneSequenceId, 254, _s18_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); _s18_currPhoneSequenceId = _s18_nextPhoneSequenceId; } else { - scene18_platEndPhoning(true); + platEndPhoning(true); } } } diff --git a/engines/gnap/scenes/scene18.h b/engines/gnap/scenes/scene18.h new file mode 100644 index 0000000000..163a8cd751 --- /dev/null +++ b/engines/gnap/scenes/scene18.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE18_H +#define GNAP_SCENE18_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene18: public Scene { +public: + Scene18(GnapEngine *vm); + ~Scene18(); + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + Graphics::Surface *_s18_cowboyHatSurface; + + int _s18_platPhoneCtr; + int _s18_platPhoneIter; + int _s18_nextPhoneSequenceId; + int _s18_currPhoneSequenceId; + + void gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5); + void putDownGarbageCan(int animationIndex); + void platEndPhoning(bool platFl); + void closeHydrantValve(); + void waitForGnapAction(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE18_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 68370e25eb..8047029e75 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -43,6 +43,7 @@ #include "gnap/scenes/scene15.h" #include "gnap/scenes/scene16.h" #include "gnap/scenes/scene17.h" +#include "gnap/scenes/scene18.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -176,10 +177,11 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 18: - backgroundId = scene18_init(); + _scene = new Scene18(this); + backgroundId = _scene->init(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); - scene18_updateHotspots(); + _scene->updateHotspots(); break; case 19: backgroundId = scene19_init(); @@ -498,7 +500,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 18: - scene18_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From 4c7756e75dcd3f7f9ad24e52e849e60936c8381d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 10:23:49 +0200 Subject: GNAP: Refactor scenes 19 and 20 --- engines/gnap/gnap.cpp | 10 - engines/gnap/gnap.h | 23 -- engines/gnap/scenes/scene19.cpp | 409 +++++++++++----------- engines/gnap/scenes/scene19.h | 54 +++ engines/gnap/scenes/scene20.cpp | 706 +++++++++++++++++++------------------- engines/gnap/scenes/scene20.h | 57 +++ engines/gnap/scenes/scenecore.cpp | 18 +- 7 files changed, 681 insertions(+), 596 deletions(-) create mode 100644 engines/gnap/scenes/scene19.h create mode 100644 engines/gnap/scenes/scene20.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 82035ebef8..286bb7316d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2021,16 +2021,6 @@ void GnapEngine::initGlobalSceneVars() { // Scene 18 _s18_garbageCanPos = 8; - // Scene 19 - _s19_toyGrabCtr = 0; - _s19_pictureSurface = 0; - _s19_shopAssistantCtr = 0; - - // Scene 20 - _s20_stonerGuyCtr = 3; - _s20_stonerGuyShowingJoint = false; - _s20_groceryStoreGuyCtr = 0; - // Scene 22 _s22_caughtBefore = false; _s22_cashierCtr = 3; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 7d8edd3697..b61f93c2d5 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,29 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 19 - int _s19_currShopAssistantSequenceId, _s19_nextShopAssistantSequenceId; - int _s19_toyGrabCtr; - int _s19_shopAssistantCtr; - Graphics::Surface *_s19_pictureSurface; - int scene19_init(); - void scene19_updateHotspots(); - void scene19_run(); - void scene19_updateAnimations(); - - // Scene 20 - int _s20_currStonerGuySequenceId, _s20_nextStonerGuySequenceId; - int _s20_currGroceryStoreGuySequenceId, _s20_nextGroceryStoreGuySequenceId; - int _s20_stonerGuyCtr; - bool _s20_stonerGuyShowingJoint; - int _s20_groceryStoreGuyCtr; - int scene20_init(); - void scene20_updateHotspots(); - void scene20_updateAnimationsCb(); - void scene20_stopSounds(); - void scene20_run(); - void scene20_updateAnimations(); - // Scene 21 int _s21_currOldLadySequenceId, _s21_nextOldLadySequenceId; int scene21_init(); diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp index 4de51f8ca4..cb5cd6d16d 100644 --- a/engines/gnap/scenes/scene19.cpp +++ b/engines/gnap/scenes/scene19.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene19.h" namespace Gnap { @@ -58,120 +59,128 @@ enum { kASLeaveScene = 5 }; -int GnapEngine::scene19_init() { - playSound(0x79, false); - return isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; +Scene19::Scene19(GnapEngine *vm) : Scene(vm) { + _s19_toyGrabCtr = 0; + _s19_pictureSurface = 0; + _s19_shopAssistantCtr = 0; + _s19_pictureSurface = nullptr; } -void GnapEngine::scene19_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitOutsideToyStore, 36, 154, 142, 338, SF_EXIT_NW_CURSOR, 4, 6); - setHotspot(kHSPicture, 471, 237, 525, 283, SF_DISABLED, 7, 2); - setHotspot(kHSShopAssistant, 411, 151, 575, 279, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - setHotspot(kHSPhone, 647, 166, 693, 234, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); - setHotspot(kHSToy1, 181, 11, 319, 149, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 0); - setHotspot(kHSToy2, 284, 85, 611, 216, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 0); - setHotspot(kHSToy3, 666, 38, 755, 154, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); - setHotspot(kHSToy4, 154, 206, 285, 327, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 3); - setHotspot(kHSToy5, 494, 301, 570, 448, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 5); - setHotspot(kHSToy6, 0, 320, 188, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); - setHotspot(kHSToy7, 597, 434, 800, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 8); - setHotspot(kHSWalkArea1, 0, 0, 170, 600); - setHotspot(kHSWalkArea2, 622, 0, 800, 600); - setHotspot(kHSWalkArea3, 0, 0, 800, 437); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFPlatypusTalkingToAssistant)) { - _hotspots[kHSToy1]._flags = SF_DISABLED; - _hotspots[kHSToy2]._flags = SF_DISABLED; - _hotspots[kHSToy3]._flags = SF_DISABLED; - _hotspots[kHSToy4]._flags = SF_DISABLED; - _hotspots[kHSToy5]._flags = SF_DISABLED; - _hotspots[kHSToy6]._flags = SF_DISABLED; - _hotspots[kHSToy7]._flags = SF_DISABLED; - _hotspots[kHSShopAssistant]._flags = SF_DISABLED; - _hotspots[kHSPhone]._flags = SF_DISABLED; - _hotspots[kHSPlatypus]._flags = SF_DISABLED; - _hotspots[kHSPicture]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - } - _hotspotsCount = 16; +Scene19::~Scene19() { + delete _s19_pictureSurface; +} + +int Scene19::init() { + _vm->playSound(0x79, false); + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; } -void GnapEngine::scene19_run() { +void Scene19::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitOutsideToyStore, 36, 154, 142, 338, SF_EXIT_NW_CURSOR, 4, 6); + _vm->setHotspot(kHSPicture, 471, 237, 525, 283, SF_DISABLED, 7, 2); + _vm->setHotspot(kHSShopAssistant, 411, 151, 575, 279, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHSPhone, 647, 166, 693, 234, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + _vm->setHotspot(kHSToy1, 181, 11, 319, 149, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 0); + _vm->setHotspot(kHSToy2, 284, 85, 611, 216, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 0); + _vm->setHotspot(kHSToy3, 666, 38, 755, 154, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + _vm->setHotspot(kHSToy4, 154, 206, 285, 327, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 3); + _vm->setHotspot(kHSToy5, 494, 301, 570, 448, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 5); + _vm->setHotspot(kHSToy6, 0, 320, 188, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + _vm->setHotspot(kHSToy7, 597, 434, 800, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 170, 600); + _vm->setHotspot(kHSWalkArea2, 622, 0, 800, 600); + _vm->setHotspot(kHSWalkArea3, 0, 0, 800, 437); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHSToy1]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy2]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy3]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy4]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy5]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy6]._flags = SF_DISABLED; + _vm->_hotspots[kHSToy7]._flags = SF_DISABLED; + _vm->_hotspots[kHSShopAssistant]._flags = SF_DISABLED; + _vm->_hotspots[kHSPhone]._flags = SF_DISABLED; + _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; + _vm->_hotspots[kHSPicture]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + } + _vm->_hotspotsCount = 16; +} - queueInsertDeviceIcon(); +void Scene19::run() { + _vm->queueInsertDeviceIcon(); _s19_toyGrabCtr = 0; _s19_pictureSurface = 0; - _gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFPictureTaken)) - _gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFPictureTaken)) + _vm->_gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFPlatypusTalkingToAssistant)) { - initGnapPos(3, 6, kDirBottomRight); - _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[getRandom(5)]; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->initGnapPos(3, 6, kDirBottomRight); + _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; _s19_nextShopAssistantSequenceId = _s19_currShopAssistantSequenceId; - _gameSys->setAnimation(_s19_currShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_currShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _s19_shopAssistantCtr = 0; - endSceneInit(); - gnapWalkTo(4, 9, -1, 0x107B9, 1); - scene19_updateHotspots(); + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + updateHotspots(); } else { _s19_currShopAssistantSequenceId = 0x6D; _s19_nextShopAssistantSequenceId = -1; - _gameSys->setAnimation(0x6D, 20, 4); - _gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); - _timers[6] = getRandom(40) + 50; - initGnapPos(3, 6, kDirBottomRight); - initPlatypusPos(4, 6, kDirNone); - endSceneInit(); - gnapWalkTo(4, 9, -1, 0x107B9, 1); - platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->_gameSys->setAnimation(0x6D, 20, 4); + _vm->_gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[6] = _vm->getRandom(40) + 50; + _vm->initGnapPos(3, 6, kDirBottomRight); + _vm->initPlatypusPos(4, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 5, -1, -1, -1, -1); + _vm->testWalk(0, 5, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene19_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -179,38 +188,38 @@ void GnapEngine::scene19_run() { break; case kHSExitOutsideToyStore: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 18; - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[1].x, _hotspotsWalkPos[1].y, 0, 0x107B2, 1); - _gnapActionStatus = kASLeaveScene; - if (isFlag(kGFPlatypusTalkingToAssistant)) - setFlag(kGFUnk27); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kASLeaveScene; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _vm->setFlag(kGFUnk27); else - platypusWalkTo(_hotspotsWalkPos[1].x + 1, _hotspotsWalkPos[1].y, -1, 0x107C5, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x + 1, _vm->_hotspotsWalkPos[1].y, -1, 0x107C5, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; } break; case kHSPicture: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 6, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 2); + _vm->playGnapScratchingHead(6, 2); break; case GRAB_CURSOR: - if (!isFlag(kGFPictureTaken)) { - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y) | 0x10000, 1); - _gnapActionStatus = kASGrabPicture; + if (!_vm->isFlag(kGFPictureTaken)) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabPicture; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -218,22 +227,22 @@ void GnapEngine::scene19_run() { break; case kHSShopAssistant: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 6, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 2); + _vm->playGnapScratchingHead(6, 2); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkShopAssistant; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkShopAssistant; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -247,22 +256,22 @@ void GnapEngine::scene19_run() { case kHSToy5: case kHSToy6: case kHSToy7: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, -1, 1); - playGnapIdle(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y); - _gnapActionStatus = kASGrabToy; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + _vm->_gnapActionStatus = kASGrabToy; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -270,22 +279,22 @@ void GnapEngine::scene19_run() { break; case kHSPhone: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 9, 1); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(9, 1); + _vm->playGnapScratchingHead(9, 1); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, 0, -1, 1); - playGnapIdle(8, 2); - _gnapActionStatus = kASUsePhone; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->playGnapIdle(8, 2); + _vm->_gnapActionStatus = kASUsePhone; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -295,28 +304,28 @@ void GnapEngine::scene19_run() { case kHSWalkArea1: case kHSWalkArea2: case kHSWalkArea3: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = 0; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; } } - scene19_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updateGnapIdleSequence(); - if (!isFlag(kGFPlatypusTalkingToAssistant)) { - updatePlatypusIdleSequence(); - if (!_timers[6] && _s19_nextShopAssistantSequenceId == -1) { - _timers[6] = getRandom(40) + 50; - if (getRandom(4) != 0) { + if (!_vm->_isLeavingScene) { + _vm->updateGnapIdleSequence(); + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->updatePlatypusIdleSequence(); + if (!_vm->_timers[6] && _s19_nextShopAssistantSequenceId == -1) { + _vm->_timers[6] = _vm->getRandom(40) + 50; + if (_vm->getRandom(4) != 0) { _s19_nextShopAssistantSequenceId = 0x64; - } else if (isFlag(kGFPictureTaken)) { + } else if (_vm->isFlag(kGFPictureTaken)) { _s19_nextShopAssistantSequenceId = 0x64; } else { _s19_nextShopAssistantSequenceId = 0x6C; @@ -324,29 +333,26 @@ void GnapEngine::scene19_run() { } } } + + _vm->checkGameKeys(); - checkGameKeys(); - - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene19_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } if (_s19_pictureSurface) - deleteSurface(&_s19_pictureSurface); - + _vm->deleteSurface(&_s19_pictureSurface); } -void GnapEngine::scene19_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene19::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASUsePhone: _s19_nextShopAssistantSequenceId = 0x67; break; @@ -368,43 +374,43 @@ void GnapEngine::scene19_updateAnimations() { } break; case kASGrabPicture: - playGnapPullOutDevice(6, 2); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x68, 19, 0); - _gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); - invAdd(kItemPicture); - setFlag(kGFPictureTaken); - scene19_updateHotspots(); - _gnapActionStatus = kASGrabPictureDone; + _vm->playGnapPullOutDevice(6, 2); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x68, 19, 0); + _vm->_gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); + _vm->invAdd(kItemPicture); + _vm->setFlag(kGFPictureTaken); + updateHotspots(); + _vm->_gnapActionStatus = kASGrabPictureDone; break; case kASGrabPictureDone: - setGrabCursorSprite(-1); - hideCursor(); - _s19_pictureSurface = addFullScreenSprite(0xF, 255); - _gameSys->setAnimation(0x61, 256, 0); - _gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) { + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + _s19_pictureSurface = _vm->addFullScreenSprite(0xF, 255); + _vm->_gameSys->setAnimation(0x61, 256, 0); + _vm->_gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - setFlag(kGFUnk27); - showCursor(); - _newSceneNum = 17; - _isLeavingScene = true; - _sceneDone = true; + _vm->setFlag(kGFUnk27); + _vm->showCursor(); + _vm->_newSceneNum = 17; + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; _s19_nextShopAssistantSequenceId = -1; break; case kASTalkShopAssistant: _s19_nextShopAssistantSequenceId = 0x6D; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(4) == 2) { + if (_vm->_gameSys->getAnimationStatus(4) == 2) { switch (_s19_nextShopAssistantSequenceId) { case 0x6F: case 0x70: @@ -413,58 +419,57 @@ void GnapEngine::scene19_updateAnimations() { case 0x73: _s19_shopAssistantCtr = (_s19_shopAssistantCtr + 1) % 5; _s19_nextShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_s19_shopAssistantCtr]; - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; break; case 0x62: case 0x66: case 0x6B: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; - _timers[5] = 10; - while (_timers[5]) { - gameUpdateTick(); + _vm->_timers[5] = 10; + while (_vm->_timers[5]) { + _vm->gameUpdateTick(); } - playGnapIdle(6, 2); - _gnapActionStatus = -1; + _vm->playGnapIdle(6, 2); + _vm->_gnapActionStatus = -1; break; case 0x67: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case 0x65: - playGnapIdle(6, 2); - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 0); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->playGnapIdle(6, 2); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 0); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; - _newSceneNum = 18; - _gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 18; + _vm->_gnapActionStatus = kASLeaveScene; break; case 0x6D: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, getSequenceTotalDuration(_s19_nextShopAssistantSequenceId), 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_s19_nextShopAssistantSequenceId), 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; break; case 0x64: case 0x6C: - _gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; _s19_nextShopAssistantSequenceId = -1; break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene19.h b/engines/gnap/scenes/scene19.h new file mode 100644 index 0000000000..721b107cf5 --- /dev/null +++ b/engines/gnap/scenes/scene19.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE19_H +#define GNAP_SCENE19_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene19: public Scene { +public: + Scene19(GnapEngine *vm); + ~Scene19(); + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s19_currShopAssistantSequenceId; + int _s19_nextShopAssistantSequenceId; + int _s19_toyGrabCtr; + int _s19_shopAssistantCtr; + + Graphics::Surface *_s19_pictureSurface; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE19_H diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 54a8438345..c31f6229cb 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene20.h" namespace Gnap { @@ -55,71 +56,76 @@ enum { kASGrabJointDone = 13 }; -int GnapEngine::scene20_init() { - return 0x186; +Scene20::Scene20(GnapEngine *vm) : Scene(vm) { + _s20_stonerGuyCtr = 3; + _s20_stonerGuyShowingJoint = false; + _s20_groceryStoreGuyCtr = 0; } -void GnapEngine::scene20_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSGroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); - setHotspot(kHSExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); - setHotspot(kHSStonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - setHotspot(kHSGroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - setHotspot(kHSExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); - setHotspot(kHSExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); - setHotspot(kHSExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); - setHotspot(kHSExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - setHotspot(kHSWalkArea1, 0, 0, 800, 468); - setHotspot(kHSWalkArea2, 605, 0, 800, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 12; +int Scene20::init() { + return 0x186; } -void GnapEngine::scene20_updateAnimationsCb() { +void Scene20::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSGroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); + _vm->setHotspot(kHSExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + _vm->setHotspot(kHSStonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHSGroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHSExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); + _vm->setHotspot(kHSExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); + _vm->setHotspot(kHSExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); + _vm->setHotspot(kHSExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 468); + _vm->setHotspot(kHSWalkArea2, 605, 0, 800, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 12; +} - if (_gameSys->getAnimationStatus(2) == 2) { +void Scene20::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { switch (_s20_nextStonerGuySequenceId) { case 0x16B: - if (!_timers[4]) { + if (!_vm->_timers[4]) { _s20_stonerGuyShowingJoint = false; - _gameSys->insertSequence(0x16B, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x16B, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16B; _s20_nextStonerGuySequenceId = -1; } break; case 0x16A: // Grab joint - playGnapPullOutDevice(4, 4); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x16A, 21, 0); - _gameSys->insertSequence(0x16A, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->playGnapPullOutDevice(4, 4); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x16A, 21, 0); + _vm->_gameSys->insertSequence(0x16A, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16A; _s20_nextStonerGuySequenceId = -1; - invAdd(kItemJoint); - setFlag(kGFJointTaken); + _vm->invAdd(kItemJoint); + _vm->setFlag(kGFJointTaken); _s20_stonerGuyShowingJoint = false; - _gnapActionStatus = kASGrabJointDone; + _vm->_gnapActionStatus = kASGrabJointDone; break; case 0x16E: - _gameSys->setAnimation(0x16E, 21, 2); - _gameSys->insertSequence(0x16E, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x16E, 21, 2); + _vm->_gameSys->insertSequence(0x16E, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16E; _s20_nextStonerGuySequenceId = -1; _s20_nextGroceryStoreGuySequenceId = 0x175; break; case 0x16D: - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 0); - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 0); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; _s20_nextStonerGuySequenceId = -1; - _gnapActionStatus = kASActionDone; + _vm->_gnapActionStatus = kASActionDone; break; case 0x16F: - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _gameSys->setAnimation(0x17A, 20, 3); - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17A, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(0x17A, 20, 3); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17A, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = 0x17A; _s20_nextGroceryStoreGuySequenceId = -1; _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; @@ -141,10 +147,10 @@ void GnapEngine::scene20_updateAnimationsCb() { _s20_nextStonerGuySequenceId = 0x171; break; } - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17C, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x17C, 20, 3); - _gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17C, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); _s20_currGroceryStoreGuySequenceId = 0x17C; _s20_nextGroceryStoreGuySequenceId = -1; _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; @@ -152,40 +158,37 @@ void GnapEngine::scene20_updateAnimationsCb() { break; default: _s20_nextStonerGuySequenceId = 0x16C; - _gameSys->setAnimation(0x16C, 21, 2); - _gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x16C, 21, 2); + _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; _s20_nextStonerGuySequenceId = -1; break; } } - } -void GnapEngine::scene20_stopSounds() { - stopSound(0x18E); - stopSound(0x18F); - stopSound(0x190); - stopSound(0x191); - stopSound(0x194); - stopSound(0x195); - stopSound(0x192); - stopSound(0x193); - stopSound(0x196); - stopSound(0x197); - stopSound(0x198); - stopSound(0x199); - stopSound(0x19A); +void Scene20::stopSounds() { + _vm->stopSound(0x18E); + _vm->stopSound(0x18F); + _vm->stopSound(0x190); + _vm->stopSound(0x191); + _vm->stopSound(0x194); + _vm->stopSound(0x195); + _vm->stopSound(0x192); + _vm->stopSound(0x193); + _vm->stopSound(0x196); + _vm->stopSound(0x197); + _vm->stopSound(0x198); + _vm->stopSound(0x199); + _vm->stopSound(0x19A); } -void GnapEngine::scene20_run() { - - playSound(0x10940, true); - - startSoundTimerA(8); +void Scene20::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(8); _s20_stonerGuyShowingJoint = false; - _timers[7] = getRandom(100) + 100; + _vm->_timers[7] = _vm->getRandom(100) + 100; _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; switch (_s20_stonerGuyCtr) { @@ -201,119 +204,117 @@ void GnapEngine::scene20_run() { } _s20_nextStonerGuySequenceId = -1; - _gameSys->setAnimation(_s20_currStonerGuySequenceId, 21, 2); - _gameSys->insertSequence(_s20_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_currStonerGuySequenceId, 21, 2); + _vm->_gameSys->insertSequence(_s20_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - _timers[6] = getRandom(20) + 30; + _vm->_timers[6] = _vm->getRandom(20) + 30; _s20_currGroceryStoreGuySequenceId = 0x17C; _s20_nextGroceryStoreGuySequenceId = -1; - _gameSys->setAnimation(0x17C, 20, 3); - _gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); - _timers[5] = getRandom(50) + 130; - if (isFlag(kGFGroceryStoreHatTaken)) - _gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFSceneFlag1)) { - clearFlag(kGFSceneFlag1); - endSceneInit(); - _gameSys->setAnimation(0x182, 140, 0); - _gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) { + if (_vm->isFlag(kGFSceneFlag1)) { + _vm->clearFlag(kGFSceneFlag1); + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(0x182, 140, 0); + _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - initGnapPos(11, 8, kDirBottomLeft); - initPlatypusPos(11, 9, kDirUnk4); - gnapWalkTo(5, 8, -1, 0x107BA, 1); - platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); } else { - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 17: - initGnapPos(5, 11, kDirBottomRight); - initPlatypusPos(6, 11, kDirNone); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107B9, 1); - platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 18: - initGnapPos(11, 8, kDirBottomLeft); - initPlatypusPos(11, 9, kDirUnk4); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107BA, 1); - platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 21: - initGnapPos(-1, 8, kDirBottomLeft); - initPlatypusPos(-1, 9, kDirUnk4); - endSceneInit(); - gnapWalkTo(3, 8, -1, 0x107B9, 1); - platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 8, kDirBottomLeft); + _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 22: - initGnapPos(7, 6, kDirBottomRight); - initPlatypusPos(8, 6, kDirNone); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107B9, 1); - platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->initGnapPos(7, 6, kDirBottomRight); + _vm->initPlatypusPos(8, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); break; default: - initGnapPos(8, 6, kDirBottomLeft); - initPlatypusPos(9, 6, kDirUnk4); - endSceneInit(); - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 9, -1, 0x107C2, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + _vm->initGnapPos(8, 6, kDirBottomLeft); + _vm->initPlatypusPos(9, 6, kDirUnk4); + _vm->endSceneInit(); + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; break; } } - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 1, 7, 9, 8, 9); - testWalk(0, 0, -1, -1, -1, -1); - testWalk(0, 1, 7, 9, 8, 9); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene20_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(20); + _vm->gnapKissPlatypus(20); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -321,96 +322,96 @@ void GnapEngine::scene20_run() { break; case kHSExitParkingLot: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 21; - gnapWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitParkingLot].x, _hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); - _platypusFacing = kDirUnk4; + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 21; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); + _vm->_platypusFacing = kDirUnk4; } break; case kHSExitPhone: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 17; - gnapWalkTo(_hotspotsWalkPos[kHSExitPhone].x, _hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitPhone].x + 1, _hotspotsWalkPos[kHSExitPhone].y, -1, 0x107C2, 1); + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 17; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x, _vm->_hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x + 1, _vm->_hotspotsWalkPos[kHSExitPhone].y, -1, 0x107C2, 1); } break; case kHSExitOutsideToyStore: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 18; - _hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideToyStore].x, _hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); - _hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); + _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; } break; case kHSExitInsideGrubCity: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 22; - gnapWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x, _hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); - _platypusFacing = kDirUnk4; + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 22; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); + _vm->_platypusFacing = kDirUnk4; } break; case kHSExitOutsideCircusWorld: - if (_gnapActionStatus < 0) { + if (_vm->_gnapActionStatus < 0) { if (_s20_stonerGuyShowingJoint) - _timers[4] = 0; - _isLeavingScene = true; - _newSceneNum = 24; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 24; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); } break; case kHSStonerGuy: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 5, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 5, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(5, 4); + _vm->playGnapMoan2(5, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_s20_stonerGuyShowingJoint) - _gnapActionStatus = kASGrabJoint; + _vm->_gnapActionStatus = kASGrabJoint; else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSStonerGuy].x, _hotspotsWalkPos[kHSStonerGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - if (isFlag(kGFJointTaken)) - _gnapActionStatus = kASTalkStonerGuyNoJoint; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + if (_vm->isFlag(kGFJointTaken)) + _vm->_gnapActionStatus = kASTalkStonerGuyNoJoint; else - _gnapActionStatus = kASTalkStonerGuyHasJoint; + _vm->_gnapActionStatus = kASTalkStonerGuyHasJoint; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -418,27 +419,27 @@ void GnapEngine::scene20_run() { break; case kHSGroceryStoreGuy: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 2, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 2, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(2, 3); + _vm->playGnapScratchingHead(2, 3); break; case GRAB_CURSOR: _s20_stonerGuyShowingJoint = false; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabGroceryStoreGuy; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabGroceryStoreGuy; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkGroceryStoreGuy; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkGroceryStoreGuy; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -446,27 +447,27 @@ void GnapEngine::scene20_run() { break; case kHSGroceryStoreHat: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemCowboyHat) { - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreHat].x, _hotspotsWalkPos[kHSGroceryStoreHat].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASSwitchGroceryStoreHat; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSGroceryStoreHat].x, _hotspotsWalkPos[kHSGroceryStoreHat].y, 1, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASSwitchGroceryStoreHat; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 1, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(1, 6); + _vm->playGnapScratchingHead(1, 6); break; case GRAB_CURSOR: _s20_stonerGuyShowingJoint = false; - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSGroceryStoreGuy].x, _hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabGroceryStoreHat; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabGroceryStoreHat; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -475,124 +476,120 @@ void GnapEngine::scene20_run() { case kHSWalkArea1: case kHSWalkArea2: - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene20_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10940)) - playSound(0x10940, true); + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) { - _hotspots[kHSWalkArea1]._y2 += 48; - updatePlatypusIdleSequence(); - _hotspots[kHSWalkArea1]._y2 -= 48; + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) { + _vm->_hotspots[kHSWalkArea1]._y2 += 48; + _vm->updatePlatypusIdleSequence(); + _vm->_hotspots[kHSWalkArea1]._y2 -= 48; } - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (_gnapActionStatus < 0 && !_timers[5] && _s20_nextGroceryStoreGuySequenceId == -1) { - _timers[5] = getRandom(50) + 130; - if (getRandom(4) != 0) + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->_timers[5] && _s20_nextGroceryStoreGuySequenceId == -1) { + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->getRandom(4) != 0) _s20_nextGroceryStoreGuySequenceId = 0x17C; else _s20_nextGroceryStoreGuySequenceId = 0x17A; } - if (!_timers[7]) { - _timers[7] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0) { - switch (getRandom(3)) { + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + switch (_vm->getRandom(3)) { case 0: - _gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); break; } } } - playSoundA(); + _vm->playSoundA(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene20_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene20_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene20::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASTalkStonerGuyNoJoint: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = 0x16E; - _timers[5] = 100; - _timers[6] = 100; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; break; case kASTalkStonerGuyHasJoint: - _gameSys->setAnimation(0x168, 21, 2); - _gameSys->setAnimation(379, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x168, 21, 2); + _vm->_gameSys->setAnimation(379, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x168; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = 0x16B; - _timers[5] = 200; - _timers[6] = 200; - _timers[4] = 100; + _vm->_timers[5] = 200; + _vm->_timers[6] = 200; + _vm->_timers[4] = 100; _s20_stonerGuyShowingJoint = true; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASGrabJoint: _s20_nextStonerGuySequenceId = 0x16A; break; case kASActionDone: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASTalkGroceryStoreGuy: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; _s20_groceryStoreGuyCtr = (_s20_groceryStoreGuyCtr + 1) % 2; @@ -600,137 +597,136 @@ void GnapEngine::scene20_updateAnimations() { _s20_nextGroceryStoreGuySequenceId = 0x176; else _s20_nextGroceryStoreGuySequenceId = 0x177; - _timers[5] = 100; - _timers[6] = 100; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; break; case kASGrabGroceryStoreGuy: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; - _timers[5] = 120; - _timers[6] = 120; + _vm->_timers[5] = 120; + _vm->_timers[6] = 120; _s20_nextGroceryStoreGuySequenceId = 0x178; break; case kASGrabGroceryStoreHat: - _gameSys->setAnimation(0x170, 21, 2); - _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - stopSound(0x1A1); - scene20_stopSounds(); + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; _s20_currStonerGuySequenceId = 0x170; _s20_nextGroceryStoreGuySequenceId = 0x179; break; case kASSwitchGroceryStoreHat: - setGrabCursorSprite(-1); - _gameSys->setAnimation(0x180, _gnapId, 0); - _gameSys->insertSequence(0x180, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x180; - _gnapSequenceDatNum = 0; - invRemove(kItemCowboyHat); - invAdd(kItemGroceryStoreHat); - _gnapActionStatus = kASSwitchGroceryStoreHatDone; + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x180; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemCowboyHat); + _vm->invAdd(kItemGroceryStoreHat); + _vm->_gnapActionStatus = kASSwitchGroceryStoreHatDone; break; case kASSwitchGroceryStoreHatDone: - _gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); - setFlag(kGFGroceryStoreHatTaken); - hideCursor(); - setGrabCursorSprite(-1); - addFullScreenSprite(0x12C, 255); - _gameSys->setAnimation(0x181, 256, 0); - _gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - removeFullScreenSprite(); - showCursor(); - setGrabCursorSprite(kItemGroceryStoreHat); - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(3, 8, -1, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFGroceryStoreHatTaken); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0x12C, 255); + _vm->_gameSys->setAnimation(0x181, 256, 0); + _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemGroceryStoreHat); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = -1; break; case kASGrabJointDone: - setGrabCursorSprite(kItemJoint); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemJoint); + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_s20_nextGroceryStoreGuySequenceId) { case 0x176: case 0x177: - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = 0x16D; break; case 0x178: - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->setAnimation(0x17D, _gnapId, 0); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x17D; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASActionDone; - _gameSys->setAnimation(0x16D, 21, 2); - _gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16D; _s20_currGroceryStoreGuySequenceId = 0x178; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = -1; break; case 0x179: - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->setAnimation(0x16D, 21, 0); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x17E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x17E; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASActionDone; - _gameSys->setAnimation(0x16D, 21, 2); - _gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x16D, 21, 0); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s20_currStonerGuySequenceId = 0x16D; _s20_currGroceryStoreGuySequenceId = 377; _s20_nextGroceryStoreGuySequenceId = -1; _s20_nextStonerGuySequenceId = -1; - gnapWalkTo(4, 8, -1, 0x107BB, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); break; case 0x17C: - _gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 3); _s20_nextStonerGuySequenceId = 0x171; break; case 0x17A: - _gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 3); _s20_nextStonerGuySequenceId = 0x16F; break; case 0x175: - _gameSys->setAnimation(0x175, 20, 0); - _gameSys->setAnimation(0x175, 20, 3); - _gameSys->insertSequence(0x175, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x175, 20, 0); + _vm->_gameSys->setAnimation(0x175, 20, 3); + _vm->_gameSys->insertSequence(0x175, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = 0x175; _s20_nextGroceryStoreGuySequenceId = -1; - _gnapActionStatus = kASActionDone; + _vm->_gnapActionStatus = kASActionDone; break; default: if (_s20_nextGroceryStoreGuySequenceId != -1) { - _gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; _s20_nextGroceryStoreGuySequenceId = -1; } break; } } - - scene20_updateAnimationsCb(); + updateAnimationsCb(); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene20.h b/engines/gnap/scenes/scene20.h new file mode 100644 index 0000000000..7496c87892 --- /dev/null +++ b/engines/gnap/scenes/scene20.h @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE20_H +#define GNAP_SCENE20_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene20: public Scene { +public: + Scene20(GnapEngine *vm); + ~Scene20() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _s20_currStonerGuySequenceId; + int _s20_nextStonerGuySequenceId; + int _s20_currGroceryStoreGuySequenceId; + int _s20_nextGroceryStoreGuySequenceId; + int _s20_stonerGuyCtr; + int _s20_groceryStoreGuyCtr; + bool _s20_stonerGuyShowingJoint; + + void stopSounds(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE20_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 8047029e75..20f4623348 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -44,6 +44,8 @@ #include "gnap/scenes/scene16.h" #include "gnap/scenes/scene17.h" #include "gnap/scenes/scene18.h" +#include "gnap/scenes/scene19.h" +#include "gnap/scenes/scene20.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -184,14 +186,16 @@ int GnapEngine::initSceneLogic() { _scene->updateHotspots(); break; case 19: - backgroundId = scene19_init(); - scene19_updateHotspots(); + _scene = new Scene19(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; case 20: - backgroundId = scene20_init(); - scene20_updateHotspots(); + _scene = new Scene20(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -506,12 +510,14 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 19: - scene19_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 19; break; case 20: - scene20_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 22; break; -- cgit v1.2.3 From 14ec2e9699caf9428a3f82b6542575595c6a4727 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 10:38:36 +0200 Subject: GNAP: Refactor scene 21 --- engines/gnap/gnap.h | 7 - engines/gnap/scenes/scene21.cpp | 321 +++++++++++++++++++------------------- engines/gnap/scenes/scene21.h | 50 ++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 218 insertions(+), 169 deletions(-) create mode 100644 engines/gnap/scenes/scene21.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index b61f93c2d5..9afc4e1bf8 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,13 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 21 - int _s21_currOldLadySequenceId, _s21_nextOldLadySequenceId; - int scene21_init(); - void scene21_updateHotspots(); - void scene21_run(); - void scene21_updateAnimations(); - // Scene 22 int _s22_currCashierSequenceId, _s22_nextCashierSequenceId; bool _s22_caughtBefore; diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp index fcc7f51ecd..0e88537014 100644 --- a/engines/gnap/scenes/scene21.cpp +++ b/engines/gnap/scenes/scene21.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene21.h" namespace Gnap { @@ -46,102 +47,105 @@ enum { kASLeaveScene = 6 }; -int GnapEngine::scene21_init() { - _gameSys->setAnimation(0, 0, 3); - return isFlag(kGFTwigTaken) ? 0x94 : 0x93; +Scene21::Scene21(GnapEngine *vm) : Scene(vm) { + _s21_currOldLadySequenceId = -1; + _s21_nextOldLadySequenceId = -1; } -void GnapEngine::scene21_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSBanana, 94, 394, 146, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 6); - setHotspot(kHSOldLady, 402, 220, 528, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - setHotspot(kHSExitOutsideGrubCity, 522, 498, 800, 600, SF_EXIT_SE_CURSOR | SF_WALKABLE, 5, 10); - setHotspot(kHSWalkArea1, 0, 0, 800, 440); - setHotspot(kHSWalkArea2, 698, 0, 800, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFUnk04) || !isFlag(kGFTwigTaken)) - _hotspots[kHSBanana]._flags = SF_WALKABLE | SF_DISABLED; - if (isFlag(kGFTwigTaken)) - _hotspots[kHSOldLady]._flags = SF_DISABLED; - _hotspotsCount = 7; +int Scene21::init() { + _vm->_gameSys->setAnimation(0, 0, 3); + return _vm->isFlag(kGFTwigTaken) ? 0x94 : 0x93; } -void GnapEngine::scene21_run() { - playSound(0x10940, true); - startSoundTimerA(6); +void Scene21::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSBanana, 94, 394, 146, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 6); + _vm->setHotspot(kHSOldLady, 402, 220, 528, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHSExitOutsideGrubCity, 522, 498, 800, 600, SF_EXIT_SE_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 440); + _vm->setHotspot(kHSWalkArea2, 698, 0, 800, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk04) || !_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHSBanana]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHSOldLady]._flags = SF_DISABLED; + _vm->_hotspotsCount = 7; +} + +void Scene21::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(6); - _timers[5] = getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(100) + 100; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFTwigTaken)) { - if (isFlag(kGFKeysTaken)) { - initGnapPos(5, 8, kDirBottomRight); - initPlatypusPos(6, 8, kDirNone); - _gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFUnk04)) - _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); - clearFlag(kGFKeysTaken); + if (_vm->isFlag(kGFTwigTaken)) { + if (_vm->isFlag(kGFKeysTaken)) { + _vm->initGnapPos(5, 8, kDirBottomRight); + _vm->initPlatypusPos(6, 8, kDirNone); + _vm->_gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->clearFlag(kGFKeysTaken); } else { - initGnapPos(5, 11, kDirBottomRight); - initPlatypusPos(6, 11, kDirNone); - if (!isFlag(kGFUnk04)) - _gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107B9, 1); - platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + if (!_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } } else { - initGnapPos(5, 11, kDirBottomRight); - initPlatypusPos(6, 11, kDirNone); + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); _s21_currOldLadySequenceId = 0x89; - _gameSys->setAnimation(0x89, 79, 3); - _gameSys->insertSequence(_s21_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x89, 79, 3); + _vm->_gameSys->insertSequence(_s21_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); _s21_nextOldLadySequenceId = -1; - _timers[4] = getRandom(30) + 50; - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107B9, 1); - platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->_timers[4] = _vm->getRandom(30) + 50; + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene21_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -149,19 +153,19 @@ void GnapEngine::scene21_run() { break; case kHSBanana: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 2, 5); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 5); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(2, 5); + _vm->playGnapScratchingHead(2, 5); break; case GRAB_CURSOR: - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBanana].x, _hotspotsWalkPos[kHSBanana].y) | 0x10000, 1); - playGnapPullOutDevice(2, 5); - playGnapUseDevice(0, 0); - _gnapActionStatus = kASGrabBanana; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBanana].x, _vm->_hotspotsWalkPos[kHSBanana].y) | 0x10000, 1); + _vm->playGnapPullOutDevice(2, 5); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kASGrabBanana; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -172,32 +176,32 @@ void GnapEngine::scene21_run() { break; case kHSOldLady: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemGroceryStoreHat) { - _newSceneNum = 47; - gnapWalkTo(4, 6, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASUseHatWithOldLady; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(4, 6, 7, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { + _vm->_newSceneNum = 47; + _vm->gnapWalkTo(4, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASUseHatWithOldLady; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 6, 7, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(7, 4); + _vm->playGnapScratchingHead(7, 4); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpLeft; - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(7, 6, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASGrabOldLady; - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabOldLady; + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSOldLady].x, _hotspotsWalkPos[kHSOldLady].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkOldLady; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSOldLady].x, _vm->_hotspotsWalkPos[kHSOldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkOldLady; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -205,40 +209,40 @@ void GnapEngine::scene21_run() { break; case kHSExitOutsideGrubCity: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 20; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107B3, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107B3, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); } break; case kHSWalkArea1: case kHSWalkArea2: - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene21_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10940)) - playSound(0x10940, true); + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!isFlag(kGFTwigTaken) && !_timers[4] && _s21_nextOldLadySequenceId == -1 && _gnapActionStatus == -1) { - _timers[4] = getRandom(30) + 50; - switch (getRandom(5)) { + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _s21_nextOldLadySequenceId == -1 && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(30) + 50; + switch (_vm->getRandom(5)) { case 0: _s21_nextOldLadySequenceId = 0x88; break; @@ -250,92 +254,91 @@ void GnapEngine::scene21_run() { break; } } - if (!_timers[5]) { - _timers[5] = getRandom(100) + 100; - _gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 100; + _vm->_gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); } - playSoundA(); + _vm->playSoundA(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene21_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene21_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene21::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASTalkOldLady: _s21_nextOldLadySequenceId = 0x8B; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASGrabBanana: - _gameSys->setAnimation(0x8C, 59, 0); - _gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); - setFlag(kGFUnk04); - invAdd(kItemBanana); - scene21_updateHotspots(); - _gnapActionStatus = kASGrabBananaDone; + _vm->_gameSys->setAnimation(0x8C, 59, 0); + _vm->_gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFUnk04); + _vm->invAdd(kItemBanana); + updateHotspots(); + _vm->_gnapActionStatus = kASGrabBananaDone; break; case kASGrabBananaDone: - setGrabCursorSprite(kItemBanana); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemBanana); + _vm->_gnapActionStatus = -1; break; case kASGrabOldLady: - _timers[4] = getRandom(30) + 50; + _vm->_timers[4] = _vm->getRandom(30) + 50; _s21_nextOldLadySequenceId = 0x87; break; case kASUseHatWithOldLady: - _gameSys->setAnimation(0x8F, _gnapId, 0); - _gameSys->insertSequence(0x8F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x8F; - _gnapActionStatus = kASUseHatWithOldLadyDone; - invAdd(kItemTickets); - invRemove(kItemGroceryStoreHat); - setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x8F, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x8F; + _vm->_gnapActionStatus = kASUseHatWithOldLadyDone; + _vm->invAdd(kItemTickets); + _vm->invRemove(kItemGroceryStoreHat); + _vm->setGrabCursorSprite(-1); break; case kASUseHatWithOldLadyDone: _s21_nextOldLadySequenceId = 0x91; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(3) == 2 && _s21_nextOldLadySequenceId != -1) { + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s21_nextOldLadySequenceId != -1) { if (_s21_nextOldLadySequenceId == 0x87) { - _gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); - _gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x86, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x86; - _gnapSequenceDatNum = 0; - _gnapActionStatus = -1; + _vm->_gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); + _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x86; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; _s21_nextOldLadySequenceId = -1; } else if (_s21_nextOldLadySequenceId == 0x91) { - _gameSys->setAnimation(0x91, 79, 0); - _gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASLeaveScene; + _vm->_gameSys->setAnimation(0x91, 79, 0); + _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASLeaveScene; _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; _s21_nextOldLadySequenceId = -1; } else { - _gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); - _gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); + _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; _s21_nextOldLadySequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene21.h b/engines/gnap/scenes/scene21.h new file mode 100644 index 0000000000..ea83e69a1e --- /dev/null +++ b/engines/gnap/scenes/scene21.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE21_H +#define GNAP_SCENE21_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene21: public Scene { +public: + Scene21(GnapEngine *vm); + ~Scene21() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s21_currOldLadySequenceId; + int _s21_nextOldLadySequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE21_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 20f4623348..42813a21f9 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -46,6 +46,7 @@ #include "gnap/scenes/scene18.h" #include "gnap/scenes/scene19.h" #include "gnap/scenes/scene20.h" +#include "gnap/scenes/scene21.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -200,8 +201,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 21: - backgroundId = scene21_init(); - scene21_updateHotspots(); + _scene = new Scene21(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -522,7 +524,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 22; break; case 21: - scene21_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From d1e7c9f594c6ad3ac31a3649e39db85e1be72d79 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 11:34:39 +0200 Subject: GNAP: Refactor scenes 22 & 23 --- engines/gnap/gnap.cpp | 6 +- engines/gnap/gnap.h | 16 --- engines/gnap/scenes/scene22.cpp | 238 ++++++++++++++++++----------------- engines/gnap/scenes/scene22.h | 52 ++++++++ engines/gnap/scenes/scene23.cpp | 252 +++++++++++++++++++------------------- engines/gnap/scenes/scene23.h | 50 ++++++++ engines/gnap/scenes/scenecore.cpp | 18 ++- 7 files changed, 358 insertions(+), 274 deletions(-) create mode 100644 engines/gnap/scenes/scene22.h create mode 100644 engines/gnap/scenes/scene23.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 286bb7316d..68704fdb8a 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2018,13 +2018,9 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { - // Scene 18 + // Shared by scenes 17 && 18 _s18_garbageCanPos = 8; - // Scene 22 - _s22_caughtBefore = false; - _s22_cashierCtr = 3; - // Scene 31 _s31_beerGuyDistracted = false; _s31_clerkMeasureMaxCtr = 3; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 9afc4e1bf8..aff93fa1d1 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,22 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 22 - int _s22_currCashierSequenceId, _s22_nextCashierSequenceId; - bool _s22_caughtBefore; - int _s22_cashierCtr; - int scene22_init(); - void scene22_updateHotspots(); - void scene22_run(); - void scene22_updateAnimations(); - - // Scene 23 - int _s23_currStoreClerkSequenceId, _s23_nextStoreClerkSequenceId; - int scene23_init(); - void scene23_updateHotspots(); - void scene23_run(); - void scene23_updateAnimations(); - // Scene 24 int _s24_currWomanSequenceId, _s24_nextWomanSequenceId; int _s24_boySequenceId; diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp index 364e42f03d..494af92b85 100644 --- a/engines/gnap/scenes/scene22.cpp +++ b/engines/gnap/scenes/scene22.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene22.h" namespace Gnap { @@ -41,53 +42,57 @@ enum { kASTalkCashier = 1 }; -int GnapEngine::scene22_init() { - return 0x5E; +Scene22::Scene22(GnapEngine *vm) : Scene(vm) { + _s22_caughtBefore = false; + _s22_cashierCtr = 3; } -void GnapEngine::scene22_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitOutsideGrubCity, 0, 180, 184, 472, SF_EXIT_L_CURSOR, 3, 6); - setHotspot(kHSExitBackGrubCity, 785, 405, 800, 585, SF_EXIT_R_CURSOR, 11, 9); - setHotspot(kHSCashier, 578, 230, 660, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - setHotspot(kHSWalkArea1, 553, 0, 800, 542); - setHotspot(kHSWalkArea2, 0, 0, 552, 488); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 7; +int Scene22::init() { + return 0x5E; } -void GnapEngine::scene22_run() { +void Scene22::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitOutsideGrubCity, 0, 180, 184, 472, SF_EXIT_L_CURSOR, 3, 6); + _vm->setHotspot(kHSExitBackGrubCity, 785, 405, 800, 585, SF_EXIT_R_CURSOR, 11, 9); + _vm->setHotspot(kHSCashier, 578, 230, 660, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHSWalkArea1, 553, 0, 800, 542); + _vm->setHotspot(kHSWalkArea2, 0, 0, 552, 488); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} - _gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); +void Scene22::run() { + _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); _s22_currCashierSequenceId = 0x59; _s22_nextCashierSequenceId = -1; - _gameSys->setAnimation(0x59, 1, 3); - _gameSys->insertSequence(_s22_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x59, 1, 3); + _vm->_gameSys->insertSequence(_s22_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _timers[6] = getRandom(30) + 20; + _vm->_timers[6] = _vm->getRandom(30) + 20; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (_prevSceneNum == 20) { - initGnapPos(2, 8, kDirBottomRight); - initPlatypusPos(1, 8, kDirNone); - endSceneInit(); + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(2, 8, kDirBottomRight); + _vm->initPlatypusPos(1, 8, kDirNone); + _vm->endSceneInit(); } else { - initGnapPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y, kDirBottomRight); - initPlatypusPos(11, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, kDirNone); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107B9, 1); - platypusWalkTo(9, 8, -1, 0x107C2, 1); + _vm->initGnapPos(11, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y, kDirBottomRight); + _vm->initPlatypusPos(11, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y + 1, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); } - if (isFlag(kGFSceneFlag1)) { + if (_vm->isFlag(kGFSceneFlag1)) { int storeDetectiveSeqId; - setGrabCursorSprite(-1); - invRemove(kItemCereals); + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemCereals); if (_s22_caughtBefore) { - switch (getRandom(3)) { + switch (_vm->getRandom(3)) { case 0: storeDetectiveSeqId = 0x55; break; @@ -102,58 +107,56 @@ void GnapEngine::scene22_run() { _s22_caughtBefore = true; storeDetectiveSeqId = 0x54; } - _gameSys->waitForUpdate(); - _gameSys->requestClear1(); - _gameSys->drawSpriteToBackground(0, 0, 0x44); - _gameSys->setAnimation(storeDetectiveSeqId, 256, 4); - _gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(4) != 2) { - gameUpdateTick(); + _vm->_gameSys->waitForUpdate(); + _vm->_gameSys->requestClear1(); + _vm->_gameSys->drawSpriteToBackground(0, 0, 0x44); + _vm->_gameSys->setAnimation(storeDetectiveSeqId, 256, 4); + _vm->_gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) { + _vm->gameUpdateTick(); } - _sceneDone = true; - _newSceneNum = 20; + _vm->_sceneDone = true; + _vm->_newSceneNum = 20; _s22_caughtBefore = true; } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene22_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -161,45 +164,45 @@ void GnapEngine::scene22_run() { break; case kHSExitOutsideGrubCity: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 20; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); } break; case kHSExitBackGrubCity: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 23; - gnapWalkTo(_hotspotsWalkPos[kHSExitBackGrubCity].x, _hotspotsWalkPos[kHSExitBackGrubCity].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitBackGrubCity].x, _hotspotsWalkPos[kHSExitBackGrubCity].y + 1, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 23; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y + 1, -1, 0x107C2, 1); } break; case kHSCashier: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSCashier].x, _hotspotsWalkPos[kHSCashier].y, 8, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCashier].x, _vm->_hotspotsWalkPos[kHSCashier].y, 8, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(8, 4); + _vm->playGnapScratchingHead(8, 4); break; case GRAB_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSCashier].x, _hotspotsWalkPos[kHSCashier].y, - 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkCashier; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCashier].x, _vm->_hotspotsWalkPos[kHSCashier].y, + 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkCashier; break; case PLAT_CURSOR: - gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypuss(); break; } } @@ -208,26 +211,25 @@ void GnapEngine::scene22_run() { case kHSWalkArea1: case kHSWalkArea2: - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene22_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[6] && _s22_nextCashierSequenceId == -1) { - _timers[6] = getRandom(30) + 20; - if (getRandom(8) != 0) { + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[6] && _s22_nextCashierSequenceId == -1) { + _vm->_timers[6] = _vm->getRandom(30) + 20; + if (_vm->getRandom(8) != 0) { _s22_nextCashierSequenceId = 0x59; } else { _s22_cashierCtr = (_s22_cashierCtr + 1) % 3; @@ -249,46 +251,42 @@ void GnapEngine::scene22_run() { } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene22_updateHotspots(); - _timers[2] = getRandom(30) + 20; - _timers[3] = 400; - _timers[1] = getRandom(20) + 30; - _timers[0] = getRandom(75) + 75; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 400; + _vm->_timers[1] = _vm->getRandom(20) + 30; + _vm->_timers[0] = _vm->getRandom(75) + 75; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene22_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene22::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASTalkCashier: _s22_nextCashierSequenceId = 0x5C; break; } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s22_nextCashierSequenceId != -1) { - _gameSys->setAnimation(_s22_nextCashierSequenceId, 1, 3); - _gameSys->insertSequence(_s22_nextCashierSequenceId, 1, _s22_currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s22_nextCashierSequenceId != -1) { + _vm->_gameSys->setAnimation(_s22_nextCashierSequenceId, 1, 3); + _vm->_gameSys->insertSequence(_s22_nextCashierSequenceId, 1, _s22_currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); _s22_currCashierSequenceId = _s22_nextCashierSequenceId; _s22_nextCashierSequenceId = -1; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene22.h b/engines/gnap/scenes/scene22.h new file mode 100644 index 0000000000..44afa10da7 --- /dev/null +++ b/engines/gnap/scenes/scene22.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE22_H +#define GNAP_SCENE22_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene22: public Scene { +public: + Scene22(GnapEngine *vm); + ~Scene22() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s22_currCashierSequenceId; + int _s22_nextCashierSequenceId; + bool _s22_caughtBefore; + int _s22_cashierCtr; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE22_H diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp index a6b4c1fd80..75838f4482 100644 --- a/engines/gnap/scenes/scene23.cpp +++ b/engines/gnap/scenes/scene23.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene23.h" namespace Gnap { @@ -42,90 +43,92 @@ enum { kASLeaveScene = 3 }; -int GnapEngine::scene23_init() { +Scene23::Scene23(GnapEngine *vm) : Scene(vm) { + _s23_currStoreClerkSequenceId = -1; + _s23_nextStoreClerkSequenceId = -1; +} + +int Scene23::init() { return 0xC0; } -void GnapEngine::scene23_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitFrontGrubCity, 0, 250, 15, 550, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); - setHotspot(kHSCereals, 366, 332, 414, 408, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - setHotspot(kHSWalkArea1, 0, 0, 340, 460); - setHotspot(kHSWalkArea2, 340, 0, 800, 501); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 6; +void Scene23::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitFrontGrubCity, 0, 250, 15, 550, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + _vm->setHotspot(kHSCereals, 366, 332, 414, 408, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 340, 460); + _vm->setHotspot(kHSWalkArea2, 340, 0, 800, 501); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 6; } -void GnapEngine::scene23_run() { - - _timers[4] = getRandom(100) + 200; - _timers[5] = getRandom(100) + 200; +void Scene23::run() { + _vm->_timers[4] = _vm->getRandom(100) + 200; + _vm->_timers[5] = _vm->getRandom(100) + 200; _s23_currStoreClerkSequenceId = 0xB4; _s23_nextStoreClerkSequenceId = -1; - _gameSys->setAnimation(0xB4, 1, 4); - _gameSys->insertSequence(_s23_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0xB4, 1, 4); + _vm->_gameSys->insertSequence(_s23_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - initGnapPos(-1, 7, kDirBottomRight); - initPlatypusPos(-2, 7, kDirNone); - _gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); - platypusWalkTo(1, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - if (isFlag(kGFUnk24)) { - gnapWalkTo(2, 7, -1, 0x107B9, 1); + if (_vm->isFlag(kGFUnk24)) { + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); } else { - gnapWalkTo(2, 7, 0, 0x107B9, 1); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - playSequences(0x48, 0xBA, 0xBB, 0xBC); - setFlag(kGFUnk24); + _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); + _vm->setFlag(kGFUnk24); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 3, -1, -1, -1, -1); + _vm->testWalk(0, 3, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene23_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -133,35 +136,35 @@ void GnapEngine::scene23_run() { break; case kHSCereals: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, 5, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, 5, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFSceneFlag1)) - playGnapMoan2(0, 0); + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapMoan2(0, 0); else { - gnapWalkTo(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, - 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASLookCereals; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASLookCereals; } break; case GRAB_CURSOR: - if (isFlag(kGFSceneFlag1)) - playGnapImpossible(0, 0); + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapImpossible(0, 0); else { - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(_hotspotsWalkPos[kHSCereals].x, _hotspotsWalkPos[kHSCereals].y, - 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - setFlag(kGFSceneFlag1); - _gnapActionStatus = kASGrabCereals; - invAdd(kItemCereals); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->setFlag(kGFSceneFlag1); + _vm->_gnapActionStatus = kASGrabCereals; + _vm->invAdd(kItemCereals); } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -169,109 +172,105 @@ void GnapEngine::scene23_run() { break; case kHSExitFrontGrubCity: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 22; - gnapWalkTo(_hotspotsWalkPos[kHSExitFrontGrubCity].x, _hotspotsWalkPos[kHSExitFrontGrubCity].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitFrontGrubCity].x, _hotspotsWalkPos[kHSExitFrontGrubCity].y - 1, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 22; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHSExitFrontGrubCity].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHSExitFrontGrubCity].y - 1, -1, 0x107C2, 1); } break; case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene23_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4] && _gnapActionStatus == -1) { - _timers[4] = getRandom(100) + 200; - switch (getRandom(4)) { + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(100) + 200; + switch (_vm->getRandom(4)) { case 0: - _gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); break; case 2: case 3: - _gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); break; } } - if (!_timers[5]) { - _timers[5] = getRandom(100) + 200; - switch (getRandom(3)) { + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 200; + switch (_vm->getRandom(3)) { case 0: - playSound(0xCE, false); + _vm->playSound(0xCE, false); break; case 1: - playSound(0xD0, false); + _vm->playSound(0xD0, false); break; case 2: - playSound(0xCF, false); + _vm->playSound(0xCF, false); break; } } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene23_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene23_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene23::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLookCereals: - showFullScreenSprite(0x48); - _gnapActionStatus = -1; + _vm->showFullScreenSprite(0x48); + _vm->_gnapActionStatus = -1; break; case kASGrabCereals: - _gameSys->setAnimation(0xBE, _gnapId, 0); - _gameSys->insertSequence(0xBE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->requestRemoveSequence(0xBF, 2); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0xBE; - _gnapActionStatus = kASGrabCerealsDone; + _vm->_gameSys->setAnimation(0xBE, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->requestRemoveSequence(0xBF, 2); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0xBE; + _vm->_gnapActionStatus = kASGrabCerealsDone; break; case kASGrabCerealsDone: - setGrabCursorSprite(kItemCereals); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemCereals); + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(4) == 2 && _s23_nextStoreClerkSequenceId == -1) { - switch (getRandom(8)) { + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s23_nextStoreClerkSequenceId == -1) { + switch (_vm->getRandom(8)) { case 0: case 1: case 2: @@ -286,12 +285,11 @@ void GnapEngine::scene23_updateAnimations() { _s23_nextStoreClerkSequenceId = 0xB6; break; } - _gameSys->setAnimation(_s23_nextStoreClerkSequenceId, 1, 4); - _gameSys->insertSequence(_s23_nextStoreClerkSequenceId, 1, _s23_currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s23_nextStoreClerkSequenceId, 1, 4); + _vm->_gameSys->insertSequence(_s23_nextStoreClerkSequenceId, 1, _s23_currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); _s23_currStoreClerkSequenceId = _s23_nextStoreClerkSequenceId; _s23_nextStoreClerkSequenceId = -1; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene23.h b/engines/gnap/scenes/scene23.h new file mode 100644 index 0000000000..73543c9997 --- /dev/null +++ b/engines/gnap/scenes/scene23.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE23_H +#define GNAP_SCENE23_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene23: public Scene { +public: + Scene23(GnapEngine *vm); + ~Scene23() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s23_currStoreClerkSequenceId; + int _s23_nextStoreClerkSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE23_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 42813a21f9..0ecb9e530c 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -47,6 +47,8 @@ #include "gnap/scenes/scene19.h" #include "gnap/scenes/scene20.h" #include "gnap/scenes/scene21.h" +#include "gnap/scenes/scene22.h" +#include "gnap/scenes/scene23.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -208,14 +210,16 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 22: - backgroundId = scene22_init(); - scene22_updateHotspots(); + _scene = new Scene22(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; case 23: - backgroundId = scene23_init(); - scene23_updateHotspots(); + _scene = new Scene23(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -530,12 +534,14 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 22: - scene22_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; case 23: - scene23_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From 417d8066c9d0b8938fe9ebeaa3a256143555684b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 11:47:07 +0200 Subject: GNAP: Refactor scene 24 --- engines/gnap/gnap.h | 9 -- engines/gnap/scenes/scene24.cpp | 235 +++++++++++++++++++------------------- engines/gnap/scenes/scene24.h | 52 +++++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 176 insertions(+), 129 deletions(-) create mode 100644 engines/gnap/scenes/scene24.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index aff93fa1d1..a9389e53a7 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,15 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 24 - int _s24_currWomanSequenceId, _s24_nextWomanSequenceId; - int _s24_boySequenceId; - int _s24_girlSequenceId; - int scene24_init(); - void scene24_updateHotspots(); - void scene24_run(); - void scene24_updateAnimations(); - // Scene 25 int _s25_currTicketVendorSequenceId, _s25_nextTicketVendorSequenceId; int scene25_init(); diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp index e244a0d325..d7959d0843 100644 --- a/engines/gnap/scenes/scene24.cpp +++ b/engines/gnap/scenes/scene24.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene24.h" namespace Gnap { @@ -40,102 +41,107 @@ enum { kASLeaveScene = 0 }; -int GnapEngine::scene24_init() { +Scene24::Scene24(GnapEngine *vm) : Scene(vm) { + _s24_currWomanSequenceId = -1; + _s24_nextWomanSequenceId = -1; + _s24_boySequenceId = -1; + _s24_girlSequenceId = -1; +} + +int Scene24::init() { return 0x3B; } -void GnapEngine::scene24_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitCircusWorld, 785, 128, 800, 600, SF_EXIT_R_CURSOR, 8, 7); - setHotspot(kHSExitOutsideGrubCity, 0, 213, 91, 600, SF_EXIT_NW_CURSOR, 1, 8); - setHotspot(kHSWalkArea1, 0, 0, 0, 0); - setHotspot(kHSWalkArea2, 530, 0, 800, 600); - setHotspot(kHSWalkArea3, 0, 0, 800, 517); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 7; +void Scene24::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitCircusWorld, 785, 128, 800, 600, SF_EXIT_R_CURSOR, 8, 7); + _vm->setHotspot(kHSExitOutsideGrubCity, 0, 213, 91, 600, SF_EXIT_NW_CURSOR, 1, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 0, 0); + _vm->setHotspot(kHSWalkArea2, 530, 0, 800, 600); + _vm->setHotspot(kHSWalkArea3, 0, 0, 800, 517); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; } -void GnapEngine::scene24_run() { +void Scene24::run() { int counter = 0; - playSound(0x10940, true); - - startSoundTimerA(9); + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(9); - _timers[7] = getRandom(100) + 100; + _vm->_timers[7] = _vm->getRandom(100) + 100; - _gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); - _timers[4] = getRandom(20) + 50; - _timers[5] = getRandom(20) + 40; - _timers[6] = getRandom(50) + 30; + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_timers[5] = _vm->getRandom(20) + 40; + _vm->_timers[6] = _vm->getRandom(50) + 30; - _gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); _s24_currWomanSequenceId = 0x35; _s24_girlSequenceId = 0x36; _s24_boySequenceId = 0x30; - if (_debugLevel == 4) - startIdleTimer(8); + if (_vm->_debugLevel == 4) + _vm->startIdleTimer(8); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (_prevSceneNum == 20) { - initGnapPos(1, 8, kDirBottomRight); - initPlatypusPos(2, 8, kDirNone); - endSceneInit(); - gnapWalkTo(1, 9, -1, 0x107B9, 1); - platypusWalkTo(2, 9, -1, 0x107C2, 1); + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(1, 8, kDirBottomRight); + _vm->initPlatypusPos(2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(1, 9, -1, 0x107B9, 1); + _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); } else { - initGnapPos(8, 8, kDirBottomLeft); - initPlatypusPos(8, 8, kDirUnk4); - endSceneInit(); - gnapWalkTo(2, 8, -1, 0x107BA, 1); - platypusWalkTo(3, 8, -1, 0x107C2, 1); + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(8, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); } - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->testWalk(0, 0, -1, -1, -1, -1); - testWalk(0, 0, -1, -1, -1, -1); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene24_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -143,62 +149,61 @@ void GnapEngine::scene24_run() { break; case kHSExitCircusWorld: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 25; - gnapWalkTo(_hotspotsWalkPos[kHSExitCircusWorld].x, _hotspotsWalkPos[kHSExitCircusWorld].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitCircusWorld].x + 1, _hotspotsWalkPos[kHSExitCircusWorld].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 25; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitCircusWorld].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitCircusWorld].y, -1, 0x107C2, 1); } break; case kHSExitOutsideGrubCity: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 20; - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); } break; case kHSWalkArea1: case kHSWalkArea2: case kHSWalkArea3: - if (_gnapActionStatus == -1) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus == -1) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene24_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x10940)) - playSound(0x10940, true); + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(20) + 50; - _gameSys->insertSequence(0x37, 20, _s24_girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_gameSys->insertSequence(0x37, 20, _s24_girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s24_girlSequenceId = 0x37; } - if (!_timers[5]) { - _timers[5] = getRandom(20) + 40; - _gameSys->insertSequence(0x31, 20, _s24_boySequenceId, 20, kSeqSyncWait, 0, 0, 0); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 40; + _vm->_gameSys->insertSequence(0x31, 20, _s24_boySequenceId, 20, kSeqSyncWait, 0, 0, 0); _s24_boySequenceId = 0x31; } - if (!_timers[6]) { - _timers[6] = getRandom(50) + 30; + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(50) + 30; counter = (counter + 1) % 3; switch (counter) { case 0: @@ -211,49 +216,45 @@ void GnapEngine::scene24_run() { _s24_nextWomanSequenceId = 0x34; break; } - _gameSys->insertSequence(_s24_nextWomanSequenceId, 20, _s24_currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s24_nextWomanSequenceId, 20, _s24_currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); _s24_currWomanSequenceId = _s24_nextWomanSequenceId; } - if (!_timers[7]) { - _timers[7] = getRandom(100) + 100; - switch (getRandom(3)) { + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + switch (_vm->getRandom(3)) { case 0: - _gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); break; } } - if (_debugLevel == 4) - updateIdleTimer(); - playSoundA(); + if (_vm->_debugLevel == 4) + _vm->updateIdleTimer(); + _vm->playSoundA(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene24_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene24_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - if (_gnapActionStatus == kASLeaveScene) - _sceneDone = true; - _gnapActionStatus = -1; +void Scene24::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kASLeaveScene) + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; } } diff --git a/engines/gnap/scenes/scene24.h b/engines/gnap/scenes/scene24.h new file mode 100644 index 0000000000..ea6d694d17 --- /dev/null +++ b/engines/gnap/scenes/scene24.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE24_H +#define GNAP_SCENE24_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene24: public Scene { +public: + Scene24(GnapEngine *vm); + ~Scene24() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s24_currWomanSequenceId; + int _s24_nextWomanSequenceId; + int _s24_boySequenceId; + int _s24_girlSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE24_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 0ecb9e530c..2865767a91 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -49,6 +49,7 @@ #include "gnap/scenes/scene21.h" #include "gnap/scenes/scene22.h" #include "gnap/scenes/scene23.h" +#include "gnap/scenes/scene24.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -224,8 +225,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 24: - backgroundId = scene24_init(); - scene24_updateHotspots(); + _scene = new Scene24(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 136, 11, 10); break; @@ -546,7 +548,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 24: - scene24_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From 7479a2b73cfc242b7520c1b7ca42747546cc268b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 12:11:01 +0200 Subject: GNAP: Refactor scenes 25 & 26 --- engines/gnap/gnap.h | 15 -- engines/gnap/scenes/scene25.cpp | 349 +++++++++++++++++++------------------- engines/gnap/scenes/scene25.h | 52 ++++++ engines/gnap/scenes/scene26.cpp | 245 +++++++++++++------------- engines/gnap/scenes/scene26.h | 50 ++++++ engines/gnap/scenes/scenecore.cpp | 18 +- 6 files changed, 409 insertions(+), 320 deletions(-) create mode 100644 engines/gnap/scenes/scene25.h create mode 100644 engines/gnap/scenes/scene26.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index a9389e53a7..a1ce2dc496 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,21 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 25 - int _s25_currTicketVendorSequenceId, _s25_nextTicketVendorSequenceId; - int scene25_init(); - void scene25_updateHotspots(); - void scene25_playAnims(int index); - void scene25_run(); - void scene25_updateAnimations(); - - // Scene 26 - int _s26_currKidSequenceId, _s26_nextKidSequenceId; - int scene26_init(); - void scene26_updateHotspots(); - void scene26_run(); - void scene26_updateAnimations(); - // Scene 27 int _s27_nextJanitorSequenceId; int _s27_currJanitorSequenceId; diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index fe6c7d85ca..4731f72dab 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene25.h" namespace Gnap { @@ -49,127 +50,128 @@ enum { kASLeaveScene = 5 }; -int GnapEngine::scene25_init() { +Scene25::Scene25(GnapEngine *vm) : Scene(vm) { + _s25_currTicketVendorSequenceId = -1; + _s25_nextTicketVendorSequenceId = -1; +} + +int Scene25::init() { return 0x62; } -void GnapEngine::scene25_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSTicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5); - setHotspot(kHSExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10); - setHotspot(kHSExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6); - setHotspot(kHSPosters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - setHotspot(kHSPosters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - setHotspot(kHSPosters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7); - setHotspot(kHSPosters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - setHotspot(kHSWalkArea1, 0, 0, 800, 439); - setHotspot(kHSWalkArea2, 585, 0, 800, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 11; +void Scene25::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSTicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5); + _vm->setHotspot(kHSExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10); + _vm->setHotspot(kHSExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6); + _vm->setHotspot(kHSPosters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHSPosters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHSPosters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7); + _vm->setHotspot(kHSPosters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 439); + _vm->setHotspot(kHSWalkArea2, 585, 0, 800, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; } -void GnapEngine::scene25_playAnims(int index) { - +void Scene25::playAnims(int index) { if (index > 4) return; - hideCursor(); - setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); switch (index) { case 1: - _largeSprite = _gameSys->createSurface(0x25); + _vm->_largeSprite = _vm->_gameSys->createSurface(0x25); break; case 2: - _largeSprite = _gameSys->createSurface(0x26); + _vm->_largeSprite = _vm->_gameSys->createSurface(0x26); break; case 3: - _largeSprite = _gameSys->createSurface(0x27); + _vm->_largeSprite = _vm->_gameSys->createSurface(0x27); break; case 4: - _largeSprite = _gameSys->createSurface(0x28); + _vm->_largeSprite = _vm->_gameSys->createSurface(0x28); break; } - _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); - delayTicksCursor(5); - while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_SPACE) && - !isKeyStatus1(29)) { - gameUpdateTick(); + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->delayTicksCursor(5); + while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && + !_vm->isKeyStatus1(29)) { + _vm->gameUpdateTick(); } - _mouseClickState._left = false; - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(29); - clearKeyStatus1(Common::KEYCODE_SPACE); - _gameSys->removeSpriteDrawItem(_largeSprite, 300); - delayTicksCursor(5); - deleteSurface(&_largeSprite); - showCursor(); + _vm->_mouseClickState._left = false; + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->delayTicksCursor(5); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->showCursor(); } -void GnapEngine::scene25_run() { - playSound(0x10940, true); - - startSoundTimerA(5); +void Scene25::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(5); _s25_currTicketVendorSequenceId = 0x52; - _gameSys->setAnimation(0x52, 39, 3); - _gameSys->insertSequence(_s25_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x52, 39, 3); + _vm->_gameSys->insertSequence(_s25_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _s25_nextTicketVendorSequenceId = -1; - _timers[4] = getRandom(20) + 20; + _vm->_timers[4] = _vm->getRandom(20) + 20; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (_prevSceneNum == 24) { - initGnapPos(5, 11, kDirUpLeft); - initPlatypusPos(6, 11, kDirUnk4); - endSceneInit(); - gnapWalkTo(5, 7, -1, 0x107BA, 1); - platypusWalkTo(6, 7, -1, 0x107C2, 1); + if (_vm->_prevSceneNum == 24) { + _vm->initGnapPos(5, 11, kDirUpLeft); + _vm->initPlatypusPos(6, 11, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 7, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); } else { - initGnapPos(5, 6, kDirBottomRight); - initPlatypusPos(6, 6, kDirNone); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107B9, 1); - platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->initGnapPos(5, 6, kDirBottomRight); + _vm->initPlatypusPos(6, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene25_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_platX, _platY); + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -177,30 +179,30 @@ void GnapEngine::scene25_run() { break; case kHSTicketVendor: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemTickets) { - _gnapActionStatus = kASShowTicketToVendor; - gnapWalkTo(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, - 0, getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, 6, 1); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTickets) { + _vm->_gnapActionStatus = kASShowTicketToVendor; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, + 0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 6, 1); _s25_nextTicketVendorSequenceId = 0x5B; } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 1); - _s25_nextTicketVendorSequenceId = (getRandom(2) == 1) ? 0x59 : 0x56; + _vm->playGnapScratchingHead(6, 1); + _s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSTicketVendor].x, _hotspotsWalkPos[kHSTicketVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkTicketVendor; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkTicketVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -208,30 +210,30 @@ void GnapEngine::scene25_run() { break; case kHSExitOutsideCircusWorld: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 24; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107B4, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 24; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107B4, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); } break; case kHSExitInsideCircusWorld: - if (_gnapActionStatus < 0) { - if (isFlag(kGFNeedleTaken)) { - _isLeavingScene = true; - _newSceneNum = 26; - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFNeedleTaken)) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; } else { - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(4, 5, 0, 0x107BB, 1); - _gnapActionStatus = kASEnterCircusWihoutTicket; - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(4, 5, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASEnterCircusWihoutTicket; + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; } } break; @@ -240,26 +242,26 @@ void GnapEngine::scene25_run() { case kHSPosters2: case kHSPosters3: case kHSPosters4: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapWalkTo(_hotspotsWalkPos[_sceneClickedHotspot].x, _hotspotsWalkPos[_sceneClickedHotspot].y, -1, -1, 1); - if (_sceneClickedHotspot == 5 || _sceneClickedHotspot == 6) - _gnapIdleFacing = kDirUpLeft; - else if (_sceneClickedHotspot == 8) - _gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1); + if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) + _vm->_gnapIdleFacing = kDirUpLeft; + else if (_vm->_sceneClickedHotspot == 8) + _vm->_gnapIdleFacing = kDirBottomRight; else - _gnapIdleFacing = kDirUpRight; - playGnapIdle(0, 0); - scene25_playAnims(8 - _sceneClickedHotspot + 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->playGnapIdle(0, 0); + playAnims(8 - _vm->_sceneClickedHotspot + 1); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - playGnapMoan2(0, 0); + _vm->playGnapMoan2(0, 0); break; } } @@ -268,27 +270,26 @@ void GnapEngine::scene25_run() { case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene25_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _gnapActionStatus == -1) { - _timers[4] = getRandom(20) + 20; - switch (getRandom(13)) { + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(20) + 20; + switch (_vm->getRandom(13)) { case 0: _s25_nextTicketVendorSequenceId = 0x54; break; @@ -321,80 +322,76 @@ void GnapEngine::scene25_run() { break; } } - playSoundA(); + _vm->playSoundA(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene25_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene25_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene25::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASTalkTicketVendor: - _s25_nextTicketVendorSequenceId = (getRandom(2) == 1) ? 0x57 : 0x5F; - _gnapActionStatus = -1; + _s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; + _vm->_gnapActionStatus = -1; break; case kASEnterCircusWihoutTicket: _s25_nextTicketVendorSequenceId = 0x5E; - _gameSys->setAnimation(0x5E, 39, 0); - _gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x5E, 39, 0); + _vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; _s25_nextTicketVendorSequenceId = -1; - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - playGnapIdle(0, 0); - gnapWalkTo(_hotspotsWalkPos[3].x, _hotspotsWalkPos[3].y, -1, 0x107BB, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASEnterCircusWihoutTicketDone; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->playGnapIdle(0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASEnterCircusWihoutTicketDone; break; case kASEnterCircusWihoutTicketDone: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASShowTicketToVendor: - setGrabCursorSprite(-1); - invRemove(kItemTickets); - setFlag(kGFNeedleTaken); - _gameSys->setAnimation(0x61, 40, 0); - _gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = kASShowTicketToVendorDone; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemTickets); + _vm->setFlag(kGFNeedleTaken); + _vm->_gameSys->setAnimation(0x61, 40, 0); + _vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = kASShowTicketToVendorDone; break; case kASShowTicketToVendorDone: _s25_nextTicketVendorSequenceId = 0x53; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_s25_nextTicketVendorSequenceId == 0x53) { - _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; _s25_nextTicketVendorSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } else if (_s25_nextTicketVendorSequenceId != -1) { - _gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; _s25_nextTicketVendorSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene25.h b/engines/gnap/scenes/scene25.h new file mode 100644 index 0000000000..72df792be7 --- /dev/null +++ b/engines/gnap/scenes/scene25.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE25_H +#define GNAP_SCENE25_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene25: public Scene { +public: + Scene25(GnapEngine *vm); + ~Scene25() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s25_currTicketVendorSequenceId; + int _s25_nextTicketVendorSequenceId; + + void playAnims(int index); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE25_H diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp index b446fbb337..a8075963da 100644 --- a/engines/gnap/scenes/scene26.cpp +++ b/engines/gnap/scenes/scene26.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene26.h" namespace Gnap { @@ -42,93 +43,95 @@ enum { kASLeaveScene = 0 }; -int GnapEngine::scene26_init() { - return isFlag(kGFUnk23) ? 0x61 : 0x60; +Scene26::Scene26(GnapEngine *vm) : Scene(vm) { + _s26_currKidSequenceId = -1; + _s26_nextKidSequenceId = -1; } -void GnapEngine::scene26_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10); - setHotspot(kHSExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8); - setHotspot(kHSExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8); - setHotspot(kHSExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8); - setHotspot(kHSExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8); - setHotspot(kHSWalkArea1, 0, 0, 800, 500); - setHotspot(kHSWalkArea2, 281, 0, 800, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 9; +int Scene26::init() { + return _vm->isFlag(kGFUnk23) ? 0x61 : 0x60; } -void GnapEngine::scene26_run() { - - startSoundTimerB(7); - playSound(0x1093B, true); +void Scene26::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10); + _vm->setHotspot(kHSExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8); + _vm->setHotspot(kHSExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8); + _vm->setHotspot(kHSExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8); + _vm->setHotspot(kHSExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 500); + _vm->setHotspot(kHSWalkArea2, 281, 0, 800, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; +} + +void Scene26::run() { + _vm->startSoundTimerB(7); + _vm->playSound(0x1093B, true); _s26_currKidSequenceId = 0x5B; _s26_nextKidSequenceId = -1; - _gameSys->setAnimation(0x5B, 160, 3); - _gameSys->insertSequence(_s26_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x5B, 160, 3); + _vm->_gameSys->insertSequence(_s26_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); - _timers[5] = getRandom(20) + 50; - _timers[4] = getRandom(20) + 50; - _timers[6] = getRandom(50) + 100; + _vm->_timers[5] = _vm->getRandom(20) + 50; + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_timers[6] = _vm->getRandom(50) + 100; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - _gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); - if (_prevSceneNum == 25) { - initGnapPos(-1, 8, kDirBottomRight); - initPlatypusPos(-2, 8, kDirNone); - endSceneInit(); - gnapWalkTo(2, 8, -1, 0x107B9, 1); - platypusWalkTo(1, 8, -1, 0x107C2, 1); + if (_vm->_prevSceneNum == 25) { + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } else { - initGnapPos(2, 8, kDirBottomRight); - initPlatypusPos(3, 8, kDirNone); - endSceneInit(); + _vm->initGnapPos(2, 8, kDirBottomRight); + _vm->initPlatypusPos(3, 8, kDirNone); + _vm->endSceneInit(); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene26_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -136,117 +139,113 @@ void GnapEngine::scene26_run() { break; case kHSExitOutsideCircusWorld: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 25; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 25; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; } break; case kHSExitOutsideClown: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 27; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; } break; case kHSExitArcade: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 29; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitArcade].y, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 29; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitArcade].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; } break; case kHSExitElephant: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 30; - gnapWalkTo(-1, _hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _gnapActionStatus = kASLeaveScene; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 30; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLeaveScene; } break; case kHSExitBeerStand: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 31; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107BB, 1); - _gnapActionStatus = kASLeaveScene; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 31; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASLeaveScene; } break; case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene26_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, true); + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[5] && _s26_nextKidSequenceId == -1) { - _timers[5] = getRandom(20) + 50; - if (getRandom(5) != 0) + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5] && _s26_nextKidSequenceId == -1) { + _vm->_timers[5] = _vm->getRandom(20) + 50; + if (_vm->getRandom(5) != 0) _s26_nextKidSequenceId = 0x5B; else _s26_nextKidSequenceId = 0x5A; } - if (!_timers[4]) { - _timers[4] = getRandom(20) + 130; - _gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 130; + _vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[6]) { - _timers[6] = getRandom(50) + 100; - _gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(50) + 100; + _vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); } - playSoundB(); + _vm->playSoundB(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene26_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene26_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - if (_gnapActionStatus == kASLeaveScene) - _sceneDone = true; - _gnapActionStatus = -1; +void Scene26::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kASLeaveScene) + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s26_nextKidSequenceId != -1) { - _gameSys->insertSequence(_s26_nextKidSequenceId, 160, _s26_currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s26_nextKidSequenceId, 160, 3); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s26_nextKidSequenceId != -1) { + _vm->_gameSys->insertSequence(_s26_nextKidSequenceId, 160, _s26_currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s26_nextKidSequenceId, 160, 3); _s26_currKidSequenceId = _s26_nextKidSequenceId; _s26_nextKidSequenceId = -1; } diff --git a/engines/gnap/scenes/scene26.h b/engines/gnap/scenes/scene26.h new file mode 100644 index 0000000000..a29b0d8469 --- /dev/null +++ b/engines/gnap/scenes/scene26.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE26_H +#define GNAP_SCENE26_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene26: public Scene { +public: + Scene26(GnapEngine *vm); + ~Scene26() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s26_currKidSequenceId; + int _s26_nextKidSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE26_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 2865767a91..a7d5ab039c 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -50,6 +50,8 @@ #include "gnap/scenes/scene22.h" #include "gnap/scenes/scene23.h" #include "gnap/scenes/scene24.h" +#include "gnap/scenes/scene25.h" +#include "gnap/scenes/scene26.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -232,14 +234,16 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 136, 11, 10); break; case 25: - backgroundId = scene25_init(); - scene25_updateHotspots(); + _scene = new Scene25(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; case 26: - backgroundId = scene26_init(); - scene26_updateHotspots(); + _scene = new Scene26(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -554,12 +558,14 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 25: - scene25_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; case 26: - scene26_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From 367a10bdbd7710ca8bbb439df8173d1456221fd4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 12:22:10 +0200 Subject: GNAP: Refactor scene 27 --- engines/gnap/gnap.h | 8 - engines/gnap/scenes/scene27.cpp | 401 +++++++++++++++++++------------------- engines/gnap/scenes/scene27.h | 50 +++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 256 insertions(+), 212 deletions(-) create mode 100644 engines/gnap/scenes/scene27.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index a1ce2dc496..627ee59f86 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,14 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 27 - int _s27_nextJanitorSequenceId; - int _s27_currJanitorSequenceId; - int scene27_init(); - void scene27_updateHotspots(); - void scene27_run(); - void scene27_updateAnimations(); - // Scene 28 int _s28_currClownSequenceId, _s28_nextClownSequenceId; int _s28_clownTalkCtr; diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 881007e634..c2c32983b4 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -23,12 +23,13 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene27.h" namespace Gnap { enum { kHSPlatypus = 0, - kHSJanitor = 1, + kHSJanitor = 1, kHSDevice = 2, kHSBucket = 3, kHSExitCircus = 4, @@ -49,114 +50,115 @@ enum { kASLeaveScene = 7 }; -int GnapEngine::scene27_init() { +Scene27::Scene27(GnapEngine *vm) : Scene(vm) { + _s27_nextJanitorSequenceId = -1; + _s27_currJanitorSequenceId = -1; +} + +int Scene27::init() { return 0xD5; } -void GnapEngine::scene27_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSJanitor, 488, 204, 664, 450, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 8); - setHotspot(kHSBucket, 129, 406, 186, 453, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 6); - setHotspot(kHSExitCircus, 200, 585, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitArcade, 0, 0, 15, 600, SF_EXIT_L_CURSOR, 0, 6); - setHotspot(kHSExitBeerStand, 785, 0, 800, 600, SF_EXIT_R_CURSOR, 11, 7); - setHotspot(kHSExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); - setHotspot(kHSWalkArea1, 0, 0, 800, 507); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFUnk13)) - _hotspots[kHSBucket]._flags = SF_DISABLED; - _hotspotsCount = 9; +void Scene27::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSJanitor, 488, 204, 664, 450, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 8); + _vm->setHotspot(kHSBucket, 129, 406, 186, 453, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 6); + _vm->setHotspot(kHSExitCircus, 200, 585, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitArcade, 0, 0, 15, 600, SF_EXIT_L_CURSOR, 0, 6); + _vm->setHotspot(kHSExitBeerStand, 785, 0, 800, 600, SF_EXIT_R_CURSOR, 11, 7); + _vm->setHotspot(kHSExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 507); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk13)) + _vm->_hotspots[kHSBucket]._flags = SF_DISABLED; + _vm->_hotspotsCount = 9; } -void GnapEngine::scene27_run() { - - playSound(0x1093B, true); - startSoundTimerB(4); - _timers[7] = getRandom(100) + 300; - queueInsertDeviceIcon(); +void Scene27::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(4); + _vm->_timers[7] = _vm->getRandom(100) + 300; + _vm->queueInsertDeviceIcon(); - if (!isFlag(kGFUnk13)) - _gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFUnk13)) + _vm->_gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); - if (_debugLevel == 4) - startIdleTimer(6); + if (_vm->_debugLevel == 4) + _vm->startIdleTimer(6); - _gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); _s27_currJanitorSequenceId = 0xCB; _s27_nextJanitorSequenceId = -1; - _gameSys->setAnimation(0xCB, 39, 3); - - _timers[5] = getRandom(20) + 60; + _vm->_gameSys->setAnimation(0xCB, 39, 3); + _vm->_timers[5] = _vm->getRandom(20) + 60; - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 26: - initGnapPos(7, 12, kDirBottomRight); - initPlatypusPos(6, 12, kDirNone); - endSceneInit(); - gnapWalkTo(7, 8, -1, 0x107B9, 1); - platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); break; case 29: - initGnapPos(-1, 8, kDirBottomRight); - initPlatypusPos(-1, 9, kDirNone); - endSceneInit(); - gnapWalkTo(3, 8, -1, 0x107B9, 1); - platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-1, 9, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 31: - initGnapPos(12, 8, kDirBottomLeft); - initPlatypusPos(12, 9, kDirUnk4); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(8, 9, -1, 0x107C2, 1); + _vm->initGnapPos(12, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); break; default: - initGnapPos(6, 8, kDirBottomRight); - initPlatypusPos(5, 9, kDirNone); - endSceneInit(); + _vm->initGnapPos(6, 8, kDirBottomRight); + _vm->initPlatypusPos(5, 9, kDirNone); + _vm->endSceneInit(); break; } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); - _sceneClickedHotspot = -1; - if (_gnapActionStatus < 0) - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->_sceneClickedHotspot = -1; + if (_vm->_gnapActionStatus < 0) + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene27_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -164,26 +166,26 @@ void GnapEngine::scene27_run() { break; case kHSJanitor: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemPicture) { - _gnapIdleFacing = kDirUpLeft; - if (gnapWalkTo(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 0, 0x107BC, 1)) - _gnapActionStatus = kASShowPictureToJanitor; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 7, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemPicture) { + _vm->_gnapIdleFacing = kDirUpLeft; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 0, 0x107BC, 1)) + _vm->_gnapActionStatus = kASShowPictureToJanitor; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 7, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 3); + _vm->playGnapScratchingHead(6, 3); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSJanitor].x, _hotspotsWalkPos[kHSJanitor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkJanitor; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkJanitor; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -191,22 +193,22 @@ void GnapEngine::scene27_run() { break; case kHSBucket: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 3, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 3, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(3, 3); + _vm->playGnapScratchingHead(3, 3); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBucket].x, _hotspotsWalkPos[kHSBucket].y) | 0x10000, 1); - _gnapActionStatus = kASGrabBucket; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBucket].x, _vm->_hotspotsWalkPos[kHSBucket].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabBucket; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -214,115 +216,112 @@ void GnapEngine::scene27_run() { break; case kHSExitCircus: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 26; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C7, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C7, 1); } break; case kHSExitArcade: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 29; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitArcade].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitArcade].x, _hotspotsWalkPos[kHSExitArcade].y + 1, -1, 0x107CF, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 29; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitArcade].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitArcade].x, _vm->_hotspotsWalkPos[kHSExitArcade].y + 1, -1, 0x107CF, 1); } break; case kHSExitBeerStand: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 31; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitBeerStand].x, _hotspotsWalkPos[kHSExitBeerStand].y + 1, -1, 0x107CD, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 31; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBeerStand].x, _vm->_hotspotsWalkPos[kHSExitBeerStand].y + 1, -1, 0x107CD, 1); } break; case kHSExitClown: - if (_gnapActionStatus < 0) { - if (isFlag(kGFPlatypus)) { - _isLeavingScene = true; - _newSceneNum = 28; - gnapWalkTo(_hotspotsWalkPos[kHSExitClown].x, _hotspotsWalkPos[kHSExitClown].y, 0, 0x107AD, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitClown].x + 1, _hotspotsWalkPos[kHSExitClown].y, -1, 0x107C4, 1); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatypus)) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 28; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x, _vm->_hotspotsWalkPos[kHSExitClown].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x + 1, _vm->_hotspotsWalkPos[kHSExitClown].y, -1, 0x107C4, 1); } else { - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSExitClown].x, 7, 0, 0x107BC, 1); - _hotspots[kHSWalkArea1]._flags &= SF_WALKABLE; - _gnapActionStatus = kASTryEnterClownTent; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x, 7, 0, 0x107BC, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= SF_WALKABLE; + _vm->_gnapActionStatus = kASTryEnterClownTent; } } break; case kHSWalkArea1: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene27_updateAnimations(); - - if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, true); - - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (_debugLevel == 4) - updateIdleTimer(); - if (!_timers[5]) { - _timers[5] = getRandom(20) + 60; - if (_gnapActionStatus < 0) { - if (getRandom(3) != 0) + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_debugLevel == 4) + _vm->updateIdleTimer(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(3) != 0) _s27_nextJanitorSequenceId = 0xCB; else _s27_nextJanitorSequenceId = 0xCF; } } - if (!_timers[7]) { - _timers[7] = getRandom(100) + 300; - if (_gnapActionStatus < 0) - _gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); } - playSoundB(); + _vm->playSoundB(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene27_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - - gameUpdateTick(); + _vm->gameUpdateTick(); } - } -void GnapEngine::scene27_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene27::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASTalkJanitor: - switch (getRandom(3)) { + switch (_vm->getRandom(3)) { case 0: _s27_nextJanitorSequenceId = 0xCC; break; @@ -335,83 +334,83 @@ void GnapEngine::scene27_updateAnimations() { } break; case kASGrabBucket: - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _hotspots[kHSBucket]._flags = SF_DISABLED; - invAdd(kItemEmptyBucket); - setFlag(kGFUnk13); - _gameSys->setAnimation(0xD2, 39, 0); - _gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASGrabBucketDone; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_hotspots[kHSBucket]._flags = SF_DISABLED; + _vm->invAdd(kItemEmptyBucket); + _vm->setFlag(kGFUnk13); + _vm->_gameSys->setAnimation(0xD2, 39, 0); + _vm->_gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASGrabBucketDone; break; case kASGrabBucketDone: - setGrabCursorSprite(kItemEmptyBucket); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemEmptyBucket); + _vm->_gnapActionStatus = -1; break; case kASShowPictureToJanitor: _s27_nextJanitorSequenceId = 0xD0; break; case kASTryEnterClownTent: _s27_nextJanitorSequenceId = 0xD1; - _gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; _s27_nextJanitorSequenceId = -1; - _gnapActionStatus = kASTryEnterClownTentDone; + _vm->_gnapActionStatus = kASTryEnterClownTentDone; break; case kASTryEnterClownTentDone: - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _gnapActionStatus = -1; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = -1; break; case kASEnterClownTent: - gnapWalkTo(_gnapX, _gnapY, 0, 0x107B2, 1); - _gnapActionStatus = kASLeaveScene; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kASLeaveScene; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_s27_nextJanitorSequenceId) { case -1: _s27_nextJanitorSequenceId = 0xCB; - _gameSys->insertSequence(0xCB, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(0xCB, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; _s27_nextJanitorSequenceId = -1; break; case 0xCC: case 0xCD: case 0xCE: - _gnapActionStatus = -1; - _gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; _s27_nextJanitorSequenceId = -1; break; case 0xD0: // Show picture to janitor - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); - _gnapActionStatus = kASEnterClownTent; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); + _vm->_gnapActionStatus = kASEnterClownTent; _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; _s27_nextJanitorSequenceId = -1; - setFlag(kGFPlatypus); - setGrabCursorSprite(-1); - invRemove(kItemPicture); - _newSceneNum = 28; + _vm->setFlag(kGFPlatypus); + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemPicture); + _vm->_newSceneNum = 28; break; default: - _gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; _s27_nextJanitorSequenceId = -1; break; diff --git a/engines/gnap/scenes/scene27.h b/engines/gnap/scenes/scene27.h new file mode 100644 index 0000000000..9ee00538bc --- /dev/null +++ b/engines/gnap/scenes/scene27.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE27_H +#define GNAP_SCENE27_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene27: public Scene { +public: + Scene27(GnapEngine *vm); + ~Scene27() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s27_nextJanitorSequenceId; + int _s27_currJanitorSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE27_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index a7d5ab039c..0198eb573b 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -52,6 +52,7 @@ #include "gnap/scenes/scene24.h" #include "gnap/scenes/scene25.h" #include "gnap/scenes/scene26.h" +#include "gnap/scenes/scene27.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -248,8 +249,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 27: - backgroundId = scene27_init(); - scene27_updateHotspots(); + _scene = new Scene27(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -570,7 +572,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 27: - scene27_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From 2e37c2b9e67b5196cf014aaa57e785289ec09348 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 13:16:59 +0200 Subject: GNAP: Refactor scene 28 --- engines/gnap/gnap.h | 8 - engines/gnap/scenes/scene28.cpp | 446 +++++++++++++++++++------------------- engines/gnap/scenes/scene28.h | 51 +++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 280 insertions(+), 234 deletions(-) create mode 100644 engines/gnap/scenes/scene28.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 627ee59f86..aa0b3097b4 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,14 +606,6 @@ public: // Scene 18 int _s18_garbageCanPos; - // Scene 28 - int _s28_currClownSequenceId, _s28_nextClownSequenceId; - int _s28_clownTalkCtr; - int scene28_init(); - void scene28_updateHotspots(); - void scene28_run(); - void scene28_updateAnimations(); - // Scene 29 int _s28_currMonkeySequenceId, _s28_nextMonkeySequenceId; int _s28_currManSequenceId, _s28_nextManSequenceId; diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp index 93723e65f6..ac55d90f01 100644 --- a/engines/gnap/scenes/scene28.cpp +++ b/engines/gnap/scenes/scene28.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene28.h" namespace Gnap { @@ -51,108 +52,112 @@ enum { kASLeaveScene = 10 }; -int GnapEngine::scene28_init() { +Scene28::Scene28(GnapEngine *vm) : Scene(vm) { + _s28_currClownSequenceId = -1; + _s28_nextClownSequenceId = -1; + _s28_clownTalkCtr = 0; +} + +int Scene28::init() { return 0x125; } -void GnapEngine::scene28_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); - setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); - setHotspot(kHSEmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); - setHotspot(kHSWalkArea1, 0, 0, 799, 523); - setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (invHas(kItemHorn)) - _hotspots[kHSHorn]._flags = SF_DISABLED; - if (isFlag(kGFUnk22)) - _hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _hotspotsCount = 8; +void Scene28::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + _vm->setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); + _vm->setHotspot(kHSEmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 799, 523); + _vm->setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->invHas(kItemHorn)) + _vm->_hotspots[kHSHorn]._flags = SF_DISABLED; + if (_vm->isFlag(kGFUnk22)) + _vm->_hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 8; } -void GnapEngine::scene28_run() { - playSound(0x1093C, true); +void Scene28::run() { + _vm->playSound(0x1093C, true); _s28_nextClownSequenceId = -1; - queueInsertDeviceIcon(); - _gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFUnk22)) - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFUnk22)) + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFMudTaken)) { - if (isFlag(kGFUnk21)) { - _gameSys->setAnimation(0x11C, 39, 3); - _gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); - if (!invHas(kItemHorn)) - _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFMudTaken)) { + if (_vm->isFlag(kGFUnk21)) { + _vm->_gameSys->setAnimation(0x11C, 39, 3); + _vm->_gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->invHas(kItemHorn)) + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); _s28_currClownSequenceId = 0x11C; } else { _s28_currClownSequenceId = 0x11B; - _gameSys->setAnimation(0x11B, 39, 3); - _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); - _timers[4] = getRandom(20) + 80; + _vm->_gameSys->setAnimation(0x11B, 39, 3); + _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(20) + 80; } - initGnapPos(8, 8, kDirBottomLeft); - initPlatypusPos(9, 8, kDirUnk4); - endSceneInit(); + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); } else { - _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - initGnapPos(8, 8, kDirBottomLeft); - initPlatypusPos(9, 8, kDirUnk4); - endSceneInit(); - playSequences(0xF7, 0x121, 0x122, 0x123); + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->playSequences(0xF7, 0x121, 0x122, 0x123); _s28_currClownSequenceId = 0x115; - setFlag(kGFMudTaken); - _gameSys->setAnimation(0x115, 39, 3); - _gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFMudTaken); + _vm->_gameSys->setAnimation(0x115, 39, 3); + _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _s28_nextClownSequenceId = -1; - _timers[4] = getRandom(20) + 80; - _gnapActionStatus = kASGnapWaiting; - while (_gameSys->getAnimationStatus(3) != 2) { - gameUpdateTick(); - updateMouseCursor(); + _vm->_timers[4] = _vm->getRandom(20) + 80; + _vm->_gnapActionStatus = kASGnapWaiting; + while (_vm->_gameSys->getAnimationStatus(3) != 2) { + _vm->gameUpdateTick(); + _vm->updateMouseCursor(); } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene28_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -160,32 +165,32 @@ void GnapEngine::scene28_run() { break; case kHSHorn: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(2, 8, 3, 4); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(2, 8, 3, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(2, 4); + _vm->playGnapScratchingHead(2, 4); break; case GRAB_CURSOR: - if (isFlag(kGFUnk21)) { - if (!invHas(kItemHorn)) { - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); - _gnapActionStatus = kASGrabHornSuccess; + if (_vm->isFlag(kGFUnk21)) { + if (!_vm->invHas(kItemHorn)) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabHornSuccess; } } else { - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(2, 8, 0, 0x107BB, 1); - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSHorn].x, _hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASGrabHornFails; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASGrabHornFails; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -193,39 +198,39 @@ void GnapEngine::scene28_run() { break; case kHSClown: - if (_gnapActionStatus < 0) { - if (isFlag(kGFUnk21)) { - if (_verbCursor == LOOK_CURSOR) - playGnapScratchingHead(5, 2); + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk21)) { + if (_vm->_verbCursor == LOOK_CURSOR) + _vm->playGnapScratchingHead(5, 2); else - playGnapImpossible(0, 0); - } else if (_grabCursorSpriteIndex == kItemBucketWithBeer) { - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gnapActionStatus = kASUseBeerBucketWithClown; - } else if (_grabCursorSpriteIndex == kItemBucketWithPill) { - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gnapActionStatus = kASUsePillBucketWithClown; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSClown].x, _hotspotsWalkPos[kHSClown].y, 2, 4); + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kASUseBeerBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kASUsePillBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 2, 4); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(5, 2); + _vm->playGnapScratchingHead(5, 2); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkClown; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkClown; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -233,35 +238,35 @@ void GnapEngine::scene28_run() { break; case kHSExitOutsideClown: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 27; - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); - _gnapActionStatus = kASLeaveScene; - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); } break; case kHSEmptyBucket: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 8, 6); - } else if (isFlag(kGFUnk21)) { - playGnapImpossible(8, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); + } else if (_vm->isFlag(kGFUnk21)) { + _vm->playGnapImpossible(8, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(8, 6); + _vm->playGnapScratchingHead(8, 6); break; case GRAB_CURSOR: - gnapWalkTo(_gnapX, _gnapY, 0, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSEmptyBucket].x, _hotspotsWalkPos[kHSEmptyBucket].y) | 0x10000, 1); - _gnapActionStatus = kASGrabEmptyBucket; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSEmptyBucket].x, _vm->_hotspotsWalkPos[kHSEmptyBucket].y) | 0x10000, 1); + _vm->_gnapActionStatus = kASGrabEmptyBucket; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -270,114 +275,110 @@ void GnapEngine::scene28_run() { case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene28_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1093C)) - playSound(0x1093C, true); + if (!_vm->isSoundPlaying(0x1093C)) + _vm->playSound(0x1093C, true); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(20) + 80; - if (_gnapActionStatus < 0 && !isFlag(kGFUnk21)) + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 80; + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFUnk21)) _s28_nextClownSequenceId = 0x114; } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene28_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene28_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene28::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASUseBeerBucketWithClown: - setFlag(kGFUnk22); + _vm->setFlag(kGFUnk22); _s28_nextClownSequenceId = 0x113; - invRemove(kItemBucketWithBeer); - scene28_updateHotspots(); + _vm->invRemove(kItemBucketWithBeer); + updateHotspots(); break; case kASUsePillBucketWithClown: _s28_nextClownSequenceId = 0x116; - invRemove(kItemBucketWithPill); - setFlag(kGFUnk22); - setFlag(kGFUnk21); - scene28_updateHotspots(); + _vm->invRemove(kItemBucketWithPill); + _vm->setFlag(kGFUnk22); + _vm->setFlag(kGFUnk21); + updateHotspots(); break; case kASGrabHornFails: _s28_nextClownSequenceId = 0x119; break; case kASGrabHornSuccess: - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x117, 59, 0); - _gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASGrabHornSuccessDone; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x117, 59, 0); + _vm->_gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASGrabHornSuccessDone; break; case kASGrabHornSuccessDone: - hideCursor(); - setGrabCursorSprite(-1); - addFullScreenSprite(0xF6, 255); - _gameSys->setAnimation(0x120, 256, 0); - _gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - removeFullScreenSprite(); - showCursor(); - setGrabCursorSprite(kItemHorn); - invAdd(kItemHorn); - scene28_updateHotspots(); - _gnapActionStatus = -1; + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0xF6, 255); + _vm->_gameSys->setAnimation(0x120, 256, 0); + _vm->_gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemHorn); + _vm->invAdd(kItemHorn); + updateHotspots(); + _vm->_gnapActionStatus = -1; break; case kASGrabEmptyBucket: - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gameSys->setAnimation(0x111, 99, 0); - _gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASGrabEmptyBucketDone; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x111, 99, 0); + _vm->_gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASGrabEmptyBucketDone; break; case kASGrabEmptyBucketDone: - setGrabCursorSprite(kItemEmptyBucket); - clearFlag(kGFUnk22);; - scene28_updateHotspots(); - invAdd(kItemEmptyBucket); - _gnapActionStatus = -1; + _vm->setGrabCursorSprite(kItemEmptyBucket); + _vm->clearFlag(kGFUnk22);; + updateHotspots(); + _vm->invAdd(kItemEmptyBucket); + _vm->_gnapActionStatus = -1; break; case kASGrabHornFailsDone: - _gameSys->insertSequence(0x107B5, _gnapId, 281, 39, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; - _gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _s28_currClownSequenceId = 0x11B; _s28_nextClownSequenceId = -1; - _gnapActionStatus = -1; - gnapWalkTo(2, 8, -1, 0x107BB, 1); + _vm->_gnapActionStatus = -1; + _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); break; case kASTalkClown: _s28_clownTalkCtr = (_s28_clownTalkCtr + 1) % 2; @@ -389,60 +390,59 @@ void GnapEngine::scene28_updateAnimations() { _s28_nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? break; case kASGnapWaiting: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_s28_nextClownSequenceId) { case 0x113: - setGrabCursorSprite(-1); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x11B, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11B, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); _s28_currClownSequenceId = 0x11B; _s28_nextClownSequenceId = -1; - _gnapActionStatus = kASGnapWaiting; + _vm->_gnapActionStatus = kASGnapWaiting; break; case 0x116: - setGrabCursorSprite(-1); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x11C, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11C, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); _s28_currClownSequenceId = _s28_nextClownSequenceId; _s28_nextClownSequenceId = -1; - _gnapActionStatus = kASGnapWaiting; + _vm->_gnapActionStatus = kASGnapWaiting; break; case 0x11D: case 0x11E: case 0x11F: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case 0x119: - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _gameSys->removeSequence(_s28_currClownSequenceId, 39, true); - _gnapActionStatus = kASGrabHornFailsDone; - _gnapSequenceId = _s28_nextClownSequenceId; - _gnapSequenceDatNum = 0; + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); + _vm->_gameSys->removeSequence(_s28_currClownSequenceId, 39, true); + _vm->_gnapActionStatus = kASGrabHornFailsDone; + _vm->_gnapSequenceId = _s28_nextClownSequenceId; + _vm->_gnapSequenceDatNum = 0; _s28_nextClownSequenceId = -1; break; } if (_s28_nextClownSequenceId != -1) { - _gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextClownSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 3); _s28_currClownSequenceId = _s28_nextClownSequenceId; _s28_nextClownSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene28.h b/engines/gnap/scenes/scene28.h new file mode 100644 index 0000000000..40fa93b15a --- /dev/null +++ b/engines/gnap/scenes/scene28.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE28_H +#define GNAP_SCENE28_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene28: public Scene { +public: + Scene28(GnapEngine *vm); + ~Scene28() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s28_currClownSequenceId; + int _s28_nextClownSequenceId; + int _s28_clownTalkCtr; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE28_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 0198eb573b..25a2f7df50 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -53,6 +53,7 @@ #include "gnap/scenes/scene25.h" #include "gnap/scenes/scene26.h" #include "gnap/scenes/scene27.h" +#include "gnap/scenes/scene28.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -256,8 +257,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 28: - backgroundId = scene28_init(); - scene28_updateHotspots(); + _scene = new Scene28(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -578,7 +580,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 28: - scene28_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From 093c58a397c3b97fd4175b33428849c9716cb7af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Apr 2016 19:34:42 +0200 Subject: GNAP: Refactor scene 29 --- engines/gnap/gnap.h | 10 +- engines/gnap/scenes/scene29.cpp | 316 +++++++++++++++++++------------------- engines/gnap/scenes/scene29.h | 52 +++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 218 insertions(+), 169 deletions(-) create mode 100644 engines/gnap/scenes/scene29.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index aa0b3097b4..37099b770b 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -603,17 +603,9 @@ public: void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); - // Scene 18 + // Shared by scenes 17 & 18 int _s18_garbageCanPos; - // Scene 29 - int _s28_currMonkeySequenceId, _s28_nextMonkeySequenceId; - int _s28_currManSequenceId, _s28_nextManSequenceId; - int scene29_init(); - void scene29_updateHotspots(); - void scene29_run(); - void scene29_updateAnimations(); - // Scene 30 int _s30_kidSequenceId; int scene30_init(); diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 3528141de4..0f64304272 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene29.h" namespace Gnap { @@ -41,100 +42,104 @@ enum { kASLeaveScene = 2 }; -int GnapEngine::scene29_init() { +Scene29::Scene29(GnapEngine *vm) : Scene(vm) { + _s28_currMonkeySequenceId = -1; + _s28_nextMonkeySequenceId = -1; + _s28_currManSequenceId = -1; + _s28_nextManSequenceId = -1; +} + +int Scene29::init() { return 0xF6; } -void GnapEngine::scene29_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSMonkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); - setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); - setHotspot(kHSAracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - setHotspot(kHSWalkArea1, 0, 0, 800, 478); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (invHas(kItemHorn)) - _hotspots[kHSMonkey]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _hotspotsCount = 7; +void Scene29::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSMonkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); + _vm->setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); + _vm->setHotspot(kHSAracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 478); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->invHas(kItemHorn)) + _vm->_hotspots[kHSMonkey]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 7; } -void GnapEngine::scene29_run() { - - playSound(0x1093B, true); - startSoundTimerB(6); - queueInsertDeviceIcon(); +void Scene29::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); + _vm->queueInsertDeviceIcon(); - if (invHas(kItemHorn)) { + if (_vm->invHas(kItemHorn)) { _s28_currMonkeySequenceId = 0xE8; _s28_nextMonkeySequenceId = -1; - _gameSys->setAnimation(0xE8, 159, 4); - _gameSys->insertSequence(_s28_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0xE8, 159, 4); + _vm->_gameSys->insertSequence(_s28_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); _s28_currManSequenceId = 0xED; _s28_nextManSequenceId = -1; - _gameSys->setAnimation(0xED, 39, 3); - _timers[4] = getRandom(20) + 60; + _vm->_gameSys->setAnimation(0xED, 39, 3); + _vm->_timers[4] = _vm->getRandom(20) + 60; } else { - _gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0, 0, 4); - _gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 3); } - _gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); - if (_prevSceneNum == 27) { - initGnapPos(12, 7, kDirBottomRight); - initPlatypusPos(12, 8, kDirNone); - endSceneInit(); - gnapWalkTo(8, 7, -1, 0x107B9, 1); - platypusWalkTo(8, 8, -1, 0x107C2, 1); + if (_vm->_prevSceneNum == 27) { + _vm->initGnapPos(12, 7, kDirBottomRight); + _vm->initPlatypusPos(12, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { - initGnapPos(-1, 7, kDirBottomRight); - initPlatypusPos(-2, 7, kDirNone); - endSceneInit(); - gnapWalkTo(2, 7, -1, 0x107B9, 1); - platypusWalkTo(1, 7, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene29_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -142,27 +147,27 @@ void GnapEngine::scene29_run() { break; case kHSMonkey: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemBanana) { - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASUseBananaWithMonkey; - _newSceneNum = 51; - _isLeavingScene = true; - setGrabCursorSprite(-1); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y, 5, 6); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemBanana) { + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASUseBananaWithMonkey; + _vm->_newSceneNum = 51; + _vm->_isLeavingScene = true; + _vm->setGrabCursorSprite(-1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y, 5, 6); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(5, 6); + _vm->playGnapScratchingHead(5, 6); break; case TALK_CURSOR: - playGnapBrainPulsating(_hotspotsWalkPos[kHSMonkey].x, _hotspotsWalkPos[kHSMonkey].y); + _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y); break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -170,45 +175,45 @@ void GnapEngine::scene29_run() { break; case kHSExitCircus: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 26; - gnapWalkTo(_hotspotsWalkPos[kHSExitCircus].x, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); } break; case kHSExitOutsideClown: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 27; - gnapWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y - 1, -1, 0x107CD, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y - 1, -1, 0x107CD, 1); } break; case kHSAracde: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - setGrabCursorSprite(-1); - _isLeavingScene = true; - _newSceneNum = 52; - gnapWalkTo(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y, 0, -1, 1); - playGnapIdle(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y); - _gnapActionStatus = kASLeaveScene; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSAracde].x, _hotspotsWalkPos[kHSAracde].y, 2, 3); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->setGrabCursorSprite(-1); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 52; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y); + _vm->_gnapActionStatus = kASLeaveScene; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y, 2, 3); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan2(0, 0); + _vm->playGnapMoan2(0, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -216,33 +221,33 @@ void GnapEngine::scene29_run() { break; case kHSWalkArea1: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene29_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, true); + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); - if (!_isLeavingScene) { - if (_gnapActionStatus < 0) { - updateGnapIdleSequence(); - updatePlatypusIdleSequence(); + if (!_vm->_isLeavingScene) { + if (_vm->_gnapActionStatus < 0) { + _vm->updateGnapIdleSequence(); + _vm->updatePlatypusIdleSequence(); } - if (!_timers[4]) { - if (invHas(kItemHorn)) { - _timers[4] = getRandom(20) + 60; - if (_gnapActionStatus < 0) { - switch (getRandom(5)) { + if (!_vm->_timers[4]) { + if (_vm->invHas(kItemHorn)) { + _vm->_timers[4] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0) { + switch (_vm->getRandom(5)) { case 0: _s28_nextManSequenceId = 0xED; break; @@ -262,64 +267,61 @@ void GnapEngine::scene29_run() { } } } - playSoundB(); + _vm->playSoundB(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene29_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - - } - + _vm->gameUpdateTick(); + } } -void GnapEngine::scene29_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene29::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASUseBananaWithMonkey: _s28_nextMonkeySequenceId = 0xE5; break; case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; } } - if (_gameSys->getAnimationStatus(3) == 2 && _s28_nextManSequenceId != -1) { - _gameSys->insertSequence(_s28_nextManSequenceId, 39, _s28_currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextManSequenceId, 39, 3); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s28_nextManSequenceId != -1) { + _vm->_gameSys->insertSequence(_s28_nextManSequenceId, 39, _s28_currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s28_nextManSequenceId, 39, 3); _s28_currManSequenceId = _s28_nextManSequenceId; _s28_nextManSequenceId = -1; } - if (_gameSys->getAnimationStatus(4) == 2) { + if (_vm->_gameSys->getAnimationStatus(4) == 2) { if (_s28_nextMonkeySequenceId == 0xE5) { - _gameSys->insertSequence(0xF2, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0xF2; - _gameSys->setAnimation(0xE6, 159, 0); - _gameSys->setAnimation(0, 159, 4); - _gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xE6, 159, _s28_nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = kASLeaveScene; + _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0xF2; + _vm->_gameSys->setAnimation(0xE6, 159, 0); + _vm->_gameSys->setAnimation(0, 159, 4); + _vm->_gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xE6, 159, _s28_nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kASLeaveScene; _s28_currMonkeySequenceId = 0xE6; _s28_nextMonkeySequenceId = -1; - _timers[5] = 30; - while (_timers[5]) - gameUpdateTick(); - platypusWalkTo(0, 8, 1, 0x107CF, 1); - while (_gameSys->getAnimationStatus(1) != 2) - gameUpdateTick(); + _vm->_timers[5] = 30; + while (_vm->_timers[5]) + _vm->gameUpdateTick(); + _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); } else if (_s28_nextMonkeySequenceId == -1) { - switch (getRandom(6)) { + switch (_vm->getRandom(6)) { case 0: _s28_nextMonkeySequenceId = 0xE8; break; @@ -339,13 +341,13 @@ void GnapEngine::scene29_updateAnimations() { _s28_nextMonkeySequenceId = 0xE7; break; } - _gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); + _vm->_gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); _s28_currMonkeySequenceId = _s28_nextMonkeySequenceId; _s28_nextMonkeySequenceId = -1; } else { - _gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); + _vm->_gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); _s28_currMonkeySequenceId = _s28_nextMonkeySequenceId; _s28_nextMonkeySequenceId = -1; } diff --git a/engines/gnap/scenes/scene29.h b/engines/gnap/scenes/scene29.h new file mode 100644 index 0000000000..1b9e2c3408 --- /dev/null +++ b/engines/gnap/scenes/scene29.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE29_H +#define GNAP_SCENE29_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene29: public Scene { +public: + Scene29(GnapEngine *vm); + ~Scene29() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s28_currMonkeySequenceId; + int _s28_nextMonkeySequenceId; + int _s28_currManSequenceId; + int _s28_nextManSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE29_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 25a2f7df50..e4790a2de6 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -54,6 +54,7 @@ #include "gnap/scenes/scene26.h" #include "gnap/scenes/scene27.h" #include "gnap/scenes/scene28.h" +#include "gnap/scenes/scene29.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -264,8 +265,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 29: - backgroundId = scene29_init(); - scene29_updateHotspots(); + _scene = new Scene29(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -586,7 +588,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 29: - scene29_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From 294f1a6557b0404885aaf3c5794730ccfb95977f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 00:05:44 +0200 Subject: GNAP: Refactor scene 30 --- engines/gnap/gnap.h | 7 - engines/gnap/scenes/scene30.cpp | 278 +++++++++++++++++++------------------- engines/gnap/scenes/scene30.h | 49 +++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 196 insertions(+), 147 deletions(-) create mode 100644 engines/gnap/scenes/scene30.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 37099b770b..5edcd5813b 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,13 +606,6 @@ public: // Shared by scenes 17 & 18 int _s18_garbageCanPos; - // Scene 30 - int _s30_kidSequenceId; - int scene30_init(); - void scene30_updateHotspots(); - void scene30_run(); - void scene30_updateAnimations(); - // Scene 31 int _s28_currClerkSequenceId, _s28_nextClerkSequenceId; bool _s31_beerGuyDistracted; diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp index 33a374c134..02a389e571 100644 --- a/engines/gnap/scenes/scene30.cpp +++ b/engines/gnap/scenes/scene30.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene30.h" namespace Gnap { @@ -43,79 +44,83 @@ enum { kASUsePillMachine4 = 5 }; -int GnapEngine::scene30_init() { - return isFlag(kGFUnk23) ? 0x10B : 0x10A; +Scene30::Scene30(GnapEngine *vm) : Scene(vm) { + _s30_kidSequenceId = -1; } -void GnapEngine::scene30_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSPillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); - setHotspot(kHSExitCircus, 100, 590 - _deviceY1, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSWalkArea1, 0, 0, 800, 514); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 5; +int Scene30::init() { + return _vm->isFlag(kGFUnk23) ? 0x10B : 0x10A; } -void GnapEngine::scene30_run() { +void Scene30::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSPillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); + _vm->setHotspot(kHSExitCircus, 100, 590 - _vm->_deviceY1, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 514); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 5; +} + +void Scene30::run() { bool hasTakenPill = false; - playSound(0x1093B, true); - startSoundTimerB(6); + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFUnk23)) - _gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->isFlag(kGFUnk23)) + _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - if (!isFlag(kGFUnk13)) - _gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); - _timers[5] = getRandom(50) + 180; + if (!_vm->isFlag(kGFUnk13)) + _vm->_gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[5] = _vm->getRandom(50) + 180; - _gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); - _timers[4] = getRandom(100) + 300; + _vm->_gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(100) + 300; _s30_kidSequenceId = 0x101; - initGnapPos(7, 12, kDirBottomRight); - initPlatypusPos(6, 12, kDirNone); - endSceneInit(); - gnapWalkTo(7, 8, -1, 0x107B9, 1); - platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - while (!_sceneDone) { - updateMouseCursor(); - updateCursorByHotspot(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene30_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -123,27 +128,27 @@ void GnapEngine::scene30_run() { break; case kHSPillMachine: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemDiceQuarterHole && !isFlag(kGFUnk23)) { - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASUsePillMachine; + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASUsePillMachine; hasTakenPill = true; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y, 8, 5); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y, 8, 5); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapWalkTo(9, 8, 0, 0x107BC, 1); - _gnapActionStatus = kASLookPillMachine; + _vm->gnapWalkTo(9, 8, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASLookPillMachine; break; case GRAB_CURSOR: - playGnapScratchingHead(8, 5); + _vm->playGnapScratchingHead(8, 5); break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(8, 5); + _vm->playGnapImpossible(8, 5); break; } } @@ -151,128 +156,127 @@ void GnapEngine::scene30_run() { break; case kHSExitCircus: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; if (hasTakenPill) - _newSceneNum = 47; + _vm->_newSceneNum = 47; else - _newSceneNum = 26; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C2, 1); + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C2, 1); } break; case kHSWalkArea1: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene30_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, true); + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(100) + 300; - if (_gnapActionStatus < 0) { - if (getRandom(5) == 1) { - _gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x100, 40, _s30_kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(5) == 1) { + _vm->_gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x100, 40, _s30_kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s30_kidSequenceId = 0x100; } else { - _gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); } } } - if (!_timers[5]) { - _timers[5] = getRandom(50) + 180; - if (_gnapActionStatus < 0) { - if (!isFlag(kGFUnk23) || hasTakenPill) - _gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 180; + if (_vm->_gnapActionStatus < 0) { + if (!_vm->isFlag(kGFUnk23) || hasTakenPill) + _vm->_gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); } } - playSoundB(); + _vm->playSoundB(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene30_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene30_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene30::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASUsePillMachine: - setGrabCursorSprite(-1); - _gameSys->setAnimation(0x105, _gnapId, 0); - _gameSys->insertSequence(0x105, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x105; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASUsePillMachine2; + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x105, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x105; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASUsePillMachine2; break; case kASUsePillMachine2: - hideCursor(); - setGrabCursorSprite(-1); - addFullScreenSprite(0x3F, 255); - _gameSys->removeSequence(0x105, _gnapId, true); - _gameSys->setAnimation(0x102, 256, 0); - _gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - _gameSys->setAnimation(0x103, _gnapId, 0); - _gameSys->insertSequence(0x103, _gnapId, 0, 0, kSeqNone, 0, 0, 0); - removeFullScreenSprite(); - showCursor(); - _gnapActionStatus = kASUsePillMachine3; - invAdd(kItemPill); - setFlag(kGFUnk23); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0x3F, 255); + _vm->_gameSys->removeSequence(0x105, _vm->_gnapId, true); + _vm->_gameSys->setAnimation(0x102, 256, 0); + _vm->_gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->_gameSys->setAnimation(0x103, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->_gnapActionStatus = kASUsePillMachine3; + _vm->invAdd(kItemPill); + _vm->setFlag(kGFUnk23); break; case kASUsePillMachine3: - _gameSys->setAnimation(0x104, _gnapId, 0); - _gameSys->insertSequence(0x104, _gnapId, makeRid(_gnapSequenceDatNum, 0x103), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x104; - _gnapSequenceDatNum = 0; - _gnapActionStatus = kASUsePillMachine4; - setGrabCursorSprite(kItemDiceQuarterHole); + _vm->_gameSys->setAnimation(0x104, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x104; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kASUsePillMachine4; + _vm->setGrabCursorSprite(kItemDiceQuarterHole); break; case kASUsePillMachine4: - _gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - gnapWalkTo(_hotspotsWalkPos[kHSPillMachine].x, _hotspotsWalkPos[kHSPillMachine].y + 1, -1, 0x107BC, 1); - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y + 1, -1, 0x107BC, 1); + _vm->_gnapActionStatus = -1; break; case kASLookPillMachine: - if (isFlag(kGFUnk23)) - showFullScreenSprite(0xE3); + if (_vm->isFlag(kGFUnk23)) + _vm->showFullScreenSprite(0xE3); else - showFullScreenSprite(0xE2); - _gnapActionStatus = -1; + _vm->showFullScreenSprite(0xE2); + _vm->_gnapActionStatus = -1; break; } } diff --git a/engines/gnap/scenes/scene30.h b/engines/gnap/scenes/scene30.h new file mode 100644 index 0000000000..e1b2476a5f --- /dev/null +++ b/engines/gnap/scenes/scene30.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE30_H +#define GNAP_SCENE30_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene30: public Scene { +public: + Scene30(GnapEngine *vm); + ~Scene30() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s30_kidSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE30_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index e4790a2de6..6231b0ff1a 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -55,6 +55,7 @@ #include "gnap/scenes/scene27.h" #include "gnap/scenes/scene28.h" #include "gnap/scenes/scene29.h" +#include "gnap/scenes/scene30.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -272,8 +273,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 30: - backgroundId = scene30_init(); - scene30_updateHotspots(); + _scene = new Scene30(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -594,7 +596,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 30: - scene30_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From a8c1fb5727ff83f64da383e891d3d09f595f8635 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 09:54:44 +0200 Subject: GNAP: Refactor scene 31 --- engines/gnap/gnap.cpp | 4 - engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene31.cpp | 419 +++++++++++++++++++------------------- engines/gnap/scenes/scene31.h | 53 +++++ engines/gnap/scenes/scenecore.cpp | 9 +- 5 files changed, 270 insertions(+), 224 deletions(-) create mode 100644 engines/gnap/scenes/scene31.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 68704fdb8a..2ef75164ba 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2021,10 +2021,6 @@ void GnapEngine::initGlobalSceneVars() { // Shared by scenes 17 && 18 _s18_garbageCanPos = 8; - // Scene 31 - _s31_beerGuyDistracted = false; - _s31_clerkMeasureMaxCtr = 3; - // Scene 50 _s50_timesPlayed = 0; _s50_timesPlayedModifier = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 5edcd5813b..95f04c322c 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,15 +606,6 @@ public: // Shared by scenes 17 & 18 int _s18_garbageCanPos; - // Scene 31 - int _s28_currClerkSequenceId, _s28_nextClerkSequenceId; - bool _s31_beerGuyDistracted; - int _s31_clerkMeasureCtr, _s31_clerkMeasureMaxCtr; - int scene31_init(); - void scene31_updateHotspots(); - void scene31_run(); - void scene31_updateAnimations(); - // Scene 32 int scene32_init(); void scene32_updateHotspots(); diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp index 7a58c4de28..0c3a1fa6c7 100644 --- a/engines/gnap/scenes/scene31.cpp +++ b/engines/gnap/scenes/scene31.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene31.h" namespace Gnap { @@ -45,89 +46,95 @@ enum { kASLeaveScene = 6 }; -int GnapEngine::scene31_init() { +Scene31::Scene31(GnapEngine *vm) : Scene(vm) { + _s31_beerGuyDistracted = false; + _s31_currClerkSequenceId = -1; + _s31_nextClerkSequenceId = -1; + _s31_clerkMeasureCtr = -1; + _s31_clerkMeasureMaxCtr = 3; +} + +int Scene31::init() { return 0x105; } -void GnapEngine::scene31_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSMeasuringClown, 34, 150, 256, 436, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 6); - setHotspot(kHSBeerBarrel, 452, 182, 560, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitOutsideClown, 0, 0, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - setHotspot(kHSWalkArea1, 0, 0, 800, 480); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 7; +void Scene31::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSMeasuringClown, 34, 150, 256, 436, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 6); + _vm->setHotspot(kHSBeerBarrel, 452, 182, 560, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitOutsideClown, 0, 0, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 480); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; } -void GnapEngine::scene31_run() { - playSound(0x1093B, true); - startSoundTimerB(6); +void Scene31::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); _s31_beerGuyDistracted = false; - _gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); - _s28_currClerkSequenceId = 0xFB; - _s28_nextClerkSequenceId = -1; + _s31_currClerkSequenceId = 0xFB; + _s31_nextClerkSequenceId = -1; - _gameSys->setAnimation(0xFB, 39, 3); + _vm->_gameSys->setAnimation(0xFB, 39, 3); - _timers[4] = getRandom(20) + 60; - _timers[5] = getRandom(50) + 180; + _vm->_timers[4] = _vm->getRandom(20) + 60; + _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_prevSceneNum == 27) { - initGnapPos(-1, 8, kDirBottomLeft); - initPlatypusPos(-1, 9, kDirUnk4); - endSceneInit(); - gnapWalkTo(3, 8, -1, 0x107BA, 1); - platypusWalkTo(3, 9, -1, 0x107D2, 1); + if (_vm->_prevSceneNum == 27) { + _vm->initGnapPos(-1, 8, kDirBottomLeft); + _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); } else { - initGnapPos(7, 12, kDirBottomRight); - initPlatypusPos(6, 12, kDirNone); - endSceneInit(); - gnapWalkTo(7, 8, -1, 0x107BA, 1); - platypusWalkTo(6, 8, -1, 0x107D2, 1); + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107D2, 1); } - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); - - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0 || _gnapActionStatus == kASPlatMeasuringClown) { - runMenu(); - scene31_updateHotspots(); + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemJoint) { - gnapUseJointOnPlatypus(); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -135,42 +142,42 @@ void GnapEngine::scene31_run() { break; case kHSMeasuringClown: - if (_gnapActionStatus < 0 || _gnapActionStatus == kASPlatMeasuringClown) { - if (_gnapActionStatus == kASPlatMeasuringClown) { - if (_verbCursor == LOOK_CURSOR) - playGnapScratchingHead(2, 2); + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { + if (_vm->_gnapActionStatus == kASPlatMeasuringClown) { + if (_vm->_verbCursor == LOOK_CURSOR) + _vm->playGnapScratchingHead(2, 2); else - playGnapImpossible(0, 0); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, 2, 2); + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, 2, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(2, 2); + _vm->playGnapScratchingHead(2, 2); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, -1, -1, 1); - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - gnapWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 0, 0x107B9, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _gnapActionStatus = kASUseMeasuringClown; - _timers[4] = 300; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, -1, -1, 1); + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y, 0, 0x107B9, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kASUseMeasuringClown; + _vm->_timers[4] = 300; break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - if (!invHas(kItemBucketWithBeer)) { - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y + 1, 1, 0x107C2, 1); - _hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - platypusWalkTo(_hotspotsWalkPos[kHSMeasuringClown].x, _hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); - _hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _platypusActionStatus = kASPlatMeasuringClown; - _gnapActionStatus = kASPlatMeasuringClown; - _timers[4] = 300; + if (!_vm->invHas(kItemBucketWithBeer)) { + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, 1, 0x107C2, 1); + _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); + _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; + _vm->_platypusActionStatus = kASPlatMeasuringClown; + _vm->_gnapActionStatus = kASPlatMeasuringClown; + _vm->_timers[4] = 300; } else - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -178,36 +185,36 @@ void GnapEngine::scene31_run() { break; case kHSBeerBarrel: - if (_gnapActionStatus < 0 || _gnapActionStatus == kASPlatMeasuringClown) { - if (_grabCursorSpriteIndex == kItemEmptyBucket && _s31_beerGuyDistracted) { - setGrabCursorSprite(-1); - gnapWalkTo(_gnapX, _gnapY, -1, getGnapSequenceId(gskIdle, _hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y) | 0x10000, 1); + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { + if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _s31_beerGuyDistracted) { + _vm->setGrabCursorSprite(-1); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y) | 0x10000, 1); _s31_clerkMeasureMaxCtr += 5; - _gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); - playGnapPullOutDevice(6, 8); - playGnapUseDevice(0, 0); - gnapWalkTo(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _gnapActionStatus = kASFillEmptyBucketWithBeer; - _timers[4] = 300; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 6, 2); + _vm->_gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->playGnapPullOutDevice(6, 8); + _vm->playGnapUseDevice(0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASFillEmptyBucketWithBeer; + _vm->_timers[4] = 300; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 6, 2); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(6, 2); + _vm->playGnapScratchingHead(6, 2); break; case GRAB_CURSOR: if (_s31_beerGuyDistracted) { - playGnapScratchingHead(6, 2); + _vm->playGnapScratchingHead(6, 2); } else { - gnapWalkTo(_hotspotsWalkPos[kHSBeerBarrel].x, _hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _gnapActionStatus = kASUseBeerBarrel; - _gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASUseBeerBarrel; + _vm->_gnapIdleFacing = kDirUpLeft; } break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -215,191 +222,187 @@ void GnapEngine::scene31_run() { break; case kHSExitCircus: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 26; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitCircus].x + 1, _hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); } break; case kHSExitOutsideClown: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _newSceneNum = 27; - gnapWalkTo(-1, _hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitOutsideClown].x, _hotspotsWalkPos[kHSExitOutsideClown].y + 1, -1, 0x107CF, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y + 1, -1, 0x107CF, 1); } break; case kHSWalkArea1: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; } - scene31_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1093B)) - playSound(0x1093B, true); + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(20) + 60; - if (_gnapActionStatus < 0 && _s28_nextClerkSequenceId == -1) { - switch (getRandom(6)){ + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0 && _s31_nextClerkSequenceId == -1) { + switch (_vm->getRandom(6)){ case 0: - _s28_nextClerkSequenceId = 0xFF; + _s31_nextClerkSequenceId = 0xFF; break; case 1: - _s28_nextClerkSequenceId = 0x100; + _s31_nextClerkSequenceId = 0x100; break; case 2: - _s28_nextClerkSequenceId = 0x101; + _s31_nextClerkSequenceId = 0x101; break; default: - _s28_nextClerkSequenceId = 0xFB; + _s31_nextClerkSequenceId = 0xFB; break; } } } - if (!_timers[5]) { - _timers[5] = getRandom(50) + 180; - if (_gnapActionStatus < 0) { - if (getRandom(2) != 0) - _gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 180; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); } } - playSoundB(); + _vm->playSoundB(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene31_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene31_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene31::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASUseBeerBarrel: - _s28_nextClerkSequenceId = 0xFE; + _s31_nextClerkSequenceId = 0xFE; break; case kASFillEmptyBucketWithBeer: - _gameSys->setAnimation(0x102, 59, 0); - _gameSys->insertSequence(0x102, 59, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapX = 5; - _gnapY = 7; - _gnapSequenceDatNum = 0; - _gnapSequenceId = 0x102; - _gnapId = 59; - _gnapActionStatus = kASFillEmptyBucketWithBeerDone; + _vm->_gameSys->setAnimation(0x102, 59, 0); + _vm->_gameSys->insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapX = 5; + _vm->_gnapY = 7; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x102; + _vm->_gnapId = 59; + _vm->_gnapActionStatus = kASFillEmptyBucketWithBeerDone; break; case kASFillEmptyBucketWithBeerDone: - _gnapIdleFacing = kDirBottomLeft; - playGnapPullOutDevice(0, 0); - playGnapUseDevice(0, 0); - _gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); - _gnapActionStatus = -1; - invAdd(kItemBucketWithBeer); - invRemove(kItemEmptyBucket); - setGrabCursorSprite(kItemBucketWithBeer); + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->invAdd(kItemBucketWithBeer); + _vm->invRemove(kItemEmptyBucket); + _vm->setGrabCursorSprite(kItemBucketWithBeer); break; case kASUseMeasuringClown: - _s28_nextClerkSequenceId = 0xFA; + _s31_nextClerkSequenceId = 0xFA; _s31_clerkMeasureMaxCtr = 1; break; case kASLeaveScene: - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - if (_platypusActionStatus == kASPlatMeasuringClown) { - _sceneWaiting = true; + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusActionStatus == kASPlatMeasuringClown) { + _vm->_sceneWaiting = true; _s31_beerGuyDistracted = true; - _s28_nextClerkSequenceId = 0xFA; + _s31_nextClerkSequenceId = 0xFA; } } - if (_gameSys->getAnimationStatus(3) == 2) { - switch (_s28_nextClerkSequenceId) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_s31_nextClerkSequenceId) { case 0xFA: - _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xFC, 39, _s28_nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0xFC, 39, 3); - _s28_currClerkSequenceId = 0xFC; - _s28_nextClerkSequenceId = 0xFC; + _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFC, 39, _s31_nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xFC, 39, 3); + _s31_currClerkSequenceId = 0xFC; + _s31_nextClerkSequenceId = 0xFC; _s31_clerkMeasureCtr = 0; break; case 0xFC: ++_s31_clerkMeasureCtr; if (_s31_clerkMeasureCtr >= _s31_clerkMeasureMaxCtr) { - if (_gnapActionStatus != 5) - _platypusActionStatus = -1; - _timers[0] = 40; - _gameSys->insertSequence(0xFD, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s28_currClerkSequenceId = 0xFD; - _s28_nextClerkSequenceId = -1; - if (_gnapActionStatus != kASFillEmptyBucketWithBeerDone && _gnapActionStatus != kASFillEmptyBucketWithBeer) - _gnapActionStatus = -1; + if (_vm->_gnapActionStatus != 5) + _vm->_platypusActionStatus = -1; + _vm->_timers[0] = 40; + _vm->_gameSys->insertSequence(0xFD, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s31_currClerkSequenceId = 0xFD; + _s31_nextClerkSequenceId = -1; + if (_vm->_gnapActionStatus != kASFillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kASFillEmptyBucketWithBeer) + _vm->_gnapActionStatus = -1; _s31_beerGuyDistracted = false; _s31_clerkMeasureMaxCtr = 3; - _gameSys->setAnimation(0xFD, 39, 3); - _sceneWaiting = false; + _vm->_gameSys->setAnimation(0xFD, 39, 3); + _vm->_sceneWaiting = false; } else { - _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s28_currClerkSequenceId = _s28_nextClerkSequenceId; - _s28_nextClerkSequenceId = 0xFC; - _gameSys->setAnimation(0xFC, 39, 3); + _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _s31_currClerkSequenceId = _s31_nextClerkSequenceId; + _s31_nextClerkSequenceId = 0xFC; + _vm->_gameSys->setAnimation(0xFC, 39, 3); } break; case 0xFE: - _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextClerkSequenceId, 39, 3); - _s28_currClerkSequenceId = _s28_nextClerkSequenceId; - _s28_nextClerkSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s31_nextClerkSequenceId, 39, 3); + _s31_currClerkSequenceId = _s31_nextClerkSequenceId; + _s31_nextClerkSequenceId = -1; + _vm->_gnapActionStatus = -1; break; default: - if (_s28_nextClerkSequenceId != -1) { - _gameSys->insertSequence(_s28_nextClerkSequenceId, 39, _s28_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s28_nextClerkSequenceId, 39, 3); - _s28_currClerkSequenceId = _s28_nextClerkSequenceId; - _s28_nextClerkSequenceId = -1; + if (_s31_nextClerkSequenceId != -1) { + _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s31_nextClerkSequenceId, 39, 3); + _s31_currClerkSequenceId = _s31_nextClerkSequenceId; + _s31_nextClerkSequenceId = -1; } break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene31.h b/engines/gnap/scenes/scene31.h new file mode 100644 index 0000000000..09b7c65696 --- /dev/null +++ b/engines/gnap/scenes/scene31.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE31_H +#define GNAP_SCENE31_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene31: public Scene { +public: + Scene31(GnapEngine *vm); + ~Scene31() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _s31_beerGuyDistracted; + int _s31_currClerkSequenceId; + int _s31_nextClerkSequenceId; + int _s31_clerkMeasureCtr; + int _s31_clerkMeasureMaxCtr; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE31_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 6231b0ff1a..e366a57203 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -56,6 +56,7 @@ #include "gnap/scenes/scene28.h" #include "gnap/scenes/scene29.h" #include "gnap/scenes/scene30.h" +#include "gnap/scenes/scene31.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -280,8 +281,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 31: - backgroundId = scene31_init(); - scene31_updateHotspots(); + _scene = new Scene31(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -602,7 +604,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 31: - scene31_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; -- cgit v1.2.3 From a5d312b23f68ef3480a5e7bd516ea844dafa8318 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 10:16:35 +0200 Subject: GNAP: Refactor scenes 32 & 33 --- engines/gnap/gnap.h | 13 -- engines/gnap/scenes/scene32.cpp | 184 +++++++++++----------- engines/gnap/scenes/scene32.h | 46 ++++++ engines/gnap/scenes/scene33.cpp | 310 +++++++++++++++++++------------------- engines/gnap/scenes/scene33.h | 50 ++++++ engines/gnap/scenes/scenecore.cpp | 18 ++- 6 files changed, 354 insertions(+), 267 deletions(-) create mode 100644 engines/gnap/scenes/scene32.h create mode 100644 engines/gnap/scenes/scene33.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 95f04c322c..79e6b6344e 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -605,20 +605,7 @@ public: // Shared by scenes 17 & 18 int _s18_garbageCanPos; - - // Scene 32 - int scene32_init(); - void scene32_updateHotspots(); - void scene32_run(); - void scene32_updateAnimations(); - // Scene 33 - int _s33_currChickenSequenceId, _s33_nextChickenSequenceId; - int scene33_init(); - void scene33_updateHotspots(); - void scene33_run(); - void scene33_updateAnimations(); - // Scene 38 int scene38_init(); void scene38_updateHotspots(); diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp index 6eac47ee6e..75d2efa22b 100644 --- a/engines/gnap/scenes/scene32.cpp +++ b/engines/gnap/scenes/scene32.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene32.h" namespace Gnap { @@ -44,78 +45,82 @@ enum { kASLeaveScene = 0 }; -int GnapEngine::scene32_init() { - _gameSys->setAnimation(0, 0, 0); - return isFlag(kGFPlatypusTalkingToAssistant) ? 0xF : 0x10; +Scene32::Scene32(GnapEngine *vm) : Scene(vm) { + +} + +int Scene32::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0xF : 0x10; } -void GnapEngine::scene32_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); - setHotspot(kHSWalkArea1, 0, 0, 162, 426); - setHotspot(kHSWalkArea2, 162, 0, 237, 396); - setHotspot(kHSWalkArea3, 237, 0, 319, 363); - setHotspot(kHSWalkArea4, 520, 0, 800, 404); - setHotspot(kHSWalkArea5, 300, 447, 800, 600); - setHotspot(kHSWalkArea6, 678, 0, 800, 404); - setHotspot(kHSWalkArea7, 0, 0, 520, 351); - setHotspot(kHSWalkArea8, 0, 546, 300, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 11; +void Scene32::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + _vm->setHotspot(kHSWalkArea1, 0, 0, 162, 426); + _vm->setHotspot(kHSWalkArea2, 162, 0, 237, 396); + _vm->setHotspot(kHSWalkArea3, 237, 0, 319, 363); + _vm->setHotspot(kHSWalkArea4, 520, 0, 800, 404); + _vm->setHotspot(kHSWalkArea5, 300, 447, 800, 600); + _vm->setHotspot(kHSWalkArea6, 678, 0, 800, 404); + _vm->setHotspot(kHSWalkArea7, 0, 0, 520, 351); + _vm->setHotspot(kHSWalkArea8, 0, 546, 300, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; } -void GnapEngine::scene32_run() { - playSound(0x1091C, true); - startSoundTimerC(5); - queueInsertDeviceIcon(); - _timers[4] = getRandom(100) + 300; - - if (_prevSceneNum == 33) { - initGnapPos(11, 6, kDirBottomLeft); - initPlatypusPos(12, 6, kDirUnk4); - endSceneInit(); - platypusWalkTo(9, 6, -1, 0x107D2, 1); - gnapWalkTo(8, 6, -1, 0x107BA, 1); +void Scene32::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(5); + _vm->queueInsertDeviceIcon(); + _vm->_timers[4] = _vm->getRandom(100) + 300; + + if (_vm->_prevSceneNum == 33) { + _vm->initGnapPos(11, 6, kDirBottomLeft); + _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->endSceneInit(); + _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); + _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); } else { - initGnapPos(1, 6, kDirBottomRight); - initPlatypusPos(1, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(1, 6, kDirBottomRight); + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); } - while (!_sceneDone) { - updateMouseCursor(); - updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene32_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -123,13 +128,13 @@ void GnapEngine::scene32_run() { break; case kHSExitTruck: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - setGrabCursorSprite(-1); - gnapWalkTo(_hotspotsWalkPos[kHSExitTruck].x, _hotspotsWalkPos[kHSExitTruck].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitTruck].x, _hotspotsWalkPos[kHSExitTruck].y + 1, -1, 0x107CD, 1); - _newSceneNum = 33; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->setGrabCursorSprite(-1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitTruck].x, _vm->_hotspotsWalkPos[kHSExitTruck].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitTruck].x, _vm->_hotspotsWalkPos[kHSExitTruck].y + 1, -1, 0x107CD, 1); + _vm->_newSceneNum = 33; } break; @@ -141,59 +146,54 @@ void GnapEngine::scene32_run() { case kHSWalkArea6: case kHSWalkArea7: case kHSWalkArea8: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = 0; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; } - scene32_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, true); + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(100) + 300; - if (getRandom(2) != 0) - _gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene32_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene32_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - if (_gnapActionStatus == kASLeaveScene) - _sceneDone = true; +void Scene32::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kASLeaveScene) + _vm->_sceneDone = true; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene32.h b/engines/gnap/scenes/scene32.h new file mode 100644 index 0000000000..d96e834091 --- /dev/null +++ b/engines/gnap/scenes/scene32.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE32_H +#define GNAP_SCENE32_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene32: public Scene { +public: + Scene32(GnapEngine *vm); + ~Scene32() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE32_H diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp index 3c24dd2088..d0dec3f58c 100644 --- a/engines/gnap/scenes/scene33.cpp +++ b/engines/gnap/scenes/scene33.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene33.h" namespace Gnap { @@ -45,98 +46,101 @@ enum { kASUseChickenDone = 3 }; -int GnapEngine::scene33_init() { - return isFlag(kGFPlatypusTalkingToAssistant) ? 0x84 : 0x85; +Scene33::Scene33(GnapEngine *vm) : Scene(vm) { + _s33_currChickenSequenceId = -1; + _s33_nextChickenSequenceId = -1; +} + +int Scene33::init() { + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x84 : 0x85; } -void GnapEngine::scene33_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSChicken, 606, 455, 702, 568, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 3); - setHotspot(kHSExitBarn, 610, 75, 800, 164, SF_EXIT_U_CURSOR, 10, 3); - setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - setHotspot(kHSWalkArea1, 120, 0, 514, 458); - setHotspot(kHSWalkArea2, 0, 0, 800, 452); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 9; +void Scene33::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSChicken, 606, 455, 702, 568, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 3); + _vm->setHotspot(kHSExitBarn, 610, 75, 800, 164, SF_EXIT_U_CURSOR, 10, 3); + _vm->setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHSWalkArea1, 120, 0, 514, 458); + _vm->setHotspot(kHSWalkArea2, 0, 0, 800, 452); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; } -void GnapEngine::scene33_run() { - playSound(0x1091C, true); - startSoundTimerC(6); - queueInsertDeviceIcon(); +void Scene33::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(6); + _vm->queueInsertDeviceIcon(); _s33_currChickenSequenceId = 0x7E; - _gameSys->setAnimation(0x7E, 179, 2); - _gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x7E, 179, 2); + _vm->_gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _s33_nextChickenSequenceId = -1; - _timers[5] = getRandom(20) + 30; - _timers[4] = getRandom(100) + 300; + _vm->_timers[5] = _vm->getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(100) + 300; - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 34: - initGnapPos(11, 7, kDirBottomLeft); - initPlatypusPos(12, 7, kDirUnk4); - endSceneInit(); - gnapWalkTo(8, 7, -1, 0x107BA, 1); - platypusWalkTo(9, 7, -1, 0x107D2, 1); + _vm->initGnapPos(11, 7, kDirBottomLeft); + _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 7, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); break; case 37: - initGnapPos(7, 7, kDirBottomRight); - initPlatypusPos(8, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(7, 7, kDirBottomRight); + _vm->initPlatypusPos(8, 7, kDirNone); + _vm->endSceneInit(); break; case 32: - initGnapPos(-1, 6, kDirBottomRight); - initPlatypusPos(-1, 7, kDirNone); - endSceneInit(); - platypusWalkTo(2, 7, -1, 0x107C2, 1); - gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->initGnapPos(-1, 6, kDirBottomRight); + _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); break; default: - initGnapPos(3, 7, kDirBottomRight); - initPlatypusPos(2, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(2, 7, kDirNone); + _vm->endSceneInit(); break; } - while (!_sceneDone) { + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->testWalk(0, 0, 7, 6, 8, 6); - updateMouseCursor(); - updateCursorByHotspot(); - testWalk(0, 0, 7, 6, 8, 6); - - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - if (_gnapActionStatus < 0) { - runMenu(); - scene33_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -144,26 +148,26 @@ void GnapEngine::scene33_run() { break; case kHSChicken: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(7, 9, 9, 8); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 9, 9, 8); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case GRAB_CURSOR: - _gnapIdleFacing = kDirBottomRight; - if (gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _gnapActionStatus = kASUseChicken; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChicken].x, _vm->_hotspotsWalkPos[kHSChicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kASUseChicken; else - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case TALK_CURSOR: - _gnapIdleFacing = kDirBottomRight; - gnapWalkTo(_hotspotsWalkPos[kHSChicken].x, _hotspotsWalkPos[kHSChicken].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkChicken; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChicken].x, _vm->_hotspotsWalkPos[kHSChicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkChicken; break; case LOOK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -171,160 +175,154 @@ void GnapEngine::scene33_run() { break; case kHSExitHouse: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 37; - if (_gnapX > 6) - gnapWalkTo(_gnapX, _gnapY, 0, 0x107AD, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 37; + if (_vm->_gnapX > 6) + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); else - gnapWalkTo(6, 7, 0, 0x107B1, 1); + _vm->gnapWalkTo(6, 7, 0, 0x107B1, 1); } break; case kHSExitBarn: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 35; - if (_gnapX > 7) - gnapWalkTo(_gnapX, _gnapY, 0, 0x107AD, 1); + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 35; + if (_vm->_gnapX > 7) + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); else - gnapWalkTo(7, 7, 0, 0x107B1, 1); + _vm->gnapWalkTo(7, 7, 0, 0x107B1, 1); } break; case kHSExitCreek: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitCreek].x, _hotspotsWalkPos[kHSExitCreek].y, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitCreek].x, _hotspotsWalkPos[kHSExitCreek].y, -1, 0x107CD, 1); - _newSceneNum = 34; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCreek].x, _vm->_hotspotsWalkPos[kHSExitCreek].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCreek].x, _vm->_hotspotsWalkPos[kHSExitCreek].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 34; } break; case kHSExitPigpen: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitPigpen].x, _hotspotsWalkPos[kHSExitPigpen].y, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitPigpen].x, _hotspotsWalkPos[kHSExitPigpen].y, -1, 0x107CF, 1); - _newSceneNum = 32; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPigpen].x, _vm->_hotspotsWalkPos[kHSExitPigpen].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPigpen].x, _vm->_hotspotsWalkPos[kHSExitPigpen].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 32; } break; case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene33_updateAnimations(); + updateAnimations(); - if (!isSoundPlaying(0x1091C)) - playSound(0x1091C, true); + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(100) + 300; - if (getRandom(2) != 0) - _gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); else - _gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_timers[5] && _s33_nextChickenSequenceId == -1 && _gnapActionStatus != kASTalkChicken && _gnapActionStatus != kASUseChicken) { - if (getRandom(6) != 0) { + if (!_vm->_timers[5] && _s33_nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kASTalkChicken && _vm->_gnapActionStatus != kASUseChicken) { + if (_vm->getRandom(6) != 0) { _s33_nextChickenSequenceId = 0x7E; - _timers[5] = getRandom(20) + 30; + _vm->_timers[5] = _vm->getRandom(20) + 30; } else { _s33_nextChickenSequenceId = 0x80; - _timers[5] = getRandom(20) + 50; + _vm->_timers[5] = _vm->getRandom(20) + 50; } } - playSoundC(); + _vm->playSoundC(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene33_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene33_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - switch (_gnapActionStatus) { +void Scene33::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASTalkChicken: _s33_nextChickenSequenceId = 0x7F; break; case kASUseChicken: _s33_nextChickenSequenceId = 0x81; - _timers[2] = 100; + _vm->_timers[2] = 100; break; case kASUseChickenDone: - _gameSys->insertSequence(0x107B5, _gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceId = 0x7B5; - _gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; _s33_currChickenSequenceId = 0x7E; - _gameSys->setAnimation(0x7E, 179, 2); - _gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = -1; - _timers[5] = 30; + _vm->_gameSys->setAnimation(0x7E, 179, 2); + _vm->_gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->_timers[5] = 30; break; default: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { if (_s33_nextChickenSequenceId == 0x81) { - _gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 0); - _gameSys->insertSequence(_s33_nextChickenSequenceId, 179, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(_s33_currChickenSequenceId, 179, true); + _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 0); + _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(_s33_currChickenSequenceId, 179, true); _s33_nextChickenSequenceId = -1; _s33_currChickenSequenceId = -1; - _gnapActionStatus = kASUseChickenDone; - _timers[5] = 500; + _vm->_gnapActionStatus = kASUseChickenDone; + _vm->_timers[5] = 500; } else if (_s33_nextChickenSequenceId == 0x7F) { - _gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); - _gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _s33_currChickenSequenceId = _s33_nextChickenSequenceId; _s33_nextChickenSequenceId = -1; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } else if (_s33_nextChickenSequenceId != -1) { - _gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); - _gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _s33_currChickenSequenceId = _s33_nextChickenSequenceId; _s33_nextChickenSequenceId = -1; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene33.h b/engines/gnap/scenes/scene33.h new file mode 100644 index 0000000000..4532a263f1 --- /dev/null +++ b/engines/gnap/scenes/scene33.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE33_H +#define GNAP_SCENE33_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene33: public Scene { +public: + Scene33(GnapEngine *vm); + ~Scene33() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s33_currChickenSequenceId; + int _s33_nextChickenSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE33_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index e366a57203..c5b47c650f 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -57,6 +57,8 @@ #include "gnap/scenes/scene29.h" #include "gnap/scenes/scene30.h" #include "gnap/scenes/scene31.h" +#include "gnap/scenes/scene32.h" +#include "gnap/scenes/scene33.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -288,14 +290,16 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 32: - backgroundId = scene32_init(); - scene32_updateHotspots(); + _scene = new Scene32(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; case 33: - backgroundId = scene33_init(); - scene33_updateHotspots(); + _scene = new Scene33(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -610,12 +614,14 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 20; break; case 32: - scene32_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; case 33: - scene33_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 1095af09a666e9e44c9f95b2e6d41436e3189604 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 11:59:30 +0200 Subject: GNAP: Refactor scene 38 --- engines/gnap/gnap.h | 6 - engines/gnap/scenes/scene38.cpp | 392 +++++++++++++++++++------------------- engines/gnap/scenes/scene38.h | 48 +++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 248 insertions(+), 207 deletions(-) create mode 100644 engines/gnap/scenes/scene38.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 79e6b6344e..4bcf7fc981 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,12 +606,6 @@ public: // Shared by scenes 17 & 18 int _s18_garbageCanPos; - // Scene 38 - int scene38_init(); - void scene38_updateHotspots(); - void scene38_run(); - void scene38_updateAnimations(); - // Scene 39 int _s39_currGuySequenceId, _s39_nextGuySequenceId; int scene39_init(); diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp index 81da7642b4..9360afdd54 100644 --- a/engines/gnap/scenes/scene38.cpp +++ b/engines/gnap/scenes/scene38.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene38.h" namespace Gnap { @@ -52,156 +53,156 @@ enum { kASPlatypusHoldingTrapDoor = 6 }; -int GnapEngine::scene38_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - return 0xA5; +Scene38::Scene38(GnapEngine *vm) : Scene(vm) { } -void GnapEngine::scene38_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); - setHotspot(kHSExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); - setHotspot(kHSTrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); - setHotspot(kHSTrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); - setHotspot(kHSHuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - setHotspot(kHSWalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - setHotspot(kHSWalkArea2, 0, 0, 799, 396); - setHotspot(kHSWalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); - setHotspot(kHSWalkArea4, 0, 0, 97, 445); - setHotspot(kHSWalkArea5, 770, 0, 799, 445); - setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; - else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; - else if (_gnapActionStatus == kASHoldingHuntingTrophy) - _hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _hotspots[kHSWalkArea6]._flags = SF_NONE; - _hotspotsCount = 13; +int Scene38::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0xA5; } -void GnapEngine::scene38_run() { +void Scene38::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHSExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); + _vm->setHotspot(kHSTrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); + _vm->setHotspot(kHSTrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); + _vm->setHotspot(kHSHuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHSWalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHSWalkArea2, 0, 0, 799, 396); + _vm->setHotspot(kHSWalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); + _vm->setHotspot(kHSWalkArea4, 0, 0, 97, 445); + _vm->setHotspot(kHSWalkArea5, 770, 0, 799, 445); + _vm->setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; + else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_hotspots[kHSWalkArea6]._flags = SF_NONE; + _vm->_hotspotsCount = 13; +} - queueInsertDeviceIcon(); - _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); +void Scene38::run() { + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - if (_prevSceneNum == 39) { - initGnapPos(3, 7, kDirBottomLeft); - initPlatypusPos(4, 7, kDirUnk4); + if (_vm->_prevSceneNum == 39) { + _vm->initGnapPos(3, 7, kDirBottomLeft); + _vm->initPlatypusPos(4, 7, kDirUnk4); } else { - initGnapPos(3, 8, kDirBottomRight); - initPlatypusPos(4, 8, kDirNone); + _vm->initGnapPos(3, 8, kDirBottomRight); + _vm->initPlatypusPos(4, 8, kDirNone); } - endSceneInit(); - - while (!_sceneDone) { - - updateMouseCursor(); - updateCursorByHotspot(); + _vm->endSceneInit(); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene38_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; case kHSPlatypus: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - _gnapActionStatus = kASReleaseHuntingTrophy; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } break; case kHSExitHouse: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - _gnapActionStatus = kASReleaseHuntingTrophy; + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; } else { - _isLeavingScene = true; - gnapWalkTo(-1, -1, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 37; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 37; } break; case kHSExitCave: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - _gnapActionStatus = kASReleaseHuntingTrophy; - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _isLeavingScene = true; - } else if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _sceneWaiting = false; - _isLeavingScene = true; - gnapWalkTo(5, 7, 0, 0x107BB, 1); - _newSceneNum = 39; - _gnapActionStatus = kASExitCave; + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->_isLeavingScene = true; + } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { + _vm->_sceneWaiting = false; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kASExitCave; } break; case kHSTrapDoorLid1: case kHSTrapDoorLid2: - if (_gnapActionStatus == kASHoldingHuntingTrophy) { - if (_verbCursor == PLAT_CURSOR && _platypusActionStatus != kASPlatypusHoldingTrapDoor) - _gnapActionStatus = kASUsePlatypusWithTrapDoor; + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { + if (_vm->_verbCursor == PLAT_CURSOR && _vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) + _vm->_gnapActionStatus = kASUsePlatypusWithTrapDoor; else - _gnapActionStatus = kASReleaseHuntingTrophy; + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; } break; case kHSHuntingTrophy: - if (_gnapActionStatus != kASHoldingHuntingTrophy) { - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(3, 6, 2, 0); + if (_vm->_gnapActionStatus != kASHoldingHuntingTrophy) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 6, 2, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(0, 0); + _vm->playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) - playGnapImpossible(0, 0); + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) + _vm->playGnapImpossible(0, 0); else { - gnapWalkTo(3, 6, 0, 0x107BB, 1); - platypusWalkTo(4, 8, -1, -1, 1); - _gnapActionStatus = kASUseHuntingTrophy; + _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); + _vm->platypusWalkTo(4, 8, -1, -1, 1); + _vm->_gnapActionStatus = kASUseHuntingTrophy; } break; case TALK_CURSOR: - playGnapBrainPulsating(2, 0); + _vm->playGnapBrainPulsating(2, 0); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -217,148 +218,143 @@ void GnapEngine::scene38_run() { case kHSWalkArea4: case kHSWalkArea5: case kHSWalkArea6: - if (_gnapActionStatus == kASHoldingHuntingTrophy) - _gnapActionStatus = kASReleaseHuntingTrophy; - else if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left) { - if (_gnapActionStatus == kASHoldingHuntingTrophy) - _gnapActionStatus = kASReleaseHuntingTrophy; - else if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left) { + if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) + _vm->_gnapActionStatus = kASReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene38_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - updatePlatypusIdleSequence(); - updateGnapIdleSequence(); + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene38_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene38_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene38::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASExitCave: - _gameSys->removeSequence(_platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, true); - _gameSys->insertSequence(0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xA3; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0xA3, _gnapId, 0); - _gnapActionStatus = kASLeaveScene; + _vm->_gameSys->removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); + _vm->_gameSys->insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA3; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0xA3, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASLeaveScene; break; case kASUseHuntingTrophy: - _gameSys->removeSequence(0x9B, 0, true); - _gameSys->insertSequence(0x9C, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9C; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x9C, _gnapId, 0); - _gnapActionStatus = kASHoldingHuntingTrophy; - scene38_updateHotspots(); + _vm->_gameSys->removeSequence(0x9B, 0, true); + _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9C; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9C, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASHoldingHuntingTrophy; + updateHotspots(); break; case kASHoldingHuntingTrophy: - if (_platypusActionStatus != kASPlatypusHoldingTrapDoor) - _sceneWaiting = true; - if (_gnapSequenceId == 0xA4) { - _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9D; + if (_vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) + _vm->_sceneWaiting = true; + if (_vm->_gnapSequenceId == 0xA4) { + _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9D; } else { - _gameSys->insertSequence(0xA4, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xA4; + _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA4; } - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(_gnapSequenceId, _gnapId, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); break; case kASReleaseHuntingTrophy: - if (_gnapSequenceId == 0x9E) { - _gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - _gnapActionStatus = -1; - } else if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _gameSys->insertSequence(0xA0, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0xA0; - _gnapSequenceDatNum = 0; - _gnapX = 3; - _gnapY = 6; - _gnapIdleFacing = kDirBottomRight; - if (_isLeavingScene) { - _sceneWaiting = false; - gnapWalkTo(5, 7, 0, 0x107BB, 1); - _newSceneNum = 39; - _gnapActionStatus = kASExitCave; + if (_vm->_gnapSequenceId == 0x9E) { + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA0; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->_isLeavingScene) { + _vm->_sceneWaiting = false; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kASExitCave; } else { - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } } else { - _gameSys->insertSequence(0x9E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9E; - _gnapSequenceDatNum = 0; - _gnapX = 3; - _gnapY = 6; - _gnapIdleFacing = kDirBottomRight; - _gameSys->setAnimation(0x9E, _gnapId, 0); - _sceneWaiting = false; - scene38_updateHotspots(); + _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); + _vm->_sceneWaiting = false; + updateHotspots(); } break; case kASUsePlatypusWithTrapDoor: - _sceneWaiting = false; - _gameSys->insertSequence(0x9F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9F; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x9F, _gnapId, 0); - _gnapActionStatus = kASHoldingHuntingTrophy; - if (_platypusFacing != kDirNone) - playPlatypusSequence(0x107D5); + _vm->_sceneWaiting = false; + _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9F; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9F, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASHoldingHuntingTrophy; + if (_vm->_platypusFacing != kDirNone) + _vm->playPlatypusSequence(0x107D5); else - playPlatypusSequence(0x107D4); - platypusWalkTo(8, 7, -1, 0x107D2, 1); - _gameSys->insertSequence(0xA1, _gnapId + 1, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0xA1; - _platypusSequenceDatNum = 0; - _platypusId = _gnapId + 1; - _gameSys->setAnimation(0xA1, _gnapId + 1, 1); - _platypusActionStatus = kASPlatypusHoldingTrapDoor; - scene38_updateHotspots(); + _vm->playPlatypusSequence(0x107D4); + _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); + _vm->_gameSys->insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA1; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusId = _vm->_gnapId + 1; + _vm->_gameSys->setAnimation(0xA1, _vm->_gnapId + 1, 1); + _vm->_platypusActionStatus = kASPlatypusHoldingTrapDoor; + updateHotspots(); break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - if (_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _gameSys->insertSequence(0xA2, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0xA2; - _platypusSequenceDatNum = 0; - scene38_updateHotspots(); - _sceneWaiting = true; + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA2; + _vm->_platypusSequenceDatNum = 0; + updateHotspots(); + _vm->_sceneWaiting = true; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene38.h b/engines/gnap/scenes/scene38.h new file mode 100644 index 0000000000..7cc90b75e7 --- /dev/null +++ b/engines/gnap/scenes/scene38.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE38_H +#define GNAP_SCENE38_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene38: public Scene { +public: + Scene38(GnapEngine *vm); + ~Scene38() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE38_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c5b47c650f..75a1f572a6 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -59,6 +59,7 @@ #include "gnap/scenes/scene31.h" #include "gnap/scenes/scene32.h" #include "gnap/scenes/scene33.h" +#include "gnap/scenes/scene38.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -332,8 +333,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 38: - backgroundId = scene38_init(); - scene38_updateHotspots(); + _scene = new Scene38(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -650,7 +652,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 38: - scene38_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From f7e7a45f12351e07851a960c814411de94b346f1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 12:10:43 +0200 Subject: GNAP: Refactor scene 39 --- engines/gnap/gnap.h | 7 -- engines/gnap/scenes/scene38.h | 2 - engines/gnap/scenes/scene39.cpp | 205 +++++++++++++++++++------------------- engines/gnap/scenes/scene39.h | 50 ++++++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 5 files changed, 158 insertions(+), 115 deletions(-) create mode 100644 engines/gnap/scenes/scene39.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 4bcf7fc981..fe641ceb86 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -606,13 +606,6 @@ public: // Shared by scenes 17 & 18 int _s18_garbageCanPos; - // Scene 39 - int _s39_currGuySequenceId, _s39_nextGuySequenceId; - int scene39_init(); - void scene39_updateHotspots(); - void scene39_run(); - void scene39_updateAnimations(); - // Scene 40 int scene40_init(); void scene40_updateHotspots(); diff --git a/engines/gnap/scenes/scene38.h b/engines/gnap/scenes/scene38.h index 7cc90b75e7..8ad8e73fa3 100644 --- a/engines/gnap/scenes/scene38.h +++ b/engines/gnap/scenes/scene38.h @@ -40,8 +40,6 @@ public: virtual void run(); virtual void updateAnimations(); virtual void updateAnimationsCb() {}; - -private: }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp index bc506c1bcf..cfbdd5721a 100644 --- a/engines/gnap/scenes/scene39.cpp +++ b/engines/gnap/scenes/scene39.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene39.h" namespace Gnap { @@ -40,86 +41,89 @@ enum { kASLeaveScene = 0 }; -int GnapEngine::scene39_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - return 0x35; +Scene39::Scene39(GnapEngine *vm) : Scene(vm) { + _s39_currGuySequenceId = -1; + _s39_nextGuySequenceId = -1; } -void GnapEngine::scene39_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitInsideHouse, 0, 0, 140, 206, SF_EXIT_U_CURSOR, 4, 8); - setHotspot(kHSExitUfoParty, 360, 204, 480, 430, SF_EXIT_R_CURSOR, 6, 8); - setHotspot(kHSSign, 528, 232, 607, 397, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 3); - setHotspot(kHSWalkArea1, 0, 0, 800, 466); - setHotspot(kHSWalkArea2, 502, 466, 800, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 7; +int Scene39::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0x35; } -void GnapEngine::scene39_run() { +void Scene39::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitInsideHouse, 0, 0, 140, 206, SF_EXIT_U_CURSOR, 4, 8); + _vm->setHotspot(kHSExitUfoParty, 360, 204, 480, 430, SF_EXIT_R_CURSOR, 6, 8); + _vm->setHotspot(kHSSign, 528, 232, 607, 397, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 3); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 466); + _vm->setHotspot(kHSWalkArea2, 502, 466, 800, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} - _timers[5] = 0; // Bug in the original? Timer was never intiailized. +void Scene39::run() { + // Bug in the original? Timer was never initialized. + _vm->_timers[5] = 0; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); _s39_currGuySequenceId = 0x33; - _gameSys->setAnimation(0x33, 21, 3); - _gameSys->insertSequence(_s39_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->setAnimation(0x33, 21, 3); + _vm->_gameSys->insertSequence(_s39_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); _s39_nextGuySequenceId = -1; - if (_prevSceneNum == 38) { - initGnapPos(3, 7, kDirUpRight); - initPlatypusPos(2, 7, kDirUpLeft); - endSceneInit(); + if (_vm->_prevSceneNum == 38) { + _vm->initGnapPos(3, 7, kDirUpRight); + _vm->initPlatypusPos(2, 7, kDirUpLeft); + _vm->endSceneInit(); } else { - initGnapPos(4, 7, kDirBottomRight); - initPlatypusPos(5, 7, kDirNone); - endSceneInit(); + _vm->initGnapPos(4, 7, kDirBottomRight); + _vm->initPlatypusPos(5, 7, kDirNone); + _vm->endSceneInit(); } - while (!_sceneDone) { - - if (!isSoundPlaying(0x1094B)) { - playSound(0x1094B, true); - setSoundVolume(0x1094B, 60); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) { + _vm->playSound(0x1094B, true); + _vm->setSoundVolume(0x1094B, 60); } - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); - - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->testWalk(0, 0, -1, -1, -1, -1); - switch (_sceneClickedHotspot) { + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene39_updateHotspots(); - _timers[5] = getRandom(20) + 50; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 50; break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -127,30 +131,30 @@ void GnapEngine::scene39_run() { break; case kHSExitUfoParty: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - _sceneDone = true; - gnapWalkTo(_gnapX, _gnapY, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 40; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 40; } break; case kHSSign: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(0, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapWalkTo(_hotspotsWalkPos[kHSSign].x, _hotspotsWalkPos[kHSSign].y, 0, -1, 1); - playGnapIdle(_hotspotsWalkPos[kHSSign].x, _hotspotsWalkPos[kHSSign].y); - showFullScreenSprite(0x1C); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSSign].x, _vm->_hotspotsWalkPos[kHSSign].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHSSign].x, _vm->_hotspotsWalkPos[kHSSign].y); + _vm->showFullScreenSprite(0x1C); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -158,38 +162,37 @@ void GnapEngine::scene39_run() { break; case kHSExitInsideHouse: - if (_gnapActionStatus < 0) { - _sceneDone = true; - _isLeavingScene = true; - _newSceneNum = 38; + if (_vm->_gnapActionStatus < 0) { + _vm->_sceneDone = true; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 38; } break; case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) { - gnapWalkTo(-1, -1, -1, -1, 1); - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; } break; - } - scene39_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0) - updateGnapIdleSequence(); - if (!_timers[5]) { - _timers[5] = getRandom(20) + 50; - switch (getRandom(4)) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 50; + switch (_vm->getRandom(4)) { case 0: _s39_nextGuySequenceId = 0x30; break; @@ -206,38 +209,34 @@ void GnapEngine::scene39_run() { } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene39_updateHotspots(); - _timers[5] = getRandom(20) + 50; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 50; } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene39_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - if (_gnapActionStatus == kASLeaveScene) - _sceneDone = true; +void Scene39::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kASLeaveScene) + _vm->_sceneDone = true; else - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s39_nextGuySequenceId != -1) { - _gameSys->setAnimation(_s39_nextGuySequenceId, 21, 3); - _gameSys->insertSequence(_s39_nextGuySequenceId, 21, _s39_currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s39_nextGuySequenceId != -1) { + _vm->_gameSys->setAnimation(_s39_nextGuySequenceId, 21, 3); + _vm->_gameSys->insertSequence(_s39_nextGuySequenceId, 21, _s39_currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _s39_currGuySequenceId = _s39_nextGuySequenceId; _s39_nextGuySequenceId = -1; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene39.h b/engines/gnap/scenes/scene39.h new file mode 100644 index 0000000000..68dfdfd8e4 --- /dev/null +++ b/engines/gnap/scenes/scene39.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE39_H +#define GNAP_SCENE39_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene39: public Scene { +public: + Scene39(GnapEngine *vm); + ~Scene39() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s39_currGuySequenceId; + int _s39_nextGuySequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE39_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 75a1f572a6..cd793fd8e3 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -60,6 +60,7 @@ #include "gnap/scenes/scene32.h" #include "gnap/scenes/scene33.h" #include "gnap/scenes/scene38.h" +#include "gnap/scenes/scene39.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -340,8 +341,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 39: - backgroundId = scene39_init(); - scene39_updateHotspots(); + _scene = new Scene39(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -658,7 +660,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 39: - scene39_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 01f8cfd8af22a56ec2f09d96bf3d0a6a19c5515c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 15:00:52 +0200 Subject: GNAP: Refactor scene 40 --- engines/gnap/gnap.h | 6 -- engines/gnap/scenes/scene40.cpp | 158 +++++++++++++++++++------------------- engines/gnap/scenes/scene40.h | 46 +++++++++++ engines/gnap/scenes/scenecore.cpp | 9 ++- 4 files changed, 129 insertions(+), 90 deletions(-) create mode 100644 engines/gnap/scenes/scene40.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index fe641ceb86..1864d66dca 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -605,12 +605,6 @@ public: // Shared by scenes 17 & 18 int _s18_garbageCanPos; - - // Scene 40 - int scene40_init(); - void scene40_updateHotspots(); - void scene40_run(); - void scene40_updateAnimations(); // Scene 4x void toyUfoSetStatus(int flagNum); diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index 001a923272..c3adbf2f50 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene40.h" namespace Gnap { @@ -38,68 +39,68 @@ enum { kHSDevice = 8 }; -int GnapEngine::scene40_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - return isFlag(kGFUnk23) ? 0x01 : 0x00; +Scene40::Scene40(GnapEngine *vm) : Scene(vm) { } -void GnapEngine::scene40_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_DISABLED | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitCave, 169, 510, 264, 600, SF_EXIT_D_CURSOR, 0, 8); - setHotspot(kHSExitToyStand, 238, 297, 328, 376, SF_EXIT_L_CURSOR, 0, 8); - setHotspot(kHSExitBBQ, 328, 220, 401, 306, SF_EXIT_L_CURSOR, 0, 8); - setHotspot(kHSExitUfo, 421, 215, 501, 282, SF_EXIT_U_CURSOR, 0, 8); - setHotspot(kHSExitKissinBooth, 476, 284, 556, 345, SF_EXIT_R_CURSOR, 0, 8); - setHotspot(kHSExitDancefloor, 317, 455, 445, 600, SF_EXIT_D_CURSOR, 0, 8); - setHotspot(kHSExitShoe, 455, 346, 549, 417, SF_EXIT_D_CURSOR, 0, 8); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 9; +int Scene40::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return _vm->isFlag(kGFUnk23) ? 0x01 : 0x00; } -void GnapEngine::scene40_run() { - - queueInsertDeviceIcon(); - endSceneInit(); +void Scene40::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_DISABLED | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitCave, 169, 510, 264, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHSExitToyStand, 238, 297, 328, 376, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHSExitBBQ, 328, 220, 401, 306, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHSExitUfo, 421, 215, 501, 282, SF_EXIT_U_CURSOR, 0, 8); + _vm->setHotspot(kHSExitKissinBooth, 476, 284, 556, 345, SF_EXIT_R_CURSOR, 0, 8); + _vm->setHotspot(kHSExitDancefloor, 317, 455, 445, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHSExitShoe, 455, 346, 549, 417, SF_EXIT_D_CURSOR, 0, 8); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; +} - while (!_sceneDone) { +void Scene40::run() { + _vm->queueInsertDeviceIcon(); + _vm->endSceneInit(); - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene40_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -107,87 +108,82 @@ void GnapEngine::scene40_run() { break; case kHSExitCave: - if (_gnapActionStatus < 0) { - _newSceneNum = 39; - _sceneDone = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 39; + _vm->_sceneDone = true; } break; case kHSExitToyStand: - if (_gnapActionStatus < 0) { - _newSceneNum = 41; - _sceneDone = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 41; + _vm->_sceneDone = true; } break; case kHSExitBBQ: - if (_gnapActionStatus < 0) { - _newSceneNum = 42; - _sceneDone = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 42; + _vm->_sceneDone = true; } break; case kHSExitUfo: - if (_gnapActionStatus < 0) { - _newSceneNum = 43; - _sceneDone = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 43; + _vm->_sceneDone = true; } break; case kHSExitKissinBooth: - if (_gnapActionStatus < 0) { - _newSceneNum = 44; - _sceneDone = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 44; + _vm->_sceneDone = true; } break; case kHSExitDancefloor: - if (_gnapActionStatus < 0) { - _newSceneNum = 45; - _sceneDone = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 45; + _vm->_sceneDone = true; } break; case kHSExitShoe: - if (_gnapActionStatus < 0) { - _newSceneNum = 46; - _sceneDone = true; + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 46; + _vm->_sceneDone = true; } break; default: - if (_mouseClickState._left && _gnapActionStatus < 0) - _mouseClickState._left = false; + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) + _vm->_mouseClickState._left = false; break; } - scene40_updateAnimations(); - - checkGameKeys(); + updateAnimations(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene40_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene40_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - if (_gnapActionStatus) - _gnapActionStatus = -1; +void Scene40::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus) + _vm->_gnapActionStatus = -1; else - _sceneDone = true; + _vm->_sceneDone = true; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene40.h b/engines/gnap/scenes/scene40.h new file mode 100644 index 0000000000..f4f10103df --- /dev/null +++ b/engines/gnap/scenes/scene40.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE40_H +#define GNAP_SCENE40_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene40: public Scene { +public: + Scene40(GnapEngine *vm); + ~Scene40() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE40_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index cd793fd8e3..291fe73e16 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -61,6 +61,7 @@ #include "gnap/scenes/scene33.h" #include "gnap/scenes/scene38.h" #include "gnap/scenes/scene39.h" +#include "gnap/scenes/scene40.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -348,8 +349,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 40: - backgroundId = scene40_init(); - scene40_updateHotspots(); + _scene = new Scene40(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -666,7 +668,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 40: - scene40_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From ad06f53b6219c66d8ee2e68475ed8c773d99f6ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 16:23:04 +0200 Subject: GNAP: Refactor scene 41 --- engines/gnap/gnap.h | 8 - engines/gnap/scenes/scene41.cpp | 617 +++++++++++++++++++------------------- engines/gnap/scenes/scene41.h | 52 ++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 365 insertions(+), 321 deletions(-) create mode 100644 engines/gnap/scenes/scene41.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 1864d66dca..678bdadeac 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -612,14 +612,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 41 - int _s41_currKidSequenceId, _s41_nextKidSequenceId; - int _s41_currToyVendorSequenceId, _s41_nextToyVendorSequenceId; - int scene41_init(); - void scene41_updateHotspots(); - void scene41_run(); - void scene41_updateAnimations(); - // Scene 42 int _s42_currBBQVendorSequenceId; int _s42_nextBBQVendorSequenceId; diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index c7f278990a..0cc83ff819 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene41.h" namespace Gnap { @@ -58,188 +59,189 @@ enum { kASUfoGumAttached = 9 }; -int GnapEngine::scene41_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); +Scene41::Scene41(GnapEngine *vm) : Scene(vm) { + _s41_currKidSequenceId = -1; + _s41_nextKidSequenceId = -1; + _s41_currToyVendorSequenceId = -1; + _s41_nextToyVendorSequenceId = -1; +} + +int Scene41::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); return 0x129; } -void GnapEngine::scene41_updateHotspots() { - if (isFlag(kGFGnapControlsToyUFO)) { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - setHotspot(kHSUfoExitLeft, 0, 0, 10, 500, SF_EXIT_L_CURSOR | SF_DISABLED); - setHotspot(kHSUfoExitRight, 790, 0, 799, 500, SF_EXIT_R_CURSOR); - setHotspot(kHSUfoWalkArea1, 0, 0, 800, 470, SF_DISABLED); - setDeviceHotspot(kHSUfoDevice, -1, -1, -1, -1); - _hotspotsCount = 5; +void Scene41::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 500, SF_EXIT_L_CURSOR | SF_DISABLED); + _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 500, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHSUfoWalkArea1, 0, 0, 800, 470, SF_DISABLED); + _vm->setDeviceHotspot(kHSUfoDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 5; } else { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitCave, 150, 590, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExit, 0, 100, 10, 599, SF_EXIT_L_CURSOR | SF_DISABLED, 0, 8); - setHotspot(kHSExitBBQ, 790, 100, 799, 599, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - setHotspot(kHSToyVendor, 320, 150, 430, 310, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSKid, 615, 340, 710, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSToyUfo, 0, 0, 0, 0, SF_GRAB_CURSOR); - setHotspot(kHSWalkArea1, 0, 0, 800, 470); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 9; + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitCave, 150, 590, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExit, 0, 100, 10, 599, SF_EXIT_L_CURSOR | SF_DISABLED, 0, 8); + _vm->setHotspot(kHSExitBBQ, 790, 100, 799, 599, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHSToyVendor, 320, 150, 430, 310, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSKid, 615, 340, 710, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSToyUfo, 0, 0, 0, 0, SF_GRAB_CURSOR); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 470); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; } } -void GnapEngine::scene41_run() { - queueInsertDeviceIcon(); +void Scene41::run() { + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoX = 770; - if (_toyUfoY < 0 || _toyUfoY > 300) - _toyUfoY = 150; - if (!_timers[9]) - _gnapActionStatus = kASGiveBackToyUfo; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoX = 770; + if (_vm->_toyUfoY < 0 || _vm->_toyUfoY > 300) + _vm->_toyUfoY = 150; + if (!_vm->_timers[9]) + _vm->_gnapActionStatus = kASGiveBackToyUfo; } else { - if (!isFlag(kGFUnk16) && !isFlag(kGFJointTaken) && !isFlag(kGFUnk18) && !isFlag(kGFGroceryStoreHatTaken)) - toyUfoSetStatus(kGFUnk16); - _toyUfoX = 600; - _toyUfoY = 200; + if (!_vm->isFlag(kGFUnk16) && !_vm->isFlag(kGFJointTaken) && !_vm->isFlag(kGFUnk18) && !_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->toyUfoSetStatus(kGFUnk16); + _vm->_toyUfoX = 600; + _vm->_toyUfoY = 200; } - _toyUfoId = 0; - _toyUfoActionStatus = -1; - _toyUfoSequenceId = toyUfoGetSequenceId(); - _toyUfoNextSequenceId = _toyUfoSequenceId; + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 2); - _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); - _gameSys->insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_gameSys->insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); - if (isFlag(kGFGnapControlsToyUFO)) + if (_vm->isFlag(kGFGnapControlsToyUFO)) _s41_currKidSequenceId = 0x11B; else _s41_currKidSequenceId = 0x11D; _s41_nextKidSequenceId = -1; - _gameSys->setAnimation(_s41_currKidSequenceId, 1, 4); - _gameSys->insertSequence(_s41_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_currKidSequenceId, 1, 4); + _vm->_gameSys->insertSequence(_s41_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _s41_currToyVendorSequenceId = 0x118; _s41_nextToyVendorSequenceId = -1; - _gameSys->setAnimation(0x118, 1, 3); - _gameSys->insertSequence(_s41_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x118, 1, 3); + _vm->_gameSys->insertSequence(_s41_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - _gnapSequenceId = 0x120; - _gnapSequenceDatNum = 0; - _gnapIdleFacing = kDirUpRight; - _gnapX = 7; - _gnapY = 7; - _gnapId = 140; - _gameSys->insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - initPlatypusPos(8, 10, kDirBottomLeft); - endSceneInit(); - } else if (_prevSceneNum == 45) { - initGnapPos(-1, 8, kDirUpRight); - initPlatypusPos(-2, 8, kDirUpLeft); - endSceneInit(); - platypusWalkTo(1, 8, -1, 0x107C2, 1); - gnapWalkTo(2, 8, -1, 0x107B9, 1); - } else if (_prevSceneNum == 42) { - initGnapPos(11, 8, kDirUpRight); - initPlatypusPos(11, 9, kDirUpLeft); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 8, -1, 0x107D2, 1); + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_gnapSequenceId = 0x120; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapX = 7; + _vm->_gnapY = 7; + _vm->_gnapId = 140; + _vm->_gameSys->insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->initPlatypusPos(8, 10, kDirBottomLeft); + _vm->endSceneInit(); + } else if (_vm->_prevSceneNum == 45) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-2, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + } else if (_vm->_prevSceneNum == 42) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - initGnapPos(5, 8, kDirBottomRight); - initPlatypusPos(6, 8, kDirBottomLeft); - endSceneInit(); + _vm->initGnapPos(5, 8, kDirBottomRight); + _vm->initPlatypusPos(6, 8, kDirBottomLeft); + _vm->endSceneInit(); } - _timers[4] = getRandom(100) + 100; - _timers[5] = getRandom(30) + 20; + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; - while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); - if (!isFlag(kGFGnapControlsToyUFO)) { - _hotspots[kHSToyUfo]._x1 = _toyUfoX - 25; - _hotspots[kHSToyUfo]._y1 = _toyUfoY - 20; - _hotspots[kHSToyUfo]._x2 = _toyUfoX + 25; - _hotspots[kHSToyUfo]._y2 = _toyUfoY + 20; + if (!_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_hotspots[kHSToyUfo]._x1 = _vm->_toyUfoX - 25; + _vm->_hotspots[kHSToyUfo]._y1 = _vm->_toyUfoY - 20; + _vm->_hotspots[kHSToyUfo]._x2 = _vm->_toyUfoX + 25; + _vm->_hotspots[kHSToyUfo]._y2 = _vm->_toyUfoY + 20; } - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - - switch (_sceneClickedHotspot) { - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { case kHSUfoExitLeft: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = kASToyUfoLeaveScene; - _newSceneNum = 45; - toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; + _vm->_newSceneNum = 45; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); } break; case kHSUfoExitRight: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = kASToyUfoLeaveScene; - _newSceneNum = 42; - toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; + _vm->_newSceneNum = 42; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); } break; case kHSUfoDevice: - runMenu(); - scene41_updateHotspots(); - _timers[4] = getRandom(100) + 100; - _timers[5] = getRandom(30) + 20; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; break; - } - } else { - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene41_updateHotspots(); - _timers[4] = getRandom(100) + 100; - _timers[5] = getRandom(30) + 20; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -247,151 +249,151 @@ void GnapEngine::scene41_run() { break; case kHSExitCave: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitCave].x, _hotspotsWalkPos[kHSExitCave].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - _newSceneNum = 40; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCave].x, _vm->_hotspotsWalkPos[kHSExitCave].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->_newSceneNum = 40; break; case kHSExit: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExit].x, -1, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExit].x, -1, -1, 0x107CF, 1); - _newSceneNum = 45; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExit].x, -1, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExit].x, -1, -1, 0x107CF, 1); + _vm->_newSceneNum = 45; break; case kHSExitBBQ: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, -1, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, -1, -1, 0x107CD, 1); - _newSceneNum = 42; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, -1, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, -1, -1, 0x107CD, 1); + _vm->_newSceneNum = 42; break; case kHSToyVendor: - if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _gnapActionStatus = kASUseQuarterWithToyVendor; - gnapWalkTo(4, 7, 0, 0x107BB, 9); - playGnapShowItem(_grabCursorSpriteIndex, 5, 0); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(4, 7, 5, 0); + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->_gnapActionStatus = kASUseQuarterWithToyVendor; + _vm->gnapWalkTo(4, 7, 0, 0x107BB, 9); + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 7, 5, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(5, 0); + _vm->playGnapMoan1(5, 0); break; case GRAB_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(4, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkToyVendor; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkToyVendor; break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSKid: - if (_grabCursorSpriteIndex == kItemChickenBucket) { - gnapWalkTo(7, 7, 0, 0x107BB, 1); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASUseChickenBucketWithKid; - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(7, 7, 8, 0); + if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { + _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASUseChickenBucketWithKid; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 7, 8, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(9, 0); + _vm->playGnapScratchingHead(9, 0); break; case GRAB_CURSOR: - gnapWalkTo(7, 7, 0, 0x107BB, 1); - _gnapIdleFacing = kDirUpRight; - _gnapActionStatus = kASGrabKid; + _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kASGrabKid; break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(7, 7, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(7, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSToyUfo: - if (_grabCursorSpriteIndex == kItemGum) { - playGnapPullOutDevice(9, 0); - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 0); - _gnapActionStatus = kASUseGumWithToyUfo; + if (_vm->_grabCursorSpriteIndex == kItemGum) { + _vm->playGnapPullOutDevice(9, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kASUseGumWithToyUfo; } break; case kHSWalkArea1: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (isFlag(kGFGnapControlsToyUFO)) { - if (!_timers[9] && _gnapActionStatus < 0) { - _gnapActionStatus = kASGiveBackToyUfo; - if (_gnapSequenceId == 0x121 || _gnapSequenceId == 0x122) { - _gameSys->insertSequence(0x123, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x123; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x123, _gnapId, 0); + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + if (!_vm->_timers[9] && _vm->_gnapActionStatus < 0) { + _vm->_gnapActionStatus = kASGiveBackToyUfo; + if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x122) { + _vm->_gameSys->insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x123; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x123, _vm->_gnapId, 0); } } } - if (_mouseClickState._left && _gnapActionStatus < 0) { - _mouseClickState._left = false; - if (isFlag(kGFGnapControlsToyUFO)) { + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { int sequenceId; - if (_leftClickMouseX >= 400) { - if (_gnapSequenceId == 0x11F || _gnapSequenceId == 0x120 || _gnapSequenceId == 0x123 || _gnapSequenceId == 0x126) + if (_vm->_leftClickMouseX >= 400) { + if (_vm->_gnapSequenceId == 0x11F || _vm->_gnapSequenceId == 0x120 || _vm->_gnapSequenceId == 0x123 || _vm->_gnapSequenceId == 0x126) sequenceId = 0x120; - else if (_leftClickMouseX - _toyUfoX >= 400) + else if (_vm->_leftClickMouseX - _vm->_toyUfoX >= 400) sequenceId = 0x126; else sequenceId = 0x123; } else { - if (_gnapSequenceId == 0x121 || _gnapSequenceId == 0x125 || _gnapSequenceId == 0x122) + if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x125 || _vm->_gnapSequenceId == 0x122) sequenceId = 0x122; - else if (_toyUfoX - _leftClickMouseX >= 400) + else if (_vm->_toyUfoX - _vm->_leftClickMouseX >= 400) sequenceId = 0x125; else sequenceId = 0x121; } - _gameSys->insertSequence(sequenceId, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = sequenceId; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(sequenceId, _gnapId, 0); - _toyUfoActionStatus = kASToyUfoRefresh; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); + _vm->_gameSys->insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = sequenceId; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(sequenceId, _vm->_gnapId, 0); + _vm->_toyUfoActionStatus = kASToyUfoRefresh; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - scene41_updateAnimations(); + updateAnimations(); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { - switch (getRandom(3)) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { + switch (_vm->getRandom(3)) { case 0: _s41_nextToyVendorSequenceId = 0x113; break; @@ -406,12 +408,12 @@ void GnapEngine::scene41_run() { _s41_nextToyVendorSequenceId = -1; } } - if (!_timers[5]) { - _timers[5] = getRandom(30) + 20; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { - if (isFlag(kGFGnapControlsToyUFO)) + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(30) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { + if (_vm->isFlag(kGFGnapControlsToyUFO)) _s41_nextKidSequenceId = 0x11B; - else if (getRandom(3) != 0) + else if (_vm->getRandom(3) != 0) _s41_nextKidSequenceId = 0x11D; else _s41_nextKidSequenceId = 0x11E; @@ -419,168 +421,163 @@ void GnapEngine::scene41_run() { } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene41_updateHotspots(); - _timers[4] = getRandom(100) + 100; - _timers[5] = getRandom(30) + 20; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - } -void GnapEngine::scene41_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - switch (_gnapActionStatus) { +void Scene41::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _gameSys->setAnimation(0, 0, 0); - _sceneDone = true; - _gnapActionStatus = -1; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; break; case kASUseQuarterWithToyVendor: - _gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 0); _s41_nextToyVendorSequenceId = 0x114; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASTalkToyVendor: - _gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 0); _s41_nextToyVendorSequenceId = 0x116; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; case kASUseGumWithToyUfo: - _gameSys->setAnimation(0, 0, 0); - playGnapUseDevice(9, 0); - _gnapActionStatus = -1; - setGrabCursorSprite(-1); - invRemove(kItemGum); - _toyUfoActionStatus = kASUfoGumAttached; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->playGnapUseDevice(9, 0); + _vm->_gnapActionStatus = -1; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemGum); + _vm->_toyUfoActionStatus = kASUfoGumAttached; break; case kASUseChickenBucketWithKid: - if (_gameSys->getAnimationStatus(4) == 2) { - _timers[2] = getRandom(30) + 20; - _timers[3] = getRandom(50) + 200; - setGrabCursorSprite(-1); - _gameSys->insertSequence(0x11F, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x11F; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x11F, _gnapId, 0); + if (_vm->_gameSys->getAnimationStatus(4) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x11F; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x11F, _vm->_gnapId, 0); _s41_nextKidSequenceId = 0x11A; - _gameSys->insertSequence(0x11A, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + _vm->_gameSys->insertSequence(0x11A, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); _s41_currKidSequenceId = _s41_nextKidSequenceId; _s41_nextKidSequenceId = 0x11B; - _timers[5] = getRandom(30) + 20; - _gnapActionStatus = -1; - setFlag(kGFGnapControlsToyUFO); - scene41_updateHotspots(); - _timers[9] = 600; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_gnapActionStatus = -1; + _vm->setFlag(kGFGnapControlsToyUFO); + updateHotspots(); + _vm->_timers[9] = 600; } break; case kASGrabKid: - if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { - _timers[2] = getRandom(30) + 20; - _timers[3] = getRandom(50) + 200; - _gameSys->insertSequence(0x110, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x110; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x110, _gnapId, 0); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->_gameSys->insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x110; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x110, _vm->_gnapId, 0); _s41_nextToyVendorSequenceId = 0x111; - _gameSys->insertSequence(0x111, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); + _vm->_gameSys->insertSequence(0x111, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; _s41_nextToyVendorSequenceId = -1; - _timers[4] = getRandom(100) + 100; + _vm->_timers[4] = _vm->getRandom(100) + 100; _s41_nextKidSequenceId = 0x10F; - _gameSys->insertSequence(0x10F, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + _vm->_gameSys->insertSequence(0x10F, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); _s41_currKidSequenceId = _s41_nextKidSequenceId; _s41_nextKidSequenceId = -1; - _timers[5] = getRandom(30) + 20; - _gnapActionStatus = -1; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_gnapActionStatus = -1; } break; case kASGiveBackToyUfo: - if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { - _timers[2] = getRandom(30) + 20; - _timers[3] = getRandom(50) + 200; - _gameSys->insertSequence(0x124, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->_gameSys->insertSequence(0x124, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x124; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x124, _gnapId, 0); + _vm->_gnapSequenceId = 0x124; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x124, _vm->_gnapId, 0); _s41_nextToyVendorSequenceId = 0x112; - _gameSys->insertSequence(0x112, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); + _vm->_gameSys->insertSequence(0x112, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; _s41_nextToyVendorSequenceId = -1; - _timers[4] = getRandom(100) + 100; + _vm->_timers[4] = _vm->getRandom(100) + 100; _s41_nextKidSequenceId = 0x11C; - _gameSys->insertSequence(0x11C, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + _vm->_gameSys->insertSequence(0x11C, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); _s41_currKidSequenceId = _s41_nextKidSequenceId; _s41_nextKidSequenceId = -1; - _timers[5] = getRandom(30) + 20; - _gnapActionStatus = -1; - clearFlag(kGFGnapControlsToyUFO); - scene41_updateHotspots(); + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_gnapActionStatus = -1; + _vm->clearFlag(kGFGnapControlsToyUFO); + updateHotspots(); } break; } } - if (_gameSys->getAnimationStatus(2) == 2) { - switch (_toyUfoActionStatus) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + switch (_vm->_toyUfoActionStatus) { case kASToyUfoLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASUfoGumAttached: - _toyUfoNextSequenceId = 0x873; - _gameSys->insertSequence(0x10873, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, _toyUfoX - 365, _toyUfoY - 128); - _toyUfoSequenceId = _toyUfoNextSequenceId; - _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 2); - toyUfoSetStatus(kGFJointTaken); + _vm->_toyUfoNextSequenceId = 0x873; + _vm->_gameSys->insertSequence(0x10873, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 365, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + _vm->toyUfoSetStatus(kGFJointTaken); break; default: - _toyUfoNextSequenceId = toyUfoGetSequenceId(); - _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); - _toyUfoSequenceId = _toyUfoNextSequenceId; - ++_toyUfoId; - _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 2); + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); break; } - _toyUfoActionStatus = -1; + _vm->_toyUfoActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s41_nextToyVendorSequenceId != -1) { - _gameSys->insertSequence(_s41_nextToyVendorSequenceId, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s41_nextToyVendorSequenceId != -1) { + _vm->_gameSys->insertSequence(_s41_nextToyVendorSequenceId, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; _s41_nextToyVendorSequenceId = -1; - _timers[4] = getRandom(100) + 100; + _vm->_timers[4] = _vm->getRandom(100) + 100; } - if (_gameSys->getAnimationStatus(4) == 2 && _s41_nextKidSequenceId != -1) { - _gameSys->insertSequence(_s41_nextKidSequenceId, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s41_nextKidSequenceId != -1) { + _vm->_gameSys->insertSequence(_s41_nextKidSequenceId, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); _s41_currKidSequenceId = _s41_nextKidSequenceId; _s41_nextKidSequenceId = -1; - _timers[5] = getRandom(30) + 20; + _vm->_timers[5] = _vm->getRandom(30) + 20; if (_s41_currKidSequenceId == 0x11E) { - _toyUfoActionStatus = kASToyUfoRefresh; - toyUfoFlyTo(getRandom(300) + 500, getRandom(225) + 75, 0, 799, 0, 300, 2); + _vm->_toyUfoActionStatus = kASToyUfoRefresh; + _vm->toyUfoFlyTo(_vm->getRandom(300) + 500, _vm->getRandom(225) + 75, 0, 799, 0, 300, 2); } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene41.h b/engines/gnap/scenes/scene41.h new file mode 100644 index 0000000000..91e8a1a1a4 --- /dev/null +++ b/engines/gnap/scenes/scene41.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE41_H +#define GNAP_SCENE41_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene41: public Scene { +public: + Scene41(GnapEngine *vm); + ~Scene41() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s41_currKidSequenceId; + int _s41_nextKidSequenceId; + int _s41_currToyVendorSequenceId; + int _s41_nextToyVendorSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE41_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 291fe73e16..dbc731cb9a 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -62,6 +62,7 @@ #include "gnap/scenes/scene38.h" #include "gnap/scenes/scene39.h" #include "gnap/scenes/scene40.h" +#include "gnap/scenes/scene41.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -356,8 +357,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 41: - backgroundId = scene41_init(); - scene41_updateHotspots(); + _scene = new Scene41(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -674,7 +676,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 41: - scene41_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 6043c7842b34f1a551a0680610e352cbe1024443 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 16:42:04 +0200 Subject: GNAP: Refactor scene 42 --- engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene42.cpp | 495 +++++++++++++++++++------------------- engines/gnap/scenes/scene42.h | 50 ++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 306 insertions(+), 257 deletions(-) create mode 100644 engines/gnap/scenes/scene42.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 678bdadeac..7be814ddd2 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -612,15 +612,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 42 - int _s42_currBBQVendorSequenceId; - int _s42_nextBBQVendorSequenceId; - - int scene42_init(); - void scene42_updateHotspots(); - void scene42_run(); - void scene42_updateAnimations(); - // Scene 43 int _s43_currTwoHeadedGuySequenceId; int _s43_nextTwoHeadedGuySequenceId; diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 2ecce592d6..33f961d653 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene42.h" namespace Gnap { @@ -56,168 +57,172 @@ enum { kASToyUfoPickUpHotSauce = 7 }; -int GnapEngine::scene42_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); - if (isFlag(kGFPictureTaken) || (isFlag(kGFUnk18) && isFlag(kGFUnk23))) +Scene42::Scene42(GnapEngine *vm) : Scene(vm) { + _s42_currBBQVendorSequenceId = -1; + _s42_nextBBQVendorSequenceId = -1; +} + +int Scene42::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + if (_vm->isFlag(kGFPictureTaken) || (_vm->isFlag(kGFUnk18) && _vm->isFlag(kGFUnk23))) return 0x153; return 0x152; } -void GnapEngine::scene42_updateHotspots() { - if (isFlag(kGFGnapControlsToyUFO)) { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - setHotspot(kHSUfoHotSauce, 335, 110, 440, 175, SF_DISABLED); - setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - if ((isFlag(kGFPictureTaken) || isFlag(kGFUnk18)) && isFlag(kGFUnk23) && !isFlag(kGFUnk24)) - _hotspots[kHSUfoHotSauce]._flags = SF_GRAB_CURSOR; - _hotspotsCount = 5; +void Scene42::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHSUfoHotSauce, 335, 110, 440, 175, SF_DISABLED); + _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + if ((_vm->isFlag(kGFPictureTaken) || _vm->isFlag(kGFUnk18)) && _vm->isFlag(kGFUnk23) && !_vm->isFlag(kGFUnk24)) + _vm->_hotspots[kHSUfoHotSauce]._flags = SF_GRAB_CURSOR; + _vm->_hotspotsCount = 5; } else { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitUfoParty, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitToyStand, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - setHotspot(kHSExitUfo, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - setHotspot(kHSBBQVendor, 410, 200, 520, 365, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 8); - setHotspot(kHSChickenLeg, 530, 340, 620, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 7); - setHotspot(kHSWalkArea1, 0, 0, 800, 445); - setHotspot(kHSWalkArea2, 240, 0, 550, 495); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 9; + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitUfoParty, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitToyStand, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHSExitUfo, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHSBBQVendor, 410, 200, 520, 365, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 8); + _vm->setHotspot(kHSChickenLeg, 530, 340, 620, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 445); + _vm->setHotspot(kHSWalkArea2, 240, 0, 550, 495); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; } } -void GnapEngine::scene42_run() { - - queueInsertDeviceIcon(); +void Scene42::run() { + _vm->queueInsertDeviceIcon(); _s42_currBBQVendorSequenceId = 0x14A; _s42_nextBBQVendorSequenceId = -1; - _gameSys->setAnimation(0x14A, 1, 2); - _gameSys->insertSequence(_s42_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoId = 0; - _toyUfoActionStatus = -1; - if (_prevSceneNum == 43 && isFlag(kGFUnk18)) { - _toyUfoSequenceId = 0x872; - _toyUfoNextSequenceId = toyUfoGetSequenceId(); - _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, 0, 0); - _toyUfoX = 317; - _toyUfoY = 61; - toyUfoSetStatus(kGFJointTaken); - setFlag(kGFPictureTaken); - _timers[9] = 600; + _vm->_gameSys->setAnimation(0x14A, 1, 2); + _vm->_gameSys->insertSequence(_s42_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + if (_vm->_prevSceneNum == 43 && _vm->isFlag(kGFUnk18)) { + _vm->_toyUfoSequenceId = 0x872; + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_toyUfoX = 317; + _vm->_toyUfoY = 61; + _vm->toyUfoSetStatus(kGFJointTaken); + _vm->setFlag(kGFPictureTaken); + _vm->_timers[9] = 600; } else { - _toyUfoSequenceId = toyUfoGetSequenceId(); - _toyUfoNextSequenceId = _toyUfoSequenceId; - if (_prevSceneNum == 41) - _toyUfoX = 30; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 41) + _vm->_toyUfoX = 30; else - _toyUfoX = 770; - _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); + _vm->_toyUfoX = 770; + _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); } - _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 3); - endSceneInit(); - if (_toyUfoSequenceId == 0x872) - setGrabCursorSprite(-1); - } else if (_prevSceneNum == 41) { - initGnapPos(-1, 8, kDirUpRight); - initPlatypusPos(-1, 9, kDirUpLeft); - endSceneInit(); - gnapWalkTo(2, 8, -1, 0x107B9, 1); - platypusWalkTo(1, 8, -1, 0x107C2, 1); - } else if (_prevSceneNum == 43) { - initGnapPos(11, 8, kDirUpRight); - initPlatypusPos(11, 9, kDirUpLeft); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + _vm->endSceneInit(); + if (_vm->_toyUfoSequenceId == 0x872) + _vm->setGrabCursorSprite(-1); + } else if (_vm->_prevSceneNum == 41) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + } else if (_vm->_prevSceneNum == 43) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - initGnapPos(5, 11, kDirUpRight); - initPlatypusPos(6, 11, kDirUpLeft); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107BA, 1); - platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } - while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - switch (_sceneClickedHotspot) { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { case kHSUfoExitLeft: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = kASToyUfoLeaveScene; - _newSceneNum = 41; - toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; + _vm->_newSceneNum = 41; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); } break; case kHSUfoExitRight: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = kASToyUfoLeaveScene; - _newSceneNum = 43; - toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; + _vm->_newSceneNum = 43; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); } break; case kHSUfoHotSauce: - if (isFlag(kGFJointTaken)) { - _toyUfoActionStatus = kASToyUfoPickUpHotSauce; - toyUfoFlyTo(384, 77, 0, 799, 0, 300, 3); - _timers[9] = 600; + if (_vm->isFlag(kGFJointTaken)) { + _vm->_toyUfoActionStatus = kASToyUfoPickUpHotSauce; + _vm->toyUfoFlyTo(384, 77, 0, 799, 0, 300, 3); + _vm->_timers[9] = 600; } else { - _toyUfoActionStatus = kASToyUfoRefresh; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + _vm->_toyUfoActionStatus = kASToyUfoRefresh; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } break; case kHSUfoDevice: - runMenu(); - scene42_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; } } else { - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene42_updateHotspots(); - _timers[4] = getRandom(20) + 30; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 30; break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -225,70 +230,70 @@ void GnapEngine::scene42_run() { break; case kHSExitUfoParty: - _isLeavingScene = true; - gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_platX, _hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); - _newSceneNum = 40; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_platX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); + _vm->_newSceneNum = 40; break; case kHSExitToyStand: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitToyStand].x, _gnapY, 0, 0x107AF, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitToyStand].x, _hotspotsWalkPos[kHSExitToyStand].y, -1, 0x107CF, 1); - _newSceneNum = 41; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStand].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStand].x, _vm->_hotspotsWalkPos[kHSExitToyStand].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 41; break; case kHSExitUfo: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _gnapY, 0, 0x107AB, 1); - _gnapActionStatus = kASLeaveScene; - platypusWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _hotspotsWalkPos[kHSExitUfo].y, -1, 0x107CD, 1); - _newSceneNum = 43; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kASLeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_hotspotsWalkPos[kHSExitUfo].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 43; break; case kHSBBQVendor: - if (_grabCursorSpriteIndex == kItemDiceQuarterHole) { - gnapWalkTo(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, 0, 0x107BB, 1); - _gnapActionStatus = kASUseQuarterWithBBQVendor; - if (_platY < 9) - platypusWalkTo(_platX, 9, -1, -1, 1); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, _hotspotsWalkPos[kHSBBQVendor].x + 1, 0); + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBBQVendor].x, _vm->_hotspotsWalkPos[kHSBBQVendor].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kASUseQuarterWithBBQVendor; + if (_vm->_platY < 9) + _vm->platypusWalkTo(_vm->_platX, 9, -1, -1, 1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSBBQVendor].x, _vm->_hotspotsWalkPos[kHSBBQVendor].y, _vm->_hotspotsWalkPos[kHSBBQVendor].x + 1, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_hotspotsWalkPos[kHSBBQVendor].x - 1, 0); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHSBBQVendor].x - 1, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSBBQVendor].x, _hotspotsWalkPos[kHSBBQVendor].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = kASTalkBBQVendor; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBBQVendor].x, _vm->_hotspotsWalkPos[kHSBBQVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kASTalkBBQVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSChickenLeg: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSChickenLeg].x, _hotspotsWalkPos[kHSChickenLeg].y, _hotspotsWalkPos[kHSChickenLeg].x - 1, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSChickenLeg].x, _vm->_hotspotsWalkPos[kHSChickenLeg].y, _vm->_hotspotsWalkPos[kHSChickenLeg].x - 1, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(_hotspotsWalkPos[kHSChickenLeg].x - 1, 0); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHSChickenLeg].x - 1, 0); break; case GRAB_CURSOR: - gnapWalkTo(_hotspotsWalkPos[kHSChickenLeg].x, _hotspotsWalkPos[kHSChickenLeg].y, 0, 0x107BC, 1); - _gnapActionStatus = kASGrabChickenLeg; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChickenLeg].x, _vm->_hotspotsWalkPos[kHSChickenLeg].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kASGrabChickenLeg; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -296,36 +301,36 @@ void GnapEngine::scene42_run() { case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_mouseClickState._left && _gnapActionStatus < 0) { - _mouseClickState._left = false; - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoActionStatus = kASToyUfoRefresh; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = kASToyUfoRefresh; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - scene42_updateAnimations(); + updateAnimations(); - toyUfoCheckTimer(); + _vm->toyUfoCheckTimer(); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(20) + 30; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { - switch (getRandom(8)) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 30; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { + switch (_vm->getRandom(8)) { case 0: _s42_nextBBQVendorSequenceId = 0x14C; break; @@ -349,143 +354,143 @@ void GnapEngine::scene42_run() { } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene42_updateHotspots(); - _timers[4] = getRandom(20) + 30; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 30; } - gameUpdateTick(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene42_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - switch (_gnapActionStatus) { +void Scene42::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _gameSys->setAnimation(0, 0, 0); - _gnapActionStatus = -1; - _sceneDone = true; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->_sceneDone = true; break; case kASTalkBBQVendor: - _gameSys->setAnimation(0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; _s42_nextBBQVendorSequenceId = 0x14B; break; case kASUseQuarterWithBBQVendor: case kASGrabChickenLeg: - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { int sequenceId; - if (_gnapActionStatus == kASUseQuarterWithBBQVendor) { - invRemove(kItemDiceQuarterHole); - invAdd(kItemChickenBucket); - setGrabCursorSprite(-1); + if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) { + _vm->invRemove(kItemDiceQuarterHole); + _vm->invAdd(kItemChickenBucket); + _vm->setGrabCursorSprite(-1); sequenceId = 0x150; _s42_nextBBQVendorSequenceId = 0x148; - } else if (isFlag(kGFUnk27)) { - if (isFlag(kGFUnk28)) { + } else if (_vm->isFlag(kGFUnk27)) { + if (_vm->isFlag(kGFUnk28)) { sequenceId = 0x7B7; _s42_nextBBQVendorSequenceId = 0x145; } else { - setFlag(kGFUnk28); + _vm->setFlag(kGFUnk28); sequenceId = 0x14F; _s42_nextBBQVendorSequenceId = 0x147; } } else { - setFlag(kGFUnk27); + _vm->setFlag(kGFUnk27); sequenceId = 0x14E; _s42_nextBBQVendorSequenceId = 0x146; } if (sequenceId == 0x7B7) { - _gameSys->insertSequence(0x107B7, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, getSequenceTotalDuration(_s42_nextBBQVendorSequenceId), - 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - _gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, _vm->getSequenceTotalDuration(_s42_nextBBQVendorSequenceId), + 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceDatNum = 1; } else { - _gameSys->insertSequence(sequenceId, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _vm->_gameSys->insertSequence(sequenceId, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceDatNum = 0; + _vm->_gnapSequenceDatNum = 0; } - _gnapSequenceId = sequenceId; - _gameSys->setAnimation(sequenceId | (_gnapSequenceDatNum << 16), _gnapId, 0); - if (_gnapActionStatus == kASUseQuarterWithBBQVendor) - _gnapActionStatus = kASUseQuarterWithBBQVendorDone; + _vm->_gnapSequenceId = sequenceId; + _vm->_gameSys->setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); + if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) + _vm->_gnapActionStatus = kASUseQuarterWithBBQVendorDone; else - _gnapActionStatus = -1; - _gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; if (_s42_nextBBQVendorSequenceId == 0x145) _s42_nextBBQVendorSequenceId = 0x14A; else _s42_nextBBQVendorSequenceId = -1; - _timers[4] = getRandom(20) + 30; - _timers[2] = getRandom(30) + 20; - _timers[3] = getRandom(50) + 200; + _vm->_timers[4] = _vm->getRandom(20) + 30; + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; } break; case kASUseQuarterWithBBQVendorDone: - _gameSys->setAnimation(0, 0, 0); - setGrabCursorSprite(kItemChickenBucket); - _gnapActionStatus = -1; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->setGrabCursorSprite(kItemChickenBucket); + _vm->_gnapActionStatus = -1; break; default: - _gameSys->setAnimation(0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2 && _s42_nextBBQVendorSequenceId != -1) { - _gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s42_nextBBQVendorSequenceId != -1) { + _vm->_gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; _s42_nextBBQVendorSequenceId = -1; - _timers[4] = getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(20) + 30; } - if (_gameSys->getAnimationStatus(3) == 2) { - switch (_toyUfoActionStatus) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_vm->_toyUfoActionStatus) { case kASToyUfoLeaveScene: - _sceneDone = true; + _vm->_sceneDone = true; break; case kASToyUfoPickUpHotSauce: - _gameSys->insertSequence(0x10870, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); - setFlag(kGFUnk24); - scene42_updateHotspots(); - toyUfoSetStatus(kGFGroceryStoreHatTaken); - _toyUfoSequenceId = 0x870; - _gameSys->setAnimation(0x10870, _toyUfoId, 3); - _toyUfoActionStatus = -1; - _toyUfoX = 0x181; - _toyUfoY = 53; + _vm->_gameSys->insertSequence(0x10870, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFUnk24); + updateHotspots(); + _vm->toyUfoSetStatus(kGFGroceryStoreHatTaken); + _vm->_toyUfoSequenceId = 0x870; + _vm->_gameSys->setAnimation(0x10870, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoX = 0x181; + _vm->_toyUfoY = 53; break; default: - if (_toyUfoSequenceId == 0x872) { - hideCursor(); - addFullScreenSprite(0x13E, 255); - _gameSys->setAnimation(0x151, 256, 0); - _gameSys->insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - removeFullScreenSprite(); - showCursor(); + if (_vm->_toyUfoSequenceId == 0x872) { + _vm->hideCursor(); + _vm->addFullScreenSprite(0x13E, 255); + _vm->_gameSys->setAnimation(0x151, 256, 0); + _vm->_gameSys->insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); } - _toyUfoNextSequenceId = toyUfoGetSequenceId(); - _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, (_toyUfoId + 1) % 10, 3); - _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, (_toyUfoId + 1) % 10, - _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); - _toyUfoSequenceId = _toyUfoNextSequenceId; - _toyUfoId = (_toyUfoId + 1) % 10; + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, 3); + _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + _vm->_toyUfoId = (_vm->_toyUfoId + 1) % 10; break; } - _toyUfoActionStatus = -1; + _vm->_toyUfoActionStatus = -1; } } diff --git a/engines/gnap/scenes/scene42.h b/engines/gnap/scenes/scene42.h new file mode 100644 index 0000000000..a3008a2829 --- /dev/null +++ b/engines/gnap/scenes/scene42.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE42_H +#define GNAP_SCENE42_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene42: public Scene { +public: + Scene42(GnapEngine *vm); + ~Scene42() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s42_currBBQVendorSequenceId; + int _s42_nextBBQVendorSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE42_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index dbc731cb9a..029fb9c845 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -63,6 +63,7 @@ #include "gnap/scenes/scene39.h" #include "gnap/scenes/scene40.h" #include "gnap/scenes/scene41.h" +#include "gnap/scenes/scene42.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -364,8 +365,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 42: - backgroundId = scene42_init(); - scene42_updateHotspots(); + _scene = new Scene42(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -682,7 +684,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 42: - scene42_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 598fb5d87642fc4fd97b8c7818eb8f0f57f1b493 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 17:49:10 +0200 Subject: GNAP: Refactor scene 43 --- engines/gnap/gnap.h | 9 - engines/gnap/scenes/scene43.cpp | 468 +++++++++++++++++++------------------- engines/gnap/scenes/scene43.h | 50 ++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 291 insertions(+), 245 deletions(-) create mode 100644 engines/gnap/scenes/scene43.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 7be814ddd2..3f6e932756 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -612,15 +612,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 43 - int _s43_currTwoHeadedGuySequenceId; - int _s43_nextTwoHeadedGuySequenceId; - - int scene43_init(); - void scene43_updateHotspots(); - void scene43_run(); - void scene43_updateAnimations(); - // Scene 44 int _s44_nextSpringGuySequenceId; int _s44_nextKissingLadySequenceId; diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 5f74dfae35..9c7b56aabf 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene43.h" namespace Gnap { @@ -47,183 +48,185 @@ enum { kHSUfoDevice = 5 }; -int GnapEngine::scene43_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); +Scene43::Scene43(GnapEngine *vm) : Scene(vm) { + _s43_currTwoHeadedGuySequenceId = -1; + _s43_nextTwoHeadedGuySequenceId = -1; +} + +int Scene43::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); return 0x13F; } -void GnapEngine::scene43_updateHotspots() { - if (isFlag(kGFGnapControlsToyUFO)) { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - setHotspot(kHSUfoKey, 140, 170, 185, 260, SF_GRAB_CURSOR); - setHotspot(kHSUfoBucket, 475, 290, 545, 365, SF_DISABLED); - setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - if (isFlag(kGFGroceryStoreHatTaken)) - _hotspots[kHSUfoBucket]._flags = SF_GRAB_CURSOR; +void Scene43::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHSUfoKey, 140, 170, 185, 260, SF_GRAB_CURSOR); + _vm->setHotspot(kHSUfoBucket, 475, 290, 545, 365, SF_DISABLED); + _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_hotspots[kHSUfoBucket]._flags = SF_GRAB_CURSOR; // NOTE Bug in the original. Key hotspot wasn't disabled. - if (isFlag(kGFUnk14)) - _hotspots[kHSUfoKey]._flags = SF_DISABLED; - _hotspotsCount = 6; + if (_vm->isFlag(kGFUnk14)) + _vm->_hotspots[kHSUfoKey]._flags = SF_DISABLED; + _vm->_hotspotsCount = 6; } else { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitBBQ, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - setHotspot(kHSExitKissinBooth, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - setHotspot(kHSTwoHeadedGuy, 470, 240, 700, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSKey, 140, 170, 185, 260, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSUfo, 110, 0, 690, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSWalkArea1, 0, 0, 800, 445); - setHotspot(kHSWalkArea2, 465, 0, 800, 493); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFUnk14)) - _hotspots[kHSKey]._flags = SF_DISABLED; - _hotspotsCount = 10; + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitBBQ, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHSExitKissinBooth, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHSTwoHeadedGuy, 470, 240, 700, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSKey, 140, 170, 185, 260, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSUfo, 110, 0, 690, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 445); + _vm->setHotspot(kHSWalkArea2, 465, 0, 800, 493); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk14)) + _vm->_hotspots[kHSKey]._flags = SF_DISABLED; + _vm->_hotspotsCount = 10; } } -void GnapEngine::scene43_run() { - - queueInsertDeviceIcon(); +void Scene43::run() { + _vm->queueInsertDeviceIcon(); - if (!isFlag(kGFUnk14)) - _gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFUnk14)) + _vm->_gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); _s43_currTwoHeadedGuySequenceId = 0x13C; _s43_nextTwoHeadedGuySequenceId = -1; - _gameSys->setAnimation(0x13C, 1, 2); - _gameSys->insertSequence(_s43_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x13C, 1, 2); + _vm->_gameSys->insertSequence(_s43_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoId = 0; - _toyUfoActionStatus = -1; - _toyUfoSequenceId = toyUfoGetSequenceId(); - _toyUfoNextSequenceId = _toyUfoSequenceId; - if (_prevSceneNum == 42) - _toyUfoX = 30; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 42) + _vm->_toyUfoX = 30; else - _toyUfoX = 770; - _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 3); - _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); - endSceneInit(); + _vm->_toyUfoX = 770; + _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); } else { - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 42: - initGnapPos(-1, 8, kDirUpRight); - initPlatypusPos(-1, 9, kDirUpLeft); - endSceneInit(); - gnapWalkTo(2, 8, -1, 0x107B9, 1); - platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 44: - initGnapPos(11, 8, kDirUpRight); - initPlatypusPos(11, 9, kDirUpLeft); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); break; case 54: - initGnapPos(4, 7, kDirBottomLeft); - initPlatypusPos(11, 8, kDirUpLeft); - endSceneInit(); - platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->initGnapPos(4, 7, kDirBottomLeft); + _vm->initPlatypusPos(11, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); break; default: - initGnapPos(5, 11, kDirUpRight); - initPlatypusPos(6, 11, kDirUpLeft); - endSceneInit(); - gnapWalkTo(5, 8, -1, 0x107BA, 1); - platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); break; } } - while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - - switch (_sceneClickedHotspot) { - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { case kHSUfoDevice: - runMenu(); - scene43_updateHotspots(); - _timers[4] = getRandom(100) + 100; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; break; case kHSUfoExitLeft: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 4; - _newSceneNum = 42; - toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 4; + _vm->_newSceneNum = 42; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); } break; case kHSUfoExitRight: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 4; - _newSceneNum = 44; - toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 4; + _vm->_newSceneNum = 44; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); } break; case kHSUfoKey: - if (isFlag(kGFJointTaken)) { - _toyUfoActionStatus = 6; - toyUfoFlyTo(163, 145, 0, 799, 0, 300, 3); + if (_vm->isFlag(kGFJointTaken)) { + _vm->_toyUfoActionStatus = 6; + _vm->toyUfoFlyTo(163, 145, 0, 799, 0, 300, 3); } else { - _toyUfoActionStatus = 5; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + _vm->_toyUfoActionStatus = 5; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } break; case kHSUfoBucket: - _toyUfoActionStatus = 7; - toyUfoFlyTo(497, 143, 0, 799, 0, 300, 3); - _timers[9] = 600; + _vm->_toyUfoActionStatus = 7; + _vm->toyUfoFlyTo(497, 143, 0, 799, 0, 300, 3); + _vm->_timers[9] = 600; break; } } else { - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene43_updateHotspots(); - _timers[4] = getRandom(100) + 100; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -231,45 +234,45 @@ void GnapEngine::scene43_run() { break; case kHSExitUfoParty: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); - _newSceneNum = 40; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfoParty].x, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitUfoParty].x, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); + _vm->_newSceneNum = 40; break; case kHSExitBBQ: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, _gnapY, 0, 0x107AF, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitBBQ].x, _hotspotsWalkPos[kHSExitBBQ].y, -1, 0x107CF, 1); - _newSceneNum = 42; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, _vm->_hotspotsWalkPos[kHSExitBBQ].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 42; break; case kHSExitKissinBooth: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _gnapY, 0, 0x107AB, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _hotspotsWalkPos[kHSExitKissinBooth].y, -1, 0x107CD, 1); - _newSceneNum = 44; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_hotspotsWalkPos[kHSExitKissinBooth].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 44; break; case kHSTwoHeadedGuy: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(6, 8, 7, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 8, 7, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(7, 0); + _vm->playGnapScratchingHead(7, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(5, 8, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 2; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -277,21 +280,21 @@ void GnapEngine::scene43_run() { case kHSKey: case kHSUfo: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(3, 7, 2, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 7, 2, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(0, 0); + _vm->playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(3, 7, 0, 67515, 1); - _gnapActionStatus = 1; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(3, 7, 0, 67515, 1); + _vm->_gnapActionStatus = 1; break; case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -299,35 +302,35 @@ void GnapEngine::scene43_run() { case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_mouseClickState._left && _gnapActionStatus < 0) { - _mouseClickState._left = false; - if (isFlag(kGFGnapControlsToyUFO) && (_toyUfoActionStatus == 5 || _toyUfoActionStatus == -1)) { - _toyUfoActionStatus = 5; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO) && (_vm->_toyUfoActionStatus == 5 || _vm->_toyUfoActionStatus == -1)) { + _vm->_toyUfoActionStatus = 5; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - scene43_updateAnimations(); + updateAnimations(); - toyUfoCheckTimer(); + _vm->toyUfoCheckTimer(); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateGnapIdleSequence(); - if (!_timers[4] && (!isFlag(kGFGnapControlsToyUFO) || !isFlag(kGFGroceryStoreHatTaken))) { - _timers[4] = getRandom(100) + 100; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { - switch (getRandom(5)) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { + _vm->_timers[4] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { + switch (_vm->getRandom(5)) { case 0: _s43_nextTwoHeadedGuySequenceId = 0x13C; break; @@ -350,127 +353,126 @@ void GnapEngine::scene43_run() { } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene43_updateHotspots(); - _timers[4] = getRandom(100) + 100; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; } - gameUpdateTick(); + _vm->gameUpdateTick(); } - if (_newSceneNum == 54) - clearFlag(kGFGnapControlsToyUFO); + if (_vm->_newSceneNum == 54) + _vm->clearFlag(kGFGnapControlsToyUFO); } -void GnapEngine::scene43_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - switch (_gnapActionStatus) { +void Scene43::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { case 0: - _gameSys->setAnimation(0, 0, 0); - _sceneDone = true; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_sceneDone = true; break; case 1: - if (_gameSys->getAnimationStatus(2) == 2) { - _timers[2] = getRandom(30) + 20; - _timers[3] = getRandom(50) + 200; - _gameSys->insertSequence(0x13D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x13D; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x13D, _gnapId, 0); + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->_gameSys->insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x13D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x13D, _vm->_gnapId, 0); _s43_nextTwoHeadedGuySequenceId = 0x13B; - _gameSys->insertSequence(0x13B, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); + _vm->_gameSys->insertSequence(0x13B, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; _s43_nextTwoHeadedGuySequenceId = -1; - _timers[4] = getRandom(100) + 100; - _gnapActionStatus = -1; + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_gnapActionStatus = -1; } break; default: - _gameSys->setAnimation(0, 0, 0); - _gnapActionStatus = -1; + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { if (_s43_currTwoHeadedGuySequenceId == 0x13A) { - if (isFlag(kGFGroceryStoreHatTaken)) { + if (_vm->isFlag(kGFGroceryStoreHatTaken)) { _s43_nextTwoHeadedGuySequenceId = 0x13E; - stopSound(0x108F6); - } else if (getRandom(2) != 0) { + _vm->stopSound(0x108F6); + } else if (_vm->getRandom(2) != 0) { _s43_nextTwoHeadedGuySequenceId = 0x137; } else { _s43_nextTwoHeadedGuySequenceId = 0x138; } } else if (_s43_currTwoHeadedGuySequenceId == 0x13E) { - _sceneDone = true; - _newSceneNum = 54; + _vm->_sceneDone = true; + _vm->_newSceneNum = 54; } if (_s43_nextTwoHeadedGuySequenceId != -1) { - _gameSys->insertSequence(_s43_nextTwoHeadedGuySequenceId, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); + _vm->_gameSys->insertSequence(_s43_nextTwoHeadedGuySequenceId, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; _s43_nextTwoHeadedGuySequenceId = -1; - _timers[4] = getRandom(100) + 100; + _vm->_timers[4] = _vm->getRandom(100) + 100; } } - if (_gameSys->getAnimationStatus(3) == 2) { - switch (_toyUfoActionStatus) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_vm->_toyUfoActionStatus) { case 4: - _sceneDone = true; - _toyUfoActionStatus = -1; + _vm->_sceneDone = true; + _vm->_toyUfoActionStatus = -1; break; case 6: - _gameSys->insertSequence(0x10871, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); - _gameSys->removeSequence(0x1086F, 1, true); - setFlag(kGFUnk14); - scene43_updateHotspots(); - toyUfoSetStatus(kGFUnk18); - _toyUfoSequenceId = 0x871; - _gameSys->setAnimation(0x10871, _toyUfoId, 3); - _toyUfoActionStatus = -1; - _toyUfoX = 96; - _toyUfoY = 131; + _vm->_gameSys->insertSequence(0x10871, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x1086F, 1, true); + _vm->setFlag(kGFUnk14); + updateHotspots(); + _vm->toyUfoSetStatus(kGFUnk18); + _vm->_toyUfoSequenceId = 0x871; + _vm->_gameSys->setAnimation(0x10871, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoX = 96; + _vm->_toyUfoY = 131; break; case 7: - _gameSys->insertSequence(0x10874, _toyUfoId, _toyUfoSequenceId | 0x10000, _toyUfoId, kSeqSyncWait, 0, 0, 0); - _toyUfoSequenceId = 0x874; - _gameSys->setAnimation(0x10874, _toyUfoId, 3); - _toyUfoActionStatus = 8; - setFlag(kGFJointTaken); - _gnapActionStatus = 3; + _vm->_gameSys->insertSequence(0x10874, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + _vm->_toyUfoSequenceId = 0x874; + _vm->_gameSys->setAnimation(0x10874, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = 8; + _vm->setFlag(kGFJointTaken); + _vm->_gnapActionStatus = 3; break; case 8: _s43_nextTwoHeadedGuySequenceId = 0x13A; - _toyUfoX = 514; - _toyUfoY = 125; - toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); - _toyUfoActionStatus = 9; + _vm->_toyUfoX = 514; + _vm->_toyUfoY = 125; + _vm->toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); + _vm->_toyUfoActionStatus = 9; break; case 9: // Nothing break; default: - _toyUfoNextSequenceId = toyUfoGetSequenceId(); - _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, - _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); - _toyUfoSequenceId = _toyUfoNextSequenceId; - ++_toyUfoId; - _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 3); - _toyUfoActionStatus = -1; + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = -1; break; } } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene43.h b/engines/gnap/scenes/scene43.h new file mode 100644 index 0000000000..427d18bdae --- /dev/null +++ b/engines/gnap/scenes/scene43.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE43_H +#define GNAP_SCENE43_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene43: public Scene { +public: + Scene43(GnapEngine *vm); + ~Scene43() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s43_currTwoHeadedGuySequenceId; + int _s43_nextTwoHeadedGuySequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE43_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 029fb9c845..17ec6b035c 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -64,6 +64,7 @@ #include "gnap/scenes/scene40.h" #include "gnap/scenes/scene41.h" #include "gnap/scenes/scene42.h" +#include "gnap/scenes/scene43.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -372,8 +373,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 43: - backgroundId = scene43_init(); - scene43_updateHotspots(); + _scene = new Scene43(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -690,7 +692,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 43: - scene43_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 206a18dbfacf1292601cbc4db2893bea0c938059 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 19:04:03 +0200 Subject: GNAP: Refactor scene 44 --- engines/gnap/gnap.h | 10 - engines/gnap/scenes/scene44.cpp | 495 +++++++++++++++++++------------------- engines/gnap/scenes/scene44.h | 52 ++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 307 insertions(+), 259 deletions(-) create mode 100644 engines/gnap/scenes/scene44.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 3f6e932756..b74173070a 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -612,16 +612,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 44 - int _s44_nextSpringGuySequenceId; - int _s44_nextKissingLadySequenceId; - int _s44_currSpringGuySequenceId; - int _s44_currKissingLadySequenceId; - int scene44_init(); - void scene44_updateHotspots(); - void scene44_run(); - void scene44_updateAnimations(); - // Scene 45 int _s45_currDancerSequenceId; int scene45_init(); diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index ffd639d2e5..6c3bd9098b 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene44.h" namespace Gnap { @@ -45,196 +46,199 @@ enum { kHSUfoDevice = 3 }; -int GnapEngine::scene44_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); - _gameSys->setAnimation(0, 0, 3); +Scene44::Scene44(GnapEngine *vm) : Scene(vm) { + _s44_nextSpringGuySequenceId = -1; + _s44_nextKissingLadySequenceId = -1; + _s44_currSpringGuySequenceId = -1; + _s44_currKissingLadySequenceId = -1; +} + +int Scene44::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 3); return 0xFF; } -void GnapEngine::scene44_updateHotspots() { - if (isFlag(kGFGnapControlsToyUFO)) { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - _hotspotsCount = 4; +void Scene44::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + _vm->_hotspotsCount = 4; } else { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitUfo, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - setHotspot(kHSExitShow, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - setHotspot(kHSKissingLady, 300, 160, 400, 315, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - setHotspot(kHSSpring, 580, 310, 635, 375, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - setHotspot(kHSSpringGuy, 610, 375, 690, 515, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - setHotspot(kHSWalkArea1, 0, 0, 800, 445); - setHotspot(kHSWalkArea2, 617, 0, 800, 600); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFUnk13)) - _hotspots[kHSKissingLady]._flags = SF_DISABLED; - if (isFlag(kGFSpringTaken)) - _hotspots[kHSSpring]._flags = SF_DISABLED; - _hotspotsCount = 10; + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitUfo, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHSExitShow, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHSKissingLady, 300, 160, 400, 315, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHSSpring, 580, 310, 635, 375, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHSSpringGuy, 610, 375, 690, 515, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 445); + _vm->setHotspot(kHSWalkArea2, 617, 0, 800, 600); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk13)) + _vm->_hotspots[kHSKissingLady]._flags = SF_DISABLED; + if (_vm->isFlag(kGFSpringTaken)) + _vm->_hotspots[kHSSpring]._flags = SF_DISABLED; + _vm->_hotspotsCount = 10; } } -void GnapEngine::scene44_run() { - queueInsertDeviceIcon(); +void Scene44::run() { + _vm->queueInsertDeviceIcon(); - _gameSys->insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); - _gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFSpringTaken)) + if (_vm->isFlag(kGFSpringTaken)) _s44_currSpringGuySequenceId = 0xF8; else _s44_currSpringGuySequenceId = 0xF9; _s44_nextSpringGuySequenceId = -1; - _gameSys->setAnimation(_s44_currSpringGuySequenceId, 1, 4); - _gameSys->insertSequence(_s44_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s44_currSpringGuySequenceId, 1, 4); + _vm->_gameSys->insertSequence(_s44_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFUnk13)) { - if (_prevSceneNum != 50 || _sceneSavegameLoaded) { + if (_vm->isFlag(kGFUnk13)) { + if (_vm->_prevSceneNum != 50 || _vm->_sceneSavegameLoaded) { _s44_currKissingLadySequenceId = 0xF6; _s44_nextKissingLadySequenceId = -1; } else { - setGrabCursorSprite(kItemGum); + _vm->setGrabCursorSprite(kItemGum); _s44_currKissingLadySequenceId = 0xF5; _s44_nextKissingLadySequenceId = 0xF6; - _gameSys->setAnimation(0xF5, 1, 2); + _vm->_gameSys->setAnimation(0xF5, 1, 2); } } else { _s44_currKissingLadySequenceId = 0xEC; _s44_nextKissingLadySequenceId = -1; - _gameSys->setAnimation(0xEC, 1, 2); + _vm->_gameSys->setAnimation(0xEC, 1, 2); } - _gameSys->insertSequence(_s44_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s44_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoId = 0; - _toyUfoActionStatus = -1; - _toyUfoSequenceId = toyUfoGetSequenceId(); - _toyUfoNextSequenceId = _toyUfoSequenceId; - if (_prevSceneNum == 43) - _toyUfoX = 30; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 43) + _vm->_toyUfoX = 30; else - _toyUfoX = 770; - _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 3); - _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); - endSceneInit(); + _vm->_toyUfoX = 770; + _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); } else { - switch (_prevSceneNum) { + switch (_vm->_prevSceneNum) { case 43: - initGnapPos(-1, 8, kDirUpRight); - initPlatypusPos(-1, 7, kDirUpLeft); - endSceneInit(); - gnapWalkTo(2, 8, -1, 0x107B9, 1); - platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 7, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 46: - initGnapPos(11, 8, kDirUpRight); - initPlatypusPos(11, 8, kDirUpLeft); - endSceneInit(); - gnapWalkTo(6, 8, -1, 0x107BA, 1); - platypusWalkTo(7, 8, -1, 0x107D2, 1); + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(7, 8, -1, 0x107D2, 1); break; case 50: - initGnapPos(4, 8, kDirBottomRight); - if (_sceneSavegameLoaded) { - initPlatypusPos(_hotspotsWalkPos[4].x, _hotspotsWalkPos[4].y, kDirUnk4); - } else if (!isFlag(kGFUnk13)) { - _timers[0] = 50; - _timers[1] = 20; - _platX = 5; - _platY = 8; - _platypusSequenceId = 0xFD; - _platypusFacing = kDirNone; - _platypusId = 160; - _platypusSequenceDatNum = 0; - _gameSys->insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); + _vm->initGnapPos(4, 8, kDirBottomRight); + if (_vm->_sceneSavegameLoaded) { + _vm->initPlatypusPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); + } else if (!_vm->isFlag(kGFUnk13)) { + _vm->_timers[0] = 50; + _vm->_timers[1] = 20; + _vm->_platX = 5; + _vm->_platY = 8; + _vm->_platypusSequenceId = 0xFD; + _vm->_platypusFacing = kDirNone; + _vm->_platypusId = 160; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); } - endSceneInit(); + _vm->endSceneInit(); break; default: - initGnapPos(5, 11, kDirUpRight); - initPlatypusPos(6, 11, kDirUpLeft); - endSceneInit(); - platypusWalkTo(6, 8, -1, 0x107C2, 1); - gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); break; } } - while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - switch (_sceneClickedHotspot) { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { case kHSUfoExitLeft: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 6; - _newSceneNum = 43; - toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 6; + _vm->_newSceneNum = 43; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); } break; case kHSUfoExitRight: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 6; - _newSceneNum = 46; - toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 6; + _vm->_newSceneNum = 46; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); } break; case kHSUfoDevice: - runMenu(); - scene44_updateHotspots(); - _timers[4] = getRandom(20) + 20; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; break; - } - - } else if (_sceneClickedHotspot <= 9) { - - switch (_sceneClickedHotspot) { - + } else if (_vm->_sceneClickedHotspot <= 9) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene44_updateHotspots(); - _timers[4] = getRandom(20) + 20; + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -242,101 +246,101 @@ void GnapEngine::scene44_run() { break; case kHSExitUfoParty: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitUfoParty].x, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _gnapActionStatus = 0; - _newSceneNum = 40; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfoParty].x, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 40; break; case kHSExitUfo: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _gnapY, 0, 0x107AF, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitUfo].x, _platY, -1, 0x107CF, 1); - _newSceneNum = 43; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_platY, -1, 0x107CF, 1); + _vm->_newSceneNum = 43; break; case kHSExitShow: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitShow].x, _hotspotsWalkPos[kHSExitShow].y, 0, 0x107AB, 1); - _gnapActionStatus = 0; - _newSceneNum = 46; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitShow].x, _vm->_hotspotsWalkPos[kHSExitShow].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 46; break; case kHSKissingLady: - if (_grabCursorSpriteIndex >= 0) { - _gnapActionStatus = 2; - gnapWalkTo(_hotspotsWalkPos[kHSKissingLady].x, _hotspotsWalkPos[kHSKissingLady].y, 0, -1, 9); - playGnapShowItem(_grabCursorSpriteIndex, _hotspotsWalkPos[kHSKissingLady].x - 1, _hotspotsWalkPos[kHSKissingLady].y); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gnapActionStatus = 2; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSKissingLady].x, _vm->_hotspotsWalkPos[kHSKissingLady].y, 0, -1, 9); + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHSKissingLady].x - 1, _vm->_hotspotsWalkPos[kHSKissingLady].y); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(4, 3); + _vm->playGnapScratchingHead(4, 3); break; case GRAB_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSKissingLady].x, _hotspotsWalkPos[kHSKissingLady].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 1; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSKissingLady].x, _vm->_hotspotsWalkPos[kHSKissingLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 1; break; case PLAT_CURSOR: - gnapUseDeviceOnPlatypuss(); - platypusWalkTo(6, 7, 1, 0x107D2, 1); - if (_gnapX == 7 && _gnapY == 7) - gnapWalkStep(); - playGnapIdle(5, 7); - _platypusActionStatus = 4; + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(6, 7, 1, 0x107D2, 1); + if (_vm->_gnapX == 7 && _vm->_gnapY == 7) + _vm->gnapWalkStep(); + _vm->playGnapIdle(5, 7); + _vm->_platypusActionStatus = 4; break; } } break; case kHSSpring: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSSpring].x, _hotspotsWalkPos[kHSSpring].y, 8, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSSpring].x, _vm->_hotspotsWalkPos[kHSSpring].y, 8, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(8, 7); + _vm->playGnapScratchingHead(8, 7); break; case GRAB_CURSOR: - playGnapPullOutDevice(8, 0); - playGnapUseDevice(8, 0); + _vm->playGnapPullOutDevice(8, 0); + _vm->playGnapUseDevice(8, 0); _s44_nextSpringGuySequenceId = 0xFB; - invAdd(kItemSpring); - setFlag(kGFSpringTaken); - scene44_updateHotspots(); + _vm->invAdd(kItemSpring); + _vm->setFlag(kGFSpringTaken); + updateHotspots(); break; case TALK_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSSpringGuy: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSSpringGuy].x, _hotspotsWalkPos[kHSSpringGuy].y, 8, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSSpringGuy].x, _vm->_hotspotsWalkPos[kHSSpringGuy].y, 8, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (isFlag(kGFSpringTaken)) - playGnapMoan1(8, 7); + if (_vm->isFlag(kGFSpringTaken)) + _vm->playGnapMoan1(8, 7); else - playGnapScratchingHead(8, 7); + _vm->playGnapScratchingHead(8, 7); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSSpringGuy].x, _hotspotsWalkPos[kHSSpringGuy].y, -1, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSSpringGuy].x, _vm->_hotspotsWalkPos[kHSSpringGuy].y, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -344,36 +348,35 @@ void GnapEngine::scene44_run() { case kHSWalkArea1: case kHSWalkArea2: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_mouseClickState._left && _gnapActionStatus < 0) { - _mouseClickState._left = false; - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoActionStatus = 7; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = 7; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - scene44_updateAnimations(); - - toyUfoCheckTimer(); + updateAnimations(); + _vm->toyUfoCheckTimer(); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO) && _s44_currKissingLadySequenceId != 0xF5) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { - switch (getRandom(20)) { + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _s44_currKissingLadySequenceId != 0xF5) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { + switch (_vm->getRandom(20)) { case 0: _s44_nextKissingLadySequenceId = 0xED; break; @@ -397,14 +400,14 @@ void GnapEngine::scene44_run() { _s44_nextKissingLadySequenceId = -1; } } - if (!_timers[5]) { - _timers[5] = getRandom(20) + 20; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { - if (getRandom(5) != 0) { - if (!isFlag(kGFSpringTaken)) + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { + if (_vm->getRandom(5) != 0) { + if (!_vm->isFlag(kGFSpringTaken)) _s44_nextSpringGuySequenceId = 0xF9; } else { - if (isFlag(kGFSpringTaken)) + if (_vm->isFlag(kGFSpringTaken)) _s44_nextSpringGuySequenceId = 0xF8; else _s44_nextSpringGuySequenceId = 0xFA; @@ -413,25 +416,25 @@ void GnapEngine::scene44_run() { } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene44_updateHotspots(); - _timers[4] = getRandom(20) + 20; + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; } - gameUpdateTick(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene44_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene44::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case 0: - _sceneDone = true; + _vm->_sceneDone = true; break; case 1: _s44_nextKissingLadySequenceId = 0xEF; @@ -440,78 +443,78 @@ void GnapEngine::scene44_updateAnimations() { _s44_nextKissingLadySequenceId = 0xF2; break; } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - switch (_platypusActionStatus) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { case 4: - if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->insertSequence(0xFE, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, kSeqSyncWait, 0, 0, 0); - _platypusSequenceId = 0xFE; - _platypusSequenceDatNum = 0; - _gameSys->setAnimation(0xFE, _platypusId, 1); - _gameSys->removeSequence(_s44_currKissingLadySequenceId, 1, true); - _platypusActionStatus = 5; + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xFE; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0xFE, _vm->_platypusId, 1); + _vm->_gameSys->removeSequence(_s44_currKissingLadySequenceId, 1, true); + _vm->_platypusActionStatus = 5; } break; case 5: - _sceneDone = true; - _newSceneNum = 50; + _vm->_sceneDone = true; + _vm->_newSceneNum = 50; break; default: - _platypusActionStatus = -1; + _vm->_platypusActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(2) == 2) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { if (_s44_nextKissingLadySequenceId == 0xF6) { - _gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - initPlatypusPos(5, 8, kDirNone); + _vm->_gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->initPlatypusPos(5, 8, kDirNone); _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; _s44_nextKissingLadySequenceId = -1; - _gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 2); } else if (_s44_nextKissingLadySequenceId != -1) { - _gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s44_nextKissingLadySequenceId, 1, 2); + _vm->_gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s44_nextKissingLadySequenceId, 1, 2); _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; _s44_nextKissingLadySequenceId = -1; - _timers[4] = getRandom(20) + 20; + _vm->_timers[4] = _vm->getRandom(20) + 20; } } - if (_gameSys->getAnimationStatus(4) == 2) { + if (_vm->_gameSys->getAnimationStatus(4) == 2) { if (_s44_currSpringGuySequenceId == 0xFB) { - setGrabCursorSprite(kItemSpring); + _vm->setGrabCursorSprite(kItemSpring); _s44_nextSpringGuySequenceId = 0xF8; } if (_s44_nextSpringGuySequenceId != -1) { - _gameSys->insertSequence(_s44_nextSpringGuySequenceId, 1, _s44_currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s44_nextSpringGuySequenceId, 1, 4); + _vm->_gameSys->insertSequence(_s44_nextSpringGuySequenceId, 1, _s44_currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s44_nextSpringGuySequenceId, 1, 4); _s44_currSpringGuySequenceId = _s44_nextSpringGuySequenceId; _s44_nextSpringGuySequenceId = -1; - _timers[5] = getRandom(20) + 20; + _vm->_timers[5] = _vm->getRandom(20) + 20; } } - if (_gameSys->getAnimationStatus(3) == 2) { - switch (_toyUfoActionStatus) { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_vm->_toyUfoActionStatus) { case 6: - _sceneDone = true; + _vm->_sceneDone = true; break; default: - _toyUfoNextSequenceId = toyUfoGetSequenceId(); - _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, - _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); - _toyUfoSequenceId = _toyUfoNextSequenceId; - ++_toyUfoId; - _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 3); + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); break; } - _toyUfoActionStatus = -1; + _vm->_toyUfoActionStatus = -1; } } diff --git a/engines/gnap/scenes/scene44.h b/engines/gnap/scenes/scene44.h new file mode 100644 index 0000000000..f26cba0039 --- /dev/null +++ b/engines/gnap/scenes/scene44.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE44_H +#define GNAP_SCENE44_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene44: public Scene { +public: + Scene44(GnapEngine *vm); + ~Scene44() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s44_nextSpringGuySequenceId; + int _s44_nextKissingLadySequenceId; + int _s44_currSpringGuySequenceId; + int _s44_currKissingLadySequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE44_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 17ec6b035c..6cbd34f749 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -65,6 +65,7 @@ #include "gnap/scenes/scene41.h" #include "gnap/scenes/scene42.h" #include "gnap/scenes/scene43.h" +#include "gnap/scenes/scene44.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -380,8 +381,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 44: - backgroundId = scene44_init(); - scene44_updateHotspots(); + _scene = new Scene44(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -698,7 +700,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 44: - scene44_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From 1cf3c3b93ee4e9e96f12ae471ceeb6cf354b6db8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 19:22:58 +0200 Subject: GNAP: Rename variables of scene 29 --- engines/gnap/scenes/scene29.cpp | 80 ++++++++++++++++++++--------------------- engines/gnap/scenes/scene29.h | 8 ++--- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp index 0f64304272..5312a0bf8a 100644 --- a/engines/gnap/scenes/scene29.cpp +++ b/engines/gnap/scenes/scene29.cpp @@ -43,10 +43,10 @@ enum { }; Scene29::Scene29(GnapEngine *vm) : Scene(vm) { - _s28_currMonkeySequenceId = -1; - _s28_nextMonkeySequenceId = -1; - _s28_currManSequenceId = -1; - _s28_nextManSequenceId = -1; + _s29_currMonkeySequenceId = -1; + _s29_nextMonkeySequenceId = -1; + _s29_currManSequenceId = -1; + _s29_nextManSequenceId = -1; } int Scene29::init() { @@ -72,13 +72,13 @@ void Scene29::run() { _vm->queueInsertDeviceIcon(); if (_vm->invHas(kItemHorn)) { - _s28_currMonkeySequenceId = 0xE8; - _s28_nextMonkeySequenceId = -1; + _s29_currMonkeySequenceId = 0xE8; + _s29_nextMonkeySequenceId = -1; _vm->_gameSys->setAnimation(0xE8, 159, 4); - _vm->_gameSys->insertSequence(_s28_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s29_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _s28_currManSequenceId = 0xED; - _s28_nextManSequenceId = -1; + _s29_currManSequenceId = 0xED; + _s29_nextManSequenceId = -1; _vm->_gameSys->setAnimation(0xED, 39, 3); _vm->_timers[4] = _vm->getRandom(20) + 60; } else { @@ -249,19 +249,19 @@ void Scene29::run() { if (_vm->_gnapActionStatus < 0) { switch (_vm->getRandom(5)) { case 0: - _s28_nextManSequenceId = 0xED; + _s29_nextManSequenceId = 0xED; break; case 1: - _s28_nextManSequenceId = 0xEE; + _s29_nextManSequenceId = 0xEE; break; case 2: - _s28_nextManSequenceId = 0xEF; + _s29_nextManSequenceId = 0xEF; break; case 3: - _s28_nextManSequenceId = 0xF0; + _s29_nextManSequenceId = 0xF0; break; case 4: - _s28_nextManSequenceId = 0xF1; + _s29_nextManSequenceId = 0xF1; break; } } @@ -287,7 +287,7 @@ void Scene29::updateAnimations() { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kASUseBananaWithMonkey: - _s28_nextMonkeySequenceId = 0xE5; + _s29_nextMonkeySequenceId = 0xE5; break; case kASLeaveScene: _vm->_sceneDone = true; @@ -295,61 +295,61 @@ void Scene29::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s28_nextManSequenceId != -1) { - _vm->_gameSys->insertSequence(_s28_nextManSequenceId, 39, _s28_currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s28_nextManSequenceId, 39, 3); - _s28_currManSequenceId = _s28_nextManSequenceId; - _s28_nextManSequenceId = -1; + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s29_nextManSequenceId != -1) { + _vm->_gameSys->insertSequence(_s29_nextManSequenceId, 39, _s29_currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s29_nextManSequenceId, 39, 3); + _s29_currManSequenceId = _s29_nextManSequenceId; + _s29_nextManSequenceId = -1; } if (_vm->_gameSys->getAnimationStatus(4) == 2) { - if (_s28_nextMonkeySequenceId == 0xE5) { + if (_s29_nextMonkeySequenceId == 0xE5) { _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0xF2; _vm->_gameSys->setAnimation(0xE6, 159, 0); _vm->_gameSys->setAnimation(0, 159, 4); - _vm->_gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xE6, 159, _s28_nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xE6, 159, _s29_nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kASLeaveScene; - _s28_currMonkeySequenceId = 0xE6; - _s28_nextMonkeySequenceId = -1; + _s29_currMonkeySequenceId = 0xE6; + _s29_nextMonkeySequenceId = -1; _vm->_timers[5] = 30; while (_vm->_timers[5]) _vm->gameUpdateTick(); _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); while (_vm->_gameSys->getAnimationStatus(1) != 2) _vm->gameUpdateTick(); - } else if (_s28_nextMonkeySequenceId == -1) { + } else if (_s29_nextMonkeySequenceId == -1) { switch (_vm->getRandom(6)) { case 0: - _s28_nextMonkeySequenceId = 0xE8; + _s29_nextMonkeySequenceId = 0xE8; break; case 1: - _s28_nextMonkeySequenceId = 0xE9; + _s29_nextMonkeySequenceId = 0xE9; break; case 2: - _s28_nextMonkeySequenceId = 0xEA; + _s29_nextMonkeySequenceId = 0xEA; break; case 3: - _s28_nextMonkeySequenceId = 0xEB; + _s29_nextMonkeySequenceId = 0xEB; break; case 4: - _s28_nextMonkeySequenceId = 0xEC; + _s29_nextMonkeySequenceId = 0xEC; break; case 5: - _s28_nextMonkeySequenceId = 0xE7; + _s29_nextMonkeySequenceId = 0xE7; break; } - _vm->_gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); - _s28_currMonkeySequenceId = _s28_nextMonkeySequenceId; - _s28_nextMonkeySequenceId = -1; + _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s29_nextMonkeySequenceId, 159, 4); + _s29_currMonkeySequenceId = _s29_nextMonkeySequenceId; + _s29_nextMonkeySequenceId = -1; } else { - _vm->_gameSys->insertSequence(_s28_nextMonkeySequenceId, 159, _s28_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s28_nextMonkeySequenceId, 159, 4); - _s28_currMonkeySequenceId = _s28_nextMonkeySequenceId; - _s28_nextMonkeySequenceId = -1; + _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s29_nextMonkeySequenceId, 159, 4); + _s29_currMonkeySequenceId = _s29_nextMonkeySequenceId; + _s29_nextMonkeySequenceId = -1; } } diff --git a/engines/gnap/scenes/scene29.h b/engines/gnap/scenes/scene29.h index 1b9e2c3408..3ce5d8d497 100644 --- a/engines/gnap/scenes/scene29.h +++ b/engines/gnap/scenes/scene29.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {}; private: - int _s28_currMonkeySequenceId; - int _s28_nextMonkeySequenceId; - int _s28_currManSequenceId; - int _s28_nextManSequenceId; + int _s29_currMonkeySequenceId; + int _s29_nextMonkeySequenceId; + int _s29_currManSequenceId; + int _s29_nextManSequenceId; }; } // End of namespace Gnap -- cgit v1.2.3 From 5246356d44ba883c1d315b25d060d8dacfc4bddc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 20:14:42 +0200 Subject: GNAP: Refactor scene 45 --- engines/gnap/gnap.h | 7 - engines/gnap/scenes/scene45.cpp | 499 +++++++++++++++++++------------------- engines/gnap/scenes/scene45.h | 49 ++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 301 insertions(+), 263 deletions(-) create mode 100644 engines/gnap/scenes/scene45.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index b74173070a..dcb01edae5 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -612,13 +612,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 45 - int _s45_currDancerSequenceId; - int scene45_init(); - void scene45_updateHotspots(); - void scene45_run(); - void scene45_updateAnimations(); - // Scene 46 int _s46_currSackGuySequenceId; int _s46_nextItchyGuySequenceId; diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 1a875060a7..2490dddbb5 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene45.h" namespace Gnap { @@ -43,212 +44,210 @@ enum { kHSUfoDevice = 3 }; -int GnapEngine::scene45_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); - _gameSys->setAnimation(0, 0, 3); - _gameSys->setAnimation(0, 0, 4); - _gameSys->setAnimation(0, 0, 5); - return isFlag(kGFUnk23) ? 0xA2 : 0xA1; +Scene45::Scene45(GnapEngine *vm) : Scene(vm) { + _s45_currDancerSequenceId = -1; } -void GnapEngine::scene45_updateHotspots() { - if (isFlag(kGFGnapControlsToyUFO)) { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - setHotspot(kHSUfoExitRight, 794, 0, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED); - setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - _hotspotsCount = 4; +int Scene45::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->_gameSys->setAnimation(0, 0, 5); + return _vm->isFlag(kGFUnk23) ? 0xA2 : 0xA1; +} + +void Scene45::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHSUfoExitRight, 794, 0, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED); + _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + _vm->_hotspotsCount = 4; } else { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitShoe, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - setHotspot(kHSExitRight, 794, 100, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED, 10, 8); - setHotspot(kHSExitDiscoBall, 200, 0, 600, 10, SF_DISABLED); - setHotspot(kHSDiscoBall, 370, 10, 470, 125, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - setHotspot(kHSWalkArea1, 0, 0, 800, 472); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (isFlag(kGFUnk22)) { - _hotspots[kHSPlatypus]._flags = SF_DISABLED; - _hotspots[kHSExitUfoParty]._flags = SF_DISABLED; - _hotspots[kHSExitShoe]._flags = SF_DISABLED; - _hotspots[kHSExitRight]._flags = SF_DISABLED; - _hotspots[kHSExitDiscoBall]._flags = SF_EXIT_U_CURSOR; + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitShoe, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHSExitRight, 794, 100, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED, 10, 8); + _vm->setHotspot(kHSExitDiscoBall, 200, 0, 600, 10, SF_DISABLED); + _vm->setHotspot(kHSDiscoBall, 370, 10, 470, 125, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 472); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk22)) { + _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; + _vm->_hotspots[kHSExitUfoParty]._flags = SF_DISABLED; + _vm->_hotspots[kHSExitShoe]._flags = SF_DISABLED; + _vm->_hotspots[kHSExitRight]._flags = SF_DISABLED; + _vm->_hotspots[kHSExitDiscoBall]._flags = SF_EXIT_U_CURSOR; } - if (isFlag(kGFUnk23) || isFlag(kGFUnk22)) - _hotspots[kHSDiscoBall]._flags = SF_DISABLED; - _hotspotsCount = 8; + if (_vm->isFlag(kGFUnk23) || _vm->isFlag(kGFUnk22)) + _vm->_hotspots[kHSDiscoBall]._flags = SF_DISABLED; + _vm->_hotspotsCount = 8; } } -void GnapEngine::scene45_run() { - if (!isSoundPlaying(0x1094A)) - playSound(0x1094A, true); +void Scene45::run() { + if (!_vm->isSoundPlaying(0x1094A)) + _vm->playSound(0x1094A, true); - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - _gameSys->insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x96, 1, 3); - _gameSys->insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(0x99, 1, 4); + _vm->_gameSys->insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x96, 1, 3); + _vm->_gameSys->insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x99, 1, 4); _s45_currDancerSequenceId = 0x8F; - _gameSys->setAnimation(_s45_currDancerSequenceId, 1, 2); - _gameSys->insertSequence(_s45_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_s45_currDancerSequenceId, 1, 2); + _vm->_gameSys->insertSequence(_s45_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoId = 0; - _toyUfoActionStatus = -1; - _toyUfoSequenceId = toyUfoGetSequenceId(); - _toyUfoNextSequenceId = _toyUfoSequenceId; - if (_prevSceneNum == 46) - _toyUfoX = 30; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 46) + _vm->_toyUfoX = 30; else - _toyUfoX = 770; - _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 5); - _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); - endSceneInit(); - } else if (isFlag(kGFUnk22)) { - _gnapSequenceId = 0x9E; - _gnapSequenceDatNum = 0; - _gnapId = 1; - _gameSys->setAnimation(0x9E, 1, 0); - _gnapActionStatus = 1; - _gameSys->insertSequence(_gnapSequenceId, _gnapId, 0, 0, kSeqNone, 0, 0, 0); - initPlatypusPos(4, 8, kDirNone); - endSceneInit(); - } else if (_prevSceneNum == 46) { - initGnapPos(-1, 8, kDirUpRight); - initPlatypusPos(-1, 9, kDirUpLeft); - endSceneInit(); - platypusWalkTo(4, 8, -1, 0x107C2, 1); - gnapWalkTo(2, 7, -1, 0x107B9, 1); - } else if (_prevSceneNum == 41) { - initGnapPos(11, 8, kDirUpRight); - initPlatypusPos(11, 9, kDirUpLeft); - endSceneInit(); - platypusWalkTo(4, 8, -1, 0x107D2, 1); - gnapWalkTo(10, 9, -1, 0x107BA, 1); + _vm->_toyUfoX = 770; + _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 5); + _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); + } else if (_vm->isFlag(kGFUnk22)) { + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapId = 1; + _vm->_gameSys->setAnimation(0x9E, 1, 0); + _vm->_gnapActionStatus = 1; + _vm->_gameSys->insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->initPlatypusPos(4, 8, kDirNone); + _vm->endSceneInit(); + } else if (_vm->_prevSceneNum == 46) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + } else if (_vm->_prevSceneNum == 41) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); + _vm->gnapWalkTo(10, 9, -1, 0x107BA, 1); } else { - initGnapPos(2, 11, kDirUpRight); - initPlatypusPos(6, 11, kDirUpLeft); - endSceneInit(); - platypusWalkTo(4, 8, -1, 0x107C2, 1); - gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->initGnapPos(2, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); } - if (!isFlag(kGFUnk21) && !isFlag(kGFGnapControlsToyUFO)) { - setFlag(kGFUnk21); - setGrabCursorSprite(-1); - _gameSys->setAnimation(0x9D, _gnapId, 0); - _gameSys->insertSequence(0x9D, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) { - gameUpdateTick(); - if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->setAnimation(0, 0, 2); - int newSeqId = getRandom(7) + 0x8F; - _gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(newSeqId, 1, 2); + if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setFlag(kGFUnk21); + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x9D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + _vm->gameUpdateTick(); + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(0, 0, 2); + int newSeqId = _vm->getRandom(7) + 0x8F; + _vm->_gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(newSeqId, 1, 2); _s45_currDancerSequenceId = newSeqId; } - if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { - _gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x96, 1, 3); - _gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x99, 1, 4); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + _vm->_gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x96, 1, 3); + _vm->_gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x99, 1, 4); } } - _gnapSequenceId = 0x9D; - _gnapSequenceDatNum = 0; - hideCursor(); - addFullScreenSprite(0x8A, 255); - _gameSys->setAnimation(0xA0, 256, 0); - _gameSys->insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - _gameSys->setAnimation(0x107BD, _gnapId, 0); - _gameSys->insertSequence(0x107BD, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); - removeFullScreenSprite(); - showCursor(); - _gnapSequenceId = 0x7BD; - _gnapSequenceDatNum = 1; + _vm->_gnapSequenceId = 0x9D; + _vm->_gnapSequenceDatNum = 0; + _vm->hideCursor(); + _vm->addFullScreenSprite(0x8A, 255); + _vm->_gameSys->setAnimation(0xA0, 256, 0); + _vm->_gameSys->insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->_gameSys->setAnimation(0x107BD, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x107BD, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->_gnapSequenceId = 0x7BD; + _vm->_gnapSequenceDatNum = 1; } - playPlatypusSequence(0x9A); - _gameSys->setAnimation(_platypusSequenceId, _platypusId, 1); + _vm->playPlatypusSequence(0x9A); + _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); - while (!_sceneDone) { - if (!isSoundPlaying(0x1094A)) - playSound(0x1094A, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094A)) + _vm->playSound(0x1094A, true); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - - switch (_sceneClickedHotspot) { - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { case kHSUfoExitLeft: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 2; - _newSceneNum = 46; - toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 5); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 2; + _vm->_newSceneNum = 46; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 5); } break; case kHSUfoExitRight: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 2; - _newSceneNum = 41; - toyUfoFlyTo(835, -1, 0, 835, 0, 300, 5); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 2; + _vm->_newSceneNum = 41; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 5); } break; case kHSUfoDevice: - runMenu(); - scene45_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; - } - } else { - - switch (_sceneClickedHotspot) { - + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene45_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); - playPlatypusSequence(0x9A); - _gameSys->setAnimation(_platypusSequenceId, _platypusId, 1); + _vm->gnapKissPlatypus(0); + _vm->playPlatypusSequence(0x9A); + _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -256,59 +255,59 @@ void GnapEngine::scene45_run() { break; case kHSExitUfoParty: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _gnapActionStatus = 0; - _newSceneNum = 40; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 40; } break; case kHSExitShoe: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitShoe].x, _gnapY, 0, 0x107AF, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitShoe].x, _platY, -1, 0x107CF, 1); - _newSceneNum = 46; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitShoe].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitShoe].x, _vm->_platY, -1, 0x107CF, 1); + _vm->_newSceneNum = 46; } break; case kHSExitRight: - if (_gnapActionStatus < 0) { - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitRight].x, _gnapY, 0, 0x107AB, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitRight].x, _platY, -1, 0x107CD, 1); - _newSceneNum = 41; + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitRight].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitRight].x, _vm->_platY, -1, 0x107CD, 1); + _vm->_newSceneNum = 41; } break; case kHSExitDiscoBall: - clearFlag(kGFUnk22); - setFlag(kGFUnk23); - _sceneDone = true; - _newSceneNum = 54; + _vm->clearFlag(kGFUnk22); + _vm->setFlag(kGFUnk23); + _vm->_sceneDone = true; + _vm->_newSceneNum = 54; break; case kHSDiscoBall: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex == kItemSpring) { - gnapWalkTo(_hotspotsWalkPos[kHSDiscoBall].x, _hotspotsWalkPos[kHSDiscoBall].y, 0, 0x9F, 5); - _gnapActionStatus = 1; - setGrabCursorSprite(-1); - invRemove(kItemSpring); - } else if (_grabCursorSpriteIndex >= 0) { - playGnapShowItem(_grabCursorSpriteIndex, 5, 0); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemSpring) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSDiscoBall].x, _vm->_hotspotsWalkPos[kHSDiscoBall].y, 0, 0x9F, 5); + _vm->_gnapActionStatus = 1; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemSpring); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapScratchingHead(5, 0); + _vm->playGnapScratchingHead(5, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } @@ -316,111 +315,105 @@ void GnapEngine::scene45_run() { break; case kHSWalkArea1: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - } - } - if (_mouseClickState._left && _gnapActionStatus < 0) { - _mouseClickState._left = false; - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoActionStatus = 3; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = 3; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - scene45_updateAnimations(); - toyUfoCheckTimer(); + updateAnimations(); + _vm->toyUfoCheckTimer(); - if (!_isLeavingScene && _gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateGnapIdleSequence(); + if (!_vm->_isLeavingScene && _vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene45_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); - + _vm->gameUpdateTick(); } - _sceneWaiting = 0; - + _vm->_sceneWaiting = 0; } -void GnapEngine::scene45_updateAnimations() { - - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene45::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case 0: - _sceneDone = true; + _vm->_sceneDone = true; break; case 1: - _sceneWaiting = 1; - setFlag(kGFUnk22); - scene45_updateHotspots(); - _gameSys->insertSequence(0x9E, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, kSeqSyncWait, 0, 0, 0); - _gnapSequenceId = 0x9E; - _gnapSequenceDatNum = 0; - _gameSys->setAnimation(0x9E, _gnapId, 0); + _vm->_sceneWaiting = 1; + _vm->setFlag(kGFUnk22); + updateHotspots(); + _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); break; default: - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; break; } } - if (_gameSys->getAnimationStatus(1) == 2) { - _gameSys->setAnimation(0, 0, 1); - if (getRandom(2) != 0) - playPlatypusSequence(0x9B); + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->getRandom(2) != 0) + _vm->playPlatypusSequence(0x9B); else - playPlatypusSequence(0x9C); - _gameSys->setAnimation(_platypusSequenceId, _platypusId, 1); + _vm->playPlatypusSequence(0x9C); + _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); } - if (_gameSys->getAnimationStatus(2) == 2) { - _gameSys->setAnimation(0, 0, 2); - int newSeqId = getRandom(7) + 0x8F; - _gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(newSeqId, 1, 2); + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(0, 0, 2); + int newSeqId = _vm->getRandom(7) + 0x8F; + _vm->_gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(newSeqId, 1, 2); _s45_currDancerSequenceId = newSeqId; } - if (_gameSys->getAnimationStatus(3) == 2 && _gameSys->getAnimationStatus(4) == 2) { - _gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x96, 1, 3); - _gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0x99, 1, 4); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + _vm->_gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x96, 1, 3); + _vm->_gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x99, 1, 4); } - if (_gameSys->getAnimationStatus(5) == 2) { - switch (_toyUfoActionStatus) { + if (_vm->_gameSys->getAnimationStatus(5) == 2) { + switch (_vm->_toyUfoActionStatus) { case 2: - _sceneDone = true; + _vm->_sceneDone = true; break; default: - _toyUfoNextSequenceId = toyUfoGetSequenceId(); - _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, - _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); - _toyUfoSequenceId = _toyUfoNextSequenceId; - ++_toyUfoId; - _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 5); + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 5); break; } - _toyUfoActionStatus = -1; + _vm->_toyUfoActionStatus = -1; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene45.h b/engines/gnap/scenes/scene45.h new file mode 100644 index 0000000000..549e0779cf --- /dev/null +++ b/engines/gnap/scenes/scene45.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE45_H +#define GNAP_SCENE45_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene45: public Scene { +public: + Scene45(GnapEngine *vm); + ~Scene45() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s45_currDancerSequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE45_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 6cbd34f749..95b66fe3e4 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -66,6 +66,7 @@ #include "gnap/scenes/scene42.h" #include "gnap/scenes/scene43.h" #include "gnap/scenes/scene44.h" +#include "gnap/scenes/scene45.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -388,8 +389,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 45: - backgroundId = scene45_init(); - scene45_updateHotspots(); + _scene = new Scene45(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -706,7 +708,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 45: - scene45_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From f58874aa45f399344742fa0dc6bc6e36aa9c7552 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 20:32:22 +0200 Subject: GNAP: Refactor scene 46 --- engines/gnap/gnap.h | 10 -- engines/gnap/scenes/scene46.cpp | 364 +++++++++++++++++++------------------- engines/gnap/scenes/scene46.h | 52 ++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 242 insertions(+), 193 deletions(-) create mode 100644 engines/gnap/scenes/scene46.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index dcb01edae5..aa8de62de1 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -612,16 +612,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 46 - int _s46_currSackGuySequenceId; - int _s46_nextItchyGuySequenceId; - int _s46_nextSackGuySequenceId; - int _s46_currItchyGuySequenceId; - int scene46_init(); - void scene46_updateHotspots(); - void scene46_run(); - void scene46_updateAnimations(); - // Scene 49 int _s49_scoreBarPos, _s49_scoreLevel; bool _s49_scoreBarFlash; diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 0f26181093..74b60def33 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene46.h" namespace Gnap { @@ -43,150 +44,154 @@ enum { kHSUfoDevice = 3 }; -int GnapEngine::scene46_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0, 0, 2); - _gameSys->setAnimation(0, 0, 3); - _gameSys->setAnimation(0, 0, 4); +Scene46::Scene46(GnapEngine *vm) : Scene(vm) { + _s46_currSackGuySequenceId = -1; + _s46_nextItchyGuySequenceId = -1; + _s46_nextSackGuySequenceId = -1; + _s46_currItchyGuySequenceId = -1; +} + +int Scene46::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 4); return 0x4E; } -void GnapEngine::scene46_updateHotspots() { - if (isFlag(kGFGnapControlsToyUFO)) { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - _hotspotsCount = 4; +void Scene46::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); + _vm->_hotspotsCount = 4; } else { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - setHotspot(kHSExitKissinBooth, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - setHotspot(kHSExitDisco, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - setHotspot(kHSSackGuy, 180, 370, 235, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - setHotspot(kHSItchyGuy, 535, 210, 650, 480, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - setHotspot(kHSWalkArea1, 0, 0, 800, 485); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 8; + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHSExitKissinBooth, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHSExitDisco, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHSSackGuy, 180, 370, 235, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHSItchyGuy, 535, 210, 650, 480, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 485); + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 8; } } -void GnapEngine::scene46_run() { +void Scene46::run() { + _vm->queueInsertDeviceIcon(); - queueInsertDeviceIcon(); - - _gameSys->insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); _s46_currSackGuySequenceId = 0x4B; _s46_nextSackGuySequenceId = -1; - _gameSys->setAnimation(0x4B, 1, 3); - _gameSys->insertSequence(_s46_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x4B, 1, 3); + _vm->_gameSys->insertSequence(_s46_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _s46_currItchyGuySequenceId = 0x47; _s46_nextItchyGuySequenceId = -1; - _gameSys->setAnimation(0x47, 1, 4); - _gameSys->insertSequence(_s46_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x47, 1, 4); + _vm->_gameSys->insertSequence(_s46_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoId = 0; - _toyUfoActionStatus = -1; - _toyUfoSequenceId = toyUfoGetSequenceId(); - _toyUfoNextSequenceId = _toyUfoSequenceId; - if (_prevSceneNum == 44) - _toyUfoX = 30; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 44) + _vm->_toyUfoX = 30; else - _toyUfoX = 770; - _gameSys->setAnimation(_toyUfoSequenceId | 0x10000, _toyUfoId, 2); - _gameSys->insertSequence(_toyUfoSequenceId | 0x10000, _toyUfoId, 0, 0, kSeqNone, 0, _toyUfoX - 274, _toyUfoY - 128); - endSceneInit(); - } else if (_prevSceneNum == 44) { - initGnapPos(-1, 8, kDirUpRight); - initPlatypusPos(-1, 8, kDirUpLeft); - endSceneInit(); - platypusWalkTo(1, 8, -1, 0x107C2, 1); - gnapWalkTo(2, 8, -1, 0x107B9, 1); - } else if (_prevSceneNum == 45) { - initGnapPos(11, 8, kDirUpRight); - initPlatypusPos(12, 8, kDirUpLeft); - endSceneInit(); - gnapWalkTo(8, 8, -1, 0x107BA, 1); - platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->_toyUfoX = 770; + _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); + } else if (_vm->_prevSceneNum == 44) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + } else if (_vm->_prevSceneNum == 45) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(12, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - initGnapPos(5, 11, kDirUpRight); - initPlatypusPos(6, 11, kDirUpLeft); - endSceneInit(); - platypusWalkTo(5, 8, -1, 0x107C2, 1); - gnapWalkTo(6, 8, -1, 0x107BA, 1); + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); } - _timers[4] = getRandom(50) + 80; - _timers[5] = getRandom(50) + 80; + _vm->_timers[4] = _vm->getRandom(50) + 80; + _vm->_timers[5] = _vm->getRandom(50) + 80; - while (!_sceneDone) { - if (!isSoundPlaying(0x1094B)) - playSound(0x1094B, true); + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 0, -1, -1, -1, -1); - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - if (isFlag(kGFGnapControlsToyUFO)) { - - switch (_sceneClickedHotspot) { - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { case kHSUfoExitLeft: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 3; - _newSceneNum = 44; - toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 3; + _vm->_newSceneNum = 44; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); } break; case kHSUfoExitRight: - if (_toyUfoActionStatus < 0) { - _isLeavingScene = true; - _toyUfoActionStatus = 3; - _newSceneNum = 45; - toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 3; + _vm->_newSceneNum = 45; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); } break; case kHSUfoDevice: - runMenu(); - scene46_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; } } else { - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case kHSDevice: - runMenu(); - scene46_updateHotspots(); + _vm->runMenu(); + updateHotspots(); break; case kHSPlatypus: - if (_gnapActionStatus < 0) { - if (_grabCursorSpriteIndex >= 0) { - playGnapImpossible(_platX, _platY); + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_platX, _platY); + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); break; case GRAB_CURSOR: - gnapKissPlatypus(0); + _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - playGnapBrainPulsating(_platX, _platY); - playPlatypusSequence(getPlatypusSequenceId()); + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - playGnapImpossible(_platX, _platY); + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); break; } } @@ -194,130 +199,129 @@ void GnapEngine::scene46_run() { break; case kHSSackGuy: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSSackGuy].x, _hotspotsWalkPos[kHSSackGuy].y, 2, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSSackGuy].x, _vm->_hotspotsWalkPos[kHSSackGuy].y, 2, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_hotspotsWalkPos[kHSSackGuy].x + 1, 0); + _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHSSackGuy].x + 1, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpLeft; - gnapWalkTo(_hotspotsWalkPos[kHSSackGuy].x, _hotspotsWalkPos[kHSSackGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 2; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSSackGuy].x, _vm->_hotspotsWalkPos[kHSSackGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSItchyGuy: - if (_grabCursorSpriteIndex >= 0) { - playGnapShowCurrItem(_hotspotsWalkPos[kHSItchyGuy].x, _hotspotsWalkPos[kHSItchyGuy].y, 7, 0); + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSItchyGuy].x, _vm->_hotspotsWalkPos[kHSItchyGuy].y, 7, 0); } else { - switch (_verbCursor) { + switch (_vm->_verbCursor) { case LOOK_CURSOR: - playGnapMoan1(_hotspotsWalkPos[kHSItchyGuy].x - 1, 0); + _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHSItchyGuy].x - 1, 0); break; case TALK_CURSOR: - _gnapIdleFacing = kDirUpRight; - gnapWalkTo(_hotspotsWalkPos[kHSItchyGuy].x, _hotspotsWalkPos[kHSItchyGuy].y, 0, getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _gnapActionStatus = 1; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSItchyGuy].x, _vm->_hotspotsWalkPos[kHSItchyGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 1; break; case GRAB_CURSOR: case PLAT_CURSOR: - playGnapImpossible(0, 0); + _vm->playGnapImpossible(0, 0); break; } } break; case kHSExitUfoParty: - _isLeavingScene = true; - gnapWalkTo(_gnapX, _hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _gnapActionStatus = 0; - _newSceneNum = 40; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 40; break; case kHSExitKissinBooth: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _gnapY, 0, 0x107AF, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitKissinBooth].x, _platY, -1, 0x107CF, 1); - _newSceneNum = 44; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_platY, -1, 0x107CF, 1); + _vm->_newSceneNum = 44; break; case kHSExitDisco: - _isLeavingScene = true; - gnapWalkTo(_hotspotsWalkPos[kHSExitDisco].x, _gnapY, 0, 0x107AB, 1); - _gnapActionStatus = 0; - platypusWalkTo(_hotspotsWalkPos[kHSExitDisco].x, _platY, -1, 0x107CD, 1); - _newSceneNum = 45; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitDisco].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitDisco].x, _vm->_platY, -1, 0x107CD, 1); + _vm->_newSceneNum = 45; break; case kHSWalkArea1: - if (_gnapActionStatus < 0) - gnapWalkTo(-1, -1, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_mouseClickState._left && _gnapActionStatus < 0) { - _mouseClickState._left = false; - if (isFlag(kGFGnapControlsToyUFO)) { - _toyUfoActionStatus = 4; - toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = 4; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - scene46_updateAnimations(); - - toyUfoCheckTimer(); + updateAnimations(); + _vm->toyUfoCheckTimer(); - if (!_isLeavingScene) { - if (_platypusActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updatePlatypusIdleSequence(); - if (_gnapActionStatus < 0 && !isFlag(kGFGnapControlsToyUFO)) - updateGnapIdleSequence(); - if (!_timers[4]) { - _timers[4] = getRandom(50) + 80; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { - if (getRandom(2) != 0) + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(50) + 80; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { + if (_vm->getRandom(2) != 0) _s46_nextItchyGuySequenceId = 0x49; else _s46_nextItchyGuySequenceId = 0x48; } } - if (!_timers[5]) { - _timers[5] = getRandom(50) + 80; - if (_gnapActionStatus < 0 && _platypusActionStatus < 0 && _s46_nextSackGuySequenceId == -1) + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 80; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s46_nextSackGuySequenceId == -1) _s46_nextSackGuySequenceId = 0x4C; } } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene46_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - gameUpdateTick(); + _vm->gameUpdateTick(); } } -void GnapEngine::scene46_updateAnimations() { - if (_gameSys->getAnimationStatus(0) == 2) { - _gameSys->setAnimation(0, 0, 0); - switch (_gnapActionStatus) { +void Scene46::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { case 0: - _sceneDone = true; + _vm->_sceneDone = true; break; case 1: _s46_nextItchyGuySequenceId = 0x46; @@ -326,41 +330,41 @@ void GnapEngine::scene46_updateAnimations() { _s46_nextSackGuySequenceId = 0x4A; break; } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - if (_gameSys->getAnimationStatus(3) == 2 && _s46_nextSackGuySequenceId != -1) { - _gameSys->insertSequence(_s46_nextSackGuySequenceId, 1, _s46_currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s46_nextSackGuySequenceId, 1, 3); + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s46_nextSackGuySequenceId != -1) { + _vm->_gameSys->insertSequence(_s46_nextSackGuySequenceId, 1, _s46_currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s46_nextSackGuySequenceId, 1, 3); _s46_currSackGuySequenceId = _s46_nextSackGuySequenceId; _s46_nextSackGuySequenceId = -1; - _timers[5] = getRandom(50) + 80; + _vm->_timers[5] = _vm->getRandom(50) + 80; } - if (_gameSys->getAnimationStatus(4) == 2 && _s46_nextItchyGuySequenceId != -1) { - _gameSys->insertSequence(_s46_nextItchyGuySequenceId, 1, _s46_currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(_s46_nextItchyGuySequenceId, 1, 4); + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s46_nextItchyGuySequenceId != -1) { + _vm->_gameSys->insertSequence(_s46_nextItchyGuySequenceId, 1, _s46_currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_s46_nextItchyGuySequenceId, 1, 4); _s46_currItchyGuySequenceId = _s46_nextItchyGuySequenceId; _s46_nextItchyGuySequenceId = -1; - _timers[4] = getRandom(50) + 80; + _vm->_timers[4] = _vm->getRandom(50) + 80; } - if (_gameSys->getAnimationStatus(2) == 2) { - switch (_toyUfoActionStatus) { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + switch (_vm->_toyUfoActionStatus) { case 3: - _sceneDone = true; + _vm->_sceneDone = true; break; default: - _toyUfoNextSequenceId = toyUfoGetSequenceId(); - _gameSys->insertSequence(_toyUfoNextSequenceId | 0x10000, _toyUfoId + 1, - _toyUfoSequenceId | 0x10000, _toyUfoId, - kSeqSyncWait, 0, _toyUfoX - 274, _toyUfoY - 128); - _toyUfoSequenceId = _toyUfoNextSequenceId; - ++_toyUfoId; - _gameSys->setAnimation(_toyUfoNextSequenceId | 0x10000, _toyUfoId, 2); + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); break; } - _toyUfoActionStatus = -1; + _vm->_toyUfoActionStatus = -1; } } diff --git a/engines/gnap/scenes/scene46.h b/engines/gnap/scenes/scene46.h new file mode 100644 index 0000000000..c7beca277d --- /dev/null +++ b/engines/gnap/scenes/scene46.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE46_H +#define GNAP_SCENE46_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene46: public Scene { +public: + Scene46(GnapEngine *vm); + ~Scene46() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s46_currSackGuySequenceId; + int _s46_nextItchyGuySequenceId; + int _s46_nextSackGuySequenceId; + int _s46_currItchyGuySequenceId; +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE46_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 95b66fe3e4..8c22cc8703 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -67,6 +67,7 @@ #include "gnap/scenes/scene43.h" #include "gnap/scenes/scene44.h" #include "gnap/scenes/scene45.h" +#include "gnap/scenes/scene46.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene54.h" @@ -396,8 +397,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 46: - backgroundId = scene46_init(); - scene46_updateHotspots(); + _scene = new Scene46(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -714,7 +716,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 37; break; case 46: - scene46_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 37; break; -- cgit v1.2.3 From f3b59a2dfb96fad1610e9169e5858d66b4ebee80 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 20:36:37 +0200 Subject: GNAP: Enforce the use of boolean values for _sceneWaiting --- engines/gnap/scenes/scene18.cpp | 2 +- engines/gnap/scenes/scene45.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 0e17531c91..6f4ef67d07 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -461,7 +461,7 @@ void Scene18::run() { case kHSCowboyHat: if (_vm->_gnapActionStatus == kASStandingOnHydrant) { _vm->_gnapActionStatus = kASGrabCowboyHat; - _vm->_sceneWaiting = 0; + _vm->_sceneWaiting = false; } else if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatyPussDisguised)) { gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 2490dddbb5..15722ab7e5 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -348,7 +348,7 @@ void Scene45::run() { _vm->gameUpdateTick(); } - _vm->_sceneWaiting = 0; + _vm->_sceneWaiting = false; } void Scene45::updateAnimations() { @@ -359,7 +359,7 @@ void Scene45::updateAnimations() { _vm->_sceneDone = true; break; case 1: - _vm->_sceneWaiting = 1; + _vm->_sceneWaiting = true; _vm->setFlag(kGFUnk22); updateHotspots(); _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); -- cgit v1.2.3 From 5b0ff520b729fd4c58c800f5c7f64233a5afe8e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 20:55:54 +0200 Subject: GNAP: Refactor scene 49 --- engines/gnap/gnap.h | 28 ---- engines/gnap/scenes/scene49.cpp | 304 +++++++++++++++++++------------------- engines/gnap/scenes/scene49.h | 79 ++++++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 4 files changed, 240 insertions(+), 180 deletions(-) create mode 100644 engines/gnap/scenes/scene49.h diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index aa8de62de1..5063d90808 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -250,17 +250,6 @@ enum { // 0x7AF Gnap walks to the left 1 // 0x7B0 Gnap walks to the left 2 -struct Scene49Obstacle { - int _currSequenceId; - int _closerSequenceId; - int _passedSequenceId; - int _splashSequenceId; - int _collisionSequenceId; - int _prevId; - int _currId; - int _laneNum; -}; - struct Scene51Item { int _currSequenceId; int _droppedSequenceId; @@ -612,23 +601,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 49 - int _s49_scoreBarPos, _s49_scoreLevel; - bool _s49_scoreBarFlash; - int _s49_obstacleIndex; - Scene49Obstacle _s49_obstacles[5]; - int _s49_truckSequenceId, _s49_truckId, _s49_truckLaneNum; - int scene49_init(); - void scene49_updateHotspots(); - void scene49_checkObstacles(); - void scene49_updateObstacle(int id); - void scene49_increaseScore(int amount); - void scene49_decreaseScore(int amount); - void scene49_refreshScoreBar(); - void scene49_clearObstacle(int index); - void scene49_run(); - void scene49_updateAnimations(); - // Scene 50 bool _s50_fightDone; int _s50_timesPlayed, _s50_timesPlayedModifier; diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index 2c92919a8b..97a8724072 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -23,13 +23,10 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene49.h" namespace Gnap { -struct ObstacleDef { - int sequenceId, ticks; -}; - static const ObstacleDef kObstacleDefs[] = { {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14}, {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12}, @@ -43,36 +40,56 @@ static const ObstacleDef kObstacleDefs[] = { {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15} }; -int GnapEngine::scene49_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); +Scene49::Scene49(GnapEngine *vm) : Scene(vm) { + _s49_scoreBarFlash = false; + _s49_scoreBarPos = -1; + _s49_scoreLevel = -1; + _s49_obstacleIndex = -1; + _s49_truckSequenceId = -1; + _s49_truckId = -1; + _s49_truckLaneNum = -1; + + for (int i = 0; i < 5; i++) { + _s49_obstacles[i]._currSequenceId = -1; + _s49_obstacles[i]._closerSequenceId = -1; + _s49_obstacles[i]._passedSequenceId = -1; + _s49_obstacles[i]._splashSequenceId = -1; + _s49_obstacles[i]._collisionSequenceId = -1; + _s49_obstacles[i]._prevId = -1; + _s49_obstacles[i]._currId = -1; + _s49_obstacles[i]._laneNum = -1; + } +} + +int Scene49::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); for (int i = 0; i < 5; ++i) - _gameSys->setAnimation(0, 0, i + 2); - _timers[2] = 0; - _timers[0] = 0; - _timers[1] = 0; - clearKeyStatus1(28); - clearKeyStatus1(54); - clearKeyStatus1(52); + _vm->_gameSys->setAnimation(0, 0, i + 2); + _vm->_timers[2] = 0; + _vm->_timers[0] = 0; + _vm->_timers[1] = 0; + _vm->clearKeyStatus1(28); + _vm->clearKeyStatus1(54); + _vm->clearKeyStatus1(52); return 0xD5; } -void GnapEngine::scene49_updateHotspots() { - _hotspotsCount = 0; +void Scene49::updateHotspots() { + _vm->_hotspotsCount = 0; } -void GnapEngine::scene49_checkObstacles() { - - if (_timers[2] == 0) { - - if (_timers[3] == 0) +void Scene49::checkObstacles() { + if (_vm->_timers[2] == 0) { + if (_vm->_timers[3] == 0) { for (int i = 0; i < 5; ++i) - scene49_clearObstacle(i); + clearObstacle(i); + } for (int j = 0; j < 5; ++j) { if (_s49_obstacles[j]._currSequenceId == 0) { - _timers[3] = 35; - _s49_obstacles[j]._currSequenceId = kObstacleDefs[_s49_obstacleIndex].sequenceId; + _vm->_timers[3] = 35; + _s49_obstacles[j]._currSequenceId = kObstacleDefs[_s49_obstacleIndex]._sequenceId; switch (_s49_obstacles[j]._currSequenceId) { case 0xB4: _s49_obstacles[j]._laneNum = 1; @@ -126,9 +143,9 @@ void GnapEngine::scene49_checkObstacles() { } _s49_obstacles[j]._prevId = _s49_truckId; _s49_obstacles[j]._currId = _s49_obstacles[j]._prevId; - _gameSys->setAnimation(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, j + 2); - _gameSys->insertSequence(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); - _timers[2] = kObstacleDefs[_s49_obstacleIndex].ticks; + _vm->_gameSys->setAnimation(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, j + 2); + _vm->_gameSys->insertSequence(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); + _vm->_timers[2] = kObstacleDefs[_s49_obstacleIndex]._ticks; ++_s49_obstacleIndex; if (_s49_obstacleIndex == 50) _s49_obstacleIndex = 0; @@ -140,12 +157,10 @@ void GnapEngine::scene49_checkObstacles() { } -void GnapEngine::scene49_updateObstacle(int id) { - +void Scene49::updateObstacle(int id) { Scene49Obstacle &obstacle = _s49_obstacles[id]; - obstacle._currId = obstacle._prevId; - + switch (obstacle._laneNum) { case 1: obstacle._prevId = _s49_truckId + 1; @@ -167,39 +182,39 @@ void GnapEngine::scene49_updateObstacle(int id) { if (obstacle._currSequenceId == obstacle._closerSequenceId) { if (_s49_truckLaneNum == obstacle._laneNum) { if (obstacle._splashSequenceId) { - _gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - _gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; - playSound(224, false); - scene49_increaseScore(30); + _vm->playSound(224, false); + increaseScore(30); } else if ((obstacle._laneNum == 1 && _s49_truckSequenceId == 0xB0) || (obstacle._laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || (obstacle._laneNum == 3 && _s49_truckSequenceId == 0xB3)) { - _gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._passedSequenceId; } else { - _gameSys->setAnimation(obstacle._collisionSequenceId, 256, 0); - _gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, 256, 0); + _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - _gameSys->insertSequence(obstacle._collisionSequenceId, 256, + _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = obstacle._collisionSequenceId; _s49_truckId = 256; obstacle._currSequenceId = obstacle._passedSequenceId; - playSound(225, false); - scene49_decreaseScore(30); + _vm->playSound(225, false); + decreaseScore(30); } } else { - _gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._passedSequenceId; @@ -207,55 +222,54 @@ void GnapEngine::scene49_updateObstacle(int id) { } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { if (_s49_truckLaneNum == obstacle._laneNum) { if (obstacle._splashSequenceId) { - _gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - _gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; - playSound(224, false); - scene49_increaseScore(30); + _vm->playSound(224, false); + increaseScore(30); } } else if (obstacle._splashSequenceId) { - _gameSys->setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); - _gameSys->insertSequence(obstacle._splashSequenceId, obstacle._prevId, + _vm->_gameSys->setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); + _vm->_gameSys->insertSequence(obstacle._splashSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._splashSequenceId; } } else { - _gameSys->setAnimation(0, 0, id + 2); - scene49_clearObstacle(id); + _vm->_gameSys->setAnimation(0, 0, id + 2); + clearObstacle(id); } - } -void GnapEngine::scene49_increaseScore(int amount) { +void Scene49::increaseScore(int amount) { if (_s49_scoreBarPos + amount <= 556) { _s49_scoreBarPos += amount; - _gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 255, 0, 0); + _vm->_gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 255, 0, 0); } _s49_scoreLevel = _s49_scoreBarPos + amount >= 556; } -void GnapEngine::scene49_decreaseScore(int amount) { +void Scene49::decreaseScore(int amount) { if (_s49_scoreBarPos >= 226 && _s49_scoreLevel == 0) { if (_s49_scoreBarFlash) - scene49_refreshScoreBar(); - _gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 89, 0, 5); + refreshScoreBar(); + _vm->_gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 89, 0, 5); _s49_scoreBarPos -= amount; _s49_scoreLevel = 0; } } -void GnapEngine::scene49_refreshScoreBar() { +void Scene49::refreshScoreBar() { if (_s49_scoreBarFlash) - _gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); + _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); else - _gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); + _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); _s49_scoreBarFlash = !_s49_scoreBarFlash; } -void GnapEngine::scene49_clearObstacle(int index) { +void Scene49::clearObstacle(int index) { _s49_obstacles[index]._currSequenceId = 0; _s49_obstacles[index]._closerSequenceId = 0; _s49_obstacles[index]._passedSequenceId = 0; @@ -266,8 +280,7 @@ void GnapEngine::scene49_clearObstacle(int index) { _s49_obstacles[index]._laneNum = 0; } -void GnapEngine::scene49_run() { - +void Scene49::run() { bool animToggle6 = false; bool animToggle5 = false; bool animToggle4 = false; @@ -275,17 +288,17 @@ void GnapEngine::scene49_run() { bool streetAnimToggle = false; bool bgAnimToggle = false; - playSound(0xE2, true); - setSoundVolume(0xE2, 75); + _vm->playSound(0xE2, true); + _vm->setSoundVolume(0xE2, 75); - hideCursor(); - setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); _s49_scoreBarPos = 196; _s49_scoreLevel = 0; _s49_scoreBarFlash = false; - switch (getRandom(3)) { + switch (_vm->getRandom(3)) { case 0: _s49_truckSequenceId = 0xAD; _s49_truckLaneNum = 1; @@ -300,50 +313,49 @@ void GnapEngine::scene49_run() { break; } - int bgWidth1 = _gameSys->getSpriteWidthById(0x5E); + int bgWidth1 = _vm->_gameSys->getSpriteWidthById(0x5E); int bgX1 = 600; - int bgWidth2 = _gameSys->getSpriteWidthById(0x5F); + int bgWidth2 = _vm->_gameSys->getSpriteWidthById(0x5F); int bgX2 = 400; - int bgWidth3 = _gameSys->getSpriteWidthById(4); + int bgWidth3 = _vm->_gameSys->getSpriteWidthById(4); int bgX3 = 700; - int bgWidth4 = _gameSys->getSpriteWidthById(5); + int bgWidth4 = _vm->_gameSys->getSpriteWidthById(5); int bgX4 = 500; - int bgWidth5 = _gameSys->getSpriteWidthById(6); + int bgWidth5 = _vm->_gameSys->getSpriteWidthById(6); int bgX5 = 300; - int bgWidth6 = _gameSys->getSpriteWidthById(7); + int bgWidth6 = _vm->_gameSys->getSpriteWidthById(7); int bgX6 = 100; - _gameSys->setAnimation(0xC8, 251, 1); - _gameSys->setAnimation(_s49_truckSequenceId, 256, 0); - _gameSys->insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); - _gameSys->insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); - _gameSys->insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); - _gameSys->insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); - _gameSys->insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); - _gameSys->insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); - _gameSys->insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); - _gameSys->insertSequence(_s49_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); + _vm->_gameSys->setAnimation(0xC8, 251, 1); + _vm->_gameSys->setAnimation(_s49_truckSequenceId, 256, 0); + _vm->_gameSys->insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); + _vm->_gameSys->insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); + _vm->_gameSys->insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); + _vm->_gameSys->insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); + _vm->_gameSys->insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); + _vm->_gameSys->insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); + _vm->_gameSys->insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); + _vm->_gameSys->insertSequence(_s49_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); - _timers[0] = 2; + _vm->_timers[0] = 2; for (int i = 0; i < 5; ++i) - scene49_clearObstacle(i); + clearObstacle(i); _s49_obstacleIndex = 0; - _timers[2] = getRandom(20) + 10; + _vm->_timers[2] = _vm->getRandom(20) + 10; _s49_truckId = 256; - _timers[3] = 35; + _vm->_timers[3] = 35; - while (!_sceneDone) { - - if (_timers[0] == 0) { + while (!_vm->_sceneDone) { + if (_vm->_timers[0] == 0) { // Update background animations (clouds etc.) --bgX1; bgX2 -= 2; @@ -364,24 +376,24 @@ void GnapEngine::scene49_run() { if (bgX6 <= -bgWidth6) bgX6 = 799; bgAnimToggle = !bgAnimToggle; - _gameSys->insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); - _gameSys->insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); - _gameSys->insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); - _gameSys->insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); - _gameSys->insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); - _gameSys->insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); - _timers[0] = 2; + _vm->_gameSys->insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); + _vm->_gameSys->insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); + _vm->_gameSys->insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); + _vm->_gameSys->insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); + _vm->_gameSys->insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); + _vm->_gameSys->insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); + _vm->_timers[0] = 2; } - if (_gameSys->getAnimationStatus(1) == 2) { + if (_vm->_gameSys->getAnimationStatus(1) == 2) { streetAnimToggle = !streetAnimToggle; - _gameSys->setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); - _gameSys->insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); + _vm->_gameSys->setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); + _vm->_gameSys->insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); } - scene49_checkObstacles(); + checkObstacles(); - if (_gameSys->getAnimationStatus(0) == 2) { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { switch (_s49_truckSequenceId) { case 0xB1: _s49_truckLaneNum = 1; @@ -396,26 +408,26 @@ void GnapEngine::scene49_run() { } animToggle3 = !animToggle3; if (_s49_truckLaneNum == 1) { - _gameSys->setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); - _gameSys->insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); + _vm->_gameSys->setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); + _vm->_gameSys->insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); _s49_truckSequenceId = 0xAD; } else if (_s49_truckLaneNum == 2) { - _gameSys->setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); - _gameSys->insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); + _vm->_gameSys->setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); + _vm->_gameSys->insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); _s49_truckSequenceId = 0xAE; } else { - _gameSys->setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); - _gameSys->insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); + _vm->_gameSys->setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); + _vm->_gameSys->insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); _s49_truckSequenceId = 0xAF; } _s49_truckId = (animToggle3 ? 1 : 0) + 256; if (_s49_scoreLevel == 1) { - if (!_gameSys->isSequenceActive(0xD4, 266)) { - _gameSys->setAnimation(0xD4, 266, 8); - _gameSys->insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); + if (!_vm->_gameSys->isSequenceActive(0xD4, 266)) { + _vm->_gameSys->setAnimation(0xD4, 266, 8); + _vm->_gameSys->insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); } ++_s49_scoreLevel; - _timers[1] = 2; + _vm->_timers[1] = 2; animToggle4 = false; animToggle5 = false; animToggle6 = false; @@ -423,13 +435,13 @@ void GnapEngine::scene49_run() { } } - if (_s49_scoreLevel != 0 && !_timers[1]) { - scene49_refreshScoreBar(); - _timers[1] = 8; + if (_s49_scoreLevel != 0 && !_vm->_timers[1]) { + refreshScoreBar(); + _vm->_timers[1] = 8; if (animToggle6) { if (animToggle5) { - if (animToggle4 && !_gameSys->isSequenceActive(212, 266)) - _gameSys->insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); + if (animToggle4 && !_vm->_gameSys->isSequenceActive(212, 266)) + _vm->_gameSys->insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); animToggle4 = !animToggle4; } animToggle5 = !animToggle5; @@ -437,15 +449,15 @@ void GnapEngine::scene49_run() { animToggle6 = !animToggle6; } - scene49_updateAnimations(); + updateAnimations(); - if (sceneXX_sub_4466B1()) { - _sceneDone = true; - _newSceneNum = 2; - _newCursorValue = 1; + if (_vm->sceneXX_sub_4466B1()) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 2; + _vm->_newCursorValue = 1; } - if (isKeyStatus1(Common::KEYCODE_RIGHT)) { + if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { // Steer right if (_s49_truckSequenceId == 0xB3) _s49_truckLaneNum = 2; @@ -453,22 +465,22 @@ void GnapEngine::scene49_run() { _s49_truckLaneNum = 1; if (_s49_truckLaneNum != 3 && _s49_truckLaneNum != 2) { if (_s49_scoreLevel) { - _sceneDone = true; - _newSceneNum = 47; + _vm->_sceneDone = true; + _vm->_newSceneNum = 47; } } else { int steerSequenceId = (_s49_truckLaneNum == 3) ? 0xB3 : 0xB1; if (_s49_truckSequenceId == 0xAE || _s49_truckSequenceId == 0xAF) { - _gameSys->setAnimation(steerSequenceId, 256, 0); - _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); + _vm->_gameSys->setAnimation(steerSequenceId, 256, 0); + _vm->_gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = steerSequenceId; _s49_truckId = 256; } } - clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); } - if (isKeyStatus1(Common::KEYCODE_LEFT)) { + if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { // Steer left if (_s49_truckSequenceId == 0xB0) _s49_truckLaneNum = 2; @@ -477,37 +489,31 @@ void GnapEngine::scene49_run() { if (_s49_truckLaneNum == 1 || _s49_truckLaneNum == 2) { int steerSequenceId = (_s49_truckLaneNum == 1) ? 0xB0 : 0xB2; if (_s49_truckSequenceId == 0xAD || _s49_truckSequenceId == 0xAE) { - _gameSys->setAnimation(steerSequenceId, 256, 0); - _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); + _vm->_gameSys->setAnimation(steerSequenceId, 256, 0); + _vm->_gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = steerSequenceId; _s49_truckId = 256; } } - clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - - stopSound(0xE2); - + _vm->stopSound(0xE2); } -void GnapEngine::scene49_updateAnimations() { - +void Scene49::updateAnimations() { for (int i = 0; i < 5; ++i) { - if (_gameSys->getAnimationStatus(i + 2) == 2) { + if (_vm->_gameSys->getAnimationStatus(i + 2) == 2) { if (_s49_obstacles[i]._currSequenceId) - scene49_updateObstacle(i); + updateObstacle(i); } } - if (_gameSys->getAnimationStatus(8) == 2) { - _sceneDone = true; - _newSceneNum = 47; + if (_vm->_gameSys->getAnimationStatus(8) == 2) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 47; } - } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene49.h b/engines/gnap/scenes/scene49.h new file mode 100644 index 0000000000..f44b2ed25b --- /dev/null +++ b/engines/gnap/scenes/scene49.h @@ -0,0 +1,79 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE49_H +#define GNAP_SCENE49_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +struct Scene49Obstacle { + int _currSequenceId; + int _closerSequenceId; + int _passedSequenceId; + int _splashSequenceId; + int _collisionSequenceId; + int _prevId; + int _currId; + int _laneNum; +}; + +struct ObstacleDef { + int _sequenceId; + int _ticks; +}; + +class Scene49: public Scene { +public: + Scene49(GnapEngine *vm); + ~Scene49() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _s49_scoreBarPos; + int _s49_scoreLevel; + bool _s49_scoreBarFlash; + int _s49_obstacleIndex; + Scene49Obstacle _s49_obstacles[5]; + int _s49_truckSequenceId; + int _s49_truckId; + int _s49_truckLaneNum; + + void checkObstacles(); + void updateObstacle(int id); + void increaseScore(int amount); + void decreaseScore(int amount); + void refreshScoreBar(); + void clearObstacle(int index); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE49_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 8c22cc8703..a4d7604b0f 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -70,6 +70,7 @@ #include "gnap/scenes/scene46.h" #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" +#include "gnap/scenes/scene49.h" #include "gnap/scenes/scene54.h" namespace Gnap { @@ -404,8 +405,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 49: - backgroundId = scene49_init(); - scene49_updateHotspots(); + _scene = new Scene49(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -768,7 +770,8 @@ void GnapEngine::runSceneLogic() { delete _scene; break; case 49: - scene49_run(); + _scene = new Scene48(this); + _scene->init(); if (_newSceneNum == 55) _newSceneNum = 47; break; -- cgit v1.2.3 From aca5984e2b2f08890f828bbe9c331841c9b33674 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 21:40:42 +0200 Subject: GNAP: Refactor scene 50 --- engines/gnap/gnap.cpp | 9 - engines/gnap/gnap.h | 33 ---- engines/gnap/scenes/scene50.cpp | 341 ++++++++++++++++++++------------------ engines/gnap/scenes/scene50.h | 87 ++++++++++ engines/gnap/scenes/scenecore.cpp | 11 +- 5 files changed, 274 insertions(+), 207 deletions(-) create mode 100644 engines/gnap/scenes/scene50.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 2ef75164ba..5d4e8106ab 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2021,15 +2021,6 @@ void GnapEngine::initGlobalSceneVars() { // Shared by scenes 17 && 18 _s18_garbageCanPos = 8; - // Scene 50 - _s50_timesPlayed = 0; - _s50_timesPlayedModifier = 0; - _s50_attackCounter = 0; - _s50_leftTongueEnergyBarPos = 10; - _s50_leftTongueNextIdCtr = 0; - _s50_rightTongueEnergyBarPos = 10; - _s50_rightTongueNextIdCtr = 0; - // Scene 52 _s52_gameScore = 0; _s52_aliensInitialized = false; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 5063d90808..bd1714dbbe 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -601,39 +601,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 50 - bool _s50_fightDone; - int _s50_timesPlayed, _s50_timesPlayedModifier; - int _s50_attackCounter; - int _s50_roundNum, _s50_timeRemaining; - int _s50_leftTongueRoundsWon, _s50_rightTongueRoundsWon; - int _s50_leftTongueEnergyBarPos, _s50_rightTongueEnergyBarPos; - int _s50_leftTongueSequenceId, _s50_leftTongueId; - int _s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueNextIdCtr; - int _s50_rightTongueSequenceId, _s50_rightTongueId; - int _s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueNextIdCtr; - int _s50_leftTongueEnergy, _s50_rightTongueEnergy; - int scene50_init(); - void scene50_updateHotspots(); - bool scene50_tongueWinsRound(int tongueNum); - void scene50_playWinAnim(int tongueNum, bool fightOver); - void scene50_delayTicks(); - void scene50_initRound(); - bool scene50_updateCountdown(); - void scene50_drawCountdown(int value); - void scene50_playTonguesIdle(); - void scene50_playRoundAnim(int roundNum); - bool scene50_updateEnergyBars(int newLeftBarPos, int newRightBarPos); - void scene50_waitForAnim(int animationIndex); - int scene50_checkInput(); - int scene50_getRightTongueAction(); - void scene50_updateAnimations(); - int scene50_getRightTongueActionTicks(); - int scene50_getLeftTongueNextId(); - int scene50_getRightTongueNextId(); - void scene50_playWinBadgeAnim(int tongueNum); - void scene50_run(); - // Scene 51 int _s51_cashAmount; int _s51_digits[4]; diff --git a/engines/gnap/scenes/scene50.cpp b/engines/gnap/scenes/scene50.cpp index 2ec842af7a..68f29f3d78 100644 --- a/engines/gnap/scenes/scene50.cpp +++ b/engines/gnap/scenes/scene50.cpp @@ -23,128 +23,156 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene50.h" namespace Gnap { -int GnapEngine::scene50_init() { +Scene50::Scene50(GnapEngine *vm) : Scene(vm) { + _s50_fightDone = false; + + _s50_roundNum = -1; + _s50_timeRemaining = -1; + _s50_leftTongueRoundsWon = -1; + _s50_rightTongueRoundsWon = -1; + _s50_leftTongueSequenceId = -1; + _s50_leftTongueId = -1; + _s50_leftTongueNextSequenceId = -1; + _s50_leftTongueNextId = -1; + _s50_rightTongueSequenceId = -1; + _s50_rightTongueId = -1; + _s50_rightTongueNextSequenceId = -1; + _s50_rightTongueNextId = -1; + _s50_leftTongueEnergy = -1; + _s50_rightTongueEnergy = -1; + + _s50_timesPlayed = 0; + _s50_timesPlayedModifier = 0; + _s50_attackCounter = 0; + _s50_leftTongueEnergyBarPos = 10; + _s50_leftTongueNextIdCtr = 0; + _s50_rightTongueEnergyBarPos = 10; + _s50_rightTongueNextIdCtr = 0; +} + +int Scene50::init() { return 0xC7; } -void GnapEngine::scene50_updateHotspots() { - _hotspotsCount = 0; +void Scene50::updateHotspots() { + _vm->_hotspotsCount = 0; } -bool GnapEngine::scene50_tongueWinsRound(int tongueNum) { +bool Scene50::tongueWinsRound(int tongueNum) { if (tongueNum == 1) ++_s50_leftTongueRoundsWon; else ++_s50_rightTongueRoundsWon; - scene50_playWinBadgeAnim(tongueNum); + playWinBadgeAnim(tongueNum); bool fightOver = _s50_rightTongueRoundsWon == 2 || _s50_leftTongueRoundsWon == 2; - scene50_playWinAnim(tongueNum, fightOver); + playWinAnim(tongueNum, fightOver); return fightOver; } -void GnapEngine::scene50_playWinAnim(int tongueNum, bool fightOver) { +void Scene50::playWinAnim(int tongueNum, bool fightOver) { if (tongueNum == 1) { if (fightOver) { - _gameSys->insertSequence(0xAD, 140, 0xAC, 140, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xAD, 140, 0xAC, 140, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); _s50_leftTongueSequenceId = 0xB4; _s50_rightTongueSequenceId = 0xBC; _s50_rightTongueId = 100; _s50_leftTongueId = 100; - _gameSys->setAnimation(0xB4, 100, 6); - _gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); - scene50_waitForAnim(6); - scene50_waitForAnim(5); - invAdd(kItemGum); - setFlag(kGFUnk13); + _vm->_gameSys->setAnimation(0xB4, 100, 6); + _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); + waitForAnim(6); + waitForAnim(5); + _vm->invAdd(kItemGum); + _vm->setFlag(kGFUnk13); } else { - _gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); _s50_leftTongueSequenceId = 0xB4; _s50_rightTongueSequenceId = 0xBC; _s50_rightTongueId = 100; _s50_leftTongueId = 100; - _gameSys->setAnimation(0xB4, 100, 6); - _gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); - scene50_waitForAnim(6); - scene50_waitForAnim(5); + _vm->_gameSys->setAnimation(0xB4, 100, 6); + _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); + waitForAnim(6); + waitForAnim(5); } } else { - _gameSys->insertSequence(0xBE, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0xBE, 100, 5); - scene50_waitForAnim(5); - _gameSys->insertSequence(0xBF, 100, 0xBE, 100, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xB5, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBE, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xBE, 100, 5); + waitForAnim(5); + _vm->_gameSys->insertSequence(0xBF, 100, 0xBE, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB5, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); _s50_rightTongueSequenceId = 0xBF; _s50_leftTongueSequenceId = 0xB5; _s50_rightTongueId = 100; _s50_leftTongueId = 100; - _gameSys->setAnimation(0xB5, 100, 6); - _gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); - scene50_waitForAnim(6); - scene50_waitForAnim(5); + _vm->_gameSys->setAnimation(0xB5, 100, 6); + _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); + waitForAnim(6); + waitForAnim(5); } // TODO delayTicksA(1, 7); } -void GnapEngine::scene50_delayTicks() { +void Scene50::delayTicks() { // TODO delayTicksA(3, 7); } -void GnapEngine::scene50_initRound() { +void Scene50::initRound() { _s50_leftTongueEnergy = 10; _s50_rightTongueEnergy = 10; _s50_fightDone = false; - _timers[3] = scene50_getRightTongueActionTicks(); - _timers[4] = 0; - _timers[6] = 0; - _gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0); - _gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0); + _vm->_timers[3] = getRightTongueActionTicks(); + _vm->_timers[4] = 0; + _vm->_timers[6] = 0; + _vm->_gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0); + _vm->_gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0); _s50_timeRemaining = 40; - scene50_drawCountdown(40); + drawCountdown(40); } -bool GnapEngine::scene50_updateCountdown() { - if (!_timers[5]) { +bool Scene50::updateCountdown() { + if (!_vm->_timers[5]) { --_s50_timeRemaining; if (_s50_timeRemaining < 0) { return true; } else { - _timers[5] = 15; - scene50_drawCountdown(_s50_timeRemaining); + _vm->_timers[5] = 15; + drawCountdown(_s50_timeRemaining); } } return false; } -void GnapEngine::scene50_drawCountdown(int value) { +void Scene50::drawCountdown(int value) { char str[8]; sprintf(str, "%02d", value); - _gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0); - _gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str); + _vm->_gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str); } -void GnapEngine::scene50_playTonguesIdle() { - _gameSys->insertSequence(0xBA, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xC2, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); +void Scene50::playTonguesIdle() { + _vm->_gameSys->insertSequence(0xBA, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xC2, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); _s50_leftTongueSequenceId = 0xBA; _s50_rightTongueSequenceId = 0xC2; _s50_rightTongueNextSequenceId = -1; _s50_leftTongueNextSequenceId = -1; _s50_leftTongueId = 100; _s50_rightTongueId = 100; - _gameSys->setAnimation(0xC2, 100, 5); - _gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); + _vm->_gameSys->setAnimation(0xC2, 100, 5); + _vm->_gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); } -void GnapEngine::scene50_playRoundAnim(int roundNum) { - int sequenceId; +void Scene50::playRoundAnim(int roundNum) { + int sequenceId = 0; switch (roundNum) { case 1: @@ -158,23 +186,21 @@ void GnapEngine::scene50_playRoundAnim(int roundNum) { break; } - _gameSys->insertSequence(sequenceId, 256, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->setAnimation(sequenceId, 256, 7); - scene50_waitForAnim(7); - - _gameSys->insertSequence(0xAB, 256, sequenceId, 256, kSeqSyncWait, 0, 0, 0); - _gameSys->setAnimation(0xAB, 256, 7); - scene50_waitForAnim(7); + _vm->_gameSys->insertSequence(sequenceId, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(sequenceId, 256, 7); + waitForAnim(7); + _vm->_gameSys->insertSequence(0xAB, 256, sequenceId, 256, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xAB, 256, 7); + waitForAnim(7); } -bool GnapEngine::scene50_updateEnergyBars(int newLeftBarPos, int newRightBarPos) { - +bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { if (newLeftBarPos != _s50_leftTongueEnergyBarPos) { if (newLeftBarPos < 0) newLeftBarPos = 0; _s50_leftTongueEnergyBarPos = newLeftBarPos; - _gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); + _vm->_gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); } if (newRightBarPos != _s50_rightTongueEnergyBarPos) { @@ -182,7 +208,7 @@ bool GnapEngine::scene50_updateEnergyBars(int newLeftBarPos, int newRightBarPos) newRightBarPos = 0; _s50_rightTongueEnergyBarPos = newRightBarPos; if (newRightBarPos != 10) - _gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); + _vm->_gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); } if (newLeftBarPos * newRightBarPos > 0) @@ -193,37 +219,37 @@ bool GnapEngine::scene50_updateEnergyBars(int newLeftBarPos, int newRightBarPos) return true; } -void GnapEngine::scene50_waitForAnim(int animationIndex) { - while (_gameSys->getAnimationStatus(animationIndex) != 2) { - gameUpdateTick(); +void Scene50::waitForAnim(int animationIndex) { + while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { + _vm->gameUpdateTick(); } - _gameSys->setAnimation(0, 0, animationIndex); + _vm->_gameSys->setAnimation(0, 0, animationIndex); } -int GnapEngine::scene50_checkInput() { +int Scene50::checkInput() { int sequenceId = -1; - if (isKeyStatus1(Common::KEYCODE_RIGHT)) { - clearKeyStatus1(Common::KEYCODE_RIGHT); + if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); sequenceId = 0xB6; - } else if (isKeyStatus1(Common::KEYCODE_LEFT)) { - clearKeyStatus1(Common::KEYCODE_LEFT); + } else if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); sequenceId = 0xB3; - } else if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { - clearKeyStatus1(Common::KEYCODE_ESCAPE); + } else if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE)) { + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _s50_fightDone = true; } return sequenceId; } -int GnapEngine::scene50_getRightTongueAction() { +int Scene50::getRightTongueAction() { int sequenceId = -1; - if (!_timers[3]) { - _timers[3] = scene50_getRightTongueActionTicks(); + if (!_vm->_timers[3]) { + _vm->_timers[3] = getRightTongueActionTicks(); if (_s50_rightTongueEnergy >= _s50_leftTongueEnergy) { - switch (getRandom(5)) { + switch (_vm->getRandom(5)) { case 0: sequenceId = 0xBE; break; @@ -241,7 +267,7 @@ int GnapEngine::scene50_getRightTongueAction() { break; } } else { - switch (getRandom(4)) { + switch (_vm->getRandom(4)) { case 0: sequenceId = 0xBE; break; @@ -261,12 +287,11 @@ int GnapEngine::scene50_getRightTongueAction() { return sequenceId; } -void GnapEngine::scene50_updateAnimations() { - - if (!_timers[4]) +void Scene50::updateAnimations() { + if (!_vm->_timers[4]) _s50_attackCounter = 0; - if (_gameSys->getAnimationStatus(5) == 2) { + if (_vm->_gameSys->getAnimationStatus(5) == 2) { if (_s50_rightTongueSequenceId == 0xBE) { if (_s50_leftTongueSequenceId != 0xB3 && _s50_leftTongueSequenceId != 0xB8) _s50_rightTongueNextSequenceId = 0xBF; @@ -276,38 +301,38 @@ void GnapEngine::scene50_updateAnimations() { if (_s50_rightTongueNextSequenceId == -1) _s50_rightTongueNextSequenceId = 0xC2; if (_s50_rightTongueNextSequenceId == 0xBF) { - _s50_leftTongueNextId = scene50_getLeftTongueNextId(); - _s50_rightTongueNextId = scene50_getRightTongueNextId(); - _gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); - _gameSys->setAnimation(0xB9, _s50_leftTongueNextId, 6); - _gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncExists, 0, 0, 0); + _s50_leftTongueNextId = getLeftTongueNextId(); + _s50_rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); + _vm->_gameSys->setAnimation(0xB9, _s50_leftTongueNextId, 6); + _vm->_gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncExists, 0, 0, 0); _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; _s50_rightTongueNextSequenceId = -1; _s50_leftTongueSequenceId = 0xB9; _s50_leftTongueNextSequenceId = -1; _s50_rightTongueId = _s50_rightTongueNextId; _s50_leftTongueId = _s50_leftTongueNextId; - _s50_leftTongueEnergy -= getRandom(2) + 1;//CHECKME + _s50_leftTongueEnergy -= _vm->getRandom(2) + 1;//CHECKME } else { - _s50_rightTongueNextId = scene50_getRightTongueNextId(); - _gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); - _gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); + _s50_rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); + _vm->_gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; _s50_rightTongueNextSequenceId = -1; _s50_rightTongueId = _s50_rightTongueNextId; } } - if (_gameSys->getAnimationStatus(6) == 2) { + if (_vm->_gameSys->getAnimationStatus(6) == 2) { if (_s50_leftTongueSequenceId == 0xB6) { ++_s50_attackCounter; if (_s50_timesPlayedModifier + 3 <= _s50_attackCounter) { _s50_leftTongueNextSequenceId = 0xB8; } else { - _timers[4] = 20; + _vm->_timers[4] = 20; //CHECKME - if (_s50_rightTongueSequenceId != 0xBB && _s50_rightTongueSequenceId != 0xC0 && getRandom(8) != _s50_roundNum) + if (_s50_rightTongueSequenceId != 0xBB && _s50_rightTongueSequenceId != 0xC0 && _vm->getRandom(8) != _s50_roundNum) _s50_leftTongueNextSequenceId = 0xB7; else _s50_leftTongueNextSequenceId = 0xB8; @@ -318,12 +343,12 @@ void GnapEngine::scene50_updateAnimations() { if (_s50_leftTongueNextSequenceId == -1) _s50_leftTongueNextSequenceId = 0xBA; if (_s50_leftTongueNextSequenceId == 0xB7) { - _s50_leftTongueNextId = scene50_getLeftTongueNextId(); - _s50_rightTongueNextId = scene50_getRightTongueNextId(); - _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); - _gameSys->setAnimation(0xC1, _s50_rightTongueNextId, 5); - _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); + _s50_leftTongueNextId = getLeftTongueNextId(); + _s50_rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); + _vm->_gameSys->setAnimation(0xC1, _s50_rightTongueNextId, 5); + _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; _s50_leftTongueNextSequenceId = -1; _s50_rightTongueSequenceId = 0xC1; @@ -332,19 +357,19 @@ void GnapEngine::scene50_updateAnimations() { _s50_leftTongueId = _s50_leftTongueNextId; --_s50_rightTongueEnergy; } else if (_s50_leftTongueNextSequenceId != 0xB8 || _s50_rightTongueSequenceId != 0xC2) { - _s50_leftTongueNextId = scene50_getLeftTongueNextId(); - _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); - _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _s50_leftTongueNextId = getLeftTongueNextId(); + _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); + _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; _s50_leftTongueNextSequenceId = -1; _s50_leftTongueId = _s50_leftTongueNextId; } else { - _s50_leftTongueNextId = scene50_getLeftTongueNextId(); - _s50_rightTongueNextId = scene50_getRightTongueNextId(); - _gameSys->setAnimation(0xBB, _s50_rightTongueNextId, 5); - _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); - _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); + _s50_leftTongueNextId = getLeftTongueNextId(); + _s50_rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(0xBB, _s50_rightTongueNextId, 5); + _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); + _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); _s50_rightTongueSequenceId = 0xBB; _s50_rightTongueId = _s50_rightTongueNextId; _s50_rightTongueNextSequenceId = -1; @@ -353,24 +378,23 @@ void GnapEngine::scene50_updateAnimations() { _s50_leftTongueId = _s50_leftTongueNextId; } } - } -int GnapEngine::scene50_getRightTongueActionTicks() { +int Scene50::getRightTongueActionTicks() { return 15 - 5 * _s50_roundNum + 1; } -int GnapEngine::scene50_getLeftTongueNextId() { +int Scene50::getLeftTongueNextId() { _s50_leftTongueNextIdCtr = (_s50_leftTongueNextIdCtr + 1) % 3; return _s50_leftTongueNextIdCtr + 100; } -int GnapEngine::scene50_getRightTongueNextId() { +int Scene50::getRightTongueNextId() { _s50_rightTongueNextIdCtr = (_s50_rightTongueNextIdCtr + 1) % 3; return _s50_rightTongueNextIdCtr + 100; } -void GnapEngine::scene50_playWinBadgeAnim(int tongueNum) { +void Scene50::playWinBadgeAnim(int tongueNum) { int sequenceId; if (tongueNum == 1) { @@ -385,19 +409,17 @@ void GnapEngine::scene50_playWinBadgeAnim(int tongueNum) { sequenceId = 0xC6; } - _gameSys->setAnimation(sequenceId, 120, 7); - _gameSys->insertSequence(sequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); - scene50_waitForAnim(7); - + _vm->_gameSys->setAnimation(sequenceId, 120, 7); + _vm->_gameSys->insertSequence(sequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + waitForAnim(7); } -void GnapEngine::scene50_run() { - +void Scene50::run() { ++_s50_timesPlayed; _s50_timesPlayedModifier = _s50_timesPlayed / 4; _s50_leftTongueRoundsWon = 0; _s50_rightTongueRoundsWon = 0; - // scene50_initFont(); + // initFont(); _s50_leftTongueSequenceId = 186; _s50_rightTongueSequenceId = 194; _s50_rightTongueNextSequenceId = -1; @@ -405,75 +427,72 @@ void GnapEngine::scene50_run() { _s50_leftTongueId = 100; _s50_rightTongueId = 100; - _gameSys->setAnimation(194, 100, 5); - _gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); - _gameSys->insertSequence(_s50_leftTongueSequenceId, _s50_leftTongueId, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(_s50_rightTongueSequenceId, _s50_rightTongueId, 0, 0, kSeqNone, 0, 0, 0); - _gameSys->insertSequence(172, 140, 0, 0, kSeqNone, 0, 0, 0); - endSceneInit(); + _vm->_gameSys->setAnimation(194, 100, 5); + _vm->_gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); + _vm->_gameSys->insertSequence(_s50_leftTongueSequenceId, _s50_leftTongueId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s50_rightTongueSequenceId, _s50_rightTongueId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(172, 140, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); - scene50_initRound(); + initRound(); _s50_roundNum = 1; - setGrabCursorSprite(-1); - hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); // TODO delayTicksA(1, 7); - scene50_playRoundAnim(_s50_roundNum); + playRoundAnim(_s50_roundNum); - _timers[5] = 15; + _vm->_timers[5] = 15; while (!_s50_fightDone) { - /* TODO if (sceneXX_sub_4466B1()) _s50_fightDone = true; */ - int playerSequenceId = scene50_checkInput(); + int playerSequenceId = checkInput(); if (playerSequenceId != -1) _s50_leftTongueNextSequenceId = playerSequenceId; - int rightSequenceId = scene50_getRightTongueAction(); + int rightSequenceId = getRightTongueAction(); if (rightSequenceId != -1) _s50_rightTongueNextSequenceId = rightSequenceId; - scene50_updateAnimations(); + updateAnimations(); - if (scene50_updateCountdown() || - scene50_updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy)) { - int v0; + if (updateCountdown() || + updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy)) { + bool v0; if (_s50_rightTongueEnergy < _s50_leftTongueEnergy) - v0 = scene50_tongueWinsRound(1); + v0 = tongueWinsRound(1); else - v0 = scene50_tongueWinsRound(2); + v0 = tongueWinsRound(2); if (v0) { - scene50_delayTicks(); + delayTicks(); _s50_fightDone = true; } else { ++_s50_roundNum; - scene50_initRound(); - scene50_playTonguesIdle(); - scene50_updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy); - scene50_playRoundAnim(_s50_roundNum); - _timers[5] = 15; + initRound(); + playTonguesIdle(); + updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy); + playRoundAnim(_s50_roundNum); + _vm->_timers[5] = 15; } } - - gameUpdateTick(); - + _vm->gameUpdateTick(); } - // scene50_freeFont(); + // freeFont(); - _gameSys->setAnimation(0, 0, 7); - _gameSys->setAnimation(0, 0, 6); - _gameSys->setAnimation(0, 0, 5); - _gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 7); + _vm->_gameSys->setAnimation(0, 0, 6); + _vm->_gameSys->setAnimation(0, 0, 5); + _vm->_gameSys->setAnimation(0, 0, 3); - showCursor(); + _vm->showCursor(); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene50.h b/engines/gnap/scenes/scene50.h new file mode 100644 index 0000000000..6cc4bc35cb --- /dev/null +++ b/engines/gnap/scenes/scene50.h @@ -0,0 +1,87 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE50_H +#define GNAP_SCENE50_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene50: public Scene { +public: + Scene50(GnapEngine *vm); + ~Scene50() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _s50_fightDone; + int _s50_timesPlayed; + int _s50_timesPlayedModifier; + int _s50_attackCounter; + int _s50_roundNum; + int _s50_timeRemaining; + int _s50_leftTongueRoundsWon; + int _s50_rightTongueRoundsWon; + int _s50_leftTongueEnergyBarPos; + int _s50_rightTongueEnergyBarPos; + int _s50_leftTongueSequenceId; + int _s50_leftTongueId; + int _s50_leftTongueNextSequenceId; + int _s50_leftTongueNextId; + int _s50_leftTongueNextIdCtr; + int _s50_rightTongueSequenceId; + int _s50_rightTongueId; + int _s50_rightTongueNextSequenceId; + int _s50_rightTongueNextId; + int _s50_rightTongueNextIdCtr; + int _s50_leftTongueEnergy; + int _s50_rightTongueEnergy; + + bool tongueWinsRound(int tongueNum); + void playWinAnim(int tongueNum, bool fightOver); + void delayTicks(); + void initRound(); + bool updateCountdown(); + void drawCountdown(int value); + void playTonguesIdle(); + void playRoundAnim(int roundNum); + bool updateEnergyBars(int newLeftBarPos, int newRightBarPos); + void waitForAnim(int animationIndex); + int checkInput(); + int getRightTongueAction(); + int getRightTongueActionTicks(); + int getLeftTongueNextId(); + int getRightTongueNextId(); + void playWinBadgeAnim(int tongueNum); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE50_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index a4d7604b0f..438604670b 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -71,6 +71,7 @@ #include "gnap/scenes/scene47.h" #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene49.h" +#include "gnap/scenes/scene50.h" #include "gnap/scenes/scene54.h" namespace Gnap { @@ -412,7 +413,8 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 50: - backgroundId = scene50_init(); + _scene = new Scene50(this); + backgroundId = _scene->init(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -770,13 +772,14 @@ void GnapEngine::runSceneLogic() { delete _scene; break; case 49: - _scene = new Scene48(this); - _scene->init(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 47; break; case 50: - scene50_run(); + _scene->run(); + delete _scene; _newSceneNum = _prevSceneNum; break; case 51: -- cgit v1.2.3 From 7a66d4b3568ebcfae549f13e87549f2771f36732 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 22:38:30 +0200 Subject: GNAP: Refactor scenes 51&52 --- engines/gnap/gnap.cpp | 6 - engines/gnap/gnap.h | 123 ---------- engines/gnap/scenes/scene51.cpp | 493 ++++++++++++++++++++------------------ engines/gnap/scenes/scene51.h | 101 ++++++++ engines/gnap/scenes/scene52.cpp | 482 ++++++++++++++++++------------------- engines/gnap/scenes/scene52.h | 118 +++++++++ engines/gnap/scenes/scenecore.cpp | 14 +- 7 files changed, 724 insertions(+), 613 deletions(-) create mode 100644 engines/gnap/scenes/scene51.h create mode 100644 engines/gnap/scenes/scene52.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 5d4e8106ab..f6bff6025c 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2021,12 +2021,6 @@ void GnapEngine::initGlobalSceneVars() { // Shared by scenes 17 && 18 _s18_garbageCanPos = 8; - // Scene 52 - _s52_gameScore = 0; - _s52_aliensInitialized = false; - _s52_alienDirection = 0; - _s52_soundToggle = false; - // Scene 53 _s53_callsMadeCtr = 0; _s53_callsRndUsed = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index bd1714dbbe..a80d82f3fc 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -250,17 +250,6 @@ enum { // 0x7AF Gnap walks to the left 1 // 0x7B0 Gnap walks to the left 2 -struct Scene51Item { - int _currSequenceId; - int _droppedSequenceId; - int _x, _y; - int _collisionX; - bool _canCatch; - bool _isCollision; - int _x2; - int _id; -}; - enum Facing { kDirNone = 0, kDirBottomRight = 1, @@ -601,118 +590,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 51 - int _s51_cashAmount; - int _s51_digits[4]; - int _s51_digitSequenceIds[4]; - int _s51_guySequenceId, _s51_guyNextSequenceId; - int _s51_itemsCaughtCtr; - int _s51_dropSpeedTicks; - int _s51_nextDropItemKind, _s51_itemInsertX, _s51_itemInsertDirection; - int _s51_platypusSequenceId, _s51_platypusNextSequenceId, _s51_platypusJumpSequenceId; - bool _s51_dropLoseCash; - int _s51_itemsCtr,_s51_itemsCtr1, _s51_itemsCtr2; - Scene51Item _s51_items[6]; - - int scene51_init(); - void scene51_updateHotspots(); - void scene51_clearItem(Scene51Item *item); - void scene51_dropNextItem(); - void scene51_updateItemAnimations(); - int scene51_checkCollision(int sequenceId); - void scene51_updateItemAnimation(Scene51Item *item, int index); - void scene51_removeCollidedItems(); - int scene51_itemIsCaught(Scene51Item *item); - bool scene51_isJumpingRight(int sequenceId); - bool scene51_isJumpingLeft(int sequenceId); - bool scene51_isJumping(int sequenceId); - void scene51_waitForAnim(int animationIndex); - int scene51_getPosRight(int sequenceId); - int scene51_getPosLeft(int sequenceId); - void scene51_playIntroAnim(); - void scene51_updateGuyAnimation(); - int scene51_incCashAmount(int sequenceId); - void scene51_winMinigame(); - void scene51_playCashAppearAnim(); - void scene51_updateCash(int amount); - void scene51_drawDigit(int digit, int position); - void scene51_initCashDisplay(); - void scene51_run(); - - // Scene 52 - int _s52_liveAlienRows; - int _s52_gameScore; - bool _s52_soundToggle; - int _s52_arcadeScreenLeft; - int _s52_arcadeScreenRight; - int _s52_arcadeScreenBottom; - int _s52_shipsLeft; - int _s52_shieldSpriteIds[3]; - int _s52_shieldPosX[3]; - int _s52_shipPosX; - int _s52_shipCannonPosX, _s52_shipCannonPosY; - bool _s52_shipCannonFiring; - bool _s52_shipCannonFired; - int _s52_shipCannonWidth, _s52_shipCannonHeight; - int _s52_shipCannonTopY; - int _s52_shipMidX, _s52_shipMidY; - bool _s52_shipFlag; - bool _s52_aliensInitialized; - int _s52_alienSpeed, _s52_alienDirection; - int _s52_alienWidth, _s52_alienHeight; - int _s52_alienLeftX, _s52_alienTopY; - int _s52_alienRowDownCtr; - int _s52_alienRowKind[7]; - int _s52_alienRowAnims[7]; - int _s52_alienRowIds[7]; - int _s52_alienRowXOfs[7]; - int _s52_alienCannonFired[3]; - int _s52_alienCannonPosX[3]; - int _s52_alienCannonPosY[3]; - int _s52_alienCannonSequenceIds[3]; - int _s52_alienCannonIds[3]; - bool _s52_alienWave, _s52_alienSingle; - int _s52_alienCounter; - bool _s52_bottomAlienFlag; - int _s52_aliensCount; - int _s52_items[8][5]; - int _s52_nextUfoSequenceId, _s52_ufoSequenceId; - int scene52_init(); - void scene52_updateHotspots(); - void scene52_update(); - void scene52_initShipCannon(int bottomY); - void scene52_initAlienCannons(); - void scene52_fireShipCannon(int posX); - void scene52_fireAlienCannon(); - int scene52_getFreeShipCannon(); - int scene52_getFreeAlienCannon(); - void scene52_updateShipCannon(); - void scene52_updateAlienCannons(); - void scene52_initAliens(); - void scene52_initAlienRowKind(int rowNum, int alienKind); - void scene52_insertAlienRow(int rowNum); - void scene52_insertAlienRowAliens(int rowNum); - void scene52_updateAlienRow(int rowNum); - void scene52_moveDownAlienRow(); - int scene52_updateHitAlien(); - int scene52_getHitAlienNum(int rowNum); - int scene52_alienCannonHitShip(int cannonNum); - int scene52_alienCannonHitShield(int cannonNum); - bool scene52_shipCannonHitShield(int cannonNum); - bool scene52_shipCannonHitAlien(); - void scene52_shipExplode(); - bool scene52_checkAlienRow(int rowNum); - void scene52_updateAlienRowXOfs(); - void scene52_initAlienSize(); - void scene52_playSound(); - void scene52_updateAliens(); - void scene52_updateAlien(int rowNum); - void scene52_loseShip(); - void scene52_initShields(); - void scene52_initAnims(); - void scene52_drawScore(int score); - void scene52_run(); - // Scene 53 int _s53_currHandSequenceId; bool _s53_isGnapPhoning; diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index 1d9e177989..f4a3a843ba 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene51.h" namespace Gnap { @@ -46,18 +47,54 @@ static const int kDigitPositions[4] = { 0x76 Platypus jumping (right) */ -int GnapEngine::scene51_init() { - _gameSys->setAnimation(0, 0, 0); +Scene51::Scene51(GnapEngine *vm) : Scene(vm) { + _s51_dropLoseCash = false; + + _s51_cashAmount = -1; + _s51_guySequenceId = -1; + _s51_guyNextSequenceId = -1; + _s51_itemsCaughtCtr = -1; + _s51_dropSpeedTicks = -1; + _s51_nextDropItemKind = -1; + _s51_itemInsertX = -1; + _s51_itemInsertDirection = -1; + _s51_platypusSequenceId = -1; + _s51_platypusNextSequenceId = -1; + _s51_platypusJumpSequenceId = -1; + _s51_itemsCtr = -1; + _s51_itemsCtr1 = -1; + _s51_itemsCtr2 = -1; + + for (int i = 0; i < 4; i++) { + _s51_digits[i] = 0; + _s51_digitSequenceIds[4] = -1; + } + + for (int i = 0; i < 6; i++) { + _s51_items[i]._currSequenceId = -1; + _s51_items[i]._droppedSequenceId; + _s51_items[i]._x = 0; + _s51_items[i]._y = 0; + _s51_items[i]._collisionX; + _s51_items[i]._canCatch = false; + _s51_items[i]._isCollision = false; + _s51_items[i]._x2 = 0; + _s51_items[i]._id = -1; + } +} + +int Scene51::init() { + _vm->_gameSys->setAnimation(0, 0, 0); for (int i = 0; i < 6; ++i) - _gameSys->setAnimation(0, 0, i + 1); + _vm->_gameSys->setAnimation(0, 0, i + 1); return 0xD4; } -void GnapEngine::scene51_updateHotspots() { - _hotspotsCount = 0; +void Scene51::updateHotspots() { + _vm->_hotspotsCount = 0; } -void GnapEngine::scene51_clearItem(Scene51Item *item) { +void Scene51::clearItem(Scene51Item *item) { item->_currSequenceId = 0; item->_droppedSequenceId = 0; item->_x = 0; @@ -67,13 +104,11 @@ void GnapEngine::scene51_clearItem(Scene51Item *item) { item->_canCatch = false; } -void GnapEngine::scene51_dropNextItem() { - - if (_timers[0]) +void Scene51::dropNextItem() { + if (_vm->_timers[0]) return; int index = 0; - while (index < 6 && _s51_items[index]._currSequenceId) ++index; @@ -81,9 +116,8 @@ void GnapEngine::scene51_dropNextItem() { return; switch (_s51_nextDropItemKind) { - case 0: - if (getRandom(10) != 0 || _s51_itemsCtr2 >= 2) { + if (_vm->getRandom(10) != 0 || _s51_itemsCtr2 >= 2) { _s51_items[index]._currSequenceId = 0xBD; } else { --_s51_itemsCtr1; @@ -93,8 +127,8 @@ void GnapEngine::scene51_dropNextItem() { break; case 1: - if (getRandom(8) != 0 || _s51_itemsCtr2 >= 2) { - if (getRandom(5) == 0) { + if (_vm->getRandom(8) != 0 || _s51_itemsCtr2 >= 2) { + if (_vm->getRandom(5) == 0) { if (_s51_itemInsertDirection) _s51_itemInsertX -= 70; else @@ -109,7 +143,7 @@ void GnapEngine::scene51_dropNextItem() { break; case 2: - if (getRandom(6) != 0 || _s51_itemsCtr2 >= 2) { + if (_vm->getRandom(6) != 0 || _s51_itemsCtr2 >= 2) { _s51_items[index]._currSequenceId = 0xBD; } else { --_s51_itemsCtr1; @@ -127,8 +161,8 @@ void GnapEngine::scene51_dropNextItem() { case 5: case 6: - if (getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { - if (getRandom(5) != 0) + if (_vm->getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { + if (_vm->getRandom(5) != 0) _s51_items[index]._currSequenceId = 0xBD; else _s51_items[index]._currSequenceId = 0xC0; @@ -140,14 +174,14 @@ void GnapEngine::scene51_dropNextItem() { break; case 7: - if (getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { - if (getRandom(5) == 0) { + if (_vm->getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { + if (_vm->getRandom(5) == 0) { if (_s51_itemInsertDirection) _s51_itemInsertX -= 40; else _s51_itemInsertX += 40; } - if (getRandom(9) != 0) + if (_vm->getRandom(9) != 0) _s51_items[index]._currSequenceId = 0xBD; else _s51_items[index]._currSequenceId = 0xC0; @@ -159,8 +193,8 @@ void GnapEngine::scene51_dropNextItem() { break; default: - if (getRandom(4) != 0 || _s51_itemsCtr2 >= 2) { - if (getRandom(9) != 0) + if (_vm->getRandom(4) != 0 || _s51_itemsCtr2 >= 2) { + if (_vm->getRandom(9) != 0) _s51_items[index]._currSequenceId = 0xBD; else _s51_items[index]._currSequenceId = 0xC0; @@ -170,7 +204,6 @@ void GnapEngine::scene51_dropNextItem() { ++_s51_itemsCtr2; } break; - } if (_s51_itemInsertDirection) { @@ -194,7 +227,7 @@ void GnapEngine::scene51_dropNextItem() { _s51_itemInsertX = 129; if (_s51_items[index]._currSequenceId == 0xBA) { - _s51_items[index]._x2 = getRandom(350) + 200; + _s51_items[index]._x2 = _vm->getRandom(350) + 200; _s51_items[index]._x = _s51_items[index]._x2 - 362; _s51_items[index]._y = 15; _s51_items[index]._id = 249 - index; @@ -207,37 +240,37 @@ void GnapEngine::scene51_dropNextItem() { _s51_items[index]._canCatch = true; } - _gameSys->setAnimation(_s51_items[index]._currSequenceId, _s51_items[index]._id, index + 1); - _gameSys->insertSequence(_s51_items[index]._currSequenceId, _s51_items[index]._id, 0, 0, + _vm->_gameSys->setAnimation(_s51_items[index]._currSequenceId, _s51_items[index]._id, index + 1); + _vm->_gameSys->insertSequence(_s51_items[index]._currSequenceId, _s51_items[index]._id, 0, 0, kSeqNone, 0, _s51_items[index]._x, _s51_items[index]._y); - _timers[0] = _s51_dropSpeedTicks; + _vm->_timers[0] = _s51_dropSpeedTicks; if (_s51_nextDropItemKind >= 3) - _timers[0] = 20; + _vm->_timers[0] = 20; if (_s51_nextDropItemKind >= 5) - _timers[0] = 5; + _vm->_timers[0] = 5; if (_s51_nextDropItemKind == 8) - _timers[0] = 4; + _vm->_timers[0] = 4; ++_s51_itemsCtr; - } -void GnapEngine::scene51_updateItemAnimations() { - for (int i = 0; i < 6; ++i) - if (_gameSys->getAnimationStatus(i + 1) == 2) - scene51_updateItemAnimation(&_s51_items[i], i); +void Scene51::updateItemAnimations() { + for (int i = 0; i < 6; ++i) { + if (_vm->_gameSys->getAnimationStatus(i + 1) == 2) + updateItemAnimation(&_s51_items[i], i); + } } -int GnapEngine::scene51_checkCollision(int sequenceId) { +int Scene51::checkCollision(int sequenceId) { bool jumpingLeft = false, jumpingRight = false; int v8, v4; int result = 0; - if (!scene51_isJumping(sequenceId)) + if (!isJumping(sequenceId)) return false; bool checkFl = false; @@ -247,13 +280,13 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { if (!checkFl) return false; - if (scene51_isJumpingRight(sequenceId)) { - v8 = scene51_getPosRight(sequenceId); - v4 = scene51_getPosRight(sequenceId + 1); + if (isJumpingRight(sequenceId)) { + v8 = getPosRight(sequenceId); + v4 = getPosRight(sequenceId + 1); jumpingRight = true; - } else if (scene51_isJumpingLeft(sequenceId)) { - v4 = scene51_getPosLeft(sequenceId - 1) + 33; - v8 = scene51_getPosLeft(sequenceId) + 33; + } else if (isJumpingLeft(sequenceId)) { + v4 = getPosLeft(sequenceId - 1) + 33; + v8 = getPosLeft(sequenceId) + 33; jumpingLeft = true; } @@ -278,8 +311,8 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { } } if (v5) { - _gameSys->setAnimation(0xBC, _s51_items[i]._id, i + 1); - _gameSys->insertSequence(0xBC, _s51_items[i]._id, _s51_items[i]._currSequenceId, _s51_items[i]._id, kSeqSyncWait, 0, _s51_items[i]._x, 15); + _vm->_gameSys->setAnimation(0xBC, _s51_items[i]._id, i + 1); + _vm->_gameSys->insertSequence(0xBC, _s51_items[i]._id, _s51_items[i]._currSequenceId, _s51_items[i]._id, kSeqSyncWait, 0, _s51_items[i]._x, 15); _s51_items[i]._isCollision = false; _s51_items[i]._currSequenceId = 0xBC; --_s51_itemsCtr2; @@ -290,14 +323,14 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { return result; } -void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { +void Scene51::updateItemAnimation(Scene51Item *item, int index) { switch (item->_currSequenceId) { case 0xBD: case 0xC0: case 0xC1: // Falling coin and banknote - if (!scene51_itemIsCaught(item)) { + if (!itemIsCaught(item)) { if (_s51_dropLoseCash) { if (item->_currSequenceId == 0xBD) _s51_cashAmount -= 2; @@ -305,30 +338,30 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { _s51_cashAmount -= 25; if (_s51_cashAmount < 0) _s51_cashAmount = 0; - scene51_updateCash(_s51_cashAmount); + updateCash(_s51_cashAmount); } item->_droppedSequenceId = item->_currSequenceId + 1; if (item->_currSequenceId != 0xC0) { item->_canCatch = false; _s51_dropLoseCash = true; _s51_itemsCtr = 0; - _timers[0] = 10; + _vm->_timers[0] = 10; } if (item->_droppedSequenceId) { - _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); item->_currSequenceId = item->_droppedSequenceId; item->_y = 0; } } else { - _gameSys->removeSequence(item->_currSequenceId, item->_id, true); - _gameSys->setAnimation(0, 0, index + 1); - playSound(218, false); - if (scene51_incCashAmount(item->_currSequenceId) == 1995) { - scene51_winMinigame(); - _sceneDone = true; + _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); + _vm->_gameSys->setAnimation(0, 0, index + 1); + _vm->playSound(218, false); + if (incCashAmount(item->_currSequenceId) == 1995) { + winMinigame(); + _vm->_sceneDone = true; } else { - scene51_clearItem(item); + clearItem(item); ++_s51_itemsCaughtCtr; if (_s51_itemsCaughtCtr == 5) --_s51_dropSpeedTicks; @@ -347,7 +380,7 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { _s51_itemsCtr1 = 20; _s51_dropLoseCash = false; _s51_itemsCaughtCtr = 0; - scene51_removeCollidedItems(); + removeCollidedItems(); } } } @@ -357,8 +390,8 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { // Fallen coin item->_droppedSequenceId = item->_currSequenceId + 1; if (item->_droppedSequenceId) { - _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); item->_currSequenceId = item->_droppedSequenceId; item->_y = 0; } @@ -367,9 +400,9 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { case 0xBF: case 0xC2: // Bouncing coin and banknote - _gameSys->setAnimation(0, 0, index + 1); - _gameSys->removeSequence(item->_currSequenceId, item->_id, true); - scene51_clearItem(item); + _vm->_gameSys->setAnimation(0, 0, index + 1); + _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); + clearItem(item); break; case 0xBA: @@ -377,8 +410,8 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { item->_droppedSequenceId = 0xBB; item->_y = 15; if (item->_droppedSequenceId) { - _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); item->_currSequenceId = item->_droppedSequenceId; item->_y = 0; } @@ -387,60 +420,57 @@ void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { case 0xBB: item->_isCollision = true; item->_droppedSequenceId = 0; - _gameSys->setAnimation(0, 0, index + 1); + _vm->_gameSys->setAnimation(0, 0, index + 1); break; case 0xBC: - _gameSys->removeSequence(item->_currSequenceId, item->_id, true); - _gameSys->setAnimation(0, 0, index + 1); - scene51_clearItem(item); + _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); + _vm->_gameSys->setAnimation(0, 0, index + 1); + clearItem(item); break; default: if (item->_droppedSequenceId) { - _gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); item->_currSequenceId = item->_droppedSequenceId; item->_y = 0; } break; - } - } -void GnapEngine::scene51_removeCollidedItems() { +void Scene51::removeCollidedItems() { for (int i = 0; i < 6; ++i) { if (_s51_items[i]._isCollision) { - _gameSys->removeSequence(_s51_items[i]._currSequenceId, _s51_items[i]._id, true); - _gameSys->setAnimation(0, 0, i + 1); - scene51_clearItem(&_s51_items[i]); + _vm->_gameSys->removeSequence(_s51_items[i]._currSequenceId, _s51_items[i]._id, true); + _vm->_gameSys->setAnimation(0, 0, i + 1); + clearItem(&_s51_items[i]); } } _s51_itemsCtr2 = 0; } -int GnapEngine::scene51_itemIsCaught(Scene51Item *item) { - +int Scene51::itemIsCaught(Scene51Item *item) { if (!item->_canCatch) return 0; - if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { - int v4 = scene51_getPosRight(_s51_platypusJumpSequenceId) + 97; + if (isJumpingRight(_s51_platypusJumpSequenceId)) { + int v4 = getPosRight(_s51_platypusJumpSequenceId) + 97; if (item->_collisionX < v4 && v4 - item->_collisionX < 56) return 1; } else { - int v2 = scene51_getPosLeft(_s51_platypusJumpSequenceId); + int v2 = getPosLeft(_s51_platypusJumpSequenceId); if (item->_collisionX > v2 && item->_collisionX - v2 < 56) return 1; } if (item->_currSequenceId == 0xC1) { int v3 = item->_collisionX + 100; - if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { - if (ABS(scene51_getPosRight(_s51_platypusJumpSequenceId) + 46 - v3) < 56) + if (isJumpingRight(_s51_platypusJumpSequenceId)) { + if (ABS(getPosRight(_s51_platypusJumpSequenceId) + 46 - v3) < 56) return 1; - } else if (ABS(scene51_getPosLeft(_s51_platypusJumpSequenceId) + 46 - v3) < 56) { + } else if (ABS(getPosLeft(_s51_platypusJumpSequenceId) + 46 - v3) < 56) { return 1; } } @@ -448,27 +478,27 @@ int GnapEngine::scene51_itemIsCaught(Scene51Item *item) { return 0; } -bool GnapEngine::scene51_isJumpingRight(int sequenceId) { +bool Scene51::isJumpingRight(int sequenceId) { return sequenceId >= 0x76 && sequenceId <= 0x95; } -bool GnapEngine::scene51_isJumpingLeft(int sequenceId) { +bool Scene51::isJumpingLeft(int sequenceId) { return sequenceId >= 0x96 && sequenceId <= 0xB5; } -bool GnapEngine::scene51_isJumping(int sequenceId) { +bool Scene51::isJumping(int sequenceId) { return sequenceId >= 0x76 && sequenceId <= 0xB5; } -void GnapEngine::scene51_waitForAnim(int animationIndex) { - while (_gameSys->getAnimationStatus(animationIndex) != 2) { +void Scene51::waitForAnim(int animationIndex) { + while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { // pollMessages(); - scene51_updateItemAnimations(); - gameUpdateTick(); + updateItemAnimations(); + _vm->gameUpdateTick(); } } -int GnapEngine::scene51_getPosRight(int sequenceId) { +int Scene51::getPosRight(int sequenceId) { static const int kRightPosTbl[] = { 131, 159, 178, 195, 203, 219, 238, 254, 246, 274, 293, 310, 318, 334, 353, 369, @@ -481,7 +511,7 @@ int GnapEngine::scene51_getPosRight(int sequenceId) { return -1; } -int GnapEngine::scene51_getPosLeft(int sequenceId) { +int Scene51::getPosLeft(int sequenceId) { static const int kLeftPosTbl[] = { 580, 566, 550, 536, 526, 504, 488, 469, 460, 446, 430, 416, 406, 384, 368, 349, @@ -494,14 +524,14 @@ int GnapEngine::scene51_getPosLeft(int sequenceId) { return -1; } -void GnapEngine::scene51_playIntroAnim() { +void Scene51::playIntroAnim() { int soundCtr = 0; _s51_platypusSequenceId = 0x76; _s51_platypusNextSequenceId = 0x76; for (int i = 0; i < 6; ++i) - scene51_clearItem(&_s51_items[i]); + clearItem(&_s51_items[i]); _s51_items[0]._currSequenceId = 0xBA; _s51_items[0]._x2 = 320; @@ -510,51 +540,48 @@ void GnapEngine::scene51_playIntroAnim() { _s51_items[0]._id = 249; _s51_items[0]._isCollision = true; - _gameSys->insertSequence(_s51_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0); - _gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _s51_items[0]._x, _s51_items[0]._y); - _gameSys->setAnimation(0xBA, 249, 1); - _gameSys->setAnimation(_s51_platypusSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_s51_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0); + _vm->_gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _s51_items[0]._x, _s51_items[0]._y); + _vm->_gameSys->setAnimation(0xBA, 249, 1); + _vm->_gameSys->setAnimation(_s51_platypusSequenceId, 256, 0); while (_s51_platypusSequenceId < 0x80) { - scene51_waitForAnim(0); + waitForAnim(0); ++_s51_platypusNextSequenceId; - _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, -179, 0); + _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, -179, 0); _s51_platypusSequenceId = _s51_platypusNextSequenceId; ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, false); + _vm->playSound(214, false); } _s51_platypusNextSequenceId = 0x75; while (_s51_platypusSequenceId != 0x84) { - scene51_waitForAnim(0); + waitForAnim(0); ++_s51_platypusNextSequenceId; int oldSequenceId = _s51_platypusNextSequenceId; - int v0 = scene51_checkCollision(_s51_platypusNextSequenceId); - _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, v0, 0); + int v0 = checkCollision(_s51_platypusNextSequenceId); + _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, v0, 0); _s51_platypusSequenceId = _s51_platypusNextSequenceId; if (v0) { _s51_platypusNextSequenceId = oldSequenceId; } else { ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, false); + _vm->playSound(214, false); } } - - scene51_waitForAnim(0); - + waitForAnim(0); } -void GnapEngine::scene51_updateGuyAnimation() { - - if (!_timers[4]) { - _timers[4] = getRandom(20) + 60; +void Scene51::updateGuyAnimation() { + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 60; - switch (getRandom(5)) { + switch (_vm->getRandom(5)) { case 0: _s51_guyNextSequenceId = 0xC3; break; @@ -572,15 +599,13 @@ void GnapEngine::scene51_updateGuyAnimation() { break; } - _gameSys->insertSequence(_s51_guyNextSequenceId, 39, _s51_guySequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_s51_guyNextSequenceId, 39, _s51_guySequenceId, 39, kSeqSyncWait, 0, 0, 0); _s51_guySequenceId = _s51_guyNextSequenceId; _s51_guyNextSequenceId = -1; - } - } -int GnapEngine::scene51_incCashAmount(int sequenceId) { +int Scene51::incCashAmount(int sequenceId) { switch (sequenceId) { case 0xBD: _s51_cashAmount += 10; @@ -591,44 +616,44 @@ int GnapEngine::scene51_incCashAmount(int sequenceId) { break; case 0xB6: case 0xB7: - _s51_cashAmount -= 10 * getRandom(5) + 50; + _s51_cashAmount -= 10 * _vm->getRandom(5) + 50; if (_s51_cashAmount < 0) _s51_cashAmount = 0; break; } if (_s51_cashAmount > 1995) _s51_cashAmount = 1995; - scene51_updateCash(_s51_cashAmount); + updateCash(_s51_cashAmount); return _s51_cashAmount; } -void GnapEngine::scene51_winMinigame() { - scene51_updateCash(1995); - playSound(218, false); +void Scene51::winMinigame() { + updateCash(1995); + _vm->playSound(218, false); // TODO delayTicksA(1, 5); - _newSceneNum = 48; - invRemove(kItemBanana); + _vm->_newSceneNum = 48; + _vm->invRemove(kItemBanana); } -void GnapEngine::scene51_playCashAppearAnim() { - _gameSys->setAnimation(0xC8, 252, 0); - _gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20); - while (_gameSys->getAnimationStatus(0) != 2) { - gameUpdateTick(); +void Scene51::playCashAppearAnim() { + _vm->_gameSys->setAnimation(0xC8, 252, 0); + _vm->_gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + _vm->gameUpdateTick(); // checkGameAppStatus(); } } -void GnapEngine::scene51_updateCash(int amount) { - scene51_drawDigit(amount / 1000, 0); - scene51_drawDigit(amount / 100 % 10, 1); - scene51_drawDigit(amount / 10 % 10, 2); - scene51_drawDigit(amount % 10, 3); +void Scene51::updateCash(int amount) { + drawDigit(amount / 1000, 0); + drawDigit(amount / 100 % 10, 1); + drawDigit(amount / 10 % 10, 2); + drawDigit(amount % 10, 3); } -void GnapEngine::scene51_drawDigit(int digit, int position) { +void Scene51::drawDigit(int digit, int position) { if (digit != _s51_digits[position]) { - _gameSys->insertSequence(kDigitSequenceIds[digit], 253, + _vm->_gameSys->insertSequence(kDigitSequenceIds[digit], 253, _s51_digitSequenceIds[position], 253, kSeqSyncWait, 0, kDigitPositions[position] - 20, -20); _s51_digitSequenceIds[position] = kDigitSequenceIds[digit]; @@ -636,44 +661,42 @@ void GnapEngine::scene51_drawDigit(int digit, int position) { } } -void GnapEngine::scene51_initCashDisplay() { +void Scene51::initCashDisplay() { for (int position = 0; position < 4; ++position) { _s51_digits[position] = 0; _s51_digitSequenceIds[position] = kDigitSequenceIds[0]; - _gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0, + _vm->_gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0, kSeqNone, 0, kDigitPositions[position] - 20, -20); } _s51_cashAmount = 0; } -void GnapEngine::scene51_run() { - +void Scene51::run() { int soundCtr = 0; bool isIdle = true; _s51_itemsCtr = 0; - _newSceneNum = _prevSceneNum; + _vm->_newSceneNum = _vm->_prevSceneNum; _s51_cashAmount = 0; _s51_platypusJumpSequenceId = 0x84; - endSceneInit(); + _vm->endSceneInit(); - hideCursor(); - setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); _s51_guySequenceId = 0xC3; _s51_guyNextSequenceId = -1; - _gameSys->insertSequence(0xC3, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xC3, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(20) + 60; - _timers[4] = getRandom(20) + 60; - - scene51_playCashAppearAnim(); - scene51_initCashDisplay(); - scene51_playIntroAnim(); + playCashAppearAnim(); + initCashDisplay(); + playIntroAnim(); _s51_platypusNextSequenceId = 0x74; - _gameSys->setAnimation(0x74, 256, 0); - _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 362, 0); + _vm->_gameSys->setAnimation(0x74, 256, 0); + _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 362, 0); _s51_platypusSequenceId = _s51_platypusNextSequenceId; _s51_itemInsertDirection = 0; @@ -682,55 +705,53 @@ void GnapEngine::scene51_run() { _s51_nextDropItemKind = 0; for (int i = 0; i < 6; ++i) - scene51_clearItem(&_s51_items[i]); - - _s51_itemInsertX = getRandom(556) + 129; + clearItem(&_s51_items[i]); - _timers[0] = 15; + _s51_itemInsertX = _vm->getRandom(556) + 129; + _vm->_timers[0] = 15; _s51_itemsCaughtCtr = 0; _s51_dropLoseCash = false; _s51_itemsCtr1 = 20; - clearKeyStatus1(Common::KEYCODE_RIGHT); - clearKeyStatus1(Common::KEYCODE_LEFT); - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_SPACE); - clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); bool isCollision = false; bool startWalk = true; - while (!_sceneDone) { + while (!_vm->_sceneDone) { + if (_vm->sceneXX_sub_4466B1()) + _vm->_sceneDone = true; - if (sceneXX_sub_4466B1()) - _sceneDone = true; + _vm->gameUpdateTick(); - gameUpdateTick(); + updateGuyAnimation(); + dropNextItem(); + updateItemAnimations(); - scene51_updateGuyAnimation(); - scene51_dropNextItem(); - scene51_updateItemAnimations(); - - if (isKeyStatus2(Common::KEYCODE_UP) || isKeyStatus2(Common::KEYCODE_SPACE)) { - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_SPACE); - if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { - scene51_waitForAnim(0); - _gameSys->setAnimation(0xB8, 256, 0); - _gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 348, 0); + if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + if (isJumpingRight(_s51_platypusJumpSequenceId)) { + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB8, 256, 0); + _vm->_gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 348, 0); _s51_platypusSequenceId = 0xB8; - scene51_waitForAnim(0); + waitForAnim(0); _s51_platypusNextSequenceId += 6; if (_s51_platypusNextSequenceId > 0x95) _s51_platypusNextSequenceId = 0x95; _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; } else { - scene51_waitForAnim(0); - _gameSys->setAnimation(0xB9, 256, 0); - _gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB9, 256, 0); + _vm->_gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); _s51_platypusSequenceId = 0xB9; - scene51_waitForAnim(0); + waitForAnim(0); _s51_platypusNextSequenceId += 6; if (_s51_platypusNextSequenceId > 0xB5) _s51_platypusNextSequenceId = 0xB5; @@ -739,22 +760,22 @@ void GnapEngine::scene51_run() { isIdle = false; } - while (isKeyStatus2(Common::KEYCODE_RIGHT) && _s51_platypusNextSequenceId != 0x96) { + while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT) && _s51_platypusNextSequenceId != 0x96) { // pollMessages(); if (_s51_platypusNextSequenceId == 0xB6) _s51_platypusNextSequenceId = 0x76; - scene51_updateItemAnimations(); + updateItemAnimations(); if (startWalk) { _s51_platypusNextSequenceId = 0x86; startWalk = false; } - if (_gameSys->getAnimationStatus(0) == 2) { - int collisionX = scene51_checkCollision(_s51_platypusNextSequenceId); + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + int collisionX = checkCollision(_s51_platypusNextSequenceId); if (collisionX) - scene51_incCashAmount(_s51_platypusNextSequenceId); - _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); + incCashAmount(_s51_platypusNextSequenceId); + _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); _s51_platypusSequenceId = _s51_platypusNextSequenceId; if (collisionX) { isCollision = true; @@ -763,17 +784,17 @@ void GnapEngine::scene51_run() { } else { _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; } - if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { + if (isJumpingRight(_s51_platypusJumpSequenceId)) { ++_s51_platypusNextSequenceId; if (!isCollision) { - if (isKeyStatus2(Common::KEYCODE_UP) || isKeyStatus2(Common::KEYCODE_SPACE)) { - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_SPACE); - scene51_waitForAnim(0); - _gameSys->setAnimation(0xB8, 256, 0); - _gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 348, 0); + if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB8, 256, 0); + _vm->_gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 348, 0); _s51_platypusSequenceId = 0xB8; - scene51_waitForAnim(0); + waitForAnim(0); _s51_platypusNextSequenceId += 6; if (_s51_platypusNextSequenceId > 0x95) _s51_platypusNextSequenceId = 0x95; @@ -781,7 +802,7 @@ void GnapEngine::scene51_run() { } else { ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, false); + _vm->playSound(214, false); } } } else { @@ -790,23 +811,23 @@ void GnapEngine::scene51_run() { isCollision = false; isIdle = false; } - gameUpdateTick(); + _vm->gameUpdateTick(); } - while (isKeyStatus2(Common::KEYCODE_LEFT) && _s51_platypusNextSequenceId != 0xB6) { + while (_vm->isKeyStatus2(Common::KEYCODE_LEFT) && _s51_platypusNextSequenceId != 0xB6) { // pollMessages(); - scene51_updateItemAnimations(); + updateItemAnimations(); if (startWalk) { _s51_platypusNextSequenceId = 0xA5; startWalk = false; } - if (_gameSys->getAnimationStatus(0) == 2) { - int collisionX = scene51_checkCollision(_s51_platypusNextSequenceId); + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + int collisionX = checkCollision(_s51_platypusNextSequenceId); if (collisionX) - scene51_incCashAmount(_s51_platypusNextSequenceId); - _gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); + incCashAmount(_s51_platypusNextSequenceId); + _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); _s51_platypusSequenceId = _s51_platypusNextSequenceId; if (collisionX) { isCollision = true; @@ -815,17 +836,17 @@ void GnapEngine::scene51_run() { } else { _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; } - if (scene51_isJumpingLeft(_s51_platypusJumpSequenceId)) { + if (isJumpingLeft(_s51_platypusJumpSequenceId)) { ++_s51_platypusNextSequenceId; if (!isCollision) { - if (isKeyStatus2(Common::KEYCODE_UP) || isKeyStatus2(Common::KEYCODE_SPACE)) { - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_SPACE); - scene51_waitForAnim(0); - _gameSys->setAnimation(0xB9, 256, 0); - _gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); + if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB9, 256, 0); + _vm->_gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); _s51_platypusSequenceId = 0xB9; - scene51_waitForAnim(0); + waitForAnim(0); _s51_platypusNextSequenceId += 6; if (_s51_platypusNextSequenceId > 0xB5) _s51_platypusNextSequenceId = 0xB5; @@ -833,7 +854,7 @@ void GnapEngine::scene51_run() { } else { ++soundCtr; if (soundCtr % 4 == 0) - playSound(214, false); + _vm->playSound(214, false); } } } else { @@ -842,37 +863,35 @@ void GnapEngine::scene51_run() { isCollision = false; isIdle = false; } - gameUpdateTick(); + _vm->gameUpdateTick(); } - if (!isIdle && _gameSys->getAnimationStatus(0) == 2) { - if (scene51_isJumpingRight(_s51_platypusJumpSequenceId)) { - _gameSys->setAnimation(0x74, 256, 0); - _gameSys->insertSequence(0x74, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosRight(_s51_platypusJumpSequenceId) - 362, 0); + if (!isIdle && _vm->_gameSys->getAnimationStatus(0) == 2) { + if (isJumpingRight(_s51_platypusJumpSequenceId)) { + _vm->_gameSys->setAnimation(0x74, 256, 0); + _vm->_gameSys->insertSequence(0x74, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 362, 0); _s51_platypusSequenceId = 0x74; } else { - _gameSys->setAnimation(0x75, 256, 0); - _gameSys->insertSequence(0x75, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, scene51_getPosLeft(_s51_platypusJumpSequenceId) - 341, 0); + _vm->_gameSys->setAnimation(0x75, 256, 0); + _vm->_gameSys->insertSequence(0x75, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 341, 0); _s51_platypusSequenceId = 0x75; } - scene51_waitForAnim(0); + waitForAnim(0); isIdle = true; } - } - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_SPACE); - clearKeyStatus1(Common::KEYCODE_RIGHT); - clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); - _gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 0); for (int i = 0; i < 6; ++i) - _gameSys->setAnimation(0, 0, i + 1); - - showCursor(); + _vm->_gameSys->setAnimation(0, 0, i + 1); + _vm->showCursor(); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene51.h b/engines/gnap/scenes/scene51.h new file mode 100644 index 0000000000..44fbd3d4d1 --- /dev/null +++ b/engines/gnap/scenes/scene51.h @@ -0,0 +1,101 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE51_H +#define GNAP_SCENE51_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +struct Scene51Item { + int _currSequenceId; + int _droppedSequenceId; + int _x, _y; + int _collisionX; + bool _canCatch; + bool _isCollision; + int _x2; + int _id; +}; + +class Scene51: public Scene { +public: + Scene51(GnapEngine *vm); + ~Scene51() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations() {}; + virtual void updateAnimationsCb() {}; + +private: + bool _s51_dropLoseCash; + + int _s51_cashAmount; + int _s51_digits[4]; + int _s51_digitSequenceIds[4]; + int _s51_guySequenceId; + int _s51_guyNextSequenceId; + int _s51_itemsCaughtCtr; + int _s51_dropSpeedTicks; + int _s51_nextDropItemKind; + int _s51_itemInsertX; + int _s51_itemInsertDirection; + int _s51_platypusSequenceId; + int _s51_platypusNextSequenceId; + int _s51_platypusJumpSequenceId; + int _s51_itemsCtr; + int _s51_itemsCtr1; + int _s51_itemsCtr2; + + Scene51Item _s51_items[6]; + + void clearItem(Scene51Item *item); + void dropNextItem(); + void updateItemAnimations(); + int checkCollision(int sequenceId); + void updateItemAnimation(Scene51Item *item, int index); + void removeCollidedItems(); + int itemIsCaught(Scene51Item *item); + bool isJumpingRight(int sequenceId); + bool isJumpingLeft(int sequenceId); + bool isJumping(int sequenceId); + void waitForAnim(int animationIndex); + int getPosRight(int sequenceId); + int getPosLeft(int sequenceId); + void playIntroAnim(); + void updateGuyAnimation(); + int incCashAmount(int sequenceId); + void winMinigame(); + void playCashAppearAnim(); + void updateCash(int amount); + void drawDigit(int digit, int position); + void initCashDisplay(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE51_H diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index 3d74538b27..fb16184742 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -23,96 +23,103 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene52.h" namespace Gnap { -int GnapEngine::scene52_init() { - scene52_initAnims(); +Scene52::Scene52(GnapEngine *vm) : Scene(vm) { + _s52_gameScore = 0; + _s52_aliensInitialized = false; + _s52_alienDirection = 0; + _s52_soundToggle = false; +} + +int Scene52::init() { + initAnims(); return 0x2B; } -void GnapEngine::scene52_updateHotspots() { - _hotspotsCount = 0; +void Scene52::updateHotspots() { + _vm->_hotspotsCount = 0; } -void GnapEngine::scene52_update() { - +void Scene52::update() { for (int rowNum = 0; rowNum < 7; ++rowNum) { - gameUpdateTick(); - if (_gameSys->getAnimationStatus(_s52_alienRowAnims[rowNum]) == 2) { - scene52_updateAlienRow(rowNum); + _vm->gameUpdateTick(); + if (_vm->_gameSys->getAnimationStatus(_s52_alienRowAnims[rowNum]) == 2) { + updateAlienRow(rowNum); rowNum = 0; } } if (_s52_liveAlienRows == 0 && !_s52_alienSingle) { _s52_alienWave = false; - playSound(48, false); + _vm->playSound(48, false); ++_s52_alienCounter; if (_s52_alienCounter != 3) { - _timers[0] = 50; - _timers[2] = 100; + _vm->_timers[0] = 50; + _vm->_timers[2] = 100; _s52_alienRowDownCtr = 0; _s52_alienSingle = true; } } - if (_s52_alienSingle && !_timers[0]) { - scene52_initAliens(); + if (_s52_alienSingle && !_vm->_timers[0]) { + initAliens(); _s52_alienSingle = false; - _timers[2] = 5; + _vm->_timers[2] = 5; _s52_alienWave = true; } if ((_s52_alienRowDownCtr || _s52_liveAlienRows == 0) && !_s52_alienSingle) { - scene52_moveDownAlienRow(); + moveDownAlienRow(); _s52_alienRowDownCtr = 0; } - if (isKeyStatus1(Common::KEYCODE_UP) || isKeyStatus1(Common::KEYCODE_SPACE)) { - clearKeyStatus1(Common::KEYCODE_SPACE); - clearKeyStatus1(Common::KEYCODE_UP); + if (_vm->isKeyStatus1(Common::KEYCODE_UP) || _vm->isKeyStatus1(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); if (!_s52_aliensCount) - scene52_fireShipCannon(_s52_shipPosX); + fireShipCannon(_s52_shipPosX); } if (_s52_shipCannonFiring) - scene52_updateShipCannon(); + updateShipCannon(); - scene52_fireAlienCannon(); - scene52_updateAlienCannons(); + fireAlienCannon(); + updateAlienCannons(); if (_s52_aliensCount == 1) { _s52_alienWave = false; - _timers[3] = 20; - _timers[2] = 100; + _vm->_timers[3] = 20; + _vm->_timers[2] = 100; ++_s52_aliensCount; } - if (_s52_aliensCount && !_timers[3]) { - scene52_updateAliens(); - scene52_loseShip(); + if (_s52_aliensCount && !_vm->_timers[3]) { + updateAliens(); + loseShip(); if (_s52_shipsLeft != 0) { - _timers[3] = 40; - while (_timers[3]) { - scene52_updateAlienCannons(); + _vm->_timers[3] = 40; + while (_vm->_timers[3]) { + updateAlienCannons(); if (_s52_shipCannonFiring) - scene52_updateShipCannon(); - gameUpdateTick(); + updateShipCannon(); + _vm->gameUpdateTick(); } - scene52_initAliens(); + initAliens(); _s52_shipPosX = (800 - _s52_shipMidX) / 2; - _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_ufoSequenceId = _s52_nextUfoSequenceId; - _timers[2] = 5; + _vm->_timers[2] = 5; _s52_alienWave = true; } else { - _sceneDone = true; + _vm->_sceneDone = true; } } - if (_timers[1] || scene52_getFreeShipCannon() == -1) { + if (_vm->_timers[1] || getFreeShipCannon() == -1) { _s52_nextUfoSequenceId = 34; if (_s52_ufoSequenceId != 34) _s52_shipFlag = true; @@ -123,35 +130,35 @@ void GnapEngine::scene52_update() { } if (_s52_shipFlag) { - if (_gameSys->getAnimationStatus(7) == 2) { - _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + if (_vm->_gameSys->getAnimationStatus(7) == 2) { + _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_ufoSequenceId = _s52_nextUfoSequenceId; } _s52_shipFlag = false; } - if (_s52_alienWave && !_timers[0]) { - scene52_playSound(); + if (_s52_alienWave && !_vm->_timers[0]) { + playSound(); int v0 = _s52_alienSpeed; if (_s52_alienSpeed >= 10) v0 = 10; int v1 = v0; if (v0 < 2) v1 = 2; - _timers[0] = v1; + _vm->_timers[0] = v1; } } -void GnapEngine::scene52_initShipCannon(int bottomY) { +void Scene52::initShipCannon(int bottomY) { _s52_shipCannonFired = false; - _s52_shipCannonWidth = MAX(_gameSys->getSpriteWidthById(14), _gameSys->getSpriteWidthById(16)); - _s52_shipCannonHeight = MAX(_gameSys->getSpriteHeightById(14), _gameSys->getSpriteHeightById(16)); + _s52_shipCannonWidth = MAX(_vm->_gameSys->getSpriteWidthById(14), _vm->_gameSys->getSpriteWidthById(16)); + _s52_shipCannonHeight = MAX(_vm->_gameSys->getSpriteHeightById(14), _vm->_gameSys->getSpriteHeightById(16)); _s52_shipCannonTopY = bottomY - _s52_shipCannonHeight; _s52_shipCannonFiring = false; } -void GnapEngine::scene52_initAlienCannons() { +void Scene52::initAlienCannons() { for (int i = 0; i < 3; ++i) { _s52_alienCannonIds[i] = 0; _s52_alienCannonFired[i] = 0; @@ -161,117 +168,112 @@ void GnapEngine::scene52_initAlienCannons() { _s52_alienCannonSequenceIds[2] = 32; } -void GnapEngine::scene52_fireShipCannon(int posX) { - - if (_timers[1]) +void Scene52::fireShipCannon(int posX) { + if (_vm->_timers[1]) return; - int cannonNum = scene52_getFreeShipCannon(); + int cannonNum = getFreeShipCannon(); if (cannonNum != -1) { _s52_shipCannonPosX = _s52_shipMidX / 2 + posX - _s52_shipCannonWidth / 2; _s52_shipCannonPosY = _s52_shipCannonTopY; - _gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8); - _gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); - playSound(0x2D, false); - if (scene52_shipCannonHitShield(cannonNum)) { - _gameSys->setAnimation(0, 0, cannonNum + 8); - _gameSys->removeSequence(0x23, cannonNum + 256, true); + _vm->_gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8); + _vm->_gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); + _vm->playSound(0x2D, false); + if (shipCannonHitShield(cannonNum)) { + _vm->_gameSys->setAnimation(0, 0, cannonNum + 8); + _vm->_gameSys->removeSequence(0x23, cannonNum + 256, true); } else { _s52_shipCannonFired = true; _s52_shipCannonPosY -= 13; _s52_shipCannonFiring = true; } - _timers[1] = 5; + _vm->_timers[1] = 5; } - } -void GnapEngine::scene52_fireAlienCannon() { - - if (_timers[2]) +void Scene52::fireAlienCannon() { + if (_vm->_timers[2]) return; - int cannonNum = scene52_getFreeAlienCannon(); + int cannonNum = getFreeAlienCannon(); if (cannonNum != -1) { int alienX1 = _s52_alienLeftX + _s52_alienRowXOfs[0]; int alienX2 = _s52_alienLeftX + _s52_alienRowXOfs[0] + 5 * _s52_alienWidth - (_s52_alienWidth / 2 - 15); - _s52_alienCannonPosX[cannonNum] = getRandom(alienX2 - alienX1) + alienX1; + _s52_alienCannonPosX[cannonNum] = _vm->getRandom(alienX2 - alienX1) + alienX1; _s52_alienCannonPosY[cannonNum] = 104; _s52_alienCannonFired[cannonNum] = 1; - _gameSys->setAnimation(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, cannonNum + 9); - _gameSys->insertSequence(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, 0, 0, + _vm->_gameSys->setAnimation(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, cannonNum + 9); + _vm->_gameSys->insertSequence(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[cannonNum], _s52_alienCannonPosY[cannonNum]); _s52_alienCannonPosY[cannonNum] -= 13; - _timers[2] = 5; + _vm->_timers[2] = 5; } - } -int GnapEngine::scene52_getFreeShipCannon() { +int Scene52::getFreeShipCannon() { if (!_s52_shipCannonFired) return 0; return -1; } -int GnapEngine::scene52_getFreeAlienCannon() { +int Scene52::getFreeAlienCannon() { for (int i = 0; i < 3; ++i) if (!_s52_alienCannonFired[i]) return i; return -1; } -void GnapEngine::scene52_updateShipCannon() { - if (_s52_shipCannonFired && _gameSys->getAnimationStatus(8) == 2) { +void Scene52::updateShipCannon() { + if (_s52_shipCannonFired && _vm->_gameSys->getAnimationStatus(8) == 2) { _s52_shipCannonPosY -= 13; if (_s52_shipCannonPosY - 13 >= 135) { - if (scene52_updateHitAlien()) { - _gameSys->setAnimation(0, 0, 8); - _gameSys->removeSequence(35, 256, true); + if (updateHitAlien()) { + _vm->_gameSys->setAnimation(0, 0, 8); + _vm->_gameSys->removeSequence(35, 256, true); _s52_shipCannonFired = false; - scene52_drawScore(_s52_gameScore); + drawScore(_s52_gameScore); } else { - _gameSys->setAnimation(35, 256, 8); - _gameSys->insertSequence(35, 256, 35, 256, kSeqSyncWait, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); + _vm->_gameSys->setAnimation(35, 256, 8); + _vm->_gameSys->insertSequence(35, 256, 35, 256, kSeqSyncWait, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); _s52_shipCannonPosY -= 13; } } else { - _gameSys->setAnimation(0, 0, 8); - _gameSys->removeSequence(35, 256, true); + _vm->_gameSys->setAnimation(0, 0, 8); + _vm->_gameSys->removeSequence(35, 256, true); _s52_shipCannonFired = false; } } } -void GnapEngine::scene52_updateAlienCannons() { +void Scene52::updateAlienCannons() { for (int i = 0; i < 3; ++i) { - if (_s52_alienCannonFired[i] && _gameSys->getAnimationStatus(i + 9) == 2) { + if (_s52_alienCannonFired[i] && _vm->_gameSys->getAnimationStatus(i + 9) == 2) { _s52_alienCannonPosY[i] += 13; if (_s52_shipCannonHeight + _s52_alienCannonPosY[i] + 13 <= 550) { - if (scene52_alienCannonHitShip(i)) { - _gameSys->setAnimation(0, 0, i + 9); + if (alienCannonHitShip(i)) { + _vm->_gameSys->setAnimation(0, 0, i + 9); _s52_alienCannonFired[i] = 0; - scene52_shipExplode(); - } else if (scene52_alienCannonHitShield(i)) { + shipExplode(); + } else if (alienCannonHitShield(i)) { _s52_alienCannonFired[i] = 0; } else { - _gameSys->insertSequence(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, 0, 0, + _vm->_gameSys->insertSequence(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[i], _s52_alienCannonPosY[i]); - _gameSys->setAnimation(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, i + 9); + _vm->_gameSys->setAnimation(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, i + 9); _s52_alienCannonIds[i] = 1 - _s52_alienCannonIds[i]; _s52_alienCannonPosY[i] += 13; } } else { - _gameSys->setAnimation(0, 0, i + 9); + _vm->_gameSys->setAnimation(0, 0, i + 9); _s52_alienCannonFired[i] = 0; } } } } -void GnapEngine::scene52_initAliens() { - +void Scene52::initAliens() { if (!_s52_aliensInitialized) { - scene52_initAlienSize(); + initAlienSize(); _s52_aliensInitialized = true; } @@ -282,91 +284,88 @@ void GnapEngine::scene52_initAliens() { _s52_alienSingle = false; _s52_alienRowDownCtr = 0; - scene52_initShields(); + initShields(); _s52_alienRowKind[0] = -1; _s52_alienRowKind[1] = -1; _s52_alienRowKind[2] = -1; _s52_alienRowKind[3] = -1; - _s52_alienRowKind[4] = getRandom(2) != 0 ? 24 : 27; - _s52_alienRowKind[5] = getRandom(2) != 0 ? 25 : 28; - _s52_alienRowKind[6] = getRandom(2) != 0 ? 26 : 29; + _s52_alienRowKind[4] = _vm->getRandom(2) != 0 ? 24 : 27; + _s52_alienRowKind[5] = _vm->getRandom(2) != 0 ? 25 : 28; + _s52_alienRowKind[6] = _vm->getRandom(2) != 0 ? 26 : 29; for (int i = 0; i < 7; ++i) { _s52_alienRowAnims[i] = i; _s52_alienRowXOfs[i] = 0; - scene52_initAlienRowKind(i, _s52_alienRowKind[i]); - scene52_insertAlienRow(i); + initAlienRowKind(i, _s52_alienRowKind[i]); + insertAlienRow(i); } - } -void GnapEngine::scene52_initAlienRowKind(int rowNum, int alienKind) { +void Scene52::initAlienRowKind(int rowNum, int alienKind) { for (int i = 0; i < 5; ++i) _s52_items[rowNum][i] = alienKind; } -void GnapEngine::scene52_insertAlienRow(int rowNum) { +void Scene52::insertAlienRow(int rowNum) { if (_s52_alienRowKind[rowNum] >= 0) { - scene52_insertAlienRowAliens(rowNum); + insertAlienRowAliens(rowNum); _s52_alienRowIds[rowNum] = 256; - _gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); + _vm->_gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); ++_s52_liveAlienRows; } } -void GnapEngine::scene52_insertAlienRowAliens(int rowNum) { +void Scene52::insertAlienRowAliens(int rowNum) { int xOffs = _s52_alienLeftX; int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10; for (int i = 0; i < 5; ++i) { if (_s52_items[rowNum][i] >= 0) { - _gameSys->insertSequence(_s52_items[rowNum][i], i + 256, 0, 0, kSeqNone, 0, xOffs, yOffs); + _vm->_gameSys->insertSequence(_s52_items[rowNum][i], i + 256, 0, 0, kSeqNone, 0, xOffs, yOffs); ++_s52_alienSpeed; } xOffs += _s52_alienWidth; } } -void GnapEngine::scene52_updateAlienRow(int rowNum) { - - if (_s52_alienRowKind[rowNum] != -1 && !scene52_checkAlienRow(rowNum)) { - scene52_updateAlienRowXOfs(); +void Scene52::updateAlienRow(int rowNum) { + if (_s52_alienRowKind[rowNum] != -1 && !checkAlienRow(rowNum)) { + updateAlienRowXOfs(); _s52_alienRowIds[rowNum] = -1; int xOffs = _s52_alienLeftX + _s52_alienRowXOfs[rowNum]; int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10; for (int i = 0; i < 5; ++i) { if (_s52_items[rowNum][i] >= 0) { - _gameSys->insertSequence(_s52_items[rowNum][i], i + 256, _s52_items[rowNum][i], i + 256, kSeqSyncWait, 0, xOffs, yOffs); + _vm->_gameSys->insertSequence(_s52_items[rowNum][i], i + 256, _s52_items[rowNum][i], i + 256, kSeqSyncWait, 0, xOffs, yOffs); if (_s52_alienRowIds[rowNum] == -1) _s52_alienRowIds[rowNum] = i + 256; } else if (_s52_items[rowNum][i] == -2) { - _gameSys->removeSequence(_s52_alienRowKind[rowNum], i + 256, true); + _vm->_gameSys->removeSequence(_s52_alienRowKind[rowNum], i + 256, true); _s52_items[rowNum][i] = -1; --_s52_alienSpeed; } xOffs += _s52_alienWidth; } if (_s52_alienRowIds[rowNum] == -1) { - _gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); + _vm->_gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); // MessageBoxA(0, "No live aliens!", "Error 3:", 0x30u); } else { - _gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); + _vm->_gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); } if (rowNum == 1) { for (int j = 0; j < 3; ++j) { if (_s52_shieldSpriteIds[j] != -1) { - _gameSys->fillSurface(0, _s52_shieldPosX[j], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(0, _s52_shieldPosX[j], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _s52_shieldSpriteIds[j] = -1; } } } if (rowNum == 0 && _s52_bottomAlienFlag) - scene52_shipExplode(); + shipExplode(); } } -void GnapEngine::scene52_moveDownAlienRow() { - +void Scene52::moveDownAlienRow() { int v2[5], v3, v1, v0, v4; for (int i = 0; i < 5; ++i) @@ -394,14 +393,14 @@ void GnapEngine::scene52_moveDownAlienRow() { _s52_alienRowKind[6] = v0; _s52_alienRowXOfs[6] = v4; - scene52_updateAlien(6); - scene52_initAlienRowKind(6, _s52_alienRowKind[6]); - scene52_insertAlienRow(6); + updateAlien(6); + initAlienRowKind(6, _s52_alienRowKind[6]); + insertAlienRow(6); _s52_bottomAlienFlag = _s52_alienRowKind[0] > -1; } -int GnapEngine::scene52_updateHitAlien() { +int Scene52::updateHitAlien() { int result = 0, rowNum, ya; int y = _s52_shipCannonTopY - _s52_shipCannonPosY; @@ -417,12 +416,12 @@ int GnapEngine::scene52_updateHitAlien() { } if (rowNum < 7) { - int hitAlienNum = scene52_getHitAlienNum(rowNum); + int hitAlienNum = getHitAlienNum(rowNum); if (hitAlienNum != -1 && _s52_items[rowNum][hitAlienNum] >= 0) { _s52_gameScore = ((_s52_items[rowNum][hitAlienNum] - 24) % 3 + _s52_gameScore + 1) % 1000; _s52_items[rowNum][hitAlienNum] = -2; - playSound(44, false); - _gameSys->insertSequence(0x21, 266, 0, 0, + _vm->playSound(44, false); + _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_alienLeftX + hitAlienNum * _s52_alienWidth + _s52_alienRowXOfs[rowNum] - 10, ya - _s52_alienHeight); result = 1; } @@ -431,8 +430,7 @@ int GnapEngine::scene52_updateHitAlien() { return result; } -int GnapEngine::scene52_getHitAlienNum(int rowNum) { - +int Scene52::getHitAlienNum(int rowNum) { int result = -1; int v3 = _s52_alienLeftX + _s52_alienRowXOfs[rowNum]; @@ -473,7 +471,7 @@ int GnapEngine::scene52_getHitAlienNum(int rowNum) { return result; } -int GnapEngine::scene52_alienCannonHitShip(int cannonNum) { +int Scene52::alienCannonHitShip(int cannonNum) { int result = 0; if (_s52_aliensCount) { @@ -496,7 +494,7 @@ int GnapEngine::scene52_alienCannonHitShip(int cannonNum) { return result; } -int GnapEngine::scene52_alienCannonHitShield(int cannonNum) { +int Scene52::alienCannonHitShield(int cannonNum) { int result = 0; int v3 = _s52_alienCannonPosY[cannonNum] + 39; @@ -533,21 +531,21 @@ int GnapEngine::scene52_alienCannonHitShield(int cannonNum) { } else { ++_s52_shieldSpriteIds[shieldNum]; if (_s52_shieldSpriteIds[shieldNum] <= 21) { - _gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); + _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); } else { - _gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _s52_shieldSpriteIds[shieldNum] = -1; } - _gameSys->setAnimation(0, 0, cannonNum + 9); - _gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[cannonNum] - 18, _s52_arcadeScreenBottom - 44); - playSound(0x2C, false); + _vm->_gameSys->setAnimation(0, 0, cannonNum + 9); + _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[cannonNum] - 18, _s52_arcadeScreenBottom - 44); + _vm->playSound(0x2C, false); result = 1; } return result; } -bool GnapEngine::scene52_shipCannonHitShield(int cannonNum) { +bool Scene52::shipCannonHitShield(int cannonNum) { bool result = false; if (_s52_shipCannonPosX < _s52_shieldPosX[0]) @@ -577,23 +575,23 @@ bool GnapEngine::scene52_shipCannonHitShield(int cannonNum) { } else { ++_s52_shieldSpriteIds[shieldNum]; if (_s52_shieldSpriteIds[shieldNum] <= 21) { - _gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); + _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); } else { - _gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _s52_shieldSpriteIds[shieldNum] = -1; } - _gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_shipCannonPosX - 18, _s52_arcadeScreenBottom - 44); - playSound(0x2C, false); + _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_shipCannonPosX - 18, _s52_arcadeScreenBottom - 44); + _vm->playSound(0x2C, false); result = true; } return result; } -bool GnapEngine::scene52_shipCannonHitAlien() { +bool Scene52::shipCannonHitAlien() { bool result = false; - if (_s52_aliensCount || scene52_checkAlienRow(0)) + if (_s52_aliensCount || checkAlienRow(0)) return false; int alienNextX = _s52_alienLeftX + _s52_alienRowXOfs[0]; @@ -632,18 +630,18 @@ bool GnapEngine::scene52_shipCannonHitAlien() { return result; } -void GnapEngine::scene52_shipExplode() { +void Scene52::shipExplode() { if (!_s52_aliensCount) { - _gameSys->setAnimation(0, 0, 7); - _gameSys->removeSequence(_s52_ufoSequenceId, 256, true); - playSound(44, false); - _gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _vm->_gameSys->setAnimation(0, 0, 7); + _vm->_gameSys->removeSequence(_s52_ufoSequenceId, 256, true); + _vm->playSound(44, false); + _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_aliensCount = 1; - playSound(0x31, false); + _vm->playSound(0x31, false); } } -bool GnapEngine::scene52_checkAlienRow(int rowNum) { +bool Scene52::checkAlienRow(int rowNum) { for (int i = 0; i < 5; ++i) { if (_s52_items[rowNum][i] >= 0) return false; @@ -652,14 +650,14 @@ bool GnapEngine::scene52_checkAlienRow(int rowNum) { bool found = false; for (int j = 0; j < 5; ++j) if (_s52_items[rowNum][j] == -2) { - _gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, true); + _vm->_gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, true); _s52_items[rowNum][j] = -1; --_s52_alienSpeed; found = true; } if (found) { - _gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); + _vm->_gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); --_s52_liveAlienRows; } @@ -669,8 +667,7 @@ bool GnapEngine::scene52_checkAlienRow(int rowNum) { return true; } -void GnapEngine::scene52_updateAlienRowXOfs() { - +void Scene52::updateAlienRowXOfs() { int amount = 2 * (3 - _s52_liveAlienRows) + 1; if (_s52_alienSpeed == 2) @@ -699,110 +696,109 @@ void GnapEngine::scene52_updateAlienRowXOfs() { } } -void GnapEngine::scene52_initAlienSize() { - _s52_alienWidth = _gameSys->getSpriteWidthById(0); - if (_gameSys->getSpriteWidthById(1) > _s52_alienWidth) - _s52_alienWidth = _gameSys->getSpriteWidthById(1); - if (_gameSys->getSpriteWidthById(4) > _s52_alienWidth) - _s52_alienWidth = _gameSys->getSpriteWidthById(4); - if (_gameSys->getSpriteWidthById(5) > _s52_alienWidth) - _s52_alienWidth = _gameSys->getSpriteWidthById(5); - if (_gameSys->getSpriteWidthById(12) > _s52_alienWidth) - _s52_alienWidth = _gameSys->getSpriteWidthById(12); - if (_gameSys->getSpriteWidthById(13) > _s52_alienWidth) - _s52_alienWidth = _gameSys->getSpriteWidthById(13); - - _s52_alienHeight = _gameSys->getSpriteHeightById(0); - if (_gameSys->getSpriteHeightById(1) > _s52_alienHeight) - _s52_alienHeight = _gameSys->getSpriteHeightById(1); - if (_gameSys->getSpriteHeightById(4) > _s52_alienHeight) - _s52_alienHeight = _gameSys->getSpriteHeightById(4); - if (_gameSys->getSpriteHeightById(5) > _s52_alienHeight) - _s52_alienHeight = _gameSys->getSpriteHeightById(5); - if (_gameSys->getSpriteHeightById(12) > _s52_alienHeight) - _s52_alienHeight = _gameSys->getSpriteHeightById(12); - if (_gameSys->getSpriteHeightById(13) > _s52_alienHeight) - _s52_alienHeight = _gameSys->getSpriteHeightById(13); +void Scene52::initAlienSize() { + _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(0); + if (_vm->_gameSys->getSpriteWidthById(1) > _s52_alienWidth) + _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(1); + if (_vm->_gameSys->getSpriteWidthById(4) > _s52_alienWidth) + _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(4); + if (_vm->_gameSys->getSpriteWidthById(5) > _s52_alienWidth) + _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(5); + if (_vm->_gameSys->getSpriteWidthById(12) > _s52_alienWidth) + _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(12); + if (_vm->_gameSys->getSpriteWidthById(13) > _s52_alienWidth) + _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(13); + + _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(0); + if (_vm->_gameSys->getSpriteHeightById(1) > _s52_alienHeight) + _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(1); + if (_vm->_gameSys->getSpriteHeightById(4) > _s52_alienHeight) + _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(4); + if (_vm->_gameSys->getSpriteHeightById(5) > _s52_alienHeight) + _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(5); + if (_vm->_gameSys->getSpriteHeightById(12) > _s52_alienHeight) + _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(12); + if (_vm->_gameSys->getSpriteHeightById(13) > _s52_alienHeight) + _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(13); _s52_alienTopY = _s52_shipCannonTopY + 52; _s52_alienLeftX = (800 - 5 * _s52_alienWidth) / 2; - } -void GnapEngine::scene52_playSound() { +void Scene52::playSound() { if (_s52_soundToggle) { - playSound(0x2F, false); + _vm->playSound(0x2F, false); _s52_soundToggle = false; } else { - playSound(0x2E, false); + _vm->playSound(0x2E, false); _s52_soundToggle = true; } } -void GnapEngine::scene52_updateAliens() { +void Scene52::updateAliens() { for (int i = 0; i < 7; ++i) - scene52_updateAlien(i); + updateAlien(i); } -void GnapEngine::scene52_updateAlien(int rowNum) { - if (_s52_alienRowKind[rowNum] >= 0 && !scene52_checkAlienRow(rowNum)) { +void Scene52::updateAlien(int rowNum) { + if (_s52_alienRowKind[rowNum] >= 0 && !checkAlienRow(rowNum)) { for (int i = 0; i < 5; ++i) { if (_s52_items[rowNum][i] >= 0) _s52_items[rowNum][i] = -2; } - scene52_checkAlienRow(rowNum); + checkAlienRow(rowNum); } } -void GnapEngine::scene52_loseShip() { +void Scene52::loseShip() { --_s52_shipsLeft; if (_s52_shipsLeft == 2) { - _gameSys->fillSurface(0, 120, 140, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); + _vm->_gameSys->fillSurface(0, 120, 140, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); } else if (_s52_shipsLeft == 1) { - _gameSys->fillSurface(0, 120, 185, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); + _vm->_gameSys->fillSurface(0, 120, 185, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); } } -void GnapEngine::scene52_initShields() { +void Scene52::initShields() { for (int i = 0; i < 3; ++i) { - _gameSys->drawSpriteToBackground(_s52_shieldPosX[i], _s52_arcadeScreenBottom - 44, 17); + _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[i], _s52_arcadeScreenBottom - 44, 17); _s52_shieldSpriteIds[i] = 17; } } -void GnapEngine::scene52_initAnims() { +void Scene52::initAnims() { for (int i = 0; i < 7; ++i) - _gameSys->setAnimation(0, 0, i); - _gameSys->setAnimation(0, 0, 7); + _vm->_gameSys->setAnimation(0, 0, i); + _vm->_gameSys->setAnimation(0, 0, 7); for (int j = 0; j < 1; ++j) - _gameSys->setAnimation(0, 0, j + 8); + _vm->_gameSys->setAnimation(0, 0, j + 8); for (int k = 0; k < 3; ++k) - _gameSys->setAnimation(0, 0, k + 9); + _vm->_gameSys->setAnimation(0, 0, k + 9); } -void GnapEngine::scene52_drawScore(int score) { +void Scene52::drawScore(int score) { char str[4]; sprintf(str, "%03d", score); - _gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); - _gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); + _vm->_gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); } -void GnapEngine::scene52_run() { - _timers[1] = 0; +void Scene52::run() { + _vm->_timers[1] = 0; - hideCursor(); + _vm->hideCursor(); // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000); // TODO setFontSize(24); _s52_gameScore = 0; - _gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); - _gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); + _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); + _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); - scene52_drawScore(0); + drawScore(0); _s52_shipMidX = 33; - _s52_shipMidY = _gameSys->getSpriteHeightById(15); + _s52_shipMidY = _vm->_gameSys->getSpriteHeightById(15); _s52_shipPosX = (800 - _s52_shipMidX) / 2; _s52_arcadeScreenBottom = 496; _s52_arcadeScreenRight = 595 - _s52_shipMidX; @@ -817,82 +813,82 @@ void GnapEngine::scene52_run() { for (int i = 0; i < 3; ++i) _s52_shieldSpriteIds[i] = -1; - _gameSys->drawSpriteToBackground(120, 140, 0xF); - _gameSys->drawSpriteToBackground(120, 185, 0xF); + _vm->_gameSys->drawSpriteToBackground(120, 140, 0xF); + _vm->_gameSys->drawSpriteToBackground(120, 185, 0xF); - scene52_initShipCannon(_s52_arcadeScreenBottom); - scene52_initAlienCannons(); - scene52_initAliens(); + initShipCannon(_s52_arcadeScreenBottom); + initAlienCannons(); + initAliens(); _s52_nextUfoSequenceId = 0x22; - _gameSys->setAnimation(0x22, 256, 7); - _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _vm->_gameSys->setAnimation(0x22, 256, 7); + _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_ufoSequenceId = _s52_nextUfoSequenceId; - clearKeyStatus1(Common::KEYCODE_RIGHT); - clearKeyStatus1(Common::KEYCODE_LEFT); - clearKeyStatus1(Common::KEYCODE_SPACE); - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _timers[2] = 5; + _vm->_timers[2] = 5; _s52_shipFlag = false; - _timers[0] = 10; + _vm->_timers[0] = 10; _s52_alienWave = true; - while (!_sceneDone) { - gameUpdateTick(); + while (!_vm->_sceneDone) { + _vm->gameUpdateTick(); - while (isKeyStatus2(Common::KEYCODE_RIGHT)) { - scene52_update(); - if (_gameSys->getAnimationStatus(7) == 2) { + while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT)) { + update(); + if (_vm->_gameSys->getAnimationStatus(7) == 2) { if (_s52_shipPosX < _s52_arcadeScreenRight) { _s52_shipPosX += 15; if (_s52_shipPosX > _s52_arcadeScreenRight) _s52_shipPosX = _s52_arcadeScreenRight; - _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_ufoSequenceId = _s52_nextUfoSequenceId; - if (_s52_bottomAlienFlag && scene52_shipCannonHitAlien()) - scene52_shipExplode(); + if (_s52_bottomAlienFlag && shipCannonHitAlien()) + shipExplode(); } break; } } - while (isKeyStatus2(Common::KEYCODE_LEFT)) { - scene52_update(); - if (_gameSys->getAnimationStatus(7) == 2) { + while (_vm->isKeyStatus2(Common::KEYCODE_LEFT)) { + update(); + if (_vm->_gameSys->getAnimationStatus(7) == 2) { if (_s52_shipPosX > _s52_arcadeScreenLeft) { _s52_shipPosX -= 15; if (_s52_shipPosX < _s52_arcadeScreenLeft) _s52_shipPosX = _s52_arcadeScreenLeft; - _gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); + _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); _s52_ufoSequenceId = _s52_nextUfoSequenceId; - if (_s52_bottomAlienFlag && scene52_shipCannonHitAlien()) - scene52_shipExplode(); + if (_s52_bottomAlienFlag && shipCannonHitAlien()) + shipExplode(); } break; } } - scene52_update(); + update(); - if (sceneXX_sub_4466B1()) { + if (_vm->sceneXX_sub_4466B1()) { _s52_alienWave = false; - _gameSys->waitForUpdate(); - scene52_initAnims(); - clearKeyStatus1(30); - _sceneDone = true; + _vm->_gameSys->waitForUpdate(); + initAnims(); + _vm->clearKeyStatus1(30); + _vm->_sceneDone = true; } } // TODO freeFont(); - _gameSys->waitForUpdate(); + _vm->_gameSys->waitForUpdate(); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene52.h b/engines/gnap/scenes/scene52.h new file mode 100644 index 0000000000..0fbc29cb71 --- /dev/null +++ b/engines/gnap/scenes/scene52.h @@ -0,0 +1,118 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE52_H +#define GNAP_SCENE52_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene52: public Scene { +public: + Scene52(GnapEngine *vm); + ~Scene52() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations() {}; + virtual void updateAnimationsCb() {}; + +private: + int _s52_liveAlienRows; + int _s52_gameScore; + bool _s52_soundToggle; + int _s52_arcadeScreenLeft; + int _s52_arcadeScreenRight; + int _s52_arcadeScreenBottom; + int _s52_shipsLeft; + int _s52_shieldSpriteIds[3]; + int _s52_shieldPosX[3]; + int _s52_shipPosX; + int _s52_shipCannonPosX, _s52_shipCannonPosY; + bool _s52_shipCannonFiring; + bool _s52_shipCannonFired; + int _s52_shipCannonWidth, _s52_shipCannonHeight; + int _s52_shipCannonTopY; + int _s52_shipMidX, _s52_shipMidY; + bool _s52_shipFlag; + bool _s52_aliensInitialized; + int _s52_alienSpeed, _s52_alienDirection; + int _s52_alienWidth, _s52_alienHeight; + int _s52_alienLeftX, _s52_alienTopY; + int _s52_alienRowDownCtr; + int _s52_alienRowKind[7]; + int _s52_alienRowAnims[7]; + int _s52_alienRowIds[7]; + int _s52_alienRowXOfs[7]; + int _s52_alienCannonFired[3]; + int _s52_alienCannonPosX[3]; + int _s52_alienCannonPosY[3]; + int _s52_alienCannonSequenceIds[3]; + int _s52_alienCannonIds[3]; + bool _s52_alienWave, _s52_alienSingle; + int _s52_alienCounter; + bool _s52_bottomAlienFlag; + int _s52_aliensCount; + int _s52_items[8][5]; + int _s52_nextUfoSequenceId, _s52_ufoSequenceId; + + void update(); + void initShipCannon(int bottomY); + void initAlienCannons(); + void fireShipCannon(int posX); + void fireAlienCannon(); + int getFreeShipCannon(); + int getFreeAlienCannon(); + void updateShipCannon(); + void updateAlienCannons(); + void initAliens(); + void initAlienRowKind(int rowNum, int alienKind); + void insertAlienRow(int rowNum); + void insertAlienRowAliens(int rowNum); + void updateAlienRow(int rowNum); + void moveDownAlienRow(); + int updateHitAlien(); + int getHitAlienNum(int rowNum); + int alienCannonHitShip(int cannonNum); + int alienCannonHitShield(int cannonNum); + bool shipCannonHitShield(int cannonNum); + bool shipCannonHitAlien(); + void shipExplode(); + bool checkAlienRow(int rowNum); + void updateAlienRowXOfs(); + void initAlienSize(); + void playSound(); + void updateAliens(); + void updateAlien(int rowNum); + void loseShip(); + void initShields(); + void initAnims(); + void drawScore(int score); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE52_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 438604670b..f9f4af91ab 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -72,6 +72,8 @@ #include "gnap/scenes/scene48.h" #include "gnap/scenes/scene49.h" #include "gnap/scenes/scene50.h" +#include "gnap/scenes/scene51.h" +#include "gnap/scenes/scene52.h" #include "gnap/scenes/scene54.h" namespace Gnap { @@ -419,12 +421,14 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 51: - backgroundId = scene51_init(); + _scene = new Scene51(this); + backgroundId = _scene->init(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; case 52: - backgroundId = scene52_init(); + _scene = new Scene52(this); + backgroundId = _scene->init(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -783,10 +787,12 @@ void GnapEngine::runSceneLogic() { _newSceneNum = _prevSceneNum; break; case 51: - scene51_run(); + _scene->run(); + delete _scene; break; case 52: - scene52_run(); + _scene->run(); + delete _scene; _newSceneNum = _prevSceneNum; break; case 53: -- cgit v1.2.3 From ba0c3f2cc316d932065437b6e749f1d5edc426e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 22:59:45 +0200 Subject: GNAP: Refactor scene 53 --- engines/gnap/gnap.cpp | 4 - engines/gnap/gnap.h | 13 -- engines/gnap/scenes/scene53.cpp | 314 +++++++++++++++++++------------------- engines/gnap/scenes/scene53.h | 57 +++++++ engines/gnap/scenes/scenecore.cpp | 9 +- 5 files changed, 221 insertions(+), 176 deletions(-) create mode 100644 engines/gnap/scenes/scene53.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index f6bff6025c..376c2790b7 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2021,10 +2021,6 @@ void GnapEngine::initGlobalSceneVars() { // Shared by scenes 17 && 18 _s18_garbageCanPos = 8; - // Scene 53 - _s53_callsMadeCtr = 0; - _s53_callsRndUsed = 0; - // Toy UFO _toyUfoId = 0; _toyUfoActionStatus = -1; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index a80d82f3fc..3da744aa0e 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -590,19 +590,6 @@ public: bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - // Scene 53 - int _s53_currHandSequenceId; - bool _s53_isGnapPhoning; - int _s53_callsMadeCtr; - uint _s53_callsRndUsed; - int scene53_init(); - void scene53_updateHotspots(); - int scene53_pressPhoneNumberButton(int phoneNumber, int buttonNum); - int scene53_getRandomCallIndex(); - void scene53_runRandomCall(); - void scene53_runChitChatLine(); - void scene53_run(); - // Scene 54 void scene54_initCutscene1(); void scene54_initCutscene2(); diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index f76f608273..7c461464be 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -23,6 +23,7 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" +#include "gnap/scenes/scene53.h" namespace Gnap { @@ -44,33 +45,40 @@ enum { kHSPhoneExit = 14 }; -int GnapEngine::scene53_init() { - _gameSys->setAnimation(0, 0, 0); - _gameSys->setAnimation(0, 0, 1); +Scene53::Scene53(GnapEngine *vm) : Scene(vm) { + _s53_isGnapPhoning = false; + _s53_currHandSequenceId = -1; + _s53_callsMadeCtr = 0; + _s53_callsRndUsed = 0; +} + +int Scene53::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); return 0x75; } -void GnapEngine::scene53_updateHotspots() { - setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - setHotspot(kHSPhoneKey1, 336, 238, 361, 270, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey2, 376, 243, 405, 274, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey3, 415, 248, 441, 276, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey4, 329, 276, 358, 303, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey5, 378, 282, 408, 311, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey6, 417, 286, 446, 319, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey7, 332, 311, 361, 342, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey8, 376, 318, 407, 349, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey9, 417, 320, 447, 353, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKey0, 377, 352, 405, 384, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKeySharp, 419, 358, 450, 394, SF_GRAB_CURSOR); - setHotspot(kHSPhoneKeyStar, 328, 346, 359, 379, SF_GRAB_CURSOR); - setHotspot(kHSPhoneExit, 150, 585, 650, 600, SF_EXIT_D_CURSOR); +void Scene53::updateHotspots() { + _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHSPhoneKey1, 336, 238, 361, 270, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey2, 376, 243, 405, 274, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey3, 415, 248, 441, 276, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey4, 329, 276, 358, 303, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey5, 378, 282, 408, 311, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey6, 417, 286, 446, 319, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey7, 332, 311, 361, 342, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey8, 376, 318, 407, 349, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey9, 417, 320, 447, 353, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKey0, 377, 352, 405, 384, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKeySharp, 419, 358, 450, 394, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneKeyStar, 328, 346, 359, 379, SF_GRAB_CURSOR); + _vm->setHotspot(kHSPhoneExit, 150, 585, 650, 600, SF_EXIT_D_CURSOR); - setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _hotspotsCount = 15; + _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 15; } -int GnapEngine::scene53_pressPhoneNumberButton(int phoneNumber, int buttonNum) { +int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { static const int kGnapHandSequenceIds[13] = { 0x00, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, @@ -84,22 +92,22 @@ int GnapEngine::scene53_pressPhoneNumberButton(int phoneNumber, int buttonNum) { }; if (_s53_isGnapPhoning) { - _gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); - _gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); + _vm->_gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s53_currHandSequenceId = kGnapHandSequenceIds[buttonNum]; } else { - _gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); - _gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); + _vm->_gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s53_currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; } - _gnapActionStatus = 6; - while (_gameSys->getAnimationStatus(6) != 2) { + _vm->_gnapActionStatus = 6; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { // checkGameAppStatus(); - updateMouseCursor(); - gameUpdateTick(); + _vm->updateMouseCursor(); + _vm->gameUpdateTick(); } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; if (buttonNum < 11) phoneNumber = buttonNum % 10 + 10 * phoneNumber; @@ -107,12 +115,12 @@ int GnapEngine::scene53_pressPhoneNumberButton(int phoneNumber, int buttonNum) { return phoneNumber; } -int GnapEngine::scene53_getRandomCallIndex() { +int Scene53::getRandomCallIndex() { int index, tries = 0; if (_s53_callsRndUsed == 0x7FFF) _s53_callsRndUsed = 0; do { - index = getRandom(16); + index = _vm->getRandom(16); if (++tries == 300) _s53_callsRndUsed = 0; } while (_s53_callsRndUsed & (1 << index)); @@ -120,7 +128,7 @@ int GnapEngine::scene53_getRandomCallIndex() { return index; } -void GnapEngine::scene53_runRandomCall() { +void Scene53::runRandomCall() { static const int kCallSequenceIds[15] = { 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, @@ -133,61 +141,59 @@ void GnapEngine::scene53_runRandomCall() { int index; do { - index = scene53_getRandomCallIndex(); + index = getRandomCallIndex(); } while (!_s53_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); - _gameSys->setAnimation(kCallSequenceIds[index], 1, 6); - _gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); + _vm->_gameSys->setAnimation(kCallSequenceIds[index], 1, 6); + _vm->_gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); } else { - _gameSys->setAnimation(0x74, 1, 6); - _gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); + _vm->_gameSys->setAnimation(0x74, 1, 6); + _vm->_gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); _s53_callsMadeCtr = 0; } - _gnapActionStatus = 1; - while (_gameSys->getAnimationStatus(6) != 2) { - updateMouseCursor(); + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } -void GnapEngine::scene53_runChitChatLine() { +void Scene53::runChitChatLine() { bool flag = false; int sequenceId = -1; - _gameSys->setAnimation(0x6E, 1, 6); - _gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); + _vm->_gameSys->setAnimation(0x6E, 1, 6); + _vm->_gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); - _gnapActionStatus = 1; - while (_gameSys->getAnimationStatus(6) != 2) { - updateMouseCursor(); + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; - if (isFlag(kGFSpringTaken)) { - _gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s53_currHandSequenceId = 0x45; } else { - _gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _s53_currHandSequenceId = 0x5E; } - _hotspots[kHSDevice]._flags = SF_DISABLED; + _vm->_hotspots[kHSDevice]._flags = SF_DISABLED; while (!flag) { - updateMouseCursor(); - updateCursorByHotspot(); + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - testWalk(0, 0, -1, -1, -1, -1); - - _sceneClickedHotspot = getClickedHotspotId(); - - updateGrabCursorSprite(0, 0); + _vm->testWalk(0, 0, -1, -1, -1, -1); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case 2: sequenceId = 0x6F; flag = 1; @@ -203,10 +209,10 @@ void GnapEngine::scene53_runChitChatLine() { case 14: sequenceId = -1; flag = 1; - _isLeavingScene = true; - _sceneDone = true; - _gnapActionStatus = 0; - _newSceneNum = 17; + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 17; break; case 5: case 6: @@ -217,59 +223,59 @@ void GnapEngine::scene53_runChitChatLine() { case 11: case 12: case 13: - scene53_pressPhoneNumberButton(0, _sceneClickedHotspot - 1); + pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); break; } if (flag && sequenceId != -1) { - stopSound(0xA0); - scene53_pressPhoneNumberButton(0, _sceneClickedHotspot - 1); - _gnapActionStatus = 1; - _gameSys->setAnimation(sequenceId, 1, 6); - _gameSys->insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); - _gnapActionStatus = 1; - while (_gameSys->getAnimationStatus(6) != 2) { - updateMouseCursor(); + _vm->stopSound(0xA0); + pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); + _vm->_gnapActionStatus = 1; + _vm->_gameSys->setAnimation(sequenceId, 1, 6); + _vm->_gameSys->insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - _gnapActionStatus = -1; - _gameSys->setAnimation(0x72, 1, 6); - _gameSys->insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); - _gnapActionStatus = 1; - while (_gameSys->getAnimationStatus(6) != 2) { - updateMouseCursor(); + _vm->_gnapActionStatus = -1; + _vm->_gameSys->setAnimation(0x72, 1, 6); + _vm->_gameSys->insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } } - scene53_updateHotspots(); + updateHotspots(); - _gnapActionStatus = 1; + _vm->_gnapActionStatus = 1; - if (isFlag(kGFSpringTaken)) { - _gameSys->setAnimation(0x73, 40, 6); - _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(6) != 2) { - updateMouseCursor(); + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->setAnimation(0x73, 40, 6); + _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } _s53_currHandSequenceId = 0x73; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } } -void GnapEngine::scene53_run() { +void Scene53::run() { int phoneNumber = 0; int phoneNumberLen = 0; - queueInsertDeviceIcon(); + _vm->queueInsertDeviceIcon(); - if (isFlag(kGFSpringTaken)) { + if (_vm->isFlag(kGFSpringTaken)) { _s53_currHandSequenceId = 0x45; _s53_isGnapPhoning = true; } else { @@ -277,28 +283,25 @@ void GnapEngine::scene53_run() { _s53_isGnapPhoning = false; } - _gameSys->insertSequence(_s53_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_s53_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->setVerbCursor(GRAB_CURSOR); + _vm->playSound(0xA0, true); - endSceneInit(); + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); - setVerbCursor(GRAB_CURSOR); + _vm->testWalk(0, 0, -1, -1, -1, -1); - playSound(0xA0, true); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); - while (!_sceneDone) { - updateMouseCursor(); - updateCursorByHotspot(); - - testWalk(0, 0, -1, -1, -1, -1); - - _sceneClickedHotspot = getClickedHotspotId(); - updateGrabCursorSprite(0, 0); - - switch (_sceneClickedHotspot) { + switch (_vm->_sceneClickedHotspot) { case 1: - if (_gnapActionStatus < 0) { - runMenu(); - scene53_updateHotspots(); + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); } break; case 2: @@ -311,82 +314,81 @@ void GnapEngine::scene53_run() { case 9: case 10: case 11: - stopSound(0xA0); + _vm->stopSound(0xA0); ++phoneNumberLen; - phoneNumber = scene53_pressPhoneNumberButton(phoneNumber, _sceneClickedHotspot - 1); + phoneNumber = pressPhoneNumberButton(phoneNumber, _vm->_sceneClickedHotspot - 1); debugC(kDebugBasic, "phoneNumber: %d", phoneNumber); if (phoneNumberLen == 7) { - _gnapActionStatus = 1; - if (isFlag(kGFSpringTaken)) { - _gameSys->setAnimation(0x73, 40, 6); - _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(6) != 2) { - updateMouseCursor(); + _vm->_gnapActionStatus = 1; + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->setAnimation(0x73, 40, 6); + _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } _s53_currHandSequenceId = 0x73; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } if (phoneNumber == 7284141) { - scene53_runChitChatLine(); + runChitChatLine(); phoneNumber = 0; phoneNumberLen = 0; - _sceneDone = true; - _newSceneNum = 17; - } else if (phoneNumber != 5556789 || isFlag(kGFPictureTaken)) { - scene53_runRandomCall(); + _vm->_sceneDone = true; + _vm->_newSceneNum = 17; + } else if (phoneNumber != 5556789 || _vm->isFlag(kGFPictureTaken)) { + runRandomCall(); phoneNumber = 0; phoneNumberLen = 0; - _sceneDone = true; - _newSceneNum = 17; + _vm->_sceneDone = true; + _vm->_newSceneNum = 17; } else { phoneNumber = 0; phoneNumberLen = 0; - _sceneDone = true; - _newSceneNum = 17; + _vm->_sceneDone = true; + _vm->_newSceneNum = 17; if (_s53_isGnapPhoning) - setFlag(kGFUnk25); + _vm->setFlag(kGFUnk25); else - setFlag(kGFPlatypusTalkingToAssistant); + _vm->setFlag(kGFPlatypusTalkingToAssistant); } } break; case 12: case 13: - scene53_pressPhoneNumberButton(0, _sceneClickedHotspot - 1); + pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); break; case 14: - if (_gnapActionStatus < 0) { - _gnapActionStatus = 1; - if (isFlag(kGFSpringTaken)) { - _gameSys->setAnimation(0x73, 40, 6); - _gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_gameSys->getAnimationStatus(6) != 2) { - updateMouseCursor(); + if (_vm->_gnapActionStatus < 0) { + _vm->_gnapActionStatus = 1; + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->setAnimation(0x73, 40, 6); + _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); // checkGameAppStatus(); - gameUpdateTick(); + _vm->gameUpdateTick(); } _s53_currHandSequenceId = 0x73; - _gnapActionStatus = -1; + _vm->_gnapActionStatus = -1; } - _isLeavingScene = true; - _sceneDone = true; - _gnapActionStatus = 0; - _newSceneNum = 17; + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 17; } break; } - checkGameKeys(); + _vm->checkGameKeys(); - if (isKeyStatus1(8)) { - clearKeyStatus1(8); - runMenu(); - scene53_updateHotspots(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); } - - gameUpdateTick(); + _vm->gameUpdateTick(); } } diff --git a/engines/gnap/scenes/scene53.h b/engines/gnap/scenes/scene53.h new file mode 100644 index 0000000000..724411784e --- /dev/null +++ b/engines/gnap/scenes/scene53.h @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_SCENE53_H +#define GNAP_SCENE53_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene53: public Scene { +public: + Scene53(GnapEngine *vm); + ~Scene53() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations() {}; + virtual void updateAnimationsCb() {}; + +private: + bool _s53_isGnapPhoning; + int _s53_currHandSequenceId; + int _s53_callsMadeCtr; + uint _s53_callsRndUsed; + + int pressPhoneNumberButton(int phoneNumber, int buttonNum); + int getRandomCallIndex(); + void runRandomCall(); + void runChitChatLine(); +}; + +} // End of namespace Gnap +#endif // GNAP_SCENE53_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index f9f4af91ab..c6bc9a1c1f 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -74,6 +74,7 @@ #include "gnap/scenes/scene50.h" #include "gnap/scenes/scene51.h" #include "gnap/scenes/scene52.h" +#include "gnap/scenes/scene53.h" #include "gnap/scenes/scene54.h" namespace Gnap { @@ -433,8 +434,9 @@ int GnapEngine::initSceneLogic() { initSceneGrid(21, 146, 11, 10); break; case 53: - backgroundId = scene53_init(); - scene53_updateHotspots(); + _scene = new Scene53(this); + backgroundId = _scene->init(); + _scene->updateHotspots(); _gameSys->setScaleValues(0, 500, 1, 1000); initSceneGrid(21, 146, 11, 10); break; @@ -796,7 +798,8 @@ void GnapEngine::runSceneLogic() { _newSceneNum = _prevSceneNum; break; case 53: - scene53_run(); + _scene->run(); + delete _scene; if (_newSceneNum == 55) _newSceneNum = 53; break; -- cgit v1.2.3 From 28d8a8be7cba9f1695650c4c5de93eee458ebe7d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 23:17:15 +0200 Subject: GNAP: Rename and move two fonctions to Scene --- engines/gnap/gnap.cpp | 39 --------------------------------------- engines/gnap/gnap.h | 7 ------- engines/gnap/scenes/scene07.cpp | 2 +- engines/gnap/scenes/scene08.cpp | 2 +- engines/gnap/scenes/scene09.cpp | 2 +- engines/gnap/scenes/scene49.cpp | 2 +- engines/gnap/scenes/scene51.cpp | 2 +- engines/gnap/scenes/scene52.cpp | 2 +- engines/gnap/scenes/scenecore.cpp | 39 +++++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/scenecore.h | 3 +++ 10 files changed, 48 insertions(+), 52 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 376c2790b7..371e7ef45f 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -2028,45 +2028,6 @@ void GnapEngine::initGlobalSceneVars() { _toyUfoY = 50; } -bool GnapEngine::sceneXX_sub_4466B1() { - if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { - clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(Common::KEYCODE_UP); - clearKeyStatus1(Common::KEYCODE_RIGHT); - clearKeyStatus1(Common::KEYCODE_LEFT); - clearKeyStatus1(Common::KEYCODE_p); - return true; - } - - if (isKeyStatus1(Common::KEYCODE_p)) { - clearKeyStatus1(Common::KEYCODE_p); - pauseGame(); - updatePause(); - } - - return false; -} - -void GnapEngine::sceneXX_playRandomSound(int timerIndex) { - if (!_timers[timerIndex]) { - _timers[timerIndex] = getRandom(40) + 50; - switch (getRandom(4)) { - case 0: - playSound(0x1091B, false); - break; - case 1: - playSound(0x10921, false); - break; - case 2: - playSound(0x10927, false); - break; - case 3: - playSound(0x1091D, false); - break; - } - } -} - void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3) { setGrabCursorSprite(-1); _gameSys->setAnimation(sequenceId2, _gnapId, 0); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 3da744aa0e..1169c3bf34 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -576,9 +576,6 @@ public: int _toyUfoY; void initGlobalSceneVars(); - - bool sceneXX_sub_4466B1(); - void sceneXX_playRandomSound(int timerIndex); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); // Shared by scenes 17 & 18 @@ -589,10 +586,6 @@ public: int toyUfoGetSequenceId(); bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); - - // Scene 54 - void scene54_initCutscene1(); - void scene54_initCutscene2(); }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index c94408297e..244e901947 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -235,7 +235,7 @@ void Scene07::run() { _vm->_timers[0] = 100; _vm->_timers[1] = 35; } - _vm->sceneXX_playRandomSound(4); + playRandomSound(4); } _vm->checkGameKeys(); diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index d13f763a19..a5054cb558 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -385,7 +385,7 @@ void Scene08::run() { } } } - _vm->sceneXX_playRandomSound(5); + playRandomSound(5); } _vm->checkGameKeys(); diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index ac0b1be342..5feee78597 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -187,7 +187,7 @@ void Scene09::run() { else _vm->_gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); } - _vm->sceneXX_playRandomSound(5); + playRandomSound(5); } _vm->checkGameKeys(); diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index 97a8724072..9f637b2b78 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -451,7 +451,7 @@ void Scene49::run() { updateAnimations(); - if (_vm->sceneXX_sub_4466B1()) { + if (clearKeyStatus()) { _vm->_sceneDone = true; _vm->_newSceneNum = 2; _vm->_newCursorValue = 1; diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index f4a3a843ba..dc93c6ba4d 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -724,7 +724,7 @@ void Scene51::run() { bool startWalk = true; while (!_vm->_sceneDone) { - if (_vm->sceneXX_sub_4466B1()) + if (clearKeyStatus()) _vm->_sceneDone = true; _vm->gameUpdateTick(); diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp index fb16184742..ba1b0ff79e 100644 --- a/engines/gnap/scenes/scene52.cpp +++ b/engines/gnap/scenes/scene52.cpp @@ -877,7 +877,7 @@ void Scene52::run() { update(); - if (_vm->sceneXX_sub_4466B1()) { + if (clearKeyStatus()) { _s52_alienWave = false; _vm->_gameSys->waitForUpdate(); initAnims(); diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c6bc9a1c1f..33ba9111e7 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -821,6 +821,45 @@ void GnapEngine::runSceneLogic() { } } +void Scene::playRandomSound(int timerIndex) { + if (!_vm->_timers[timerIndex]) { + _vm->_timers[timerIndex] = _vm->getRandom(40) + 50; + switch (_vm->getRandom(4)) { + case 0: + _vm->playSound(0x1091B, false); + break; + case 1: + _vm->playSound(0x10921, false); + break; + case 2: + _vm->playSound(0x10927, false); + break; + case 3: + _vm->playSound(0x1091D, false); + break; + } + } +} + +bool Scene::clearKeyStatus() { + if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE)) { + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_p); + return true; + } + + if (_vm->isKeyStatus1(Common::KEYCODE_p)) { + _vm->clearKeyStatus1(Common::KEYCODE_p); + _vm->pauseGame(); + _vm->updatePause(); + } + + return false; +} + void CutScene::run() { int itemIndex = 0; int soundId = -1; diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index 1f49fd8641..ba729f802d 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -34,6 +34,9 @@ public: Scene(GnapEngine *vm) : _vm(vm) {}; ~Scene() {}; + void playRandomSound(int timerIndex); + bool clearKeyStatus(); + virtual int init() = 0; virtual void updateHotspots() = 0; virtual void run() = 0; -- cgit v1.2.3 From 441565db4d1e4a7934dd2cb580d0df35766222cc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 24 Apr 2016 23:39:39 +0200 Subject: GNAP: Reduce code duplication in SceneCore --- engines/gnap/gnap.cpp | 2 - engines/gnap/scenes/scenecore.cpp | 188 ++------------------------------------ 2 files changed, 9 insertions(+), 181 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 371e7ef45f..389124bdcd 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -936,7 +936,6 @@ void GnapEngine::startSoundTimerB(int timerIndex) { } int GnapEngine::playSoundB() { - static const int kSoundIdsB[] = { 0x93D, 0x929, 0x92A, 0x92B, 0x92C, 0x92D, 0x92E, 0x92F, 0x930, 0x931, 0x932, 0x933, @@ -1791,7 +1790,6 @@ void GnapEngine::gnapUseDeviceOnPlatypuss() { kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); _gnapSequenceId = newSequenceId; _gnapSequenceDatNum = 1; - } void GnapEngine::doCallback(int callback) { diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 33ba9111e7..c549a7aac9 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -454,35 +454,10 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 8; break; case 1: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 4; - break; case 2: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 4; - break; case 3: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 4; - break; case 4: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 4; - break; case 5: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 4; - break; case 6: _scene->run(); delete _scene; @@ -508,41 +483,26 @@ void GnapEngine::runSceneLogic() { _newSceneNum = 10; break; case 10: + case 12: + case 13: _scene->run(); delete _scene; if (_newSceneNum == 55) _newSceneNum = 11; break; case 11: + case 15: _scene->run(); delete _scene; if (_newSceneNum == 55) _newSceneNum = 12; break; - case 12: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 11; - break; - case 13: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 11; - break; case 14: _scene->run(); delete _scene; if (_newSceneNum == 55) _newSceneNum = 13; break; - case 15: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 12; - break; case 16: _scene = new Scene16(this); _scene->init(); @@ -552,179 +512,49 @@ void GnapEngine::runSceneLogic() { delete _scene; break; case 17: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 18: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; - case 19: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 19; - break; - case 20: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 22; - break; case 21: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 22: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 23: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 24: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 25: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 26: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 27: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 28: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 29: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 30: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 20; - break; case 31: _scene->run(); delete _scene; if (_newSceneNum == 55) _newSceneNum = 20; break; - case 32: + case 19: _scene->run(); delete _scene; if (_newSceneNum == 55) - _newSceneNum = 37; + _newSceneNum = 19; break; - case 33: + case 20: _scene->run(); delete _scene; if (_newSceneNum == 55) - _newSceneNum = 37; + _newSceneNum = 22; break; + case 32: + case 33: case 34: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 35: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 36: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 37: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 38: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 39: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 40: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 41: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 42: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 43: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 44: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 45: - _scene->run(); - delete _scene; - if (_newSceneNum == 55) - _newSceneNum = 37; - break; case 46: _scene->run(); delete _scene; -- cgit v1.2.3 From 9503f9bdc84a758858037fb84504e9dfa2d3ab72 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 25 Apr 2016 07:10:04 +0200 Subject: GNAP: Add detection for the russian version --- engines/gnap/detection.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 69628f9cb1..cb4802c4cd 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -45,6 +45,14 @@ static const ADGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() }, + { + "gnap", "", + { + {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12995485}, + AD_LISTEND + }, + Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() + }, AD_TABLE_END_MARKER }; -- cgit v1.2.3 From 0a7f2fe938c4502ffa921d66c74e5380f8e2e2d5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 25 Apr 2016 07:10:34 +0200 Subject: GNAP: Remove debug code --- engines/gnap/gnap.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 389124bdcd..bcf2db1f56 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -708,30 +708,6 @@ void GnapEngine::initGameFlags(int num) { setFlag(kGFBarnPadlockOpen); break; } - - //DEBUG! -#if 0 -// setFlag(kGFPlatypus); // Enable platypus - setFlag(kGFUnk25); - invClear(); - invAdd(kItemMagazine); -#endif -#if 0 - invAdd(kItemDisguise); -#endif -#if 0 - //invAdd(kItemGas); - invAdd(kItemJoint); - //invAdd(kItemKeys); - invAdd(kItemWrench); - //invAdd(kItemTongs); - invAdd(kItemDiceQuarterHole); - //invAdd(kItemPill); - //invAdd(kItemBucketWithBeer); - invAdd(kItemChickenBucket); - invAdd(kItemBanana); - invAdd(kItemHorn); -#endif } void GnapEngine::loadStockDat() { -- cgit v1.2.3 From 700d82c1c22fe9b4c586b272f827b2ee9aa659ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 25 Apr 2016 22:57:07 +0200 Subject: GNAP: Fix crash in CutScenes --- engines/gnap/scenes/scenecore.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index ba729f802d..73723fd685 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -59,8 +59,6 @@ public: void updateAnimationsCb() {} protected: - GnapEngine *_vm; - int _s99_itemsCount; int _s99_resourceIdArr[16]; int _s99_sequenceCountArr[16]; -- cgit v1.2.3 From aa8df847f7ab087dc4097f683c583197d2e8b035 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 26 Apr 2016 00:23:23 +0200 Subject: GNAP: Reduce dereferencing in scene group 4, some renaming --- engines/gnap/scenes/scene16.cpp | 100 ++++----- engines/gnap/scenes/scene40.cpp | 12 +- engines/gnap/scenes/scene41.cpp | 194 +++++++++--------- engines/gnap/scenes/scene41.h | 8 +- engines/gnap/scenes/scene42.cpp | 112 ++++++----- engines/gnap/scenes/scene42.h | 4 +- engines/gnap/scenes/scene43.cpp | 108 +++++----- engines/gnap/scenes/scene43.h | 4 +- engines/gnap/scenes/scene44.cpp | 154 +++++++------- engines/gnap/scenes/scene44.h | 8 +- engines/gnap/scenes/scene45.cpp | 122 +++++------ engines/gnap/scenes/scene45.h | 2 +- engines/gnap/scenes/scene46.cpp | 91 +++++---- engines/gnap/scenes/scene46.h | 8 +- engines/gnap/scenes/scene47.cpp | 216 ++++++++++---------- engines/gnap/scenes/scene48.cpp | 106 +++++----- engines/gnap/scenes/scene49.cpp | 412 +++++++++++++++++++------------------- engines/gnap/scenes/scene49.h | 16 +- engines/gnap/scenes/scene54.cpp | 180 ++++++++--------- engines/gnap/scenes/scenecore.cpp | 26 +-- engines/gnap/scenes/scenecore.h | 10 +- 21 files changed, 970 insertions(+), 923 deletions(-) diff --git a/engines/gnap/scenes/scene16.cpp b/engines/gnap/scenes/scene16.cpp index bfe9afaf87..370faf40bb 100644 --- a/engines/gnap/scenes/scene16.cpp +++ b/engines/gnap/scenes/scene16.cpp @@ -30,56 +30,56 @@ namespace Gnap { Scene16::Scene16(GnapEngine *vm) : CutScene(vm) {} int Scene16::init() { - _s99_sequenceIdArr[0] = 0x1F2; - _s99_sequenceIdArr[1] = 0x201; - _s99_sequenceIdArr[2] = 0x1FC; - _s99_sequenceIdArr[3] = 0x1F4; - _s99_sequenceIdArr[4] = 0x1FB; - _s99_sequenceIdArr[5] = 0x1F0; - _s99_sequenceIdArr[6] = 0x1FD; - _s99_sequenceIdArr[7] = 0x1FE; - _s99_sequenceIdArr[8] = 0x1F7; - _s99_sequenceIdArr[9] = 0x1F9; - _s99_sequenceIdArr[10] = 0x1F8; - _s99_sequenceIdArr[11] = 0x1F1; - _s99_sequenceIdArr[12] = 0x202; - _s99_sequenceIdArr[13] = 0x1F6; - _s99_sequenceIdArr[14] = 0x1F3; - _s99_sequenceIdArr[15] = 0x1FA; - _s99_sequenceIdArr[16] = 0x1FF; - _s99_sequenceIdArr[17] = 0x200; - _s99_sequenceIdArr[18] = 0x203; - _s99_sequenceIdArr[19] = 0x206; - _s99_sequenceIdArr[20] = 0x207; - _s99_sequenceIdArr[21] = 0x204; - _s99_sequenceIdArr[22] = 0x205; - _s99_resourceIdArr[0] = 0x1C; - _s99_resourceIdArr[1] = 2; - _s99_resourceIdArr[2] = 0x1B; - _s99_resourceIdArr[3] = 0; - _s99_resourceIdArr[4] = 0x167; - _s99_resourceIdArr[5] = 1; - _s99_resourceIdArr[6] = 0x15B; - _s99_resourceIdArr[7] = 0x15A; - _s99_resourceIdArr[8] = 0x170; - _s99_resourceIdArr[9] = 0x1EB; - _s99_resourceIdArr[10] = 0x1EC; - _s99_resourceIdArr[11] = 0x1BE; - _s99_resourceIdArr[12] = 0x1BF; - _s99_sequenceCountArr[0] = 4; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 6; - _s99_sequenceCountArr[4] = 1; - _s99_sequenceCountArr[5] = 3; - _s99_sequenceCountArr[6] = 1; - _s99_sequenceCountArr[7] = 1; - _s99_sequenceCountArr[8] = 1; - _s99_sequenceCountArr[9] = 1; - _s99_sequenceCountArr[10] = 1; - _s99_sequenceCountArr[11] = 1; - _s99_sequenceCountArr[12] = 1; - _s99_itemsCount = 13; + _sequenceIdArr[0] = 0x1F2; + _sequenceIdArr[1] = 0x201; + _sequenceIdArr[2] = 0x1FC; + _sequenceIdArr[3] = 0x1F4; + _sequenceIdArr[4] = 0x1FB; + _sequenceIdArr[5] = 0x1F0; + _sequenceIdArr[6] = 0x1FD; + _sequenceIdArr[7] = 0x1FE; + _sequenceIdArr[8] = 0x1F7; + _sequenceIdArr[9] = 0x1F9; + _sequenceIdArr[10] = 0x1F8; + _sequenceIdArr[11] = 0x1F1; + _sequenceIdArr[12] = 0x202; + _sequenceIdArr[13] = 0x1F6; + _sequenceIdArr[14] = 0x1F3; + _sequenceIdArr[15] = 0x1FA; + _sequenceIdArr[16] = 0x1FF; + _sequenceIdArr[17] = 0x200; + _sequenceIdArr[18] = 0x203; + _sequenceIdArr[19] = 0x206; + _sequenceIdArr[20] = 0x207; + _sequenceIdArr[21] = 0x204; + _sequenceIdArr[22] = 0x205; + _resourceIdArr[0] = 0x1C; + _resourceIdArr[1] = 2; + _resourceIdArr[2] = 0x1B; + _resourceIdArr[3] = 0; + _resourceIdArr[4] = 0x167; + _resourceIdArr[5] = 1; + _resourceIdArr[6] = 0x15B; + _resourceIdArr[7] = 0x15A; + _resourceIdArr[8] = 0x170; + _resourceIdArr[9] = 0x1EB; + _resourceIdArr[10] = 0x1EC; + _resourceIdArr[11] = 0x1BE; + _resourceIdArr[12] = 0x1BF; + _sequenceCountArr[0] = 4; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 6; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 3; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _itemsCount = 13; return -1; } diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index c3adbf2f50..ade66363dc 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -43,8 +43,10 @@ Scene40::Scene40(GnapEngine *vm) : Scene(vm) { } int Scene40::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return _vm->isFlag(kGFUnk23) ? 0x01 : 0x00; } @@ -177,8 +179,10 @@ void Scene40::run() { } void Scene40::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus) _vm->_gnapActionStatus = -1; else diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 0cc83ff819..605dff0abe 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -60,16 +60,18 @@ enum { }; Scene41::Scene41(GnapEngine *vm) : Scene(vm) { - _s41_currKidSequenceId = -1; - _s41_nextKidSequenceId = -1; - _s41_currToyVendorSequenceId = -1; - _s41_nextToyVendorSequenceId = -1; + _currKidSequenceId = -1; + _nextKidSequenceId = -1; + _currToyVendorSequenceId = -1; + _nextToyVendorSequenceId = -1; } int Scene41::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x129; } @@ -96,6 +98,8 @@ void Scene41::updateHotspots() { } void Scene41::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFGnapControlsToyUFO)) { @@ -116,26 +120,26 @@ void Scene41::run() { _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_gameSys->insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) - _s41_currKidSequenceId = 0x11B; + _currKidSequenceId = 0x11B; else - _s41_currKidSequenceId = 0x11D; + _currKidSequenceId = 0x11D; - _s41_nextKidSequenceId = -1; + _nextKidSequenceId = -1; - _vm->_gameSys->setAnimation(_s41_currKidSequenceId, 1, 4); - _vm->_gameSys->insertSequence(_s41_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currKidSequenceId, 1, 4); + gameSys.insertSequence(_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _s41_currToyVendorSequenceId = 0x118; - _s41_nextToyVendorSequenceId = -1; + _currToyVendorSequenceId = 0x118; + _nextToyVendorSequenceId = -1; - _vm->_gameSys->setAnimation(0x118, 1, 3); - _vm->_gameSys->insertSequence(_s41_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x118, 1, 3); + gameSys.insertSequence(_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_gnapSequenceId = 0x120; @@ -144,8 +148,8 @@ void Scene41::run() { _vm->_gnapX = 7; _vm->_gnapY = 7; _vm->_gnapId = 140; - _vm->_gameSys->insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->initPlatypusPos(8, 10, kDirBottomLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 45) { @@ -329,7 +333,7 @@ void Scene41::run() { case kHSToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { _vm->playGnapPullOutDevice(9, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kASUseGumWithToyUfo; } break; @@ -345,10 +349,10 @@ void Scene41::run() { if (!_vm->_timers[9] && _vm->_gnapActionStatus < 0) { _vm->_gnapActionStatus = kASGiveBackToyUfo; if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x122) { - _vm->_gameSys->insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x123; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x123, _vm->_gnapId, 0); + gameSys.setAnimation(0x123, _vm->_gnapId, 0); } } } @@ -372,10 +376,10 @@ void Scene41::run() { else sequenceId = 0x121; } - _vm->_gameSys->insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = sequenceId; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(sequenceId, _vm->_gnapId, 0); + gameSys.setAnimation(sequenceId, _vm->_gnapId, 0); _vm->_toyUfoActionStatus = kASToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { @@ -392,31 +396,31 @@ void Scene41::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { switch (_vm->getRandom(3)) { case 0: - _s41_nextToyVendorSequenceId = 0x113; + _nextToyVendorSequenceId = 0x113; break; case 1: - _s41_nextToyVendorSequenceId = 0x117; + _nextToyVendorSequenceId = 0x117; break; case 2: - _s41_nextToyVendorSequenceId = 0x119; + _nextToyVendorSequenceId = 0x119; break; } - if (_s41_nextToyVendorSequenceId == _s41_currToyVendorSequenceId) - _s41_nextToyVendorSequenceId = -1; + if (_nextToyVendorSequenceId == _currToyVendorSequenceId) + _nextToyVendorSequenceId = -1; } } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { if (_vm->isFlag(kGFGnapControlsToyUFO)) - _s41_nextKidSequenceId = 0x11B; + _nextKidSequenceId = 0x11B; else if (_vm->getRandom(3) != 0) - _s41_nextKidSequenceId = 0x11D; + _nextKidSequenceId = 0x11D; else - _s41_nextKidSequenceId = 0x11E; + _nextKidSequenceId = 0x11E; } } } @@ -435,25 +439,27 @@ void Scene41::run() { } void Scene41::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kASUseQuarterWithToyVendor: - _vm->_gameSys->setAnimation(0, 0, 0); - _s41_nextToyVendorSequenceId = 0x114; + gameSys.setAnimation(0, 0, 0); + _nextToyVendorSequenceId = 0x114; _vm->_gnapActionStatus = -1; break; case kASTalkToyVendor: - _vm->_gameSys->setAnimation(0, 0, 0); - _s41_nextToyVendorSequenceId = 0x116; + gameSys.setAnimation(0, 0, 0); + _nextToyVendorSequenceId = 0x116; _vm->_gnapActionStatus = -1; break; case kASUseGumWithToyUfo: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->playGnapUseDevice(9, 0); _vm->_gnapActionStatus = -1; _vm->setGrabCursorSprite(-1); @@ -461,19 +467,19 @@ void Scene41::updateAnimations() { _vm->_toyUfoActionStatus = kASUfoGumAttached; break; case kASUseChickenBucketWithKid: - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x11F; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x11F, _vm->_gnapId, 0); - _s41_nextKidSequenceId = 0x11A; - _vm->_gameSys->insertSequence(0x11A, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = 0x11B; + gameSys.setAnimation(0x11F, _vm->_gnapId, 0); + _nextKidSequenceId = 0x11A; + gameSys.insertSequence(0x11A, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = 0x11B; _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_gnapActionStatus = -1; _vm->setFlag(kGFGnapControlsToyUFO); @@ -482,49 +488,49 @@ void Scene41::updateAnimations() { } break; case kASGrabKid: - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x110; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x110, _vm->_gnapId, 0); - _s41_nextToyVendorSequenceId = 0x111; - _vm->_gameSys->insertSequence(0x111, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); - _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; - _s41_nextToyVendorSequenceId = -1; + gameSys.setAnimation(0x110, _vm->_gnapId, 0); + _nextToyVendorSequenceId = 0x111; + gameSys.insertSequence(0x111, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; - _s41_nextKidSequenceId = 0x10F; - _vm->_gameSys->insertSequence(0x10F, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = -1; + _nextKidSequenceId = 0x10F; + gameSys.insertSequence(0x10F, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_gnapActionStatus = -1; } break; case kASGiveBackToyUfo: - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x124, _vm->_gnapId, + gameSys.insertSequence(0x124, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x124; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x124, _vm->_gnapId, 0); - _s41_nextToyVendorSequenceId = 0x112; - _vm->_gameSys->insertSequence(0x112, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); - _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; - _s41_nextToyVendorSequenceId = -1; + gameSys.setAnimation(0x124, _vm->_gnapId, 0); + _nextToyVendorSequenceId = 0x112; + gameSys.insertSequence(0x112, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; - _s41_nextKidSequenceId = 0x11C; - _vm->_gameSys->insertSequence(0x11C, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = -1; + _nextKidSequenceId = 0x11C; + gameSys.insertSequence(0x11C, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_gnapActionStatus = -1; _vm->clearFlag(kGFGnapControlsToyUFO); @@ -534,46 +540,46 @@ void Scene41::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { switch (_vm->_toyUfoActionStatus) { case kASToyUfoLeaveScene: _vm->_sceneDone = true; break; case kASUfoGumAttached: _vm->_toyUfoNextSequenceId = 0x873; - _vm->_gameSys->insertSequence(0x10873, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + gameSys.insertSequence(0x10873, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 365, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); _vm->toyUfoSetStatus(kGFJointTaken); break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); break; } _vm->_toyUfoActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s41_nextToyVendorSequenceId != -1) { - _vm->_gameSys->insertSequence(_s41_nextToyVendorSequenceId, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); - _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; - _s41_nextToyVendorSequenceId = -1; + if (gameSys.getAnimationStatus(3) == 2 && _nextToyVendorSequenceId != -1) { + gameSys.insertSequence(_nextToyVendorSequenceId, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s41_nextKidSequenceId != -1) { - _vm->_gameSys->insertSequence(_s41_nextKidSequenceId, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = -1; + if (gameSys.getAnimationStatus(4) == 2 && _nextKidSequenceId != -1) { + gameSys.insertSequence(_nextKidSequenceId, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_s41_currKidSequenceId == 0x11E) { + if (_currKidSequenceId == 0x11E) { _vm->_toyUfoActionStatus = kASToyUfoRefresh; _vm->toyUfoFlyTo(_vm->getRandom(300) + 500, _vm->getRandom(225) + 75, 0, 799, 0, 300, 2); } diff --git a/engines/gnap/scenes/scene41.h b/engines/gnap/scenes/scene41.h index 91e8a1a1a4..0b0cd4ec40 100644 --- a/engines/gnap/scenes/scene41.h +++ b/engines/gnap/scenes/scene41.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {}; private: - int _s41_currKidSequenceId; - int _s41_nextKidSequenceId; - int _s41_currToyVendorSequenceId; - int _s41_nextToyVendorSequenceId; + int _currKidSequenceId; + int _nextKidSequenceId; + int _currToyVendorSequenceId; + int _nextToyVendorSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 33f961d653..8bab50260b 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -58,14 +58,16 @@ enum { }; Scene42::Scene42(GnapEngine *vm) : Scene(vm) { - _s42_currBBQVendorSequenceId = -1; - _s42_nextBBQVendorSequenceId = -1; + _currBBQVendorSequenceId = -1; + _nextBBQVendorSequenceId = -1; } int Scene42::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); if (_vm->isFlag(kGFPictureTaken) || (_vm->isFlag(kGFUnk18) && _vm->isFlag(kGFUnk23))) return 0x153; return 0x152; @@ -96,13 +98,15 @@ void Scene42::updateHotspots() { } void Scene42::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _s42_currBBQVendorSequenceId = 0x14A; - _s42_nextBBQVendorSequenceId = -1; + _currBBQVendorSequenceId = 0x14A; + _nextBBQVendorSequenceId = -1; - _vm->_gameSys->setAnimation(0x14A, 1, 2); - _vm->_gameSys->insertSequence(_s42_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x14A, 1, 2); + gameSys.insertSequence(_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -110,7 +114,7 @@ void Scene42::run() { if (_vm->_prevSceneNum == 43 && _vm->isFlag(kGFUnk18)) { _vm->_toyUfoSequenceId = 0x872; _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, 0, 0); _vm->_toyUfoX = 317; _vm->_toyUfoY = 61; _vm->toyUfoSetStatus(kGFJointTaken); @@ -123,9 +127,9 @@ void Scene42::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); } - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); _vm->endSceneInit(); if (_vm->_toyUfoSequenceId == 0x872) _vm->setGrabCursorSprite(-1); @@ -329,27 +333,27 @@ void Scene42::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextBBQVendorSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: - _s42_nextBBQVendorSequenceId = 0x14C; + _nextBBQVendorSequenceId = 0x14C; break; case 1: case 2: - _s42_nextBBQVendorSequenceId = 0x149; + _nextBBQVendorSequenceId = 0x149; break; case 3: case 4: case 5: case 6: - _s42_nextBBQVendorSequenceId = 0x14D; + _nextBBQVendorSequenceId = 0x14D; break; case 7: - _s42_nextBBQVendorSequenceId = 0x14A; + _nextBBQVendorSequenceId = 0x14A; break; } - if (_s42_nextBBQVendorSequenceId == _s42_currBBQVendorSequenceId && _s42_nextBBQVendorSequenceId != 0x14D) - _s42_nextBBQVendorSequenceId = -1; + if (_nextBBQVendorSequenceId == _currBBQVendorSequenceId && _nextBBQVendorSequenceId != 0x14D) + _nextBBQVendorSequenceId = -1; } } } @@ -368,104 +372,106 @@ void Scene42::run() { } void Scene42::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; _vm->_sceneDone = true; break; case kASTalkBBQVendor: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; - _s42_nextBBQVendorSequenceId = 0x14B; + _nextBBQVendorSequenceId = 0x14B; break; case kASUseQuarterWithBBQVendor: case kASGrabChickenLeg: - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { int sequenceId; if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) { _vm->invRemove(kItemDiceQuarterHole); _vm->invAdd(kItemChickenBucket); _vm->setGrabCursorSprite(-1); sequenceId = 0x150; - _s42_nextBBQVendorSequenceId = 0x148; + _nextBBQVendorSequenceId = 0x148; } else if (_vm->isFlag(kGFUnk27)) { if (_vm->isFlag(kGFUnk28)) { sequenceId = 0x7B7; - _s42_nextBBQVendorSequenceId = 0x145; + _nextBBQVendorSequenceId = 0x145; } else { _vm->setFlag(kGFUnk28); sequenceId = 0x14F; - _s42_nextBBQVendorSequenceId = 0x147; + _nextBBQVendorSequenceId = 0x147; } } else { _vm->setFlag(kGFUnk27); sequenceId = 0x14E; - _s42_nextBBQVendorSequenceId = 0x146; + _nextBBQVendorSequenceId = 0x146; } if (sequenceId == 0x7B7) { - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, + gameSys.insertSequence(0x107B7, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, _vm->getSequenceTotalDuration(_s42_nextBBQVendorSequenceId), + kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceDatNum = 1; } else { - _vm->_gameSys->insertSequence(sequenceId, _vm->_gnapId, + gameSys.insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; } _vm->_gnapSequenceId = sequenceId; - _vm->_gameSys->setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); + gameSys.setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) _vm->_gnapActionStatus = kASUseQuarterWithBBQVendorDone; else _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); - _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; - if (_s42_nextBBQVendorSequenceId == 0x145) - _s42_nextBBQVendorSequenceId = 0x14A; + gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); + _currBBQVendorSequenceId = _nextBBQVendorSequenceId; + if (_nextBBQVendorSequenceId == 0x145) + _nextBBQVendorSequenceId = 0x14A; else - _s42_nextBBQVendorSequenceId = -1; + _nextBBQVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 30; _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; } break; case kASUseQuarterWithBBQVendorDone: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->setGrabCursorSprite(kItemChickenBucket); _vm->_gnapActionStatus = -1; break; default: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s42_nextBBQVendorSequenceId != -1) { - _vm->_gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); - _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; - _s42_nextBBQVendorSequenceId = -1; + if (gameSys.getAnimationStatus(2) == 2 && _nextBBQVendorSequenceId != -1) { + gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); + _currBBQVendorSequenceId = _nextBBQVendorSequenceId; + _nextBBQVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 30; } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case kASToyUfoLeaveScene: _vm->_sceneDone = true; break; case kASToyUfoPickUpHotSauce: - _vm->_gameSys->insertSequence(0x10870, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10870, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); _vm->setFlag(kGFUnk24); updateHotspots(); _vm->toyUfoSetStatus(kGFGroceryStoreHatTaken); _vm->_toyUfoSequenceId = 0x870; - _vm->_gameSys->setAnimation(0x10870, _vm->_toyUfoId, 3); + gameSys.setAnimation(0x10870, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = -1; _vm->_toyUfoX = 0x181; _vm->_toyUfoY = 53; @@ -474,16 +480,16 @@ void Scene42::updateAnimations() { if (_vm->_toyUfoSequenceId == 0x872) { _vm->hideCursor(); _vm->addFullScreenSprite(0x13E, 255); - _vm->_gameSys->setAnimation(0x151, 256, 0); - _vm->_gameSys->insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0x151, 256, 0); + gameSys.insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); } _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, 3); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, 3); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; diff --git a/engines/gnap/scenes/scene42.h b/engines/gnap/scenes/scene42.h index a3008a2829..8175e98110 100644 --- a/engines/gnap/scenes/scene42.h +++ b/engines/gnap/scenes/scene42.h @@ -42,8 +42,8 @@ public: virtual void updateAnimationsCb() {}; private: - int _s42_currBBQVendorSequenceId; - int _s42_nextBBQVendorSequenceId; + int _currBBQVendorSequenceId; + int _nextBBQVendorSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 9c7b56aabf..a3119bfb1e 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -49,14 +49,16 @@ enum { }; Scene43::Scene43(GnapEngine *vm) : Scene(vm) { - _s43_currTwoHeadedGuySequenceId = -1; - _s43_nextTwoHeadedGuySequenceId = -1; + _currTwoHeadedGuySequenceId = -1; + _nextTwoHeadedGuySequenceId = -1; } int Scene43::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x13F; } @@ -92,16 +94,18 @@ void Scene43::updateHotspots() { } void Scene43::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); if (!_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); - _s43_currTwoHeadedGuySequenceId = 0x13C; - _s43_nextTwoHeadedGuySequenceId = -1; + _currTwoHeadedGuySequenceId = 0x13C; + _nextTwoHeadedGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x13C, 1, 2); - _vm->_gameSys->insertSequence(_s43_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x13C, 1, 2); + gameSys.insertSequence(_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -112,8 +116,8 @@ void Scene43::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else { switch (_vm->_prevSceneNum) { @@ -329,26 +333,26 @@ void Scene43::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { switch (_vm->getRandom(5)) { case 0: - _s43_nextTwoHeadedGuySequenceId = 0x13C; + _nextTwoHeadedGuySequenceId = 0x13C; break; case 1: - _s43_nextTwoHeadedGuySequenceId = 0x134; + _nextTwoHeadedGuySequenceId = 0x134; break; case 2: - _s43_nextTwoHeadedGuySequenceId = 0x135; + _nextTwoHeadedGuySequenceId = 0x135; break; case 3: - _s43_nextTwoHeadedGuySequenceId = 0x136; + _nextTwoHeadedGuySequenceId = 0x136; break; case 4: - _s43_nextTwoHeadedGuySequenceId = 0x13A; + _nextTwoHeadedGuySequenceId = 0x13A; break; } - if (_s43_nextTwoHeadedGuySequenceId == _s43_currTwoHeadedGuySequenceId) - _s43_nextTwoHeadedGuySequenceId = -1; + if (_nextTwoHeadedGuySequenceId == _currTwoHeadedGuySequenceId) + _nextTwoHeadedGuySequenceId = -1; } } } @@ -370,89 +374,91 @@ void Scene43::run() { } void Scene43::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case 0: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; break; case 1: - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x13D; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x13D, _vm->_gnapId, 0); - _s43_nextTwoHeadedGuySequenceId = 0x13B; - _vm->_gameSys->insertSequence(0x13B, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); - _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; - _s43_nextTwoHeadedGuySequenceId = -1; + gameSys.setAnimation(0x13D, _vm->_gnapId, 0); + _nextTwoHeadedGuySequenceId = 0x13B; + gameSys.insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; _vm->_gnapActionStatus = -1; } break; default: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s43_currTwoHeadedGuySequenceId == 0x13A) { + if (gameSys.getAnimationStatus(2) == 2) { + if (_currTwoHeadedGuySequenceId == 0x13A) { if (_vm->isFlag(kGFGroceryStoreHatTaken)) { - _s43_nextTwoHeadedGuySequenceId = 0x13E; + _nextTwoHeadedGuySequenceId = 0x13E; _vm->stopSound(0x108F6); } else if (_vm->getRandom(2) != 0) { - _s43_nextTwoHeadedGuySequenceId = 0x137; + _nextTwoHeadedGuySequenceId = 0x137; } else { - _s43_nextTwoHeadedGuySequenceId = 0x138; + _nextTwoHeadedGuySequenceId = 0x138; } - } else if (_s43_currTwoHeadedGuySequenceId == 0x13E) { + } else if (_currTwoHeadedGuySequenceId == 0x13E) { _vm->_sceneDone = true; _vm->_newSceneNum = 54; } - if (_s43_nextTwoHeadedGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s43_nextTwoHeadedGuySequenceId, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); - _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; - _s43_nextTwoHeadedGuySequenceId = -1; + if (_nextTwoHeadedGuySequenceId != -1) { + gameSys.insertSequence(_nextTwoHeadedGuySequenceId, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case 4: _vm->_sceneDone = true; _vm->_toyUfoActionStatus = -1; break; case 6: - _vm->_gameSys->insertSequence(0x10871, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x1086F, 1, true); + gameSys.insertSequence(0x10871, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x1086F, 1, true); _vm->setFlag(kGFUnk14); updateHotspots(); _vm->toyUfoSetStatus(kGFUnk18); _vm->_toyUfoSequenceId = 0x871; - _vm->_gameSys->setAnimation(0x10871, _vm->_toyUfoId, 3); + gameSys.setAnimation(0x10871, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = -1; _vm->_toyUfoX = 96; _vm->_toyUfoY = 131; break; case 7: - _vm->_gameSys->insertSequence(0x10874, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10874, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); _vm->_toyUfoSequenceId = 0x874; - _vm->_gameSys->setAnimation(0x10874, _vm->_toyUfoId, 3); + gameSys.setAnimation(0x10874, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = 8; _vm->setFlag(kGFJointTaken); _vm->_gnapActionStatus = 3; break; case 8: - _s43_nextTwoHeadedGuySequenceId = 0x13A; + _nextTwoHeadedGuySequenceId = 0x13A; _vm->_toyUfoX = 514; _vm->_toyUfoY = 125; _vm->toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); @@ -463,12 +469,12 @@ void Scene43::updateAnimations() { break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = -1; break; } diff --git a/engines/gnap/scenes/scene43.h b/engines/gnap/scenes/scene43.h index 427d18bdae..fdf6d6e4c2 100644 --- a/engines/gnap/scenes/scene43.h +++ b/engines/gnap/scenes/scene43.h @@ -42,8 +42,8 @@ public: virtual void updateAnimationsCb() {}; private: - int _s43_currTwoHeadedGuySequenceId; - int _s43_nextTwoHeadedGuySequenceId; + int _currTwoHeadedGuySequenceId; + int _nextTwoHeadedGuySequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 6c3bd9098b..2e66df7991 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -47,17 +47,19 @@ enum { }; Scene44::Scene44(GnapEngine *vm) : Scene(vm) { - _s44_nextSpringGuySequenceId = -1; - _s44_nextKissingLadySequenceId = -1; - _s44_currSpringGuySequenceId = -1; - _s44_currKissingLadySequenceId = -1; + _nextSpringGuySequenceId = -1; + _nextKissingLadySequenceId = -1; + _currSpringGuySequenceId = -1; + _currKissingLadySequenceId = -1; } int Scene44::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->_gameSys->setAnimation(0, 0, 3); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); return 0xFF; } @@ -88,37 +90,39 @@ void Scene44::updateHotspots() { } void Scene44::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFSpringTaken)) - _s44_currSpringGuySequenceId = 0xF8; + _currSpringGuySequenceId = 0xF8; else - _s44_currSpringGuySequenceId = 0xF9; + _currSpringGuySequenceId = 0xF9; - _s44_nextSpringGuySequenceId = -1; - _vm->_gameSys->setAnimation(_s44_currSpringGuySequenceId, 1, 4); - _vm->_gameSys->insertSequence(_s44_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _nextSpringGuySequenceId = -1; + gameSys.setAnimation(_currSpringGuySequenceId, 1, 4); + gameSys.insertSequence(_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFUnk13)) { if (_vm->_prevSceneNum != 50 || _vm->_sceneSavegameLoaded) { - _s44_currKissingLadySequenceId = 0xF6; - _s44_nextKissingLadySequenceId = -1; + _currKissingLadySequenceId = 0xF6; + _nextKissingLadySequenceId = -1; } else { _vm->setGrabCursorSprite(kItemGum); - _s44_currKissingLadySequenceId = 0xF5; - _s44_nextKissingLadySequenceId = 0xF6; - _vm->_gameSys->setAnimation(0xF5, 1, 2); + _currKissingLadySequenceId = 0xF5; + _nextKissingLadySequenceId = 0xF6; + gameSys.setAnimation(0xF5, 1, 2); } } else { - _s44_currKissingLadySequenceId = 0xEC; - _s44_nextKissingLadySequenceId = -1; - _vm->_gameSys->setAnimation(0xEC, 1, 2); + _currKissingLadySequenceId = 0xEC; + _nextKissingLadySequenceId = -1; + gameSys.setAnimation(0xEC, 1, 2); } - _vm->_gameSys->insertSequence(_s44_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -129,8 +133,8 @@ void Scene44::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else { switch (_vm->_prevSceneNum) { @@ -161,7 +165,7 @@ void Scene44::run() { _vm->_platypusFacing = kDirNone; _vm->_platypusId = 160; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); } _vm->endSceneInit(); break; @@ -308,7 +312,7 @@ void Scene44::run() { case GRAB_CURSOR: _vm->playGnapPullOutDevice(8, 0); _vm->playGnapUseDevice(8, 0); - _s44_nextSpringGuySequenceId = 0xFB; + _nextSpringGuySequenceId = 0xFB; _vm->invAdd(kItemSpring); _vm->setFlag(kGFSpringTaken); updateHotspots(); @@ -369,48 +373,48 @@ void Scene44::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _s44_currKissingLadySequenceId != 0xF5) + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) _vm->updatePlatypusIdleSequence(); if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextKissingLadySequenceId == -1) { switch (_vm->getRandom(20)) { case 0: - _s44_nextKissingLadySequenceId = 0xED; + _nextKissingLadySequenceId = 0xED; break; case 1: - _s44_nextKissingLadySequenceId = 0xEE; + _nextKissingLadySequenceId = 0xEE; break; case 2: - _s44_nextKissingLadySequenceId = 0xF0; + _nextKissingLadySequenceId = 0xF0; break; case 3: - _s44_nextKissingLadySequenceId = 0xF3; + _nextKissingLadySequenceId = 0xF3; break; case 4: - _s44_nextKissingLadySequenceId = 0xF4; + _nextKissingLadySequenceId = 0xF4; break; default: - _s44_nextKissingLadySequenceId = 0xEC; + _nextKissingLadySequenceId = 0xEC; break; } - if (_s44_nextKissingLadySequenceId != 0xEC && _s44_nextKissingLadySequenceId == _s44_currKissingLadySequenceId) - _s44_nextKissingLadySequenceId = -1; + if (_nextKissingLadySequenceId != 0xEC && _nextKissingLadySequenceId == _currKissingLadySequenceId) + _nextKissingLadySequenceId = -1; } } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSpringGuySequenceId == -1) { if (_vm->getRandom(5) != 0) { if (!_vm->isFlag(kGFSpringTaken)) - _s44_nextSpringGuySequenceId = 0xF9; + _nextSpringGuySequenceId = 0xF9; } else { if (_vm->isFlag(kGFSpringTaken)) - _s44_nextSpringGuySequenceId = 0xF8; + _nextSpringGuySequenceId = 0xF8; else - _s44_nextSpringGuySequenceId = 0xFA; + _nextSpringGuySequenceId = 0xFA; } } } @@ -430,32 +434,34 @@ void Scene44::run() { } void Scene44::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case 0: _vm->_sceneDone = true; break; case 1: - _s44_nextKissingLadySequenceId = 0xEF; + _nextKissingLadySequenceId = 0xEF; break; case 2: - _s44_nextKissingLadySequenceId = 0xF2; + _nextKissingLadySequenceId = 0xF2; break; } _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case 4: - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xFE; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0xFE, _vm->_platypusId, 1); - _vm->_gameSys->removeSequence(_s44_currKissingLadySequenceId, 1, true); + gameSys.setAnimation(0xFE, _vm->_platypusId, 1); + gameSys.removeSequence(_currKissingLadySequenceId, 1, true); _vm->_platypusActionStatus = 5; } break; @@ -469,49 +475,49 @@ void Scene44::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s44_nextKissingLadySequenceId == 0xF6) { - _vm->_gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2) { + if (_nextKissingLadySequenceId == 0xF6) { + gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); _vm->initPlatypusPos(5, 8, kDirNone); - _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; - _s44_nextKissingLadySequenceId = -1; - _vm->_gameSys->setAnimation(0, 0, 2); - } else if (_s44_nextKissingLadySequenceId != -1) { - _vm->_gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s44_nextKissingLadySequenceId, 1, 2); - _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; - _s44_nextKissingLadySequenceId = -1; + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; + gameSys.setAnimation(0, 0, 2); + } else if (_nextKissingLadySequenceId != -1) { + gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKissingLadySequenceId, 1, 2); + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 20; } } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - if (_s44_currSpringGuySequenceId == 0xFB) { + if (gameSys.getAnimationStatus(4) == 2) { + if (_currSpringGuySequenceId == 0xFB) { _vm->setGrabCursorSprite(kItemSpring); - _s44_nextSpringGuySequenceId = 0xF8; + _nextSpringGuySequenceId = 0xF8; } - if (_s44_nextSpringGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s44_nextSpringGuySequenceId, 1, _s44_currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s44_nextSpringGuySequenceId, 1, 4); - _s44_currSpringGuySequenceId = _s44_nextSpringGuySequenceId; - _s44_nextSpringGuySequenceId = -1; + if (_nextSpringGuySequenceId != -1) { + gameSys.insertSequence(_nextSpringGuySequenceId, 1, _currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextSpringGuySequenceId, 1, 4); + _currSpringGuySequenceId = _nextSpringGuySequenceId; + _nextSpringGuySequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 20; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case 6: _vm->_sceneDone = true; break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); break; } _vm->_toyUfoActionStatus = -1; diff --git a/engines/gnap/scenes/scene44.h b/engines/gnap/scenes/scene44.h index f26cba0039..3ba5438487 100644 --- a/engines/gnap/scenes/scene44.h +++ b/engines/gnap/scenes/scene44.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {}; private: - int _s44_nextSpringGuySequenceId; - int _s44_nextKissingLadySequenceId; - int _s44_currSpringGuySequenceId; - int _s44_currKissingLadySequenceId; + int _nextSpringGuySequenceId; + int _nextKissingLadySequenceId; + int _currSpringGuySequenceId; + int _currKissingLadySequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 15722ab7e5..95aac39065 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -45,16 +45,18 @@ enum { }; Scene45::Scene45(GnapEngine *vm) : Scene(vm) { - _s45_currDancerSequenceId = -1; + _currDancerSequenceId = -1; } int Scene45::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->_gameSys->setAnimation(0, 0, 5); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 4); + gameSys.setAnimation(0, 0, 5); return _vm->isFlag(kGFUnk23) ? 0xA2 : 0xA1; } @@ -88,18 +90,20 @@ void Scene45::updateHotspots() { } void Scene45::run() { + GameSys gameSys = *_vm->_gameSys; + if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x96, 1, 3); - _vm->_gameSys->insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x99, 1, 4); - _s45_currDancerSequenceId = 0x8F; - _vm->_gameSys->setAnimation(_s45_currDancerSequenceId, 1, 2); - _vm->_gameSys->insertSequence(_s45_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); + _currDancerSequenceId = 0x8F; + gameSys.setAnimation(_currDancerSequenceId, 1, 2); + gameSys.insertSequence(_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -110,16 +114,16 @@ void Scene45::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 5); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 5); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->isFlag(kGFUnk22)) { _vm->_gnapSequenceId = 0x9E; _vm->_gnapSequenceDatNum = 0; _vm->_gnapId = 1; - _vm->_gameSys->setAnimation(0x9E, 1, 0); + gameSys.setAnimation(0x9E, 1, 0); _vm->_gnapActionStatus = 1; - _vm->_gameSys->insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->initPlatypusPos(4, 8, kDirNone); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { @@ -145,34 +149,34 @@ void Scene45::run() { if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->setFlag(kGFUnk21); _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x9D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + gameSys.setAnimation(0x9D, _vm->_gnapId, 0); + gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) { _vm->gameUpdateTick(); - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); int newSeqId = _vm->getRandom(7) + 0x8F; - _vm->_gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(newSeqId, 1, 2); - _s45_currDancerSequenceId = newSeqId; + gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { - _vm->_gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x96, 1, 3); - _vm->_gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x99, 1, 4); + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); } } _vm->_gnapSequenceId = 0x9D; _vm->_gnapSequenceDatNum = 0; _vm->hideCursor(); _vm->addFullScreenSprite(0x8A, 255); - _vm->_gameSys->setAnimation(0xA0, 256, 0); - _vm->_gameSys->insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0xA0, 256, 0); + gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x107BD, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x107BD, _vm->_gnapId, + gameSys.setAnimation(0x107BD, _vm->_gnapId, 0); + gameSys.insertSequence(0x107BD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->removeFullScreenSprite(); @@ -182,7 +186,7 @@ void Scene45::run() { } _vm->playPlatypusSequence(0x9A); - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094A)) @@ -240,7 +244,7 @@ void Scene45::run() { case GRAB_CURSOR: _vm->gnapKissPlatypus(0); _vm->playPlatypusSequence(0x9A); - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); @@ -352,8 +356,10 @@ void Scene45::run() { } void Scene45::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case 0: _vm->_sceneDone = true; @@ -362,10 +368,10 @@ void Scene45::updateAnimations() { _vm->_sceneWaiting = true; _vm->setFlag(kGFUnk22); updateHotspots(); - _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9E; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); + gameSys.setAnimation(0x9E, _vm->_gnapId, 0); break; default: _vm->_gnapActionStatus = -1; @@ -373,43 +379,43 @@ void Scene45::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->getRandom(2) != 0) _vm->playPlatypusSequence(0x9B); else _vm->playPlatypusSequence(0x9C); - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); int newSeqId = _vm->getRandom(7) + 0x8F; - _vm->_gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(newSeqId, 1, 2); - _s45_currDancerSequenceId = newSeqId; + gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { - _vm->_gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x96, 1, 3); - _vm->_gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x99, 1, 4); + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); } - if (_vm->_gameSys->getAnimationStatus(5) == 2) { + if (gameSys.getAnimationStatus(5) == 2) { switch (_vm->_toyUfoActionStatus) { case 2: _vm->_sceneDone = true; break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 5); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 5); break; } _vm->_toyUfoActionStatus = -1; diff --git a/engines/gnap/scenes/scene45.h b/engines/gnap/scenes/scene45.h index 549e0779cf..3aa7f9cb29 100644 --- a/engines/gnap/scenes/scene45.h +++ b/engines/gnap/scenes/scene45.h @@ -42,7 +42,7 @@ public: virtual void updateAnimationsCb() {}; private: - int _s45_currDancerSequenceId; + int _currDancerSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 74b60def33..5de3d4911d 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -45,18 +45,20 @@ enum { }; Scene46::Scene46(GnapEngine *vm) : Scene(vm) { - _s46_currSackGuySequenceId = -1; - _s46_nextItchyGuySequenceId = -1; - _s46_nextSackGuySequenceId = -1; - _s46_currItchyGuySequenceId = -1; + _currSackGuySequenceId = -1; + _nextItchyGuySequenceId = -1; + _nextSackGuySequenceId = -1; + _currItchyGuySequenceId = -1; } int Scene46::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->_gameSys->setAnimation(0, 0, 4); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 4); return 0x4E; } @@ -81,19 +83,20 @@ void Scene46::updateHotspots() { } void Scene46::run() { - _vm->queueInsertDeviceIcon(); + GameSys gameSys = *_vm->_gameSys; - _vm->_gameSys->insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); + _vm->queueInsertDeviceIcon(); + gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); - _s46_currSackGuySequenceId = 0x4B; - _s46_nextSackGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x4B, 1, 3); - _vm->_gameSys->insertSequence(_s46_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _currSackGuySequenceId = 0x4B; + _nextSackGuySequenceId = -1; + gameSys.setAnimation(0x4B, 1, 3); + gameSys.insertSequence(_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _s46_currItchyGuySequenceId = 0x47; - _s46_nextItchyGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x47, 1, 4); - _vm->_gameSys->insertSequence(_s46_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _currItchyGuySequenceId = 0x47; + _nextItchyGuySequenceId = -1; + gameSys.setAnimation(0x47, 1, 4); + gameSys.insertSequence(_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -104,8 +107,8 @@ void Scene46::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 44) { _vm->initGnapPos(-1, 8, kDirUpRight); @@ -290,17 +293,17 @@ void Scene46::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextItchyGuySequenceId == -1) { if (_vm->getRandom(2) != 0) - _s46_nextItchyGuySequenceId = 0x49; + _nextItchyGuySequenceId = 0x49; else - _s46_nextItchyGuySequenceId = 0x48; + _nextItchyGuySequenceId = 0x48; } } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s46_nextSackGuySequenceId == -1) - _s46_nextSackGuySequenceId = 0x4C; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSackGuySequenceId == -1) + _nextSackGuySequenceId = 0x4C; } } @@ -317,51 +320,53 @@ void Scene46::run() { } void Scene46::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case 0: _vm->_sceneDone = true; break; case 1: - _s46_nextItchyGuySequenceId = 0x46; + _nextItchyGuySequenceId = 0x46; break; case 2: - _s46_nextSackGuySequenceId = 0x4A; + _nextSackGuySequenceId = 0x4A; break; } _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s46_nextSackGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s46_nextSackGuySequenceId, 1, _s46_currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s46_nextSackGuySequenceId, 1, 3); - _s46_currSackGuySequenceId = _s46_nextSackGuySequenceId; - _s46_nextSackGuySequenceId = -1; + if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { + gameSys.insertSequence(_nextSackGuySequenceId, 1, _currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextSackGuySequenceId, 1, 3); + _currSackGuySequenceId = _nextSackGuySequenceId; + _nextSackGuySequenceId = -1; _vm->_timers[5] = _vm->getRandom(50) + 80; } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s46_nextItchyGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s46_nextItchyGuySequenceId, 1, _s46_currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s46_nextItchyGuySequenceId, 1, 4); - _s46_currItchyGuySequenceId = _s46_nextItchyGuySequenceId; - _s46_nextItchyGuySequenceId = -1; + if (gameSys.getAnimationStatus(4) == 2 && _nextItchyGuySequenceId != -1) { + gameSys.insertSequence(_nextItchyGuySequenceId, 1, _currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextItchyGuySequenceId, 1, 4); + _currItchyGuySequenceId = _nextItchyGuySequenceId; + _nextItchyGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(50) + 80; } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { switch (_vm->_toyUfoActionStatus) { case 3: _vm->_sceneDone = true; break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); break; } _vm->_toyUfoActionStatus = -1; diff --git a/engines/gnap/scenes/scene46.h b/engines/gnap/scenes/scene46.h index c7beca277d..9a578288ad 100644 --- a/engines/gnap/scenes/scene46.h +++ b/engines/gnap/scenes/scene46.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {}; private: - int _s46_currSackGuySequenceId; - int _s46_nextItchyGuySequenceId; - int _s46_nextSackGuySequenceId; - int _s46_currItchyGuySequenceId; + int _currSackGuySequenceId; + int _nextItchyGuySequenceId; + int _nextSackGuySequenceId; + int _currItchyGuySequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index ec0be02aeb..1c96139fdd 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -30,27 +30,27 @@ namespace Gnap { Scene471::Scene471(GnapEngine *vm) : CutScene(vm) {} int Scene471::init() { - _s99_sequenceIdArr[0] = 0x301; - _s99_sequenceIdArr[1] = 0x305; - _s99_sequenceIdArr[2] = 0x302; - _s99_sequenceIdArr[3] = 0x304; - _s99_sequenceIdArr[4] = 0x300; - _s99_resourceIdArr[0] = 3; - _s99_resourceIdArr[1] = 0; - _s99_resourceIdArr[2] = 1; - _s99_resourceIdArr[3] = 0; - _s99_resourceIdArr[4] = 2; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_itemsCount = 5; + _sequenceIdArr[0] = 0x301; + _sequenceIdArr[1] = 0x305; + _sequenceIdArr[2] = 0x302; + _sequenceIdArr[3] = 0x304; + _sequenceIdArr[4] = 0x300; + _resourceIdArr[0] = 3; + _resourceIdArr[1] = 0; + _resourceIdArr[2] = 1; + _resourceIdArr[3] = 0; + _resourceIdArr[4] = 2; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; return -1; } @@ -58,24 +58,24 @@ int Scene471::init() { Scene472::Scene472(GnapEngine *vm) : CutScene(vm) {} int Scene472::init() { - _s99_sequenceIdArr[0] = 0x306; - _s99_sequenceIdArr[1] = 0x309; - _s99_sequenceIdArr[2] = 0x307; - _s99_sequenceIdArr[3] = 0x308; - _s99_sequenceIdArr[4] = 0x30A; - _s99_resourceIdArr[0] = 0x8E; - _s99_resourceIdArr[1] = 0x90; - _s99_resourceIdArr[2] = 0x8F; - _s99_resourceIdArr[3] = 0x91; - _s99_sequenceCountArr[0] = 2; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_itemsCount = 4; + _sequenceIdArr[0] = 0x306; + _sequenceIdArr[1] = 0x309; + _sequenceIdArr[2] = 0x307; + _sequenceIdArr[3] = 0x308; + _sequenceIdArr[4] = 0x30A; + _resourceIdArr[0] = 0x8E; + _resourceIdArr[1] = 0x90; + _resourceIdArr[2] = 0x8F; + _resourceIdArr[3] = 0x91; + _sequenceCountArr[0] = 2; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _itemsCount = 4; return -1; } @@ -83,15 +83,15 @@ int Scene472::init() { Scene473::Scene473(GnapEngine *vm) : CutScene(vm) {} int Scene473::init() { - _s99_sequenceIdArr[0] = 0x320; - _s99_sequenceIdArr[1] = 0x321; - _s99_resourceIdArr[0] = 0x142; - _s99_resourceIdArr[1] = 0x143; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_itemsCount = 2; + _sequenceIdArr[0] = 0x320; + _sequenceIdArr[1] = 0x321; + _resourceIdArr[0] = 0x142; + _resourceIdArr[1] = 0x143; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _itemsCount = 2; return -1; } @@ -99,19 +99,19 @@ int Scene473::init() { Scene474::Scene474(GnapEngine *vm) : CutScene(vm) {} int Scene474::init() { - _s99_sequenceIdArr[0] = 0x30C; - _s99_sequenceIdArr[1] = 0x30D; - _s99_sequenceIdArr[2] = 0x30B; - _s99_resourceIdArr[0] = 0x142; - _s99_resourceIdArr[1] = 0x141; - _s99_resourceIdArr[2] = 0x177; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_itemsCount = 3; + _sequenceIdArr[0] = 0x30C; + _sequenceIdArr[1] = 0x30D; + _sequenceIdArr[2] = 0x30B; + _resourceIdArr[0] = 0x142; + _resourceIdArr[1] = 0x141; + _resourceIdArr[2] = 0x177; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _itemsCount = 3; return -1; } @@ -119,17 +119,17 @@ int Scene474::init() { Scene475::Scene475(GnapEngine *vm) : CutScene(vm) {} int Scene475::init() { - _s99_sequenceIdArr[0] = 0x30E; - _s99_sequenceIdArr[1] = 0x30F; - _s99_sequenceIdArr[2] = 0x310; - _s99_sequenceIdArr[3] = 0x311; - _s99_resourceIdArr[0] = 0x206; - _s99_resourceIdArr[1] = 0x207; - _s99_sequenceCountArr[0] = 3; - _s99_sequenceCountArr[1] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_itemsCount = 2; + _sequenceIdArr[0] = 0x30E; + _sequenceIdArr[1] = 0x30F; + _sequenceIdArr[2] = 0x310; + _sequenceIdArr[3] = 0x311; + _resourceIdArr[0] = 0x206; + _resourceIdArr[1] = 0x207; + _sequenceCountArr[0] = 3; + _sequenceCountArr[1] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _itemsCount = 2; return -1; } @@ -137,12 +137,12 @@ int Scene475::init() { Scene476::Scene476(GnapEngine *vm) : CutScene(vm) {} int Scene476::init() { - _s99_sequenceIdArr[0] = 0x31E; - _s99_sequenceIdArr[1] = 0x31F; - _s99_resourceIdArr[0] = 0x2FA; - _s99_sequenceCountArr[0] = 2; - _s99_canSkip[0] = false; - _s99_itemsCount = 1; + _sequenceIdArr[0] = 0x31E; + _sequenceIdArr[1] = 0x31F; + _resourceIdArr[0] = 0x2FA; + _sequenceCountArr[0] = 2; + _canSkip[0] = false; + _itemsCount = 1; return -1; } @@ -152,47 +152,47 @@ Scene477::Scene477(GnapEngine *vm) : CutScene(vm) {} int Scene477::init() { int v0, v4, v2, v3; - _s99_sequenceIdArr[0] = 0x316; - _s99_sequenceIdArr[1] = 0x31A; - _s99_sequenceIdArr[2] = 0x314; - _s99_sequenceIdArr[3] = 0x31B; + _sequenceIdArr[0] = 0x316; + _sequenceIdArr[1] = 0x31A; + _sequenceIdArr[2] = 0x314; + _sequenceIdArr[3] = 0x31B; int v1 = 4; if (!_vm->isFlag(kGFTwigTaken)) { - _s99_sequenceIdArr[4] = 0x31C; + _sequenceIdArr[4] = 0x31C; v1 = 5; } if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _s99_sequenceIdArr[v1++] = 0x31D; + _sequenceIdArr[v1++] = 0x31D; v4 = v1; - _s99_sequenceIdArr[v1] = 0x319; + _sequenceIdArr[v1] = 0x319; v0 = v1 + 1; v3 = v0; - _s99_sequenceIdArr[v0++] = 0x317; - _s99_sequenceIdArr[v0++] = 0x312; - _s99_sequenceIdArr[v0] = 0x31A; + _sequenceIdArr[v0++] = 0x317; + _sequenceIdArr[v0++] = 0x312; + _sequenceIdArr[v0] = 0x31A; v2 = v0 + 1; if (!_vm->isFlag(kGFTwigTaken)) - _s99_sequenceIdArr[v2++] = 0x31C; + _sequenceIdArr[v2++] = 0x31C; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _s99_sequenceIdArr[v2++] = 0x31D; - _s99_sequenceIdArr[v2] = 0x313; - _s99_sequenceIdArr[v2 + 1] = 0x315; - _s99_resourceIdArr[0] = 0x2B8; - _s99_resourceIdArr[1] = 0x20C; - _s99_resourceIdArr[2] = 0x2B8; - _s99_resourceIdArr[3] = 0x20B; - _s99_resourceIdArr[4] = 0x20B; - _s99_sequenceCountArr[0] = v4; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = v2 - v3; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_itemsCount = 5; + _sequenceIdArr[v2++] = 0x31D; + _sequenceIdArr[v2] = 0x313; + _sequenceIdArr[v2 + 1] = 0x315; + _resourceIdArr[0] = 0x2B8; + _resourceIdArr[1] = 0x20C; + _resourceIdArr[2] = 0x2B8; + _resourceIdArr[3] = 0x20B; + _resourceIdArr[4] = 0x20B; + _sequenceCountArr[0] = v4; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = v2 - v3; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; return -1; } diff --git a/engines/gnap/scenes/scene48.cpp b/engines/gnap/scenes/scene48.cpp index 46d624ea3f..27f8d829d8 100644 --- a/engines/gnap/scenes/scene48.cpp +++ b/engines/gnap/scenes/scene48.cpp @@ -30,59 +30,59 @@ namespace Gnap { Scene48::Scene48(GnapEngine *vm) : CutScene(vm) {} int Scene48::init() { - _s99_sequenceIdArr[0] = 390; - _s99_sequenceIdArr[1] = 391; - _s99_sequenceIdArr[2] = 392; - _s99_sequenceIdArr[3] = 393; - _s99_sequenceIdArr[4] = 394; - _s99_sequenceIdArr[5] = 395; - _s99_sequenceIdArr[6] = 396; - _s99_sequenceIdArr[7] = 397; - _s99_sequenceIdArr[8] = 398; - _s99_sequenceIdArr[9] = 399; - _s99_sequenceIdArr[10] = 400; - _s99_sequenceIdArr[11] = 401; - _s99_sequenceIdArr[12] = 402; - _s99_resourceIdArr[0] = 238; - _s99_resourceIdArr[1] = 42; - _s99_resourceIdArr[2] = 2; - _s99_resourceIdArr[3] = 37; - _s99_resourceIdArr[4] = 35; - _s99_resourceIdArr[5] = 38; - _s99_resourceIdArr[6] = 39; - _s99_resourceIdArr[7] = 40; - _s99_resourceIdArr[8] = 41; - _s99_resourceIdArr[9] = 36; - _s99_resourceIdArr[10] = 41; - _s99_resourceIdArr[11] = 388; - _s99_resourceIdArr[12] = 387; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_sequenceCountArr[5] = 1; - _s99_sequenceCountArr[6] = 1; - _s99_sequenceCountArr[7] = 1; - _s99_sequenceCountArr[8] = 1; - _s99_sequenceCountArr[9] = 1; - _s99_sequenceCountArr[10] = 1; - _s99_sequenceCountArr[11] = 1; - _s99_sequenceCountArr[12] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_canSkip[5] = false; - _s99_canSkip[6] = false; - _s99_canSkip[7] = false; - _s99_canSkip[8] = false; - _s99_canSkip[9] = false; - _s99_canSkip[10] = false; - _s99_canSkip[11] = false; - _s99_canSkip[12] = false; - _s99_itemsCount = 13; + _sequenceIdArr[0] = 390; + _sequenceIdArr[1] = 391; + _sequenceIdArr[2] = 392; + _sequenceIdArr[3] = 393; + _sequenceIdArr[4] = 394; + _sequenceIdArr[5] = 395; + _sequenceIdArr[6] = 396; + _sequenceIdArr[7] = 397; + _sequenceIdArr[8] = 398; + _sequenceIdArr[9] = 399; + _sequenceIdArr[10] = 400; + _sequenceIdArr[11] = 401; + _sequenceIdArr[12] = 402; + _resourceIdArr[0] = 238; + _resourceIdArr[1] = 42; + _resourceIdArr[2] = 2; + _resourceIdArr[3] = 37; + _resourceIdArr[4] = 35; + _resourceIdArr[5] = 38; + _resourceIdArr[6] = 39; + _resourceIdArr[7] = 40; + _resourceIdArr[8] = 41; + _resourceIdArr[9] = 36; + _resourceIdArr[10] = 41; + _resourceIdArr[11] = 388; + _resourceIdArr[12] = 387; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 1; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _canSkip[5] = false; + _canSkip[6] = false; + _canSkip[7] = false; + _canSkip[8] = false; + _canSkip[9] = false; + _canSkip[10] = false; + _canSkip[11] = false; + _canSkip[12] = false; + _itemsCount = 13; return -1; } diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index 9f637b2b78..3753d987eb 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -41,31 +41,33 @@ static const ObstacleDef kObstacleDefs[] = { }; Scene49::Scene49(GnapEngine *vm) : Scene(vm) { - _s49_scoreBarFlash = false; - _s49_scoreBarPos = -1; - _s49_scoreLevel = -1; - _s49_obstacleIndex = -1; - _s49_truckSequenceId = -1; - _s49_truckId = -1; - _s49_truckLaneNum = -1; + _scoreBarFlash = false; + _scoreBarPos = -1; + _scoreLevel = -1; + _obstacleIndex = -1; + _truckSequenceId = -1; + _truckId = -1; + _truckLaneNum = -1; for (int i = 0; i < 5; i++) { - _s49_obstacles[i]._currSequenceId = -1; - _s49_obstacles[i]._closerSequenceId = -1; - _s49_obstacles[i]._passedSequenceId = -1; - _s49_obstacles[i]._splashSequenceId = -1; - _s49_obstacles[i]._collisionSequenceId = -1; - _s49_obstacles[i]._prevId = -1; - _s49_obstacles[i]._currId = -1; - _s49_obstacles[i]._laneNum = -1; + _obstacles[i]._currSequenceId = -1; + _obstacles[i]._closerSequenceId = -1; + _obstacles[i]._passedSequenceId = -1; + _obstacles[i]._splashSequenceId = -1; + _obstacles[i]._collisionSequenceId = -1; + _obstacles[i]._prevId = -1; + _obstacles[i]._currId = -1; + _obstacles[i]._laneNum = -1; } } int Scene49::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); for (int i = 0; i < 5; ++i) - _vm->_gameSys->setAnimation(0, 0, i + 2); + gameSys.setAnimation(0, 0, i + 2); _vm->_timers[2] = 0; _vm->_timers[0] = 0; _vm->_timers[1] = 0; @@ -87,68 +89,68 @@ void Scene49::checkObstacles() { } for (int j = 0; j < 5; ++j) { - if (_s49_obstacles[j]._currSequenceId == 0) { + if (_obstacles[j]._currSequenceId == 0) { _vm->_timers[3] = 35; - _s49_obstacles[j]._currSequenceId = kObstacleDefs[_s49_obstacleIndex]._sequenceId; - switch (_s49_obstacles[j]._currSequenceId) { + _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId; + switch (_obstacles[j]._currSequenceId) { case 0xB4: - _s49_obstacles[j]._laneNum = 1; - _s49_obstacles[j]._closerSequenceId = 180; - _s49_obstacles[j]._passedSequenceId = 181; - _s49_obstacles[j]._splashSequenceId = 182; - _s49_obstacles[j]._collisionSequenceId = 192; + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 180; + _obstacles[j]._passedSequenceId = 181; + _obstacles[j]._splashSequenceId = 182; + _obstacles[j]._collisionSequenceId = 192; break; case 0xB7: - _s49_obstacles[j]._laneNum = 2; - _s49_obstacles[j]._closerSequenceId = 183; - _s49_obstacles[j]._passedSequenceId = 184; - _s49_obstacles[j]._splashSequenceId = 185; - _s49_obstacles[j]._collisionSequenceId = 193; + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 183; + _obstacles[j]._passedSequenceId = 184; + _obstacles[j]._splashSequenceId = 185; + _obstacles[j]._collisionSequenceId = 193; break; case 0xBD: - _s49_obstacles[j]._laneNum = 3; - _s49_obstacles[j]._closerSequenceId = 189; - _s49_obstacles[j]._passedSequenceId = 190; - _s49_obstacles[j]._splashSequenceId = 191; - _s49_obstacles[j]._collisionSequenceId = 195; + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 189; + _obstacles[j]._passedSequenceId = 190; + _obstacles[j]._splashSequenceId = 191; + _obstacles[j]._collisionSequenceId = 195; break; case 0xBA: - _s49_obstacles[j]._laneNum = 2; - _s49_obstacles[j]._closerSequenceId = 186; - _s49_obstacles[j]._passedSequenceId = 187; - _s49_obstacles[j]._splashSequenceId = 188; - _s49_obstacles[j]._collisionSequenceId = 194; + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 186; + _obstacles[j]._passedSequenceId = 187; + _obstacles[j]._splashSequenceId = 188; + _obstacles[j]._collisionSequenceId = 194; break; case 0xCB: - _s49_obstacles[j]._laneNum = 1; - _s49_obstacles[j]._closerSequenceId = 203; - _s49_obstacles[j]._passedSequenceId = 204; - _s49_obstacles[j]._splashSequenceId = 0; - _s49_obstacles[j]._collisionSequenceId = 209; + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 203; + _obstacles[j]._passedSequenceId = 204; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 209; break; case 0xCD: - _s49_obstacles[j]._laneNum = 2; - _s49_obstacles[j]._closerSequenceId = 205; - _s49_obstacles[j]._passedSequenceId = 206; - _s49_obstacles[j]._splashSequenceId = 0; - _s49_obstacles[j]._collisionSequenceId = 210; + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 205; + _obstacles[j]._passedSequenceId = 206; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 210; break; case 0xCF: - _s49_obstacles[j]._laneNum = 3; - _s49_obstacles[j]._closerSequenceId = 207; - _s49_obstacles[j]._passedSequenceId = 208; - _s49_obstacles[j]._splashSequenceId = 0; - _s49_obstacles[j]._collisionSequenceId = 211; + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 207; + _obstacles[j]._passedSequenceId = 208; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 211; break; } - _s49_obstacles[j]._prevId = _s49_truckId; - _s49_obstacles[j]._currId = _s49_obstacles[j]._prevId; - _vm->_gameSys->setAnimation(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, j + 2); - _vm->_gameSys->insertSequence(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); - _vm->_timers[2] = kObstacleDefs[_s49_obstacleIndex]._ticks; - ++_s49_obstacleIndex; - if (_s49_obstacleIndex == 50) - _s49_obstacleIndex = 0; + _obstacles[j]._prevId = _truckId; + _obstacles[j]._currId = _obstacles[j]._prevId; + _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2); + _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); + _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks; + ++_obstacleIndex; + if (_obstacleIndex == 50) + _obstacleIndex = 0; break; } } @@ -158,72 +160,74 @@ void Scene49::checkObstacles() { } void Scene49::updateObstacle(int id) { - Scene49Obstacle &obstacle = _s49_obstacles[id]; + GameSys gameSys = *_vm->_gameSys; + Scene49Obstacle &obstacle = _obstacles[id]; + obstacle._currId = obstacle._prevId; switch (obstacle._laneNum) { case 1: - obstacle._prevId = _s49_truckId + 1; + obstacle._prevId = _truckId + 1; break; case 2: - if (_s49_truckLaneNum != 2 && _s49_truckLaneNum != 3) - obstacle._prevId = _s49_truckId - 1; + if (_truckLaneNum != 2 && _truckLaneNum != 3) + obstacle._prevId = _truckId - 1; else - obstacle._prevId = _s49_truckId + 1; + obstacle._prevId = _truckId + 1; break; case 3: - if (_s49_truckLaneNum != 1 && _s49_truckLaneNum != 2) - obstacle._prevId = _s49_truckId; + if (_truckLaneNum != 1 && _truckLaneNum != 2) + obstacle._prevId = _truckId; else - obstacle._prevId = _s49_truckId - 1; + obstacle._prevId = _truckId - 1; break; } if (obstacle._currSequenceId == obstacle._closerSequenceId) { - if (_s49_truckLaneNum == obstacle._laneNum) { + if (_truckLaneNum == obstacle._laneNum) { if (obstacle._splashSequenceId) { - _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; _vm->playSound(224, false); increaseScore(30); - } else if ((obstacle._laneNum == 1 && _s49_truckSequenceId == 0xB0) || - (obstacle._laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || - (obstacle._laneNum == 3 && _s49_truckSequenceId == 0xB3)) { - _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) || + (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) || + (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) { + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._passedSequenceId; } else { - _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, 256, 0); - _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0); + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, 256, - _s49_truckSequenceId, _s49_truckId, + gameSys.insertSequence(obstacle._collisionSequenceId, 256, + _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); - _s49_truckSequenceId = obstacle._collisionSequenceId; - _s49_truckId = 256; + _truckSequenceId = obstacle._collisionSequenceId; + _truckId = 256; obstacle._currSequenceId = obstacle._passedSequenceId; _vm->playSound(225, false); decreaseScore(30); } } else { - _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._passedSequenceId; } } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { - if (_s49_truckLaneNum == obstacle._laneNum) { + if (_truckLaneNum == obstacle._laneNum) { if (obstacle._splashSequenceId) { - _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; @@ -231,56 +235,58 @@ void Scene49::updateObstacle(int id) { increaseScore(30); } } else if (obstacle._splashSequenceId) { - _vm->_gameSys->setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._splashSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._splashSequenceId; } } else { - _vm->_gameSys->setAnimation(0, 0, id + 2); + gameSys.setAnimation(0, 0, id + 2); clearObstacle(id); } } void Scene49::increaseScore(int amount) { - if (_s49_scoreBarPos + amount <= 556) { - _s49_scoreBarPos += amount; - _vm->_gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 255, 0, 0); + if (_scoreBarPos + amount <= 556) { + _scoreBarPos += amount; + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); } - _s49_scoreLevel = _s49_scoreBarPos + amount >= 556; + _scoreLevel = _scoreBarPos + amount >= 556; } void Scene49::decreaseScore(int amount) { - if (_s49_scoreBarPos >= 226 && _s49_scoreLevel == 0) { - if (_s49_scoreBarFlash) + if (_scoreBarPos >= 226 && _scoreLevel == 0) { + if (_scoreBarFlash) refreshScoreBar(); - _vm->_gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 89, 0, 5); - _s49_scoreBarPos -= amount; - _s49_scoreLevel = 0; + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); + _scoreBarPos -= amount; + _scoreLevel = 0; } } void Scene49::refreshScoreBar() { - if (_s49_scoreBarFlash) + if (_scoreBarFlash) _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); else _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); - _s49_scoreBarFlash = !_s49_scoreBarFlash; + _scoreBarFlash = !_scoreBarFlash; } void Scene49::clearObstacle(int index) { - _s49_obstacles[index]._currSequenceId = 0; - _s49_obstacles[index]._closerSequenceId = 0; - _s49_obstacles[index]._passedSequenceId = 0; - _s49_obstacles[index]._splashSequenceId = 0; - _s49_obstacles[index]._collisionSequenceId = 0; - _s49_obstacles[index]._prevId = 0; - _s49_obstacles[index]._currId = 0; - _s49_obstacles[index]._laneNum = 0; + _obstacles[index]._currSequenceId = 0; + _obstacles[index]._closerSequenceId = 0; + _obstacles[index]._passedSequenceId = 0; + _obstacles[index]._splashSequenceId = 0; + _obstacles[index]._collisionSequenceId = 0; + _obstacles[index]._prevId = 0; + _obstacles[index]._currId = 0; + _obstacles[index]._laneNum = 0; } void Scene49::run() { + GameSys gameSys = *_vm->_gameSys; + bool animToggle6 = false; bool animToggle5 = false; bool animToggle4 = false; @@ -294,64 +300,64 @@ void Scene49::run() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); - _s49_scoreBarPos = 196; - _s49_scoreLevel = 0; - _s49_scoreBarFlash = false; + _scoreBarPos = 196; + _scoreLevel = 0; + _scoreBarFlash = false; switch (_vm->getRandom(3)) { case 0: - _s49_truckSequenceId = 0xAD; - _s49_truckLaneNum = 1; + _truckSequenceId = 0xAD; + _truckLaneNum = 1; break; case 1: - _s49_truckSequenceId = 0xAE; - _s49_truckLaneNum = 2; + _truckSequenceId = 0xAE; + _truckLaneNum = 2; break; case 2: - _s49_truckSequenceId = 0xAF; - _s49_truckLaneNum = 3; + _truckSequenceId = 0xAF; + _truckLaneNum = 3; break; } - int bgWidth1 = _vm->_gameSys->getSpriteWidthById(0x5E); + int bgWidth1 = gameSys.getSpriteWidthById(0x5E); int bgX1 = 600; - int bgWidth2 = _vm->_gameSys->getSpriteWidthById(0x5F); + int bgWidth2 = gameSys.getSpriteWidthById(0x5F); int bgX2 = 400; - int bgWidth3 = _vm->_gameSys->getSpriteWidthById(4); + int bgWidth3 = gameSys.getSpriteWidthById(4); int bgX3 = 700; - int bgWidth4 = _vm->_gameSys->getSpriteWidthById(5); + int bgWidth4 = gameSys.getSpriteWidthById(5); int bgX4 = 500; - int bgWidth5 = _vm->_gameSys->getSpriteWidthById(6); + int bgWidth5 = gameSys.getSpriteWidthById(6); int bgX5 = 300; - int bgWidth6 = _vm->_gameSys->getSpriteWidthById(7); + int bgWidth6 = gameSys.getSpriteWidthById(7); int bgX6 = 100; - _vm->_gameSys->setAnimation(0xC8, 251, 1); - _vm->_gameSys->setAnimation(_s49_truckSequenceId, 256, 0); - _vm->_gameSys->insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); - _vm->_gameSys->insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); - _vm->_gameSys->insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); - _vm->_gameSys->insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); - _vm->_gameSys->insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); - _vm->_gameSys->insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); - _vm->_gameSys->insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); - _vm->_gameSys->insertSequence(_s49_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); + gameSys.setAnimation(0xC8, 251, 1); + gameSys.setAnimation(_truckSequenceId, 256, 0); + gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); + gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); + gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); + gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); + gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); + gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); + gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); + gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); _vm->_timers[0] = 2; for (int i = 0; i < 5; ++i) clearObstacle(i); - _s49_obstacleIndex = 0; + _obstacleIndex = 0; _vm->_timers[2] = _vm->getRandom(20) + 10; - _s49_truckId = 256; + _truckId = 256; _vm->_timers[3] = 35; while (!_vm->_sceneDone) { @@ -376,72 +382,72 @@ void Scene49::run() { if (bgX6 <= -bgWidth6) bgX6 = 799; bgAnimToggle = !bgAnimToggle; - _vm->_gameSys->insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); - _vm->_gameSys->insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); - _vm->_gameSys->insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); - _vm->_gameSys->insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); - _vm->_gameSys->insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); - _vm->_gameSys->insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); + gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); + gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); + gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); + gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); + gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); + gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); _vm->_timers[0] = 2; } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (gameSys.getAnimationStatus(1) == 2) { streetAnimToggle = !streetAnimToggle; - _vm->_gameSys->setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); - _vm->_gameSys->insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); + gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); + gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); } checkObstacles(); - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - switch (_s49_truckSequenceId) { + if (gameSys.getAnimationStatus(0) == 2) { + switch (_truckSequenceId) { case 0xB1: - _s49_truckLaneNum = 1; + _truckLaneNum = 1; break; case 0xB0: case 0xB3: - _s49_truckLaneNum = 2; + _truckLaneNum = 2; break; case 0xB2: - _s49_truckLaneNum = 3; + _truckLaneNum = 3; break; } animToggle3 = !animToggle3; - if (_s49_truckLaneNum == 1) { - _vm->_gameSys->setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); - _vm->_gameSys->insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); - _s49_truckSequenceId = 0xAD; - } else if (_s49_truckLaneNum == 2) { - _vm->_gameSys->setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); - _vm->_gameSys->insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); - _s49_truckSequenceId = 0xAE; + if (_truckLaneNum == 1) { + gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAD; + } else if (_truckLaneNum == 2) { + gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAE; } else { - _vm->_gameSys->setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); - _vm->_gameSys->insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); - _s49_truckSequenceId = 0xAF; + gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAF; } - _s49_truckId = (animToggle3 ? 1 : 0) + 256; - if (_s49_scoreLevel == 1) { - if (!_vm->_gameSys->isSequenceActive(0xD4, 266)) { - _vm->_gameSys->setAnimation(0xD4, 266, 8); - _vm->_gameSys->insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); + _truckId = (animToggle3 ? 1 : 0) + 256; + if (_scoreLevel == 1) { + if (!gameSys.isSequenceActive(0xD4, 266)) { + gameSys.setAnimation(0xD4, 266, 8); + gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); } - ++_s49_scoreLevel; + ++_scoreLevel; _vm->_timers[1] = 2; animToggle4 = false; animToggle5 = false; animToggle6 = false; - _s49_scoreBarFlash = false; + _scoreBarFlash = false; } } - if (_s49_scoreLevel != 0 && !_vm->_timers[1]) { + if (_scoreLevel != 0 && !_vm->_timers[1]) { refreshScoreBar(); _vm->_timers[1] = 8; if (animToggle6) { if (animToggle5) { - if (animToggle4 && !_vm->_gameSys->isSequenceActive(212, 266)) - _vm->_gameSys->insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); + if (animToggle4 && !gameSys.isSequenceActive(212, 266)) + gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); animToggle4 = !animToggle4; } animToggle5 = !animToggle5; @@ -459,22 +465,22 @@ void Scene49::run() { if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { // Steer right - if (_s49_truckSequenceId == 0xB3) - _s49_truckLaneNum = 2; - if (_s49_truckSequenceId == 0xB1) - _s49_truckLaneNum = 1; - if (_s49_truckLaneNum != 3 && _s49_truckLaneNum != 2) { - if (_s49_scoreLevel) { + if (_truckSequenceId == 0xB3) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB1) + _truckLaneNum = 1; + if (_truckLaneNum != 3 && _truckLaneNum != 2) { + if (_scoreLevel) { _vm->_sceneDone = true; _vm->_newSceneNum = 47; } } else { - int steerSequenceId = (_s49_truckLaneNum == 3) ? 0xB3 : 0xB1; - if (_s49_truckSequenceId == 0xAE || _s49_truckSequenceId == 0xAF) { - _vm->_gameSys->setAnimation(steerSequenceId, 256, 0); - _vm->_gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); - _s49_truckSequenceId = steerSequenceId; - _s49_truckId = 256; + int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1; + if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; } } _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); @@ -482,17 +488,17 @@ void Scene49::run() { if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { // Steer left - if (_s49_truckSequenceId == 0xB0) - _s49_truckLaneNum = 2; - if (_s49_truckSequenceId == 0xB2) - _s49_truckLaneNum = 3; - if (_s49_truckLaneNum == 1 || _s49_truckLaneNum == 2) { - int steerSequenceId = (_s49_truckLaneNum == 1) ? 0xB0 : 0xB2; - if (_s49_truckSequenceId == 0xAD || _s49_truckSequenceId == 0xAE) { - _vm->_gameSys->setAnimation(steerSequenceId, 256, 0); - _vm->_gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); - _s49_truckSequenceId = steerSequenceId; - _s49_truckId = 256; + if (_truckSequenceId == 0xB0) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB2) + _truckLaneNum = 3; + if (_truckLaneNum == 1 || _truckLaneNum == 2) { + int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2; + if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; } } _vm->clearKeyStatus1(Common::KEYCODE_LEFT); @@ -503,14 +509,16 @@ void Scene49::run() { } void Scene49::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + for (int i = 0; i < 5; ++i) { - if (_vm->_gameSys->getAnimationStatus(i + 2) == 2) { - if (_s49_obstacles[i]._currSequenceId) + if (gameSys.getAnimationStatus(i + 2) == 2) { + if (_obstacles[i]._currSequenceId) updateObstacle(i); } } - if (_vm->_gameSys->getAnimationStatus(8) == 2) { + if (gameSys.getAnimationStatus(8) == 2) { _vm->_sceneDone = true; _vm->_newSceneNum = 47; } diff --git a/engines/gnap/scenes/scene49.h b/engines/gnap/scenes/scene49.h index f44b2ed25b..d69d9771c9 100644 --- a/engines/gnap/scenes/scene49.h +++ b/engines/gnap/scenes/scene49.h @@ -58,14 +58,14 @@ public: virtual void updateAnimationsCb() {}; private: - int _s49_scoreBarPos; - int _s49_scoreLevel; - bool _s49_scoreBarFlash; - int _s49_obstacleIndex; - Scene49Obstacle _s49_obstacles[5]; - int _s49_truckSequenceId; - int _s49_truckId; - int _s49_truckLaneNum; + int _scoreBarPos; + int _scoreLevel; + bool _scoreBarFlash; + int _obstacleIndex; + Scene49Obstacle _obstacles[5]; + int _truckSequenceId; + int _truckId; + int _truckLaneNum; void checkObstacles(); void updateObstacle(int id); diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp index 935a1668ee..222c6e81e4 100644 --- a/engines/gnap/scenes/scene54.cpp +++ b/engines/gnap/scenes/scene54.cpp @@ -30,31 +30,31 @@ namespace Gnap { Scene541::Scene541(GnapEngine *vm) : CutScene(vm) {} int Scene541::init() { - _s99_sequenceIdArr[0] = 0x1BE; - _s99_sequenceIdArr[1] = 0x1BF; - _s99_sequenceIdArr[2] = 0x1BA; - _s99_sequenceIdArr[3] = 0x1BB; - _s99_sequenceIdArr[4] = 0x1BD; - _s99_sequenceIdArr[5] = 0x1BC; - _s99_resourceIdArr[0] = 0x3C; - _s99_resourceIdArr[1] = 0x43; - _s99_resourceIdArr[2] = 0x44; + _sequenceIdArr[0] = 0x1BE; + _sequenceIdArr[1] = 0x1BF; + _sequenceIdArr[2] = 0x1BA; + _sequenceIdArr[3] = 0x1BB; + _sequenceIdArr[4] = 0x1BD; + _sequenceIdArr[5] = 0x1BC; + _resourceIdArr[0] = 0x3C; + _resourceIdArr[1] = 0x43; + _resourceIdArr[2] = 0x44; if (_vm->isFlag(kGFPictureTaken)) - _s99_resourceIdArr[3] = 0x47; + _resourceIdArr[3] = 0x47; else - _s99_resourceIdArr[3] = 0x46; - _s99_resourceIdArr[4] = 0x45; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 2; - _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_itemsCount = 5; + _resourceIdArr[3] = 0x46; + _resourceIdArr[4] = 0x45; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 2; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; return -1; } @@ -62,73 +62,73 @@ int Scene541::init() { Scene542::Scene542(GnapEngine *vm) : CutScene(vm) {} int Scene542::init() { - _s99_sequenceIdArr[0] = 0x1C9; - _s99_sequenceIdArr[1] = 0x1C7; - _s99_sequenceIdArr[2] = 0x1CC; - _s99_sequenceIdArr[3] = 0x1C8; - _s99_sequenceIdArr[4] = 0x1CB; - _s99_sequenceIdArr[5] = 0x1C0; - _s99_sequenceIdArr[6] = 0x1CA; - _s99_sequenceIdArr[7] = 0x1CE; - _s99_sequenceIdArr[8] = 0x1CD; - _s99_sequenceIdArr[9] = 0x1C1; - _s99_sequenceIdArr[10] = 0x1C2; - _s99_sequenceIdArr[11] = 0x1C3; - _s99_sequenceIdArr[12] = 0x1C4; - _s99_sequenceIdArr[13] = 0x1C6; - _s99_sequenceIdArr[14] = 0x1C5; - _s99_sequenceIdArr[15] = 0x1D0; - _s99_sequenceIdArr[16] = 0x1D0; - _s99_sequenceIdArr[17] = 0x1D0; - _s99_resourceIdArr[0] = 0xD5; - _s99_resourceIdArr[1] = 0x14C; - _s99_resourceIdArr[2] = 0xD5; - _s99_resourceIdArr[3] = 0xBF; - _s99_resourceIdArr[4] = 0xD6; - _s99_resourceIdArr[5] = 0x154; - _s99_resourceIdArr[6] = 0x155; - _s99_resourceIdArr[7] = 0xB9; - _s99_resourceIdArr[8] = 0xBA; - _s99_resourceIdArr[9] = 0x17B; - _s99_resourceIdArr[10] = 0x17A; - _s99_resourceIdArr[11] = 0x17C; - _s99_resourceIdArr[12] = 0x17A; - _s99_resourceIdArr[13] = 0x1B7; - _s99_resourceIdArr[14] = 0x1B8; - _s99_resourceIdArr[15] = 0x1B9; - _s99_sequenceCountArr[0] = 2; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 2; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_sequenceCountArr[5] = 1; - _s99_sequenceCountArr[6] = 1; - _s99_sequenceCountArr[7] = 1; - _s99_sequenceCountArr[8] = 1; - _s99_sequenceCountArr[9] = 1; - _s99_sequenceCountArr[10] = 1; - _s99_sequenceCountArr[11] = 1; - _s99_sequenceCountArr[12] = 1; - _s99_sequenceCountArr[13] = 1; - _s99_sequenceCountArr[14] = 1; - _s99_sequenceCountArr[15] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_canSkip[5] = false; - _s99_canSkip[6] = false; - _s99_canSkip[7] = false; - _s99_canSkip[8] = false; - _s99_canSkip[9] = false; - _s99_canSkip[10] = false; - _s99_canSkip[11] = false; - _s99_canSkip[12] = false; - _s99_canSkip[13] = true; - _s99_canSkip[14] = true; - _s99_canSkip[15] = false; - _s99_itemsCount = 16; + _sequenceIdArr[0] = 0x1C9; + _sequenceIdArr[1] = 0x1C7; + _sequenceIdArr[2] = 0x1CC; + _sequenceIdArr[3] = 0x1C8; + _sequenceIdArr[4] = 0x1CB; + _sequenceIdArr[5] = 0x1C0; + _sequenceIdArr[6] = 0x1CA; + _sequenceIdArr[7] = 0x1CE; + _sequenceIdArr[8] = 0x1CD; + _sequenceIdArr[9] = 0x1C1; + _sequenceIdArr[10] = 0x1C2; + _sequenceIdArr[11] = 0x1C3; + _sequenceIdArr[12] = 0x1C4; + _sequenceIdArr[13] = 0x1C6; + _sequenceIdArr[14] = 0x1C5; + _sequenceIdArr[15] = 0x1D0; + _sequenceIdArr[16] = 0x1D0; + _sequenceIdArr[17] = 0x1D0; + _resourceIdArr[0] = 0xD5; + _resourceIdArr[1] = 0x14C; + _resourceIdArr[2] = 0xD5; + _resourceIdArr[3] = 0xBF; + _resourceIdArr[4] = 0xD6; + _resourceIdArr[5] = 0x154; + _resourceIdArr[6] = 0x155; + _resourceIdArr[7] = 0xB9; + _resourceIdArr[8] = 0xBA; + _resourceIdArr[9] = 0x17B; + _resourceIdArr[10] = 0x17A; + _resourceIdArr[11] = 0x17C; + _resourceIdArr[12] = 0x17A; + _resourceIdArr[13] = 0x1B7; + _resourceIdArr[14] = 0x1B8; + _resourceIdArr[15] = 0x1B9; + _sequenceCountArr[0] = 2; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 2; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 1; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _sequenceCountArr[13] = 1; + _sequenceCountArr[14] = 1; + _sequenceCountArr[15] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _canSkip[5] = false; + _canSkip[6] = false; + _canSkip[7] = false; + _canSkip[8] = false; + _canSkip[9] = false; + _canSkip[10] = false; + _canSkip[11] = false; + _canSkip[12] = false; + _canSkip[13] = true; + _canSkip[14] = true; + _canSkip[15] = false; + _itemsCount = 16; return -1; } diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c549a7aac9..8c16bb593e 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -699,7 +699,7 @@ void CutScene::run() { if (_vm->_prevSceneNum == 2) { soundId = 0x36B; - duration = MAX(1, 300 / _vm->getSequenceTotalDuration(_s99_sequenceIdArr[_s99_itemsCount - 1]));//CHECKME + duration = MAX(1, 300 / _vm->getSequenceTotalDuration(_sequenceIdArr[_itemsCount - 1]));//CHECKME _vm->_timers[0] = 0; } @@ -708,11 +708,11 @@ void CutScene::run() { _vm->hideCursor(); - _vm->_gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[0]); + _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[0]); - for (int j = 0; j < _s99_sequenceCountArr[0]; ++j) - _vm->_gameSys->insertSequence(_s99_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(_s99_sequenceIdArr[0], 2, 0); + for (int j = 0; j < _sequenceCountArr[0]; ++j) + _vm->_gameSys->insertSequence(_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_sequenceIdArr[0], 2, 0); _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); @@ -729,14 +729,14 @@ void CutScene::run() { _vm->_gameSys->requestClear2(false); _vm->_gameSys->requestClear1(); _vm->_gameSys->setAnimation(0, 0, 0); - firstSequenceIndex += _s99_sequenceCountArr[itemIndex++]; - if (itemIndex >= _s99_itemsCount) { + firstSequenceIndex += _sequenceCountArr[itemIndex++]; + if (itemIndex >= _itemsCount) { _vm->_sceneDone = true; } else { - for (int m = 0; m < _s99_sequenceCountArr[itemIndex]; ++m) - _vm->_gameSys->insertSequence(_s99_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[itemIndex]); - _vm->_gameSys->setAnimation(_s99_sequenceIdArr[firstSequenceIndex], 2, 0); + for (int m = 0; m < _sequenceCountArr[itemIndex]; ++m) + _vm->_gameSys->insertSequence(_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[itemIndex]); + _vm->_gameSys->setAnimation(_sequenceIdArr[firstSequenceIndex], 2, 0); } } @@ -744,13 +744,13 @@ void CutScene::run() { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); _vm->clearKeyStatus1(29); - if (_s99_canSkip[itemIndex]) + if (_canSkip[itemIndex]) skip = true; else _vm->_sceneDone = true; } - if (!_vm->_timers[0] && itemIndex == _s99_itemsCount - 1) { + if (!_vm->_timers[0] && itemIndex == _itemsCount - 1) { _vm->_timers[0] = 2; volume = MAX(1, volume - duration); _vm->setSoundVolume(soundId, volume); diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index 73723fd685..209f07a162 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -59,11 +59,11 @@ public: void updateAnimationsCb() {} protected: - int _s99_itemsCount; - int _s99_resourceIdArr[16]; - int _s99_sequenceCountArr[16]; - int _s99_sequenceIdArr[50]; - bool _s99_canSkip[16]; + int _itemsCount; + int _resourceIdArr[16]; + int _sequenceCountArr[16]; + int _sequenceIdArr[50]; + bool _canSkip[16]; }; } // End of namespace Gnap -- cgit v1.2.3 From 71ba82154e491e167029571d32a18291f7da830a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 26 Apr 2016 06:03:59 +0200 Subject: GNAP: Group cutscenes in a single scene group file --- engines/gnap/module.mk | 5 +- engines/gnap/scenes/groupcs.cpp | 430 ++++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/groupcs.h | 122 +++++++++++ engines/gnap/scenes/scene16.cpp | 87 -------- engines/gnap/scenes/scene16.h | 42 ---- engines/gnap/scenes/scene47.cpp | 200 ------------------ engines/gnap/scenes/scene47.h | 89 -------- engines/gnap/scenes/scene48.cpp | 90 -------- engines/gnap/scenes/scene48.h | 42 ---- engines/gnap/scenes/scene54.cpp | 136 ------------ engines/gnap/scenes/scene54.h | 49 ----- engines/gnap/scenes/scenecore.cpp | 6 +- 12 files changed, 555 insertions(+), 743 deletions(-) create mode 100644 engines/gnap/scenes/groupcs.cpp create mode 100644 engines/gnap/scenes/groupcs.h delete mode 100644 engines/gnap/scenes/scene16.cpp delete mode 100644 engines/gnap/scenes/scene16.h delete mode 100644 engines/gnap/scenes/scene47.cpp delete mode 100644 engines/gnap/scenes/scene47.h delete mode 100644 engines/gnap/scenes/scene48.cpp delete mode 100644 engines/gnap/scenes/scene48.h delete mode 100644 engines/gnap/scenes/scene54.cpp delete mode 100644 engines/gnap/scenes/scene54.h diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index a2e5c77c82..bb565eb276 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -10,6 +10,7 @@ MODULE_OBJS := \ menu.o \ resource.o \ sound.o \ + scenes/groupcs.o \ scenes/scene00.o \ scenes/scene01.o \ scenes/scene02.o \ @@ -26,7 +27,6 @@ MODULE_OBJS := \ scenes/scene13.o \ scenes/scene14.o \ scenes/scene15.o \ - scenes/scene16.o \ scenes/scene17.o \ scenes/scene18.o \ scenes/scene19.o \ @@ -53,14 +53,11 @@ MODULE_OBJS := \ scenes/scene44.o \ scenes/scene45.o \ scenes/scene46.o \ - scenes/scene47.o \ - scenes/scene48.o \ scenes/scene49.o \ scenes/scene50.o \ scenes/scene51.o \ scenes/scene52.o \ scenes/scene53.o \ - scenes/scene54.o \ scenes/scenecore.o # This module can be built as a plugin diff --git a/engines/gnap/scenes/groupcs.cpp b/engines/gnap/scenes/groupcs.cpp new file mode 100644 index 0000000000..92491a3847 --- /dev/null +++ b/engines/gnap/scenes/groupcs.cpp @@ -0,0 +1,430 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/groupcs.h" + + +namespace Gnap { + +Scene16::Scene16(GnapEngine *vm) : CutScene(vm) {} + +int Scene16::init() { + _sequenceIdArr[0] = 0x1F2; + _sequenceIdArr[1] = 0x201; + _sequenceIdArr[2] = 0x1FC; + _sequenceIdArr[3] = 0x1F4; + _sequenceIdArr[4] = 0x1FB; + _sequenceIdArr[5] = 0x1F0; + _sequenceIdArr[6] = 0x1FD; + _sequenceIdArr[7] = 0x1FE; + _sequenceIdArr[8] = 0x1F7; + _sequenceIdArr[9] = 0x1F9; + _sequenceIdArr[10] = 0x1F8; + _sequenceIdArr[11] = 0x1F1; + _sequenceIdArr[12] = 0x202; + _sequenceIdArr[13] = 0x1F6; + _sequenceIdArr[14] = 0x1F3; + _sequenceIdArr[15] = 0x1FA; + _sequenceIdArr[16] = 0x1FF; + _sequenceIdArr[17] = 0x200; + _sequenceIdArr[18] = 0x203; + _sequenceIdArr[19] = 0x206; + _sequenceIdArr[20] = 0x207; + _sequenceIdArr[21] = 0x204; + _sequenceIdArr[22] = 0x205; + _resourceIdArr[0] = 0x1C; + _resourceIdArr[1] = 2; + _resourceIdArr[2] = 0x1B; + _resourceIdArr[3] = 0; + _resourceIdArr[4] = 0x167; + _resourceIdArr[5] = 1; + _resourceIdArr[6] = 0x15B; + _resourceIdArr[7] = 0x15A; + _resourceIdArr[8] = 0x170; + _resourceIdArr[9] = 0x1EB; + _resourceIdArr[10] = 0x1EC; + _resourceIdArr[11] = 0x1BE; + _resourceIdArr[12] = 0x1BF; + _sequenceCountArr[0] = 4; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 6; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 3; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _itemsCount = 13; + + return -1; +} + +/*****************************************************************************/ + +Scene471::Scene471(GnapEngine *vm) : CutScene(vm) {} + +int Scene471::init() { + _sequenceIdArr[0] = 0x301; + _sequenceIdArr[1] = 0x305; + _sequenceIdArr[2] = 0x302; + _sequenceIdArr[3] = 0x304; + _sequenceIdArr[4] = 0x300; + _resourceIdArr[0] = 3; + _resourceIdArr[1] = 0; + _resourceIdArr[2] = 1; + _resourceIdArr[3] = 0; + _resourceIdArr[4] = 2; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; + + return -1; +} + +Scene472::Scene472(GnapEngine *vm) : CutScene(vm) {} + +int Scene472::init() { + _sequenceIdArr[0] = 0x306; + _sequenceIdArr[1] = 0x309; + _sequenceIdArr[2] = 0x307; + _sequenceIdArr[3] = 0x308; + _sequenceIdArr[4] = 0x30A; + _resourceIdArr[0] = 0x8E; + _resourceIdArr[1] = 0x90; + _resourceIdArr[2] = 0x8F; + _resourceIdArr[3] = 0x91; + _sequenceCountArr[0] = 2; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _itemsCount = 4; + + return -1; +} + +Scene473::Scene473(GnapEngine *vm) : CutScene(vm) {} + +int Scene473::init() { + _sequenceIdArr[0] = 0x320; + _sequenceIdArr[1] = 0x321; + _resourceIdArr[0] = 0x142; + _resourceIdArr[1] = 0x143; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _itemsCount = 2; + + return -1; +} + +Scene474::Scene474(GnapEngine *vm) : CutScene(vm) {} + +int Scene474::init() { + _sequenceIdArr[0] = 0x30C; + _sequenceIdArr[1] = 0x30D; + _sequenceIdArr[2] = 0x30B; + _resourceIdArr[0] = 0x142; + _resourceIdArr[1] = 0x141; + _resourceIdArr[2] = 0x177; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _itemsCount = 3; + + return -1; +} + +Scene475::Scene475(GnapEngine *vm) : CutScene(vm) {} + +int Scene475::init() { + _sequenceIdArr[0] = 0x30E; + _sequenceIdArr[1] = 0x30F; + _sequenceIdArr[2] = 0x310; + _sequenceIdArr[3] = 0x311; + _resourceIdArr[0] = 0x206; + _resourceIdArr[1] = 0x207; + _sequenceCountArr[0] = 3; + _sequenceCountArr[1] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _itemsCount = 2; + + return -1; +} + +Scene476::Scene476(GnapEngine *vm) : CutScene(vm) {} + +int Scene476::init() { + _sequenceIdArr[0] = 0x31E; + _sequenceIdArr[1] = 0x31F; + _resourceIdArr[0] = 0x2FA; + _sequenceCountArr[0] = 2; + _canSkip[0] = false; + _itemsCount = 1; + + return -1; +} + +Scene477::Scene477(GnapEngine *vm) : CutScene(vm) {} + +int Scene477::init() { + int v0, v4, v2, v3; + + _sequenceIdArr[0] = 0x316; + _sequenceIdArr[1] = 0x31A; + _sequenceIdArr[2] = 0x314; + _sequenceIdArr[3] = 0x31B; + int v1 = 4; + if (!_vm->isFlag(kGFTwigTaken)) { + _sequenceIdArr[4] = 0x31C; + v1 = 5; + } + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _sequenceIdArr[v1++] = 0x31D; + v4 = v1; + _sequenceIdArr[v1] = 0x319; + v0 = v1 + 1; + v3 = v0; + _sequenceIdArr[v0++] = 0x317; + _sequenceIdArr[v0++] = 0x312; + _sequenceIdArr[v0] = 0x31A; + v2 = v0 + 1; + if (!_vm->isFlag(kGFTwigTaken)) + _sequenceIdArr[v2++] = 0x31C; + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _sequenceIdArr[v2++] = 0x31D; + _sequenceIdArr[v2] = 0x313; + _sequenceIdArr[v2 + 1] = 0x315; + _resourceIdArr[0] = 0x2B8; + _resourceIdArr[1] = 0x20C; + _resourceIdArr[2] = 0x2B8; + _resourceIdArr[3] = 0x20B; + _resourceIdArr[4] = 0x20B; + _sequenceCountArr[0] = v4; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = v2 - v3; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; + + return -1; +} + +/*****************************************************************************/ + +Scene48::Scene48(GnapEngine *vm) : CutScene(vm) {} + +int Scene48::init() { + _sequenceIdArr[0] = 390; + _sequenceIdArr[1] = 391; + _sequenceIdArr[2] = 392; + _sequenceIdArr[3] = 393; + _sequenceIdArr[4] = 394; + _sequenceIdArr[5] = 395; + _sequenceIdArr[6] = 396; + _sequenceIdArr[7] = 397; + _sequenceIdArr[8] = 398; + _sequenceIdArr[9] = 399; + _sequenceIdArr[10] = 400; + _sequenceIdArr[11] = 401; + _sequenceIdArr[12] = 402; + _resourceIdArr[0] = 238; + _resourceIdArr[1] = 42; + _resourceIdArr[2] = 2; + _resourceIdArr[3] = 37; + _resourceIdArr[4] = 35; + _resourceIdArr[5] = 38; + _resourceIdArr[6] = 39; + _resourceIdArr[7] = 40; + _resourceIdArr[8] = 41; + _resourceIdArr[9] = 36; + _resourceIdArr[10] = 41; + _resourceIdArr[11] = 388; + _resourceIdArr[12] = 387; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 1; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _canSkip[5] = false; + _canSkip[6] = false; + _canSkip[7] = false; + _canSkip[8] = false; + _canSkip[9] = false; + _canSkip[10] = false; + _canSkip[11] = false; + _canSkip[12] = false; + _itemsCount = 13; + + return -1; +} + +/*****************************************************************************/ + +Scene541::Scene541(GnapEngine *vm) : CutScene(vm) {} + +int Scene541::init() { + _sequenceIdArr[0] = 0x1BE; + _sequenceIdArr[1] = 0x1BF; + _sequenceIdArr[2] = 0x1BA; + _sequenceIdArr[3] = 0x1BB; + _sequenceIdArr[4] = 0x1BD; + _sequenceIdArr[5] = 0x1BC; + _resourceIdArr[0] = 0x3C; + _resourceIdArr[1] = 0x43; + _resourceIdArr[2] = 0x44; + if (_vm->isFlag(kGFPictureTaken)) + _resourceIdArr[3] = 0x47; + else + _resourceIdArr[3] = 0x46; + _resourceIdArr[4] = 0x45; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 2; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; + + return -1; +} + +Scene542::Scene542(GnapEngine *vm) : CutScene(vm) {} + +int Scene542::init() { + _sequenceIdArr[0] = 0x1C9; + _sequenceIdArr[1] = 0x1C7; + _sequenceIdArr[2] = 0x1CC; + _sequenceIdArr[3] = 0x1C8; + _sequenceIdArr[4] = 0x1CB; + _sequenceIdArr[5] = 0x1C0; + _sequenceIdArr[6] = 0x1CA; + _sequenceIdArr[7] = 0x1CE; + _sequenceIdArr[8] = 0x1CD; + _sequenceIdArr[9] = 0x1C1; + _sequenceIdArr[10] = 0x1C2; + _sequenceIdArr[11] = 0x1C3; + _sequenceIdArr[12] = 0x1C4; + _sequenceIdArr[13] = 0x1C6; + _sequenceIdArr[14] = 0x1C5; + _sequenceIdArr[15] = 0x1D0; + _sequenceIdArr[16] = 0x1D0; + _sequenceIdArr[17] = 0x1D0; + _resourceIdArr[0] = 0xD5; + _resourceIdArr[1] = 0x14C; + _resourceIdArr[2] = 0xD5; + _resourceIdArr[3] = 0xBF; + _resourceIdArr[4] = 0xD6; + _resourceIdArr[5] = 0x154; + _resourceIdArr[6] = 0x155; + _resourceIdArr[7] = 0xB9; + _resourceIdArr[8] = 0xBA; + _resourceIdArr[9] = 0x17B; + _resourceIdArr[10] = 0x17A; + _resourceIdArr[11] = 0x17C; + _resourceIdArr[12] = 0x17A; + _resourceIdArr[13] = 0x1B7; + _resourceIdArr[14] = 0x1B8; + _resourceIdArr[15] = 0x1B9; + _sequenceCountArr[0] = 2; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 2; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 1; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _sequenceCountArr[13] = 1; + _sequenceCountArr[14] = 1; + _sequenceCountArr[15] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _canSkip[5] = false; + _canSkip[6] = false; + _canSkip[7] = false; + _canSkip[8] = false; + _canSkip[9] = false; + _canSkip[10] = false; + _canSkip[11] = false; + _canSkip[12] = false; + _canSkip[13] = true; + _canSkip[14] = true; + _canSkip[15] = false; + _itemsCount = 16; + + return -1; +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/groupcs.h b/engines/gnap/scenes/groupcs.h new file mode 100644 index 0000000000..26f51abb0b --- /dev/null +++ b/engines/gnap/scenes/groupcs.h @@ -0,0 +1,122 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GROUPCS_H +#define GNAP_GROUPCS_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene16: public CutScene { +public: + Scene16(GnapEngine *vm); + ~Scene16() {} + + virtual int init(); +}; + +class Scene471: public CutScene { +public: + Scene471(GnapEngine *vm); + ~Scene471() {} + + virtual int init(); +}; + +class Scene472: public CutScene { +public: + Scene472(GnapEngine *vm); + ~Scene472() {} + + virtual int init(); +}; + +class Scene473: public CutScene { +public: + Scene473(GnapEngine *vm); + ~Scene473() {} + + virtual int init(); +}; + +class Scene474: public CutScene { +public: + Scene474(GnapEngine *vm); + ~Scene474() {} + + virtual int init(); +}; + +class Scene475: public CutScene { +public: + Scene475(GnapEngine *vm); + ~Scene475() {} + + virtual int init(); +}; + +class Scene476: public CutScene { +public: + Scene476(GnapEngine *vm); + ~Scene476() {} + + virtual int init(); +}; + +class Scene477: public CutScene { +public: + Scene477(GnapEngine *vm); + ~Scene477() {} + + virtual int init(); +}; + +class Scene48: public CutScene { +public: + Scene48(GnapEngine *vm); + ~Scene48() {} + + virtual int init(); +}; + +class Scene541: public CutScene { +public: + Scene541(GnapEngine *vm); + ~Scene541() {} + + virtual int init(); +}; + +class Scene542: public CutScene { +public: + Scene542(GnapEngine *vm); + ~Scene542() {} + + virtual int init(); +}; +} // End of namespace Gnap + +#endif // GNAP_GROUPCS_H diff --git a/engines/gnap/scenes/scene16.cpp b/engines/gnap/scenes/scene16.cpp deleted file mode 100644 index 370faf40bb..0000000000 --- a/engines/gnap/scenes/scene16.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene16.h" - -namespace Gnap { - -Scene16::Scene16(GnapEngine *vm) : CutScene(vm) {} - -int Scene16::init() { - _sequenceIdArr[0] = 0x1F2; - _sequenceIdArr[1] = 0x201; - _sequenceIdArr[2] = 0x1FC; - _sequenceIdArr[3] = 0x1F4; - _sequenceIdArr[4] = 0x1FB; - _sequenceIdArr[5] = 0x1F0; - _sequenceIdArr[6] = 0x1FD; - _sequenceIdArr[7] = 0x1FE; - _sequenceIdArr[8] = 0x1F7; - _sequenceIdArr[9] = 0x1F9; - _sequenceIdArr[10] = 0x1F8; - _sequenceIdArr[11] = 0x1F1; - _sequenceIdArr[12] = 0x202; - _sequenceIdArr[13] = 0x1F6; - _sequenceIdArr[14] = 0x1F3; - _sequenceIdArr[15] = 0x1FA; - _sequenceIdArr[16] = 0x1FF; - _sequenceIdArr[17] = 0x200; - _sequenceIdArr[18] = 0x203; - _sequenceIdArr[19] = 0x206; - _sequenceIdArr[20] = 0x207; - _sequenceIdArr[21] = 0x204; - _sequenceIdArr[22] = 0x205; - _resourceIdArr[0] = 0x1C; - _resourceIdArr[1] = 2; - _resourceIdArr[2] = 0x1B; - _resourceIdArr[3] = 0; - _resourceIdArr[4] = 0x167; - _resourceIdArr[5] = 1; - _resourceIdArr[6] = 0x15B; - _resourceIdArr[7] = 0x15A; - _resourceIdArr[8] = 0x170; - _resourceIdArr[9] = 0x1EB; - _resourceIdArr[10] = 0x1EC; - _resourceIdArr[11] = 0x1BE; - _resourceIdArr[12] = 0x1BF; - _sequenceCountArr[0] = 4; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = 1; - _sequenceCountArr[3] = 6; - _sequenceCountArr[4] = 1; - _sequenceCountArr[5] = 3; - _sequenceCountArr[6] = 1; - _sequenceCountArr[7] = 1; - _sequenceCountArr[8] = 1; - _sequenceCountArr[9] = 1; - _sequenceCountArr[10] = 1; - _sequenceCountArr[11] = 1; - _sequenceCountArr[12] = 1; - _itemsCount = 13; - - return -1; -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene16.h b/engines/gnap/scenes/scene16.h deleted file mode 100644 index e9d3b7f071..0000000000 --- a/engines/gnap/scenes/scene16.h +++ /dev/null @@ -1,42 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE16_H -#define GNAP_SCENE16_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene16: public CutScene { -public: - Scene16(GnapEngine *vm); - ~Scene16() {} - - virtual int init(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE16_H diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp deleted file mode 100644 index 1c96139fdd..0000000000 --- a/engines/gnap/scenes/scene47.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene47.h" - -namespace Gnap { - -Scene471::Scene471(GnapEngine *vm) : CutScene(vm) {} - -int Scene471::init() { - _sequenceIdArr[0] = 0x301; - _sequenceIdArr[1] = 0x305; - _sequenceIdArr[2] = 0x302; - _sequenceIdArr[3] = 0x304; - _sequenceIdArr[4] = 0x300; - _resourceIdArr[0] = 3; - _resourceIdArr[1] = 0; - _resourceIdArr[2] = 1; - _resourceIdArr[3] = 0; - _resourceIdArr[4] = 2; - _sequenceCountArr[0] = 1; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = 1; - _sequenceCountArr[3] = 1; - _sequenceCountArr[4] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _canSkip[2] = false; - _canSkip[3] = false; - _canSkip[4] = false; - _itemsCount = 5; - - return -1; -} - -Scene472::Scene472(GnapEngine *vm) : CutScene(vm) {} - -int Scene472::init() { - _sequenceIdArr[0] = 0x306; - _sequenceIdArr[1] = 0x309; - _sequenceIdArr[2] = 0x307; - _sequenceIdArr[3] = 0x308; - _sequenceIdArr[4] = 0x30A; - _resourceIdArr[0] = 0x8E; - _resourceIdArr[1] = 0x90; - _resourceIdArr[2] = 0x8F; - _resourceIdArr[3] = 0x91; - _sequenceCountArr[0] = 2; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = 1; - _sequenceCountArr[3] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _canSkip[2] = false; - _canSkip[3] = false; - _itemsCount = 4; - - return -1; -} - -Scene473::Scene473(GnapEngine *vm) : CutScene(vm) {} - -int Scene473::init() { - _sequenceIdArr[0] = 0x320; - _sequenceIdArr[1] = 0x321; - _resourceIdArr[0] = 0x142; - _resourceIdArr[1] = 0x143; - _sequenceCountArr[0] = 1; - _sequenceCountArr[1] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _itemsCount = 2; - - return -1; -} - -Scene474::Scene474(GnapEngine *vm) : CutScene(vm) {} - -int Scene474::init() { - _sequenceIdArr[0] = 0x30C; - _sequenceIdArr[1] = 0x30D; - _sequenceIdArr[2] = 0x30B; - _resourceIdArr[0] = 0x142; - _resourceIdArr[1] = 0x141; - _resourceIdArr[2] = 0x177; - _sequenceCountArr[0] = 1; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _canSkip[2] = false; - _itemsCount = 3; - - return -1; -} - -Scene475::Scene475(GnapEngine *vm) : CutScene(vm) {} - -int Scene475::init() { - _sequenceIdArr[0] = 0x30E; - _sequenceIdArr[1] = 0x30F; - _sequenceIdArr[2] = 0x310; - _sequenceIdArr[3] = 0x311; - _resourceIdArr[0] = 0x206; - _resourceIdArr[1] = 0x207; - _sequenceCountArr[0] = 3; - _sequenceCountArr[1] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _itemsCount = 2; - - return -1; -} - -Scene476::Scene476(GnapEngine *vm) : CutScene(vm) {} - -int Scene476::init() { - _sequenceIdArr[0] = 0x31E; - _sequenceIdArr[1] = 0x31F; - _resourceIdArr[0] = 0x2FA; - _sequenceCountArr[0] = 2; - _canSkip[0] = false; - _itemsCount = 1; - - return -1; -} - -Scene477::Scene477(GnapEngine *vm) : CutScene(vm) {} - -int Scene477::init() { - int v0, v4, v2, v3; - - _sequenceIdArr[0] = 0x316; - _sequenceIdArr[1] = 0x31A; - _sequenceIdArr[2] = 0x314; - _sequenceIdArr[3] = 0x31B; - int v1 = 4; - if (!_vm->isFlag(kGFTwigTaken)) { - _sequenceIdArr[4] = 0x31C; - v1 = 5; - } - if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _sequenceIdArr[v1++] = 0x31D; - v4 = v1; - _sequenceIdArr[v1] = 0x319; - v0 = v1 + 1; - v3 = v0; - _sequenceIdArr[v0++] = 0x317; - _sequenceIdArr[v0++] = 0x312; - _sequenceIdArr[v0] = 0x31A; - v2 = v0 + 1; - if (!_vm->isFlag(kGFTwigTaken)) - _sequenceIdArr[v2++] = 0x31C; - if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _sequenceIdArr[v2++] = 0x31D; - _sequenceIdArr[v2] = 0x313; - _sequenceIdArr[v2 + 1] = 0x315; - _resourceIdArr[0] = 0x2B8; - _resourceIdArr[1] = 0x20C; - _resourceIdArr[2] = 0x2B8; - _resourceIdArr[3] = 0x20B; - _resourceIdArr[4] = 0x20B; - _sequenceCountArr[0] = v4; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = v2 - v3; - _sequenceCountArr[3] = 1; - _sequenceCountArr[4] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _canSkip[2] = false; - _canSkip[3] = false; - _canSkip[4] = false; - _itemsCount = 5; - - return -1; -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene47.h b/engines/gnap/scenes/scene47.h deleted file mode 100644 index f1c1034223..0000000000 --- a/engines/gnap/scenes/scene47.h +++ /dev/null @@ -1,89 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE47_H -#define GNAP_SCENE47_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene471: public CutScene { -public: - Scene471(GnapEngine *vm); - ~Scene471() {} - - virtual int init(); -}; - -class Scene472: public CutScene { -public: - Scene472(GnapEngine *vm); - ~Scene472() {} - - virtual int init(); -}; - -class Scene473: public CutScene { -public: - Scene473(GnapEngine *vm); - ~Scene473() {} - - virtual int init(); -}; - -class Scene474: public CutScene { -public: - Scene474(GnapEngine *vm); - ~Scene474() {} - - virtual int init(); -}; - -class Scene475: public CutScene { -public: - Scene475(GnapEngine *vm); - ~Scene475() {} - - virtual int init(); -}; - -class Scene476: public CutScene { -public: - Scene476(GnapEngine *vm); - ~Scene476() {} - - virtual int init(); -}; - -class Scene477: public CutScene { -public: - Scene477(GnapEngine *vm); - ~Scene477() {} - - virtual int init(); -}; -} // End of namespace Gnap -#endif // GNAP_SCENE47_H diff --git a/engines/gnap/scenes/scene48.cpp b/engines/gnap/scenes/scene48.cpp deleted file mode 100644 index 27f8d829d8..0000000000 --- a/engines/gnap/scenes/scene48.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene48.h" - -namespace Gnap { - -Scene48::Scene48(GnapEngine *vm) : CutScene(vm) {} - -int Scene48::init() { - _sequenceIdArr[0] = 390; - _sequenceIdArr[1] = 391; - _sequenceIdArr[2] = 392; - _sequenceIdArr[3] = 393; - _sequenceIdArr[4] = 394; - _sequenceIdArr[5] = 395; - _sequenceIdArr[6] = 396; - _sequenceIdArr[7] = 397; - _sequenceIdArr[8] = 398; - _sequenceIdArr[9] = 399; - _sequenceIdArr[10] = 400; - _sequenceIdArr[11] = 401; - _sequenceIdArr[12] = 402; - _resourceIdArr[0] = 238; - _resourceIdArr[1] = 42; - _resourceIdArr[2] = 2; - _resourceIdArr[3] = 37; - _resourceIdArr[4] = 35; - _resourceIdArr[5] = 38; - _resourceIdArr[6] = 39; - _resourceIdArr[7] = 40; - _resourceIdArr[8] = 41; - _resourceIdArr[9] = 36; - _resourceIdArr[10] = 41; - _resourceIdArr[11] = 388; - _resourceIdArr[12] = 387; - _sequenceCountArr[0] = 1; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = 1; - _sequenceCountArr[3] = 1; - _sequenceCountArr[4] = 1; - _sequenceCountArr[5] = 1; - _sequenceCountArr[6] = 1; - _sequenceCountArr[7] = 1; - _sequenceCountArr[8] = 1; - _sequenceCountArr[9] = 1; - _sequenceCountArr[10] = 1; - _sequenceCountArr[11] = 1; - _sequenceCountArr[12] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _canSkip[2] = false; - _canSkip[3] = false; - _canSkip[4] = false; - _canSkip[5] = false; - _canSkip[6] = false; - _canSkip[7] = false; - _canSkip[8] = false; - _canSkip[9] = false; - _canSkip[10] = false; - _canSkip[11] = false; - _canSkip[12] = false; - _itemsCount = 13; - - return -1; -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene48.h b/engines/gnap/scenes/scene48.h deleted file mode 100644 index 24e54b4462..0000000000 --- a/engines/gnap/scenes/scene48.h +++ /dev/null @@ -1,42 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE48_H -#define GNAP_SCENE48_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene48: public CutScene { -public: - Scene48(GnapEngine *vm); - ~Scene48() {} - - virtual int init(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE48_H diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp deleted file mode 100644 index 222c6e81e4..0000000000 --- a/engines/gnap/scenes/scene54.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene54.h" - -namespace Gnap { - -Scene541::Scene541(GnapEngine *vm) : CutScene(vm) {} - -int Scene541::init() { - _sequenceIdArr[0] = 0x1BE; - _sequenceIdArr[1] = 0x1BF; - _sequenceIdArr[2] = 0x1BA; - _sequenceIdArr[3] = 0x1BB; - _sequenceIdArr[4] = 0x1BD; - _sequenceIdArr[5] = 0x1BC; - _resourceIdArr[0] = 0x3C; - _resourceIdArr[1] = 0x43; - _resourceIdArr[2] = 0x44; - if (_vm->isFlag(kGFPictureTaken)) - _resourceIdArr[3] = 0x47; - else - _resourceIdArr[3] = 0x46; - _resourceIdArr[4] = 0x45; - _sequenceCountArr[0] = 1; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = 1; - _sequenceCountArr[3] = 2; - _sequenceCountArr[4] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _canSkip[2] = false; - _canSkip[3] = false; - _canSkip[4] = false; - _itemsCount = 5; - - return -1; -} - -Scene542::Scene542(GnapEngine *vm) : CutScene(vm) {} - -int Scene542::init() { - _sequenceIdArr[0] = 0x1C9; - _sequenceIdArr[1] = 0x1C7; - _sequenceIdArr[2] = 0x1CC; - _sequenceIdArr[3] = 0x1C8; - _sequenceIdArr[4] = 0x1CB; - _sequenceIdArr[5] = 0x1C0; - _sequenceIdArr[6] = 0x1CA; - _sequenceIdArr[7] = 0x1CE; - _sequenceIdArr[8] = 0x1CD; - _sequenceIdArr[9] = 0x1C1; - _sequenceIdArr[10] = 0x1C2; - _sequenceIdArr[11] = 0x1C3; - _sequenceIdArr[12] = 0x1C4; - _sequenceIdArr[13] = 0x1C6; - _sequenceIdArr[14] = 0x1C5; - _sequenceIdArr[15] = 0x1D0; - _sequenceIdArr[16] = 0x1D0; - _sequenceIdArr[17] = 0x1D0; - _resourceIdArr[0] = 0xD5; - _resourceIdArr[1] = 0x14C; - _resourceIdArr[2] = 0xD5; - _resourceIdArr[3] = 0xBF; - _resourceIdArr[4] = 0xD6; - _resourceIdArr[5] = 0x154; - _resourceIdArr[6] = 0x155; - _resourceIdArr[7] = 0xB9; - _resourceIdArr[8] = 0xBA; - _resourceIdArr[9] = 0x17B; - _resourceIdArr[10] = 0x17A; - _resourceIdArr[11] = 0x17C; - _resourceIdArr[12] = 0x17A; - _resourceIdArr[13] = 0x1B7; - _resourceIdArr[14] = 0x1B8; - _resourceIdArr[15] = 0x1B9; - _sequenceCountArr[0] = 2; - _sequenceCountArr[1] = 1; - _sequenceCountArr[2] = 2; - _sequenceCountArr[3] = 1; - _sequenceCountArr[4] = 1; - _sequenceCountArr[5] = 1; - _sequenceCountArr[6] = 1; - _sequenceCountArr[7] = 1; - _sequenceCountArr[8] = 1; - _sequenceCountArr[9] = 1; - _sequenceCountArr[10] = 1; - _sequenceCountArr[11] = 1; - _sequenceCountArr[12] = 1; - _sequenceCountArr[13] = 1; - _sequenceCountArr[14] = 1; - _sequenceCountArr[15] = 1; - _canSkip[0] = false; - _canSkip[1] = false; - _canSkip[2] = false; - _canSkip[3] = false; - _canSkip[4] = false; - _canSkip[5] = false; - _canSkip[6] = false; - _canSkip[7] = false; - _canSkip[8] = false; - _canSkip[9] = false; - _canSkip[10] = false; - _canSkip[11] = false; - _canSkip[12] = false; - _canSkip[13] = true; - _canSkip[14] = true; - _canSkip[15] = false; - _itemsCount = 16; - - return -1; -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene54.h b/engines/gnap/scenes/scene54.h deleted file mode 100644 index a27d157da4..0000000000 --- a/engines/gnap/scenes/scene54.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE54_H -#define GNAP_SCENE54_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene541: public CutScene { -public: - Scene541(GnapEngine *vm); - ~Scene541() {} - - virtual int init(); -}; - -class Scene542: public CutScene { -public: - Scene542(GnapEngine *vm); - ~Scene542() {} - - virtual int init(); -}; -} // End of namespace Gnap -#endif // GNAP_SCENE54_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 8c16bb593e..309c872526 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -25,6 +25,8 @@ #include "gnap/resource.h" #include "gnap/scenes/scenecore.h" +#include "gnap/scenes/groupcs.h" + #include "gnap/scenes/scene00.h" #include "gnap/scenes/scene01.h" #include "gnap/scenes/scene02.h" @@ -41,7 +43,6 @@ #include "gnap/scenes/scene13.h" #include "gnap/scenes/scene14.h" #include "gnap/scenes/scene15.h" -#include "gnap/scenes/scene16.h" #include "gnap/scenes/scene17.h" #include "gnap/scenes/scene18.h" #include "gnap/scenes/scene19.h" @@ -68,14 +69,11 @@ #include "gnap/scenes/scene44.h" #include "gnap/scenes/scene45.h" #include "gnap/scenes/scene46.h" -#include "gnap/scenes/scene47.h" -#include "gnap/scenes/scene48.h" #include "gnap/scenes/scene49.h" #include "gnap/scenes/scene50.h" #include "gnap/scenes/scene51.h" #include "gnap/scenes/scene52.h" #include "gnap/scenes/scene53.h" -#include "gnap/scenes/scene54.h" namespace Gnap { -- cgit v1.2.3 From 19d205b3da025609f171bf7e77b71bb28fcb6604 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 26 Apr 2016 22:00:39 +0200 Subject: GNAP: Prepare the merge of scene group 0 (WIP) --- engines/gnap/scenes/scene01.cpp | 158 ++++++++++++------------- engines/gnap/scenes/scene01.h | 5 +- engines/gnap/scenes/scene02.cpp | 252 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene02.h | 8 +- 4 files changed, 212 insertions(+), 211 deletions(-) diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp index 39d21fc320..39f572a63b 100644 --- a/engines/gnap/scenes/scene01.cpp +++ b/engines/gnap/scenes/scene01.cpp @@ -28,39 +28,39 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSExitTruck = 1, - kHSMud = 2, - kHSPigs = 3, - kHSSpaceship = 4, - kHSDevice = 5, - kHSWalkArea1 = 6, - kHSWalkArea2 = 7, - kHSWalkArea3 = 8, - kHSWalkArea4 = 9, - kHSWalkArea5 = 10, - kHSWalkArea6 = 11, - kHSWalkArea7 = 12, - kHSWalkArea8 = 13 + kHS01Platypus = 0, + kHS01ExitTruck = 1, + kHS01Mud = 2, + kHS01Pigs = 3, + kHS01Spaceship = 4, + kHS01Device = 5, + kHS01WalkArea1 = 6, + kHS01WalkArea2 = 7, + kHS01WalkArea3 = 8, + kHS01WalkArea4 = 9, + kHS01WalkArea5 = 10, + kHS01WalkArea6 = 11, + kHS01WalkArea7 = 12, + kHS01WalkArea8 = 13 }; enum { - kASLookSpaceship = 1, - kASLookSpaceshipDone = 2, - kASLeaveScene = 3, - kASTakeMud = 5, - kASLookPigs = 6, - kASUsePigs = 7 + kAS01LookSpaceship = 1, + kAS01LookSpaceshipDone = 2, + kAS01LeaveScene = 3, + kAS01TakeMud = 5, + kAS01LookPigs = 6, + kAS01UsePigs = 7 }; Scene01::Scene01(GnapEngine *vm) : Scene(vm) { - _s01_pigsIdCtr = 0; - _s01_smokeIdCtr = 0; - _s01_spaceshipSurface = nullptr; + _pigsIdCtr = 0; + _smokeIdCtr = 0; + _spaceshipSurface = nullptr; } Scene01::~Scene01() { - delete _s01_spaceshipSurface; + delete _spaceshipSurface; } int Scene01::init() { @@ -70,24 +70,24 @@ int Scene01::init() { } void Scene01::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); - _vm->setHotspot(kHSMud, 138, 282, 204, 318, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); - _vm->setHotspot(kHSPigs, 408, 234, 578, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 4); - _vm->setHotspot(kHSSpaceship, 0, 200, 94, 292, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); - _vm->setHotspot(kHSWalkArea1, 0, 0, 162, 426); - _vm->setHotspot(kHSWalkArea2, 162, 0, 237, 396); - _vm->setHotspot(kHSWalkArea3, 237, 0, 319, 363); - _vm->setHotspot(kHSWalkArea4, 520, 0, 800, 404); - _vm->setHotspot(kHSWalkArea5, 300, 447, 800, 600); - _vm->setHotspot(kHSWalkArea6, 678, 0, 800, 404); - _vm->setHotspot(kHSWalkArea7, 0, 0, 520, 351); - _vm->setHotspot(kHSWalkArea8, 0, 546, 300, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS01Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS01ExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + _vm->setHotspot(kHS01Mud, 138, 282, 204, 318, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + _vm->setHotspot(kHS01Pigs, 408, 234, 578, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 4); + _vm->setHotspot(kHS01Spaceship, 0, 200, 94, 292, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + _vm->setHotspot(kHS01WalkArea1, 0, 0, 162, 426); + _vm->setHotspot(kHS01WalkArea2, 162, 0, 237, 396); + _vm->setHotspot(kHS01WalkArea3, 237, 0, 319, 363); + _vm->setHotspot(kHS01WalkArea4, 520, 0, 800, 404); + _vm->setHotspot(kHS01WalkArea5, 300, 447, 800, 600); + _vm->setHotspot(kHS01WalkArea6, 678, 0, 800, 404); + _vm->setHotspot(kHS01WalkArea7, 0, 0, 520, 351); + _vm->setHotspot(kHS01WalkArea8, 0, 546, 300, 600); + _vm->setDeviceHotspot(kHS01Device, -1, -1, -1, -1); if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspots[kHS01Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->isFlag(kGFMudTaken)) - _vm->_hotspots[kHSMud]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspots[kHS01Mud]._flags = SF_WALKABLE | SF_DISABLED; _vm->_hotspotsCount = 14; } @@ -136,14 +136,14 @@ void Scene01::run() { switch (_vm->_sceneClickedHotspot) { - case kHSDevice: + case kHS01Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; - case kHSPlatypus: + case kHS01Platypus: if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); @@ -172,7 +172,7 @@ void Scene01::run() { } break; - case kHSSpaceship: + case kHS01Spaceship: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); @@ -181,7 +181,7 @@ void Scene01::run() { case LOOK_CURSOR: _vm->_gnapIdleFacing = kDirUpLeft; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kASLookSpaceship; + _vm->_gnapActionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: case TALK_CURSOR: @@ -193,7 +193,7 @@ void Scene01::run() { } break; - case kHSMud: + case kHS01Mud: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); @@ -204,7 +204,7 @@ void Scene01::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); - _vm->_gnapActionStatus = kASTakeMud; + _vm->_gnapActionStatus = kAS01TakeMud; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -215,7 +215,7 @@ void Scene01::run() { } break; - case kHSPigs: + case kHS01Pigs: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); @@ -224,17 +224,17 @@ void Scene01::run() { case LOOK_CURSOR: _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kASLookPigs; + _vm->_gnapActionStatus = kAS01LookPigs; break; case GRAB_CURSOR: _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kASUsePigs; + _vm->_gnapActionStatus = kAS01UsePigs; break; case TALK_CURSOR: _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kASLookPigs; + _vm->_gnapActionStatus = kAS01LookPigs; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -244,25 +244,25 @@ void Scene01::run() { } break; - case kHSExitTruck: + case kHS01ExitTruck: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); _vm->_newSceneNum = 2; } break; - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: - case kHSWalkArea6: - case kHSWalkArea7: - case kHSWalkArea8: + case kHS01WalkArea1: + case kHS01WalkArea2: + case kHS01WalkArea3: + case kHS01WalkArea4: + case kHS01WalkArea5: + case kHS01WalkArea6: + case kHS01WalkArea7: + case kHS01WalkArea8: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -312,26 +312,26 @@ void Scene01::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLookSpaceship: - _s01_spaceshipSurface = _vm->_gameSys->createSurface(47); - _vm->_gameSys->insertSpriteDrawItem(_s01_spaceshipSurface, 0, 0, 255); + case kAS01LookSpaceship: + _spaceshipSurface = _vm->_gameSys->createSurface(47); + _vm->_gameSys->insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); _vm->_gameSys->setAnimation(133, 256, 0); _vm->_gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = kASLookSpaceshipDone; + _vm->_gnapActionStatus = kAS01LookSpaceshipDone; break; - case kASLookSpaceshipDone: + case kAS01LookSpaceshipDone: _vm->_gameSys->removeSequence(133, 256, true); - _vm->_gameSys->removeSpriteDrawItem(_s01_spaceshipSurface, 255); - _vm->deleteSurface(&_s01_spaceshipSurface); + _vm->_gameSys->removeSpriteDrawItem(_spaceshipSurface, 255); + _vm->deleteSurface(&_spaceshipSurface); _vm->_gnapActionStatus = -1; break; - case kASLeaveScene: + case kAS01LeaveScene: _vm->_sceneDone = true; break; - case kASTakeMud: + case kAS01TakeMud: _vm->playGnapPullOutDevice(2, 3); _vm->playGnapUseDevice(0, 0); _vm->_gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); @@ -339,14 +339,14 @@ void Scene01::updateAnimations() { _vm->_gnapActionStatus = -1; break; - case kASLookPigs: + case kAS01LookPigs: _vm->playSound(138, false); _vm->playSound(139, false); _vm->playSound(140, false); _vm->_gnapActionStatus = -1; break; - case kASUsePigs: + case kAS01UsePigs: _vm->playGnapPullOutDevice(7, 2); _vm->playGnapUseDevice(0, 0); _vm->_gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); @@ -364,18 +364,18 @@ void Scene01::updateAnimations() { } if (_vm->_gameSys->getAnimationStatus(4) == 2) { - _s01_smokeIdCtr = (_s01_smokeIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x86, _s01_smokeIdCtr + 20, 4); - _vm->_gameSys->insertSequence(0x86, _s01_smokeIdCtr + 20, - 0x86, (_s01_smokeIdCtr + 1) % 2 + 20, + _smokeIdCtr = (_smokeIdCtr + 1) % 2; + _vm->_gameSys->setAnimation(0x86, _smokeIdCtr + 20, 4); + _vm->_gameSys->insertSequence(0x86, _smokeIdCtr + 20, + 0x86, (_smokeIdCtr + 1) % 2 + 20, kSeqSyncWait, 0, 0, 0); } if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _s01_pigsIdCtr = (_s01_pigsIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x7F, _s01_pigsIdCtr + 40, 2); - _vm->_gameSys->insertSequence(0x7F, _s01_pigsIdCtr + 40, - 0x7F, (_s01_pigsIdCtr + 1) % 2 + 40, + _pigsIdCtr = (_pigsIdCtr + 1) % 2; + _vm->_gameSys->setAnimation(0x7F, _pigsIdCtr + 40, 2); + _vm->_gameSys->insertSequence(0x7F, _pigsIdCtr + 40, + 0x7F, (_pigsIdCtr + 1) % 2 + 40, kSeqSyncWait, 0, 0, 0); } } diff --git a/engines/gnap/scenes/scene01.h b/engines/gnap/scenes/scene01.h index c6de546954..8aca9fa360 100644 --- a/engines/gnap/scenes/scene01.h +++ b/engines/gnap/scenes/scene01.h @@ -42,8 +42,9 @@ public: virtual void updateAnimationsCb() {} private: - int _s01_pigsIdCtr, _s01_smokeIdCtr; - Graphics::Surface *_s01_spaceshipSurface; + int _pigsIdCtr; + int _smokeIdCtr; + Graphics::Surface *_spaceshipSurface; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index 47ac5578d0..b95810ad7e 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -28,42 +28,42 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSChicken = 1, - kHSTruck1 = 2, - kHSTruck2 = 3, - kHSTruckGrill = 4, - kHSDevice = 5, - kHSExitHouse = 6, - kHSExitBarn = 7, - kHSExitCreek = 8, - kHSExitPigpen = 9, - kHSWalkArea1 = 10, - kHSWalkArea2 = 11, - kHSWalkArea3 = 12, - kHSWalkArea4 = 13 + kHS02Platypus = 0, + kHS02Chicken = 1, + kHS02Truck1 = 2, + kHS02Truck2 = 3, + kHS02TruckGrill = 4, + kHS02Device = 5, + kHS02ExitHouse = 6, + kHS02ExitBarn = 7, + kHS02ExitCreek = 8, + kHS02ExitPigpen = 9, + kHS02WalkArea1 = 10, + kHS02WalkArea2 = 11, + kHS02WalkArea3 = 12, + kHS02WalkArea4 = 13 }; enum { - kASUseTruckNoKeys = 0, - kASUseGasWithTruck = 1, - kASUseTruckGas = 2, - kASUseTruckNoGas = 3, - kASGrabTruckGrill = 5, - kASLeaveScene = 6, - kASTalkChicken = 7, - kASGrabChicken = 8, - kASGrabChickenDone = 9, - kASUseTruckNoKeysDone = 11, - kASUseGasWithTruckDone = 12, - kASUseTwigWithChicken = 16 + kAS02UseTruckNoKeys = 0, + kAS02UseGasWithTruck = 1, + kAS02UseTruckGas = 2, + kAS02UseTruckNoGas = 3, + kAS02GrabTruckGrill = 5, + kAS02LeaveScene = 6, + kAS02TalkChicken = 7, + kAS02GrabChicken = 8, + kAS02GrabChickenDone = 9, + kAS02UseTruckNoKeysDone = 11, + kAS02UseGasWithTruckDone = 12, + kAS02UseTwigWithChicken = 16 }; Scene02::Scene02(GnapEngine *vm) : Scene(vm) { - _s02_truckGrillCtr = 0; - _s02_nextChickenSequenceId = 0; - _s02_currChickenSequenceId = 0; - _s02_gnapTruckSequenceId = 0; + _truckGrillCtr = 0; + _nextChickenSequenceId = 0; + _currChickenSequenceId = 0; + _gnapTruckSequenceId = 0; } int Scene02::init() { @@ -72,22 +72,22 @@ int Scene02::init() { } void Scene02::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE); - _vm->setHotspot(kHSChicken, 606, 455, 702, 568, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSTruck1, 385, 258, 464, 304, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 5); - _vm->setHotspot(kHSTruck2, 316, 224, 390, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 6); - _vm->setHotspot(kHSTruckGrill, 156, 318, 246, 390, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 7); - _vm->setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 5); - _vm->setHotspot(kHSExitBarn, 610, 0, 800, 164, SF_EXIT_U_CURSOR, 10, 5); - _vm->setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - _vm->setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSWalkArea1, 92, 140, 304, 430, 0, 3, 1); - _vm->setHotspot(kHSWalkArea2, 0, 0, 800, 380); - _vm->setHotspot(kHSWalkArea3, 0, 0, 386, 445); - _vm->setHotspot(kHSWalkArea4, 386, 0, 509, 410); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS02Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE); + _vm->setHotspot(kHS02Chicken, 606, 455, 702, 568, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS02Truck1, 385, 258, 464, 304, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 5); + _vm->setHotspot(kHS02Truck2, 316, 224, 390, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 6); + _vm->setHotspot(kHS02TruckGrill, 156, 318, 246, 390, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 7); + _vm->setHotspot(kHS02ExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 5); + _vm->setHotspot(kHS02ExitBarn, 610, 0, 800, 164, SF_EXIT_U_CURSOR, 10, 5); + _vm->setHotspot(kHS02ExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHS02ExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS02WalkArea1, 92, 140, 304, 430, 0, 3, 1); + _vm->setHotspot(kHS02WalkArea2, 0, 0, 800, 380); + _vm->setHotspot(kHS02WalkArea3, 0, 0, 386, 445); + _vm->setHotspot(kHS02WalkArea4, 386, 0, 509, 410); + _vm->setDeviceHotspot(kHS02Device, -1, -1, -1, -1); if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspots[kHS02Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _vm->_hotspotsCount = 14; } @@ -95,11 +95,11 @@ void Scene02::run() { _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); - _s02_currChickenSequenceId = 0x14B; + _currChickenSequenceId = 0x14B; _vm->_gameSys->setAnimation(0x14B, 179, 2); _vm->_gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); - _s02_nextChickenSequenceId = -1; + _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 30; _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -159,14 +159,14 @@ void Scene02::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSDevice: + case kHS02Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; - case kHSPlatypus: + case kHS02Platypus: if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); @@ -195,13 +195,13 @@ void Scene02::run() { } break; - case kHSChicken: + case kHS02Chicken: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASUseTwigWithChicken; + _vm->_gnapActionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); } else { @@ -212,14 +212,14 @@ void Scene02::run() { case GRAB_CURSOR: _vm->_gnapIdleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kASGrabChicken; + _vm->_gnapActionStatus = kAS02GrabChicken; else _vm->_gnapActionStatus = -1; break; case TALK_CURSOR: _vm->_gnapIdleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkChicken; + _vm->_gnapActionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -229,23 +229,23 @@ void Scene02::run() { } break; - case kHSTruck1: - case kHSTruck2: + case kHS02Truck1: + case kHS02Truck2: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnapActionStatus = kASUseTruckGas; + _vm->_gnapActionStatus = kAS02UseTruckGas; else - _vm->_gnapActionStatus = kASUseTruckNoGas; + _vm->_gnapActionStatus = kAS02UseTruckNoGas; } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { - _vm->_hotspots[kHSWalkArea4]._flags |= SF_WALKABLE; + _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _vm->_gnapActionStatus = kASUseGasWithTruck; - _vm->_hotspots[kHSWalkArea4]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS02UseGasWithTruck; + _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); } else { @@ -257,14 +257,14 @@ void Scene02::run() { if (_vm->isFlag(kGFTruckKeysUsed)) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnapActionStatus = kASUseTruckGas; + _vm->_gnapActionStatus = kAS02UseTruckGas; else - _vm->_gnapActionStatus = kASUseTruckNoGas; + _vm->_gnapActionStatus = kAS02UseTruckNoGas; } } else { _vm->_gnapIdleFacing = kDirUnk4; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _vm->_gnapActionStatus = kASUseTruckNoKeys; + _vm->_gnapActionStatus = kAS02UseTruckNoKeys; } break; case TALK_CURSOR: @@ -276,7 +276,7 @@ void Scene02::run() { } break; - case kHSTruckGrill: + case kHS02TruckGrill: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); @@ -288,7 +288,7 @@ void Scene02::run() { case GRAB_CURSOR: _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabTruckGrill; + _vm->_gnapActionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -299,11 +299,11 @@ void Scene02::run() { } break; - case kHSExitHouse: + case kHS02ExitHouse: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, -1, 0x107C1, 1); updateHotspots(); @@ -311,11 +311,11 @@ void Scene02::run() { } break; - case kHSExitBarn: + case kHS02ExitBarn: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7].x + 1, _vm->_hotspotsWalkPos[7].y, -1, 0x107C1, 1); updateHotspots(); @@ -323,32 +323,32 @@ void Scene02::run() { } break; - case kHSExitCreek: + case kHS02ExitCreek: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, -1, 0x107CD, 1); _vm->_newSceneNum = 3; } break; - case kHSExitPigpen: + case kHS02ExitPigpen: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, -1, 0x107CF, 1); _vm->_newSceneNum = 1; } break; - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: + case kHS02WalkArea1: + case kHS02WalkArea2: + case kHS02WalkArea3: + case kHS02WalkArea4: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -379,12 +379,12 @@ void Scene02::run() { else _vm->_gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_vm->_timers[5] && _s02_nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { if (_vm->getRandom(6) != 0) { - _s02_nextChickenSequenceId = 0x14B; + _nextChickenSequenceId = 0x14B; _vm->_timers[5] = _vm->getRandom(20) + 30; } else { - _s02_nextChickenSequenceId = 0x14D; + _nextChickenSequenceId = 0x14D; _vm->_timers[5] = _vm->getRandom(20) + 50; } } @@ -406,14 +406,14 @@ void Scene02::run() { void Scene02::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { - case kASUseTruckNoKeys: + case kAS02UseTruckNoKeys: _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(0x14E, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x14E; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASUseTruckNoKeysDone; + _vm->_gnapActionStatus = kAS02UseTruckNoKeysDone; break; - case kASUseGasWithTruck: + case kAS02UseGasWithTruck: _vm->_gameSys->insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(0x151, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x151; @@ -421,9 +421,9 @@ void Scene02::updateAnimations() { _vm->invRemove(kItemGas); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFTruckFilledWithGas); - _vm->_gnapActionStatus = kASUseGasWithTruckDone; + _vm->_gnapActionStatus = kAS02UseGasWithTruckDone; break; - case kASUseTruckGas: + case kAS02UseTruckGas: _vm->_timers[5] = 9999; _vm->_timers[4] = 9999; _vm->hideCursor(); @@ -440,7 +440,7 @@ void Scene02::updateAnimations() { _vm->_newSceneNum = 47; _vm->_sceneDone = true; break; - case kASUseTruckNoGas: + case kAS02UseTruckNoGas: _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->_timers[4] = 250; @@ -457,54 +457,54 @@ void Scene02::updateAnimations() { _vm->_sceneDone = true; _vm->setFlag(kGFUnk25); break; - case kASGrabTruckGrill: - switch (_s02_truckGrillCtr) { + case kAS02GrabTruckGrill: + switch (_truckGrillCtr) { case 0: - _s02_gnapTruckSequenceId = 0x158; + _gnapTruckSequenceId = 0x158; break; case 1: - _s02_gnapTruckSequenceId = 0x159; + _gnapTruckSequenceId = 0x159; break; case 2: - _s02_gnapTruckSequenceId = 0x157; + _gnapTruckSequenceId = 0x157; break; } - _s02_truckGrillCtr = (_s02_truckGrillCtr + 1) % 3; - _vm->_gameSys->insertSequence(_s02_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s02_gnapTruckSequenceId, _vm->_gnapId, 0); - _vm->_gnapSequenceId = _s02_gnapTruckSequenceId; + _truckGrillCtr = (_truckGrillCtr + 1) % 3; + _vm->_gameSys->insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); + _vm->_gnapSequenceId = _gnapTruckSequenceId; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; break; - case kASLeaveScene: + case kAS02LeaveScene: _vm->_sceneDone = true; break; - case kASTalkChicken: - _s02_nextChickenSequenceId = 0x14C; + case kAS02TalkChicken: + _nextChickenSequenceId = 0x14C; break; - case kASGrabChicken: - _s02_nextChickenSequenceId = 0x150; + case kAS02GrabChicken: + _nextChickenSequenceId = 0x150; _vm->_timers[2] = 100; break; - case kASGrabChickenDone: + case kAS02GrabChickenDone: _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _s02_currChickenSequenceId = 0x14B; + _currChickenSequenceId = 0x14B; _vm->_gameSys->setAnimation(0x14B, 179, 2); - _vm->_gameSys->insertSequence(_s02_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; _vm->_timers[5] = 30; break; - case kASUseTwigWithChicken: + case kAS02UseTwigWithChicken: _vm->playGnapShowItem(5, 0, 0); - _vm->_gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); - _s02_currChickenSequenceId = 0x155; - _s02_nextChickenSequenceId = -1; + _vm->_gameSys->insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); + _currChickenSequenceId = 0x155; + _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; break; - case kASUseTruckNoKeysDone: - case kASUseGasWithTruckDone: + case kAS02UseTruckNoKeysDone: + case kAS02UseGasWithTruckDone: default: _vm->_gnapActionStatus = -1; break; @@ -512,25 +512,25 @@ void Scene02::updateAnimations() { } if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s02_nextChickenSequenceId == 0x150) { - _vm->_gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_s02_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_s02_currChickenSequenceId, 179, true); - _s02_nextChickenSequenceId = -1; - _s02_currChickenSequenceId = -1; - _vm->_gnapActionStatus = kASGrabChickenDone; + if (_nextChickenSequenceId == 0x150) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + _nextChickenSequenceId = -1; + _currChickenSequenceId = -1; + _vm->_gnapActionStatus = kAS02GrabChickenDone; _vm->_timers[5] = 500; - } else if (_s02_nextChickenSequenceId == 0x14C) { - _vm->_gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _s02_currChickenSequenceId = _s02_nextChickenSequenceId; - _s02_nextChickenSequenceId = -1; + } else if (_nextChickenSequenceId == 0x14C) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; - } else if (_s02_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_s02_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_s02_nextChickenSequenceId, 179, _s02_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _s02_currChickenSequenceId = _s02_nextChickenSequenceId; - _s02_nextChickenSequenceId = -1; + } else if (_nextChickenSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; } } } diff --git a/engines/gnap/scenes/scene02.h b/engines/gnap/scenes/scene02.h index d9c341ce45..187f24d35a 100644 --- a/engines/gnap/scenes/scene02.h +++ b/engines/gnap/scenes/scene02.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {} private: - int _s02_truckGrillCtr; - int _s02_nextChickenSequenceId; - int _s02_currChickenSequenceId; - int _s02_gnapTruckSequenceId; + int _truckGrillCtr; + int _nextChickenSequenceId; + int _currChickenSequenceId; + int _gnapTruckSequenceId; }; } // End of namespace Gnap -- cgit v1.2.3 From ffb93fa214ae0550a5afd571b9fe998dcb856fb7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 26 Apr 2016 22:55:09 +0200 Subject: GNAP: Prepare the merge of scene group 0 (WIP 2) --- engines/gnap/scenes/scene03.cpp | 226 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene03.h | 10 +- engines/gnap/scenes/scene04.cpp | 202 +++++++++++++++++------------------ engines/gnap/scenes/scene04.h | 8 +- 4 files changed, 223 insertions(+), 223 deletions(-) diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 2bcbe40a8f..3c35ee32bd 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -27,36 +27,36 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSGrass = 1, - kHSExitTruck = 2, - kHSCreek = 3, - kHSTrappedPlatypus = 4, - kHSDevice = 5, - kHSWalkAreas1 = 6, - kHSWalkAreas2 = 7, - kHSPlatypusWalkArea = 8, - kHSWalkAreas3 = 9 + kHS03Platypus = 0, + kHS03Grass = 1, + kHS03ExitTruck = 2, + kHS03Creek = 3, + kHS03TrappedPlatypus = 4, + kHS03Device = 5, + kHS03WalkAreas1 = 6, + kHS03WalkAreas2 = 7, + kHS03PlatypusWalkArea = 8, + kHS03WalkAreas3 = 9 }; enum { - kASLeaveScene = 0, - kASFreePlatypus = 1, - kASHypnotizePlat = 2, - kASHypnotizeScaredPlat = 3, - kASFreePlatypusDone = 4, - kASGrabPlatypus = 5, - kASGrabCreek = 6, - kASGrabCreekDone = 7, - kASGrabScaredPlatypus = 8 + kAS03LeaveScene = 0, + kAS03FreePlatypus = 1, + kAS03HypnotizePlat = 2, + kAS03HypnotizeScaredPlat= 3, + kAS03FreePlatypusDone = 4, + kAS03GrabPlatypus = 5, + kAS03GrabCreek = 6, + kAS03GrabCreekDone = 7, + kAS03GrabScaredPlatypus = 8 }; Scene03::Scene03(GnapEngine *vm) : Scene(vm) { - _s03_nextPlatSequenceId = -1; - _s03_platypusScared = false; - _s03_platypusHypnotized = false; - _s03_nextFrogSequenceId = -1; - _s03_currFrogSequenceId = -1; + _nextPlatSequenceId = -1; + _platypusScared = false; + _platypusHypnotized = false; + _nextFrogSequenceId = -1; + _currFrogSequenceId = -1; } int Scene03::init() { @@ -67,24 +67,24 @@ int Scene03::init() { } void Scene03::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSGrass, 646, 408, 722, 458, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); - _vm->setHotspot(kHSExitTruck, 218, 64, 371, 224, SF_EXIT_U_CURSOR | SF_WALKABLE, 4, 4); - _vm->setHotspot(kHSCreek, 187, 499, 319, 587, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHSTrappedPlatypus, 450, 256, 661, 414, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 5); - _vm->setHotspot(kHSWalkAreas1, 0, 500, 300, 600); - _vm->setHotspot(kHSWalkAreas2, 300, 447, 800, 600); - _vm->setHotspot(kHSPlatypusWalkArea, 235, 0, 800, 600); - _vm->setHotspot(kHSWalkAreas3, 0, 0, 800, 354); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS03Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS03Grass, 646, 408, 722, 458, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + _vm->setHotspot(kHS03ExitTruck, 218, 64, 371, 224, SF_EXIT_U_CURSOR | SF_WALKABLE, 4, 4); + _vm->setHotspot(kHS03Creek, 187, 499, 319, 587, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS03TrappedPlatypus, 450, 256, 661, 414, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 5); + _vm->setHotspot(kHS03WalkAreas1, 0, 500, 300, 600); + _vm->setHotspot(kHS03WalkAreas2, 300, 447, 800, 600); + _vm->setHotspot(kHS03PlatypusWalkArea, 235, 0, 800, 600); + _vm->setHotspot(kHS03WalkAreas3, 0, 0, 800, 354); + _vm->setDeviceHotspot(kHS03Device, -1, -1, -1, -1); if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspots[kHS03Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->isFlag(kGFGrassTaken)) - _vm->_hotspots[kHSGrass]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspots[kHS03Grass]._flags = SF_WALKABLE | SF_DISABLED; if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSTrappedPlatypus]._flags = SF_DISABLED; - if (_vm->isFlag(kGFPlatypus) || _s03_platypusHypnotized) - _vm->_hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; + _vm->_hotspots[kHS03TrappedPlatypus]._flags = SF_DISABLED; + if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) + _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; _vm->_hotspotsCount = 10; } @@ -95,14 +95,14 @@ void Scene03::run() { _vm->_gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); - _s03_platypusHypnotized = false; + _platypusHypnotized = false; _vm->initGnapPos(3, 4, kDirBottomRight); _vm->_gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); - _s03_currFrogSequenceId = 0x1C6; - _s03_nextFrogSequenceId = -1; + _currFrogSequenceId = 0x1C6; + _nextFrogSequenceId = -1; _vm->_gameSys->setAnimation(0x1C6, 253, 2); _vm->_timers[6] = _vm->getRandom(20) + 30; @@ -140,7 +140,7 @@ void Scene03::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSPlatypus: + case kHS03Platypus: if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); @@ -169,7 +169,7 @@ void Scene03::run() { } break; - case kHSGrass: + case kHS03Grass: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -185,7 +185,7 @@ void Scene03::run() { _vm->playGnapUseDevice(0, 0); _vm->_gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(0x1B3, 253, 5); - _vm->_hotspots[kHSGrass]._flags |= SF_WALKABLE | SF_DISABLED; + _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -196,15 +196,15 @@ void Scene03::run() { } break; - case kHSExitTruck: + case kHS03ExitTruck: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; + _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, -1, 0x107C2, 1); - _vm->_hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; + _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 2; else @@ -212,7 +212,7 @@ void Scene03::run() { } break; - case kHSCreek: + case kHS03Creek: if (_vm->_gnapActionStatus == -1) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); @@ -223,11 +223,11 @@ void Scene03::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSPlatypusWalkArea]._flags |= SF_WALKABLE; + _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) - _vm->_gnapActionStatus = kASGrabCreek; + _vm->_gnapActionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSPlatypusWalkArea]._flags &= ~SF_WALKABLE; + _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -238,7 +238,7 @@ void Scene03::run() { } break; - case kHSTrappedPlatypus: + case kHS03TrappedPlatypus: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -250,27 +250,27 @@ void Scene03::run() { _vm->playGnapScratchingHead(8, 4); break; case GRAB_CURSOR: - if (_s03_platypusHypnotized) { + if (_platypusHypnotized) { _vm->gnapWalkTo(7, 6, 0, 0x107B5, 1); - _vm->_gnapActionStatus = kASFreePlatypus; + _vm->_gnapActionStatus = kAS03FreePlatypus; } else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - if (_s03_platypusScared) - _vm->_gnapActionStatus = kASGrabScaredPlatypus; + if (_platypusScared) + _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnapActionStatus = kASGrabPlatypus; + _vm->_gnapActionStatus = kAS03GrabPlatypus; } break; case TALK_CURSOR: - if (_s03_platypusHypnotized) { + if (_platypusHypnotized) { _vm->playGnapBrainPulsating(8, 4); } else { _vm->_gnapIdleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - if (_s03_platypusScared) - _vm->_gnapActionStatus = kASHypnotizeScaredPlat; + if (_platypusScared) + _vm->_gnapActionStatus = kAS03HypnotizeScaredPlat; else - _vm->_gnapActionStatus = kASHypnotizePlat; + _vm->_gnapActionStatus = kAS03HypnotizePlat; } break; case PLAT_CURSOR: @@ -281,30 +281,30 @@ void Scene03::run() { } break; - case kHSDevice: + case kHS03Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; - case kHSWalkAreas1: - case kHSWalkAreas2: - case kHSWalkAreas3: + case kHS03WalkAreas1: + case kHS03WalkAreas2: + case kHS03WalkAreas3: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - case kHSPlatypusWalkArea: + case kHS03PlatypusWalkArea: if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatypus) || _s03_platypusHypnotized) { + if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107B5, 1); - if (_s03_platypusScared) - _vm->_gnapActionStatus = kASGrabScaredPlatypus; + if (_platypusScared) + _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnapActionStatus = kASGrabPlatypus; + _vm->_gnapActionStatus = kAS03GrabPlatypus; } } break; @@ -328,18 +328,18 @@ void Scene03::run() { _vm->updatePlatypusIdleSequence(); if (_vm->_gnapActionStatus < 0) _vm->updateGnapIdleSequence(); - if (!_vm->_timers[1] && !_s03_platypusScared) { + if (!_vm->_timers[1] && !_platypusScared) { _vm->_timers[1] = _vm->getRandom(40) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_s03_platypusHypnotized) - _s03_nextPlatSequenceId = 450; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) + _nextPlatSequenceId = 450; } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s03_nextFrogSequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextFrogSequenceId == -1) { if (_vm->getRandom(5) == 1) - _s03_nextFrogSequenceId = 0x1C6; + _nextFrogSequenceId = 0x1C6; else - _s03_nextFrogSequenceId = 0x1C7; + _nextFrogSequenceId = 0x1C7; } } if (!_vm->_timers[4]) { @@ -377,13 +377,13 @@ void Scene03::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLeaveScene: + case kAS03LeaveScene: _vm->_sceneDone = true; break; - case kASFreePlatypus: - _s03_nextPlatSequenceId = 0x1BC; + case kAS03FreePlatypus: + _nextPlatSequenceId = 0x1BC; break; - case kASFreePlatypusDone: + case kAS03FreePlatypusDone: _vm->_gnapActionStatus = -1; _vm->_platX = 6; _vm->_platY = 6; @@ -395,10 +395,10 @@ void Scene03::updateAnimations() { _vm->_platypusSequenceDatNum = 1; _vm->_platypusSequenceId = 0x7CA; _vm->setFlag(kGFPlatypus); - _s03_nextPlatSequenceId = -1; + _nextPlatSequenceId = -1; updateHotspots(); break; - case kASHypnotizePlat: + case kAS03HypnotizePlat: _vm->playGnapBrainPulsating(0, 0); _vm->addFullScreenSprite(0x106, 255); _vm->_gameSys->setAnimation(0x1C9, 256, 1); @@ -411,10 +411,10 @@ void Scene03::updateAnimations() { _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; _vm->_gnapActionStatus = -1; - _s03_platypusHypnotized = true; + _platypusHypnotized = true; updateHotspots(); break; - case kASHypnotizeScaredPlat: + case kAS03HypnotizeScaredPlat: _vm->playGnapBrainPulsating(0, 0); _vm->_gameSys->insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _vm->_gameSys->setAnimation(0x1BF, 99, 1); @@ -431,23 +431,23 @@ void Scene03::updateAnimations() { _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; _vm->_gnapActionStatus = -1; - _s03_platypusHypnotized = true; + _platypusHypnotized = true; updateHotspots(); break; - case kASGrabPlatypus: - _s03_nextPlatSequenceId = 0x1BD; - _s03_platypusHypnotized = false; + case kAS03GrabPlatypus: + _nextPlatSequenceId = 0x1BD; + _platypusHypnotized = false; break; - case kASGrabScaredPlatypus: - _s03_nextPlatSequenceId = 0x1C0; - _s03_platypusHypnotized = false; + case kAS03GrabScaredPlatypus: + _nextPlatSequenceId = 0x1C0; + _platypusHypnotized = false; break; - case kASGrabCreek: + case kAS03GrabCreek: _vm->_gameSys->insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(0x1B4, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x1B4; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASGrabCreekDone; + _vm->_gnapActionStatus = kAS03GrabCreekDone; break; default: _vm->_gnapActionStatus = -1; @@ -456,20 +456,20 @@ void Scene03::updateAnimations() { } if (_vm->_gameSys->getAnimationStatus(1) == 2) { - if (_s03_nextPlatSequenceId == 0x1BD || _s03_nextPlatSequenceId == 0x1C0) { + if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { _vm->_gameSys->setAnimation(0, 0, 1); - _s03_platypusScared = true; + _platypusScared = true; _vm->_gameSys->insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_s03_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x1B5; _vm->_gnapSequenceDatNum = 0; _vm->_gnapIdleFacing = kDirNone; - _vm->_platypusSequenceId = _s03_nextPlatSequenceId; + _vm->_platypusSequenceId = _nextPlatSequenceId; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_s03_nextPlatSequenceId, 99, 1); - _s03_nextPlatSequenceId = -1; + _vm->_gameSys->setAnimation(_nextPlatSequenceId, 99, 1); + _nextPlatSequenceId = -1; _vm->_gnapActionStatus = -1; - } else if (_s03_nextPlatSequenceId == 0x1BC) { + } else if (_nextPlatSequenceId == 0x1BC) { _vm->_gnapX = 3; _vm->_gnapY = 6; _vm->_gameSys->insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -479,30 +479,30 @@ void Scene03::updateAnimations() { _vm->_gnapSequenceId = 0x1B6; _vm->_gnapSequenceDatNum = 0; _vm->_gnapIdleFacing = kDirNone; - _vm->_gnapActionStatus = kASFreePlatypusDone; - _s03_nextPlatSequenceId = -1; - } else if (_s03_nextPlatSequenceId == 0x1C2 && !_s03_platypusScared) { + _vm->_gnapActionStatus = kAS03FreePlatypusDone; + _nextPlatSequenceId = -1; + } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { _vm->_gameSys->setAnimation(0, 0, 1); _vm->_gameSys->insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x1C2; _vm->_platypusSequenceDatNum = 0; _vm->_gameSys->setAnimation(0x1C2, 99, 1); - _s03_nextPlatSequenceId = -1; - } else if (_s03_nextPlatSequenceId == -1 && _s03_platypusScared && !_s03_platypusHypnotized) { + _nextPlatSequenceId = -1; + } else if (_nextPlatSequenceId == -1 && _platypusScared && !_platypusHypnotized) { _vm->_gameSys->setAnimation(0, 0, 1); _vm->_gameSys->setAnimation(0x1BE, 99, 1); _vm->_gameSys->insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x1BE; _vm->_platypusSequenceDatNum = 0; - _s03_nextPlatSequenceId = -1; + _nextPlatSequenceId = -1; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s03_nextFrogSequenceId != -1) { - _vm->_gameSys->setAnimation(_s03_nextFrogSequenceId, 253, 2); - _vm->_gameSys->insertSequence(_s03_nextFrogSequenceId, 253, _s03_currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); - _s03_currFrogSequenceId = _s03_nextFrogSequenceId; - _s03_nextFrogSequenceId = -1; + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextFrogSequenceId, 253, 2); + _vm->_gameSys->insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); + _currFrogSequenceId = _nextFrogSequenceId; + _nextFrogSequenceId = -1; } if (_vm->_gameSys->getAnimationStatus(5) == 2) { diff --git a/engines/gnap/scenes/scene03.h b/engines/gnap/scenes/scene03.h index e8a7ccf716..aac06ccac2 100644 --- a/engines/gnap/scenes/scene03.h +++ b/engines/gnap/scenes/scene03.h @@ -42,11 +42,11 @@ public: virtual void updateAnimationsCb() {} private: - bool _s03_platypusHypnotized; - bool _s03_platypusScared; - int _s03_nextPlatSequenceId; - int _s03_nextFrogSequenceId; - int _s03_currFrogSequenceId; + bool _platypusHypnotized; + bool _platypusScared; + int _nextPlatSequenceId; + int _nextFrogSequenceId; + int _currFrogSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp index 299656c226..d61ceac57e 100644 --- a/engines/gnap/scenes/scene04.cpp +++ b/engines/gnap/scenes/scene04.cpp @@ -28,38 +28,38 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSTwig = 1, - kHSDog = 2, - kHSAxe = 3, - kHSDoor = 4, - kHSExitTruck = 5, - kHSDevice = 6, - kHSWindow = 7, - kHSExitBarn = 8, - kHSWalkArea1 = 9, - kHSWalkArea2 = 10 + kHS04Platypus = 0, + kHS04Twig = 1, + kHS04Dog = 2, + kHS04Axe = 3, + kHS04Door = 4, + kHS04ExitTruck = 5, + kHS04Device = 6, + kHS04Window = 7, + kHS04ExitBarn = 8, + kHS04WalkArea1 = 9, + kHS04WalkArea2 = 10 }; enum { - kASOpenDoor = 1, - kASGetKeyFirst = 2, - kASGetKeyAnother = 3, - kASLeaveScene = 4, - kASGetKeyFirstDone = 6, - kASGetKeyFirst2 = 7, - kASGetKeyAnother2 = 8, - kASGetKeyAnotherDone = 9, - kASOpenDoorDone = 10, - kASGrabDog = 12, - kASGrabAxe = 13 + kAS04OpenDoor = 1, + kAS04GetKeyFirst = 2, + kAS04GetKeyAnother = 3, + kAS04LeaveScene = 4, + kAS04GetKeyFirstDone = 6, + kAS04GetKeyFirst2 = 7, + kAS04GetKeyAnother2 = 8, + kAS04GetKeyAnotherDone = 9, + kAS04OpenDoorDone = 10, + kAS04GrabDog = 12, + kAS04GrabAxe = 13 }; Scene04::Scene04(GnapEngine *vm) : Scene(vm) { - _s04_dogIdCtr = 0; - _s04_triedWindow = false; - _s04_nextDogSequenceId = -1; - _s04_currDogSequenceId = -1; + _dogIdCtr = 0; + _triedWindow = false; + _nextDogSequenceId = -1; + _currDogSequenceId = -1; } int Scene04::init() { @@ -70,23 +70,23 @@ int Scene04::init() { } void Scene04::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSTwig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); - _vm->setHotspot(kHSDog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - _vm->setHotspot(kHSAxe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - _vm->setHotspot(kHSDoor, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - _vm->setHotspot(kHSExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSWindow, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHSExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 562, 461); - _vm->setHotspot(kHSWalkArea2, 562, 0, 800, 500); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS04Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS04Twig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + _vm->setHotspot(kHS04Dog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHS04Axe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHS04Door, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHS04ExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS04Window, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS04ExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); + _vm->setHotspot(kHS04WalkArea1, 0, 0, 562, 461); + _vm->setHotspot(kHS04WalkArea2, 562, 0, 800, 500); + _vm->setDeviceHotspot(kHS04Device, -1, -1, -1, -1); if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspots[kHS04Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->isFlag(kGFTwigTaken)) - _vm->_hotspots[kHSTwig]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspots[kHS04Twig]._flags = SF_WALKABLE | SF_DISABLED; if (_vm->isFlag(kGFPlatypusTalkingToAssistant) || _vm->_cursorValue == 1) - _vm->_hotspots[kHSAxe]._flags = SF_DISABLED; + _vm->_hotspots[kHS04Axe]._flags = SF_DISABLED; _vm->_hotspotsCount = 11; } @@ -94,13 +94,13 @@ void Scene04::run() { _vm->playSound(0x1091C, true); _vm->startSoundTimerC(4); - _vm->_gameSys->insertSequence(0x210, 139 - _s04_dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x210, 139 - _dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); - _s04_currDogSequenceId = 0x210; - _s04_nextDogSequenceId = -1; + _currDogSequenceId = 0x210; + _nextDogSequenceId = -1; - _vm->_gameSys->setAnimation(0x210, 139 - _s04_dogIdCtr, 3); - _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; + _vm->_gameSys->setAnimation(0x210, 139 - _dogIdCtr, 3); + _dogIdCtr = (_dogIdCtr + 1) % 2; _vm->_timers[6] = _vm->getRandom(20) + 60; _vm->_timers[5] = _vm->getRandom(150) + 300; _vm->_timers[7] = _vm->getRandom(150) + 200; @@ -174,14 +174,14 @@ void Scene04::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSDevice: + case kHS04Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; - case kHSPlatypus: + case kHS04Platypus: if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); @@ -213,7 +213,7 @@ void Scene04::run() { } break; - case kHSTwig: + case kHS04Twig: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); @@ -237,7 +237,7 @@ void Scene04::run() { } break; - case kHSAxe: + case kHS04Axe: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); @@ -249,7 +249,7 @@ void Scene04::run() { case GRAB_CURSOR: _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabAxe; + _vm->_gnapActionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); break; @@ -262,7 +262,7 @@ void Scene04::run() { } break; - case kHSDog: + case kHS04Dog: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); @@ -271,19 +271,19 @@ void Scene04::run() { case LOOK_CURSOR: if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); - _s04_nextDogSequenceId = 0x20F; + _nextDogSequenceId = 0x20F; } break; case GRAB_CURSOR: _vm->_gnapIdleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kASGrabDog; + _vm->_gnapActionStatus = kAS04GrabDog; break; case TALK_CURSOR: _vm->_gnapIdleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); - _s04_nextDogSequenceId = 0x20E; + _nextDogSequenceId = 0x20E; } break; case PLAT_CURSOR: @@ -294,7 +294,7 @@ void Scene04::run() { } break; - case kHSDoor: + case kHS04Door: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); @@ -307,13 +307,13 @@ void Scene04::run() { case GRAB_CURSOR: if (_vm->_cursorValue == 1) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASOpenDoor; + _vm->_gnapActionStatus = kAS04OpenDoor; _vm->_timers[5] = 300; _vm->_gnapIdleFacing = kDirUpLeft; } else { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS04LeaveScene; _vm->_newSceneNum = 38; } break; @@ -325,11 +325,11 @@ void Scene04::run() { } break; - case kHSExitTruck: + case kHS04ExitTruck: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -339,7 +339,7 @@ void Scene04::run() { } break; - case kHSWindow: + case kHS04Window: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); @@ -349,11 +349,11 @@ void Scene04::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { - if (_s04_triedWindow) { - _vm->_gnapActionStatus = kASGetKeyAnother; + if (_triedWindow) { + _vm->_gnapActionStatus = kAS04GetKeyAnother; } else { - _vm->_gnapActionStatus = kASGetKeyFirst; - _s04_triedWindow = true; + _vm->_gnapActionStatus = kAS04GetKeyFirst; + _triedWindow = true; } } break; @@ -369,11 +369,11 @@ void Scene04::run() { } break; - case kHSExitBarn: + case kHS04ExitBarn: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); if (_vm->_cursorValue == 1) @@ -383,8 +383,8 @@ void Scene04::run() { } break; - case kHSWalkArea1: - case kHSWalkArea2: + case kHS04WalkArea1: + case kHS04WalkArea2: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -419,8 +419,8 @@ void Scene04::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 60; - if (_s04_nextDogSequenceId == -1) - _s04_nextDogSequenceId = 0x210; + if (_nextDogSequenceId == -1) + _nextDogSequenceId = 0x210; } if (!_vm->_timers[8]) { _vm->_timers[8] = _vm->getRandom(150) + 400; @@ -445,10 +445,10 @@ void Scene04::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLeaveScene: + case kAS04LeaveScene: _vm->_sceneDone = true; break; - case kASOpenDoor: + case kAS04OpenDoor: _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); _vm->_gnapX = 6; @@ -459,29 +459,29 @@ void Scene04::updateAnimations() { _vm->_gameSys->setAnimation(0x107B5, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _vm->_gnapActionStatus = kASOpenDoorDone; + _vm->_gnapActionStatus = kAS04OpenDoorDone; break; - case kASOpenDoorDone: + case kAS04OpenDoorDone: _vm->_gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = -1; break; - case kASGetKeyFirst: + case kAS04GetKeyFirst: _vm->_gameSys->insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(0x204, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x204; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASGetKeyFirst2; + _vm->_gnapActionStatus = kAS04GetKeyFirst2; break; - case kASGetKeyFirst2: + case kAS04GetKeyFirst2: _vm->_gameSys->insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->setAnimation(0x20B, 256, 0); _vm->_gnapSequenceId = 0x206; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASGetKeyFirstDone; + _vm->_gnapActionStatus = kAS04GetKeyFirstDone; break; - case kASGetKeyFirstDone: + case kAS04GetKeyFirstDone: _vm->_gameSys->requestRemoveSequence(0x1FF, 256); _vm->_gameSys->requestRemoveSequence(0x20B, 256); _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, @@ -492,23 +492,23 @@ void Scene04::updateAnimations() { _vm->_gnapSequenceDatNum = 1; _vm->_gnapActionStatus = -1; break; - case kASGetKeyAnother: + case kAS04GetKeyAnother: _vm->_gameSys->insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(0x202, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x202; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASGetKeyAnother2; + _vm->_gnapActionStatus = kAS04GetKeyAnother2; break; - case kASGetKeyAnother2: + case kAS04GetKeyAnother2: _vm->_gameSys->insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->setAnimation(0x20A, 256, 0); _vm->_gnapSequenceId = 0x203; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASGetKeyAnotherDone; + _vm->_gnapActionStatus = kAS04GetKeyAnotherDone; break; - case kASGetKeyAnotherDone: + case kAS04GetKeyAnotherDone: _vm->_gameSys->removeSequence(0x1FF, 256, true); _vm->_gameSys->removeSequence(0x20A, 256, true); _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, @@ -519,10 +519,10 @@ void Scene04::updateAnimations() { _vm->_gnapIdleFacing = kDirBottomRight; _vm->_gnapActionStatus = -1; break; - case kASGrabDog: - _s04_nextDogSequenceId = 0x201; + case kAS04GrabDog: + _nextDogSequenceId = 0x201; break; - case kASGrabAxe: + case kAS04GrabAxe: _vm->_gameSys->insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->requestRemoveSequence(0x212, 100); _vm->_gnapSequenceDatNum = 0; @@ -544,27 +544,27 @@ void Scene04::updateAnimations() { } if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_s04_nextDogSequenceId == 0x201) { - _vm->_gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, - _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, + if (_nextDogSequenceId == 0x201) { + _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); - _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; - _s04_currDogSequenceId = 0x201; + _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + _dogIdCtr = (_dogIdCtr + 1) % 2; + _currDogSequenceId = 0x201; _vm->_gnapSequenceId = 0x200; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; _vm->_timers[6] = _vm->getRandom(20) + 60; - _s04_nextDogSequenceId = -1; - } else if (_s04_nextDogSequenceId != -1) { - _vm->_gameSys->insertSequence(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, - _s04_currDogSequenceId, 139 - (_s04_dogIdCtr + 1) % 2, + _nextDogSequenceId = -1; + } else if (_nextDogSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s04_nextDogSequenceId, 139 - _s04_dogIdCtr, 3); - _s04_dogIdCtr = (_s04_dogIdCtr + 1) % 2; - _s04_currDogSequenceId = _s04_nextDogSequenceId; - _s04_nextDogSequenceId = -1; + _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + _dogIdCtr = (_dogIdCtr + 1) % 2; + _currDogSequenceId = _nextDogSequenceId; + _nextDogSequenceId = -1; } } } diff --git a/engines/gnap/scenes/scene04.h b/engines/gnap/scenes/scene04.h index 519799b48c..10b6964045 100644 --- a/engines/gnap/scenes/scene04.h +++ b/engines/gnap/scenes/scene04.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {} private: - bool _s04_triedWindow; - int _s04_dogIdCtr; - int _s04_nextDogSequenceId; - int _s04_currDogSequenceId; + bool _triedWindow; + int _dogIdCtr; + int _nextDogSequenceId; + int _currDogSequenceId; }; } // End of namespace Gnap -- cgit v1.2.3 From 9fc9de7882b04c633d6b551ef5ea437ecade26cd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 26 Apr 2016 23:16:19 +0200 Subject: GNAP: Prepare the merge of scene group 0 (WIP 3) --- engines/gnap/scenes/scene05.cpp | 162 +++++++++++++++++----------------- engines/gnap/scenes/scene05.h | 4 +- engines/gnap/scenes/scene06.cpp | 190 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene06.h | 8 +- 4 files changed, 182 insertions(+), 182 deletions(-) diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp index f28a37daa1..8046465cd0 100644 --- a/engines/gnap/scenes/scene05.cpp +++ b/engines/gnap/scenes/scene05.cpp @@ -28,33 +28,33 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSHaystack = 1, - kHSPadlock = 2, - kHSLadder = 3, - kHSExitHouse = 4, - kHSChicken = 5, - kHSDevice = 6, - kHSWalkArea1 = 7, - kHSWalkArea2 = 8, - kHSWalkArea3 = 9 + kHS05Platypus = 0, + kHS05Haystack = 1, + kHS05Padlock = 2, + kHS05Ladder = 3, + kHS05ExitHouse = 4, + kHS05Chicken = 5, + kHS05Device = 6, + kHS05WalkArea1 = 7, + kHS05WalkArea2 = 8, + kHS05WalkArea3 = 9 }; enum { - kASPlatSearchHaystack = 0, - kASTryPickPadlock = 1, - kASPickPadlock = 2, - kASTalkChicken = 3, - kASGrabChicken = 4, - kASGrabLadder = 5, - kASEnterBarn = 6, - kASUseTwigWithChicken = 11, - kASLeaveScene = 12 + kAS05PlatSearchHaystack = 0, + kAS05TryPickPadlock = 1, + kAS05PickPadlock = 2, + kAS05TalkChicken = 3, + kAS05GrabChicken = 4, + kAS05GrabLadder = 5, + kAS05EnterBarn = 6, + kAS05UseTwigWithChicken = 11, + kAS05LeaveScene = 12 }; Scene05::Scene05(GnapEngine *vm) : Scene(vm) { - _s05_nextChickenSequenceId = -1; - _s05_currChickenSequenceId = -1; + _nextChickenSequenceId = -1; + _currChickenSequenceId = -1; } int Scene05::init() { @@ -65,20 +65,20 @@ int Scene05::init() { } void Scene05::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSHaystack, 236, 366, 372, 442, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - _vm->setHotspot(kHSPadlock, 386, 230, 626, 481, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - _vm->setHotspot(kHSLadder, 108, 222, 207, 444, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSExitHouse, 0, 395, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSChicken, 612, 462, 722, 564, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSWalkArea1, 104, 0, 421, 480); - _vm->setHotspot(kHSWalkArea2, 422, 0, 800, 487); - _vm->setHotspot(kHSWalkArea3, 0, 0, 104, 499); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS05Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS05Haystack, 236, 366, 372, 442, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHS05Padlock, 386, 230, 626, 481, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHS05Ladder, 108, 222, 207, 444, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS05ExitHouse, 0, 395, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS05Chicken, 612, 462, 722, 564, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS05WalkArea1, 104, 0, 421, 480); + _vm->setHotspot(kHS05WalkArea2, 422, 0, 800, 487); + _vm->setHotspot(kHS05WalkArea3, 0, 0, 104, 499); + _vm->setDeviceHotspot(kHS05Device, -1, -1, -1, -1); if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspots[kHS05Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_hotspots[kHSPadlock]._flags = SF_EXIT_U_CURSOR; + _vm->_hotspots[kHS05Padlock]._flags = SF_EXIT_U_CURSOR; _vm->_hotspotsCount = 10; } @@ -86,11 +86,11 @@ void Scene05::run() { _vm->playSound(0x1091C, true); _vm->startSoundTimerC(7); - _s05_currChickenSequenceId = 0x142; + _currChickenSequenceId = 0x142; _vm->_gameSys->setAnimation(0x142, 100, 3); _vm->_gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); - _s05_nextChickenSequenceId = -1; + _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(10) + 30; _vm->_timers[6] = _vm->getRandom(150) + 300; @@ -125,14 +125,14 @@ void Scene05::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSDevice: + case kHS05Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; - case kHSPlatypus: + case kHS05Platypus: if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); @@ -161,7 +161,7 @@ void Scene05::run() { } break; - case kHSHaystack: + case kHS05Haystack: if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); @@ -180,7 +180,7 @@ void Scene05::run() { if (_vm->isFlag(kGFPlatypus)) { _vm->gnapUseDeviceOnPlatypuss(); if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { - _vm->_platypusActionStatus = kASPlatSearchHaystack; + _vm->_platypusActionStatus = kAS05PlatSearchHaystack; _vm->_platypusFacing = kDirUnk4; } if (_vm->_gnapX == 4 && (_vm->_gnapY == 8 || _vm->_gnapY == 7)) @@ -193,13 +193,13 @@ void Scene05::run() { } break; - case kHSChicken: + case kHS05Chicken: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASUseTwigWithChicken; + _vm->_gnapActionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); } else { @@ -210,12 +210,12 @@ void Scene05::run() { case GRAB_CURSOR: _vm->_gnapIdleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabChicken; + _vm->_gnapActionStatus = kAS05GrabChicken; break; case TALK_CURSOR: _vm->_gnapIdleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkChicken; + _vm->_gnapActionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -225,7 +225,7 @@ void Scene05::run() { } break; - case kHSLadder: + case kHS05Ladder: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); @@ -237,7 +237,7 @@ void Scene05::run() { case GRAB_CURSOR: _vm->_gnapIdleFacing = kDirBottomLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabLadder; + _vm->_gnapActionStatus = kAS05GrabLadder; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -248,11 +248,11 @@ void Scene05::run() { } break; - case kHSPadlock: + case kHS05Padlock: if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x - 1, _vm->_hotspotsWalkPos[2].y + 1, 0, -1, 1); - _vm->_gnapActionStatus = kASEnterBarn; + _vm->_gnapActionStatus = kAS05EnterBarn; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 6; else @@ -261,7 +261,7 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) - _vm->_gnapActionStatus = kASPickPadlock; + _vm->_gnapActionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); } else { @@ -273,7 +273,7 @@ void Scene05::run() { _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTryPickPadlock; + _vm->_gnapActionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -284,11 +284,11 @@ void Scene05::run() { } break; - case kHSExitHouse: + case kHS05ExitHouse: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -298,13 +298,13 @@ void Scene05::run() { } break; - case kHSWalkArea1: - case kHSWalkArea2: + case kHS05WalkArea1: + case kHS05WalkArea2: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - case kHSWalkArea3: + case kHS05WalkArea3: // Nothing break; @@ -328,11 +328,11 @@ void Scene05::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus != kASTalkChicken && _s05_nextChickenSequenceId == -1) { + if (_vm->_gnapActionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { if (_vm->getRandom(4) != 0) - _s05_nextChickenSequenceId = 0x142; + _nextChickenSequenceId = 0x142; else - _s05_nextChickenSequenceId = 0x143; + _nextChickenSequenceId = 0x143; } } if (!_vm->_timers[6]) { @@ -360,17 +360,17 @@ void Scene05::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLeaveScene: + case kAS05LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; - case kASTryPickPadlock: + case kAS05TryPickPadlock: _vm->_gameSys->insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x148; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; break; - case kASPickPadlock: + case kAS05PickPadlock: _vm->_gameSys->setAnimation(0x147, _vm->_gnapId, 0); _vm->_gameSys->insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x147; @@ -381,16 +381,16 @@ void Scene05::updateAnimations() { _vm->_newSceneNum = 6; _vm->_timers[2] = 100; _vm->invRemove(kItemNeedle); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS05LeaveScene; break; - case kASTalkChicken: - _s05_nextChickenSequenceId = 0x144; + case kAS05TalkChicken: + _nextChickenSequenceId = 0x144; _vm->_gnapActionStatus = -1; break; - case kASGrabChicken: - _s05_nextChickenSequenceId = 0x14B; + case kAS05GrabChicken: + _nextChickenSequenceId = 0x14B; break; - case kASGrabLadder: + case kAS05GrabLadder: while (_vm->_gameSys->isSequenceActive(0x149, 39)) _vm->gameUpdateTick(); _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); @@ -401,16 +401,16 @@ void Scene05::updateAnimations() { _vm->_timers[6] = 300; _vm->_gnapActionStatus = -1; break; - case kASEnterBarn: + case kAS05EnterBarn: _vm->_gameSys->insertSequence(0x107B1, 1, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gameSys->setAnimation(0x107B1, 1, 0); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS05LeaveScene; break; - case kASUseTwigWithChicken: + case kAS05UseTwigWithChicken: _vm->playGnapShowItem(5, 0, 0); - _s05_nextChickenSequenceId = 0x14F; + _nextChickenSequenceId = 0x14F; _vm->_gnapActionStatus = -1; break; } @@ -431,7 +431,7 @@ void Scene05::updateAnimations() { _vm->_timers[1] = 30; _vm->_platypusActionStatus = -1; } - if (_vm->_platypusActionStatus == kASPlatSearchHaystack) { + if (_vm->_platypusActionStatus == kAS05PlatSearchHaystack) { _vm->_gameSys->setAnimation(0, 0, 1); _vm->_gameSys->insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); @@ -445,20 +445,20 @@ void Scene05::updateAnimations() { } if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_s05_nextChickenSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + if (_nextChickenSequenceId == 0x14B) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x14C; - _s05_currChickenSequenceId = _s05_nextChickenSequenceId; - _s05_nextChickenSequenceId = -1; + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; - } else if (_s05_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_s05_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_s05_nextChickenSequenceId, 100, _s05_currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _s05_currChickenSequenceId = _s05_nextChickenSequenceId; - _s05_nextChickenSequenceId = -1; + } else if (_nextChickenSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; } } } diff --git a/engines/gnap/scenes/scene05.h b/engines/gnap/scenes/scene05.h index 083abe5f2d..a3be46b009 100644 --- a/engines/gnap/scenes/scene05.h +++ b/engines/gnap/scenes/scene05.h @@ -42,8 +42,8 @@ public: virtual void updateAnimationsCb() {} private: - int _s05_nextChickenSequenceId; - int _s05_currChickenSequenceId; + int _nextChickenSequenceId; + int _currChickenSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp index 3bd79fd1dd..aae5125bb7 100644 --- a/engines/gnap/scenes/scene06.cpp +++ b/engines/gnap/scenes/scene06.cpp @@ -28,33 +28,33 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSGas = 1, - kHSLadder = 2, - kHSHorse = 3, - kHSExitOutsideBarn = 4, - kHSDevice = 5, - kHSWalkArea1 = 6, - kHSWalkArea2 = 7, - kHSWalkArea3 = 8, - kHSWalkArea4 = 9, - kHSWalkArea5 = 10 + kHS06Platypus = 0, + kHS06Gas = 1, + kHS06Ladder = 2, + kHS06Horse = 3, + kHS06ExitOutsideBarn = 4, + kHS06Device = 5, + kHS06WalkArea1 = 6, + kHS06WalkArea2 = 7, + kHS06WalkArea3 = 8, + kHS06WalkArea4 = 9, + kHS06WalkArea5 = 10 }; enum { - kASTryToGetGas = 0, - kASTryToClimbLadder = 1, - kASTryToClimbLadderDone = 2, - kASTalkToHorse = 3, - kASUseTwigOnHorse = 4, - kASLeaveScene = 5 + kAS06TryToGetGas = 0, + kAS06TryToClimbLadder = 1, + kAS06TryToClimbLadderDone = 2, + kAS06TalkToHorse = 3, + kAS06UseTwigOnHorse = 4, + kAS06LeaveScene = 5 }; Scene06::Scene06(GnapEngine *vm) : Scene(vm) { - _s06_horseTurnedBack = false;; - _s06_nextPlatSequenceId = -1; - _s06_nextHorseSequenceId = -1; - _s06_currHorseSequenceId = -1; + _horseTurnedBack = false;; + _nextPlatSequenceId = -1; + _nextHorseSequenceId = -1; + _currHorseSequenceId = -1; } int Scene06::init() { @@ -69,22 +69,22 @@ int Scene06::init() { } void Scene06::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSGas, 300, 120, 440, 232, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSLadder, 497, 222, 614, 492, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - _vm->setHotspot(kHSHorse, 90, 226, 259, 376, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSExitOutsideBarn, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - _vm->setHotspot(kHSWalkArea1, 0, 0, 200, 515); - _vm->setHotspot(kHSWalkArea2, 200, 0, 285, 499); - _vm->setHotspot(kHSWalkArea3, 688, 0, 800, 499); - _vm->setHotspot(kHSWalkArea4, 475, 469, 800, 505); - _vm->setHotspot(kHSWalkArea5, 0, 0, 800, 504); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS06Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS06Gas, 300, 120, 440, 232, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS06Ladder, 497, 222, 614, 492, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHS06Horse, 90, 226, 259, 376, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS06ExitOutsideBarn, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHS06WalkArea1, 0, 0, 200, 515); + _vm->setHotspot(kHS06WalkArea2, 200, 0, 285, 499); + _vm->setHotspot(kHS06WalkArea3, 688, 0, 800, 499); + _vm->setHotspot(kHS06WalkArea4, 475, 469, 800, 505); + _vm->setHotspot(kHS06WalkArea5, 0, 0, 800, 504); + _vm->setDeviceHotspot(kHS06Device, -1, -1, -1, -1); if (_vm->isFlag(kGFGasTaken)) - _vm->_hotspots[kHSLadder]._flags = SF_DISABLED; + _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; if (_vm->_cursorValue == 4) { - _vm->_hotspots[kHSLadder]._flags = SF_DISABLED; - _vm->_hotspots[kHSGas]._flags = SF_DISABLED; + _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; + _vm->_hotspots[kHS06Gas]._flags = SF_DISABLED; } _vm->_hotspotsCount = 11; } @@ -94,11 +94,11 @@ void Scene06::run() { _vm->startSoundTimerC(7); - _s06_horseTurnedBack = false; + _horseTurnedBack = false; _vm->_gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); - _s06_currHorseSequenceId = 0xF1; - _s06_nextHorseSequenceId = -1; + _currHorseSequenceId = 0xF1; + _nextHorseSequenceId = -1; _vm->_gameSys->setAnimation(0xF1, 120, 2); _vm->_timers[4] = _vm->getRandom(40) + 25; @@ -130,14 +130,14 @@ void Scene06::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSDevice: + case kHS06Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; - case kHSPlatypus: + case kHS06Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); @@ -166,7 +166,7 @@ void Scene06::run() { } break; - case kHSGas: + case kHS06Gas: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); @@ -179,10 +179,10 @@ void Scene06::run() { if (_vm->isFlag(kGFUnk04)) { _vm->playGnapImpossible(0, 0); } else if (triedDeviceOnGas) { - _vm->_hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; + _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASTryToGetGas; + _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS06TryToGetGas; } else { triedDeviceOnGas = true; _vm->playGnapPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); @@ -200,7 +200,7 @@ void Scene06::run() { } break; - case kHSLadder: + case kHS06Ladder: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); @@ -214,7 +214,7 @@ void Scene06::run() { _vm->playGnapImpossible(0, 0); else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASTryToClimbLadder; + _vm->_gnapActionStatus = kAS06TryToClimbLadder; _vm->setFlag(kGFGasTaken); } break; @@ -227,16 +227,16 @@ void Scene06::run() { } break; - case kHSHorse: + case kHS06Horse: if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemTwig && _s06_horseTurnedBack) { - _vm->_hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; + if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { + _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; + _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnapIdleFacing = kDirUpLeft; _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); _vm->_platypusFacing = kDirNone; - _vm->_gnapActionStatus = kASUseTwigOnHorse; + _vm->_gnapActionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); @@ -246,14 +246,14 @@ void Scene06::run() { _vm->playGnapScratchingHead(3, 2); break; case TALK_CURSOR: - if (_s06_horseTurnedBack) { + if (_horseTurnedBack) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { _vm->_gnapIdleFacing = kDirBottomLeft; - _vm->_hotspots[kHSWalkArea5]._flags |= SF_WALKABLE; + _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_hotspots[kHSWalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASTalkToHorse; + _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS06TalkToHorse; } break; case GRAB_CURSOR: @@ -265,11 +265,11 @@ void Scene06::run() { } break; - case kHSExitOutsideBarn: + case kHS06ExitOutsideBarn: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS06LeaveScene; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; else @@ -277,11 +277,11 @@ void Scene06::run() { } break; - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: + case kHS06WalkArea1: + case kHS06WalkArea2: + case kHS06WalkArea3: + case kHS06WalkArea4: + case kHS06WalkArea5: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -304,21 +304,21 @@ void Scene06::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 25; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s06_nextHorseSequenceId == -1) { - if (_s06_horseTurnedBack) { - _s06_nextHorseSequenceId = 0xF5; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextHorseSequenceId == -1) { + if (_horseTurnedBack) { + _nextHorseSequenceId = 0xF5; } else { switch (_vm->getRandom(5)) { case 0: case 1: case 2: - _s06_nextHorseSequenceId = 0xF1; + _nextHorseSequenceId = 0xF1; break; case 3: - _s06_nextHorseSequenceId = 0xF3; + _nextHorseSequenceId = 0xF3; break; case 4: - _s06_nextHorseSequenceId = 0xF4; + _nextHorseSequenceId = 0xF4; break; } } @@ -343,34 +343,34 @@ void Scene06::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLeaveScene: + case kAS06LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; - case kASTryToGetGas: + case kAS06TryToGetGas: _vm->_gameSys->insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFC; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; break; - case kASTryToClimbLadder: + case kAS06TryToClimbLadder: _vm->_gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(0xFD, _vm->_gnapId, 0); _vm->_gameSys->insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFD; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASTryToClimbLadderDone; + _vm->_gnapActionStatus = kAS06TryToClimbLadderDone; break; - case kASTryToClimbLadderDone: + case kAS06TryToClimbLadderDone: _vm->_gnapX = 6; _vm->_gnapY = 7; _vm->_gnapActionStatus = -1; break; - case kASTalkToHorse: - _s06_nextHorseSequenceId = 0xF6; + case kAS06TalkToHorse: + _nextHorseSequenceId = 0xF6; break; - case kASUseTwigOnHorse: - _s06_nextPlatSequenceId = 0xFB; + case kAS06UseTwigOnHorse: + _nextPlatSequenceId = 0xFB; break; default: _vm->_gnapActionStatus = -1; @@ -384,7 +384,7 @@ void Scene06::updateAnimations() { _vm->_gameSys->setAnimation(0, 0, 1); _vm->invAdd(kItemGas); _vm->setFlag(kGFGasTaken); - _vm->_hotspots[kHSLadder]._flags = SF_DISABLED; + _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; _vm->setGrabCursorSprite(kItemGas); _vm->_platypusActionStatus = -1; _vm->_platX = 6; @@ -396,20 +396,20 @@ void Scene06::updateAnimations() { _vm->_gnapActionStatus = -1; _vm->showCursor(); } - if (_s06_nextPlatSequenceId == 0xFB) { + if (_nextPlatSequenceId == 0xFB) { _vm->_gameSys->setAnimation(0, 0, 1); - _s06_nextHorseSequenceId = 0xF2; + _nextHorseSequenceId = 0xF2; _vm->_platypusActionStatus = 6; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s06_nextHorseSequenceId != -1) { - switch (_s06_nextHorseSequenceId) { + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { + switch (_nextHorseSequenceId) { case 0xF2: _vm->setGrabCursorSprite(-1); _vm->hideCursor(); _vm->_gameSys->setAnimation(0xFA, 256, 1); - _vm->_gameSys->insertSequence(0xF2, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); @@ -420,24 +420,24 @@ void Scene06::updateAnimations() { kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B7; _vm->_gnapSequenceDatNum = 1; - _s06_currHorseSequenceId = _s06_nextHorseSequenceId; - _s06_nextHorseSequenceId = -1; - _s06_nextPlatSequenceId = -1; + _currHorseSequenceId = _nextHorseSequenceId; + _nextHorseSequenceId = -1; + _nextPlatSequenceId = -1; _vm->invRemove(kItemTwig); break; case 0xF6: - _vm->_gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(0xF6, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _s06_horseTurnedBack = true; - _s06_currHorseSequenceId = _s06_nextHorseSequenceId; - _s06_nextHorseSequenceId = -1; + _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); + _vm->_gameSys->insertSequence(0xF6, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _horseTurnedBack = true; + _currHorseSequenceId = _nextHorseSequenceId; + _nextHorseSequenceId = -1; _vm->_gnapActionStatus = -1; break; default: - _vm->_gameSys->setAnimation(_s06_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(_s06_nextHorseSequenceId, 120, _s06_currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _s06_currHorseSequenceId = _s06_nextHorseSequenceId; - _s06_nextHorseSequenceId = -1; + _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); + _vm->_gameSys->insertSequence(_nextHorseSequenceId, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _currHorseSequenceId = _nextHorseSequenceId; + _nextHorseSequenceId = -1; break; } } diff --git a/engines/gnap/scenes/scene06.h b/engines/gnap/scenes/scene06.h index 1f15be54f6..ff6ff9f14c 100644 --- a/engines/gnap/scenes/scene06.h +++ b/engines/gnap/scenes/scene06.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {} private: - bool _s06_horseTurnedBack; - int _s06_nextPlatSequenceId; - int _s06_nextHorseSequenceId; - int _s06_currHorseSequenceId; + bool _horseTurnedBack; + int _nextPlatSequenceId; + int _nextHorseSequenceId; + int _currHorseSequenceId; }; } // End of namespace Gnap -- cgit v1.2.3 From 0a1c36a26b6fb824f0dd862b05a5fa6dae0b3435 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 27 Apr 2016 07:10:20 +0200 Subject: GNAP: Prepare the merge of scene group 0 (End) --- engines/gnap/datarchive.cpp | 1 + engines/gnap/scenes/scene07.cpp | 54 ++++---- engines/gnap/scenes/scene08.cpp | 264 ++++++++++++++++++++-------------------- engines/gnap/scenes/scene08.h | 8 +- engines/gnap/scenes/scene09.cpp | 68 +++++------ engines/gnap/scenes/scene09.h | 2 - 6 files changed, 198 insertions(+), 199 deletions(-) diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp index a2de0b38e0..0eb6601ccb 100644 --- a/engines/gnap/datarchive.cpp +++ b/engines/gnap/datarchive.cpp @@ -83,6 +83,7 @@ DatManager::~DatManager() { void DatManager::open(int index, const char *filename) { close(index); _datArchives[index] = new DatArchive(filename); + warning("Loading %s - %d", filename, index); } void DatManager::close(int index) { diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp index 244e901947..41ddf4caf1 100644 --- a/engines/gnap/scenes/scene07.cpp +++ b/engines/gnap/scenes/scene07.cpp @@ -29,18 +29,18 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSExitHouse = 1, - kHSDice = 2, - kHSDevice = 3, - kHSWalkArea1 = 4, - kHSWalkArea2 = 5, - kHSWalkArea3 = 6 + kHS07Platypus = 0, + kHS07ExitHouse = 1, + kHS07Dice = 2, + kHS07Device = 3, + kHS07WalkArea1 = 4, + kHS07WalkArea2 = 5, + kHS07WalkArea3 = 6 }; enum { - kASWait = 0, - kASLeaveScene = 1 + kAS07Wait = 0, + kAS07LeaveScene = 1 }; Scene07::Scene07(GnapEngine *vm) : Scene(vm) { @@ -51,15 +51,15 @@ int Scene07::init() { } void Scene07::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); - _vm->setHotspot(kHSDice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 0, 0, 325, 445); - _vm->setHotspot(kHSWalkArea2, 325, 0, 799, 445, _vm->_isLeavingScene ? SF_WALKABLE : SF_NONE); - _vm->setHotspot(kHSWalkArea3, 160, 0, 325, 495); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS07Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS07ExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); + _vm->setHotspot(kHS07Dice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS07WalkArea1, 0, 0, 325, 445); + _vm->setHotspot(kHS07WalkArea2, 325, 0, 799, 445, _vm->_isLeavingScene ? SF_WALKABLE : SF_NONE); + _vm->setHotspot(kHS07WalkArea3, 160, 0, 325, 495); + _vm->setDeviceHotspot(kHS07Device, -1, -1, -1, -1); if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHSDice]._flags = SF_DISABLED; + _vm->_hotspots[kHS07Dice]._flags = SF_DISABLED; _vm->_hotspotsCount = 7; } @@ -87,7 +87,7 @@ void Scene07::run() { _vm->_gnapIdleFacing = kDirBottomRight; _vm->_gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASWait; + _vm->_gnapActionStatus = kAS07Wait; _vm->_platX = 3; _vm->_platY = 8; _vm->_platypusId = 160; @@ -115,7 +115,7 @@ void Scene07::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSPlatypus: + case kHS07Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapMoan1(_vm->_platX, _vm->_platY); @@ -132,16 +132,16 @@ void Scene07::run() { } break; - case kHSExitHouse: + case kHS07ExitHouse: _vm->_isLeavingScene = true; if (_vm->_gnapX > 8) _vm->gnapWalkTo(_vm->_gnapX, 7, 0, 0x107AD, 1); else _vm->gnapWalkTo(8, 7, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS07LeaveScene; break; - case kHSDice: + case kHS07Dice: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 8, 3, 3); } else { @@ -169,7 +169,7 @@ void Scene07::run() { } break; - case kHSDevice: + case kHS07Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); @@ -177,12 +177,12 @@ void Scene07::run() { } break; - case kHSWalkArea1: - case kHSWalkArea2: + case kHS07WalkArea1: + case kHS07WalkArea2: _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - case kHSWalkArea3: + case kHS07WalkArea3: // Nothing break; @@ -254,7 +254,7 @@ void Scene07::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLeaveScene: + case kAS07LeaveScene: _vm->_newSceneNum = 8; _vm->_sceneDone = true; break; diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp index a5054cb558..2b977a481e 100644 --- a/engines/gnap/scenes/scene08.cpp +++ b/engines/gnap/scenes/scene08.cpp @@ -28,35 +28,35 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSExitBackdoor = 1, - kHSExitCrash = 2, - kHSMan = 3, - kHSDoor = 4, - kHSMeat = 5, - kHSBone = 6, - kHSToy = 7, - kHSWalkArea1 = 8, - kHSDevice = 9, - kHSWalkArea2 = 10 + kH08SPlatypus = 0, + kHS08ExitBackdoor = 1, + kHS08ExitCrash = 2, + kHS08Man = 3, + kHS08Door = 4, + kHS08Meat = 5, + kHS08Bone = 6, + kHS08Toy = 7, + kHS08WalkArea1 = 8, + kHS08Device = 9, + kHS08WalkArea2 = 10 }; enum { - kASLeaveScene = 0, - kASTalkMan = 1, - kASLookMan = 2, - kASLookDog = 3, - kASGrabDog = 4, - kASTalkDog = 5, - kASPlatWithMan = 6, - kASPlatWithDog = 7 + kAS08LeaveScene = 0, + kAS08TalkMan = 1, + kAS08LookMan = 2, + kAS08LookDog = 3, + kAS08GrabDog = 4, + kAS08TalkDog = 5, + kAS08PlatWithMan = 6, + kAS08PlatWithDog = 7 }; Scene08::Scene08(GnapEngine *vm) : Scene(vm) { - _s08_nextDogSequenceId = -1; - _s08_currDogSequenceId = -1; - _s08_nextManSequenceId = -1; - _s08_currManSequenceId = -1; + _nextDogSequenceId = -1; + _currDogSequenceId = -1; + _nextManSequenceId = -1; + _currManSequenceId = -1; } int Scene08::init() { @@ -64,33 +64,33 @@ int Scene08::init() { } void Scene08::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHSExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHSMan, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSDoor, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSMeat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSBone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSToy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 290, 340, -1, -1); - _vm->setHotspot(kHSWalkArea2, 0, 0, 799, 420); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kH08SPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08ExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS08ExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS08Man, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Door, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Meat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Bone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Toy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08WalkArea1, 290, 340, -1, -1); + _vm->setHotspot(kHS08WalkArea2, 0, 0, 799, 420); + _vm->setDeviceHotspot(kHS08Device, -1, -1, -1, -1); if (_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_hotspots[kHSMeat]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspots[kHS08Meat]._flags = SF_WALKABLE | SF_DISABLED; if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_hotspots[kHSBone]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspots[kHS08Bone]._flags = SF_WALKABLE | SF_DISABLED; if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_hotspots[kHSToy]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspots[kHS08Toy]._flags = SF_WALKABLE | SF_DISABLED; _vm->_hotspotsCount = 11; } void Scene08::updateAnimationsCb() { if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _s08_currDogSequenceId = _s08_nextDogSequenceId; - if ( _s08_nextDogSequenceId != 0x135 ) - _s08_nextDogSequenceId = 0x134; + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currDogSequenceId = _nextDogSequenceId; + if ( _nextDogSequenceId != 0x135 ) + _nextDogSequenceId = 0x134; } } @@ -100,17 +100,17 @@ void Scene08::run() { _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); - _s08_currDogSequenceId = 0x135; - _s08_nextDogSequenceId = 0x135; + _currDogSequenceId = 0x135; + _nextDogSequenceId = 0x135; _vm->_gameSys->setAnimation(0x135, 100, 3); - _vm->_gameSys->insertSequence(_s08_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); - _s08_currManSequenceId = 0x140; - _s08_nextManSequenceId = -1; + _currManSequenceId = 0x140; + _nextManSequenceId = -1; _vm->_gameSys->setAnimation(0x140, 100, 2); - _vm->_gameSys->insertSequence(_s08_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(50) + 75; @@ -146,7 +146,7 @@ void Scene08::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSDevice: + case kHS08Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); @@ -155,7 +155,7 @@ void Scene08::run() { } break; - case kHSPlatypus: + case kH08SPlatypus: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -180,25 +180,25 @@ void Scene08::run() { } break; - case kHSExitBackdoor: + case kHS08ExitBackdoor: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(0, 6, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS08LeaveScene; _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1); _vm->_newSceneNum = 9; break; - case kHSExitCrash: + case kHS08ExitCrash: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(3, 9, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS08LeaveScene; _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1); _vm->_newSceneNum = 7; break; - case kHSMan: + case kHS08Man: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(6, 6, 7, 0); } else { @@ -206,7 +206,7 @@ void Scene08::run() { case LOOK_CURSOR: _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLookMan; + _vm->_gnapActionStatus = kAS08LookMan; _vm->_gnapIdleFacing = kDirUpRight; break; case GRAB_CURSOR: @@ -216,13 +216,13 @@ void Scene08::run() { _vm->_gnapIdleFacing = kDirUpLeft; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkMan; + _vm->_gnapActionStatus = kAS08TalkMan; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x14D); _vm->gnapUseDeviceOnPlatypuss(); _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kASPlatWithMan; + _vm->_platypusActionStatus = kAS08PlatWithMan; _vm->_platypusFacing = kDirNone; _vm->playGnapIdle(6, 6); break; @@ -230,35 +230,35 @@ void Scene08::run() { } break; - case kHSDoor: + case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 7, 5, 0); _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASGrabDog; + _vm->_gnapActionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapScratchingHead(6, 0); _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASLookDog; + _vm->_gnapActionStatus = kAS08LookDog; break; case GRAB_CURSOR: _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASGrabDog; + _vm->_gnapActionStatus = kAS08GrabDog; _vm->_gnapIdleFacing = kDirUpRight; break; case TALK_CURSOR: _vm->_gnapIdleFacing = kDirUpRight; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkDog; + _vm->_gnapActionStatus = kAS08TalkDog; break; case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); _vm->gnapActionIdle(0x14D); _vm->gnapUseDeviceOnPlatypuss(); _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kASPlatWithDog; + _vm->_platypusActionStatus = kAS08PlatWithDog; _vm->_platypusFacing = kDirNone; _vm->playGnapIdle(3, 7); break; @@ -266,7 +266,7 @@ void Scene08::run() { } break; - case kHSMeat: + case kHS08Meat: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(6, 8, 5, 6); } else { @@ -275,13 +275,13 @@ void Scene08::run() { _vm->playGnapScratchingHead(6, 7); break; case GRAB_CURSOR: - if (_s08_currDogSequenceId == 0x135) { + if (_currDogSequenceId == 0x135) { _vm->playGnapScratchingHead(6, 7); } else { _vm->gnapActionIdle(0x14D); _vm->playGnapPullOutDevice(6, 7); _vm->playGnapUseDevice(0, 0); - _s08_nextDogSequenceId = 0x149; + _nextDogSequenceId = 0x149; } break; case TALK_CURSOR: @@ -292,7 +292,7 @@ void Scene08::run() { } break; - case kHSBone: + case kHS08Bone: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(2, 7, 3, 6); } else { @@ -301,13 +301,13 @@ void Scene08::run() { _vm->playGnapScratchingHead(3, 6); break; case GRAB_CURSOR: - if (_s08_currDogSequenceId == 0x135) { + if (_currDogSequenceId == 0x135) { _vm->playGnapScratchingHead(3, 6); } else { _vm->gnapActionIdle(0x14D); _vm->playGnapPullOutDevice(3, 6); _vm->playGnapUseDevice(0, 0); - _s08_nextDogSequenceId = 0x14A; + _nextDogSequenceId = 0x14A; } break; case TALK_CURSOR: @@ -318,7 +318,7 @@ void Scene08::run() { } break; - case kHSToy: + case kHS08Toy: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(8, 7, 7, 6); } else { @@ -327,13 +327,13 @@ void Scene08::run() { _vm->playGnapScratchingHead(7, 6); break; case GRAB_CURSOR: - if (_s08_currDogSequenceId == 0x135) { + if (_currDogSequenceId == 0x135) { _vm->playGnapScratchingHead(7, 6); } else { _vm->gnapActionIdle(0x14D); _vm->playGnapPullOutDevice(7, 6); _vm->playGnapUseDevice(0, 0); - _s08_nextDogSequenceId = 0x14B; + _nextDogSequenceId = 0x14B; } break; case TALK_CURSOR: @@ -344,8 +344,8 @@ void Scene08::run() { } break; - case kHSWalkArea1: - case kHSWalkArea2: + case kHS08WalkArea1: + case kHS08WalkArea2: _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(-1, 6, -1, -1, 1); break; @@ -366,21 +366,21 @@ void Scene08::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 125; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s08_nextManSequenceId == -1 && - (_s08_currDogSequenceId == 0x134 || _s08_currDogSequenceId == 0x135)) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextManSequenceId == -1 && + (_currDogSequenceId == 0x134 || _currDogSequenceId == 0x135)) { int _gnapRandomValue = _vm->getRandom(4); switch (_gnapRandomValue) { case 0: - _s08_nextManSequenceId = 0x138; + _nextManSequenceId = 0x138; break; case 1: - _s08_nextManSequenceId = 0x136; + _nextManSequenceId = 0x136; break; case 2: - _s08_nextManSequenceId = 0x13B; + _nextManSequenceId = 0x13B; break; case 3: - _s08_nextManSequenceId = 0x13A; + _nextManSequenceId = 0x13A; break; } } @@ -406,34 +406,34 @@ void Scene08::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLeaveScene: + case kAS08LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; - case kASTalkMan: - _s08_nextManSequenceId = 0x13F; + case kAS08TalkMan: + _nextManSequenceId = 0x13F; _vm->_gnapActionStatus = -1; break; - case kASLookMan: - _s08_nextManSequenceId = 0x140; + case kAS08LookMan: + _nextManSequenceId = 0x140; _vm->_gnapActionStatus = -1; break; - case kASLookDog: - _s08_nextManSequenceId = 0x137; + case kAS08LookDog: + _nextManSequenceId = 0x137; _vm->_gnapActionStatus = -1; break; - case kASGrabDog: - if (_s08_currDogSequenceId == 0x135) - _s08_nextDogSequenceId = 0x133; + case kAS08GrabDog: + if (_currDogSequenceId == 0x135) + _nextDogSequenceId = 0x133; else - _s08_nextDogSequenceId = 0x13C; + _nextDogSequenceId = 0x13C; _vm->_gnapActionStatus = -1; break; - case kASTalkDog: - if (_s08_currDogSequenceId == 0x135) - _s08_nextDogSequenceId = 0x133; + case kAS08TalkDog: + if (_currDogSequenceId == 0x135) + _nextDogSequenceId = 0x133; else - _s08_nextDogSequenceId = 0x13C; + _nextDogSequenceId = 0x13C; _vm->_gnapActionStatus = -1; break; } @@ -442,61 +442,61 @@ void Scene08::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(1) == 2) { _vm->_gameSys->setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { - case kASPlatWithDog: - _s08_nextDogSequenceId = 0x147; + case kAS08PlatWithDog: + _nextDogSequenceId = 0x147; break; - case kASPlatWithMan: - _s08_nextManSequenceId = 0x140; + case kAS08PlatWithMan: + _nextManSequenceId = 0x140; _vm->_platypusActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s08_nextManSequenceId != -1) { - _vm->_gameSys->setAnimation(_s08_nextManSequenceId, 100, 2); - _vm->_gameSys->insertSequence(_s08_nextManSequenceId, 100, _s08_currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _s08_currManSequenceId = _s08_nextManSequenceId; - _s08_nextManSequenceId = -1; + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextManSequenceId, 100, 2); + _vm->_gameSys->insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currManSequenceId = _nextManSequenceId; + _nextManSequenceId = -1; } if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_s08_currDogSequenceId == 0x147) + if (_currDogSequenceId == 0x147) _vm->_platypusActionStatus = -1; - if (_s08_currDogSequenceId == 0x149 || _s08_currDogSequenceId == 0x14A || _s08_currDogSequenceId == 0x14B) { + if (_currDogSequenceId == 0x149 || _currDogSequenceId == 0x14A || _currDogSequenceId == 0x14B) { if (_vm->getRandom(2) != 0) - _s08_nextManSequenceId = 0x13D; + _nextManSequenceId = 0x13D; else - _s08_nextManSequenceId = 0x13E; - } else if (_s08_currDogSequenceId == 0x133) - _s08_nextManSequenceId = 0x139; - if (_s08_nextDogSequenceId == 0x149 || _s08_nextDogSequenceId == 0x14A || _s08_nextDogSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - switch (_s08_nextDogSequenceId) { + _nextManSequenceId = 0x13E; + } else if (_currDogSequenceId == 0x133) + _nextManSequenceId = 0x139; + if (_nextDogSequenceId == 0x149 || _nextDogSequenceId == 0x14A || _nextDogSequenceId == 0x14B) { + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + switch (_nextDogSequenceId) { case 0x149: _vm->setFlag(kGFBarnPadlockOpen); - _vm->_hotspots[kHSMeat]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_hotspots[kHS08Meat]._flags = SF_DISABLED | SF_WALKABLE; _vm->_gameSys->removeSequence(0x144, 1, true); break; case 0x14A: _vm->setFlag(kGFTruckFilledWithGas); - _vm->_hotspots[kHSBone]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_hotspots[kHS08Bone]._flags = SF_DISABLED | SF_WALKABLE; _vm->_gameSys->removeSequence(0x145, 1, true); break; case 0x14B: _vm->setFlag(kGFTruckKeysUsed); - _vm->_hotspots[kHSToy]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_hotspots[kHS08Toy]._flags = SF_DISABLED | SF_WALKABLE; _vm->_gameSys->removeSequence(0x146, 1, true); break; } - _s08_currDogSequenceId = _s08_nextDogSequenceId; - _s08_nextDogSequenceId = 0x134; - } else if (_s08_nextDogSequenceId == 0x147) { - _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currDogSequenceId = _nextDogSequenceId; + _nextDogSequenceId = 0x134; + } else if (_nextDogSequenceId == 0x147) { + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _s08_currDogSequenceId = _s08_nextDogSequenceId; - _s08_nextDogSequenceId = 0x134; + _currDogSequenceId = _nextDogSequenceId; + _nextDogSequenceId = 0x134; _vm->_platX = 1; _vm->_platY = 8; _vm->_platypusId = 160; @@ -505,13 +505,13 @@ void Scene08::updateAnimations() { _vm->_platypusSequenceDatNum = 0; if (_vm->_gnapX == 1 && _vm->_gnapY == 8) _vm->gnapWalkStep(); - } else if (_s08_nextDogSequenceId != -1) { - _vm->_gameSys->setAnimation(_s08_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_s08_nextDogSequenceId, 100, _s08_currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _s08_currDogSequenceId = _s08_nextDogSequenceId; - if (_s08_nextDogSequenceId != 0x135) - _s08_nextDogSequenceId = 0x134; - if (_s08_currDogSequenceId == 0x133) { + } else if (_nextDogSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currDogSequenceId = _nextDogSequenceId; + if (_nextDogSequenceId != 0x135) + _nextDogSequenceId = 0x134; + if (_currDogSequenceId == 0x133) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/scene08.h b/engines/gnap/scenes/scene08.h index ab538ce29a..b73bc49b22 100644 --- a/engines/gnap/scenes/scene08.h +++ b/engines/gnap/scenes/scene08.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb(); private: - int _s08_nextDogSequenceId; - int _s08_currDogSequenceId; - int _s08_nextManSequenceId; - int _s08_currManSequenceId; + int _nextDogSequenceId; + int _currDogSequenceId; + int _nextManSequenceId; + int _currManSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp index 5feee78597..7e92ca16ac 100644 --- a/engines/gnap/scenes/scene09.cpp +++ b/engines/gnap/scenes/scene09.cpp @@ -28,20 +28,20 @@ namespace Gnap { enum { - kHSPlatypus = 0, - kHSExitKitchen = 1, - kHSExitHouse = 2, - kHSTrash = 3, - kHSDevice = 4, - kHSWalkArea1 = 5, - kHSWalkArea2 = 6, - kHSWalkArea3 = 7 + kHS09Platypus = 0, + kHS09ExitKitchen = 1, + kHS09ExitHouse = 2, + kHS09Trash = 3, + kHS09Device = 4, + kHS09WalkArea1 = 5, + kHS09WalkArea2 = 6, + kHS09WalkArea3 = 7 }; enum { - kASLeaveScene = 0, - kASSearchTrash = 1, - kASSearchTrashDone = 2 + kAS09LeaveScene = 0, + kAS09SearchTrash = 1, + kAS09SearchTrashDone = 2 }; Scene09::Scene09(GnapEngine *vm) : Scene(vm) { @@ -52,14 +52,14 @@ int Scene09::init() { } void Scene09::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 200, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitKitchen, 280, 200, 380, 400, SF_EXIT_U_CURSOR); - _vm->setHotspot(kHSExitHouse, 790, 200, 799, 450, SF_EXIT_R_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHSTrash, 440, 310, 680, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 0, 0, 799, 400); - _vm->setHotspot(kHSWalkArea2, 0, 0, 630, 450); - _vm->setHotspot(kHSWalkArea2, 0, 0, 175, 495); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); + _vm->setHotspot(kHS09Platypus, 0, 200, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS09ExitKitchen, 280, 200, 380, 400, SF_EXIT_U_CURSOR); + _vm->setHotspot(kHS09ExitHouse, 790, 200, 799, 450, SF_EXIT_R_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS09Trash, 440, 310, 680, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS09WalkArea1, 0, 0, 799, 400); + _vm->setHotspot(kHS09WalkArea2, 0, 0, 630, 450); + _vm->setHotspot(kHS09WalkArea2, 0, 0, 175, 495); + _vm->setDeviceHotspot(kHS09Device, -1, -1, -1, -1); _vm->_hotspotsCount = 8; } @@ -97,7 +97,7 @@ void Scene09::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHSDevice: + case kHS09Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); updateHotspots(); @@ -106,7 +106,7 @@ void Scene09::run() { } break; - case kHSPlatypus: + case kHS09Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapMoan1(_vm->_platX, _vm->_platY); @@ -123,25 +123,25 @@ void Scene09::run() { } break; - case kHSExitKitchen: + case kHS09ExitKitchen: _vm->_isLeavingScene = true; _vm->_newSceneNum = 10; _vm->gnapWalkTo(4, 7, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS09LeaveScene; _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); _vm->_platypusFacing = kDirUnk4; break; - case kHSExitHouse: + case kHS09ExitHouse: _vm->_isLeavingScene = true; _vm->_newSceneNum = 8; _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; + _vm->_gnapActionStatus = kAS09LeaveScene; _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); _vm->_platypusFacing = kDirUnk4; break; - case kHSTrash: + case kHS09Trash: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(9, 6, 8, 0); } else { @@ -150,7 +150,7 @@ void Scene09::run() { _vm->playGnapScratchingHead(8, 3); break; case GRAB_CURSOR: - _vm->_gnapActionStatus = kASSearchTrash; + _vm->_gnapActionStatus = kAS09SearchTrash; _vm->gnapWalkTo(9, 6, 0, 0x107BC, 1); break; case TALK_CURSOR: @@ -161,9 +161,9 @@ void Scene09::run() { } break; - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: + case kHS09WalkArea1: + case kHS09WalkArea2: + case kHS09WalkArea3: _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -208,11 +208,11 @@ void Scene09::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { - case kASLeaveScene: + case kAS09LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; - case kASSearchTrash: + case kAS09SearchTrash: _vm->_gameSys->setAnimation(0x4C, 120, 0); _vm->_gameSys->insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->removeSequence(0x4B, 2, true); @@ -222,9 +222,9 @@ void Scene09::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnapX = 9; _vm->_gnapY = 6; - _vm->_gnapActionStatus = kASSearchTrashDone; + _vm->_gnapActionStatus = kAS09SearchTrashDone; break; - case kASSearchTrashDone: + case kAS09SearchTrashDone: _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[2] = 360; _vm->_timers[4] = _vm->getRandom(150) + 100; diff --git a/engines/gnap/scenes/scene09.h b/engines/gnap/scenes/scene09.h index c914d16aa9..2a1576e663 100644 --- a/engines/gnap/scenes/scene09.h +++ b/engines/gnap/scenes/scene09.h @@ -40,8 +40,6 @@ public: virtual void run(); virtual void updateAnimations(); virtual void updateAnimationsCb() {} - -private: }; } // End of namespace Gnap -- cgit v1.2.3 From 5381edd40e96be464400923d0c6e40fae43b8ea2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 27 Apr 2016 07:31:04 +0200 Subject: GNAP: group first scenes, rename intro --- engines/gnap/module.mk | 12 +- engines/gnap/scenes/group0.cpp | 3733 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group0.h | 183 ++ engines/gnap/scenes/intro.cpp | 181 ++ engines/gnap/scenes/intro.h | 47 + engines/gnap/scenes/scene00.cpp | 181 -- engines/gnap/scenes/scene00.h | 47 - engines/gnap/scenes/scene01.cpp | 383 ---- engines/gnap/scenes/scene01.h | 52 - engines/gnap/scenes/scene02.cpp | 538 ------ engines/gnap/scenes/scene02.h | 53 - engines/gnap/scenes/scene03.cpp | 517 ----- engines/gnap/scenes/scene03.h | 54 - engines/gnap/scenes/scene04.cpp | 572 ------ engines/gnap/scenes/scene04.h | 53 - engines/gnap/scenes/scene05.cpp | 466 ----- engines/gnap/scenes/scene05.h | 51 - engines/gnap/scenes/scene06.cpp | 446 ----- engines/gnap/scenes/scene06.h | 53 - engines/gnap/scenes/scene07.cpp | 271 --- engines/gnap/scenes/scene07.h | 47 - engines/gnap/scenes/scene08.cpp | 527 ------ engines/gnap/scenes/scene08.h | 52 - engines/gnap/scenes/scene09.cpp | 237 --- engines/gnap/scenes/scene09.h | 46 - engines/gnap/scenes/scenecore.cpp | 16 +- 26 files changed, 4150 insertions(+), 4668 deletions(-) create mode 100644 engines/gnap/scenes/group0.cpp create mode 100644 engines/gnap/scenes/group0.h create mode 100644 engines/gnap/scenes/intro.cpp create mode 100644 engines/gnap/scenes/intro.h delete mode 100644 engines/gnap/scenes/scene00.cpp delete mode 100644 engines/gnap/scenes/scene00.h delete mode 100644 engines/gnap/scenes/scene01.cpp delete mode 100644 engines/gnap/scenes/scene01.h delete mode 100644 engines/gnap/scenes/scene02.cpp delete mode 100644 engines/gnap/scenes/scene02.h delete mode 100644 engines/gnap/scenes/scene03.cpp delete mode 100644 engines/gnap/scenes/scene03.h delete mode 100644 engines/gnap/scenes/scene04.cpp delete mode 100644 engines/gnap/scenes/scene04.h delete mode 100644 engines/gnap/scenes/scene05.cpp delete mode 100644 engines/gnap/scenes/scene05.h delete mode 100644 engines/gnap/scenes/scene06.cpp delete mode 100644 engines/gnap/scenes/scene06.h delete mode 100644 engines/gnap/scenes/scene07.cpp delete mode 100644 engines/gnap/scenes/scene07.h delete mode 100644 engines/gnap/scenes/scene08.cpp delete mode 100644 engines/gnap/scenes/scene08.h delete mode 100644 engines/gnap/scenes/scene09.cpp delete mode 100644 engines/gnap/scenes/scene09.h diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index bb565eb276..0e1271a167 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -11,16 +11,8 @@ MODULE_OBJS := \ resource.o \ sound.o \ scenes/groupcs.o \ - scenes/scene00.o \ - scenes/scene01.o \ - scenes/scene02.o \ - scenes/scene03.o \ - scenes/scene04.o \ - scenes/scene05.o \ - scenes/scene06.o \ - scenes/scene07.o \ - scenes/scene08.o \ - scenes/scene09.o \ + scenes/group0.o \ + scenes/intro.o \ scenes/scene10.o \ scenes/scene11.o \ scenes/scene12.o \ diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp new file mode 100644 index 0000000000..5e455555a7 --- /dev/null +++ b/engines/gnap/scenes/group0.cpp @@ -0,0 +1,3733 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/group0.h" + +namespace Gnap { + +enum { + kHS01Platypus = 0, + kHS01ExitTruck = 1, + kHS01Mud = 2, + kHS01Pigs = 3, + kHS01Spaceship = 4, + kHS01Device = 5, + kHS01WalkArea1 = 6, + kHS01WalkArea2 = 7, + kHS01WalkArea3 = 8, + kHS01WalkArea4 = 9, + kHS01WalkArea5 = 10, + kHS01WalkArea6 = 11, + kHS01WalkArea7 = 12, + kHS01WalkArea8 = 13 +}; + +enum { + kAS01LookSpaceship = 1, + kAS01LookSpaceshipDone = 2, + kAS01LeaveScene = 3, + kAS01TakeMud = 5, + kAS01LookPigs = 6, + kAS01UsePigs = 7 +}; + +Scene01::Scene01(GnapEngine *vm) : Scene(vm) { + _pigsIdCtr = 0; + _smokeIdCtr = 0; + _spaceshipSurface = nullptr; +} + +Scene01::~Scene01() { + delete _spaceshipSurface; +} + +int Scene01::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 3); + return 0x88; +} + +void Scene01::updateHotspots() { + _vm->setHotspot(kHS01Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS01ExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + _vm->setHotspot(kHS01Mud, 138, 282, 204, 318, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + _vm->setHotspot(kHS01Pigs, 408, 234, 578, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 4); + _vm->setHotspot(kHS01Spaceship, 0, 200, 94, 292, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + _vm->setHotspot(kHS01WalkArea1, 0, 0, 162, 426); + _vm->setHotspot(kHS01WalkArea2, 162, 0, 237, 396); + _vm->setHotspot(kHS01WalkArea3, 237, 0, 319, 363); + _vm->setHotspot(kHS01WalkArea4, 520, 0, 800, 404); + _vm->setHotspot(kHS01WalkArea5, 300, 447, 800, 600); + _vm->setHotspot(kHS01WalkArea6, 678, 0, 800, 404); + _vm->setHotspot(kHS01WalkArea7, 0, 0, 520, 351); + _vm->setHotspot(kHS01WalkArea8, 0, 546, 300, 600); + _vm->setDeviceHotspot(kHS01Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS01Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFMudTaken)) + _vm->_hotspots[kHS01Mud]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspotsCount = 14; +} + +void Scene01::run() { + // NOTE Removed _s01_dword_474380 which was set when the mud was taken + // which is also set in the global game flags. + + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(5); + + _vm->_gameSys->setAnimation(134, 20, 4); + _vm->_gameSys->insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_gameSys->setAnimation(0x7F, 40, 2); + _vm->_gameSys->insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[4] = _vm->getRandom(100) + 300; + + if (!_vm->isFlag(kGFMudTaken)) + _vm->_gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 2) { + _vm->initGnapPos(11, 6, kDirBottomLeft); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); + _vm->gnapWalkTo(8, 6, -1, 0x107B9, 1); + } else { + _vm->initGnapPos(1, 6, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->testWalk(0, 3, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + + case kHS01Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS01Platypus: + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS01Spaceship: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS01LookSpaceship; + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS01Mud: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(3, 3); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); + _vm->_gnapActionStatus = kAS01TakeMud; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS01Pigs: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnapActionStatus = kAS01LookPigs; + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnapActionStatus = kAS01UsePigs; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); + _vm->_gnapActionStatus = kAS01LookPigs; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS01ExitTruck: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS01LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); + _vm->_newSceneNum = 2; + } + break; + + case kHS01WalkArea1: + case kHS01WalkArea2: + case kHS01WalkArea3: + case kHS01WalkArea4: + case kHS01WalkArea5: + case kHS01WalkArea6: + case kHS01WalkArea7: + case kHS01WalkArea8: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_timers[4] == 0) { + // Update bird animation + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(1) == 0) + _vm->_gameSys->insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene01::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS01LookSpaceship: + _spaceshipSurface = _vm->_gameSys->createSurface(47); + _vm->_gameSys->insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); + _vm->_gameSys->setAnimation(133, 256, 0); + _vm->_gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = kAS01LookSpaceshipDone; + break; + + case kAS01LookSpaceshipDone: + _vm->_gameSys->removeSequence(133, 256, true); + _vm->_gameSys->removeSpriteDrawItem(_spaceshipSurface, 255); + _vm->deleteSurface(&_spaceshipSurface); + _vm->_gnapActionStatus = -1; + break; + + case kAS01LeaveScene: + _vm->_sceneDone = true; + break; + + case kAS01TakeMud: + _vm->playGnapPullOutDevice(2, 3); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(128, 40, 3); + _vm->_gnapActionStatus = -1; + break; + + case kAS01LookPigs: + _vm->playSound(138, false); + _vm->playSound(139, false); + _vm->playSound(140, false); + _vm->_gnapActionStatus = -1; + break; + + case kAS01UsePigs: + _vm->playGnapPullOutDevice(7, 2); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->invAdd(kItemMud); + _vm->setGrabCursorSprite(kItemMud); + _vm->setFlag(kGFMudTaken); + updateHotspots(); + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2) { + _smokeIdCtr = (_smokeIdCtr + 1) % 2; + _vm->_gameSys->setAnimation(0x86, _smokeIdCtr + 20, 4); + _vm->_gameSys->insertSequence(0x86, _smokeIdCtr + 20, + 0x86, (_smokeIdCtr + 1) % 2 + 20, + kSeqSyncWait, 0, 0, 0); + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _pigsIdCtr = (_pigsIdCtr + 1) % 2; + _vm->_gameSys->setAnimation(0x7F, _pigsIdCtr + 40, 2); + _vm->_gameSys->insertSequence(0x7F, _pigsIdCtr + 40, + 0x7F, (_pigsIdCtr + 1) % 2 + 40, + kSeqSyncWait, 0, 0, 0); + } +} + +/*****************************************************************************/ + +enum { + kHS02Platypus = 0, + kHS02Chicken = 1, + kHS02Truck1 = 2, + kHS02Truck2 = 3, + kHS02TruckGrill = 4, + kHS02Device = 5, + kHS02ExitHouse = 6, + kHS02ExitBarn = 7, + kHS02ExitCreek = 8, + kHS02ExitPigpen = 9, + kHS02WalkArea1 = 10, + kHS02WalkArea2 = 11, + kHS02WalkArea3 = 12, + kHS02WalkArea4 = 13 +}; + +enum { + kAS02UseTruckNoKeys = 0, + kAS02UseGasWithTruck = 1, + kAS02UseTruckGas = 2, + kAS02UseTruckNoGas = 3, + kAS02GrabTruckGrill = 5, + kAS02LeaveScene = 6, + kAS02TalkChicken = 7, + kAS02GrabChicken = 8, + kAS02GrabChickenDone = 9, + kAS02UseTruckNoKeysDone = 11, + kAS02UseGasWithTruckDone = 12, + kAS02UseTwigWithChicken = 16 +}; + +Scene02::Scene02(GnapEngine *vm) : Scene(vm) { + _truckGrillCtr = 0; + _nextChickenSequenceId = 0; + _currChickenSequenceId = 0; + _gnapTruckSequenceId = 0; +} + +int Scene02::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + return _vm->isFlag(kGFTruckKeysUsed) ? 0x15A : 0x15B; +} + +void Scene02::updateHotspots() { + _vm->setHotspot(kHS02Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE); + _vm->setHotspot(kHS02Chicken, 606, 455, 702, 568, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS02Truck1, 385, 258, 464, 304, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 5); + _vm->setHotspot(kHS02Truck2, 316, 224, 390, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 6); + _vm->setHotspot(kHS02TruckGrill, 156, 318, 246, 390, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 7); + _vm->setHotspot(kHS02ExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 5); + _vm->setHotspot(kHS02ExitBarn, 610, 0, 800, 164, SF_EXIT_U_CURSOR, 10, 5); + _vm->setHotspot(kHS02ExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHS02ExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS02WalkArea1, 92, 140, 304, 430, 0, 3, 1); + _vm->setHotspot(kHS02WalkArea2, 0, 0, 800, 380); + _vm->setHotspot(kHS02WalkArea3, 0, 0, 386, 445); + _vm->setHotspot(kHS02WalkArea4, 386, 0, 509, 410); + _vm->setDeviceHotspot(kHS02Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS02Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 14; +} + +void Scene02::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(6); + + _currChickenSequenceId = 0x14B; + _vm->_gameSys->setAnimation(0x14B, 179, 2); + _vm->_gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); + + _nextChickenSequenceId = -1; + _vm->_timers[5] = _vm->getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(100) + 300; + + _vm->queueInsertDeviceIcon(); + + switch (_vm->_prevSceneNum) { + case 3: + _vm->initGnapPos(11, 6, kDirBottomLeft); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); + _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); + break; + case 4: + _vm->initGnapPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 6, 0, 0x107B9, 1); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(8, 6, 1, 0x107C2, 1); + updateHotspots(); + _vm->_gameSys->waitForUpdate(); + break; + case 47: + _vm->clearFlag(kGFUnk25); + _vm->initGnapPos(5, 6, kDirBottomLeft); + _vm->initPlatypusPos(6, 7, kDirUnk4); + _vm->endSceneInit(); + break; + case 49: + _vm->initGnapPos(5, 6, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(6, 7, kDirNone); + _vm->endSceneInit(); + break; + default: + _vm->initGnapPos(-1, 6, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + break; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 6, 7, 6, 8, 6); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS02Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS02Platypus: + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS02Chicken: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTwig) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS02UseTwigWithChicken; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(9, 8); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS02GrabChicken; + else + _vm->_gnapActionStatus = -1; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS02TalkChicken; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS02Truck1: + case kHS02Truck2: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemKeys) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemKeys); + if (_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_gnapActionStatus = kAS02UseTruckGas; + else + _vm->_gnapActionStatus = kAS02UseTruckNoGas; + } + } else if (_vm->_grabCursorSpriteIndex == kItemGas) { + _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS02UseGasWithTruck; + _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 2); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFTruckKeysUsed)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_gnapActionStatus = kAS02UseTruckGas; + else + _vm->_gnapActionStatus = kAS02UseTruckNoGas; + } + } else { + _vm->_gnapIdleFacing = kDirUnk4; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS02UseTruckNoKeys; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS02TruckGrill: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(2, 4); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS02GrabTruckGrill; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS02ExitHouse: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kAS02LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, -1, 0x107C1, 1); + updateHotspots(); + _vm->_newSceneNum = 4; + } + break; + + case kHS02ExitBarn: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kAS02LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7].x + 1, _vm->_hotspotsWalkPos[7].y, -1, 0x107C1, 1); + updateHotspots(); + _vm->_newSceneNum = 5; + } + break; + + case kHS02ExitCreek: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS02LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 3; + } + break; + + case kHS02ExitPigpen: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS02LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 1; + } + break; + + case kHS02WalkArea1: + case kHS02WalkArea2: + case kHS02WalkArea3: + case kHS02WalkArea4: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + // Update bird animation + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { + if (_vm->getRandom(6) != 0) { + _nextChickenSequenceId = 0x14B; + _vm->_timers[5] = _vm->getRandom(20) + 30; + } else { + _nextChickenSequenceId = 0x14D; + _vm->_timers[5] = _vm->getRandom(20) + 50; + } + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene02::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { + case kAS02UseTruckNoKeys: + _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x14E, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x14E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS02UseTruckNoKeysDone; + break; + case kAS02UseGasWithTruck: + _vm->_gameSys->insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x151, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x151; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemGas); + _vm->setGrabCursorSprite(-1); + _vm->setFlag(kGFTruckFilledWithGas); + _vm->_gnapActionStatus = kAS02UseGasWithTruckDone; + break; + case kAS02UseTruckGas: + _vm->_timers[5] = 9999; + _vm->_timers[4] = 9999; + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + if (!_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->waitForUpdate(); + _vm->setFlag(kGFTruckKeysUsed); + _vm->_gnapSequenceId = 0x14F; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemKeys); + _vm->setGrabCursorSprite(-1); + } + _vm->_newSceneNum = 47; + _vm->_sceneDone = true; + break; + case kAS02UseTruckNoGas: + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->_timers[4] = 250; + if (!_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->waitForUpdate(); + _vm->setFlag(kGFTruckKeysUsed); + _vm->_gnapSequenceId = 0x14F; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemKeys); + _vm->setGrabCursorSprite(-1); + } + _vm->_newSceneNum = 47; + _vm->_sceneDone = true; + _vm->setFlag(kGFUnk25); + break; + case kAS02GrabTruckGrill: + switch (_truckGrillCtr) { + case 0: + _gnapTruckSequenceId = 0x158; + break; + case 1: + _gnapTruckSequenceId = 0x159; + break; + case 2: + _gnapTruckSequenceId = 0x157; + break; + } + _truckGrillCtr = (_truckGrillCtr + 1) % 3; + _vm->_gameSys->insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); + _vm->_gnapSequenceId = _gnapTruckSequenceId; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + break; + case kAS02LeaveScene: + _vm->_sceneDone = true; + break; + case kAS02TalkChicken: + _nextChickenSequenceId = 0x14C; + break; + case kAS02GrabChicken: + _nextChickenSequenceId = 0x150; + _vm->_timers[2] = 100; + break; + case kAS02GrabChickenDone: + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _currChickenSequenceId = 0x14B; + _vm->_gameSys->setAnimation(0x14B, 179, 2); + _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->_timers[5] = 30; + break; + case kAS02UseTwigWithChicken: + _vm->playGnapShowItem(5, 0, 0); + _vm->_gameSys->insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); + _currChickenSequenceId = 0x155; + _nextChickenSequenceId = -1; + _vm->_gnapActionStatus = -1; + break; + case kAS02UseTruckNoKeysDone: + case kAS02UseGasWithTruckDone: + default: + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (_nextChickenSequenceId == 0x150) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + _nextChickenSequenceId = -1; + _currChickenSequenceId = -1; + _vm->_gnapActionStatus = kAS02GrabChickenDone; + _vm->_timers[5] = 500; + } else if (_nextChickenSequenceId == 0x14C) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + _vm->_gnapActionStatus = -1; + } else if (_nextChickenSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS03Platypus = 0, + kHS03Grass = 1, + kHS03ExitTruck = 2, + kHS03Creek = 3, + kHS03TrappedPlatypus = 4, + kHS03Device = 5, + kHS03WalkAreas1 = 6, + kHS03WalkAreas2 = 7, + kHS03PlatypusWalkArea = 8, + kHS03WalkAreas3 = 9 +}; + +enum { + kAS03LeaveScene = 0, + kAS03FreePlatypus = 1, + kAS03HypnotizePlat = 2, + kAS03HypnotizeScaredPlat= 3, + kAS03FreePlatypusDone = 4, + kAS03GrabPlatypus = 5, + kAS03GrabCreek = 6, + kAS03GrabCreekDone = 7, + kAS03GrabScaredPlatypus = 8 +}; + +Scene03::Scene03(GnapEngine *vm) : Scene(vm) { + _nextPlatSequenceId = -1; + _platypusScared = false; + _platypusHypnotized = false; + _nextFrogSequenceId = -1; + _currFrogSequenceId = -1; +} + +int Scene03::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 5); + return 0x1CC; +} + +void Scene03::updateHotspots() { + _vm->setHotspot(kHS03Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS03Grass, 646, 408, 722, 458, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + _vm->setHotspot(kHS03ExitTruck, 218, 64, 371, 224, SF_EXIT_U_CURSOR | SF_WALKABLE, 4, 4); + _vm->setHotspot(kHS03Creek, 187, 499, 319, 587, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS03TrappedPlatypus, 450, 256, 661, 414, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 5); + _vm->setHotspot(kHS03WalkAreas1, 0, 500, 300, 600); + _vm->setHotspot(kHS03WalkAreas2, 300, 447, 800, 600); + _vm->setHotspot(kHS03PlatypusWalkArea, 235, 0, 800, 600); + _vm->setHotspot(kHS03WalkAreas3, 0, 0, 800, 354); + _vm->setDeviceHotspot(kHS03Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS03Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFGrassTaken)) + _vm->_hotspots[kHS03Grass]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS03TrappedPlatypus]._flags = SF_DISABLED; + if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) + _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; + _vm->_hotspotsCount = 10; +} + +void Scene03::run() { + _vm->playSound(0x10925, true); + _vm->startSoundTimerC(7); + + _vm->_gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); + + _platypusHypnotized = false; + + _vm->initGnapPos(3, 4, kDirBottomRight); + + _vm->_gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); + + _currFrogSequenceId = 0x1C6; + _nextFrogSequenceId = -1; + _vm->_gameSys->setAnimation(0x1C6, 253, 2); + + _vm->_timers[6] = _vm->getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(100) + 300; + _vm->_timers[5] = _vm->getRandom(100) + 200; + + if (_vm->isFlag(kGFPlatypus)) { + _vm->initPlatypusPos(5, 4, kDirNone); + } else { + _vm->_timers[1] = _vm->getRandom(40) + 20; + _vm->_gameSys->setAnimation(0x1C2, 99, 1); + _vm->_gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x1C2; + _vm->_platypusSequenceDatNum = 0; + } + + _vm->_gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFGrassTaken)) + _vm->_gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + _vm->endSceneInit(); + + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(4, 7, -1, 0x107C2, 1); + _vm->gnapWalkTo(3, 6, -1, 0x107B9, 1); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS03Platypus: + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS03Grass: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(9, 6); + break; + case GRAB_CURSOR: + _vm->playGnapPullOutDevice(9, 6); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1B3, 253, 5); + _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS03ExitTruck: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kAS03LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, -1, 0x107C2, 1); + _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 2; + else + _vm->_newSceneNum = 33; + } + break; + + case kHS03Creek: + if (_vm->_gnapActionStatus == -1) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(2, 8); + break; + case GRAB_CURSOR: + if (!_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS03GrabCreek; + if (!_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS03TrappedPlatypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatypus)) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 4); + break; + case GRAB_CURSOR: + if (_platypusHypnotized) { + _vm->gnapWalkTo(7, 6, 0, 0x107B5, 1); + _vm->_gnapActionStatus = kAS03FreePlatypus; + } else { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + if (_platypusScared) + _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; + else + _vm->_gnapActionStatus = kAS03GrabPlatypus; + } + break; + case TALK_CURSOR: + if (_platypusHypnotized) { + _vm->playGnapBrainPulsating(8, 4); + } else { + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + if (_platypusScared) + _vm->_gnapActionStatus = kAS03HypnotizeScaredPlat; + else + _vm->_gnapActionStatus = kAS03HypnotizePlat; + } + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS03Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS03WalkAreas1: + case kHS03WalkAreas2: + case kHS03WalkAreas3: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHS03PlatypusWalkArea: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } else { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107B5, 1); + if (_platypusScared) + _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; + else + _vm->_gnapActionStatus = kAS03GrabPlatypus; + } + } + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10925)) + _vm->playSound(0x10925, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[1] && !_platypusScared) { + _vm->_timers[1] = _vm->getRandom(40) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) + _nextPlatSequenceId = 450; + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(20) + 30; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextFrogSequenceId == -1) { + if (_vm->getRandom(5) == 1) + _nextFrogSequenceId = 0x1C6; + else + _nextFrogSequenceId = 0x1C7; + } + } + if (!_vm->_timers[4]) { + // Update bird animation + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + _vm->_gameSys->insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 200; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + _vm->_gameSys->setAnimation(0x1C5, 253, 4); + _vm->_gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); + } + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(100) + 200; + _vm->_timers[4] = _vm->getRandom(100) + 300; + _vm->_timers[6] = _vm->getRandom(20) + 30; + } + + _vm->gameUpdateTick(); + } +} + +void Scene03::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS03LeaveScene: + _vm->_sceneDone = true; + break; + case kAS03FreePlatypus: + _nextPlatSequenceId = 0x1BC; + break; + case kAS03FreePlatypusDone: + _vm->_gnapActionStatus = -1; + _vm->_platX = 6; + _vm->_platY = 6; + _vm->_platypusFacing = kDirUnk4; + _vm->_platypusId = 120; + _vm->_gameSys->insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, + kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + _vm->_gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceDatNum = 1; + _vm->_platypusSequenceId = 0x7CA; + _vm->setFlag(kGFPlatypus); + _nextPlatSequenceId = -1; + updateHotspots(); + break; + case kAS03HypnotizePlat: + _vm->playGnapBrainPulsating(0, 0); + _vm->addFullScreenSprite(0x106, 255); + _vm->_gameSys->setAnimation(0x1C9, 256, 1); + _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->_gameSys->setAnimation(0x1BA, 99, 1); + _vm->_gameSys->insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x1BA; + _vm->_gnapActionStatus = -1; + _platypusHypnotized = true; + updateHotspots(); + break; + case kAS03HypnotizeScaredPlat: + _vm->playGnapBrainPulsating(0, 0); + _vm->_gameSys->insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1BF, 99, 1); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->addFullScreenSprite(0x106, 255); + _vm->_gameSys->setAnimation(0x1C9, 256, 1); + _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->_gameSys->setAnimation(0x1BA, 99, 1); + _vm->_gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x1BA; + _vm->_gnapActionStatus = -1; + _platypusHypnotized = true; + updateHotspots(); + break; + case kAS03GrabPlatypus: + _nextPlatSequenceId = 0x1BD; + _platypusHypnotized = false; + break; + case kAS03GrabScaredPlatypus: + _nextPlatSequenceId = 0x1C0; + _platypusHypnotized = false; + break; + case kAS03GrabCreek: + _vm->_gameSys->insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1B4, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x1B4; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS03GrabCreekDone; + break; + default: + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { + _vm->_gameSys->setAnimation(0, 0, 1); + _platypusScared = true; + _vm->_gameSys->insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x1B5; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirNone; + _vm->_platypusSequenceId = _nextPlatSequenceId; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(_nextPlatSequenceId, 99, 1); + _nextPlatSequenceId = -1; + _vm->_gnapActionStatus = -1; + } else if (_nextPlatSequenceId == 0x1BC) { + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gameSys->insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1BC, 99, 0); + _vm->_gnapId = 20 * _vm->_gnapY; + _vm->_gnapSequenceId = 0x1B6; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirNone; + _vm->_gnapActionStatus = kAS03FreePlatypusDone; + _nextPlatSequenceId = -1; + } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0x1C2; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x1C2, 99, 1); + _nextPlatSequenceId = -1; + } else if (_nextPlatSequenceId == -1 && _platypusScared && !_platypusHypnotized) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0x1BE, 99, 1); + _vm->_gameSys->insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0x1BE; + _vm->_platypusSequenceDatNum = 0; + _nextPlatSequenceId = -1; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextFrogSequenceId, 253, 2); + _vm->_gameSys->insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); + _currFrogSequenceId = _nextFrogSequenceId; + _nextFrogSequenceId = -1; + } + + if (_vm->_gameSys->getAnimationStatus(5) == 2) { + _vm->_gameSys->setAnimation(0, 0, 5); + _vm->invAdd(kItemGrass); + _vm->setGrabCursorSprite(kItemGrass); + _vm->setFlag(kGFGrassTaken); + updateHotspots(); + } +} + +/*****************************************************************************/ + +enum { + kHS04Platypus = 0, + kHS04Twig = 1, + kHS04Dog = 2, + kHS04Axe = 3, + kHS04Door = 4, + kHS04ExitTruck = 5, + kHS04Device = 6, + kHS04Window = 7, + kHS04ExitBarn = 8, + kHS04WalkArea1 = 9, + kHS04WalkArea2 = 10 +}; + +enum { + kAS04OpenDoor = 1, + kAS04GetKeyFirst = 2, + kAS04GetKeyAnother = 3, + kAS04LeaveScene = 4, + kAS04GetKeyFirstDone = 6, + kAS04GetKeyFirst2 = 7, + kAS04GetKeyAnother2 = 8, + kAS04GetKeyAnotherDone = 9, + kAS04OpenDoorDone = 10, + kAS04GrabDog = 12, + kAS04GrabAxe = 13 +}; + +Scene04::Scene04(GnapEngine *vm) : Scene(vm) { + _dogIdCtr = 0; + _triedWindow = false; + _nextDogSequenceId = -1; + _currDogSequenceId = -1; +} + +int Scene04::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + return 0x214; +} + +void Scene04::updateHotspots() { + _vm->setHotspot(kHS04Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS04Twig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); + _vm->setHotspot(kHS04Dog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHS04Axe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHS04Door, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHS04ExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS04Window, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS04ExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); + _vm->setHotspot(kHS04WalkArea1, 0, 0, 562, 461); + _vm->setHotspot(kHS04WalkArea2, 562, 0, 800, 500); + _vm->setDeviceHotspot(kHS04Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS04Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHS04Twig]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant) || _vm->_cursorValue == 1) + _vm->_hotspots[kHS04Axe]._flags = SF_DISABLED; + _vm->_hotspotsCount = 11; +} + +void Scene04::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(4); + + _vm->_gameSys->insertSequence(0x210, 139 - _dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); + + _currDogSequenceId = 0x210; + _nextDogSequenceId = -1; + + _vm->_gameSys->setAnimation(0x210, 139 - _dogIdCtr, 3); + _dogIdCtr = (_dogIdCtr + 1) % 2; + _vm->_timers[6] = _vm->getRandom(20) + 60; + _vm->_timers[5] = _vm->getRandom(150) + 300; + _vm->_timers[7] = _vm->getRandom(150) + 200; + _vm->_timers[8] = _vm->getRandom(150) + 400; + + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant) && _vm->_cursorValue == 4) + _vm->_gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFTwigTaken)) + _vm->_gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFPlatyPussDisguised)) { + _vm->_timers[3] = 300; + // TODO setCursor((LPCSTR)IDC_WAIT); + _vm->setGrabCursorSprite(kItemKeys); + _vm->_gnapX = 4; + _vm->_gnapY = 7; + _vm->_gnapId = 140; + _vm->_platX = 6; + _vm->_platY = 7; + _vm->_platypusId = 141; + _vm->_gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + _vm->_gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); + _vm->endSceneInit(); + _vm->invRemove(kItemDisguise); + _vm->invAdd(kItemKeys); + _vm->setFlag(kGFKeysTaken); + _vm->clearFlag(kGFPlatyPussDisguised); + _vm->_platypusSequenceId = 0x20C; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusFacing = kDirBottomRight; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->waitForUpdate(); + } else { + _vm->_gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); + if (_vm->_prevSceneNum == 2) { + _vm->initGnapPos(5, 11, kDirUpRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(6, 9, -1, 0x107BA, 1); + } else if (_vm->_prevSceneNum == 38) { + _vm->initGnapPos(5, 7, kDirBottomRight); + _vm->initPlatypusPos(4, 7, kDirNone); + _vm->endSceneInit(); + } else { + _vm->initGnapPos(12, 9, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(12, 8, kDirNone); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(9, 9, -1, 0x107BA, 1); + } + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 4, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS04Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS04Platypus: + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + if (_vm->_cursorValue == 4) + _vm->gnapKissPlatypus(0); + else + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS04Twig: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + break; + case GRAB_CURSOR: + _vm->playGnapPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->playGnapUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->_gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x1FD, 100, 2); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS04Axe: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS04GrabAxe; + _vm->setFlag(kGFPlatypusTalkingToAssistant); + updateHotspots(); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS04Dog: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + _nextDogSequenceId = 0x20F; + } + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS04GrabDog; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + _nextDogSequenceId = 0x20E; + } + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS04Door: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapScratchingHead(4, 3); + break; + case GRAB_CURSOR: + if (_vm->_cursorValue == 1) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS04OpenDoor; + _vm->_timers[5] = 300; + _vm->_gnapIdleFacing = kDirUpLeft; + } else { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS04LeaveScene; + _vm->_newSceneNum = 38; + } + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS04ExitTruck: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS04LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 2; + else + _vm->_newSceneNum = 33; + } + break; + + case kHS04Window: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); + } else if (_vm->isFlag(kGFKeysTaken)) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_triedWindow) { + _vm->_gnapActionStatus = kAS04GetKeyAnother; + } else { + _vm->_gnapActionStatus = kAS04GetKeyFirst; + _triedWindow = true; + } + } + break; + case GRAB_CURSOR: + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS04ExitBarn: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS04LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 5; + else + _vm->_newSceneNum = 35; + } + break; + + case kHS04WalkArea1: + case kHS04WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + _vm->platypusSub426234(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(150) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(150) + 200; + _vm->_gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(20) + 60; + if (_nextDogSequenceId == -1) + _nextDogSequenceId = 0x210; + } + if (!_vm->_timers[8]) { + _vm->_timers[8] = _vm->getRandom(150) + 400; + _vm->_gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene04::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS04LeaveScene: + _vm->_sceneDone = true; + break; + case kAS04OpenDoor: + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gnapX = 6; + _vm->_gnapY = 7; + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + _vm->_gameSys->setAnimation(0x107B5, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapActionStatus = kAS04OpenDoorDone; + break; + case kAS04OpenDoorDone: + _vm->_gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = -1; + break; + case kAS04GetKeyFirst: + _vm->_gameSys->insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x204, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x204; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS04GetKeyFirst2; + break; + case kAS04GetKeyFirst2: + _vm->_gameSys->insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20B, 256, 0); + _vm->_gnapSequenceId = 0x206; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS04GetKeyFirstDone; + break; + case kAS04GetKeyFirstDone: + _vm->_gameSys->requestRemoveSequence(0x1FF, 256); + _vm->_gameSys->requestRemoveSequence(0x20B, 256); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapActionStatus = -1; + break; + case kAS04GetKeyAnother: + _vm->_gameSys->insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x202, _vm->_gnapId, 0); + _vm->_gnapSequenceId = 0x202; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS04GetKeyAnother2; + break; + case kAS04GetKeyAnother2: + _vm->_gameSys->insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20A, 256, 0); + _vm->_gnapSequenceId = 0x203; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS04GetKeyAnotherDone; + break; + case kAS04GetKeyAnotherDone: + _vm->_gameSys->removeSequence(0x1FF, 256, true); + _vm->_gameSys->removeSequence(0x20A, 256, true); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapActionStatus = -1; + break; + case kAS04GrabDog: + _nextDogSequenceId = 0x201; + break; + case kAS04GrabAxe: + _vm->_gameSys->insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->requestRemoveSequence(0x212, 100); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x211; + _vm->_gnapActionStatus = -1; + break; + default: + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->invAdd(kItemTwig); + _vm->setGrabCursorSprite(kItemTwig); + _vm->setFlag(kGFTwigTaken); + updateHotspots(); + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_nextDogSequenceId == 0x201) { + _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, + kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + _dogIdCtr = (_dogIdCtr + 1) % 2; + _currDogSequenceId = 0x201; + _vm->_gnapSequenceId = 0x200; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + _vm->_timers[6] = _vm->getRandom(20) + 60; + _nextDogSequenceId = -1; + } else if (_nextDogSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, + kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + _dogIdCtr = (_dogIdCtr + 1) % 2; + _currDogSequenceId = _nextDogSequenceId; + _nextDogSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS05Platypus = 0, + kHS05Haystack = 1, + kHS05Padlock = 2, + kHS05Ladder = 3, + kHS05ExitHouse = 4, + kHS05Chicken = 5, + kHS05Device = 6, + kHS05WalkArea1 = 7, + kHS05WalkArea2 = 8, + kHS05WalkArea3 = 9 +}; + +enum { + kAS05PlatSearchHaystack = 0, + kAS05TryPickPadlock = 1, + kAS05PickPadlock = 2, + kAS05TalkChicken = 3, + kAS05GrabChicken = 4, + kAS05GrabLadder = 5, + kAS05EnterBarn = 6, + kAS05UseTwigWithChicken = 11, + kAS05LeaveScene = 12 +}; + +Scene05::Scene05(GnapEngine *vm) : Scene(vm) { + _nextChickenSequenceId = -1; + _currChickenSequenceId = -1; +} + +int Scene05::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 3); + return _vm->isFlag(kGFBarnPadlockOpen) ? 0x151 : 0x150; +} + +void Scene05::updateHotspots() { + _vm->setHotspot(kHS05Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS05Haystack, 236, 366, 372, 442, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHS05Padlock, 386, 230, 626, 481, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHS05Ladder, 108, 222, 207, 444, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS05ExitHouse, 0, 395, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS05Chicken, 612, 462, 722, 564, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS05WalkArea1, 104, 0, 421, 480); + _vm->setHotspot(kHS05WalkArea2, 422, 0, 800, 487); + _vm->setHotspot(kHS05WalkArea3, 0, 0, 104, 499); + _vm->setDeviceHotspot(kHS05Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS05Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_hotspots[kHS05Padlock]._flags = SF_EXIT_U_CURSOR; + _vm->_hotspotsCount = 10; +} + +void Scene05::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(7); + + _currChickenSequenceId = 0x142; + _vm->_gameSys->setAnimation(0x142, 100, 3); + _vm->_gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); + + _nextChickenSequenceId = -1; + + _vm->_timers[5] = _vm->getRandom(10) + 30; + _vm->_timers[6] = _vm->getRandom(150) + 300; + + if (_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { + _vm->initGnapPos(-1, 8, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(-1, 9, kDirNone); + _vm->endSceneInit(); + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(2, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 9, -1, 0x107B9, 1); + } else { + _vm->initGnapPos(6, 8, kDirBottomRight); + if (_vm->isFlag(kGFPlatypus)) + _vm->initPlatypusPos(7, 9, kDirNone); + _vm->endSceneInit(); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 12, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS05Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS05Platypus: + if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS05Haystack: + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); + } else if (_vm->isFlag(kGFNeedleTaken)) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (_vm->isFlag(kGFPlatypus)) { + _vm->gnapUseDeviceOnPlatypuss(); + if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { + _vm->_platypusActionStatus = kAS05PlatSearchHaystack; + _vm->_platypusFacing = kDirUnk4; + } + if (_vm->_gnapX == 4 && (_vm->_gnapY == 8 || _vm->_gnapY == 7)) + _vm->gnapWalkStep(); + _vm->playGnapIdle(_vm->_platX, _vm->_platY); + } + break; + } + } + } + break; + + case kHS05Chicken: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTwig) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS05UseTwigWithChicken; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(9, 7); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS05GrabChicken; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS05TalkChicken; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS05Ladder: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(2, 4); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS05GrabLadder; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS05Padlock: + if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x - 1, _vm->_hotspotsWalkPos[2].y + 1, 0, -1, 1); + _vm->_gnapActionStatus = kAS05EnterBarn; + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 6; + else + _vm->_newSceneNum = 36; + } else if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemNeedle) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, + _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS05PickPadlock; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(7, 4); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS05TryPickPadlock; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS05ExitHouse: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS05LeaveScene; + if (_vm->isFlag(kGFPlatypus)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 4; + else + _vm->_newSceneNum = 37; + } + break; + + case kHS05WalkArea1: + case kHS05WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHS05WalkArea3: + // Nothing + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->isFlag(kGFPlatypus)) + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 30; + if (_vm->_gnapActionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { + if (_vm->getRandom(4) != 0) + _nextChickenSequenceId = 0x142; + else + _nextChickenSequenceId = 0x143; + } + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(150) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 30; + } + + _vm->gameUpdateTick(); + } +} + +void Scene05::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS05LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + case kAS05TryPickPadlock: + _vm->_gameSys->insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x148; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + break; + case kAS05PickPadlock: + _vm->_gameSys->setAnimation(0x147, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x147; + _vm->_gnapSequenceDatNum = 0; + _vm->setFlag(kGFBarnPadlockOpen); + _vm->setFlag(kGFSceneFlag1); + _vm->setGrabCursorSprite(-1); + _vm->_newSceneNum = 6; + _vm->_timers[2] = 100; + _vm->invRemove(kItemNeedle); + _vm->_gnapActionStatus = kAS05LeaveScene; + break; + case kAS05TalkChicken: + _nextChickenSequenceId = 0x144; + _vm->_gnapActionStatus = -1; + break; + case kAS05GrabChicken: + _nextChickenSequenceId = 0x14B; + break; + case kAS05GrabLadder: + while (_vm->_gameSys->isSequenceActive(0x149, 39)) + _vm->gameUpdateTick(); + _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x14D; + _vm->_gnapSequenceDatNum = 0; + _vm->_timers[2] = 200; + _vm->_timers[6] = 300; + _vm->_gnapActionStatus = -1; + break; + case kAS05EnterBarn: + _vm->_gameSys->insertSequence(0x107B1, 1, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gameSys->setAnimation(0x107B1, 1, 0); + _vm->_gnapActionStatus = kAS05LeaveScene; + break; + case kAS05UseTwigWithChicken: + _vm->playGnapShowItem(5, 0, 0); + _nextChickenSequenceId = 0x14F; + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (_vm->_platypusSequenceId == 0x146) { + _vm->_platX = 4; + _vm->_platY = 8; + _vm->_gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); + _vm->_platypusSequenceId = 0x7C1; + _vm->_platypusSequenceDatNum = 1; + _vm->_platypusId = 20 * _vm->_platY; + _vm->invAdd(kItemNeedle); + _vm->setFlag(kGFNeedleTaken); + _vm->setGrabCursorSprite(kItemNeedle); + _vm->showCursor(); + _vm->_timers[1] = 30; + _vm->_platypusActionStatus = -1; + } + if (_vm->_platypusActionStatus == kAS05PlatSearchHaystack) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->_platypusSequenceId = 0x146; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x146, 256, 1); + _vm->_timers[1] = 300; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_nextChickenSequenceId == 0x14B) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x14C; + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + _vm->_gnapActionStatus = -1; + } else if (_nextChickenSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS06Platypus = 0, + kHS06Gas = 1, + kHS06Ladder = 2, + kHS06Horse = 3, + kHS06ExitOutsideBarn = 4, + kHS06Device = 5, + kHS06WalkArea1 = 6, + kHS06WalkArea2 = 7, + kHS06WalkArea3 = 8, + kHS06WalkArea4 = 9, + kHS06WalkArea5 = 10 +}; + +enum { + kAS06TryToGetGas = 0, + kAS06TryToClimbLadder = 1, + kAS06TryToClimbLadderDone = 2, + kAS06TalkToHorse = 3, + kAS06UseTwigOnHorse = 4, + kAS06LeaveScene = 5 +}; + +Scene06::Scene06(GnapEngine *vm) : Scene(vm) { + _horseTurnedBack = false;; + _nextPlatSequenceId = -1; + _nextHorseSequenceId = -1; + _currHorseSequenceId = -1; +} + +int Scene06::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + if (_vm->isFlag(kGFSceneFlag1)) { + _vm->playSound(0x11B, false); + _vm->clearFlag(kGFSceneFlag1); + } + return 0x101; +} + +void Scene06::updateHotspots() { + _vm->setHotspot(kHS06Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS06Gas, 300, 120, 440, 232, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS06Ladder, 497, 222, 614, 492, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHS06Horse, 90, 226, 259, 376, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS06ExitOutsideBarn, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHS06WalkArea1, 0, 0, 200, 515); + _vm->setHotspot(kHS06WalkArea2, 200, 0, 285, 499); + _vm->setHotspot(kHS06WalkArea3, 688, 0, 800, 499); + _vm->setHotspot(kHS06WalkArea4, 475, 469, 800, 505); + _vm->setHotspot(kHS06WalkArea5, 0, 0, 800, 504); + _vm->setDeviceHotspot(kHS06Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFGasTaken)) + _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; + if (_vm->_cursorValue == 4) { + _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; + _vm->_hotspots[kHS06Gas]._flags = SF_DISABLED; + } + _vm->_hotspotsCount = 11; +} + +void Scene06::run() { + bool triedDeviceOnGas = false; + + _vm->startSoundTimerC(7); + + _horseTurnedBack = false; + _vm->_gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); + + _currHorseSequenceId = 0xF1; + _nextHorseSequenceId = -1; + + _vm->_gameSys->setAnimation(0xF1, 120, 2); + _vm->_timers[4] = _vm->getRandom(40) + 25; + + if (_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFGasTaken) && _vm->_cursorValue != 4) + _vm->_gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + _vm->initGnapPos(5, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 5, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS06Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS06Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDisguise) { + _vm->gnapUseDisguiseOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFKeysTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS06Gas: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(5, 0); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFUnk04)) { + _vm->playGnapImpossible(0, 0); + } else if (triedDeviceOnGas) { + _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107BC, 1); + _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS06TryToGetGas; + } else { + triedDeviceOnGas = true; + _vm->playGnapPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + if (_vm->isFlag(kGFUnk04)) + _vm->playGnapImpossible(0, 0); + else + _vm->playGnapScratchingHead(5, 0); + break; + } + } + } + break; + + case kHS06Ladder: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 4); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFGasTaken)) + _vm->playGnapImpossible(0, 0); + else { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS06TryToClimbLadder; + _vm->setFlag(kGFGasTaken); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS06Horse: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { + _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); + _vm->_platypusFacing = kDirNone; + _vm->_gnapActionStatus = kAS06UseTwigOnHorse; + _vm->setGrabCursorSprite(-1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(3, 2); + break; + case TALK_CURSOR: + if (_horseTurnedBack) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); + } else { + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS06TalkToHorse; + } + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS06ExitOutsideBarn: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS06LeaveScene; + if (_vm->_cursorValue == 1) + _vm->_newSceneNum = 5; + else + _vm->_newSceneNum = 35; + } + break; + + case kHS06WalkArea1: + case kHS06WalkArea2: + case kHS06WalkArea3: + case kHS06WalkArea4: + case kHS06WalkArea5: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(40) + 25; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextHorseSequenceId == -1) { + if (_horseTurnedBack) { + _nextHorseSequenceId = 0xF5; + } else { + switch (_vm->getRandom(5)) { + case 0: + case 1: + case 2: + _nextHorseSequenceId = 0xF1; + break; + case 3: + _nextHorseSequenceId = 0xF3; + break; + case 4: + _nextHorseSequenceId = 0xF4; + break; + } + } + } + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene06::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS06LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + case kAS06TryToGetGas: + _vm->_gameSys->insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xFC; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + break; + case kAS06TryToClimbLadder: + _vm->_gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xFD, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xFD; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS06TryToClimbLadderDone; + break; + case kAS06TryToClimbLadderDone: + _vm->_gnapX = 6; + _vm->_gnapY = 7; + _vm->_gnapActionStatus = -1; + break; + case kAS06TalkToHorse: + _nextHorseSequenceId = 0xF6; + break; + case kAS06UseTwigOnHorse: + _nextPlatSequenceId = 0xFB; + break; + default: + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusSequenceId == 0xFA) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->invAdd(kItemGas); + _vm->setFlag(kGFGasTaken); + _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; + _vm->setGrabCursorSprite(kItemGas); + _vm->_platypusActionStatus = -1; + _vm->_platX = 6; + _vm->_platY = 8; + _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); + _vm->_platypusSequenceId = 0x7C1; + _vm->_platypusSequenceDatNum = 1; + _vm->setFlag(kGFUnk04); + _vm->_gnapActionStatus = -1; + _vm->showCursor(); + } + if (_nextPlatSequenceId == 0xFB) { + _vm->_gameSys->setAnimation(0, 0, 1); + _nextHorseSequenceId = 0xF2; + _vm->_platypusActionStatus = 6; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { + switch (_nextHorseSequenceId) { + case 0xF2: + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->_gameSys->setAnimation(0xFA, 256, 1); + _vm->_gameSys->insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xFA; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B7; + _vm->_gnapSequenceDatNum = 1; + _currHorseSequenceId = _nextHorseSequenceId; + _nextHorseSequenceId = -1; + _nextPlatSequenceId = -1; + _vm->invRemove(kItemTwig); + break; + case 0xF6: + _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); + _vm->_gameSys->insertSequence(0xF6, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _horseTurnedBack = true; + _currHorseSequenceId = _nextHorseSequenceId; + _nextHorseSequenceId = -1; + _vm->_gnapActionStatus = -1; + break; + default: + _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); + _vm->_gameSys->insertSequence(_nextHorseSequenceId, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + _currHorseSequenceId = _nextHorseSequenceId; + _nextHorseSequenceId = -1; + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS07Platypus = 0, + kHS07ExitHouse = 1, + kHS07Dice = 2, + kHS07Device = 3, + kHS07WalkArea1 = 4, + kHS07WalkArea2 = 5, + kHS07WalkArea3 = 6 +}; + +enum { + kAS07Wait = 0, + kAS07LeaveScene = 1 +}; + +Scene07::Scene07(GnapEngine *vm) : Scene(vm) { +} + +int Scene07::init() { + return 0x92; +} + +void Scene07::updateHotspots() { + _vm->setHotspot(kHS07Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS07ExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); + _vm->setHotspot(kHS07Dice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS07WalkArea1, 0, 0, 325, 445); + _vm->setHotspot(kHS07WalkArea2, 325, 0, 799, 445, _vm->_isLeavingScene ? SF_WALKABLE : SF_NONE); + _vm->setHotspot(kHS07WalkArea3, 160, 0, 325, 495); + _vm->setDeviceHotspot(kHS07Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypus)) + _vm->_hotspots[kHS07Dice]._flags = SF_DISABLED; + _vm->_hotspotsCount = 7; +} + +void Scene07::run() { + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); + + _vm->invRemove(kItemGas); + _vm->invRemove(kItemNeedle); + + if (!_vm->isFlag(kGFPlatypus)) + _vm->_gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 8) { + _vm->initGnapPos(7, 7, kDirBottomLeft); + _vm->initPlatypusPos(9, 7, kDirUnk4); + _vm->endSceneInit(); + } else { + _vm->_gnapX = 6; + _vm->_gnapY = 7; + _vm->_gnapId = 140; + _vm->_gnapSequenceId = 0x8F; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS07Wait; + _vm->_platX = 3; + _vm->_platY = 8; + _vm->_platypusId = 160; + _vm->_platypusSequenceId = 0x91; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusFacing = kDirNone; + _vm->_gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + } + + _vm->_timers[3] = 600; + _vm->_timers[4] = _vm->getRandom(40) + 50; + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x10919)) + _vm->playSound(0x10919, true); + + if (_vm->testWalk(0, 1, 8, 7, 6, 7)) + updateHotspots(); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS07Platypus: + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHS07ExitHouse: + _vm->_isLeavingScene = true; + if (_vm->_gnapX > 8) + _vm->gnapWalkTo(_vm->_gnapX, 7, 0, 0x107AD, 1); + else + _vm->gnapWalkTo(8, 7, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kAS07LeaveScene; + break; + + case kHS07Dice: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 8, 3, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + break; + case GRAB_CURSOR: + _vm->setFlag(kGFPlatypus); + _vm->invAdd(kItemDice); + updateHotspots(); + _vm->playGnapPullOutDevice(3, 3); + _vm->_gameSys->setAnimation(0x8E, 1, 2); + _vm->_gameSys->insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = _vm->getGnapSequenceId(gskUseDevice, 0, 0); + _vm->_gnapSequenceDatNum = 1; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS07Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(40) + 50; + } + break; + + case kHS07WalkArea1: + case kHS07WalkArea2: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHS07WalkArea3: + // Nothing + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updateGnapIdleSequence(); + if (_vm->_platypusActionStatus < 0 && _vm->_gnapActionStatus < 0) { + if (_vm->_timers[0]) { + if (!_vm->_timers[1]) { + _vm->_timers[1] = _vm->getRandom(20) + 30; + int gnapRandomValue = _vm->getRandom(20); + // TODO Cleanup + if (_vm->_platypusFacing != kDirNone) { + if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7CA) { + if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7CA) { + if (_vm->_platY == 9) + _vm->playPlatypusSequence(0x107CA); + } else { + _vm->playPlatypusSequence(0x10845); + } + } else { + _vm->playPlatypusSequence(0x107CC); + } + } else if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7C9) { + if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7C9) { + if (_vm->_platY == 9) + _vm->playPlatypusSequence(0x107C9); + } else { + _vm->playPlatypusSequence(0x10844); + } + } else { + _vm->playPlatypusSequence(0x107CB); + } + _vm->_gameSys->setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); + } + } else { + _vm->_timers[0] = _vm->getRandom(75) + 75; + _vm->platypusMakeRoom(); + } + } else { + _vm->_timers[0] = 100; + _vm->_timers[1] = 35; + } + playRandomSound(4); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(40) + 50; + } + _vm->gameUpdateTick(); + } +} + +void Scene07::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS07LeaveScene: + _vm->_newSceneNum = 8; + _vm->_sceneDone = true; + break; + } + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->setGrabCursorSprite(kItemDice); + } +} + +/*****************************************************************************/ + +enum { + kH08SPlatypus = 0, + kHS08ExitBackdoor = 1, + kHS08ExitCrash = 2, + kHS08Man = 3, + kHS08Door = 4, + kHS08Meat = 5, + kHS08Bone = 6, + kHS08Toy = 7, + kHS08WalkArea1 = 8, + kHS08Device = 9, + kHS08WalkArea2 = 10 +}; + +enum { + kAS08LeaveScene = 0, + kAS08TalkMan = 1, + kAS08LookMan = 2, + kAS08LookDog = 3, + kAS08GrabDog = 4, + kAS08TalkDog = 5, + kAS08PlatWithMan = 6, + kAS08PlatWithDog = 7 +}; + +Scene08::Scene08(GnapEngine *vm) : Scene(vm) { + _nextDogSequenceId = -1; + _currDogSequenceId = -1; + _nextManSequenceId = -1; + _currManSequenceId = -1; +} + +int Scene08::init() { + return 0x150; +} + +void Scene08::updateHotspots() { + _vm->setHotspot(kH08SPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08ExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS08ExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS08Man, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Door, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Meat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Bone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08Toy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS08WalkArea1, 290, 340, -1, -1); + _vm->setHotspot(kHS08WalkArea2, 0, 0, 799, 420); + _vm->setDeviceHotspot(kHS08Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_hotspots[kHS08Meat]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_hotspots[kHS08Bone]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFTruckKeysUsed)) + _vm->_hotspots[kHS08Toy]._flags = SF_WALKABLE | SF_DISABLED; + _vm->_hotspotsCount = 11; +} + +void Scene08::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currDogSequenceId = _nextDogSequenceId; + if ( _nextDogSequenceId != 0x135 ) + _nextDogSequenceId = 0x134; + } +} + +void Scene08::run() { + _vm->queueInsertDeviceIcon(); + + _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); + + _currDogSequenceId = 0x135; + _nextDogSequenceId = 0x135; + + _vm->_gameSys->setAnimation(0x135, 100, 3); + _vm->_gameSys->insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + + _currManSequenceId = 0x140; + _nextManSequenceId = -1; + + _vm->_gameSys->setAnimation(0x140, 100, 2); + _vm->_gameSys->insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[4] = _vm->getRandom(50) + 75; + + if (!_vm->isFlag(kGFBarnPadlockOpen)) + _vm->_gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFTruckFilledWithGas)) + _vm->_gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFTruckKeysUsed)) + _vm->_gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-1, 7, kDirNone); + + _vm->endSceneInit(); + + _vm->gnapWalkTo(1, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + + _vm->_timers[5] = _vm->getRandom(40) + 50; + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x10919)) + _vm->playSound(0x10919, true); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS08Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(50) + 75; + _vm->_timers[5] = _vm->getRandom(40) + 50; + } + break; + + case kH08SPlatypus: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapActionIdle(0x14D); + _vm->gnapKissPlatypus(8); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + break; + } + } + break; + + case kHS08ExitBackdoor: + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(0, 6, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS08LeaveScene; + _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1); + _vm->_newSceneNum = 9; + break; + + case kHS08ExitCrash: + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(3, 9, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS08LeaveScene; + _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1); + _vm->_newSceneNum = 7; + break; + + case kHS08Man: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 6, 7, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS08LookMan; + _vm->_gnapIdleFacing = kDirUpRight; + break; + case GRAB_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS08TalkMan; + break; + case PLAT_CURSOR: + _vm->gnapActionIdle(0x14D); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kAS08PlatWithMan; + _vm->_platypusFacing = kDirNone; + _vm->playGnapIdle(6, 6); + break; + } + } + break; + + case kHS08Door: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 7, 5, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS08GrabDog; + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS08LookDog; + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS08GrabDog; + _vm->_gnapIdleFacing = kDirUpRight; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS08TalkDog; + break; + case PLAT_CURSOR: + _vm->setFlag(kGFSceneFlag1); + _vm->gnapActionIdle(0x14D); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kAS08PlatWithDog; + _vm->_platypusFacing = kDirNone; + _vm->playGnapIdle(3, 7); + break; + } + } + break; + + case kHS08Meat: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 8, 5, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 7); + break; + case GRAB_CURSOR: + if (_currDogSequenceId == 0x135) { + _vm->playGnapScratchingHead(6, 7); + } else { + _vm->gnapActionIdle(0x14D); + _vm->playGnapPullOutDevice(6, 7); + _vm->playGnapUseDevice(0, 0); + _nextDogSequenceId = 0x149; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS08Bone: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(2, 7, 3, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(3, 6); + break; + case GRAB_CURSOR: + if (_currDogSequenceId == 0x135) { + _vm->playGnapScratchingHead(3, 6); + } else { + _vm->gnapActionIdle(0x14D); + _vm->playGnapPullOutDevice(3, 6); + _vm->playGnapUseDevice(0, 0); + _nextDogSequenceId = 0x14A; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS08Toy: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(8, 7, 7, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(7, 6); + break; + case GRAB_CURSOR: + if (_currDogSequenceId == 0x135) { + _vm->playGnapScratchingHead(7, 6); + } else { + _vm->gnapActionIdle(0x14D); + _vm->playGnapPullOutDevice(7, 6); + _vm->playGnapUseDevice(0, 0); + _nextDogSequenceId = 0x14B; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS08WalkArea1: + case kHS08WalkArea2: + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(-1, 6, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapActionIdle(0x14D); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(50) + 125; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextManSequenceId == -1 && + (_currDogSequenceId == 0x134 || _currDogSequenceId == 0x135)) { + int _gnapRandomValue = _vm->getRandom(4); + switch (_gnapRandomValue) { + case 0: + _nextManSequenceId = 0x138; + break; + case 1: + _nextManSequenceId = 0x136; + break; + case 2: + _nextManSequenceId = 0x13B; + break; + case 3: + _nextManSequenceId = 0x13A; + break; + } + } + } + playRandomSound(5); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(50) + 75; + _vm->_timers[5] = _vm->getRandom(40) + 50; + } + + _vm->gameUpdateTick(); + } +} + +void Scene08::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS08LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + case kAS08TalkMan: + _nextManSequenceId = 0x13F; + _vm->_gnapActionStatus = -1; + break; + case kAS08LookMan: + _nextManSequenceId = 0x140; + _vm->_gnapActionStatus = -1; + break; + case kAS08LookDog: + _nextManSequenceId = 0x137; + _vm->_gnapActionStatus = -1; + break; + case kAS08GrabDog: + if (_currDogSequenceId == 0x135) + _nextDogSequenceId = 0x133; + else + _nextDogSequenceId = 0x13C; + _vm->_gnapActionStatus = -1; + break; + case kAS08TalkDog: + if (_currDogSequenceId == 0x135) + _nextDogSequenceId = 0x133; + else + _nextDogSequenceId = 0x13C; + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { + case kAS08PlatWithDog: + _nextDogSequenceId = 0x147; + break; + case kAS08PlatWithMan: + _nextManSequenceId = 0x140; + _vm->_platypusActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextManSequenceId, 100, 2); + _vm->_gameSys->insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currManSequenceId = _nextManSequenceId; + _nextManSequenceId = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_currDogSequenceId == 0x147) + _vm->_platypusActionStatus = -1; + if (_currDogSequenceId == 0x149 || _currDogSequenceId == 0x14A || _currDogSequenceId == 0x14B) { + if (_vm->getRandom(2) != 0) + _nextManSequenceId = 0x13D; + else + _nextManSequenceId = 0x13E; + } else if (_currDogSequenceId == 0x133) + _nextManSequenceId = 0x139; + if (_nextDogSequenceId == 0x149 || _nextDogSequenceId == 0x14A || _nextDogSequenceId == 0x14B) { + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + switch (_nextDogSequenceId) { + case 0x149: + _vm->setFlag(kGFBarnPadlockOpen); + _vm->_hotspots[kHS08Meat]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_gameSys->removeSequence(0x144, 1, true); + break; + case 0x14A: + _vm->setFlag(kGFTruckFilledWithGas); + _vm->_hotspots[kHS08Bone]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_gameSys->removeSequence(0x145, 1, true); + break; + case 0x14B: + _vm->setFlag(kGFTruckKeysUsed); + _vm->_hotspots[kHS08Toy]._flags = SF_DISABLED | SF_WALKABLE; + _vm->_gameSys->removeSequence(0x146, 1, true); + break; + } + _currDogSequenceId = _nextDogSequenceId; + _nextDogSequenceId = 0x134; + } else if (_nextDogSequenceId == 0x147) { + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _currDogSequenceId = _nextDogSequenceId; + _nextDogSequenceId = 0x134; + _vm->_platX = 1; + _vm->_platY = 8; + _vm->_platypusId = 160; + _vm->_platypusSequenceId = 0x148; + _vm->_platypusFacing = kDirUnk4; + _vm->_platypusSequenceDatNum = 0; + if (_vm->_gnapX == 1 && _vm->_gnapY == 8) + _vm->gnapWalkStep(); + } else if (_nextDogSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); + _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currDogSequenceId = _nextDogSequenceId; + if (_nextDogSequenceId != 0x135) + _nextDogSequenceId = 0x134; + if (_currDogSequenceId == 0x133) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x14D; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + } + } + } +} + +/*****************************************************************************/ + +enum { + kHS09Platypus = 0, + kHS09ExitKitchen = 1, + kHS09ExitHouse = 2, + kHS09Trash = 3, + kHS09Device = 4, + kHS09WalkArea1 = 5, + kHS09WalkArea2 = 6, + kHS09WalkArea3 = 7 +}; + +enum { + kAS09LeaveScene = 0, + kAS09SearchTrash = 1, + kAS09SearchTrashDone = 2 +}; + +Scene09::Scene09(GnapEngine *vm) : Scene(vm) { +} + +int Scene09::init() { + return 0x4E; +} + +void Scene09::updateHotspots() { + _vm->setHotspot(kHS09Platypus, 0, 200, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS09ExitKitchen, 280, 200, 380, 400, SF_EXIT_U_CURSOR); + _vm->setHotspot(kHS09ExitHouse, 790, 200, 799, 450, SF_EXIT_R_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS09Trash, 440, 310, 680, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS09WalkArea1, 0, 0, 799, 400); + _vm->setHotspot(kHS09WalkArea2, 0, 0, 630, 450); + _vm->setHotspot(kHS09WalkArea2, 0, 0, 175, 495); + _vm->setDeviceHotspot(kHS09Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 8; +} + +void Scene09::run() { + _vm->queueInsertDeviceIcon(); + + _vm->_gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 8) { + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); + } else { + _vm->initGnapPos(4, 7, kDirBottomRight); + _vm->initPlatypusPos(5, 7, kDirNone); + _vm->endSceneInit(); + } + + _vm->_timers[4] = _vm->getRandom(150) + 50; + _vm->_timers[5] = _vm->getRandom(40) + 50; + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x10919)) + _vm->playSound(0x10919, true); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS09Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(150) + 50; + _vm->_timers[5] = _vm->getRandom(40) + 50; + } + break; + + case kHS09Platypus: + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHS09ExitKitchen: + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 10; + _vm->gnapWalkTo(4, 7, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kAS09LeaveScene; + _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); + _vm->_platypusFacing = kDirUnk4; + break; + + case kHS09ExitHouse: + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 8; + _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS09LeaveScene; + _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); + _vm->_platypusFacing = kDirUnk4; + break; + + case kHS09Trash: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(9, 6, 8, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 3); + break; + case GRAB_CURSOR: + _vm->_gnapActionStatus = kAS09SearchTrash; + _vm->gnapWalkTo(9, 6, 0, 0x107BC, 1); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS09WalkArea1: + case kHS09WalkArea2: + case kHS09WalkArea3: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene && _vm->_gnapActionStatus != 1 && _vm->_gnapActionStatus != 2) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(150) + 100; + if (_vm->_timers[4] & 1) + _vm->_gameSys->insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); + } + playRandomSound(5); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(150) + 50; + _vm->_timers[5] = _vm->getRandom(40) + 50; + } + + _vm->gameUpdateTick(); + } +} + +void Scene09::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS09LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + case kAS09SearchTrash: + _vm->_gameSys->setAnimation(0x4C, 120, 0); + _vm->_gameSys->insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x4B, 2, true); + _vm->_gnapSequenceId = 0x4C; + _vm->_gnapId = 120; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 9; + _vm->_gnapY = 6; + _vm->_gnapActionStatus = kAS09SearchTrashDone; + break; + case kAS09SearchTrashDone: + _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[2] = 360; + _vm->_timers[4] = _vm->getRandom(150) + 100; + _vm->_gnapActionStatus = -1; + break; + } + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group0.h b/engines/gnap/scenes/group0.h new file mode 100644 index 0000000000..a705ba1483 --- /dev/null +++ b/engines/gnap/scenes/group0.h @@ -0,0 +1,183 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GROUP01_H +#define GNAP_GROUP01_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene01: public Scene { +public: + Scene01(GnapEngine *vm); + ~Scene01(); + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} + +private: + int _pigsIdCtr; + int _smokeIdCtr; + Graphics::Surface *_spaceshipSurface; +}; + +class Scene02: public Scene { +public: + Scene02(GnapEngine *vm); + ~Scene02() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} + +private: + int _truckGrillCtr; + int _nextChickenSequenceId; + int _currChickenSequenceId; + int _gnapTruckSequenceId; +}; + +class Scene03: public Scene { +public: + Scene03(GnapEngine *vm); + ~Scene03() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} + +private: + bool _platypusHypnotized; + bool _platypusScared; + int _nextPlatSequenceId; + int _nextFrogSequenceId; + int _currFrogSequenceId; +}; + +class Scene04: public Scene { +public: + Scene04(GnapEngine *vm); + ~Scene04() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} + +private: + bool _triedWindow; + int _dogIdCtr; + int _nextDogSequenceId; + int _currDogSequenceId; +}; + +class Scene05: public Scene { +public: + Scene05(GnapEngine *vm); + ~Scene05() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} + +private: + int _nextChickenSequenceId; + int _currChickenSequenceId; +}; + +class Scene06: public Scene { +public: + Scene06(GnapEngine *vm); + ~Scene06() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} + +private: + bool _horseTurnedBack; + int _nextPlatSequenceId; + int _nextHorseSequenceId; + int _currHorseSequenceId; +}; + +class Scene07: public Scene { +public: + Scene07(GnapEngine *vm); + ~Scene07() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} +}; + +class Scene08: public Scene { +public: + Scene08(GnapEngine *vm); + ~Scene08() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _nextDogSequenceId; + int _currDogSequenceId; + int _nextManSequenceId; + int _currManSequenceId; +}; + +class Scene09: public Scene { +public: + Scene09(GnapEngine *vm); + ~Scene09() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {} +}; + +} // End of namespace Gnap + +#endif // GNAP_GROUP01_H diff --git a/engines/gnap/scenes/intro.cpp b/engines/gnap/scenes/intro.cpp new file mode 100644 index 0000000000..0463f12ac6 --- /dev/null +++ b/engines/gnap/scenes/intro.cpp @@ -0,0 +1,181 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "video/avi_decoder.h" + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/intro.h" + +namespace Gnap { + +SceneIntro::SceneIntro(GnapEngine *vm) : Scene(vm) { +} + +int SceneIntro::init() { + return 0x37C; +} + +void SceneIntro::run() { + const int animIdArr[] = { + 0x356, 0x357, 0x358, 0x35A, 0x35F, + 0x360, 0x361, 0x362, 0x363, 0x364, + 0x365, 0x368, 0x369, 0x36B, 0x378, + 0x36C, 0x36D, 0x36E, 0x36F, 0x370, + 0x371, 0x372, 0x373, 0x374, 0x375, + 0x376, 0x377, 0x378, 0x379, 0x37A, + 0x37B, 0}; + + const int backgroundIdArr[] = { + 0x354, 0x355, 0, 1, 3, + 4, 5, 6, 7, 8, + 7, 9, 0xA, 0xB, 0xC, + 0xD, 0xE, 0xF, 0x10, 0x11, + 0x12, 0x13, 0x17, 0x14, 0x19, + 0x1A, 0x14, 0x15, 0x16, 0x14, + 0x19, 0}; + + int index = 0; + bool skip = false; + + _vm->hideCursor(); + _vm->_dat->open(1, "musop_n.dat"); + + Video::VideoDecoder *videoDecoder = new Video::AVIDecoder(); + if (!videoDecoder->loadFile("hoffman.avi")) { + delete videoDecoder; + warning("Unable to open video 'hoffman.avi' - Skipping intro"); + return; + } + videoDecoder->start(); + + int vidPosX = (800 - videoDecoder->getWidth()) / 2; + int vidPosY = (600 - videoDecoder->getHeight()) / 2; + bool skipVideo = false; + + _vm->screenEffect(1, 255, 255, 255); + + while (!_vm->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { + if (videoDecoder->needsUpdate()) { + const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + if (frame) { + if (frame->format.bytesPerPixel == 1) { + _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, vidPosX, vidPosY, frame->w, frame->h); + } else if (frame->format.bytesPerPixel != 4) { + Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getScreenFormat()); + _vm->_system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); + frame1->free(); + delete frame1; + } else { + // The intro AVI is played upside down, it's the only video played in the English version + for (uint16 y = 0; y < frame->h / 2; y++) { + uint32 *ptrFrom = (uint32*)frame->getBasePtr(0, y); + uint32 *ptrTo = (uint32*)frame->getBasePtr(0, frame->h - y - 1); + for (uint16 x = 0; x < frame->w; x++) { + uint32 t = *ptrFrom; + *ptrFrom = *ptrTo; + *ptrTo = t; + ptrFrom++; + ptrTo++; + } + } + + Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getScreenFormat()); + _vm->_system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); + frame1->free(); + delete frame1; + } + _vm->_system->updateScreen(); + } + } + + Common::Event event; + while (g_system->getEventManager()->pollEvent(event)) { + if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || + event.type == Common::EVENT_LBUTTONUP) + skipVideo = true; + } + + _vm->_system->delayMillis(10); + } + + delete videoDecoder; + + _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); + _vm->_gameSys->insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0x356, 2, 0); + + while (!_vm->_sceneDone) { + _vm->gameUpdateTick(); + + if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip ) { + skip = false; + _vm->_gameSys->requestClear2(false); + _vm->_gameSys->requestClear1(); + if ( index == 11 || index == 1 ) + _vm->screenEffect(0, 0, 0, 0); + + _vm->_gameSys->setAnimation(0, 0, 0); + if (++index >= 31) + _vm->_sceneDone = true; + else { + _vm->_gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); + if (index == 2) { + _vm->playSound(0x10000, false); + _vm->_gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); + } else if (index == 3) + _vm->_gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); + else if (index == 12) + _vm->_gameSys->insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); + _vm->_gameSys->setAnimation(animIdArr[index], 2, 0); + + if (index == 11) + _vm->stopSound(0x10000); + } + } + + if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(29)) { + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(29); + if (index == 0) { + skip = true; + _vm->stopSound(0x3CF); + } else if (index == 1) + skip = true; + else + _vm->_sceneDone = true; + } + } + + _vm->stopSound(0x10000); + + _vm->_newSceneNum = 1; + _vm->_newCursorValue = 1; + + _vm->_dat->open(1, "stock_n.dat"); +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/intro.h b/engines/gnap/scenes/intro.h new file mode 100644 index 0000000000..c744999a69 --- /dev/null +++ b/engines/gnap/scenes/intro.h @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_INTRO_H +#define GNAP_INTRO_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class SceneIntro: public Scene { +public: + SceneIntro(GnapEngine *vm); + ~SceneIntro() {} + + virtual int init(); + virtual void updateHotspots() {} + virtual void run(); + virtual void updateAnimations() {} + virtual void updateAnimationsCb() {} +}; + +} // End of namespace Gnap + +#endif // GNAP_INTRO_H diff --git a/engines/gnap/scenes/scene00.cpp b/engines/gnap/scenes/scene00.cpp deleted file mode 100644 index 9ee0eb38f2..0000000000 --- a/engines/gnap/scenes/scene00.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "video/avi_decoder.h" - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene00.h" - -namespace Gnap { - -Scene00::Scene00(GnapEngine *vm) : Scene(vm) { -} - -int Scene00::init() { - return 0x37C; -} - -void Scene00::run() { - const int animIdArr[] = { - 0x356, 0x357, 0x358, 0x35A, 0x35F, - 0x360, 0x361, 0x362, 0x363, 0x364, - 0x365, 0x368, 0x369, 0x36B, 0x378, - 0x36C, 0x36D, 0x36E, 0x36F, 0x370, - 0x371, 0x372, 0x373, 0x374, 0x375, - 0x376, 0x377, 0x378, 0x379, 0x37A, - 0x37B, 0}; - - const int backgroundIdArr[] = { - 0x354, 0x355, 0, 1, 3, - 4, 5, 6, 7, 8, - 7, 9, 0xA, 0xB, 0xC, - 0xD, 0xE, 0xF, 0x10, 0x11, - 0x12, 0x13, 0x17, 0x14, 0x19, - 0x1A, 0x14, 0x15, 0x16, 0x14, - 0x19, 0}; - - int index = 0; - bool skip = false; - - _vm->hideCursor(); - _vm->_dat->open(1, "musop_n.dat"); - - Video::VideoDecoder *videoDecoder = new Video::AVIDecoder(); - if (!videoDecoder->loadFile("hoffman.avi")) { - delete videoDecoder; - warning("Unable to open video 'hoffman.avi' - Skipping intro"); - return; - } - videoDecoder->start(); - - int vidPosX = (800 - videoDecoder->getWidth()) / 2; - int vidPosY = (600 - videoDecoder->getHeight()) / 2; - bool skipVideo = false; - - _vm->screenEffect(1, 255, 255, 255); - - while (!_vm->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { - if (videoDecoder->needsUpdate()) { - const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); - if (frame) { - if (frame->format.bytesPerPixel == 1) { - _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, vidPosX, vidPosY, frame->w, frame->h); - } else if (frame->format.bytesPerPixel != 4) { - Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getScreenFormat()); - _vm->_system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); - frame1->free(); - delete frame1; - } else { - // The intro AVI is played upside down, it's the only video played in the English version - for (uint16 y = 0; y < frame->h / 2; y++) { - uint32 *ptrFrom = (uint32*)frame->getBasePtr(0, y); - uint32 *ptrTo = (uint32*)frame->getBasePtr(0, frame->h - y - 1); - for (uint16 x = 0; x < frame->w; x++) { - uint32 t = *ptrFrom; - *ptrFrom = *ptrTo; - *ptrTo = t; - ptrFrom++; - ptrTo++; - } - } - - Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getScreenFormat()); - _vm->_system->copyRectToScreen(frame1->getPixels(), frame1->pitch, vidPosX, vidPosY, frame1->w, frame1->h); - frame1->free(); - delete frame1; - } - _vm->_system->updateScreen(); - } - } - - Common::Event event; - while (g_system->getEventManager()->pollEvent(event)) { - if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || - event.type == Common::EVENT_LBUTTONUP) - skipVideo = true; - } - - _vm->_system->delayMillis(10); - } - - delete videoDecoder; - - _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _vm->_gameSys->insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x356, 2, 0); - - while (!_vm->_sceneDone) { - _vm->gameUpdateTick(); - - if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip ) { - skip = false; - _vm->_gameSys->requestClear2(false); - _vm->_gameSys->requestClear1(); - if ( index == 11 || index == 1 ) - _vm->screenEffect(0, 0, 0, 0); - - _vm->_gameSys->setAnimation(0, 0, 0); - if (++index >= 31) - _vm->_sceneDone = true; - else { - _vm->_gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); - if (index == 2) { - _vm->playSound(0x10000, false); - _vm->_gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); - } else if (index == 3) - _vm->_gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); - else if (index == 12) - _vm->_gameSys->insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _vm->_gameSys->setAnimation(animIdArr[index], 2, 0); - - if (index == 11) - _vm->stopSound(0x10000); - } - } - - if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(29)) { - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(29); - if (index == 0) { - skip = true; - _vm->stopSound(0x3CF); - } else if (index == 1) - skip = true; - else - _vm->_sceneDone = true; - } - } - - _vm->stopSound(0x10000); - - _vm->_newSceneNum = 1; - _vm->_newCursorValue = 1; - - _vm->_dat->open(1, "stock_n.dat"); -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene00.h b/engines/gnap/scenes/scene00.h deleted file mode 100644 index d71722bcbc..0000000000 --- a/engines/gnap/scenes/scene00.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE00_H -#define GNAP_SCENE00_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene00: public Scene { -public: - Scene00(GnapEngine *vm); - ~Scene00() {} - - virtual int init(); - virtual void updateHotspots() {} - virtual void run(); - virtual void updateAnimations() {} - virtual void updateAnimationsCb() {} -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE00_H diff --git a/engines/gnap/scenes/scene01.cpp b/engines/gnap/scenes/scene01.cpp deleted file mode 100644 index 39f572a63b..0000000000 --- a/engines/gnap/scenes/scene01.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene01.h" - -namespace Gnap { - -enum { - kHS01Platypus = 0, - kHS01ExitTruck = 1, - kHS01Mud = 2, - kHS01Pigs = 3, - kHS01Spaceship = 4, - kHS01Device = 5, - kHS01WalkArea1 = 6, - kHS01WalkArea2 = 7, - kHS01WalkArea3 = 8, - kHS01WalkArea4 = 9, - kHS01WalkArea5 = 10, - kHS01WalkArea6 = 11, - kHS01WalkArea7 = 12, - kHS01WalkArea8 = 13 -}; - -enum { - kAS01LookSpaceship = 1, - kAS01LookSpaceshipDone = 2, - kAS01LeaveScene = 3, - kAS01TakeMud = 5, - kAS01LookPigs = 6, - kAS01UsePigs = 7 -}; - -Scene01::Scene01(GnapEngine *vm) : Scene(vm) { - _pigsIdCtr = 0; - _smokeIdCtr = 0; - _spaceshipSurface = nullptr; -} - -Scene01::~Scene01() { - delete _spaceshipSurface; -} - -int Scene01::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); - return 0x88; -} - -void Scene01::updateHotspots() { - _vm->setHotspot(kHS01Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS01ExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); - _vm->setHotspot(kHS01Mud, 138, 282, 204, 318, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); - _vm->setHotspot(kHS01Pigs, 408, 234, 578, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 4); - _vm->setHotspot(kHS01Spaceship, 0, 200, 94, 292, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); - _vm->setHotspot(kHS01WalkArea1, 0, 0, 162, 426); - _vm->setHotspot(kHS01WalkArea2, 162, 0, 237, 396); - _vm->setHotspot(kHS01WalkArea3, 237, 0, 319, 363); - _vm->setHotspot(kHS01WalkArea4, 520, 0, 800, 404); - _vm->setHotspot(kHS01WalkArea5, 300, 447, 800, 600); - _vm->setHotspot(kHS01WalkArea6, 678, 0, 800, 404); - _vm->setHotspot(kHS01WalkArea7, 0, 0, 520, 351); - _vm->setHotspot(kHS01WalkArea8, 0, 546, 300, 600); - _vm->setDeviceHotspot(kHS01Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS01Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->isFlag(kGFMudTaken)) - _vm->_hotspots[kHS01Mud]._flags = SF_WALKABLE | SF_DISABLED; - _vm->_hotspotsCount = 14; -} - -void Scene01::run() { - // NOTE Removed _s01_dword_474380 which was set when the mud was taken - // which is also set in the global game flags. - - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(5); - - _vm->_gameSys->setAnimation(134, 20, 4); - _vm->_gameSys->insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_gameSys->setAnimation(0x7F, 40, 2); - _vm->_gameSys->insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[4] = _vm->getRandom(100) + 300; - - if (!_vm->isFlag(kGFMudTaken)) - _vm->_gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 2) { - _vm->initGnapPos(11, 6, kDirBottomLeft); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(12, 6, kDirUnk4); - _vm->endSceneInit(); - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); - _vm->gnapWalkTo(8, 6, -1, 0x107B9, 1); - } else { - _vm->initGnapPos(1, 6, kDirBottomRight); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(1, 7, kDirNone); - _vm->endSceneInit(); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - _vm->testWalk(0, 3, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - - case kHS01Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHS01Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { - if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS01Spaceship: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS01LookSpaceship; - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS01Mud: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 3); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01TakeMud; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS01Pigs: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01LookPigs; - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01UsePigs; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01LookPigs; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS01ExitTruck: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS01LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); - _vm->_newSceneNum = 2; - } - break; - - case kHS01WalkArea1: - case kHS01WalkArea2: - case kHS01WalkArea3: - case kHS01WalkArea4: - case kHS01WalkArea5: - case kHS01WalkArea6: - case kHS01WalkArea7: - case kHS01WalkArea8: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (_vm->_timers[4] == 0) { - // Update bird animation - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->getRandom(1) == 0) - _vm->_gameSys->insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene01::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS01LookSpaceship: - _spaceshipSurface = _vm->_gameSys->createSurface(47); - _vm->_gameSys->insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); - _vm->_gameSys->setAnimation(133, 256, 0); - _vm->_gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = kAS01LookSpaceshipDone; - break; - - case kAS01LookSpaceshipDone: - _vm->_gameSys->removeSequence(133, 256, true); - _vm->_gameSys->removeSpriteDrawItem(_spaceshipSurface, 255); - _vm->deleteSurface(&_spaceshipSurface); - _vm->_gnapActionStatus = -1; - break; - - case kAS01LeaveScene: - _vm->_sceneDone = true; - break; - - case kAS01TakeMud: - _vm->playGnapPullOutDevice(2, 3); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(128, 40, 3); - _vm->_gnapActionStatus = -1; - break; - - case kAS01LookPigs: - _vm->playSound(138, false); - _vm->playSound(139, false); - _vm->playSound(140, false); - _vm->_gnapActionStatus = -1; - break; - - case kAS01UsePigs: - _vm->playGnapPullOutDevice(7, 2); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->invAdd(kItemMud); - _vm->setGrabCursorSprite(kItemMud); - _vm->setFlag(kGFMudTaken); - updateHotspots(); - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - _smokeIdCtr = (_smokeIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x86, _smokeIdCtr + 20, 4); - _vm->_gameSys->insertSequence(0x86, _smokeIdCtr + 20, - 0x86, (_smokeIdCtr + 1) % 2 + 20, - kSeqSyncWait, 0, 0, 0); - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _pigsIdCtr = (_pigsIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x7F, _pigsIdCtr + 40, 2); - _vm->_gameSys->insertSequence(0x7F, _pigsIdCtr + 40, - 0x7F, (_pigsIdCtr + 1) % 2 + 40, - kSeqSyncWait, 0, 0, 0); - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene01.h b/engines/gnap/scenes/scene01.h deleted file mode 100644 index 8aca9fa360..0000000000 --- a/engines/gnap/scenes/scene01.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE01_H -#define GNAP_SCENE01_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene01: public Scene { -public: - Scene01(GnapEngine *vm); - ~Scene01(); - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} - -private: - int _pigsIdCtr; - int _smokeIdCtr; - Graphics::Surface *_spaceshipSurface; -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE01_H diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp deleted file mode 100644 index b95810ad7e..0000000000 --- a/engines/gnap/scenes/scene02.cpp +++ /dev/null @@ -1,538 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene02.h" - -namespace Gnap { - -enum { - kHS02Platypus = 0, - kHS02Chicken = 1, - kHS02Truck1 = 2, - kHS02Truck2 = 3, - kHS02TruckGrill = 4, - kHS02Device = 5, - kHS02ExitHouse = 6, - kHS02ExitBarn = 7, - kHS02ExitCreek = 8, - kHS02ExitPigpen = 9, - kHS02WalkArea1 = 10, - kHS02WalkArea2 = 11, - kHS02WalkArea3 = 12, - kHS02WalkArea4 = 13 -}; - -enum { - kAS02UseTruckNoKeys = 0, - kAS02UseGasWithTruck = 1, - kAS02UseTruckGas = 2, - kAS02UseTruckNoGas = 3, - kAS02GrabTruckGrill = 5, - kAS02LeaveScene = 6, - kAS02TalkChicken = 7, - kAS02GrabChicken = 8, - kAS02GrabChickenDone = 9, - kAS02UseTruckNoKeysDone = 11, - kAS02UseGasWithTruckDone = 12, - kAS02UseTwigWithChicken = 16 -}; - -Scene02::Scene02(GnapEngine *vm) : Scene(vm) { - _truckGrillCtr = 0; - _nextChickenSequenceId = 0; - _currChickenSequenceId = 0; - _gnapTruckSequenceId = 0; -} - -int Scene02::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - return _vm->isFlag(kGFTruckKeysUsed) ? 0x15A : 0x15B; -} - -void Scene02::updateHotspots() { - _vm->setHotspot(kHS02Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE); - _vm->setHotspot(kHS02Chicken, 606, 455, 702, 568, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHS02Truck1, 385, 258, 464, 304, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 5); - _vm->setHotspot(kHS02Truck2, 316, 224, 390, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 6); - _vm->setHotspot(kHS02TruckGrill, 156, 318, 246, 390, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 7); - _vm->setHotspot(kHS02ExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 5); - _vm->setHotspot(kHS02ExitBarn, 610, 0, 800, 164, SF_EXIT_U_CURSOR, 10, 5); - _vm->setHotspot(kHS02ExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - _vm->setHotspot(kHS02ExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHS02WalkArea1, 92, 140, 304, 430, 0, 3, 1); - _vm->setHotspot(kHS02WalkArea2, 0, 0, 800, 380); - _vm->setHotspot(kHS02WalkArea3, 0, 0, 386, 445); - _vm->setHotspot(kHS02WalkArea4, 386, 0, 509, 410); - _vm->setDeviceHotspot(kHS02Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS02Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _vm->_hotspotsCount = 14; -} - -void Scene02::run() { - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(6); - - _currChickenSequenceId = 0x14B; - _vm->_gameSys->setAnimation(0x14B, 179, 2); - _vm->_gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); - - _nextChickenSequenceId = -1; - _vm->_timers[5] = _vm->getRandom(20) + 30; - _vm->_timers[4] = _vm->getRandom(100) + 300; - - _vm->queueInsertDeviceIcon(); - - switch (_vm->_prevSceneNum) { - case 3: - _vm->initGnapPos(11, 6, kDirBottomLeft); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(12, 6, kDirUnk4); - _vm->endSceneInit(); - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); - _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); - break; - case 4: - _vm->initGnapPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(7, 6, 0, 0x107B9, 1); - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(8, 6, 1, 0x107C2, 1); - updateHotspots(); - _vm->_gameSys->waitForUpdate(); - break; - case 47: - _vm->clearFlag(kGFUnk25); - _vm->initGnapPos(5, 6, kDirBottomLeft); - _vm->initPlatypusPos(6, 7, kDirUnk4); - _vm->endSceneInit(); - break; - case 49: - _vm->initGnapPos(5, 6, kDirBottomRight); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(6, 7, kDirNone); - _vm->endSceneInit(); - break; - default: - _vm->initGnapPos(-1, 6, kDirBottomRight); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(-1, 7, kDirNone); - _vm->endSceneInit(); - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - break; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 6, 7, 6, 8, 6); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS02Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHS02Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { - if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS02Chicken: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS02UseTwigWithChicken; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(9, 8); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS02GrabChicken; - else - _vm->_gnapActionStatus = -1; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS02TalkChicken; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS02Truck1: - case kHS02Truck2: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemKeys); - if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnapActionStatus = kAS02UseTruckGas; - else - _vm->_gnapActionStatus = kAS02UseTruckNoGas; - } - } else if (_vm->_grabCursorSpriteIndex == kItemGas) { - _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS02UseGasWithTruck; - _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 2); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { - if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnapActionStatus = kAS02UseTruckGas; - else - _vm->_gnapActionStatus = kAS02UseTruckNoGas; - } - } else { - _vm->_gnapIdleFacing = kDirUnk4; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS02UseTruckNoKeys; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS02TruckGrill: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(2, 4); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS02GrabTruckGrill; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS02ExitHouse: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, -1, 0x107C1, 1); - updateHotspots(); - _vm->_newSceneNum = 4; - } - break; - - case kHS02ExitBarn: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7].x + 1, _vm->_hotspotsWalkPos[7].y, -1, 0x107C1, 1); - updateHotspots(); - _vm->_newSceneNum = 5; - } - break; - - case kHS02ExitCreek: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, -1, 0x107CD, 1); - _vm->_newSceneNum = 3; - } - break; - - case kHS02ExitPigpen: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, -1, 0x107CF, 1); - _vm->_newSceneNum = 1; - } - break; - - case kHS02WalkArea1: - case kHS02WalkArea2: - case kHS02WalkArea3: - case kHS02WalkArea4: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - // Update bird animation - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { - if (_vm->getRandom(6) != 0) { - _nextChickenSequenceId = 0x14B; - _vm->_timers[5] = _vm->getRandom(20) + 30; - } else { - _nextChickenSequenceId = 0x14D; - _vm->_timers[5] = _vm->getRandom(20) + 50; - } - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene02::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { - case kAS02UseTruckNoKeys: - _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x14E, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x14E; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS02UseTruckNoKeysDone; - break; - case kAS02UseGasWithTruck: - _vm->_gameSys->insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x151, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x151; - _vm->_gnapSequenceDatNum = 0; - _vm->invRemove(kItemGas); - _vm->setGrabCursorSprite(-1); - _vm->setFlag(kGFTruckFilledWithGas); - _vm->_gnapActionStatus = kAS02UseGasWithTruckDone; - break; - case kAS02UseTruckGas: - _vm->_timers[5] = 9999; - _vm->_timers[4] = 9999; - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->waitForUpdate(); - _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnapSequenceId = 0x14F; - _vm->_gnapSequenceDatNum = 0; - _vm->invRemove(kItemKeys); - _vm->setGrabCursorSprite(-1); - } - _vm->_newSceneNum = 47; - _vm->_sceneDone = true; - break; - case kAS02UseTruckNoGas: - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->_timers[4] = 250; - if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->waitForUpdate(); - _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnapSequenceId = 0x14F; - _vm->_gnapSequenceDatNum = 0; - _vm->invRemove(kItemKeys); - _vm->setGrabCursorSprite(-1); - } - _vm->_newSceneNum = 47; - _vm->_sceneDone = true; - _vm->setFlag(kGFUnk25); - break; - case kAS02GrabTruckGrill: - switch (_truckGrillCtr) { - case 0: - _gnapTruckSequenceId = 0x158; - break; - case 1: - _gnapTruckSequenceId = 0x159; - break; - case 2: - _gnapTruckSequenceId = 0x157; - break; - } - _truckGrillCtr = (_truckGrillCtr + 1) % 3; - _vm->_gameSys->insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); - _vm->_gnapSequenceId = _gnapTruckSequenceId; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - break; - case kAS02LeaveScene: - _vm->_sceneDone = true; - break; - case kAS02TalkChicken: - _nextChickenSequenceId = 0x14C; - break; - case kAS02GrabChicken: - _nextChickenSequenceId = 0x150; - _vm->_timers[2] = 100; - break; - case kAS02GrabChickenDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _currChickenSequenceId = 0x14B; - _vm->_gameSys->setAnimation(0x14B, 179, 2); - _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - _vm->_timers[5] = 30; - break; - case kAS02UseTwigWithChicken: - _vm->playGnapShowItem(5, 0, 0); - _vm->_gameSys->insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); - _currChickenSequenceId = 0x155; - _nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; - break; - case kAS02UseTruckNoKeysDone: - case kAS02UseGasWithTruckDone: - default: - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_nextChickenSequenceId == 0x150) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); - _nextChickenSequenceId = -1; - _currChickenSequenceId = -1; - _vm->_gnapActionStatus = kAS02GrabChickenDone; - _vm->_timers[5] = 500; - } else if (_nextChickenSequenceId == 0x14C) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _currChickenSequenceId = _nextChickenSequenceId; - _nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; - } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _currChickenSequenceId = _nextChickenSequenceId; - _nextChickenSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene02.h b/engines/gnap/scenes/scene02.h deleted file mode 100644 index 187f24d35a..0000000000 --- a/engines/gnap/scenes/scene02.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE02_H -#define GNAP_SCENE02_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene02: public Scene { -public: - Scene02(GnapEngine *vm); - ~Scene02() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} - -private: - int _truckGrillCtr; - int _nextChickenSequenceId; - int _currChickenSequenceId; - int _gnapTruckSequenceId; -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE02_H diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp deleted file mode 100644 index 3c35ee32bd..0000000000 --- a/engines/gnap/scenes/scene03.cpp +++ /dev/null @@ -1,517 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene03.h" -namespace Gnap { - -enum { - kHS03Platypus = 0, - kHS03Grass = 1, - kHS03ExitTruck = 2, - kHS03Creek = 3, - kHS03TrappedPlatypus = 4, - kHS03Device = 5, - kHS03WalkAreas1 = 6, - kHS03WalkAreas2 = 7, - kHS03PlatypusWalkArea = 8, - kHS03WalkAreas3 = 9 -}; - -enum { - kAS03LeaveScene = 0, - kAS03FreePlatypus = 1, - kAS03HypnotizePlat = 2, - kAS03HypnotizeScaredPlat= 3, - kAS03FreePlatypusDone = 4, - kAS03GrabPlatypus = 5, - kAS03GrabCreek = 6, - kAS03GrabCreekDone = 7, - kAS03GrabScaredPlatypus = 8 -}; - -Scene03::Scene03(GnapEngine *vm) : Scene(vm) { - _nextPlatSequenceId = -1; - _platypusScared = false; - _platypusHypnotized = false; - _nextFrogSequenceId = -1; - _currFrogSequenceId = -1; -} - -int Scene03::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 5); - return 0x1CC; -} - -void Scene03::updateHotspots() { - _vm->setHotspot(kHS03Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS03Grass, 646, 408, 722, 458, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); - _vm->setHotspot(kHS03ExitTruck, 218, 64, 371, 224, SF_EXIT_U_CURSOR | SF_WALKABLE, 4, 4); - _vm->setHotspot(kHS03Creek, 187, 499, 319, 587, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHS03TrappedPlatypus, 450, 256, 661, 414, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 5); - _vm->setHotspot(kHS03WalkAreas1, 0, 500, 300, 600); - _vm->setHotspot(kHS03WalkAreas2, 300, 447, 800, 600); - _vm->setHotspot(kHS03PlatypusWalkArea, 235, 0, 800, 600); - _vm->setHotspot(kHS03WalkAreas3, 0, 0, 800, 354); - _vm->setDeviceHotspot(kHS03Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS03Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->isFlag(kGFGrassTaken)) - _vm->_hotspots[kHS03Grass]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS03TrappedPlatypus]._flags = SF_DISABLED; - if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) - _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - _vm->_hotspotsCount = 10; -} - -void Scene03::run() { - _vm->playSound(0x10925, true); - _vm->startSoundTimerC(7); - - _vm->_gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); - - _platypusHypnotized = false; - - _vm->initGnapPos(3, 4, kDirBottomRight); - - _vm->_gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); - - _currFrogSequenceId = 0x1C6; - _nextFrogSequenceId = -1; - _vm->_gameSys->setAnimation(0x1C6, 253, 2); - - _vm->_timers[6] = _vm->getRandom(20) + 30; - _vm->_timers[4] = _vm->getRandom(100) + 300; - _vm->_timers[5] = _vm->getRandom(100) + 200; - - if (_vm->isFlag(kGFPlatypus)) { - _vm->initPlatypusPos(5, 4, kDirNone); - } else { - _vm->_timers[1] = _vm->getRandom(40) + 20; - _vm->_gameSys->setAnimation(0x1C2, 99, 1); - _vm->_gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceId = 0x1C2; - _vm->_platypusSequenceDatNum = 0; - } - - _vm->_gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFGrassTaken)) - _vm->_gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - _vm->endSceneInit(); - - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(4, 7, -1, 0x107C2, 1); - _vm->gnapWalkTo(3, 6, -1, 0x107B9, 1); - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS03Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { - if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS03Grass: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFGrassTaken)) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 6); - break; - case GRAB_CURSOR: - _vm->playGnapPullOutDevice(9, 6); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1B3, 253, 5); - _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS03ExitTruck: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS03LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, -1, 0x107C2, 1); - _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; - if (_vm->_cursorValue == 1) - _vm->_newSceneNum = 2; - else - _vm->_newSceneNum = 33; - } - break; - - case kHS03Creek: - if (_vm->_gnapActionStatus == -1) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(2, 8); - break; - case GRAB_CURSOR: - if (!_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS03GrabCreek; - if (!_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS03TrappedPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatypus)) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 4); - break; - case GRAB_CURSOR: - if (_platypusHypnotized) { - _vm->gnapWalkTo(7, 6, 0, 0x107B5, 1); - _vm->_gnapActionStatus = kAS03FreePlatypus; - } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - if (_platypusScared) - _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; - else - _vm->_gnapActionStatus = kAS03GrabPlatypus; - } - break; - case TALK_CURSOR: - if (_platypusHypnotized) { - _vm->playGnapBrainPulsating(8, 4); - } else { - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - if (_platypusScared) - _vm->_gnapActionStatus = kAS03HypnotizeScaredPlat; - else - _vm->_gnapActionStatus = kAS03HypnotizePlat; - } - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS03Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHS03WalkAreas1: - case kHS03WalkAreas2: - case kHS03WalkAreas3: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - case kHS03PlatypusWalkArea: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107B5, 1); - if (_platypusScared) - _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; - else - _vm->_gnapActionStatus = kAS03GrabPlatypus; - } - } - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10925)) - _vm->playSound(0x10925, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[1] && !_platypusScared) { - _vm->_timers[1] = _vm->getRandom(40) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) - _nextPlatSequenceId = 450; - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextFrogSequenceId == -1) { - if (_vm->getRandom(5) == 1) - _nextFrogSequenceId = 0x1C6; - else - _nextFrogSequenceId = 0x1C7; - } - } - if (!_vm->_timers[4]) { - // Update bird animation - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) - _vm->_gameSys->insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 200; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - _vm->_gameSys->setAnimation(0x1C5, 253, 4); - _vm->_gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); - } - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(100) + 200; - _vm->_timers[4] = _vm->getRandom(100) + 300; - _vm->_timers[6] = _vm->getRandom(20) + 30; - } - - _vm->gameUpdateTick(); - } -} - -void Scene03::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS03LeaveScene: - _vm->_sceneDone = true; - break; - case kAS03FreePlatypus: - _nextPlatSequenceId = 0x1BC; - break; - case kAS03FreePlatypusDone: - _vm->_gnapActionStatus = -1; - _vm->_platX = 6; - _vm->_platY = 6; - _vm->_platypusFacing = kDirUnk4; - _vm->_platypusId = 120; - _vm->_gameSys->insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, - kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceDatNum = 1; - _vm->_platypusSequenceId = 0x7CA; - _vm->setFlag(kGFPlatypus); - _nextPlatSequenceId = -1; - updateHotspots(); - break; - case kAS03HypnotizePlat: - _vm->playGnapBrainPulsating(0, 0); - _vm->addFullScreenSprite(0x106, 255); - _vm->_gameSys->setAnimation(0x1C9, 256, 1); - _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(1) != 2) - _vm->gameUpdateTick(); - _vm->removeFullScreenSprite(); - _vm->_gameSys->setAnimation(0x1BA, 99, 1); - _vm->_gameSys->insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x1BA; - _vm->_gnapActionStatus = -1; - _platypusHypnotized = true; - updateHotspots(); - break; - case kAS03HypnotizeScaredPlat: - _vm->playGnapBrainPulsating(0, 0); - _vm->_gameSys->insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1BF, 99, 1); - while (_vm->_gameSys->getAnimationStatus(1) != 2) - _vm->gameUpdateTick(); - _vm->addFullScreenSprite(0x106, 255); - _vm->_gameSys->setAnimation(0x1C9, 256, 1); - _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(1) != 2) - _vm->gameUpdateTick(); - _vm->removeFullScreenSprite(); - _vm->_gameSys->setAnimation(0x1BA, 99, 1); - _vm->_gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x1BA; - _vm->_gnapActionStatus = -1; - _platypusHypnotized = true; - updateHotspots(); - break; - case kAS03GrabPlatypus: - _nextPlatSequenceId = 0x1BD; - _platypusHypnotized = false; - break; - case kAS03GrabScaredPlatypus: - _nextPlatSequenceId = 0x1C0; - _platypusHypnotized = false; - break; - case kAS03GrabCreek: - _vm->_gameSys->insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1B4, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x1B4; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS03GrabCreekDone; - break; - default: - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { - _vm->_gameSys->setAnimation(0, 0, 1); - _platypusScared = true; - _vm->_gameSys->insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x1B5; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirNone; - _vm->_platypusSequenceId = _nextPlatSequenceId; - _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_nextPlatSequenceId, 99, 1); - _nextPlatSequenceId = -1; - _vm->_gnapActionStatus = -1; - } else if (_nextPlatSequenceId == 0x1BC) { - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gameSys->insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1BC, 99, 0); - _vm->_gnapId = 20 * _vm->_gnapY; - _vm->_gnapSequenceId = 0x1B6; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirNone; - _vm->_gnapActionStatus = kAS03FreePlatypusDone; - _nextPlatSequenceId = -1; - } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0x1C2; - _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x1C2, 99, 1); - _nextPlatSequenceId = -1; - } else if (_nextPlatSequenceId == -1 && _platypusScared && !_platypusHypnotized) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0x1BE, 99, 1); - _vm->_gameSys->insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0x1BE; - _vm->_platypusSequenceDatNum = 0; - _nextPlatSequenceId = -1; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextFrogSequenceId, 253, 2); - _vm->_gameSys->insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); - _currFrogSequenceId = _nextFrogSequenceId; - _nextFrogSequenceId = -1; - } - - if (_vm->_gameSys->getAnimationStatus(5) == 2) { - _vm->_gameSys->setAnimation(0, 0, 5); - _vm->invAdd(kItemGrass); - _vm->setGrabCursorSprite(kItemGrass); - _vm->setFlag(kGFGrassTaken); - updateHotspots(); - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene03.h b/engines/gnap/scenes/scene03.h deleted file mode 100644 index aac06ccac2..0000000000 --- a/engines/gnap/scenes/scene03.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE03_H -#define GNAP_SCENE03_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene03: public Scene { -public: - Scene03(GnapEngine *vm); - ~Scene03() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} - -private: - bool _platypusHypnotized; - bool _platypusScared; - int _nextPlatSequenceId; - int _nextFrogSequenceId; - int _currFrogSequenceId; -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE03_H diff --git a/engines/gnap/scenes/scene04.cpp b/engines/gnap/scenes/scene04.cpp deleted file mode 100644 index d61ceac57e..0000000000 --- a/engines/gnap/scenes/scene04.cpp +++ /dev/null @@ -1,572 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene04.h" - -namespace Gnap { - -enum { - kHS04Platypus = 0, - kHS04Twig = 1, - kHS04Dog = 2, - kHS04Axe = 3, - kHS04Door = 4, - kHS04ExitTruck = 5, - kHS04Device = 6, - kHS04Window = 7, - kHS04ExitBarn = 8, - kHS04WalkArea1 = 9, - kHS04WalkArea2 = 10 -}; - -enum { - kAS04OpenDoor = 1, - kAS04GetKeyFirst = 2, - kAS04GetKeyAnother = 3, - kAS04LeaveScene = 4, - kAS04GetKeyFirstDone = 6, - kAS04GetKeyFirst2 = 7, - kAS04GetKeyAnother2 = 8, - kAS04GetKeyAnotherDone = 9, - kAS04OpenDoorDone = 10, - kAS04GrabDog = 12, - kAS04GrabAxe = 13 -}; - -Scene04::Scene04(GnapEngine *vm) : Scene(vm) { - _dogIdCtr = 0; - _triedWindow = false; - _nextDogSequenceId = -1; - _currDogSequenceId = -1; -} - -int Scene04::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - return 0x214; -} - -void Scene04::updateHotspots() { - _vm->setHotspot(kHS04Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS04Twig, 690, 394, 769, 452, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 6); - _vm->setHotspot(kHS04Dog, 550, 442, 680, 552, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - _vm->setHotspot(kHS04Axe, 574, 342, 680, 412, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - _vm->setHotspot(kHS04Door, 300, 244, 386, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - _vm->setHotspot(kHS04ExitTruck, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHS04Window, 121, 295, 237, 342, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHS04ExitBarn, 585, 154, 800, 276, SF_EXIT_U_CURSOR, 10, 8); - _vm->setHotspot(kHS04WalkArea1, 0, 0, 562, 461); - _vm->setHotspot(kHS04WalkArea2, 562, 0, 800, 500); - _vm->setDeviceHotspot(kHS04Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS04Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->isFlag(kGFTwigTaken)) - _vm->_hotspots[kHS04Twig]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->isFlag(kGFPlatypusTalkingToAssistant) || _vm->_cursorValue == 1) - _vm->_hotspots[kHS04Axe]._flags = SF_DISABLED; - _vm->_hotspotsCount = 11; -} - -void Scene04::run() { - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(4); - - _vm->_gameSys->insertSequence(0x210, 139 - _dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); - - _currDogSequenceId = 0x210; - _nextDogSequenceId = -1; - - _vm->_gameSys->setAnimation(0x210, 139 - _dogIdCtr, 3); - _dogIdCtr = (_dogIdCtr + 1) % 2; - _vm->_timers[6] = _vm->getRandom(20) + 60; - _vm->_timers[5] = _vm->getRandom(150) + 300; - _vm->_timers[7] = _vm->getRandom(150) + 200; - _vm->_timers[8] = _vm->getRandom(150) + 400; - - if (!_vm->isFlag(kGFPlatypusTalkingToAssistant) && _vm->_cursorValue == 4) - _vm->_gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFTwigTaken)) - _vm->_gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFPlatyPussDisguised)) { - _vm->_timers[3] = 300; - // TODO setCursor((LPCSTR)IDC_WAIT); - _vm->setGrabCursorSprite(kItemKeys); - _vm->_gnapX = 4; - _vm->_gnapY = 7; - _vm->_gnapId = 140; - _vm->_platX = 6; - _vm->_platY = 7; - _vm->_platypusId = 141; - _vm->_gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); - _vm->_gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); - _vm->endSceneInit(); - _vm->invRemove(kItemDisguise); - _vm->invAdd(kItemKeys); - _vm->setFlag(kGFKeysTaken); - _vm->clearFlag(kGFPlatyPussDisguised); - _vm->_platypusSequenceId = 0x20C; - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusFacing = kDirBottomRight; - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->waitForUpdate(); - } else { - _vm->_gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); - if (_vm->_prevSceneNum == 2) { - _vm->initGnapPos(5, 11, kDirUpRight); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(6, 11, kDirUpLeft); - _vm->endSceneInit(); - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(6, 9, -1, 0x107BA, 1); - } else if (_vm->_prevSceneNum == 38) { - _vm->initGnapPos(5, 7, kDirBottomRight); - _vm->initPlatypusPos(4, 7, kDirNone); - _vm->endSceneInit(); - } else { - _vm->initGnapPos(12, 9, kDirBottomRight); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(12, 8, kDirNone); - _vm->endSceneInit(); - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(9, 9, -1, 0x107BA, 1); - } - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 4, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS04Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHS04Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { - if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - if (_vm->_cursorValue == 4) - _vm->gnapKissPlatypus(0); - else - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS04Twig: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - break; - case GRAB_CURSOR: - _vm->playGnapPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - _vm->playGnapUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - _vm->_gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1FD, 100, 2); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS04Axe: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS04GrabAxe; - _vm->setFlag(kGFPlatypusTalkingToAssistant); - updateHotspots(); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS04Dog: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { - _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); - _nextDogSequenceId = 0x20F; - } - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS04GrabDog; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { - _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); - _nextDogSequenceId = 0x20E; - } - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS04Door: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapScratchingHead(4, 3); - break; - case GRAB_CURSOR: - if (_vm->_cursorValue == 1) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS04OpenDoor; - _vm->_timers[5] = 300; - _vm->_gnapIdleFacing = kDirUpLeft; - } else { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS04LeaveScene; - _vm->_newSceneNum = 38; - } - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS04ExitTruck: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS04LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); - if (_vm->_cursorValue == 1) - _vm->_newSceneNum = 2; - else - _vm->_newSceneNum = 33; - } - break; - - case kHS04Window: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); - } else if (_vm->isFlag(kGFKeysTaken)) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { - if (_triedWindow) { - _vm->_gnapActionStatus = kAS04GetKeyAnother; - } else { - _vm->_gnapActionStatus = kAS04GetKeyFirst; - _triedWindow = true; - } - } - break; - case GRAB_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS04ExitBarn: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS04LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); - if (_vm->_cursorValue == 1) - _vm->_newSceneNum = 5; - else - _vm->_newSceneNum = 35; - } - break; - - case kHS04WalkArea1: - case kHS04WalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->platypusSub426234(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence2(); - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(150) + 300; - if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(150) + 200; - _vm->_gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(20) + 60; - if (_nextDogSequenceId == -1) - _nextDogSequenceId = 0x210; - } - if (!_vm->_timers[8]) { - _vm->_timers[8] = _vm->getRandom(150) + 400; - _vm->_gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene04::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS04LeaveScene: - _vm->_sceneDone = true; - break; - case kAS04OpenDoor: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnapX = 6; - _vm->_gnapY = 7; - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); - _vm->_gameSys->setAnimation(0x107B5, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _vm->_gnapActionStatus = kAS04OpenDoorDone; - break; - case kAS04OpenDoorDone: - _vm->_gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = -1; - break; - case kAS04GetKeyFirst: - _vm->_gameSys->insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x204, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x204; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyFirst2; - break; - case kAS04GetKeyFirst2: - _vm->_gameSys->insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x20B, 256, 0); - _vm->_gnapSequenceId = 0x206; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyFirstDone; - break; - case kAS04GetKeyFirstDone: - _vm->_gameSys->requestRemoveSequence(0x1FF, 256); - _vm->_gameSys->requestRemoveSequence(0x20B, 256); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _vm->_gnapActionStatus = -1; - break; - case kAS04GetKeyAnother: - _vm->_gameSys->insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x202, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x202; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyAnother2; - break; - case kAS04GetKeyAnother2: - _vm->_gameSys->insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x20A, 256, 0); - _vm->_gnapSequenceId = 0x203; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyAnotherDone; - break; - case kAS04GetKeyAnotherDone: - _vm->_gameSys->removeSequence(0x1FF, 256, true); - _vm->_gameSys->removeSequence(0x20A, 256, true); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gnapActionStatus = -1; - break; - case kAS04GrabDog: - _nextDogSequenceId = 0x201; - break; - case kAS04GrabAxe: - _vm->_gameSys->insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->requestRemoveSequence(0x212, 100); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x211; - _vm->_gnapActionStatus = -1; - break; - default: - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->invAdd(kItemTwig); - _vm->setGrabCursorSprite(kItemTwig); - _vm->setFlag(kGFTwigTaken); - updateHotspots(); - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_nextDogSequenceId == 0x201) { - _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, - _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, - kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); - _dogIdCtr = (_dogIdCtr + 1) % 2; - _currDogSequenceId = 0x201; - _vm->_gnapSequenceId = 0x200; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - _vm->_timers[6] = _vm->getRandom(20) + 60; - _nextDogSequenceId = -1; - } else if (_nextDogSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, - _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, - kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); - _dogIdCtr = (_dogIdCtr + 1) % 2; - _currDogSequenceId = _nextDogSequenceId; - _nextDogSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene04.h b/engines/gnap/scenes/scene04.h deleted file mode 100644 index 10b6964045..0000000000 --- a/engines/gnap/scenes/scene04.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE04_H -#define GNAP_SCENE04_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene04: public Scene { -public: - Scene04(GnapEngine *vm); - ~Scene04() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} - -private: - bool _triedWindow; - int _dogIdCtr; - int _nextDogSequenceId; - int _currDogSequenceId; -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE04_H diff --git a/engines/gnap/scenes/scene05.cpp b/engines/gnap/scenes/scene05.cpp deleted file mode 100644 index 8046465cd0..0000000000 --- a/engines/gnap/scenes/scene05.cpp +++ /dev/null @@ -1,466 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene05.h" - -namespace Gnap { - -enum { - kHS05Platypus = 0, - kHS05Haystack = 1, - kHS05Padlock = 2, - kHS05Ladder = 3, - kHS05ExitHouse = 4, - kHS05Chicken = 5, - kHS05Device = 6, - kHS05WalkArea1 = 7, - kHS05WalkArea2 = 8, - kHS05WalkArea3 = 9 -}; - -enum { - kAS05PlatSearchHaystack = 0, - kAS05TryPickPadlock = 1, - kAS05PickPadlock = 2, - kAS05TalkChicken = 3, - kAS05GrabChicken = 4, - kAS05GrabLadder = 5, - kAS05EnterBarn = 6, - kAS05UseTwigWithChicken = 11, - kAS05LeaveScene = 12 -}; - -Scene05::Scene05(GnapEngine *vm) : Scene(vm) { - _nextChickenSequenceId = -1; - _currChickenSequenceId = -1; -} - -int Scene05::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 3); - return _vm->isFlag(kGFBarnPadlockOpen) ? 0x151 : 0x150; -} - -void Scene05::updateHotspots() { - _vm->setHotspot(kHS05Platypus, 0, 0, 0, 0, SF_DISABLED | SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS05Haystack, 236, 366, 372, 442, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - _vm->setHotspot(kHS05Padlock, 386, 230, 626, 481, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - _vm->setHotspot(kHS05Ladder, 108, 222, 207, 444, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHS05ExitHouse, 0, 395, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHS05Chicken, 612, 462, 722, 564, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHS05WalkArea1, 104, 0, 421, 480); - _vm->setHotspot(kHS05WalkArea2, 422, 0, 800, 487); - _vm->setHotspot(kHS05WalkArea3, 0, 0, 104, 499); - _vm->setDeviceHotspot(kHS05Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS05Platypus]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_hotspots[kHS05Padlock]._flags = SF_EXIT_U_CURSOR; - _vm->_hotspotsCount = 10; -} - -void Scene05::run() { - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(7); - - _currChickenSequenceId = 0x142; - _vm->_gameSys->setAnimation(0x142, 100, 3); - _vm->_gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); - - _nextChickenSequenceId = -1; - - _vm->_timers[5] = _vm->getRandom(10) + 30; - _vm->_timers[6] = _vm->getRandom(150) + 300; - - if (_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { - _vm->initGnapPos(-1, 8, kDirBottomRight); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(-1, 9, kDirNone); - _vm->endSceneInit(); - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(2, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 9, -1, 0x107B9, 1); - } else { - _vm->initGnapPos(6, 8, kDirBottomRight); - if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(7, 9, kDirNone); - _vm->endSceneInit(); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 12, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS05Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHS05Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { - if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS05Haystack: - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); - } else if (_vm->isFlag(kGFNeedleTaken)) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (_vm->isFlag(kGFPlatypus)) { - _vm->gnapUseDeviceOnPlatypuss(); - if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { - _vm->_platypusActionStatus = kAS05PlatSearchHaystack; - _vm->_platypusFacing = kDirUnk4; - } - if (_vm->_gnapX == 4 && (_vm->_gnapY == 8 || _vm->_gnapY == 7)) - _vm->gnapWalkStep(); - _vm->playGnapIdle(_vm->_platX, _vm->_platY); - } - break; - } - } - } - break; - - case kHS05Chicken: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05UseTwigWithChicken; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(9, 7); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05GrabChicken; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05TalkChicken; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS05Ladder: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(2, 4); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05GrabLadder; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS05Padlock: - if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x - 1, _vm->_hotspotsWalkPos[2].y + 1, 0, -1, 1); - _vm->_gnapActionStatus = kAS05EnterBarn; - if (_vm->_cursorValue == 1) - _vm->_newSceneNum = 6; - else - _vm->_newSceneNum = 36; - } else if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemNeedle) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, - _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS05PickPadlock; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 4); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05TryPickPadlock; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS05ExitHouse: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS05LeaveScene; - if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); - if (_vm->_cursorValue == 1) - _vm->_newSceneNum = 4; - else - _vm->_newSceneNum = 37; - } - break; - - case kHS05WalkArea1: - case kHS05WalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - case kHS05WalkArea3: - // Nothing - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { - if (_vm->getRandom(4) != 0) - _nextChickenSequenceId = 0x142; - else - _nextChickenSequenceId = 0x143; - } - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(150) + 300; - if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(20) + 30; - } - - _vm->gameUpdateTick(); - } -} - -void Scene05::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS05LeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - case kAS05TryPickPadlock: - _vm->_gameSys->insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x148; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - break; - case kAS05PickPadlock: - _vm->_gameSys->setAnimation(0x147, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x147; - _vm->_gnapSequenceDatNum = 0; - _vm->setFlag(kGFBarnPadlockOpen); - _vm->setFlag(kGFSceneFlag1); - _vm->setGrabCursorSprite(-1); - _vm->_newSceneNum = 6; - _vm->_timers[2] = 100; - _vm->invRemove(kItemNeedle); - _vm->_gnapActionStatus = kAS05LeaveScene; - break; - case kAS05TalkChicken: - _nextChickenSequenceId = 0x144; - _vm->_gnapActionStatus = -1; - break; - case kAS05GrabChicken: - _nextChickenSequenceId = 0x14B; - break; - case kAS05GrabLadder: - while (_vm->_gameSys->isSequenceActive(0x149, 39)) - _vm->gameUpdateTick(); - _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x14D; - _vm->_gnapSequenceDatNum = 0; - _vm->_timers[2] = 200; - _vm->_timers[6] = 300; - _vm->_gnapActionStatus = -1; - break; - case kAS05EnterBarn: - _vm->_gameSys->insertSequence(0x107B1, 1, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gameSys->setAnimation(0x107B1, 1, 0); - _vm->_gnapActionStatus = kAS05LeaveScene; - break; - case kAS05UseTwigWithChicken: - _vm->playGnapShowItem(5, 0, 0); - _nextChickenSequenceId = 0x14F; - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - if (_vm->_platypusSequenceId == 0x146) { - _vm->_platX = 4; - _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); - _vm->_platypusSequenceId = 0x7C1; - _vm->_platypusSequenceDatNum = 1; - _vm->_platypusId = 20 * _vm->_platY; - _vm->invAdd(kItemNeedle); - _vm->setFlag(kGFNeedleTaken); - _vm->setGrabCursorSprite(kItemNeedle); - _vm->showCursor(); - _vm->_timers[1] = 30; - _vm->_platypusActionStatus = -1; - } - if (_vm->_platypusActionStatus == kAS05PlatSearchHaystack) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->_platypusSequenceId = 0x146; - _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x146, 256, 1); - _vm->_timers[1] = 300; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_nextChickenSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x14C; - _currChickenSequenceId = _nextChickenSequenceId; - _nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; - } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _currChickenSequenceId = _nextChickenSequenceId; - _nextChickenSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene05.h b/engines/gnap/scenes/scene05.h deleted file mode 100644 index a3be46b009..0000000000 --- a/engines/gnap/scenes/scene05.h +++ /dev/null @@ -1,51 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE05_H -#define GNAP_SCENE05_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene05: public Scene { -public: - Scene05(GnapEngine *vm); - ~Scene05() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} - -private: - int _nextChickenSequenceId; - int _currChickenSequenceId; -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE05_H diff --git a/engines/gnap/scenes/scene06.cpp b/engines/gnap/scenes/scene06.cpp deleted file mode 100644 index aae5125bb7..0000000000 --- a/engines/gnap/scenes/scene06.cpp +++ /dev/null @@ -1,446 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene06.h" - -namespace Gnap { - -enum { - kHS06Platypus = 0, - kHS06Gas = 1, - kHS06Ladder = 2, - kHS06Horse = 3, - kHS06ExitOutsideBarn = 4, - kHS06Device = 5, - kHS06WalkArea1 = 6, - kHS06WalkArea2 = 7, - kHS06WalkArea3 = 8, - kHS06WalkArea4 = 9, - kHS06WalkArea5 = 10 -}; - -enum { - kAS06TryToGetGas = 0, - kAS06TryToClimbLadder = 1, - kAS06TryToClimbLadderDone = 2, - kAS06TalkToHorse = 3, - kAS06UseTwigOnHorse = 4, - kAS06LeaveScene = 5 -}; - -Scene06::Scene06(GnapEngine *vm) : Scene(vm) { - _horseTurnedBack = false;; - _nextPlatSequenceId = -1; - _nextHorseSequenceId = -1; - _currHorseSequenceId = -1; -} - -int Scene06::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - if (_vm->isFlag(kGFSceneFlag1)) { - _vm->playSound(0x11B, false); - _vm->clearFlag(kGFSceneFlag1); - } - return 0x101; -} - -void Scene06::updateHotspots() { - _vm->setHotspot(kHS06Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS06Gas, 300, 120, 440, 232, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHS06Ladder, 497, 222, 614, 492, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - _vm->setHotspot(kHS06Horse, 90, 226, 259, 376, SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHS06ExitOutsideBarn, 226, 580, 688, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - _vm->setHotspot(kHS06WalkArea1, 0, 0, 200, 515); - _vm->setHotspot(kHS06WalkArea2, 200, 0, 285, 499); - _vm->setHotspot(kHS06WalkArea3, 688, 0, 800, 499); - _vm->setHotspot(kHS06WalkArea4, 475, 469, 800, 505); - _vm->setHotspot(kHS06WalkArea5, 0, 0, 800, 504); - _vm->setDeviceHotspot(kHS06Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFGasTaken)) - _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; - if (_vm->_cursorValue == 4) { - _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; - _vm->_hotspots[kHS06Gas]._flags = SF_DISABLED; - } - _vm->_hotspotsCount = 11; -} - -void Scene06::run() { - bool triedDeviceOnGas = false; - - _vm->startSoundTimerC(7); - - _horseTurnedBack = false; - _vm->_gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); - - _currHorseSequenceId = 0xF1; - _nextHorseSequenceId = -1; - - _vm->_gameSys->setAnimation(0xF1, 120, 2); - _vm->_timers[4] = _vm->getRandom(40) + 25; - - if (_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFGasTaken) && _vm->_cursorValue != 4) - _vm->_gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - _vm->initGnapPos(5, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); - _vm->endSceneInit(); - - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 5, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS06Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHS06Platypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS06Gas: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 0); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFUnk04)) { - _vm->playGnapImpossible(0, 0); - } else if (triedDeviceOnGas) { - _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107BC, 1); - _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS06TryToGetGas; - } else { - triedDeviceOnGas = true; - _vm->playGnapPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - if (_vm->isFlag(kGFUnk04)) - _vm->playGnapImpossible(0, 0); - else - _vm->playGnapScratchingHead(5, 0); - break; - } - } - } - break; - - case kHS06Ladder: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 4); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFGasTaken)) - _vm->playGnapImpossible(0, 0); - else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS06TryToClimbLadder; - _vm->setFlag(kGFGasTaken); - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS06Horse: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { - _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); - _vm->_platypusFacing = kDirNone; - _vm->_gnapActionStatus = kAS06UseTwigOnHorse; - _vm->setGrabCursorSprite(-1); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 2); - break; - case TALK_CURSOR: - if (_horseTurnedBack) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); - } else { - _vm->_gnapIdleFacing = kDirBottomLeft; - _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS06TalkToHorse; - } - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHS06ExitOutsideBarn: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS06LeaveScene; - if (_vm->_cursorValue == 1) - _vm->_newSceneNum = 5; - else - _vm->_newSceneNum = 35; - } - break; - - case kHS06WalkArea1: - case kHS06WalkArea2: - case kHS06WalkArea3: - case kHS06WalkArea4: - case kHS06WalkArea5: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(40) + 25; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextHorseSequenceId == -1) { - if (_horseTurnedBack) { - _nextHorseSequenceId = 0xF5; - } else { - switch (_vm->getRandom(5)) { - case 0: - case 1: - case 2: - _nextHorseSequenceId = 0xF1; - break; - case 3: - _nextHorseSequenceId = 0xF3; - break; - case 4: - _nextHorseSequenceId = 0xF4; - break; - } - } - } - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene06::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS06LeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - case kAS06TryToGetGas: - _vm->_gameSys->insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xFC; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - break; - case kAS06TryToClimbLadder: - _vm->_gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xFD, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xFD; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS06TryToClimbLadderDone; - break; - case kAS06TryToClimbLadderDone: - _vm->_gnapX = 6; - _vm->_gnapY = 7; - _vm->_gnapActionStatus = -1; - break; - case kAS06TalkToHorse: - _nextHorseSequenceId = 0xF6; - break; - case kAS06UseTwigOnHorse: - _nextPlatSequenceId = 0xFB; - break; - default: - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - if (_vm->_platypusSequenceId == 0xFA) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->invAdd(kItemGas); - _vm->setFlag(kGFGasTaken); - _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; - _vm->setGrabCursorSprite(kItemGas); - _vm->_platypusActionStatus = -1; - _vm->_platX = 6; - _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); - _vm->_platypusSequenceId = 0x7C1; - _vm->_platypusSequenceDatNum = 1; - _vm->setFlag(kGFUnk04); - _vm->_gnapActionStatus = -1; - _vm->showCursor(); - } - if (_nextPlatSequenceId == 0xFB) { - _vm->_gameSys->setAnimation(0, 0, 1); - _nextHorseSequenceId = 0xF2; - _vm->_platypusActionStatus = 6; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { - switch (_nextHorseSequenceId) { - case 0xF2: - _vm->setGrabCursorSprite(-1); - _vm->hideCursor(); - _vm->_gameSys->setAnimation(0xFA, 256, 1); - _vm->_gameSys->insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xFA; - _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B7; - _vm->_gnapSequenceDatNum = 1; - _currHorseSequenceId = _nextHorseSequenceId; - _nextHorseSequenceId = -1; - _nextPlatSequenceId = -1; - _vm->invRemove(kItemTwig); - break; - case 0xF6: - _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(0xF6, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _horseTurnedBack = true; - _currHorseSequenceId = _nextHorseSequenceId; - _nextHorseSequenceId = -1; - _vm->_gnapActionStatus = -1; - break; - default: - _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(_nextHorseSequenceId, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _currHorseSequenceId = _nextHorseSequenceId; - _nextHorseSequenceId = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene06.h b/engines/gnap/scenes/scene06.h deleted file mode 100644 index ff6ff9f14c..0000000000 --- a/engines/gnap/scenes/scene06.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE06_H -#define GNAP_SCENE06_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene06: public Scene { -public: - Scene06(GnapEngine *vm); - ~Scene06() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} - -private: - bool _horseTurnedBack; - int _nextPlatSequenceId; - int _nextHorseSequenceId; - int _currHorseSequenceId; -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE06_H diff --git a/engines/gnap/scenes/scene07.cpp b/engines/gnap/scenes/scene07.cpp deleted file mode 100644 index 41ddf4caf1..0000000000 --- a/engines/gnap/scenes/scene07.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" - -#include "gnap/scenes/scene07.h" - -namespace Gnap { - -enum { - kHS07Platypus = 0, - kHS07ExitHouse = 1, - kHS07Dice = 2, - kHS07Device = 3, - kHS07WalkArea1 = 4, - kHS07WalkArea2 = 5, - kHS07WalkArea3 = 6 -}; - -enum { - kAS07Wait = 0, - kAS07LeaveScene = 1 -}; - -Scene07::Scene07(GnapEngine *vm) : Scene(vm) { -} - -int Scene07::init() { - return 0x92; -} - -void Scene07::updateHotspots() { - _vm->setHotspot(kHS07Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS07ExitHouse, 700, 125, 799, 290, SF_EXIT_NE_CURSOR); - _vm->setHotspot(kHS07Dice, 200, 290, 270, 360, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS07WalkArea1, 0, 0, 325, 445); - _vm->setHotspot(kHS07WalkArea2, 325, 0, 799, 445, _vm->_isLeavingScene ? SF_WALKABLE : SF_NONE); - _vm->setHotspot(kHS07WalkArea3, 160, 0, 325, 495); - _vm->setDeviceHotspot(kHS07Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFPlatypus)) - _vm->_hotspots[kHS07Dice]._flags = SF_DISABLED; - _vm->_hotspotsCount = 7; -} - -void Scene07::run() { - _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); - - _vm->invRemove(kItemGas); - _vm->invRemove(kItemNeedle); - - if (!_vm->isFlag(kGFPlatypus)) - _vm->_gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_prevSceneNum == 8) { - _vm->initGnapPos(7, 7, kDirBottomLeft); - _vm->initPlatypusPos(9, 7, kDirUnk4); - _vm->endSceneInit(); - } else { - _vm->_gnapX = 6; - _vm->_gnapY = 7; - _vm->_gnapId = 140; - _vm->_gnapSequenceId = 0x8F; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS07Wait; - _vm->_platX = 3; - _vm->_platY = 8; - _vm->_platypusId = 160; - _vm->_platypusSequenceId = 0x91; - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusFacing = kDirNone; - _vm->_gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - } - - _vm->_timers[3] = 600; - _vm->_timers[4] = _vm->getRandom(40) + 50; - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x10919)) - _vm->playSound(0x10919, true); - - if (_vm->testWalk(0, 1, 8, 7, 6, 7)) - updateHotspots(); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS07Platypus: - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - break; - } - break; - - case kHS07ExitHouse: - _vm->_isLeavingScene = true; - if (_vm->_gnapX > 8) - _vm->gnapWalkTo(_vm->_gnapX, 7, 0, 0x107AD, 1); - else - _vm->gnapWalkTo(8, 7, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS07LeaveScene; - break; - - case kHS07Dice: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 8, 3, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - break; - case GRAB_CURSOR: - _vm->setFlag(kGFPlatypus); - _vm->invAdd(kItemDice); - updateHotspots(); - _vm->playGnapPullOutDevice(3, 3); - _vm->_gameSys->setAnimation(0x8E, 1, 2); - _vm->_gameSys->insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = _vm->getGnapSequenceId(gskUseDevice, 0, 0); - _vm->_gnapSequenceDatNum = 1; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHS07Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(40) + 50; - } - break; - - case kHS07WalkArea1: - case kHS07WalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - case kHS07WalkArea3: - // Nothing - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updateGnapIdleSequence(); - if (_vm->_platypusActionStatus < 0 && _vm->_gnapActionStatus < 0) { - if (_vm->_timers[0]) { - if (!_vm->_timers[1]) { - _vm->_timers[1] = _vm->getRandom(20) + 30; - int gnapRandomValue = _vm->getRandom(20); - // TODO Cleanup - if (_vm->_platypusFacing != kDirNone) { - if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7CA) { - if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7CA) { - if (_vm->_platY == 9) - _vm->playPlatypusSequence(0x107CA); - } else { - _vm->playPlatypusSequence(0x10845); - } - } else { - _vm->playPlatypusSequence(0x107CC); - } - } else if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7C9) { - if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7C9) { - if (_vm->_platY == 9) - _vm->playPlatypusSequence(0x107C9); - } else { - _vm->playPlatypusSequence(0x10844); - } - } else { - _vm->playPlatypusSequence(0x107CB); - } - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); - } - } else { - _vm->_timers[0] = _vm->getRandom(75) + 75; - _vm->platypusMakeRoom(); - } - } else { - _vm->_timers[0] = 100; - _vm->_timers[1] = 35; - } - playRandomSound(4); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(40) + 50; - } - _vm->gameUpdateTick(); - } -} - -void Scene07::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS07LeaveScene: - _vm->_newSceneNum = 8; - _vm->_sceneDone = true; - break; - } - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->setGrabCursorSprite(kItemDice); - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene07.h b/engines/gnap/scenes/scene07.h deleted file mode 100644 index 1afc1f8f12..0000000000 --- a/engines/gnap/scenes/scene07.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE07_H -#define GNAP_SCENE07_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene07: public Scene { -public: - Scene07(GnapEngine *vm); - ~Scene07() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} -}; - -} // End of namespace Gnap - -#endif // GNAP_SCENE07_H diff --git a/engines/gnap/scenes/scene08.cpp b/engines/gnap/scenes/scene08.cpp deleted file mode 100644 index 2b977a481e..0000000000 --- a/engines/gnap/scenes/scene08.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene08.h" - -namespace Gnap { - -enum { - kH08SPlatypus = 0, - kHS08ExitBackdoor = 1, - kHS08ExitCrash = 2, - kHS08Man = 3, - kHS08Door = 4, - kHS08Meat = 5, - kHS08Bone = 6, - kHS08Toy = 7, - kHS08WalkArea1 = 8, - kHS08Device = 9, - kHS08WalkArea2 = 10 -}; - -enum { - kAS08LeaveScene = 0, - kAS08TalkMan = 1, - kAS08LookMan = 2, - kAS08LookDog = 3, - kAS08GrabDog = 4, - kAS08TalkDog = 5, - kAS08PlatWithMan = 6, - kAS08PlatWithDog = 7 -}; - -Scene08::Scene08(GnapEngine *vm) : Scene(vm) { - _nextDogSequenceId = -1; - _currDogSequenceId = -1; - _nextManSequenceId = -1; - _currManSequenceId = -1; -} - -int Scene08::init() { - return 0x150; -} - -void Scene08::updateHotspots() { - _vm->setHotspot(kH08SPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS08ExitBackdoor, 0, 280, 10, 400, SF_EXIT_L_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHS08ExitCrash, 200, 590, 400, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHS08Man, 510, 150, 610, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS08Door, 350, 170, 500, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS08Meat, 405, 450, 480, 485, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS08Bone, 200, 405, 270, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS08Toy, 540, 430, 615, 465, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS08WalkArea1, 290, 340, -1, -1); - _vm->setHotspot(kHS08WalkArea2, 0, 0, 799, 420); - _vm->setDeviceHotspot(kHS08Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_hotspots[kHS08Meat]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_hotspots[kHS08Bone]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_hotspots[kHS08Toy]._flags = SF_WALKABLE | SF_DISABLED; - _vm->_hotspotsCount = 11; -} - -void Scene08::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _currDogSequenceId = _nextDogSequenceId; - if ( _nextDogSequenceId != 0x135 ) - _nextDogSequenceId = 0x134; - } -} - -void Scene08::run() { - _vm->queueInsertDeviceIcon(); - - _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); - - _currDogSequenceId = 0x135; - _nextDogSequenceId = 0x135; - - _vm->_gameSys->setAnimation(0x135, 100, 3); - _vm->_gameSys->insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); - - _currManSequenceId = 0x140; - _nextManSequenceId = -1; - - _vm->_gameSys->setAnimation(0x140, 100, 2); - _vm->_gameSys->insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[4] = _vm->getRandom(50) + 75; - - if (!_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-1, 7, kDirNone); - - _vm->endSceneInit(); - - _vm->gnapWalkTo(1, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - - _vm->_timers[5] = _vm->getRandom(40) + 50; - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x10919)) - _vm->playSound(0x10919, true); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS08Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(50) + 75; - _vm->_timers[5] = _vm->getRandom(40) + 50; - } - break; - - case kH08SPlatypus: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapActionIdle(0x14D); - _vm->gnapKissPlatypus(8); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - break; - } - } - break; - - case kHS08ExitBackdoor: - _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(0, 6, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS08LeaveScene; - _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1); - _vm->_newSceneNum = 9; - break; - - case kHS08ExitCrash: - _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(3, 9, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS08LeaveScene; - _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1); - _vm->_newSceneNum = 7; - break; - - case kHS08Man: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 6, 7, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS08LookMan; - _vm->_gnapIdleFacing = kDirUpRight; - break; - case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS08TalkMan; - break; - case PLAT_CURSOR: - _vm->gnapActionIdle(0x14D); - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kAS08PlatWithMan; - _vm->_platypusFacing = kDirNone; - _vm->playGnapIdle(6, 6); - break; - } - } - break; - - case kHS08Door: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 7, 5, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS08GrabDog; - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS08LookDog; - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS08GrabDog; - _vm->_gnapIdleFacing = kDirUpRight; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS08TalkDog; - break; - case PLAT_CURSOR: - _vm->setFlag(kGFSceneFlag1); - _vm->gnapActionIdle(0x14D); - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kAS08PlatWithDog; - _vm->_platypusFacing = kDirNone; - _vm->playGnapIdle(3, 7); - break; - } - } - break; - - case kHS08Meat: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 8, 5, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 7); - break; - case GRAB_CURSOR: - if (_currDogSequenceId == 0x135) { - _vm->playGnapScratchingHead(6, 7); - } else { - _vm->gnapActionIdle(0x14D); - _vm->playGnapPullOutDevice(6, 7); - _vm->playGnapUseDevice(0, 0); - _nextDogSequenceId = 0x149; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHS08Bone: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(2, 7, 3, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 6); - break; - case GRAB_CURSOR: - if (_currDogSequenceId == 0x135) { - _vm->playGnapScratchingHead(3, 6); - } else { - _vm->gnapActionIdle(0x14D); - _vm->playGnapPullOutDevice(3, 6); - _vm->playGnapUseDevice(0, 0); - _nextDogSequenceId = 0x14A; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHS08Toy: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(8, 7, 7, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 6); - break; - case GRAB_CURSOR: - if (_currDogSequenceId == 0x135) { - _vm->playGnapScratchingHead(7, 6); - } else { - _vm->gnapActionIdle(0x14D); - _vm->playGnapPullOutDevice(7, 6); - _vm->playGnapUseDevice(0, 0); - _nextDogSequenceId = 0x14B; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHS08WalkArea1: - case kHS08WalkArea2: - _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(-1, 6, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(50) + 125; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextManSequenceId == -1 && - (_currDogSequenceId == 0x134 || _currDogSequenceId == 0x135)) { - int _gnapRandomValue = _vm->getRandom(4); - switch (_gnapRandomValue) { - case 0: - _nextManSequenceId = 0x138; - break; - case 1: - _nextManSequenceId = 0x136; - break; - case 2: - _nextManSequenceId = 0x13B; - break; - case 3: - _nextManSequenceId = 0x13A; - break; - } - } - } - playRandomSound(5); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(50) + 75; - _vm->_timers[5] = _vm->getRandom(40) + 50; - } - - _vm->gameUpdateTick(); - } -} - -void Scene08::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS08LeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - case kAS08TalkMan: - _nextManSequenceId = 0x13F; - _vm->_gnapActionStatus = -1; - break; - case kAS08LookMan: - _nextManSequenceId = 0x140; - _vm->_gnapActionStatus = -1; - break; - case kAS08LookDog: - _nextManSequenceId = 0x137; - _vm->_gnapActionStatus = -1; - break; - case kAS08GrabDog: - if (_currDogSequenceId == 0x135) - _nextDogSequenceId = 0x133; - else - _nextDogSequenceId = 0x13C; - _vm->_gnapActionStatus = -1; - break; - case kAS08TalkDog: - if (_currDogSequenceId == 0x135) - _nextDogSequenceId = 0x133; - else - _nextDogSequenceId = 0x13C; - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { - case kAS08PlatWithDog: - _nextDogSequenceId = 0x147; - break; - case kAS08PlatWithMan: - _nextManSequenceId = 0x140; - _vm->_platypusActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextManSequenceId, 100, 2); - _vm->_gameSys->insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _currManSequenceId = _nextManSequenceId; - _nextManSequenceId = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_currDogSequenceId == 0x147) - _vm->_platypusActionStatus = -1; - if (_currDogSequenceId == 0x149 || _currDogSequenceId == 0x14A || _currDogSequenceId == 0x14B) { - if (_vm->getRandom(2) != 0) - _nextManSequenceId = 0x13D; - else - _nextManSequenceId = 0x13E; - } else if (_currDogSequenceId == 0x133) - _nextManSequenceId = 0x139; - if (_nextDogSequenceId == 0x149 || _nextDogSequenceId == 0x14A || _nextDogSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - switch (_nextDogSequenceId) { - case 0x149: - _vm->setFlag(kGFBarnPadlockOpen); - _vm->_hotspots[kHS08Meat]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x144, 1, true); - break; - case 0x14A: - _vm->setFlag(kGFTruckFilledWithGas); - _vm->_hotspots[kHS08Bone]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x145, 1, true); - break; - case 0x14B: - _vm->setFlag(kGFTruckKeysUsed); - _vm->_hotspots[kHS08Toy]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x146, 1, true); - break; - } - _currDogSequenceId = _nextDogSequenceId; - _nextDogSequenceId = 0x134; - } else if (_nextDogSequenceId == 0x147) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _currDogSequenceId = _nextDogSequenceId; - _nextDogSequenceId = 0x134; - _vm->_platX = 1; - _vm->_platY = 8; - _vm->_platypusId = 160; - _vm->_platypusSequenceId = 0x148; - _vm->_platypusFacing = kDirUnk4; - _vm->_platypusSequenceDatNum = 0; - if (_vm->_gnapX == 1 && _vm->_gnapY == 8) - _vm->gnapWalkStep(); - } else if (_nextDogSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _currDogSequenceId = _nextDogSequenceId; - if (_nextDogSequenceId != 0x135) - _nextDogSequenceId = 0x134; - if (_currDogSequenceId == 0x133) { - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x14D; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - } - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene08.h b/engines/gnap/scenes/scene08.h deleted file mode 100644 index b73bc49b22..0000000000 --- a/engines/gnap/scenes/scene08.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE08_H -#define GNAP_SCENE08_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene08: public Scene { -public: - Scene08(GnapEngine *vm); - ~Scene08() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb(); - -private: - int _nextDogSequenceId; - int _currDogSequenceId; - int _nextManSequenceId; - int _currManSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE08_H diff --git a/engines/gnap/scenes/scene09.cpp b/engines/gnap/scenes/scene09.cpp deleted file mode 100644 index 7e92ca16ac..0000000000 --- a/engines/gnap/scenes/scene09.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene09.h" - -namespace Gnap { - -enum { - kHS09Platypus = 0, - kHS09ExitKitchen = 1, - kHS09ExitHouse = 2, - kHS09Trash = 3, - kHS09Device = 4, - kHS09WalkArea1 = 5, - kHS09WalkArea2 = 6, - kHS09WalkArea3 = 7 -}; - -enum { - kAS09LeaveScene = 0, - kAS09SearchTrash = 1, - kAS09SearchTrashDone = 2 -}; - -Scene09::Scene09(GnapEngine *vm) : Scene(vm) { -} - -int Scene09::init() { - return 0x4E; -} - -void Scene09::updateHotspots() { - _vm->setHotspot(kHS09Platypus, 0, 200, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS09ExitKitchen, 280, 200, 380, 400, SF_EXIT_U_CURSOR); - _vm->setHotspot(kHS09ExitHouse, 790, 200, 799, 450, SF_EXIT_R_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHS09Trash, 440, 310, 680, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHS09WalkArea1, 0, 0, 799, 400); - _vm->setHotspot(kHS09WalkArea2, 0, 0, 630, 450); - _vm->setHotspot(kHS09WalkArea2, 0, 0, 175, 495); - _vm->setDeviceHotspot(kHS09Device, -1, -1, -1, -1); - _vm->_hotspotsCount = 8; -} - -void Scene09::run() { - _vm->queueInsertDeviceIcon(); - - _vm->_gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_prevSceneNum == 8) { - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 7, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); - } else { - _vm->initGnapPos(4, 7, kDirBottomRight); - _vm->initPlatypusPos(5, 7, kDirNone); - _vm->endSceneInit(); - } - - _vm->_timers[4] = _vm->getRandom(150) + 50; - _vm->_timers[5] = _vm->getRandom(40) + 50; - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x10919)) - _vm->playSound(0x10919, true); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHS09Device: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(150) + 50; - _vm->_timers[5] = _vm->getRandom(40) + 50; - } - break; - - case kHS09Platypus: - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - break; - } - break; - - case kHS09ExitKitchen: - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 10; - _vm->gnapWalkTo(4, 7, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kAS09LeaveScene; - _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); - _vm->_platypusFacing = kDirUnk4; - break; - - case kHS09ExitHouse: - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 8; - _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS09LeaveScene; - _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); - _vm->_platypusFacing = kDirUnk4; - break; - - case kHS09Trash: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(9, 6, 8, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 3); - break; - case GRAB_CURSOR: - _vm->_gnapActionStatus = kAS09SearchTrash; - _vm->gnapWalkTo(9, 6, 0, 0x107BC, 1); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHS09WalkArea1: - case kHS09WalkArea2: - case kHS09WalkArea3: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene && _vm->_gnapActionStatus != 1 && _vm->_gnapActionStatus != 2) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(150) + 100; - if (_vm->_timers[4] & 1) - _vm->_gameSys->insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); - } - playRandomSound(5); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(150) + 50; - _vm->_timers[5] = _vm->getRandom(40) + 50; - } - - _vm->gameUpdateTick(); - } -} - -void Scene09::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kAS09LeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - case kAS09SearchTrash: - _vm->_gameSys->setAnimation(0x4C, 120, 0); - _vm->_gameSys->insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x4B, 2, true); - _vm->_gnapSequenceId = 0x4C; - _vm->_gnapId = 120; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 9; - _vm->_gnapY = 6; - _vm->_gnapActionStatus = kAS09SearchTrashDone; - break; - case kAS09SearchTrashDone: - _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[2] = 360; - _vm->_timers[4] = _vm->getRandom(150) + 100; - _vm->_gnapActionStatus = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene09.h b/engines/gnap/scenes/scene09.h deleted file mode 100644 index 2a1576e663..0000000000 --- a/engines/gnap/scenes/scene09.h +++ /dev/null @@ -1,46 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE09_H -#define GNAP_SCENE09_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene09: public Scene { -public: - Scene09(GnapEngine *vm); - ~Scene09() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {} -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE09_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 309c872526..567270a1db 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -23,20 +23,12 @@ #include "gnap/gnap.h" #include "gnap/gamesys.h" #include "gnap/resource.h" -#include "gnap/scenes/scenecore.h" +#include "gnap/scenes/scenecore.h" #include "gnap/scenes/groupcs.h" +#include "gnap/scenes/group0.h" +#include "gnap/scenes/intro.h" -#include "gnap/scenes/scene00.h" -#include "gnap/scenes/scene01.h" -#include "gnap/scenes/scene02.h" -#include "gnap/scenes/scene03.h" -#include "gnap/scenes/scene04.h" -#include "gnap/scenes/scene05.h" -#include "gnap/scenes/scene06.h" -#include "gnap/scenes/scene07.h" -#include "gnap/scenes/scene08.h" -#include "gnap/scenes/scene09.h" #include "gnap/scenes/scene10.h" #include "gnap/scenes/scene11.h" #include "gnap/scenes/scene12.h" @@ -82,7 +74,7 @@ int GnapEngine::initSceneLogic() { switch (_currentSceneNum) { case 0: - _scene = new Scene00(this); + _scene = new SceneIntro(this); backgroundId = _scene->init(); _gameSys->setScaleValues(0, 500, 1, 1000); break; -- cgit v1.2.3 From 12fa081a192c254e4a1d32a0edef2dffee61c154 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 27 Apr 2016 07:35:19 +0200 Subject: GNAP: Remove debug code --- engines/gnap/gnap.cpp | 71 --------------------------------------------------- 1 file changed, 71 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index bcf2db1f56..e4cc379604 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -152,70 +152,8 @@ Common::Error GnapEngine::run() { _menuBackgroundSurface = nullptr; initGlobalSceneVars(); - -#if 1 - mainLoop(); -#else - - Graphics::Surface *testBack = new Graphics::Surface(); - testBack->create(800, 600, _system->getScreenFormat()); - //testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFFFFFFFF); - testBack->fillRect(Common::Rect(0, 0, 800, 600), 0xFF000000); - - _currentSceneNum = 41; - - Common::String datFilename = Common::String::format("%s_n.dat", kSceneNames[_currentSceneNum]); - _dat->open(0, datFilename.c_str()); - - _gameSys->setBackgroundSurface(testBack, 0, 500, 1, 1000); - - _gameSys->insertSequence(0x11b, 100, -1, -1, kSeqNone, 0, 0, 0); - - CursorMan.showMouse(true); - - while (!shouldQuit()) { - Common::Event event; - - while (_eventMan->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_KEYDOWN: - break; - case Common::EVENT_LBUTTONUP: - case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_RBUTTONUP: - case Common::EVENT_RBUTTONDOWN: - case Common::EVENT_MOUSEMOVE: - break; - case Common::EVENT_QUIT: - quitGame(); - break; - default: - break; - } - } - - _gameSys->fatUpdate(); - _gameSys->drawSprites(); - _gameSys->updateScreen(); - _gameSys->_gameSysClock++; - updateTimers(); - - _system->updateScreen(); - _system->delayMillis(100); - - } - - _dat->close(0); - - testBack->free(); - delete testBack; - - return Common::kNoError; - -#endif - delete _soundMan; delete _gameSys; delete _sequenceCache; @@ -223,7 +161,6 @@ Common::Error GnapEngine::run() { delete _spriteCache; delete _dat; delete _debugger; - delete _exe; return Common::kNoError; @@ -730,14 +667,6 @@ void GnapEngine::mainLoop() { _grabCursorSpriteIndex = -1; _grabCursorSprite = nullptr; -#if 0 - // > DEBUG BEGIN - _currentSceneNum = 0; - _newSceneNum = 1; - _newCursorValue = 1; - // < DEBUG END -#endif - loadStockDat(); if (_loadGameSlot != -1) { -- cgit v1.2.3 From 02c8aeae2074c326b618adcc7224a9c5f7e6d86a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 27 Apr 2016 22:09:08 +0200 Subject: GNAP: renaming and grouping of scenes in group 1 --- engines/gnap/gnap.cpp | 2 +- engines/gnap/gnap.h | 2 +- engines/gnap/module.mk | 10 +- engines/gnap/scenes/group0.h | 6 +- engines/gnap/scenes/group1.cpp | 4672 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group1.h | 214 ++ engines/gnap/scenes/scene10.cpp | 500 ---- engines/gnap/scenes/scene10.h | 50 - engines/gnap/scenes/scene11.cpp | 487 ---- engines/gnap/scenes/scene11.h | 53 - engines/gnap/scenes/scene12.cpp | 568 ----- engines/gnap/scenes/scene12.h | 54 - engines/gnap/scenes/scene13.cpp | 451 ---- engines/gnap/scenes/scene13.h | 51 - engines/gnap/scenes/scene14.cpp | 190 -- engines/gnap/scenes/scene14.h | 48 - engines/gnap/scenes/scene15.cpp | 344 --- engines/gnap/scenes/scene15.h | 56 - engines/gnap/scenes/scene17.cpp | 852 ------- engines/gnap/scenes/scene17.h | 61 - engines/gnap/scenes/scene18.cpp | 1030 -------- engines/gnap/scenes/scene18.h | 60 - engines/gnap/scenes/scene19.cpp | 475 ---- engines/gnap/scenes/scene19.h | 54 - engines/gnap/scenes/scenecore.cpp | 10 +- 25 files changed, 4893 insertions(+), 5407 deletions(-) create mode 100644 engines/gnap/scenes/group1.cpp create mode 100644 engines/gnap/scenes/group1.h delete mode 100644 engines/gnap/scenes/scene10.cpp delete mode 100644 engines/gnap/scenes/scene10.h delete mode 100644 engines/gnap/scenes/scene11.cpp delete mode 100644 engines/gnap/scenes/scene11.h delete mode 100644 engines/gnap/scenes/scene12.cpp delete mode 100644 engines/gnap/scenes/scene12.h delete mode 100644 engines/gnap/scenes/scene13.cpp delete mode 100644 engines/gnap/scenes/scene13.h delete mode 100644 engines/gnap/scenes/scene14.cpp delete mode 100644 engines/gnap/scenes/scene14.h delete mode 100644 engines/gnap/scenes/scene15.cpp delete mode 100644 engines/gnap/scenes/scene15.h delete mode 100644 engines/gnap/scenes/scene17.cpp delete mode 100644 engines/gnap/scenes/scene17.h delete mode 100644 engines/gnap/scenes/scene18.cpp delete mode 100644 engines/gnap/scenes/scene18.h delete mode 100644 engines/gnap/scenes/scene19.cpp delete mode 100644 engines/gnap/scenes/scene19.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e4cc379604..c17790f707 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1922,7 +1922,7 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { void GnapEngine::initGlobalSceneVars() { // Shared by scenes 17 && 18 - _s18_garbageCanPos = 8; + _s18GarbageCanPos = 8; // Toy UFO _toyUfoId = 0; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 1169c3bf34..6c8995a331 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -579,7 +579,7 @@ public: void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); // Shared by scenes 17 & 18 - int _s18_garbageCanPos; + int _s18GarbageCanPos; // Scene 4x void toyUfoSetStatus(int flagNum); diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 0e1271a167..17dfad4aac 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -12,16 +12,8 @@ MODULE_OBJS := \ sound.o \ scenes/groupcs.o \ scenes/group0.o \ + scenes/group1.o \ scenes/intro.o \ - scenes/scene10.o \ - scenes/scene11.o \ - scenes/scene12.o \ - scenes/scene13.o \ - scenes/scene14.o \ - scenes/scene15.o \ - scenes/scene17.o \ - scenes/scene18.o \ - scenes/scene19.o \ scenes/scene20.o \ scenes/scene21.o \ scenes/scene22.o \ diff --git a/engines/gnap/scenes/group0.h b/engines/gnap/scenes/group0.h index a705ba1483..b8df3af0ff 100644 --- a/engines/gnap/scenes/group0.h +++ b/engines/gnap/scenes/group0.h @@ -20,8 +20,8 @@ * */ -#ifndef GNAP_GROUP01_H -#define GNAP_GROUP01_H +#ifndef GNAP_GROUP0_H +#define GNAP_GROUP0_H #include "gnap/debugger.h" @@ -180,4 +180,4 @@ public: } // End of namespace Gnap -#endif // GNAP_GROUP01_H +#endif // GNAP_GROUP0_H diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp new file mode 100644 index 0000000000..fa5b5d07e4 --- /dev/null +++ b/engines/gnap/scenes/group1.cpp @@ -0,0 +1,4672 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/group1.h" + +namespace Gnap { + +enum { + kHS10Platypus = 0, + kHS10ExitBar = 1, + kHS10ExitBackdoor = 2, + kHS10Cook = 3, + kHS10Tongs = 4, + kHS10Box = 5, + kHS10Oven = 6, + kHS10WalkArea1 = 7, + kHS10Device = 8, + kHS10WalkArea2 = 9, + kHS10WalkArea3 = 10, + kHS10WalkArea4 = 11 +}; + +enum { + kAS10LeaveScene = 0, + kAS10AnnoyCook = 1, + kAS10PlatWithBox = 4 +}; + +Scene10::Scene10(GnapEngine *vm) : Scene(vm) { + _nextCookSequenceId = -1; + _currCookSequenceId = -1; +} + +int Scene10::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0, 0, 2); + return 0x10F; +} + +void Scene10::updateHotspots() { + _vm->setHotspot(kHS10Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS10ExitBar, 0, 75, 85, 455, SF_EXIT_NW_CURSOR); + _vm->setHotspot(kHS10ExitBackdoor, 75, 590, 500, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS10Cook, 370, 205, 495, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS10Tongs, 250, 290, 350, 337, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS10Box, 510, 275, 565, 330, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS10Oven, 690, 280, 799, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS10WalkArea1, 59, 0, 495, 460); + _vm->setHotspot(kHS10WalkArea2, 495, 0, 650, 420); + _vm->setHotspot(kHS10WalkArea3, 651, 0, 725, 400); + _vm->setHotspot(kHS10WalkArea4, 725, 0, 799, 441); + _vm->setDeviceHotspot(kHS10Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 12; +} + +void Scene10::run() { + _currCookSequenceId = 0x103; + + _vm->_gameSys->setAnimation(0x103, 100, 2); + _vm->_gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); + + _nextCookSequenceId = 0x106; + if (!_vm->isFlag(kGFMudTaken)) + _vm->_gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 9) { + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); + } else { + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(1, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + } + + _vm->_timers[4] = _vm->getRandom(80) + 150; + _vm->_timers[5] = _vm->getRandom(100) + 100; + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1091E)) + _vm->playSound(0x1091E, true); + + if (!_vm->isSoundPlaying(0x1091A)) + _vm->playSound(0x1091A, true); + + _vm->updateMouseCursor(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS10Platypus: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + else + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(10); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + break; + } + } + break; + + case kHS10ExitBar: + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(0, 7, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS10LeaveScene; + _vm->platypusWalkTo(0, 7, -1, 0x107CF, 1); + _vm->_newSceneNum = 11; + break; + + case kHS10ExitBackdoor: + _vm->_isLeavingScene = true; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(2, 9, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS10LeaveScene; + _vm->platypusWalkTo(3, 9, -1, 0x107C7, 1); + _vm->_newSceneNum = 9; + break; + + case kHS10Cook: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 8, 6, 0); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS10AnnoyCook; + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 0); + break; + case GRAB_CURSOR: + _vm->playGnapImpossible(0, 0); + _vm->_gnapIdleFacing = kDirBottomRight; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(4, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS10AnnoyCook; + break; + case PLAT_CURSOR: + _vm->gnapActionIdle(0x10C); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(4, 6, -1, -1, 1); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS10AnnoyCook; + break; + } + } + break; + + case kHS10Tongs: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 7, 4, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); + else + _vm->playGnapScratchingHead(4, 3); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); + else { + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS10AnnoyCook; + } + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); + else { + _vm->gnapActionIdle(0x10C); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(3, 7, -1, -1, 1); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS10AnnoyCook; + } + break; + } + } + break; + + case kHS10Box: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 6, 6, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(7, 3); + break; + case GRAB_CURSOR: + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS10AnnoyCook; + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (_vm->isFlag(kGFMudTaken)) + _vm->playGnapMoan2(-1, -1); + else { + _vm->invAdd(kItemTongs); + _vm->setFlag(kGFMudTaken); + _vm->gnapActionIdle(0x10C); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); + _vm->_platypusActionStatus = kAS10PlatWithBox; + _vm->_platypusFacing = kDirUnk4; + _vm->_largeSprite = _vm->_gameSys->createSurface(0xC3); + _vm->playGnapIdle(7, 6); + } + break; + } + } + break; + + case kHS10Oven: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(9, 6, 10, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 10, 5) | 0x10000); + break; + case GRAB_CURSOR: + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(9, 6, 0, 0x107BB, 1); + _vm->_gameSys->insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x10E; + _vm->_gnapId = 120; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 9; + _vm->_gnapY = 6; + _vm->_timers[2] = 360; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS10WalkArea1: + case kHS10WalkArea2: + case kHS10WalkArea3: + case kHS10WalkArea4: + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHS10Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapActionIdle(0x10C); + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(80) + 150; + _vm->playSound(0x12B, false); + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 100; + int _gnapRandomValue = _vm->getRandom(4); + if (_gnapRandomValue) { + int sequenceId; + if (_gnapRandomValue == 1) { + sequenceId = 0x8A5; + } else if (_gnapRandomValue == 2) { + sequenceId = 0x8A6; + } else { + sequenceId = 0x8A7; + } + _vm->_gameSys->insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene10::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS10LeaveScene: + _vm->_sceneDone = true; + break; + case kAS10AnnoyCook: + _nextCookSequenceId = 0x105; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { + case kAS10PlatWithBox: + _nextCookSequenceId = 0x109; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextCookSequenceId != -1) { + + switch (_nextCookSequenceId) { + case 0x109: + _vm->_platX = 4; + _vm->_platY = 8; + _vm->_gameSys->insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107C9, 160, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), + 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + _vm->_gameSys->removeSequence(0x107, 100, true); + _currCookSequenceId = 0x109; + _nextCookSequenceId = 0x843; + _vm->_platypusSequenceId = 0x7C9; + _vm->_platypusId = 160; + _vm->_platypusFacing = kDirNone; + _vm->_platypusSequenceDatNum = 1; + break; + case 0x843: + _vm->hideCursor(); + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_gameSys->insertSequence(0x10843, 301, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currCookSequenceId = 0x843; + _nextCookSequenceId = 0x10A; + break; + case 0x10A: + _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); + _currCookSequenceId = _nextCookSequenceId; + _nextCookSequenceId = 0x104; + _vm->showCursor(); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->delayTicksCursor(5); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->setGrabCursorSprite(kItemTongs); + if (_vm->_platypusActionStatus == kAS10PlatWithBox) + _vm->_platypusActionStatus = -1; + if (_vm->_gnapX == 4 && _vm->_gnapY == 8) + _vm->gnapWalkStep(); + break; + default: + _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currCookSequenceId = _nextCookSequenceId; + break; + } + + switch (_currCookSequenceId) { + case 0x106: { + // TODO: Refactor into a if + a switch + int rnd = _vm->getRandom(7); + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + _nextCookSequenceId = 0x106; + else if (rnd == 0) + _nextCookSequenceId = 0x104; + else if (rnd == 1) + _nextCookSequenceId = 0x103; + else if (rnd == 2) { + _nextCookSequenceId = 0x106; + _vm->_gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); + } else + _nextCookSequenceId = 0x106; + } + break; + case 0x103: + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + _nextCookSequenceId = 0x106; + else if (_vm->getRandom(7) == 0) + _nextCookSequenceId = 0x104; + else + _nextCookSequenceId = 0x106; + break; + case 0x104: + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + _nextCookSequenceId = 0x106; + else if (_vm->getRandom(7) == 0) + _nextCookSequenceId = 0x103; + else + _nextCookSequenceId = 0x106; + break; + case 0x105: { + // TODO: Refactor into a if + a switch + int rnd = _vm->getRandom(7); + if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + _nextCookSequenceId = 0x106; + else if (rnd == 0) + _nextCookSequenceId = 0x104; + else if (rnd == 1) + _nextCookSequenceId = 0x103; + else + _nextCookSequenceId = 0x106; + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 300; + _vm->_gameSys->insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x10C; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + _vm->_platypusActionStatus = -1; + } + break; + } + if (_currCookSequenceId == 0x843) + _vm->_gameSys->setAnimation(_currCookSequenceId | 0x10000, 301, 2); + else + _vm->_gameSys->setAnimation(_currCookSequenceId, 100, 2); + } +} + +void Scene10::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + _vm->_gameSys->setAnimation(_nextCookSequenceId, 100, 2); + _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + _currCookSequenceId = _nextCookSequenceId; + _nextCookSequenceId = 0x106; + } +} + +/*****************************************************************************/ + +enum { + kHS11Platypus = 0, + kHS11ExitKitchen = 1, + kHS11ExitToilet = 2, + kHS11ExitLeft = 3, + kHS11GoggleGuy = 4, + kHS11HookGuy = 5, + kHS11Billard = 6, + kHS11WalkArea1 = 7, + kHS11Device = 8, + kHS11WalkArea2 = 9, + kHS11WalkArea3 = 10, + kHS11WalkArea4 = 11, + kHS11WalkArea5 = 12 +}; + +enum { + kAS11LeaveScene = 0, + kAS11ShowMagazineToGoggleGuy = 3, + kAS11TalkGoggleGuy = 4, + kAS11GrabHookGuy = 6, + kAS11ShowItemToHookGuy = 8, + kAS11TalkHookGuy = 9, + kAS11GrabBillardBall = 11 +}; + +Scene11::Scene11(GnapEngine *vm) : Scene(vm) { + _billardBallCtr = 0; + _nextHookGuySequenceId = -1; + _currHookGuySequenceId = -1; + _nextGoggleGuySequenceId = -1; + _currGoggleGuySequenceId = -1; +} + +int Scene11::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->_gameSys->setAnimation(0, 0, 2); + if (_vm->_prevSceneNum == 10 || _vm->_prevSceneNum == 13) { + _vm->playSound(0x108EC, false); + _vm->playSound(0x10928, false); + } + return 0x209; +} + +void Scene11::updateHotspots() { + _vm->setHotspot(kHS11Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS11ExitKitchen, 420, 140, 520, 345, SF_EXIT_U_CURSOR); + _vm->setHotspot(kHS11ExitToilet, 666, 130, 740, 364, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHS11ExitLeft, 0, 350, 10, 599, SF_EXIT_L_CURSOR | SF_WALKABLE); + _vm->setHotspot(kHS11GoggleGuy, 90, 185, 185, 340, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS11HookGuy, 210, 240, 340, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS11Billard, 640, 475, 700, 530, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS11WalkArea1, 0, 0, 365, 453); + _vm->setHotspot(kHS11WalkArea2, 0, 0, 629, 353); + _vm->setHotspot(kHS11WalkArea3, 629, 0, 799, 364); + _vm->setHotspot(kHS11WalkArea4, 735, 0, 799, 397); + _vm->setHotspot(kHS11WalkArea5, 510, 540, 799, 599); + _vm->setDeviceHotspot(kHS11Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 13; +} + +void Scene11::run() { + bool flag = true; + + _vm->_timers[7] = 50; + _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; + + _currGoggleGuySequenceId = 0x1F9; + _currHookGuySequenceId = 0x201; + + switch (_vm->_prevSceneNum) { + case 13: + _vm->initGnapPos(8, 5, kDirBottomLeft); + _vm->initPlatypusPos(9, 6, kDirUnk4); + break; + case 47: + _vm->initGnapPos(8, 5, kDirBottomLeft); + _vm->initPlatypusPos(9, 5, kDirUnk4); + _currGoggleGuySequenceId = 0x1FA; + _currHookGuySequenceId = 0x1FF; + _vm->_timers[7] = 180; + break; + case 12: + _vm->initGnapPos(-1, 9, kDirBottomRight); + _vm->initPlatypusPos(-2, 8, kDirNone); + break; + default: + _vm->initGnapPos(6, 6, kDirBottomLeft); + _vm->initPlatypusPos(6, 5, kDirUnk4); + break; + } + + _vm->queueInsertDeviceIcon(); + + _vm->_gameSys->insertSequence(_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + + _nextHookGuySequenceId = -1; + + _vm->_gameSys->setAnimation(_currHookGuySequenceId, 120, 3); + _vm->_gameSys->insertSequence(_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); + + _nextGoggleGuySequenceId = -1; + + _vm->_gameSys->setAnimation(_currGoggleGuySequenceId, 121, 2); + + _vm->_timers[5] = _vm->getRandom(100) + 75; + _vm->_timers[4] = _vm->getRandom(40) + 20; + _vm->_timers[6] = _vm->getRandom(100) + 100; + _vm->endSceneInit(); + + if (_vm->_prevSceneNum == 12) { + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + } + + _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); + + while (!_vm->_sceneDone) { + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS11Platypus: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + break; + } + } + break; + + case kHS11ExitKitchen: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(6, 5, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kAS11LeaveScene; + _vm->platypusWalkTo(6, 6, -1, -1, 1); + _vm->_newSceneNum = 10; + break; + + case kHS11ExitToilet: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(8, 5, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kAS11LeaveScene; + _vm->platypusWalkTo(8, 6, -1, -1, 1); + _vm->_newSceneNum = 13; + break; + + case kHS11ExitLeft: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(-1, 8, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS11LeaveScene; + _vm->platypusWalkTo(-1, 9, -1, 0x107CF, 1); + _vm->_newSceneNum = 12; + break; + + case kHS11GoggleGuy: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemMagazine) { + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS11ShowMagazineToGoggleGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 7, 2, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 6); + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS11TalkGoggleGuy; + break; + } + } + } + break; + + case kHS11HookGuy: + if (_vm->_gnapActionStatus < 0) { + _vm->_gnapIdleFacing = kDirUpRight; + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(5, 6, 0, 0x107BC, 9); + _vm->_gnapActionStatus = kAS11ShowItemToHookGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 3, 6) | 0x10000); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS11GrabHookGuy; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->gnapWalkTo(5, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS11TalkHookGuy; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS11Billard: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(9, 8); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(9, 8); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(9, 8, 0, 0x107BA, 1); + _vm->_gnapActionStatus = kAS11GrabBillardBall; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(9, 8); + break; + } + } + } + break; + + case kHS11WalkArea1: + case kHS11WalkArea2: + case kHS11WalkArea3: + case kHS11WalkArea4: + case kHS11WalkArea5: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHS11Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + if (flag && !_vm->_timers[7]) { + flag = false; + _vm->_gameSys->setAnimation(0x207, 257, 4); + _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->platypusSub426234(); + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 75; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextGoggleGuySequenceId == -1) { + if (_vm->getRandom(2)) + _nextGoggleGuySequenceId = 0x1F6; + else + _nextGoggleGuySequenceId = 0x1F9; + } + } + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(40) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextHookGuySequenceId == -1) { + if (_currHookGuySequenceId == 0x201) { + switch (_vm->getRandom(7)) { + case 0: + _nextHookGuySequenceId = 0x200; + break; + case 1: + _nextHookGuySequenceId = 0x205; + break; + case 2: + _nextHookGuySequenceId = 0x202; + break; + default: + _nextHookGuySequenceId = 0x201; + break; + } + } else { + _nextHookGuySequenceId = 0x201; + } + } + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(100) + 100; + int _gnapRandomValue = _vm->getRandom(3); + switch (_gnapRandomValue) { + case 0: + _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(50) + 75; + _vm->_timers[4] = _vm->getRandom(40) + 20; + } + + _vm->gameUpdateTick(); + } +} + +void Scene11::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + if (_vm->_gnapActionStatus != kAS11GrabBillardBall) + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS11LeaveScene: + _vm->_sceneDone = true; + break; + case kAS11ShowMagazineToGoggleGuy: + _nextGoggleGuySequenceId = 0x1F7; + break; + case kAS11TalkGoggleGuy: + _nextGoggleGuySequenceId = 0x1FB; + break; + case kAS11GrabHookGuy: + _nextHookGuySequenceId = 0x204; + break; + case kAS11ShowItemToHookGuy: + _nextHookGuySequenceId = 0x203; + break; + case kAS11TalkHookGuy: + _nextHookGuySequenceId = 0x206; + break; + case kAS11GrabBillardBall: + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->_gameSys->insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x1F4; + _vm->_gnapId = 255; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->removeSequence(0x207, 257, true); + _vm->_gameSys->removeSequence(0x208, 256, true); + _nextGoggleGuySequenceId = 0x1F8; + _vm->_timers[5] = _vm->getRandom(100) + 75; + _vm->_gameSys->insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextGoggleGuySequenceId, 121, 2); + _currGoggleGuySequenceId = _nextGoggleGuySequenceId; + _nextGoggleGuySequenceId = -1; + switch (_billardBallCtr) { + case 0: + _nextHookGuySequenceId = 0x1FC; + break; + case 1: + _nextHookGuySequenceId = 0x1FD; + break; + default: + _nextHookGuySequenceId = 0x1FE; + break; + } + ++_billardBallCtr; + _vm->_gameSys->insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); + _currHookGuySequenceId = _nextHookGuySequenceId; + _nextHookGuySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(40) + 20; + _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0); + _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; + _vm->_gameSys->setAnimation(0x207, 257, 4); + _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); + _vm->_gnapActionStatus = -1; + } + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextGoggleGuySequenceId != -1) { + _vm->_timers[5] = _vm->getRandom(100) + 75; + _vm->_gameSys->insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextGoggleGuySequenceId, 121, 2); + _currGoggleGuySequenceId = _nextGoggleGuySequenceId; + _nextGoggleGuySequenceId = -1; + if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4) + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_nextHookGuySequenceId == 0x204) { + _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); + _vm->_gameSys->insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _currHookGuySequenceId = 0x204; + _nextHookGuySequenceId = -1; + _vm->_gnapSequenceId = 0x1F5; + _vm->_gnapSequenceDatNum = 0; + _vm->_timers[4] = _vm->getRandom(40) + 20; + _vm->_timers[2] = _vm->getRandom(20) + 70; + _vm->_timers[3] = _vm->getRandom(50) + 200; + if (_vm->_gnapActionStatus == kAS11GrabHookGuy) + _vm->_gnapActionStatus = -1; + } else if (_nextHookGuySequenceId != -1) { + _vm->_gameSys->insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); + _currHookGuySequenceId = _nextHookGuySequenceId; + _nextHookGuySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(40) + 20; + if (_vm->_gnapActionStatus >= 6 && _vm->_gnapActionStatus <= 9) + _vm->_gnapActionStatus = -1; + } + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2) { + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->_hotspots[kHS11Billard]._flags &= ~SF_DISABLED; + } +} + +/*****************************************************************************/ + +enum { + kHS12Platypus = 0, + kHS12ExitRight = 1, + kHS12ToothGuy = 2, + kHS12Barkeeper = 3, + kHS12BeardGuy = 4, + kHS12Jukebox = 5, + kHS12WalkArea1 = 6, + kHS12Device = 7, + kHS12WalkArea2 = 8, + kHS12WalkArea3 = 9, + kHS12WalkArea4 = 10 +}; + +enum { + kAS12LeaveScene = 0, + kAS12QuarterToToothGuyDone = 1, + kAS12TalkToothGuy = 2, + kAS12GrabToothGuy = 4, + kAS12ShowItemToToothGuy = 5, + kAS12QuarterWithHoleToToothGuy = 6, + kAS12QuarterToToothGuy = 7, + kAS12TalkBeardGuy = 8, + kAS12LookBeardGuy = 9, + kAS12GrabBeardGuy = 10, + kAS12ShowItemToBeardGuy = 11, + kAS12TalkBarkeeper = 12, + kAS12LookBarkeeper = 13, + kAS12ShowItemToBarkeeper = 15, + kAS12QuarterWithBarkeeper = 16, + kAS12PlatWithBarkeeper = 17, + kAS12PlatWithToothGuy = 18, + kAS12PlatWithBeardGuy = 19 +}; + +Scene12::Scene12(GnapEngine *vm) : Scene(vm) { + _nextBeardGuySequenceId = -1; + _currBeardGuySequenceId = -1; + _nextToothGuySequenceId = -1; + _currToothGuySequenceId = -1; + _nextBarkeeperSequenceId = -1; + _currBarkeeperSequenceId = -1; +} + +int Scene12::init() { + return 0x209; +} + +void Scene12::updateHotspots() { + _vm->setHotspot(kHS12Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS12ExitRight, 790, 360, 799, 599, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHS12ToothGuy, 80, 180, 160, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS12Barkeeper, 490, 175, 580, 238, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS12BeardGuy, 620, 215, 720, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS12Jukebox, 300, 170, 410, 355, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS12WalkArea1, 0, 0, 260, 460); + _vm->setHotspot(kHS12WalkArea2, 0, 0, 380, 410); + _vm->setHotspot(kHS12WalkArea3, 0, 0, 799, 395); + _vm->setHotspot(kHS12WalkArea4, 585, 0, 799, 455); + _vm->setDeviceHotspot(kHS12Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; +} + +void Scene12::run() { + int v18 = 1; + + _vm->queueInsertDeviceIcon(); + + _vm->_gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); + + _currToothGuySequenceId = 0x200; + _nextToothGuySequenceId = -1; + + _vm->_gameSys->setAnimation(0x200, 50, 2); + _vm->_gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); + + _currBeardGuySequenceId = 0x202; + _nextBeardGuySequenceId = -1; + + _vm->_gameSys->setAnimation(0x202, 50, 4); + _vm->_gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); + + _currBarkeeperSequenceId = 0x203; + _nextBarkeeperSequenceId = -1; + + _vm->_gameSys->setAnimation(0x203, 50, 3); + + _vm->_timers[4] = 30; + _vm->_timers[6] = _vm->getRandom(30) + 20; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_timers[7] = _vm->getRandom(100) + 100; + + if (_vm->_prevSceneNum == 15) { + _vm->initGnapPos(5, 6, kDirBottomRight); + _vm->initPlatypusPos(3, 7, kDirNone); + _vm->endSceneInit(); + } else { + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + } + + while (!_vm->_sceneDone) { + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->updateGrabCursorSprite(0, 0); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS12Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS12Platypus: + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHS12ExitRight: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS12LeaveScene; + _vm->platypusWalkTo(10, -1, -1, -1, 1); + _vm->_newSceneNum = 11; + break; + + case kHS12ToothGuy: + if (_vm->_grabCursorSpriteIndex == kItemQuarter) { + _vm->_largeSprite = _vm->_gameSys->createSurface(0x141); + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapActionStatus = kAS12QuarterToToothGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + _vm->setGrabCursorSprite(-1); + } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapActionStatus = kAS12QuarterWithHoleToToothGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnapActionStatus = kAS12ShowItemToToothGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 2); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS12GrabToothGuy; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS12TalkToothGuy; + break; + case PLAT_CURSOR: + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); + _vm->_platypusActionStatus = kAS12PlatWithToothGuy; + _vm->_platypusFacing = kDirUnk4; + _vm->playGnapIdle(2, 7); + break; + } + } + break; + + case kHS12Barkeeper: + if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS12QuarterWithBarkeeper; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS12ShowItemToBarkeeper; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS12LookBarkeeper; + break; + case GRAB_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(6, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS12TalkBarkeeper; + break; + case PLAT_CURSOR: + _vm->playGnapPullOutDevice(_vm->_platX, _vm->_platY); + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS12PlatWithBarkeeper; + break; + } + } + break; + + case kHS12BeardGuy: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->gnapWalkTo(7, 6, 0, 0x107BB, 9); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS12ShowItemToBeardGuy; + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS12LookBeardGuy; + break; + case GRAB_CURSOR: + // NOTE Bug in the original. It has 9 as flags which seems wrong here. + _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS12GrabBeardGuy; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS12TalkBeardGuy; + break; + case PLAT_CURSOR: + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kAS12PlatWithBeardGuy; + _vm->_platypusFacing = kDirNone; + _vm->playGnapIdle(7, 6); + break; + } + } + break; + + case kHS12Jukebox: + _vm->_newSceneNum = 15; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS12LeaveScene; + break; + + case kHS12WalkArea1: + case kHS12WalkArea2: + case kHS12WalkArea3: + case kHS12WalkArea4: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = 15; + if (_nextToothGuySequenceId == -1) { + if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->getRandom(2) != 0) + _nextToothGuySequenceId = 0x1EC; + else + _nextToothGuySequenceId = 0x204; + } else if (_currToothGuySequenceId != 0x200) + _nextToothGuySequenceId = 0x200; + v18 = (v18 + 1) % 15; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(30) + 20; + if (_nextBarkeeperSequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->getRandom(2) != 0) + _nextBarkeeperSequenceId = 0x208; + else + _nextBarkeeperSequenceId = 0x1FB; + } else + _nextBarkeeperSequenceId = 0x203; + v18 = (v18 + 1) % 15; + } + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(30) + 15; + if (_nextBeardGuySequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + _nextBeardGuySequenceId = 0x1F2; + else + _nextBeardGuySequenceId = 0x202; + v18 = (v18 + 1) % 15; + } + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + int _gnapRandomValue = _vm->getRandom(3); + switch (_gnapRandomValue) { + case 0: + _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = 30; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_timers[6] = _vm->getRandom(30) + 20; + } + + _vm->gameUpdateTick(); + } +} + +void Scene12::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS12LeaveScene: + _vm->_sceneDone = true; + break; + case kAS12TalkToothGuy: + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + // Easter egg + _vm->clearKeyStatus1(Common::KEYCODE_j); + _nextToothGuySequenceId = 0x206; + } else { + _nextToothGuySequenceId = 0x1EE; + } + break; + case 3: + break; + case kAS12GrabToothGuy: + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); + _nextToothGuySequenceId = 0x206; + } else { + _nextToothGuySequenceId = 0x1EF; + } + break; + case kAS12ShowItemToToothGuy: + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); + _nextToothGuySequenceId = 0x206; + } else { + _nextToothGuySequenceId = 0x1ED; + } + break; + case kAS12QuarterWithHoleToToothGuy: + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); + _nextToothGuySequenceId = 0x206; + } else { + _nextToothGuySequenceId = 0x1EA; + } + break; + case kAS12QuarterToToothGuy: + if (_vm->isKeyStatus1(Common::KEYCODE_j)) { + _vm->clearKeyStatus1(Common::KEYCODE_j); + _nextToothGuySequenceId = 0x206; + } else { + _nextToothGuySequenceId = 0x1E9; + } + break; + case kAS12QuarterToToothGuyDone: + _vm->_gnapActionStatus = -1; + _vm->showCursor(); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->setGrabCursorSprite(kItemQuarterWithHole); + break; + case kAS12TalkBeardGuy: + _nextBeardGuySequenceId = 0x1F4; + break; + case kAS12LookBeardGuy: + _nextBeardGuySequenceId = 0x1F3; + break; + case kAS12GrabBeardGuy: + _nextBeardGuySequenceId = 0x1F1; + break; + case kAS12ShowItemToBeardGuy: + _nextBeardGuySequenceId = 0x1F0; + break; + case kAS12TalkBarkeeper: + if (_vm->getRandom(2) != 0) + _nextBarkeeperSequenceId = 0x1FD; + else + _nextBarkeeperSequenceId = 0x1FF; + break; + case kAS12LookBarkeeper: + _nextBarkeeperSequenceId = 0x1F8; + break; + case 14: + _nextBarkeeperSequenceId = 0x1F6; + break; + case kAS12ShowItemToBarkeeper: + _nextBarkeeperSequenceId = 0x1F5; + break; + case kAS12QuarterWithBarkeeper: + _nextBarkeeperSequenceId = 0x1FA; + break; + case kAS12PlatWithBarkeeper: + _nextBarkeeperSequenceId = 0x1F9; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { + case kAS12PlatWithToothGuy: + _nextToothGuySequenceId = 0x1EB; + break; + case kAS12PlatWithBeardGuy: + _nextBeardGuySequenceId = 0x1F3; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (_currToothGuySequenceId == 0x1E9) { + _vm->_gameSys->setAnimation(0, 0, 2); + _vm->hideCursor(); + _vm->_gameSys->setAnimation(0x10843, 301, 0); + _vm->_gnapActionStatus = kAS12QuarterToToothGuyDone; + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_gameSys->insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B7; + _vm->_gnapSequenceDatNum = 1; + _vm->setFlag(kGFTwigTaken); + _vm->invAdd(kItemQuarterWithHole); + _vm->invRemove(kItemQuarter); + } + if (_nextToothGuySequenceId == 0x1EF) { + _vm->_gameSys->setAnimation(_nextToothGuySequenceId, 50, 2); + _vm->_gameSys->insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _currToothGuySequenceId = _nextToothGuySequenceId; + _nextToothGuySequenceId = -1; + _vm->_gnapSequenceId = 0x205; + _vm->_gnapSequenceDatNum = 0; + _vm->_timers[4] = 40; + _vm->_timers[2] = _vm->getRandom(20) + 70; + _vm->_timers[3] = _vm->getRandom(50) + 200; + if (_vm->_gnapActionStatus == kAS12GrabToothGuy) + _vm->_gnapActionStatus = -1; + } else if (_nextToothGuySequenceId != -1) { + _vm->_gameSys->insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextToothGuySequenceId, 50, 2); + _currToothGuySequenceId = _nextToothGuySequenceId; + _nextToothGuySequenceId = -1; + _vm->_timers[4] = 50; + if (_vm->_gnapActionStatus >= kAS12TalkToothGuy && _vm->_gnapActionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && + _currToothGuySequenceId != 0x1EC && _currToothGuySequenceId != 0x200) + _vm->_gnapActionStatus = -1; + if (_vm->_platypusActionStatus == kAS12PlatWithToothGuy) + _vm->_platypusActionStatus = -1; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_vm->_gnapActionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { + _vm->_gnapActionStatus = -1; + _vm->playGnapIdle(7, 6); + _vm->_timers[5] = 0; + } + if (_nextBarkeeperSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextBarkeeperSequenceId, 50, _currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextBarkeeperSequenceId, 50, 3); + _currBarkeeperSequenceId = _nextBarkeeperSequenceId; + _nextBarkeeperSequenceId = -1; + _vm->_timers[5] = _vm->getRandom(30) + 20; + if (_vm->_gnapActionStatus >= kAS12TalkBarkeeper && _vm->_gnapActionStatus <= kAS12QuarterWithBarkeeper && _currBarkeeperSequenceId != 0x203 && + _currBarkeeperSequenceId != 0x1FB && _currBarkeeperSequenceId != 0x208) + _vm->_gnapActionStatus = -1; + } + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextBeardGuySequenceId != -1) { + _vm->_gameSys->insertSequence(_nextBeardGuySequenceId, 50, _currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextBeardGuySequenceId, 50, 4); + _currBeardGuySequenceId = _nextBeardGuySequenceId; + _nextBeardGuySequenceId = -1; + _vm->_timers[6] = _vm->getRandom(30) + 20; + if (_vm->_gnapActionStatus >= kAS12TalkBeardGuy && _vm->_gnapActionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) + _vm->_gnapActionStatus = -1; + if (_vm->_platypusActionStatus == kAS12PlatWithBeardGuy) + _vm->_platypusActionStatus = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS13Platypus = 0, + kHS13ExitBar = 1, + kHS13WalkArea1 = 2, + kHS13BackToilet = 3, + kHS13FrontToilet = 4, + kHS13Urinal = 5, + kHS13Scribble = 6, + kHS13Sink = 7, + kHS13WalkArea2 = 8, + kHS13Device = 9, + kHS13WalkArea3 = 10, + kHS13WalkArea4 = 11, + kHS13WalkArea5 = 12, + kHS13WalkArea6 = 13, + kHS13WalkArea7 = 14, + kHS13WalkArea8 = 15, + kHS13WalkArea9 = 16 +}; + +enum { + kAS13LeaveScene = 0, + kAS13BackToilet = 1, + kAS13FrontToilet = 2, + kAS13LookScribble = 6, + kAS13GrabSink = 7, + kAS13GrabSinkDone = 8, + kAS13Wait = 12, + kAS13GrabUrinal = 13 +}; + +Scene13::Scene13(GnapEngine *vm) : Scene(vm) { + _backToiletCtr = -1; +} + +int Scene13::init() { + _vm->playSound(0x108EC, false); + return 0xAC; +} + +void Scene13::updateHotspots() { + _vm->setHotspot(kHS13Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS13ExitBar, 113, 160, 170, 455, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHS13BackToilet, 385, 195, 478, 367, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS13FrontToilet, 497, 182, 545, 432, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS13Urinal, 680, 265, 760, 445, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS13Scribble, 560, 270, 660, 370, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS13Sink, 310, 520, 560, 599, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS13WalkArea1, 268, 270, 325, 385); + _vm->setHotspot(kHS13WalkArea2, 0, 0, 52, 599); + _vm->setHotspot(kHS13WalkArea3, 0, 0, 113, 550); + _vm->setHotspot(kHS13WalkArea4, 0, 0, 226, 438); + _vm->setHotspot(kHS13WalkArea5, 0, 0, 268, 400); + _vm->setHotspot(kHS13WalkArea6, 0, 0, 799, 367); + _vm->setHotspot(kHS13WalkArea7, 478, 0, 799, 401); + _vm->setHotspot(kHS13WalkArea8, 545, 0, 799, 473); + _vm->setHotspot(kHS13WalkArea9, 0, 549, 799, 599); + _vm->setDeviceHotspot(kHS13Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 17; +} + +void Scene13::showScribble() { + _vm->hideCursor(); + _vm->_largeSprite = _vm->_gameSys->createSurface(0x6F); + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && + !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) + _vm->gameUpdateTick(); + _vm->_mouseClickState._left = false; + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->showCursor(); +} + +void Scene13::run() { + int currSoundId = 0; + + _vm->queueInsertDeviceIcon(); + + _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 14) { + _vm->initGnapPos(6, 6, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirNone); + } else { + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(2, 7, kDirNone); + } + + _vm->endSceneInit(); + + _vm->_timers[4] = _vm->getRandom(20) + 20; + _vm->_timers[5] = _vm->getRandom(50) + 50; + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1091A)) + _vm->playSound(0x1091A, true); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS13Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; + _vm->_timers[5] = _vm->getRandom(50) + 50; + } + break; + + case kHS13Platypus: + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + break; + } + break; + + case kHS13ExitBar: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(2, 7, 0, 0x107C0, 1); + _vm->_gnapActionStatus = kAS13LeaveScene; + _vm->platypusWalkTo(2, 8, -1, -1, 1); + if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { + _vm->_newSceneNum = 11; + } else { + _vm->setFlag(kGFSpringTaken); + _vm->_newSceneNum = 47; + } + break; + + case kHS13BackToilet: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(5, 5, 6, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + case TALK_CURSOR: + if (_vm->_gnapX == 5 && _vm->_gnapY == 5) { + _backToiletCtr = MIN(5, _backToiletCtr + 1); + _vm->_gameSys->setAnimation(_backToiletCtr + 0xA3, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqScale | kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS13Wait; + _vm->_gnapSequenceId = _backToiletCtr + 0xA3; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapSequenceDatNum = 0; + } else { + _vm->gnapWalkTo(5, 5, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS13BackToilet; + _vm->_gnapIdleFacing = kDirUpRight; + } + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS13FrontToilet: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 7, 7, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->gnapWalkTo(6, 7, 0, 0xA9, 5); + _vm->_gnapActionStatus = kAS13FrontToilet; + _vm->_gnapIdleFacing = kDirBottomRight; + break; + } + } + break; + + case kHS13Scribble: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 7, 8, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS13LookScribble; + _vm->_gnapIdleFacing = kDirUpRight; + break; + case GRAB_CURSOR: + _vm->playGnapScratchingHead(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(7, 7, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0), 1); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS13Urinal: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(8, 7, 9, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 9, 6)); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); + _vm->_gnapActionStatus = kAS13Wait; + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(8, 7, 0, -1, 1); + _vm->_gnapActionStatus = kAS13GrabUrinal; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS13Sink: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 5, 9)); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); + _vm->_gnapActionStatus = kAS13Wait; + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(4, 8, 0, 0x107B9, 1); + _vm->_gnapActionStatus = kAS13GrabSink; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS13WalkArea2: + case kHS13WalkArea3: + case kHS13WalkArea4: + case kHS13WalkArea5: + case kHS13WalkArea6: + case kHS13WalkArea7: + case kHS13WalkArea8: + case kHS13WalkArea9: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + case kHS13WalkArea1: + // Nothing + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + if (_vm->_platY == 5 || _vm->_platY == 6) + _vm->platypusWalkTo(-1, 7, -1, -1, 1); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 20; + switch (_vm->getRandom(5)) { + case 0: + _vm->playSound(0xD2, false); + break; + case 1: + _vm->playSound(0xD3, false); + break; + case 2: + _vm->playSound(0xD4, false); + break; + case 3: + _vm->playSound(0xD5, false); + break; + case 4: + _vm->playSound(0xD6, false); + break; + } + } + if (!_vm->_timers[5]) { + int newSoundId; + _vm->_timers[5] = _vm->getRandom(50) + 50; + switch (_vm->getRandom(7)) { + case 0: + newSoundId = 0xD7; + _vm->_timers[5] = 2 * _vm->getRandom(50) + 100; + break; + case 1: + case 2: + newSoundId = 0xCF; + break; + case 3: + case 4: + newSoundId = 0xD0; + break; + default: + newSoundId = 0xD1; + break; + } + if (newSoundId != currSoundId) { + _vm->playSound(newSoundId, false); + currSoundId = newSoundId; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; + _vm->_timers[5] = _vm->getRandom(50) + 50; + } + + _vm->gameUpdateTick(); + } +} + +void Scene13::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS13LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + case kAS13BackToilet: + _backToiletCtr = MIN(5, _backToiletCtr + 1); + _vm->_gameSys->insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); + _vm->_gnapSequenceId = _backToiletCtr + 0xA3; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + break; + case kAS13FrontToilet: + _vm->_sceneDone = true; + _vm->_newSceneNum = 14; + break; + case kAS13LookScribble: + _vm->_gnapActionStatus = -1; + showScribble(); + break; + case kAS13GrabSink: + _vm->_gameSys->setAnimation(0xAB, 160, 0); + _vm->_gameSys->insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0xAA, 256, true); + _vm->_gnapSequenceId = 0xAB; + _vm->_gnapId = 160; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 4; + _vm->_gnapY = 8; + _vm->_timers[2] = 360; + _vm->_gnapActionStatus = kAS13GrabSinkDone; + break; + case kAS13GrabSinkDone: + _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + break; + case kAS13Wait: + _vm->_gnapActionStatus = -1; + break; + case kAS13GrabUrinal: + _vm->_gameSys->setAnimation(0xA2, 120, 0); + _vm->_gameSys->insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA2; + _vm->_gnapId = 120; + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 4; + _vm->_gnapY = 6; + _vm->_timers[2] = 360; + _vm->_gnapActionStatus = kAS13Wait; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_platypusActionStatus = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS14Platypus = 0, + kHS14Exit = 1, + kHS14Coin = 2, + kHS14Toilet = 3, + kHS14Device = 4 +}; + +Scene14::Scene14(GnapEngine *vm) : Scene(vm) { +} + +int Scene14::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0x27; +} + +void Scene14::updateHotspots() { + _vm->setHotspot(kHS14Platypus, 0, 0, 0, 0); + _vm->setHotspot(kHS14Exit, 0, 590, 799, 599, SF_EXIT_D_CURSOR); + _vm->setHotspot(kHS14Coin, 330, 390, 375, 440, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS14Toilet, 225, 250, 510, 500, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setDeviceHotspot(kHS14Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFNeedleTaken)) + _vm->_hotspots[kHS14Coin]._flags = SF_DISABLED; + _vm->_hotspotsCount = 5; +} + +void Scene14::run() { + _vm->_largeSprite = nullptr; + + _vm->queueInsertDeviceIcon(); + + if (!_vm->isFlag(kGFNeedleTaken)) + _vm->_gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); + + _vm->endSceneInit(); + + if (!_vm->isFlag(kGFNeedleTaken) && _vm->invHas(kItemTongs)) + _vm->_largeSprite = _vm->_gameSys->createSurface(1); + + if (!_vm->isFlag(kGFNeedleTaken)) { + _vm->_gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x24; + _vm->_timers[2] = _vm->getRandom(40) + 50; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS14Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS14Exit: + _vm->_sceneDone = true; + _vm->_newSceneNum = 13; + break; + + case kHS14Coin: + if (_vm->_grabCursorSpriteIndex == kItemTongs) { + _vm->invAdd(kItemQuarter); + _vm->setFlag(kGFNeedleTaken); + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + _vm->_gameSys->setAnimation(0x26, 10, 0); + _vm->_gameSys->insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playSound(0x108E9, false); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playSound(0x108E9, false); + break; + case GRAB_CURSOR: + _vm->_gameSys->insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x23; + break; + case TALK_CURSOR: + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); + break; + case PLAT_CURSOR: + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + break; + } + } + break; + + case kHS14Toilet: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + _vm->playSound(0x108B1, false); + break; + case TALK_CURSOR: + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); + break; + case PLAT_CURSOR: + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + break; + } + } + break; + + default: + _vm->_mouseClickState._left = false; + break; + } + + updateAnimations(); + _vm->checkGameKeys(); + + if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { + _vm->_gameSys->insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x24; + _vm->_timers[2] = _vm->getRandom(40) + 50; + } + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } + + if (_vm->_largeSprite) + _vm->deleteSurface(&_vm->_largeSprite); +} + +void Scene14::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_gameSys->setAnimation(0x10843, 301, 1); + _vm->_gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_sceneDone = true; + _vm->_newSceneNum = 13; + _vm->_grabCursorSpriteIndex = kItemQuarter; + } +} + +/*****************************************************************************/ + +enum { + kHS15Platypus = 0, + kHS15Exit = 1, + kHS15Button1 = 2, + kHS15Button2 = 3, + kHS15Button3 = 4, + kHS15Button4 = 5, + kHS15Button5 = 6, + kHS15Button6 = 7, + kHS15ButtonA = 8, + kHS15ButtonB = 9, + kHS15ButtonC = 10, + kHS15ButtonD = 11, + kHS15ButtonE = 12, + kHS15ButtonF = 13, + kHS15CoinSlot = 14, + kHS15PlayButton = 15, + kHS15Device = 16 +}; + +Scene15::Scene15(GnapEngine *vm) : Scene(vm) { + _nextRecordSequenceId = -1; + _currRecordSequenceId = -1; + _nextSlotSequenceId = -1; + _currSlotSequenceId = -1; + _nextUpperButtonSequenceId = -1; + _currUpperButtonSequenceId = -1; + _nextLowerButtonSequenceId = -1; + _currLowerButtonSequenceId = -1; +} + +int Scene15::init() { + return 0xDD; +} + +void Scene15::updateHotspots() { + _vm->setHotspot(kHS15Platypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHS15Exit, 50, 590, 750, 599, SF_EXIT_D_CURSOR); + _vm->setHotspot(kHS15Button1, 210, 425, 260, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15Button2, 280, 425, 325, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15Button3, 340, 425, 385, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15Button4, 400, 425, 445, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15Button5, 460, 425, 510, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15Button6, 520, 425, 560, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15ButtonA, 205, 480, 250, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15ButtonB, 270, 480, 320, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15ButtonC, 335, 480, 380, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15ButtonD, 395, 480, 445, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15ButtonE, 460, 480, 505, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15ButtonF, 515, 480, 560, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15CoinSlot, 585, 475, 620, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS15PlayButton, 622, 431, 650, 482, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setDeviceHotspot(kHS15Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 17; +} + +void Scene15::run() { + _currSlotSequenceId = -1; + _currUpperButtonSequenceId = -1; + _currLowerButtonSequenceId = -1; + _nextSlotSequenceId = -1; + _nextUpperButtonSequenceId = -1; + _nextLowerButtonSequenceId = -1; + _currRecordSequenceId = 0xD5; + _nextRecordSequenceId = -1; + + _vm->_gameSys->setAnimation(0xD5, 1, 0); + _vm->_gameSys->insertSequence(_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + _vm->endSceneInit(); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_hotspots[kHS15Platypus]._x1 = 0; + _vm->_hotspots[kHS15Platypus]._y1 = 0; + _vm->_hotspots[kHS15Platypus]._x2 = 0; + _vm->_hotspots[kHS15Platypus]._y2 = 0; + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS15Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS15Exit: + _vm->_newSceneNum = 12; + _vm->_isLeavingScene = true; + break; + + case kHS15CoinSlot: + if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { + _nextSlotSequenceId = 0xDC; // Insert coin + } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _nextSlotSequenceId = 0xDB; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + _vm->playSound(0x108E9, false); + break; + case TALK_CURSOR: + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); + break; + case PLAT_CURSOR: + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + break; + } + } + break; + + case kHS15PlayButton: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFGnapControlsToyUFO) || _vm->isFlag(kGFUnk13)) + _vm->playSound(0x108E9, false); + else + _nextSlotSequenceId = 0xDA; + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFGnapControlsToyUFO) || _vm->isFlag(kGFUnk13)) + _nextSlotSequenceId = 0xD9; + else + _nextSlotSequenceId = 0xDA; + break; + case TALK_CURSOR: + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); + break; + case PLAT_CURSOR: + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + break; + } + } + break; + + case kHS15Button1: + case kHS15Button2: + case kHS15Button3: + case kHS15Button4: + case kHS15Button5: + case kHS15Button6: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playSound(0x108E9, false); + break; + case GRAB_CURSOR: + _nextUpperButtonSequenceId = _vm->_sceneClickedHotspot + 0xC5; + break; + case TALK_CURSOR: + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); + break; + case PLAT_CURSOR: + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + break; + } + } + break; + + case kHS15ButtonA: + case kHS15ButtonB: + case kHS15ButtonC: + case kHS15ButtonD: + case kHS15ButtonE: + case kHS15ButtonF: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playSound(0x108E9, false); + break; + case GRAB_CURSOR: + _nextLowerButtonSequenceId = _vm->_sceneClickedHotspot + 0xC5; + break; + case TALK_CURSOR: + _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); + break; + case PLAT_CURSOR: + _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + break; + } + } + break; + + default: + _vm->_mouseClickState._left = false; + break; + + } + + updateAnimations(); + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene15::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + if (_vm->_isLeavingScene) { + _vm->_sceneDone = true; + } else if (_nextSlotSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextSlotSequenceId, 1, 0); + _vm->_gameSys->insertSequence(_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _currSlotSequenceId = _nextSlotSequenceId; + _nextSlotSequenceId = -1; + switch (_currSlotSequenceId) { + case 0xDC: + if (_vm->_grabCursorSpriteIndex == kItemQuarter) { + _vm->invRemove(kItemQuarter); + } else { + _vm->invRemove(kItemQuarterWithHole); + _vm->setFlag(kGFUnk13); + } + _vm->setGrabCursorSprite(-1); + break; + case 0xDB: + _vm->setFlag(kGFUnk14); + _vm->setGrabCursorSprite(-1); + _nextSlotSequenceId = 0xD8; + break; + case 0xD9: + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->clearFlag(kGFGnapControlsToyUFO); + _vm->invAdd(kItemQuarter); + _vm->_newGrabCursorSpriteIndex = kItemQuarter; + } else if (_vm->isFlag(kGFUnk13)) { + _vm->clearFlag(kGFUnk13); + _vm->invAdd(kItemQuarterWithHole); + _vm->_newGrabCursorSpriteIndex = kItemQuarterWithHole; + } + _vm->_newSceneNum = 12; + _vm->_isLeavingScene = true; + break; + case 0xD8: + case 0xDA: + if (_currUpperButtonSequenceId != -1) { + _vm->_gameSys->removeSequence(_currUpperButtonSequenceId, 1, true); + _currUpperButtonSequenceId = -1; + } + if (_currLowerButtonSequenceId != -1) { + _vm->_gameSys->removeSequence(_currLowerButtonSequenceId, 1, true); + _currLowerButtonSequenceId = -1; + } + break; + } + } else if (_nextRecordSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextRecordSequenceId, 1, 0); + _vm->_gameSys->insertSequence(_nextRecordSequenceId, 1, _currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _currRecordSequenceId = _nextRecordSequenceId; + _nextRecordSequenceId = -1; + if (_currRecordSequenceId == 0xD3) { + _vm->invRemove(kItemDiceQuarterHole); + _vm->_newSceneNum = 16; + _vm->_isLeavingScene = true; + } + _vm->_gameSys->removeSequence(_currUpperButtonSequenceId, 1, true); + _currUpperButtonSequenceId = -1; + _vm->_gameSys->removeSequence(_currLowerButtonSequenceId, 1, true); + _currLowerButtonSequenceId = -1; + } else if (_nextUpperButtonSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextUpperButtonSequenceId, 1, 0); + if (_currUpperButtonSequenceId == -1) + _vm->_gameSys->insertSequence(_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(_nextUpperButtonSequenceId, 1, _currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _currUpperButtonSequenceId = _nextUpperButtonSequenceId; + _nextUpperButtonSequenceId = -1; + if (_currLowerButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { + if (_currUpperButtonSequenceId == 0xCC && _currLowerButtonSequenceId == 0xCE) + _nextRecordSequenceId = 0xD3; + else + _nextRecordSequenceId = 0xD4; + } + } else if (_nextLowerButtonSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextLowerButtonSequenceId, 1, 0); + if (_currLowerButtonSequenceId == -1) + _vm->_gameSys->insertSequence(_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(_nextLowerButtonSequenceId, 1, _currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _currLowerButtonSequenceId = _nextLowerButtonSequenceId; + _nextLowerButtonSequenceId = -1; + if (_currUpperButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { + if (_currUpperButtonSequenceId == 0xCC && _currLowerButtonSequenceId == 0xCE) + _nextRecordSequenceId = 0xD3; + else + _nextRecordSequenceId = 0xD4; + } + } + } +} + +/*****************************************************************************/ + +enum { + kHS17Platypus = 0, + kHS17Phone1 = 1, + kHS17Phone2 = 2, + kHS17ExitGrubCity = 3, + kHS17Device = 4, + kHS17ExitToyStore = 5, + kHS17Wrench = 6, + kHS17WalkArea1 = 7, + kHS17WalkArea2 = 8, + kHS17WalkArea3 = 9 +}; + +enum { + kAS17TryGetWrench = 0, + kAS17GetWrench2 = 1, + kAS17GetWrenchDone = 2, + kAS17GetWrench1 = 3, + kAS17PlatUsePhone = 4, + kAS17PutCoinIntoPhone = 5, + kAS17GetCoinFromPhone = 6, + kAS17GetCoinFromPhoneDone = 7, + kAS17PutCoinIntoPhoneDone = 8, + kAS17GnapUsePhone = 9, + kAS17GetWrenchGnapReady = 10, + kAS17GnapHangUpPhone = 11, + kAS17PlatPhoningAssistant = 12, + kAS17PlatHangUpPhone = 14, + kAS17LeaveScene = 15 +}; + +Scene17::Scene17(GnapEngine *vm) : Scene(vm) { + _platTryGetWrenchCtr = 0; + _wrenchCtr = 2; + _nextCarWindowSequenceId = -1; + _nextWrenchSequenceId = -1; + _canTryGetWrench = true; + _platPhoneCtr = 0; + _nextPhoneSequenceId = -1; + _currPhoneSequenceId = -1; +} + +int Scene17::init() { + return 0x263; +} + +void Scene17::updateHotspots() { + _vm->setHotspot(kHS17Platypus, 1, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS17Phone1, 61, 280, 97, 322, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHS17Phone2, 80, 204, 178, 468, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHS17ExitGrubCity, 196, 207, 280, 304, SF_EXIT_U_CURSOR, 3, 5); + _vm->setHotspot(kHS17ExitToyStore, 567, 211, 716, 322, SF_EXIT_U_CURSOR, 5, 6); + _vm->setHotspot(kHS17Wrench, 586, 455, 681, 547, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHS17WalkArea1, 0, 0, 800, 434); + _vm->setHotspot(kHS17WalkArea2, 541, 0, 800, 600); + _vm->setHotspot(kHS17WalkArea3, 0, 204, 173, 468); + _vm->setDeviceHotspot(kHS17Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFGrassTaken)) + _vm->_hotspots[kHS17Wrench]._flags = SF_NONE; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHS17Device]._flags = SF_DISABLED; + _vm->_hotspots[kHS17Platypus]._flags = SF_DISABLED; + } + _vm->_hotspotsCount = 10; +} + +void Scene17::update() { + _vm->gameUpdateTick(); + _vm->updateMouseCursor(); + _vm->updateGrabCursorSprite(0, 0); + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } +} + +void Scene17::platHangUpPhone() { + int savedGnapActionStatus = _vm->_gnapActionStatus; + + if (_vm->_platypusActionStatus == kAS17PlatPhoningAssistant) { + _vm->_gnapActionStatus = kAS17PlatHangUpPhone; + _vm->updateMouseCursor(); + _platPhoneCtr = 0; + _vm->_platypusActionStatus = -1; + _vm->_gameSys->setAnimation(0x257, 254, 4); + _vm->_gameSys->insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) + _vm->gameUpdateTick(); + _vm->_gameSys->setAnimation(0x25B, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0x25B; + _vm->_platypusSequenceDatNum = 0; + _currPhoneSequenceId = -1; + _nextPhoneSequenceId = -1; + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + _vm->_gnapActionStatus = savedGnapActionStatus; + _vm->updateMouseCursor(); + } + updateHotspots(); +} + +void Scene17::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(8); + _vm->_sceneWaiting = false; + _vm->_timers[4] = _vm->getRandom(100) + 200; + _vm->_timers[3] = 200; + _vm->_timers[5] = _vm->getRandom(30) + 80; + _vm->_timers[6] = _vm->getRandom(30) + 200; + _vm->_timers[7] = _vm->getRandom(100) + 100; + + if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); + } else { + if (_vm->_s18GarbageCanPos >= 8) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); + } else if (_vm->_s18GarbageCanPos >= 6) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); + } else if (_vm->_s18GarbageCanPos >= 5) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); + } else if (_vm->_s18GarbageCanPos >= 4) { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); + } else { + _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); + } + } + + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFGrassTaken)) + _currWrenchSequenceId = 0x22D; + else + _currWrenchSequenceId = 0x22F; + + _currCarWindowSequenceId = 0x244; + + if (_vm->isFlag(kGFUnk14)) + _vm->_gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_gameSys->setAnimation(_currWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGrassTaken)) { + _vm->_gameSys->setAnimation(0, 0, 3); + } else { + _vm->_gameSys->setAnimation(_currCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + } + + _canTryGetWrench = true; + + if (_vm->isFlag(kGFUnk18)) + _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(4, 6, kDirBottomRight); + _vm->initPlatypusPos(5, 6, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else if (_vm->isFlag(kGFUnk27)) { + _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_platX = _vm->_hotspotsWalkPos[2].x; + _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x25A; + _vm->_platypusSequenceDatNum = 0; + _vm->endSceneInit(); + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; + platHangUpPhone(); + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + _vm->clearFlag(kGFUnk27); + updateHotspots(); + } else if (_vm->isFlag(kGFUnk25)) { + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->initPlatypusPos(7, 9, kDirNone); + _vm->_gnapX = _vm->_hotspotsWalkPos[2].x; + _vm->_gnapY = _vm->_hotspotsWalkPos[2].y; + _vm->_gnapId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_gameSys->insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 601; + _vm->_gnapActionStatus = kAS17GnapHangUpPhone; + _vm->clearFlag(kGFUnk25); + _vm->_gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(0x257, 254, 0); + _vm->_gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); + } else if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->_sceneWaiting = true; + _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_platX = _vm->_hotspotsWalkPos[2].x; + _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; + _currPhoneSequenceId = 0x251; + _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platypusSequenceId = 0x25A; + _vm->_platypusSequenceDatNum = 0; + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(_currPhoneSequenceId, 254, 1); + _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; + updateHotspots(); + } else if (_vm->_prevSceneNum == 18) { + _vm->initGnapPos(6, 6, kDirBottomRight); + _vm->initPlatypusPos(5, 6, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else { + if (_vm->isFlag(kGFSpringTaken)) { + _vm->initGnapPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); + _vm->initPlatypusPos(1, 9, kDirNone); + _vm->endSceneInit(); + } else { + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); + } + _vm->clearFlag(kGFSpringTaken); + _vm->clearFlag(kGFUnk16); + _vm->endSceneInit(); + } + } else { + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapId = 120; + _vm->_gnapSequenceId = 0x23D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_platX = -1; + _vm->_platY = 8; + _vm->_platypusId = 160; + _vm->_gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, + kSeqScale | kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + _vm->_gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); + // TODO delayTicksA(2, 9); + _vm->endSceneInit(); + _vm->_platypusSequenceId = 0x7C1; + _vm->_platypusSequenceDatNum = 1; + _vm->_platypusFacing = kDirBottomRight; + _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS17Device: + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == 3) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS17Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->gnapUseJointOnPlatypus(); + } else { + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); + _vm->_platypusActionStatus = kAS17GetWrench1; + _vm->_gnapActionStatus = kAS17GetWrench1; + _vm->_timers[5] = _vm->getRandom(30) + 80; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemJoint); + } + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS17Wrench: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFGrassTaken)) { + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + case GRAB_CURSOR: + _vm->playGnapScratchingHead(8, 7); + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (_canTryGetWrench) { + platHangUpPhone(); + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->_platypusActionStatus = kAS17TryGetWrench; + _vm->_gnapActionStatus = kAS17TryGetWrench; + _vm->_timers[5] = _vm->getRandom(30) + 80; + } else + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS17Phone1: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS17PutCoinIntoPhone; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 3); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS17GetCoinFromPhone; + } else + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->gnapUseDeviceOnPlatypuss(); + _vm->_platypusFacing = kDirUpLeft; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->setFlag(kGFUnk16); + _vm->_platypusActionStatus = kAS17PlatUsePhone; + _vm->_gnapActionStatus = kAS17PlatUsePhone; + } else + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS17Phone2: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS17PutCoinIntoPhone; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 3); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS17GnapUsePhone; + _vm->setFlag(kGFSpringTaken); + } else + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (_vm->isFlag(kGFUnk18)) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->gnapUseDeviceOnPlatypuss(); + _vm->_platypusFacing = kDirUpLeft; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->setFlag(kGFUnk16); + _vm->_platypusActionStatus = kAS17PlatUsePhone; + _vm->_gnapActionStatus = kAS17PlatUsePhone; + } else + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS17ExitToyStore: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS17LeaveScene; + if (_vm->_platypusActionStatus != kAS17PlatPhoningAssistant) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); + } + break; + + case kHS17ExitGrubCity: + if (_vm->_gnapActionStatus < 0) { + platHangUpPhone(); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS17LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); + } + break; + + case kHS17WalkArea1: + case kHS17WalkArea2: + case kHS17WalkArea3: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->platypusSub426234(); + _vm->updateGnapIdleSequence2(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 200; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + _vm->_gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + switch (_vm->getRandom(3)) { + case 0: + _vm->_gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _vm->_gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + if (_vm->_platypusActionStatus < 0 && !_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(30) + 80; + if (_vm->isFlag(kGFGrassTaken) && _nextWrenchSequenceId == -1) { + _nextWrenchSequenceId = 0x236; + } else if (_canTryGetWrench) { + switch (_vm->getRandom(6)) { + case 0: + _nextWrenchSequenceId = 0x231; + break; + case 1: + _nextWrenchSequenceId = 0x232; + break; + case 2: + case 3: + _nextWrenchSequenceId = 0x23C; + break; + case 4: + case 5: + _nextWrenchSequenceId = 0x22E; + break; + } + } else { + --_wrenchCtr; + if (_wrenchCtr) { + switch (_vm->getRandom(6)) { + case 0: + _nextWrenchSequenceId = 0x237; + break; + case 1: + _nextWrenchSequenceId = 0x238; + break; + case 2: + _nextWrenchSequenceId = 0x239; + break; + case 3: + _nextWrenchSequenceId = 0x23A; + break; + case 4: + _nextWrenchSequenceId = 0x23B; + break; + case 5: + _nextWrenchSequenceId = 0x235; + break; + } + } else { + _wrenchCtr = 2; + _nextWrenchSequenceId = 0x235; + } + } + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(30) + 200; + if (_nextCarWindowSequenceId == -1 && !_vm->isFlag(kGFGrassTaken)) + _nextCarWindowSequenceId = 0x246; + } + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene17::updateAnimations() { + static const int kPlatPhoneSequenceIds[] = { + 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257 + }; + + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS17GetWrench1: + _vm->_gnapActionStatus = kAS17GetWrenchGnapReady; + break; + case kAS17GetCoinFromPhone: + _vm->playGnapPullOutDevice(1, 3); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x250, 100, 0); + _vm->_gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); + _vm->invAdd(kItemDiceQuarterHole); + _vm->clearFlag(kGFUnk18); + _vm->_gnapActionStatus = kAS17GetCoinFromPhoneDone; + break; + case kAS17GetCoinFromPhoneDone: + _vm->setGrabCursorSprite(kItemDiceQuarterHole); + _vm->_gnapActionStatus = -1; + break; + case kAS17PutCoinIntoPhone: + _vm->_gameSys->setAnimation(0x24C, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x24C; + _vm->invRemove(kItemDiceQuarterHole); + _vm->setGrabCursorSprite(-1); + _vm->setFlag(kGFUnk18); + _vm->_gnapActionStatus = kAS17PutCoinIntoPhoneDone; + break; + case kAS17PutCoinIntoPhoneDone: + _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + break; + case kAS17GnapUsePhone: + _vm->_gameSys->setAnimation(0x24D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS17LeaveScene; + _vm->_newSceneNum = 53; + break; + case kAS17GnapHangUpPhone: + _vm->_gameSys->insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x258; + _vm->_gnapActionStatus = -1; + break; + case kAS17LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { + case kAS17TryGetWrench: + _vm->_platypusActionStatus = -1; + ++_platTryGetWrenchCtr; + if (_platTryGetWrenchCtr % 2 != 0) + _nextWrenchSequenceId = 0x233; + else + _nextWrenchSequenceId = 0x234; + _canTryGetWrench = false; + break; + case kAS17GetWrench1: + _nextWrenchSequenceId = 0x230; + break; + case kAS17GetWrench2: + _nextCarWindowSequenceId = 0x249; + break; + case kAS17GetWrenchDone: + _vm->_platypusActionStatus = -1; + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); + break; + case kAS17PlatUsePhone: + _vm->_gameSys->setAnimation(0x24E, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x24E; + _vm->_platypusActionStatus = kAS17LeaveScene; + _vm->_newSceneNum = 53; + break; + case kAS17PlatPhoningAssistant: + ++_platPhoneCtr; + if (_platPhoneCtr >= 7) { + _platPhoneCtr = 0; + _nextPhoneSequenceId = -1; + _currPhoneSequenceId = -1; + _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x25B; + _vm->_platypusActionStatus = -1; + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + _vm->_sceneWaiting = false; + updateHotspots(); + } else { + _nextPhoneSequenceId = kPlatPhoneSequenceIds[_platPhoneCtr]; + _vm->_gameSys->setAnimation(_nextPhoneSequenceId, 254, 1); + _vm->_gameSys->insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x25A; + _currPhoneSequenceId = _nextPhoneSequenceId; + } + break; + case kAS17LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + switch (_nextWrenchSequenceId) { + case 0x233: + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x243, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currWrenchSequenceId = _nextWrenchSequenceId; + _nextWrenchSequenceId = -1; + _vm->_platypusSequenceId = 0x243; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x243, _vm->_platypusId, 1); + break; + case 0x234: + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(0x242, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currWrenchSequenceId = _nextWrenchSequenceId; + _nextWrenchSequenceId = -1; + _vm->_platypusSequenceId = 0x242; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x242, _vm->_platypusId, 1); + break; + case 0x231: + if (_vm->getRandom(2) != 0) + _nextCarWindowSequenceId = 0x245; + else + _nextCarWindowSequenceId = 0x248; + _vm->_gameSys->setAnimation(0, 0, 2); + break; + case 0x232: + _nextCarWindowSequenceId = 0x247; + _vm->_gameSys->setAnimation(0, 0, 2); + break; + case 0x22E: + case 0x235: + if (_nextWrenchSequenceId == 0x235) + _vm->_hotspots[kHS17Wrench]._flags &= ~SF_DISABLED; + else + _vm->_hotspots[kHS17Wrench]._flags |= SF_DISABLED; + _canTryGetWrench = !_canTryGetWrench; + _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currWrenchSequenceId = _nextWrenchSequenceId; + _nextWrenchSequenceId = -1; + break; + case 0x230: + if (_vm->_gnapActionStatus == kAS17GetWrenchGnapReady) { + _vm->_gameSys->setAnimation(0, 0, 2); + if (_canTryGetWrench) { + _vm->_gameSys->insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currWrenchSequenceId = 0x22E; + _canTryGetWrench = false; + } + _vm->_gameSys->setAnimation(0x23F, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23F, _vm->_platypusId, + _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 1; + _vm->_platypusSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x875; + _vm->_platypusSequenceId = 0x23F; + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->_platypusActionStatus = kAS17GetWrench2; + } + break; + default: + if (_nextWrenchSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currWrenchSequenceId = _nextWrenchSequenceId; + _nextWrenchSequenceId = -1; + } + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextCarWindowSequenceId) { + case 0x246: + _vm->_gameSys->setAnimation(_nextCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currCarWindowSequenceId = _nextCarWindowSequenceId; + _nextCarWindowSequenceId = -1; + break; + case 0x245: + case 0x247: + case 0x248: + _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); + _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(2) != 2) + update(); + _vm->_gameSys->setAnimation(_nextCarWindowSequenceId, 40, 3); + _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currCarWindowSequenceId = _nextCarWindowSequenceId; + _nextCarWindowSequenceId = -1; + _currWrenchSequenceId = _nextWrenchSequenceId; + _nextWrenchSequenceId = -1; + break; + case 0x249: + _vm->_gameSys->setAnimation(0x230, 40, 2); + _vm->_gameSys->setAnimation(0x240, _vm->_platypusId, 1); + _vm->_gameSys->insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x23E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x23E; + _vm->_gnapSequenceDatNum = 0; + _vm->_platypusSequenceId = 0x240; + _vm->_platypusSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x24A, 40, 3); + _vm->_gameSys->insertSequence(0x24A, 40, _nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(2) != 2) { + update(); + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0x24A, 40, 3); + _vm->_gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + } + } + _vm->_gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x24B, 40, 3); + _vm->_gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + _currCarWindowSequenceId = 0x24B; + _nextCarWindowSequenceId = -1; + _currWrenchSequenceId = 0x22D; + _nextWrenchSequenceId = -1; + _vm->setFlag(kGFGrassTaken); + _vm->_gnapActionStatus = -1; + _vm->_platypusActionStatus = 2; + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(30) + 80; + break; + } + } + +} + +/*****************************************************************************/ + +static const int kScene18SequenceIds[] = { + 0x219, 0x21A, 0x21B, 0x21C, 0x21D +}; + +enum { + kHS18Platypus = 0, + kHS18GarbageCan = 1, + kHS18Device = 2, + kHS18ExitToyStore = 3, + kHS18ExitPhoneBooth = 4, + kHS18ExitGrubCity = 5, + kHS18HydrantTopValve = 6, + kHS18HydrantRightValve = 7, + kHS18CowboyHat = 8, + kHS18WalkArea1 = 9, + kHS18WalkArea2 = 10 +}; + +enum { + kAS18OpenRightValveNoGarbageCanDone = 0, + kAS18OpenRightValveNoGarbageCan = 1, + kAS18CloseRightValveNoGarbageCan = 2, + kAS18OpenTopValveDone = 3, + kAS18OpenTopValve = 4, + kAS18CloseTopValve = 5, + kAS18GrabGarbageCanFromStreet = 6, + kAS18GrabCowboyHat = 7, + kAS18GrabGarbageCanFromHydrant = 8, + kAS18PutGarbageCanOnRunningHydrant = 9, + kAS18PutGarbageCanOnRunningHydrant2 = 10, + kAS18GrabCowboyHatDone = 11, + kAS18StandingOnHydrant = 12, + kAS18OpenRightValveWithGarbageCan = 13, + kAS18OpenRightValveWithGarbageCanDone = 14, + kAS18CloseRightValveWithGarbageCan = 15, + kAS18PutGarbageCanOnHydrant = 16, + kAS18PutGarbageCanOnHydrantDone = 17, + kAS18PlatComesHere = 18, + kAS18CloseRightValveWithGarbageCanDone = 19, + kAS18LeaveScene = 20 +}; + +Scene18::Scene18(GnapEngine *vm) : Scene(vm) { + _cowboyHatSurface = nullptr; + + _platPhoneCtr = 0; + _platPhoneIter = 0; + _nextPhoneSequenceId = -1; + _currPhoneSequenceId = -1; +} + +Scene18::~Scene18() { + delete _cowboyHatSurface; +} + +int Scene18::init() { + _vm->_gameSys->setAnimation(0, 0, 3); + return 0x222; +} + +void Scene18::updateHotspots() { + _vm->setHotspot(kHS18Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS18GarbageCan, _vm->_gridMinX + 75 * _vm->_s18GarbageCanPos - 35, _vm->_gridMinY + 230, _vm->_gridMinX + 75 * _vm->_s18GarbageCanPos + 35, _vm->_gridMinY + 318, + SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, _vm->_s18GarbageCanPos, 7); + _vm->setHotspot(kHS18ExitToyStore, 460, 238, 592, 442, SF_EXIT_U_CURSOR, 7, 7); + _vm->setHotspot(kHS18ExitPhoneBooth, 275, 585, 525, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHS18ExitGrubCity, 0, 350, 15, 600, SF_EXIT_L_CURSOR, 0, 9); + _vm->setHotspot(kHS18HydrantTopValve, 100, 345, 182, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 8); + _vm->setHotspot(kHS18HydrantRightValve, 168, 423, 224, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS18CowboyHat, 184, 63, 289, 171, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS18WalkArea1, 0, 0, 800, 448); + _vm->setHotspot(kHS18WalkArea2, 0, 0, 214, 515); + _vm->setDeviceHotspot(kHS18Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFTruckFilledWithGas)) { + if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_hotspots[kHS18HydrantTopValve]._flags = SF_DISABLED; + _vm->_hotspots[kHS18HydrantRightValve]._x1 = 148; + _vm->_hotspots[kHS18HydrantRightValve]._y1 = 403; + _vm->_hotspots[kHS18GarbageCan]._flags = SF_DISABLED; + _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; + _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; + } else { + _vm->_hotspots[kHS18HydrantTopValve]._y1 = 246; + } + } else if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_hotspots[kHS18HydrantRightValve]._flags = SF_DISABLED; + _vm->_hotspots[kHS18HydrantTopValve]._x1 = 105; + _vm->_hotspots[kHS18HydrantTopValve]._x2 = 192; + } else if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_hotspots[kHS18GarbageCan]._x1 = 115; + _vm->_hotspots[kHS18GarbageCan]._y1 = 365; + _vm->_hotspots[kHS18GarbageCan]._x2 = 168; + _vm->_hotspots[kHS18GarbageCan]._y2 = 470; + _vm->_hotspots[kHS18GarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; + _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; + } + if (_vm->isFlag(kGFPlatyPussDisguised)) + _vm->_hotspots[kHS18GarbageCan]._flags = SF_DISABLED; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHS18Device]._flags = SF_DISABLED; + _vm->_hotspots[kHS18HydrantTopValve]._flags = SF_DISABLED; + _vm->_hotspots[kHS18HydrantRightValve]._flags = SF_DISABLED; + _vm->_hotspots[kHS18Platypus]._flags = SF_DISABLED; + } + if (_vm->isFlag(kGFUnk14)) { + _vm->_hotspots[kHS18HydrantTopValve]._flags = SF_DISABLED; + _vm->_hotspots[kHS18CowboyHat]._flags = SF_DISABLED; + } + _vm->_hotspotsCount = 11; +} + +void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { + // CHECKME: (x, y) is always set to (-1, -1) + + // TODO Cleanup + static const int kSequenceIds[] = { + 0x203, 0x204 + }; + + int gnapSeqId, gnapId, gnapDatNum, gnapGridX; + int clippedX, v12, v5, v10, v11, direction; + + if (x >= 0) + clippedX = x; + else + clippedX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; + if (clippedX >= _vm->_gnapX) + v10 = clippedX - 1; + else + v10 = clippedX + 1; + + if (a5 < 0) + a5 = 4; + v5 = v10; + if (v10 <= a5) + v5 = a5; + v11 = v5; + v12 = _vm->_gridMaxX - 1; + if (_vm->_gridMaxX - 1 >= v11) + v12 = v11; + + if (v12 == _vm->_gnapX) { + gnapSeqId = _vm->_gnapSequenceId; + gnapId = _vm->_gnapId; + gnapDatNum = _vm->_gnapSequenceDatNum; + gnapGridX = _vm->_gnapX; + if (_vm->_gnapX <= clippedX) + direction = 1; + else + direction = -1; + } else { + if (_vm->_gnapY == _vm->_platY) { + if (v12 >= _vm->_gnapX) { + if (v12 >= _vm->_platX && _vm->_gnapX <= _vm->_platX) + _vm->platypusMakeRoom(); + } else if (v12 <= _vm->_platX && _vm->_gnapX >= _vm->_platX) { + _vm->platypusMakeRoom(); + } + } + gnapSeqId = _vm->_gnapSequenceId; + gnapId = _vm->_gnapId; + gnapDatNum = _vm->_gnapSequenceDatNum; + gnapGridX = _vm->_gnapX; + int seqId = 0; + if (v12 < _vm->_gnapX) { + direction = -1; + seqId = 1; + } else + direction = 1; + int a2 = 20 * _vm->_gnapY + 1; + do { + if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnapY)) + break; + a2 += direction; + _vm->_gameSys->insertSequence(kSequenceIds[seqId], a2, + gnapSeqId | (gnapDatNum << 16), gnapId, + kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gnapSeqId = kSequenceIds[seqId]; + gnapId = a2; + gnapDatNum = 0; + gnapGridX += direction; + } while (v12 != gnapGridX); + } + + if (argC >= 0) { + _vm->_gnapSequenceId = ridToEntryIndex(argC); + _vm->_gnapSequenceDatNum = ridToDatIndex(argC); + } else { + if (direction == 1) + _vm->_gnapSequenceId = 0x20A; + else + _vm->_gnapSequenceId = 0x209; + _vm->_gnapSequenceDatNum = 0; + } + + if (direction == 1) + _vm->_gnapIdleFacing = kDirBottomRight; + else + _vm->_gnapIdleFacing = kDirBottomLeft; + + _vm->_gnapId = 20 * _vm->_gnapY + 1; + + if (animationIndex >= 0) + _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); + + _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gnapSeqId | (gnapDatNum << 16), gnapId, + kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + + _vm->_gnapX = gnapGridX; + +} + +void Scene18::putDownGarbageCan(int animationIndex) { + if (animationIndex >= 0) { + while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) + _vm->gameUpdateTick(); + } + if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) + _vm->_s18GarbageCanPos = _vm->_gnapX - 1; + else + _vm->_s18GarbageCanPos = _vm->_gnapX + 1; + _vm->clearFlag(kGFPlatyPussDisguised); + updateHotspots(); + if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) { + _vm->_gameSys->insertSequence(0x107BA, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7BA; + } else { + _vm->_gameSys->insertSequence(0x107B9, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B9; + } + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + _vm->_gameSys->setAnimation(0x1FA, 19, 4); + _vm->_gameSys->insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) + _vm->gameUpdateTick(); +} + +void Scene18::platEndPhoning(bool platFl) { + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _platPhoneIter = 0; + _platPhoneCtr = 0; + _vm->_platypusActionStatus = -1; + if (_currPhoneSequenceId != -1) { + _vm->_gameSys->setAnimation(0x21E, 254, 3); + _vm->_gameSys->insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(3) != 2) + _vm->gameUpdateTick(); + } + _vm->_gameSys->removeSequence(0x21F, 254, true); + _vm->_gameSys->setAnimation(0, 0, 3); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + if (platFl) { + _vm->_platypusActionStatus = kAS18PlatComesHere; + _vm->_timers[6] = 50; + _vm->_sceneWaiting = true; + } + _currPhoneSequenceId = -1; + _nextPhoneSequenceId = -1; + updateHotspots(); + } +} + +void Scene18::closeHydrantValve() { + _vm->_gnapActionStatus = kAS18LeaveScene; + _vm->updateMouseCursor(); + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); + if (_vm->isFlag(kGFTruckKeysUsed)) { + _vm->_gnapActionStatus = kAS18CloseRightValveWithGarbageCan; + waitForGnapAction(); + } else { + _vm->_gnapActionStatus = kAS18CloseRightValveNoGarbageCan; + waitForGnapAction(); + } + } else if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BA, 1); + _vm->_gnapActionStatus = kAS18CloseTopValve; + waitForGnapAction(); + } +} + +void Scene18::waitForGnapAction() { + while (_vm->_gnapActionStatus >= 0) { + updateAnimations(); + _vm->gameUpdateTick(); + } +} + +void Scene18::run() { + _cowboyHatSurface = nullptr; + + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(4); + + _vm->_timers[5] = _vm->getRandom(100) + 100; + + _vm->queueInsertDeviceIcon(); + + _vm->clearFlag(kGFPlatyPussDisguised); + + if (!_vm->isFlag(kGFUnk14)) + _vm->_gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFTruckKeysUsed)) { + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->_gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->playSound(0x22B, true); + } else { + _vm->_gameSys->insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); + } + } else { + _vm->_gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->_gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->playSound(0x22B, true); + } else if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->playSound(0x22B, true); + } + } + + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + if (_vm->_prevSceneNum == 17) + _vm->initGnapPos(4, 11, kDirBottomRight); + else + _vm->initGnapPos(4, 7, kDirBottomRight); + _platPhoneCtr = _vm->getRandom(5); + if (_vm->isFlag(kGFUnk27)) { + _vm->_gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _currPhoneSequenceId = -1; + platEndPhoning(true); + _vm->clearFlag(kGFUnk27); + } else { + _currPhoneSequenceId = kScene18SequenceIds[_platPhoneCtr]; + _platPhoneIter = 0; + _vm->_gameSys->insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + } + if (_vm->isFlag(kGFUnk27)) { + platEndPhoning(true); + _vm->clearFlag(kGFUnk27); + } else { + _vm->_gameSys->setAnimation(_currPhoneSequenceId, 254, 3); + } + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + } else { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->clearFlag(kGFGnapControlsToyUFO); + _vm->setGrabCursorSprite(kItemCowboyHat); + _vm->_prevSceneNum = 19; + } + if (_vm->_prevSceneNum == 17) { + _vm->initGnapPos(4, 11, kDirBottomRight); + _vm->initPlatypusPos(5, 11, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + } else if (_vm->_prevSceneNum == 19) { + _vm->initGnapPos(7, 7, kDirBottomRight); + _vm->initPlatypusPos(8, 7, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(-1, 10, kDirBottomRight); + _vm->initPlatypusPos(-1, 10, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); + } + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 20, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS18Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS18Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS18CowboyHat: + if (_vm->_gnapActionStatus == kAS18StandingOnHydrant) { + _vm->_gnapActionStatus = kAS18GrabCowboyHat; + _vm->_sceneWaiting = false; + } else if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(3, 2); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 0, _vm->getGnapSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS18GarbageCan: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk14)) { + if (_vm->_grabCursorSpriteIndex >= 0) + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); + else + _vm->playGnapImpossible(0, 0); + } else { + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + platEndPhoning(true); + if (_vm->_grabCursorSpriteIndex >= 0) { + if (!_vm->isFlag(kGFTruckKeysUsed)) + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnapX < _vm->_s18GarbageCanPos ? 1 : -1), + _vm->_hotspotsWalkPos[kHS18GarbageCan].y, _vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + else + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (!_vm->isFlag(kGFTruckKeysUsed)) + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnapX < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + else if (!_vm->isFlag(kGFTruckFilledWithGas)) + _vm->playGnapScratchingHead(2, 4); + break; + case GRAB_CURSOR: + if (!_vm->isFlag(kGFTruckKeysUsed)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnapX < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, + -1, -1, 1); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnapY) | 0x10000, 1); + _vm->_gnapActionStatus = kAS18GrabGarbageCanFromStreet; + } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 0, -1, 1)) + _vm->_gnapActionStatus = kAS18GrabGarbageCanFromHydrant; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + } + break; + + case kHS18HydrantTopValve: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + // While carrying garbage can + if (_vm->_grabCursorSpriteIndex >= 0) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapScratchingHead(0, 0); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFTruckFilledWithGas)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + _vm->_gnapActionStatus = kAS18PutGarbageCanOnRunningHydrant; + } else if (!_vm->isFlag(kGFBarnPadlockOpen)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + _vm->_gnapActionStatus = kAS18PutGarbageCanOnHydrant; + } else { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapImpossible(0, 0); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + _vm->playGnapImpossible(0, 0); + break; + } + } + } else { + if (_vm->_grabCursorSpriteIndex == kItemWrench) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->_gnapActionStatus = kAS18OpenTopValve; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 5); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFBarnPadlockOpen)) { + _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BA, 1); + _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS18CloseTopValve; + } else + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + } + break; + + case kHS18HydrantRightValve: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk14)) { + if (_vm->_grabCursorSpriteIndex == -1) { + _vm->playGnapImpossible(0, 0); + } else { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + } + } else { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } + if (_vm->_grabCursorSpriteIndex == kItemWrench) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + if (_vm->isFlag(kGFTruckKeysUsed)) + _vm->_gnapActionStatus = kAS18OpenRightValveWithGarbageCan; + else + _vm->_gnapActionStatus = kAS18OpenRightValveNoGarbageCan; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 5); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFTruckFilledWithGas)) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); + if (_vm->isFlag(kGFTruckKeysUsed)) + _vm->_gnapActionStatus = kAS18CloseRightValveWithGarbageCan; + else + _vm->_gnapActionStatus = kAS18CloseRightValveNoGarbageCan; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + } + break; + + case kHS18ExitToyStore: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } + if (_vm->isFlag(kGFPictureTaken)) { + _vm->playGnapImpossible(0, 0); + } else { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 19; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore].x, _vm->_hotspotsWalkPos[kHS18ExitToyStore].y, 0, 0x107C0, 1); + _vm->_gnapActionStatus = kAS18LeaveScene; + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore].x + 1, _vm->_hotspotsWalkPos[kHS18ExitToyStore].y, -1, 0x107C2, 1); + } + } + break; + + case kHS18ExitPhoneBooth: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } + closeHydrantValve(); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 17; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].x, _vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS18LeaveScene; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _vm->setFlag(kGFUnk27); + else + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].x + 1, _vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].y, -1, 0x107C2, 1); + } + break; + + case kHS18ExitGrubCity: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } + closeHydrantValve(); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity].x, _vm->_hotspotsWalkPos[kHS18ExitGrubCity].y, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kAS18LeaveScene; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + platEndPhoning(false); + else + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity].x, _vm->_hotspotsWalkPos[kHS18ExitGrubCity].y - 1, -1, 0x107CF, 1); + _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; + } + break; + + case kHS18WalkArea1: + case kHS18WalkArea2: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + _vm->_mouseClickState._left = false; + } + break; + + default: + if (_vm->_gnapActionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { + if (_vm->isFlag(kGFPlatyPussDisguised)) { + gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + putDownGarbageCan(0); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if ((_vm->isFlag(kGFTruckFilledWithGas) || _vm->isFlag(kGFBarnPadlockOpen)) && !_vm->isSoundPlaying(0x22B) && + _vm->_gnapActionStatus != kAS18OpenRightValveNoGarbageCanDone && _vm->_gnapActionStatus != kAS18OpenRightValveNoGarbageCan && + _vm->_gnapActionStatus != kAS18OpenTopValve && _vm->_gnapActionStatus != kAS18OpenTopValveDone && + _vm->_gnapActionStatus != kAS18OpenRightValveWithGarbageCan && _vm->_gnapActionStatus != kAS18OpenRightValveWithGarbageCanDone) + _vm->playSound(0x22B, true); + + if (!_vm->_isLeavingScene) { + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + if (_vm->_platypusActionStatus == kAS18PlatComesHere) { + if (!_vm->_timers[6]) { + _vm->_platypusActionStatus = -1; + _vm->_sceneWaiting = false; + _vm->initPlatypusPos(-1, 10, kDirNone); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->clearFlag(kGFPlatypusTalkingToAssistant); + } + } else { + _vm->_hotspots[kHS18WalkArea1]._y2 += 48; + _vm->_hotspots[kHS18WalkArea2]._x1 += 75; + _vm->updatePlatypusIdleSequence(); + _vm->_hotspots[kHS18WalkArea2]._x1 -= 75; + _vm->_hotspots[kHS18WalkArea1]._y2 -= 48; + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(2) == 1) + _vm->_gameSys->insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); + } + } + _vm->playSoundA(); + } + if (!_vm->isFlag(kGFPlatyPussDisguised)) + _vm->updateGnapIdleSequence(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } + + if (_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->deleteSurface(&_cowboyHatSurface); +} + +void Scene18::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS18GrabGarbageCanFromStreet: + if (_vm->_gnapIdleFacing != kDirUpRight && _vm->_gnapIdleFacing != kDirBottomRight) { + _vm->_gameSys->insertSequence(0x1FC, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - 675, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FC; + } else { + _vm->_gameSys->insertSequence(0x1FD, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - 525, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FD; + } + _vm->_gameSys->removeSequence(0x1FA, 19, true); + _vm->setFlag(kGFPlatyPussDisguised); + updateHotspots(); + _vm->_gnapActionStatus = -1; + break; + case kAS18GrabGarbageCanFromHydrant: + _vm->_gameSys->insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x1F9, 19, true); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FE; + _vm->clearFlag(kGFTruckKeysUsed); + _vm->setFlag(kGFPlatyPussDisguised); + updateHotspots(); + _vm->_gnapActionStatus = -1; + break; + case kAS18CloseRightValveNoGarbageCan: + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x20D, 39, true); + _vm->_gameSys->removeSequence(0x212, 39, true); + _vm->_gameSys->removeSequence(0x211, 39, true); + _vm->stopSound(0x22B); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x205; + _vm->clearFlag(kGFTruckFilledWithGas); + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); + updateHotspots(); + _vm->_gnapActionStatus = -1; + break; + case kAS18OpenTopValve: + _vm->setFlag(kGFBarnPadlockOpen); + updateHotspots(); + _vm->playGnapPullOutDevice(2, 7); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BB, 1); + _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS18OpenTopValveDone; + break; + case kAS18OpenTopValveDone: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); + _vm->_gameSys->removeSequence(0x20C, 19, true); + _vm->_gameSys->setAnimation(0x217, 39, 5); + _vm->_gameSys->insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(5) != 2) + _vm->gameUpdateTick(); + _vm->playSound(0x22B, true); + _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x208; + _vm->invRemove(kItemWrench); + _vm->setGrabCursorSprite(-1); + _vm->_gnapActionStatus = -1; + break; + case kAS18CloseTopValve: + _vm->_gameSys->insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x20E, 39, true); + _vm->_gameSys->removeSequence(0x216, 39, true); + _vm->_gameSys->removeSequence(0x217, 39, true); + _vm->stopSound(0x22B); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x206; + _vm->clearFlag(kGFBarnPadlockOpen); + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); + updateHotspots(); + _vm->_gnapActionStatus = -1; + break; + case kAS18GrabCowboyHat: + _vm->_gameSys->setAnimation(0x200, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x200; + _vm->_gnapActionStatus = kAS18GrabCowboyHatDone; + break; + case kAS18GrabCowboyHatDone: + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _cowboyHatSurface = _vm->addFullScreenSprite(0x1D2, 255); + _vm->_gameSys->setAnimation(0x218, 256, 0); + _vm->_gameSys->insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->_newSceneNum = 18; + _vm->invAdd(kItemCowboyHat); + _vm->invAdd(kItemWrench); + _vm->setFlag(kGFGnapControlsToyUFO); + _vm->setFlag(kGFUnk14); + _vm->clearFlag(kGFTruckFilledWithGas); + _vm->setFlag(kGFTruckKeysUsed); + _vm->setFlag(kGFUnk14); // CHECKME - Set 2 times? + updateHotspots(); + _vm->_gnapActionStatus = kAS18LeaveScene; + break; + case kAS18LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + case kAS18PutGarbageCanOnRunningHydrant: + _vm->setFlag(kGFTruckKeysUsed); + _vm->clearFlag(kGFPlatyPussDisguised); + _vm->_gameSys->requestRemoveSequence(0x211, 39); + _vm->_gameSys->requestRemoveSequence(0x212, 39); + _vm->_gameSys->insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x22B); + _vm->_gameSys->setAnimation(0x210, _vm->_gnapId, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x210; + _vm->_gnapActionStatus = kAS18PutGarbageCanOnRunningHydrant2; + break; + case kAS18PutGarbageCanOnRunningHydrant2: + _vm->playSound(0x22B, true); + _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x1FF; + _vm->_sceneWaiting = true; + _vm->_gnapActionStatus = kAS18StandingOnHydrant; + break; + case kAS18StandingOnHydrant: + _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + break; + case kAS18OpenRightValveNoGarbageCan: + case kAS18OpenRightValveWithGarbageCan: + _vm->setFlag(kGFTruckFilledWithGas); + updateHotspots(); + _vm->playGnapPullOutDevice(2, 7); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); + _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; + if (_vm->_gnapActionStatus == kAS18OpenRightValveNoGarbageCan) + _vm->_gnapActionStatus = kAS18OpenRightValveNoGarbageCanDone; + else + _vm->_gnapActionStatus = kAS18OpenRightValveWithGarbageCanDone; + break; + case kAS18OpenRightValveWithGarbageCanDone: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); + _vm->_gameSys->requestRemoveSequence(0x1F9, 19); + _vm->_gameSys->removeSequence(0x20B, 19, true); + _vm->_gameSys->setAnimation(0x213, 39, 5); + _vm->_gameSys->insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(5) != 2) + _vm->gameUpdateTick(); + _vm->playSound(555, true); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x207; + _vm->invRemove(kItemWrench); + _vm->_gnapActionStatus = -1; + break; + case kAS18OpenRightValveNoGarbageCanDone: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); + _vm->_gameSys->removeSequence(0x20B, 19, true); + _vm->_gameSys->setAnimation(0x211, 39, 5); + _vm->_gameSys->insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(5) != 2) + _vm->gameUpdateTick(); + _vm->playSound(0x22B, true); + _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x207; + _vm->invRemove(kItemWrench); + _vm->_gnapActionStatus = -1; + break; + case kAS18CloseRightValveWithGarbageCan: + _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(0x20D, 39, true); + _vm->_gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x22B); + _vm->_gameSys->setAnimation(0x1F9, 19, 0); + _vm->_gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); + _vm->clearFlag(kGFTruckFilledWithGas); + _vm->invAdd(kItemWrench); + _vm->setGrabCursorSprite(kItemWrench); + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + updateHotspots(); + _vm->_gnapSequenceDatNum = 1; + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapActionStatus = kAS18CloseRightValveWithGarbageCanDone; + break; + case kAS18CloseRightValveWithGarbageCanDone: + _vm->_gnapActionStatus = -1; + break; + case kAS18PutGarbageCanOnHydrant: + _vm->setFlag(kGFTruckKeysUsed); + _vm->clearFlag(kGFPlatyPussDisguised); + _vm->_gameSys->insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x20F, _vm->_gnapId, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x20F; + _vm->_gnapActionStatus = kAS18PutGarbageCanOnHydrantDone; + break; + case kAS18PutGarbageCanOnHydrantDone: + _vm->_gameSys->insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); + updateHotspots(); + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + _vm->_gameSys->setAnimation(0, 0, 3); + ++_platPhoneIter; + if (_platPhoneIter <= 4) { + ++_platPhoneCtr; + _nextPhoneSequenceId = kScene18SequenceIds[_platPhoneCtr % 5]; + _vm->_gameSys->setAnimation(_nextPhoneSequenceId, 254, 3); + _vm->_gameSys->insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); + _currPhoneSequenceId = _nextPhoneSequenceId; + } else { + platEndPhoning(true); + } + } +} + +/*****************************************************************************/ + +static const int kS19ShopAssistantSequenceIds[] = { + 0x6F, 0x70, 0x71, 0x72, 0x73 +}; + +enum { + kHS19Platypus = 0, + kHS19ExitOutsideToyStore = 1, + kHS19Device = 2, + kHS19Picture = 3, + kHS19ShopAssistant = 4, + kHS19Toy1 = 5, + kHS19Toy2 = 6, + kHS19Toy3 = 7, + kHS19Phone = 8, + kHS19Toy4 = 9, + kHS19Toy5 = 10, + kHS19Toy6 = 11, + kHS19Toy7 = 12, + kHS19WalkArea1 = 13, + kHS19WalkArea2 = 14, + kHS19WalkArea3 = 15 +}; + +enum { + kAS19UsePhone = 0, + kAS19GrabToy = 1, + kAS19GrabPicture = 2, + kAS19GrabPictureDone = 3, + kAS19TalkShopAssistant = 4, + kAS19LeaveScene = 5 +}; + +Scene19::Scene19(GnapEngine *vm) : Scene(vm) { + _toyGrabCtr = 0; + _pictureSurface = 0; + _shopAssistantCtr = 0; + _pictureSurface = nullptr; +} + +Scene19::~Scene19() { + delete _pictureSurface; +} + +int Scene19::init() { + _vm->playSound(0x79, false); + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; +} + +void Scene19::updateHotspots() { + _vm->setHotspot(kHS19Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS19ExitOutsideToyStore, 36, 154, 142, 338, SF_EXIT_NW_CURSOR, 4, 6); + _vm->setHotspot(kHS19Picture, 471, 237, 525, 283, SF_DISABLED, 7, 2); + _vm->setHotspot(kHS19ShopAssistant, 411, 151, 575, 279, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHS19Phone, 647, 166, 693, 234, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + _vm->setHotspot(kHS19Toy1, 181, 11, 319, 149, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 0); + _vm->setHotspot(kHS19Toy2, 284, 85, 611, 216, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 0); + _vm->setHotspot(kHS19Toy3, 666, 38, 755, 154, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); + _vm->setHotspot(kHS19Toy4, 154, 206, 285, 327, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 3); + _vm->setHotspot(kHS19Toy5, 494, 301, 570, 448, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 5); + _vm->setHotspot(kHS19Toy6, 0, 320, 188, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); + _vm->setHotspot(kHS19Toy7, 597, 434, 800, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 8); + _vm->setHotspot(kHS19WalkArea1, 0, 0, 170, 600); + _vm->setHotspot(kHS19WalkArea2, 622, 0, 800, 600); + _vm->setHotspot(kHS19WalkArea3, 0, 0, 800, 437); + _vm->setDeviceHotspot(kHS19Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->_hotspots[kHS19Toy1]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Toy2]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Toy3]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Toy4]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Toy5]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Toy6]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Toy7]._flags = SF_DISABLED; + _vm->_hotspots[kHS19ShopAssistant]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Phone]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Platypus]._flags = SF_DISABLED; + _vm->_hotspots[kHS19Picture]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + } + _vm->_hotspotsCount = 16; +} + +void Scene19::run() { + _vm->queueInsertDeviceIcon(); + + _toyGrabCtr = 0; + _pictureSurface = 0; + + _vm->_gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFPictureTaken)) + _vm->_gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->initGnapPos(3, 6, kDirBottomRight); + _currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; + _nextShopAssistantSequenceId = _currShopAssistantSequenceId; + _vm->_gameSys->setAnimation(_currShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _shopAssistantCtr = 0; + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + updateHotspots(); + } else { + _currShopAssistantSequenceId = 0x6D; + _nextShopAssistantSequenceId = -1; + _vm->_gameSys->setAnimation(0x6D, 20, 4); + _vm->_gameSys->insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[6] = _vm->getRandom(40) + 50; + _vm->initGnapPos(3, 6, kDirBottomRight); + _vm->initPlatypusPos(4, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 5, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS19Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS19Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS19ExitOutsideToyStore: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_hotspots[kHS19WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kAS19LeaveScene; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) + _vm->setFlag(kGFUnk27); + else + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x + 1, _vm->_hotspotsWalkPos[1].y, -1, 0x107C5, 1); + _vm->_hotspots[kHS19WalkArea1]._flags &= ~SF_WALKABLE; + } + break; + + case kHS19Picture: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 2); + break; + case GRAB_CURSOR: + if (!_vm->isFlag(kGFPictureTaken)) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS19GrabPicture; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS19ShopAssistant: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 2); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS19TalkShopAssistant; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS19Toy1: + case kHS19Toy2: + case kHS19Toy3: + case kHS19Toy4: + case kHS19Toy5: + case kHS19Toy6: + case kHS19Toy7: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + _vm->_gnapActionStatus = kAS19GrabToy; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS19Phone: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(9, 1); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->playGnapIdle(8, 2); + _vm->_gnapActionStatus = kAS19UsePhone; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS19WalkArea1: + case kHS19WalkArea2: + case kHS19WalkArea3: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; + } + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updateGnapIdleSequence(); + if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { + _vm->updatePlatypusIdleSequence(); + if (!_vm->_timers[6] && _nextShopAssistantSequenceId == -1) { + _vm->_timers[6] = _vm->getRandom(40) + 50; + if (_vm->getRandom(4) != 0) { + _nextShopAssistantSequenceId = 0x64; + } else if (_vm->isFlag(kGFPictureTaken)) { + _nextShopAssistantSequenceId = 0x64; + } else { + _nextShopAssistantSequenceId = 0x6C; + } + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } + + if (_pictureSurface) + _vm->deleteSurface(&_pictureSurface); +} + +void Scene19::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS19UsePhone: + _nextShopAssistantSequenceId = 0x67; + break; + case kAS19GrabToy: + ++_toyGrabCtr; + switch (_toyGrabCtr) { + case 1: + _nextShopAssistantSequenceId = 0x62; + break; + case 2: + _nextShopAssistantSequenceId = 0x6B; + break; + case 3: + _nextShopAssistantSequenceId = 0x66; + break; + default: + _nextShopAssistantSequenceId = 0x65; + break; + } + break; + case kAS19GrabPicture: + _vm->playGnapPullOutDevice(6, 2); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x68, 19, 0); + _vm->_gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); + _vm->invAdd(kItemPicture); + _vm->setFlag(kGFPictureTaken); + updateHotspots(); + _vm->_gnapActionStatus = kAS19GrabPictureDone; + break; + case kAS19GrabPictureDone: + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + _pictureSurface = _vm->addFullScreenSprite(0xF, 255); + _vm->_gameSys->setAnimation(0x61, 256, 0); + _vm->_gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _vm->setFlag(kGFUnk27); + _vm->showCursor(); + _vm->_newSceneNum = 17; + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _nextShopAssistantSequenceId = -1; + break; + case kAS19TalkShopAssistant: + _nextShopAssistantSequenceId = 0x6D; + _vm->_gnapActionStatus = -1; + break; + case kAS19LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2) { + switch (_nextShopAssistantSequenceId) { + case 0x6F: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + _shopAssistantCtr = (_shopAssistantCtr + 1) % 5; + _nextShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_shopAssistantCtr]; + _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); + _currShopAssistantSequenceId = _nextShopAssistantSequenceId; + break; + case 0x62: + case 0x66: + case 0x6B: + _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currShopAssistantSequenceId = _nextShopAssistantSequenceId; + _nextShopAssistantSequenceId = -1; + _vm->_timers[5] = 10; + while (_vm->_timers[5]) { + _vm->gameUpdateTick(); + } + _vm->playGnapIdle(6, 2); + _vm->_gnapActionStatus = -1; + break; + case 0x67: + _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currShopAssistantSequenceId = _nextShopAssistantSequenceId; + _nextShopAssistantSequenceId = -1; + _vm->_gnapActionStatus = -1; + break; + case 0x65: + _vm->playGnapIdle(6, 2); + _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 0); + _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currShopAssistantSequenceId = _nextShopAssistantSequenceId; + _nextShopAssistantSequenceId = -1; + _vm->_newSceneNum = 18; + _vm->_gnapActionStatus = kAS19LeaveScene; + break; + case 0x6D: + _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextShopAssistantSequenceId), 0, 0); + _currShopAssistantSequenceId = _nextShopAssistantSequenceId; + _nextShopAssistantSequenceId = -1; + break; + case 0x64: + case 0x6C: + _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); + _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currShopAssistantSequenceId = _nextShopAssistantSequenceId; + _nextShopAssistantSequenceId = -1; + break; + } + } +} + + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group1.h b/engines/gnap/scenes/group1.h new file mode 100644 index 0000000000..451a652ffd --- /dev/null +++ b/engines/gnap/scenes/group1.h @@ -0,0 +1,214 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GROUP1_H +#define GNAP_GROUP1_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene10: public Scene { +public: + Scene10(GnapEngine *vm); + ~Scene10() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _nextCookSequenceId; + int _currCookSequenceId; +}; + +class Scene11: public Scene { +public: + Scene11(GnapEngine *vm); + ~Scene11() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _billardBallCtr; + int _nextHookGuySequenceId; + int _currHookGuySequenceId; + int _nextGoggleGuySequenceId; + int _currGoggleGuySequenceId; +}; + +class Scene12: public Scene { +public: + Scene12(GnapEngine *vm); + ~Scene12() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _nextBeardGuySequenceId; + int _currBeardGuySequenceId; + int _nextToothGuySequenceId; + int _currToothGuySequenceId; + int _nextBarkeeperSequenceId; + int _currBarkeeperSequenceId; +}; + +class Scene13: public Scene { +public: + Scene13(GnapEngine *vm); + ~Scene13() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _backToiletCtr; + + void showScribble(); +}; + +class Scene14: public Scene { +public: + Scene14(GnapEngine *vm); + ~Scene14() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +class Scene15: public Scene { +public: + Scene15(GnapEngine *vm); + ~Scene15() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _nextRecordSequenceId; + int _currRecordSequenceId; + int _nextSlotSequenceId; + int _currSlotSequenceId; + int _nextUpperButtonSequenceId; + int _currUpperButtonSequenceId; + int _nextLowerButtonSequenceId; + int _currLowerButtonSequenceId; +}; + +class Scene17: public Scene { +public: + Scene17(GnapEngine *vm); + ~Scene17() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _canTryGetWrench; + int _wrenchCtr; + int _platPhoneCtr; + int _platTryGetWrenchCtr; + int _nextPhoneSequenceId; + int _currPhoneSequenceId; + int _nextWrenchSequenceId; + int _currWrenchSequenceId; + int _nextCarWindowSequenceId; + int _currCarWindowSequenceId; + + void update(); + void platHangUpPhone(); +}; + +class Scene18: public Scene { +public: + Scene18(GnapEngine *vm); + ~Scene18(); + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + Graphics::Surface *_cowboyHatSurface; + + int _platPhoneCtr; + int _platPhoneIter; + int _nextPhoneSequenceId; + int _currPhoneSequenceId; + + void gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5); + void putDownGarbageCan(int animationIndex); + void platEndPhoning(bool platFl); + void closeHydrantValve(); + void waitForGnapAction(); +}; + +class Scene19: public Scene { +public: + Scene19(GnapEngine *vm); + ~Scene19(); + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currShopAssistantSequenceId; + int _nextShopAssistantSequenceId; + int _toyGrabCtr; + int _shopAssistantCtr; + + Graphics::Surface *_pictureSurface; +}; + +} // End of namespace Gnap + +#endif // GNAP_GROUP1_H diff --git a/engines/gnap/scenes/scene10.cpp b/engines/gnap/scenes/scene10.cpp deleted file mode 100644 index 9f987ba7bc..0000000000 --- a/engines/gnap/scenes/scene10.cpp +++ /dev/null @@ -1,500 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene10.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitBar = 1, - kHSExitBackdoor = 2, - kHSCook = 3, - kHSTongs = 4, - kHSBox = 5, - kHSOven = 6, - kHSWalkArea1 = 7, - kHSDevice = 8, - kHSWalkArea2 = 9, - kHSWalkArea3 = 10, - kHSWalkArea4 = 11 -}; - -enum { - kASLeaveScene = 0, - kASAnnoyCook = 1, - kASPlatWithBox = 4 -}; - -Scene10::Scene10(GnapEngine *vm) : Scene(vm) { - _s10_nextCookSequenceId = -1; - _s10_currCookSequenceId = -1; -} - -int Scene10::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - return 0x10F; -} - -void Scene10::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitBar, 0, 75, 85, 455, SF_EXIT_NW_CURSOR); - _vm->setHotspot(kHSExitBackdoor, 75, 590, 500, 599, SF_EXIT_D_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHSCook, 370, 205, 495, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSTongs, 250, 290, 350, 337, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSBox, 510, 275, 565, 330, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSOven, 690, 280, 799, 420, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 59, 0, 495, 460); - _vm->setHotspot(kHSWalkArea2, 495, 0, 650, 420); - _vm->setHotspot(kHSWalkArea3, 651, 0, 725, 400); - _vm->setHotspot(kHSWalkArea4, 725, 0, 799, 441); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 12; -} - -void Scene10::run() { - _s10_currCookSequenceId = 0x103; - - _vm->_gameSys->setAnimation(0x103, 100, 2); - _vm->_gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); - - _s10_nextCookSequenceId = 0x106; - if (!_vm->isFlag(kGFMudTaken)) - _vm->_gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 9) { - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 7, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); - } else { - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 8, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(1, 7, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - } - - _vm->_timers[4] = _vm->getRandom(80) + 150; - _vm->_timers[5] = _vm->getRandom(100) + 100; - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1091E)) - _vm->playSound(0x1091E, true); - - if (!_vm->isSoundPlaying(0x1091A)) - _vm->playSound(0x1091A, true); - - _vm->updateMouseCursor(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSPlatypus: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(10); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - break; - } - } - break; - - case kHSExitBar: - _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(0, 7, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(0, 7, -1, 0x107CF, 1); - _vm->_newSceneNum = 11; - break; - - case kHSExitBackdoor: - _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(2, 9, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(3, 9, -1, 0x107C7, 1); - _vm->_newSceneNum = 9; - break; - - case kHSCook: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 8, 6, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASAnnoyCook; - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 0); - break; - case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); - _vm->_gnapIdleFacing = kDirBottomRight; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(4, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASAnnoyCook; - break; - case PLAT_CURSOR: - _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(4, 6, -1, -1, 1); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASAnnoyCook; - break; - } - } - break; - - case kHSTongs: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 7, 4, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); - else - _vm->playGnapScratchingHead(4, 3); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); - else { - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASAnnoyCook; - } - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); - else { - _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(3, 7, -1, -1, 1); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASAnnoyCook; - } - break; - } - } - break; - - case kHSBox: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 6, 6, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 3); - break; - case GRAB_CURSOR: - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASAnnoyCook; - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); - else { - _vm->invAdd(kItemTongs); - _vm->setFlag(kGFMudTaken); - _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); - _vm->_platypusActionStatus = kASPlatWithBox; - _vm->_platypusFacing = kDirUnk4; - _vm->_largeSprite = _vm->_gameSys->createSurface(0xC3); - _vm->playGnapIdle(7, 6); - } - break; - } - } - break; - - case kHSOven: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(9, 6, 10, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 10, 5) | 0x10000); - break; - case GRAB_CURSOR: - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(9, 6, 0, 0x107BB, 1); - _vm->_gameSys->insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x10E; - _vm->_gnapId = 120; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 9; - _vm->_gnapY = 6; - _vm->_timers[2] = 360; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(80) + 150; - _vm->playSound(0x12B, false); - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 100; - int _gnapRandomValue = _vm->getRandom(4); - if (_gnapRandomValue) { - int sequenceId; - if (_gnapRandomValue == 1) { - sequenceId = 0x8A5; - } else if (_gnapRandomValue == 2) { - sequenceId = 0x8A6; - } else { - sequenceId = 0x8A7; - } - _vm->_gameSys->insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene10::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASAnnoyCook: - _s10_nextCookSequenceId = 0x105; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { - case kASPlatWithBox: - _s10_nextCookSequenceId = 0x109; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s10_nextCookSequenceId != -1) { - - switch (_s10_nextCookSequenceId) { - case 0x109: - _vm->_platX = 4; - _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x109, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107C9, 160, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, - kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), - 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->removeSequence(0x107, 100, true); - _s10_currCookSequenceId = 0x109; - _s10_nextCookSequenceId = 0x843; - _vm->_platypusSequenceId = 0x7C9; - _vm->_platypusId = 160; - _vm->_platypusFacing = kDirNone; - _vm->_platypusSequenceDatNum = 1; - break; - case 0x843: - _vm->hideCursor(); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->insertSequence(0x10843, 301, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _s10_currCookSequenceId = 0x843; - _s10_nextCookSequenceId = 0x10A; - break; - case 0x10A: - _vm->_gameSys->insertSequence(_s10_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); - _s10_currCookSequenceId = _s10_nextCookSequenceId; - _s10_nextCookSequenceId = 0x104; - _vm->showCursor(); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); - _vm->delayTicksCursor(5); - _vm->deleteSurface(&_vm->_largeSprite); - _vm->setGrabCursorSprite(kItemTongs); - if (_vm->_platypusActionStatus == kASPlatWithBox) - _vm->_platypusActionStatus = -1; - if (_vm->_gnapX == 4 && _vm->_gnapY == 8) - _vm->gnapWalkStep(); - break; - default: - _vm->_gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _s10_currCookSequenceId = _s10_nextCookSequenceId; - break; - } - - switch (_s10_currCookSequenceId) { - case 0x106: { - // TODO: Refactor into a if + a switch - int rnd = _vm->getRandom(7); - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) - _s10_nextCookSequenceId = 0x106; - else if (rnd == 0) - _s10_nextCookSequenceId = 0x104; - else if (rnd == 1) - _s10_nextCookSequenceId = 0x103; - else if (rnd == 2) { - _s10_nextCookSequenceId = 0x106; - _vm->_gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); - } else - _s10_nextCookSequenceId = 0x106; - } - break; - case 0x103: - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) - _s10_nextCookSequenceId = 0x106; - else if (_vm->getRandom(7) == 0) - _s10_nextCookSequenceId = 0x104; - else - _s10_nextCookSequenceId = 0x106; - break; - case 0x104: - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) - _s10_nextCookSequenceId = 0x106; - else if (_vm->getRandom(7) == 0) - _s10_nextCookSequenceId = 0x103; - else - _s10_nextCookSequenceId = 0x106; - break; - case 0x105: { - // TODO: Refactor into a if + a switch - int rnd = _vm->getRandom(7); - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) - _s10_nextCookSequenceId = 0x106; - else if (rnd == 0) - _s10_nextCookSequenceId = 0x104; - else if (rnd == 1) - _s10_nextCookSequenceId = 0x103; - else - _s10_nextCookSequenceId = 0x106; - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = 300; - _vm->_gameSys->insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x10C; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - _vm->_platypusActionStatus = -1; - } - break; - } - if (_s10_currCookSequenceId == 0x843) - _vm->_gameSys->setAnimation(_s10_currCookSequenceId | 0x10000, 301, 2); - else - _vm->_gameSys->setAnimation(_s10_currCookSequenceId, 100, 2); - } -} - -void Scene10::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(_s10_nextCookSequenceId, 100, 2); - _vm->_gameSys->insertSequence(_s10_nextCookSequenceId, 100, _s10_currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _s10_currCookSequenceId = _s10_nextCookSequenceId; - _s10_nextCookSequenceId = 0x106; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene10.h b/engines/gnap/scenes/scene10.h deleted file mode 100644 index 987c059098..0000000000 --- a/engines/gnap/scenes/scene10.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE10_H -#define GNAP_SCENE10_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene10: public Scene { -public: - Scene10(GnapEngine *vm); - ~Scene10() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb(); - -private: - int _s10_nextCookSequenceId; - int _s10_currCookSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE10_H diff --git a/engines/gnap/scenes/scene11.cpp b/engines/gnap/scenes/scene11.cpp deleted file mode 100644 index ae264dcccf..0000000000 --- a/engines/gnap/scenes/scene11.cpp +++ /dev/null @@ -1,487 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene11.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitKitchen = 1, - kHSExitToilet = 2, - kHSExitLeft = 3, - kHSGoggleGuy = 4, - kHSHookGuy = 5, - kHSBillard = 6, - kHSWalkArea1 = 7, - kHSDevice = 8, - kHSWalkArea2 = 9, - kHSWalkArea3 = 10, - kHSWalkArea4 = 11, - kHSWalkArea5 = 12 -}; - -enum { - kASLeaveScene = 0, - kASShowMagazineToGoggleGuy = 3, - kASTalkGoggleGuy = 4, - kASGrabHookGuy = 6, - kASShowItemToHookGuy = 8, - kASTalkHookGuy = 9, - kASGrabBillardBall = 11 -}; - -Scene11::Scene11(GnapEngine *vm) : Scene(vm) { - _s11_billardBallCtr = 0; - _s11_nextHookGuySequenceId = -1; - _s11_currHookGuySequenceId = -1; - _s11_nextGoggleGuySequenceId = -1; - _s11_currGoggleGuySequenceId = -1; -} - -int Scene11::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->_gameSys->setAnimation(0, 0, 2); - if (_vm->_prevSceneNum == 10 || _vm->_prevSceneNum == 13) { - _vm->playSound(0x108EC, false); - _vm->playSound(0x10928, false); - } - return 0x209; -} - -void Scene11::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitKitchen, 420, 140, 520, 345, SF_EXIT_U_CURSOR); - _vm->setHotspot(kHSExitToilet, 666, 130, 740, 364, SF_EXIT_R_CURSOR); - _vm->setHotspot(kHSExitLeft, 0, 350, 10, 599, SF_EXIT_L_CURSOR | SF_WALKABLE); - _vm->setHotspot(kHSGoggleGuy, 90, 185, 185, 340, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSHookGuy, 210, 240, 340, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSBillard, 640, 475, 700, 530, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 0, 0, 365, 453); - _vm->setHotspot(kHSWalkArea2, 0, 0, 629, 353); - _vm->setHotspot(kHSWalkArea3, 629, 0, 799, 364); - _vm->setHotspot(kHSWalkArea4, 735, 0, 799, 397); - _vm->setHotspot(kHSWalkArea5, 510, 540, 799, 599); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 13; -} - -void Scene11::run() { - bool flag = true; - - _vm->_timers[7] = 50; - _vm->_hotspots[kHSBillard]._flags |= SF_DISABLED; - - _s11_currGoggleGuySequenceId = 0x1F9; - _s11_currHookGuySequenceId = 0x201; - - switch (_vm->_prevSceneNum) { - case 13: - _vm->initGnapPos(8, 5, kDirBottomLeft); - _vm->initPlatypusPos(9, 6, kDirUnk4); - break; - case 47: - _vm->initGnapPos(8, 5, kDirBottomLeft); - _vm->initPlatypusPos(9, 5, kDirUnk4); - _s11_currGoggleGuySequenceId = 0x1FA; - _s11_currHookGuySequenceId = 0x1FF; - _vm->_timers[7] = 180; - break; - case 12: - _vm->initGnapPos(-1, 9, kDirBottomRight); - _vm->initPlatypusPos(-2, 8, kDirNone); - break; - default: - _vm->initGnapPos(6, 6, kDirBottomLeft); - _vm->initPlatypusPos(6, 5, kDirUnk4); - break; - } - - _vm->queueInsertDeviceIcon(); - - _vm->_gameSys->insertSequence(_s11_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); - - _s11_nextHookGuySequenceId = -1; - - _vm->_gameSys->setAnimation(_s11_currHookGuySequenceId, 120, 3); - _vm->_gameSys->insertSequence(_s11_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); - - _s11_nextGoggleGuySequenceId = -1; - - _vm->_gameSys->setAnimation(_s11_currGoggleGuySequenceId, 121, 2); - - _vm->_timers[5] = _vm->getRandom(100) + 75; - _vm->_timers[4] = _vm->getRandom(40) + 20; - _vm->_timers[6] = _vm->getRandom(100) + 100; - _vm->endSceneInit(); - - if (_vm->_prevSceneNum == 12) { - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - } - - _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); - - while (!_vm->_sceneDone) { - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSPlatypus: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - break; - } - } - break; - - case kHSExitKitchen: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(6, 5, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(6, 6, -1, -1, 1); - _vm->_newSceneNum = 10; - break; - - case kHSExitToilet: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(8, 5, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(8, 6, -1, -1, 1); - _vm->_newSceneNum = 13; - break; - - case kHSExitLeft: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(-1, 8, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(-1, 9, -1, 0x107CF, 1); - _vm->_newSceneNum = 12; - break; - - case kHSGoggleGuy: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemMagazine) { - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASShowMagazineToGoggleGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 7, 2, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 6); - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkGoggleGuy; - break; - } - } - } - break; - - case kHSHookGuy: - if (_vm->_gnapActionStatus < 0) { - _vm->_gnapIdleFacing = kDirUpRight; - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(5, 6, 0, 0x107BC, 9); - _vm->_gnapActionStatus = kASShowItemToHookGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 3, 6) | 0x10000); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASGrabHookGuy; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomLeft; - _vm->gnapWalkTo(5, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkHookGuy; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSBillard: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(9, 8); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 8); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(9, 8, 0, 0x107BA, 1); - _vm->_gnapActionStatus = kASGrabBillardBall; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(9, 8); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - if (flag && !_vm->_timers[7]) { - flag = false; - _vm->_gameSys->setAnimation(0x207, 257, 4); - _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->platypusSub426234(); - _vm->updateGnapIdleSequence2(); - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 75; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s11_nextGoggleGuySequenceId == -1) { - if (_vm->getRandom(2)) - _s11_nextGoggleGuySequenceId = 0x1F6; - else - _s11_nextGoggleGuySequenceId = 0x1F9; - } - } - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(40) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s11_nextHookGuySequenceId == -1) { - if (_s11_currHookGuySequenceId == 0x201) { - switch (_vm->getRandom(7)) { - case 0: - _s11_nextHookGuySequenceId = 0x200; - break; - case 1: - _s11_nextHookGuySequenceId = 0x205; - break; - case 2: - _s11_nextHookGuySequenceId = 0x202; - break; - default: - _s11_nextHookGuySequenceId = 0x201; - break; - } - } else { - _s11_nextHookGuySequenceId = 0x201; - } - } - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(100) + 100; - int _gnapRandomValue = _vm->getRandom(3); - switch (_gnapRandomValue) { - case 0: - _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(50) + 75; - _vm->_timers[4] = _vm->getRandom(40) + 20; - } - - _vm->gameUpdateTick(); - } -} - -void Scene11::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - if (_vm->_gnapActionStatus != kASGrabBillardBall) - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASShowMagazineToGoggleGuy: - _s11_nextGoggleGuySequenceId = 0x1F7; - break; - case kASTalkGoggleGuy: - _s11_nextGoggleGuySequenceId = 0x1FB; - break; - case kASGrabHookGuy: - _s11_nextHookGuySequenceId = 0x204; - break; - case kASShowItemToHookGuy: - _s11_nextHookGuySequenceId = 0x203; - break; - case kASTalkHookGuy: - _s11_nextHookGuySequenceId = 0x206; - break; - case kASGrabBillardBall: - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x1F4; - _vm->_gnapId = 255; - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->removeSequence(0x207, 257, true); - _vm->_gameSys->removeSequence(0x208, 256, true); - _s11_nextGoggleGuySequenceId = 0x1F8; - _vm->_timers[5] = _vm->getRandom(100) + 75; - _vm->_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); - _s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId; - _s11_nextGoggleGuySequenceId = -1; - switch (_s11_billardBallCtr) { - case 0: - _s11_nextHookGuySequenceId = 0x1FC; - break; - case 1: - _s11_nextHookGuySequenceId = 0x1FD; - break; - default: - _s11_nextHookGuySequenceId = 0x1FE; - break; - } - ++_s11_billardBallCtr; - _vm->_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); - _s11_currHookGuySequenceId = _s11_nextHookGuySequenceId; - _s11_nextHookGuySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(40) + 20; - _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0); - _vm->_hotspots[kHSBillard]._flags |= SF_DISABLED; - _vm->_gameSys->setAnimation(0x207, 257, 4); - _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); - _vm->_gnapActionStatus = -1; - } - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s11_nextGoggleGuySequenceId != -1) { - _vm->_timers[5] = _vm->getRandom(100) + 75; - _vm->_gameSys->insertSequence(_s11_nextGoggleGuySequenceId, 121, _s11_currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s11_nextGoggleGuySequenceId, 121, 2); - _s11_currGoggleGuySequenceId = _s11_nextGoggleGuySequenceId; - _s11_nextGoggleGuySequenceId = -1; - if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4) - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_s11_nextHookGuySequenceId == 0x204) { - _vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); - _vm->_gameSys->insertSequence(0x204, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _s11_currHookGuySequenceId = 0x204; - _s11_nextHookGuySequenceId = -1; - _vm->_gnapSequenceId = 0x1F5; - _vm->_gnapSequenceDatNum = 0; - _vm->_timers[4] = _vm->getRandom(40) + 20; - _vm->_timers[2] = _vm->getRandom(20) + 70; - _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnapActionStatus == kASGrabHookGuy) - _vm->_gnapActionStatus = -1; - } else if (_s11_nextHookGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s11_nextHookGuySequenceId, 120, _s11_currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s11_nextHookGuySequenceId, 120, 3); - _s11_currHookGuySequenceId = _s11_nextHookGuySequenceId; - _s11_nextHookGuySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(40) + 20; - if (_vm->_gnapActionStatus >= 6 && _vm->_gnapActionStatus <= 9) - _vm->_gnapActionStatus = -1; - } - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->_hotspots[kHSBillard]._flags &= ~SF_DISABLED; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene11.h b/engines/gnap/scenes/scene11.h deleted file mode 100644 index e37f0bdbfa..0000000000 --- a/engines/gnap/scenes/scene11.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE11_H -#define GNAP_SCENE11_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene11: public Scene { -public: - Scene11(GnapEngine *vm); - ~Scene11() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s11_billardBallCtr; - int _s11_nextHookGuySequenceId; - int _s11_currHookGuySequenceId; - int _s11_nextGoggleGuySequenceId; - int _s11_currGoggleGuySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE11_H diff --git a/engines/gnap/scenes/scene12.cpp b/engines/gnap/scenes/scene12.cpp deleted file mode 100644 index 6b63c9f877..0000000000 --- a/engines/gnap/scenes/scene12.cpp +++ /dev/null @@ -1,568 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" - -#include "gnap/scenes/scene12.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitRight = 1, - kHSToothGuy = 2, - kHSBarkeeper = 3, - kHSBeardGuy = 4, - kHSJukebox = 5, - kHSWalkArea1 = 6, - kHSDevice = 7, - kHSWalkArea2 = 8, - kHSWalkArea3 = 9, - kHSWalkArea4 = 10 -}; - -enum { - kASLeaveScene = 0, - kASQuarterToToothGuyDone = 1, - kASTalkToothGuy = 2, - kASGrabToothGuy = 4, - kASShowItemToToothGuy = 5, - kASQuarterWithHoleToToothGuy = 6, - kASQuarterToToothGuy = 7, - kASTalkBeardGuy = 8, - kASLookBeardGuy = 9, - kASGrabBeardGuy = 10, - kASShowItemToBeardGuy = 11, - kASTalkBarkeeper = 12, - kASLookBarkeeper = 13, - kASShowItemToBarkeeper = 15, - kASQuarterWithBarkeeper = 16, - kASPlatWithBarkeeper = 17, - kASPlatWithToothGuy = 18, - kASPlatWithBeardGuy = 19 -}; - -Scene12::Scene12(GnapEngine *vm) : Scene(vm) { - _s12_nextBeardGuySequenceId = -1; - _s12_currBeardGuySequenceId = -1; - _s12_nextToothGuySequenceId = -1; - _s12_currToothGuySequenceId = -1; - _s12_nextBarkeeperSequenceId = -1; - _s12_currBarkeeperSequenceId = -1; -} - -int Scene12::init() { - return 0x209; -} - -void Scene12::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitRight, 790, 360, 799, 599, SF_EXIT_R_CURSOR); - _vm->setHotspot(kHSToothGuy, 80, 180, 160, 380, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSBarkeeper, 490, 175, 580, 238, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSBeardGuy, 620, 215, 720, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSJukebox, 300, 170, 410, 355, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 0, 0, 260, 460); - _vm->setHotspot(kHSWalkArea2, 0, 0, 380, 410); - _vm->setHotspot(kHSWalkArea3, 0, 0, 799, 395); - _vm->setHotspot(kHSWalkArea4, 585, 0, 799, 455); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 11; -} - -void Scene12::run() { - int v18 = 1; - - _vm->queueInsertDeviceIcon(); - - _vm->_gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); - - _s12_currToothGuySequenceId = 0x200; - _s12_nextToothGuySequenceId = -1; - - _vm->_gameSys->setAnimation(0x200, 50, 2); - _vm->_gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); - - _s12_currBeardGuySequenceId = 0x202; - _s12_nextBeardGuySequenceId = -1; - - _vm->_gameSys->setAnimation(0x202, 50, 4); - _vm->_gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); - - _s12_currBarkeeperSequenceId = 0x203; - _s12_nextBarkeeperSequenceId = -1; - - _vm->_gameSys->setAnimation(0x203, 50, 3); - - _vm->_timers[4] = 30; - _vm->_timers[6] = _vm->getRandom(30) + 20; - _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_timers[7] = _vm->getRandom(100) + 100; - - if (_vm->_prevSceneNum == 15) { - _vm->initGnapPos(5, 6, kDirBottomRight); - _vm->initPlatypusPos(3, 7, kDirNone); - _vm->endSceneInit(); - } else { - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 8, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); - } - - while (!_vm->_sceneDone) { - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - _vm->updateGrabCursorSprite(0, 0); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - break; - } - break; - - case kHSExitRight: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(10, -1, -1, -1, 1); - _vm->_newSceneNum = 11; - break; - - case kHSToothGuy: - if (_vm->_grabCursorSpriteIndex == kItemQuarter) { - _vm->_largeSprite = _vm->_gameSys->createSurface(0x141); - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->_gnapActionStatus = kASQuarterToToothGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); - _vm->setGrabCursorSprite(-1); - } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->_gnapActionStatus = kASQuarterWithHoleToToothGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->_gnapActionStatus = kASShowItemToToothGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 2); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASGrabToothGuy; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkToothGuy; - break; - case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); - _vm->_platypusActionStatus = kASPlatWithToothGuy; - _vm->_platypusFacing = kDirUnk4; - _vm->playGnapIdle(2, 7); - break; - } - } - break; - - case kHSBarkeeper: - if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASQuarterWithBarkeeper; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASShowItemToBarkeeper; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASLookBarkeeper; - break; - case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(6, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkBarkeeper; - break; - case PLAT_CURSOR: - _vm->playGnapPullOutDevice(_vm->_platX, _vm->_platY); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASPlatWithBarkeeper; - break; - } - } - break; - - case kHSBeardGuy: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(7, 6, 0, 0x107BB, 9); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASShowItemToBeardGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASLookBeardGuy; - break; - case GRAB_CURSOR: - // NOTE Bug in the original. It has 9 as flags which seems wrong here. - _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASGrabBeardGuy; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkBeardGuy; - break; - case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kASPlatWithBeardGuy; - _vm->_platypusFacing = kDirNone; - _vm->playGnapIdle(7, 6); - break; - } - } - break; - - case kHSJukebox: - _vm->_newSceneNum = 15; - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = 15; - if (_s12_nextToothGuySequenceId == -1) { - if (v18 == 0 && _s12_currBeardGuySequenceId == 0x202 && _s12_currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - if (_vm->getRandom(2) != 0) - _s12_nextToothGuySequenceId = 0x1EC; - else - _s12_nextToothGuySequenceId = 0x204; - } else if (_s12_currToothGuySequenceId != 0x200) - _s12_nextToothGuySequenceId = 0x200; - v18 = (v18 + 1) % 15; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_s12_nextBarkeeperSequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBeardGuySequenceId == 0x202 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - if (_vm->getRandom(2) != 0) - _s12_nextBarkeeperSequenceId = 0x208; - else - _s12_nextBarkeeperSequenceId = 0x1FB; - } else - _s12_nextBarkeeperSequenceId = 0x203; - v18 = (v18 + 1) % 15; - } - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(30) + 15; - if (_s12_nextBeardGuySequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - if (v18 == 0 && _s12_currToothGuySequenceId == 0x200 && _s12_currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) - _s12_nextBeardGuySequenceId = 0x1F2; - else - _s12_nextBeardGuySequenceId = 0x202; - v18 = (v18 + 1) % 15; - } - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 100; - int _gnapRandomValue = _vm->getRandom(3); - switch (_gnapRandomValue) { - case 0: - _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = 30; - _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_timers[6] = _vm->getRandom(30) + 20; - } - - _vm->gameUpdateTick(); - } -} - -void Scene12::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASTalkToothGuy: - if (_vm->isKeyStatus1(Common::KEYCODE_j)) { - // Easter egg - _vm->clearKeyStatus1(Common::KEYCODE_j); - _s12_nextToothGuySequenceId = 0x206; - } else { - _s12_nextToothGuySequenceId = 0x1EE; - } - break; - case 3: - break; - case kASGrabToothGuy: - if (_vm->isKeyStatus1(Common::KEYCODE_j)) { - _vm->clearKeyStatus1(Common::KEYCODE_j); - _s12_nextToothGuySequenceId = 0x206; - } else { - _s12_nextToothGuySequenceId = 0x1EF; - } - break; - case kASShowItemToToothGuy: - if (_vm->isKeyStatus1(Common::KEYCODE_j)) { - _vm->clearKeyStatus1(Common::KEYCODE_j); - _s12_nextToothGuySequenceId = 0x206; - } else { - _s12_nextToothGuySequenceId = 0x1ED; - } - break; - case kASQuarterWithHoleToToothGuy: - if (_vm->isKeyStatus1(Common::KEYCODE_j)) { - _vm->clearKeyStatus1(Common::KEYCODE_j); - _s12_nextToothGuySequenceId = 0x206; - } else { - _s12_nextToothGuySequenceId = 0x1EA; - } - break; - case kASQuarterToToothGuy: - if (_vm->isKeyStatus1(Common::KEYCODE_j)) { - _vm->clearKeyStatus1(Common::KEYCODE_j); - _s12_nextToothGuySequenceId = 0x206; - } else { - _s12_nextToothGuySequenceId = 0x1E9; - } - break; - case kASQuarterToToothGuyDone: - _vm->_gnapActionStatus = -1; - _vm->showCursor(); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); - _vm->deleteSurface(&_vm->_largeSprite); - _vm->setGrabCursorSprite(kItemQuarterWithHole); - break; - case kASTalkBeardGuy: - _s12_nextBeardGuySequenceId = 0x1F4; - break; - case kASLookBeardGuy: - _s12_nextBeardGuySequenceId = 0x1F3; - break; - case kASGrabBeardGuy: - _s12_nextBeardGuySequenceId = 0x1F1; - break; - case kASShowItemToBeardGuy: - _s12_nextBeardGuySequenceId = 0x1F0; - break; - case kASTalkBarkeeper: - if (_vm->getRandom(2) != 0) - _s12_nextBarkeeperSequenceId = 0x1FD; - else - _s12_nextBarkeeperSequenceId = 0x1FF; - break; - case kASLookBarkeeper: - _s12_nextBarkeeperSequenceId = 0x1F8; - break; - case 14: - _s12_nextBarkeeperSequenceId = 0x1F6; - break; - case kASShowItemToBarkeeper: - _s12_nextBarkeeperSequenceId = 0x1F5; - break; - case kASQuarterWithBarkeeper: - _s12_nextBarkeeperSequenceId = 0x1FA; - break; - case kASPlatWithBarkeeper: - _s12_nextBarkeeperSequenceId = 0x1F9; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { - case kASPlatWithToothGuy: - _s12_nextToothGuySequenceId = 0x1EB; - break; - case kASPlatWithBeardGuy: - _s12_nextBeardGuySequenceId = 0x1F3; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s12_currToothGuySequenceId == 0x1E9) { - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->hideCursor(); - _vm->_gameSys->setAnimation(0x10843, 301, 0); - _vm->_gnapActionStatus = kASQuarterToToothGuyDone; - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B7; - _vm->_gnapSequenceDatNum = 1; - _vm->setFlag(kGFTwigTaken); - _vm->invAdd(kItemQuarterWithHole); - _vm->invRemove(kItemQuarter); - } - if (_s12_nextToothGuySequenceId == 0x1EF) { - _vm->_gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); - _vm->_gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _s12_currToothGuySequenceId = _s12_nextToothGuySequenceId; - _s12_nextToothGuySequenceId = -1; - _vm->_gnapSequenceId = 0x205; - _vm->_gnapSequenceDatNum = 0; - _vm->_timers[4] = 40; - _vm->_timers[2] = _vm->getRandom(20) + 70; - _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnapActionStatus == kASGrabToothGuy) - _vm->_gnapActionStatus = -1; - } else if (_s12_nextToothGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s12_nextToothGuySequenceId, 50, _s12_currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s12_nextToothGuySequenceId, 50, 2); - _s12_currToothGuySequenceId = _s12_nextToothGuySequenceId; - _s12_nextToothGuySequenceId = -1; - _vm->_timers[4] = 50; - if (_vm->_gnapActionStatus >= kASTalkToothGuy && _vm->_gnapActionStatus <= kASQuarterToToothGuy && _s12_currToothGuySequenceId != 0x1E9 && - _s12_currToothGuySequenceId != 0x1EC && _s12_currToothGuySequenceId != 0x200) - _vm->_gnapActionStatus = -1; - if (_vm->_platypusActionStatus == kASPlatWithToothGuy) - _vm->_platypusActionStatus = -1; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_vm->_gnapActionStatus == kASPlatWithBarkeeper && _s12_currBarkeeperSequenceId == 0x1F9) { - _vm->_gnapActionStatus = -1; - _vm->playGnapIdle(7, 6); - _vm->_timers[5] = 0; - } - if (_s12_nextBarkeeperSequenceId != -1) { - _vm->_gameSys->insertSequence(_s12_nextBarkeeperSequenceId, 50, _s12_currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s12_nextBarkeeperSequenceId, 50, 3); - _s12_currBarkeeperSequenceId = _s12_nextBarkeeperSequenceId; - _s12_nextBarkeeperSequenceId = -1; - _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus >= kASTalkBarkeeper && _vm->_gnapActionStatus <= kASQuarterWithBarkeeper && _s12_currBarkeeperSequenceId != 0x203 && - _s12_currBarkeeperSequenceId != 0x1FB && _s12_currBarkeeperSequenceId != 0x208) - _vm->_gnapActionStatus = -1; - } - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s12_nextBeardGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s12_nextBeardGuySequenceId, 50, _s12_currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s12_nextBeardGuySequenceId, 50, 4); - _s12_currBeardGuySequenceId = _s12_nextBeardGuySequenceId; - _s12_nextBeardGuySequenceId = -1; - _vm->_timers[6] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus >= kASTalkBeardGuy && _vm->_gnapActionStatus <= kASShowItemToBeardGuy && _s12_currBeardGuySequenceId != 0x202 && _s12_currBeardGuySequenceId != 0x1F2) - _vm->_gnapActionStatus = -1; - if (_vm->_platypusActionStatus == kASPlatWithBeardGuy) - _vm->_platypusActionStatus = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene12.h b/engines/gnap/scenes/scene12.h deleted file mode 100644 index 505047161d..0000000000 --- a/engines/gnap/scenes/scene12.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE12_H -#define GNAP_SCENE12_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene12: public Scene { -public: - Scene12(GnapEngine *vm); - ~Scene12() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s12_nextBeardGuySequenceId; - int _s12_currBeardGuySequenceId; - int _s12_nextToothGuySequenceId; - int _s12_currToothGuySequenceId; - int _s12_nextBarkeeperSequenceId; - int _s12_currBarkeeperSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE12_H diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp deleted file mode 100644 index a8f89ecbdf..0000000000 --- a/engines/gnap/scenes/scene13.cpp +++ /dev/null @@ -1,451 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene13.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitBar = 1, - kHSWalkArea1 = 2, - kHSBackToilet = 3, - kHSFrontToilet = 4, - kHSUrinal = 5, - kHSScribble = 6, - kHSSink = 7, - kHSWalkArea2 = 8, - kHSDevice = 9, - kHSWalkArea3 = 10, - kHSWalkArea4 = 11, - kHSWalkArea5 = 12, - kHSWalkArea6 = 13, - kHSWalkArea7 = 14, - kHSWalkArea8 = 15, - kHSWalkArea9 = 16 -}; - -enum { - kASLeaveScene = 0, - kASBackToilet = 1, - kASFrontToilet = 2, - kASLookScribble = 6, - kASGrabSink = 7, - kASGrabSinkDone = 8, - kASWait = 12, - kASGrabUrinal = 13 -}; - -Scene13::Scene13(GnapEngine *vm) : Scene(vm) { - _s13_backToiletCtr = -1; -} - -int Scene13::init() { - _vm->playSound(0x108EC, false); - return 0xAC; -} - -void Scene13::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitBar, 113, 160, 170, 455, SF_EXIT_L_CURSOR); - _vm->setHotspot(kHSBackToilet, 385, 195, 478, 367, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSFrontToilet, 497, 182, 545, 432, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSUrinal, 680, 265, 760, 445, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSScribble, 560, 270, 660, 370, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSSink, 310, 520, 560, 599, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 268, 270, 325, 385); - _vm->setHotspot(kHSWalkArea2, 0, 0, 52, 599); - _vm->setHotspot(kHSWalkArea3, 0, 0, 113, 550); - _vm->setHotspot(kHSWalkArea4, 0, 0, 226, 438); - _vm->setHotspot(kHSWalkArea5, 0, 0, 268, 400); - _vm->setHotspot(kHSWalkArea6, 0, 0, 799, 367); - _vm->setHotspot(kHSWalkArea7, 478, 0, 799, 401); - _vm->setHotspot(kHSWalkArea8, 545, 0, 799, 473); - _vm->setHotspot(kHSWalkArea9, 0, 549, 799, 599); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 17; -} - -void Scene13::showScribble() { - _vm->hideCursor(); - _vm->_largeSprite = _vm->_gameSys->createSurface(0x6F); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && - !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) - _vm->gameUpdateTick(); - _vm->_mouseClickState._left = false; - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _vm->clearKeyStatus1(29); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); - _vm->deleteSurface(&_vm->_largeSprite); - _vm->showCursor(); -} - -void Scene13::run() { - int currSoundId = 0; - - _vm->queueInsertDeviceIcon(); - - _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_prevSceneNum == 14) { - _vm->initGnapPos(6, 6, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirNone); - } else { - _vm->initGnapPos(3, 7, kDirBottomRight); - _vm->initPlatypusPos(2, 7, kDirNone); - } - - _vm->endSceneInit(); - - _vm->_timers[4] = _vm->getRandom(20) + 20; - _vm->_timers[5] = _vm->getRandom(50) + 50; - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1091A)) - _vm->playSound(0x1091A, true); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(20) + 20; - _vm->_timers[5] = _vm->getRandom(50) + 50; - } - break; - - case kHSPlatypus: - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - break; - } - break; - - case kHSExitBar: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(2, 7, 0, 0x107C0, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(2, 8, -1, -1, 1); - if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { - _vm->_newSceneNum = 11; - } else { - _vm->setFlag(kGFSpringTaken); - _vm->_newSceneNum = 47; - } - break; - - case kHSBackToilet: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(5, 5, 6, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - case GRAB_CURSOR: - case TALK_CURSOR: - if (_vm->_gnapX == 5 && _vm->_gnapY == 5) { - _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); - _vm->_gameSys->setAnimation(_s13_backToiletCtr + 0xA3, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqScale | kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASWait; - _vm->_gnapSequenceId = _s13_backToiletCtr + 0xA3; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; - } else { - _vm->gnapWalkTo(5, 5, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASBackToilet; - _vm->_gnapIdleFacing = kDirUpRight; - } - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSFrontToilet: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 7, 7, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->gnapWalkTo(6, 7, 0, 0xA9, 5); - _vm->_gnapActionStatus = kASFrontToilet; - _vm->_gnapIdleFacing = kDirBottomRight; - break; - } - } - break; - - case kHSScribble: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 7, 8, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLookScribble; - _vm->_gnapIdleFacing = kDirUpRight; - break; - case GRAB_CURSOR: - _vm->playGnapScratchingHead(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 7, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0), 1); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSUrinal: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(8, 7, 9, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 9, 6)); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); - _vm->_gnapActionStatus = kASWait; - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(8, 7, 0, -1, 1); - _vm->_gnapActionStatus = kASGrabUrinal; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSSink: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 5, 9)); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); - _vm->_gnapActionStatus = kASWait; - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(4, 8, 0, 0x107B9, 1); - _vm->_gnapActionStatus = kASGrabSink; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: - case kHSWalkArea6: - case kHSWalkArea7: - case kHSWalkArea8: - case kHSWalkArea9: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - case kHSWalkArea1: - // Nothing - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - if (_vm->_platY == 5 || _vm->_platY == 6) - _vm->platypusWalkTo(-1, 7, -1, -1, 1); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 20; - switch (_vm->getRandom(5)) { - case 0: - _vm->playSound(0xD2, false); - break; - case 1: - _vm->playSound(0xD3, false); - break; - case 2: - _vm->playSound(0xD4, false); - break; - case 3: - _vm->playSound(0xD5, false); - break; - case 4: - _vm->playSound(0xD6, false); - break; - } - } - if (!_vm->_timers[5]) { - int newSoundId; - _vm->_timers[5] = _vm->getRandom(50) + 50; - switch (_vm->getRandom(7)) { - case 0: - newSoundId = 0xD7; - _vm->_timers[5] = 2 * _vm->getRandom(50) + 100; - break; - case 1: - case 2: - newSoundId = 0xCF; - break; - case 3: - case 4: - newSoundId = 0xD0; - break; - default: - newSoundId = 0xD1; - break; - } - if (newSoundId != currSoundId) { - _vm->playSound(newSoundId, false); - currSoundId = newSoundId; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(20) + 20; - _vm->_timers[5] = _vm->getRandom(50) + 50; - } - - _vm->gameUpdateTick(); - } -} - -void Scene13::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - case kASBackToilet: - _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); - _vm->_gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); - _vm->_gnapSequenceId = _s13_backToiletCtr + 0xA3; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - break; - case kASFrontToilet: - _vm->_sceneDone = true; - _vm->_newSceneNum = 14; - break; - case kASLookScribble: - _vm->_gnapActionStatus = -1; - showScribble(); - break; - case kASGrabSink: - _vm->_gameSys->setAnimation(0xAB, 160, 0); - _vm->_gameSys->insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0xAA, 256, true); - _vm->_gnapSequenceId = 0xAB; - _vm->_gnapId = 160; - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 4; - _vm->_gnapY = 8; - _vm->_timers[2] = 360; - _vm->_gnapActionStatus = kASGrabSinkDone; - break; - case kASGrabSinkDone: - _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - break; - case kASWait: - _vm->_gnapActionStatus = -1; - break; - case kASGrabUrinal: - _vm->_gameSys->setAnimation(0xA2, 120, 0); - _vm->_gameSys->insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA2; - _vm->_gnapId = 120; - _vm->_gnapIdleFacing = kDirBottomLeft; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 4; - _vm->_gnapY = 6; - _vm->_timers[2] = 360; - _vm->_gnapActionStatus = kASWait; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_platypusActionStatus = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene13.h b/engines/gnap/scenes/scene13.h deleted file mode 100644 index 53085dd915..0000000000 --- a/engines/gnap/scenes/scene13.h +++ /dev/null @@ -1,51 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE13_H -#define GNAP_SCENE13_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene13: public Scene { -public: - Scene13(GnapEngine *vm); - ~Scene13() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s13_backToiletCtr; - - void showScribble(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE13_H diff --git a/engines/gnap/scenes/scene14.cpp b/engines/gnap/scenes/scene14.cpp deleted file mode 100644 index 6fafc2d66a..0000000000 --- a/engines/gnap/scenes/scene14.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" - -#include "gnap/scenes/scene14.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExit = 1, - kHSCoin = 2, - kHSToilet = 3, - kHSDevice = 4 -}; - -Scene14::Scene14(GnapEngine *vm) : Scene(vm) { -} - -int Scene14::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - return 0x27; -} - -void Scene14::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0); - _vm->setHotspot(kHSExit, 0, 590, 799, 599, SF_EXIT_D_CURSOR); - _vm->setHotspot(kHSCoin, 330, 390, 375, 440, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSToilet, 225, 250, 510, 500, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFNeedleTaken)) - _vm->_hotspots[kHSCoin]._flags = SF_DISABLED; - _vm->_hotspotsCount = 5; -} - -void Scene14::run() { - _vm->_largeSprite = nullptr; - - _vm->queueInsertDeviceIcon(); - - if (!_vm->isFlag(kGFNeedleTaken)) - _vm->_gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); - - _vm->endSceneInit(); - - if (!_vm->isFlag(kGFNeedleTaken) && _vm->invHas(kItemTongs)) - _vm->_largeSprite = _vm->_gameSys->createSurface(1); - - if (!_vm->isFlag(kGFNeedleTaken)) { - _vm->_gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x24; - _vm->_timers[2] = _vm->getRandom(40) + 50; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSExit: - _vm->_sceneDone = true; - _vm->_newSceneNum = 13; - break; - - case kHSCoin: - if (_vm->_grabCursorSpriteIndex == kItemTongs) { - _vm->invAdd(kItemQuarter); - _vm->setFlag(kGFNeedleTaken); - _vm->setGrabCursorSprite(-1); - _vm->hideCursor(); - _vm->_gameSys->setAnimation(0x26, 10, 0); - _vm->_gameSys->insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playSound(0x108E9, false); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playSound(0x108E9, false); - break; - case GRAB_CURSOR: - _vm->_gameSys->insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x23; - break; - case TALK_CURSOR: - _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); - break; - case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - break; - } - } - break; - - case kHSToilet: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - case GRAB_CURSOR: - _vm->playSound(0x108B1, false); - break; - case TALK_CURSOR: - _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); - break; - case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - break; - } - } - break; - - default: - _vm->_mouseClickState._left = false; - break; - } - - updateAnimations(); - _vm->checkGameKeys(); - - if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { - _vm->_gameSys->insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x24; - _vm->_timers[2] = _vm->getRandom(40) + 50; - } - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } - - if (_vm->_largeSprite) - _vm->deleteSurface(&_vm->_largeSprite); -} - -void Scene14::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->setAnimation(0x10843, 301, 1); - _vm->_gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_sceneDone = true; - _vm->_newSceneNum = 13; - _vm->_grabCursorSpriteIndex = kItemQuarter; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene14.h b/engines/gnap/scenes/scene14.h deleted file mode 100644 index 32f0907cb8..0000000000 --- a/engines/gnap/scenes/scene14.h +++ /dev/null @@ -1,48 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE14_H -#define GNAP_SCENE14_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene14: public Scene { -public: - Scene14(GnapEngine *vm); - ~Scene14() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE14_H diff --git a/engines/gnap/scenes/scene15.cpp b/engines/gnap/scenes/scene15.cpp deleted file mode 100644 index 1052d573f4..0000000000 --- a/engines/gnap/scenes/scene15.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene15.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExit = 1, - kHSButton1 = 2, - kHSButton2 = 3, - kHSButton3 = 4, - kHSButton4 = 5, - kHSButton5 = 6, - kHSButton6 = 7, - kHSButtonA = 8, - kHSButtonB = 9, - kHSButtonC = 10, - kHSButtonD = 11, - kHSButtonE = 12, - kHSButtonF = 13, - kHSCoinSlot = 14, - kHSPlayButton = 15, - kHSDevice = 16 -}; - -Scene15::Scene15(GnapEngine *vm) : Scene(vm) { - _s15_nextRecordSequenceId = -1; - _s15_currRecordSequenceId = -1; - _s15_nextSlotSequenceId = -1; - _s15_currSlotSequenceId = -1; - _s15_nextUpperButtonSequenceId = -1; - _s15_currUpperButtonSequenceId = -1; - _s15_nextLowerButtonSequenceId = -1; - _s15_currLowerButtonSequenceId = -1; -} - -int Scene15::init() { - return 0xDD; -} - -void Scene15::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - _vm->setHotspot(kHSExit, 50, 590, 750, 599, SF_EXIT_D_CURSOR); - _vm->setHotspot(kHSButton1, 210, 425, 260, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButton2, 280, 425, 325, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButton3, 340, 425, 385, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButton4, 400, 425, 445, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButton5, 460, 425, 510, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButton6, 520, 425, 560, 475, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButtonA, 205, 480, 250, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButtonB, 270, 480, 320, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButtonC, 335, 480, 380, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButtonD, 395, 480, 445, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButtonE, 460, 480, 505, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSButtonF, 515, 480, 560, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSCoinSlot, 585, 475, 620, 535, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSPlayButton, 622, 431, 650, 482, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 17; -} - -void Scene15::run() { - _s15_currSlotSequenceId = -1; - _s15_currUpperButtonSequenceId = -1; - _s15_currLowerButtonSequenceId = -1; - _s15_nextSlotSequenceId = -1; - _s15_nextUpperButtonSequenceId = -1; - _s15_nextLowerButtonSequenceId = -1; - _s15_currRecordSequenceId = 0xD5; - _s15_nextRecordSequenceId = -1; - - _vm->_gameSys->setAnimation(0xD5, 1, 0); - _vm->_gameSys->insertSequence(_s15_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - _vm->endSceneInit(); - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_hotspots[kHSPlatypus]._x1 = 0; - _vm->_hotspots[kHSPlatypus]._y1 = 0; - _vm->_hotspots[kHSPlatypus]._x2 = 0; - _vm->_hotspots[kHSPlatypus]._y2 = 0; - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSExit: - _vm->_newSceneNum = 12; - _vm->_isLeavingScene = true; - break; - - case kHSCoinSlot: - if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _s15_nextSlotSequenceId = 0xDC; // Insert coin - } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _s15_nextSlotSequenceId = 0xDB; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - case GRAB_CURSOR: - _vm->playSound(0x108E9, false); - break; - case TALK_CURSOR: - _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); - break; - case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - break; - } - } - break; - - case kHSPlayButton: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFGnapControlsToyUFO) || _vm->isFlag(kGFUnk13)) - _vm->playSound(0x108E9, false); - else - _s15_nextSlotSequenceId = 0xDA; - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFGnapControlsToyUFO) || _vm->isFlag(kGFUnk13)) - _s15_nextSlotSequenceId = 0xD9; - else - _s15_nextSlotSequenceId = 0xDA; - break; - case TALK_CURSOR: - _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); - break; - case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - break; - } - } - break; - - case kHSButton1: - case kHSButton2: - case kHSButton3: - case kHSButton4: - case kHSButton5: - case kHSButton6: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playSound(0x108E9, false); - break; - case GRAB_CURSOR: - _s15_nextUpperButtonSequenceId = _vm->_sceneClickedHotspot + 0xC5; - break; - case TALK_CURSOR: - _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); - break; - case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - break; - } - } - break; - - case kHSButtonA: - case kHSButtonB: - case kHSButtonC: - case kHSButtonD: - case kHSButtonE: - case kHSButtonF: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playSound(0x108E9, false); - break; - case GRAB_CURSOR: - _s15_nextLowerButtonSequenceId = _vm->_sceneClickedHotspot + 0xC5; - break; - case TALK_CURSOR: - _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); - break; - case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); - break; - } - } - break; - - default: - _vm->_mouseClickState._left = false; - break; - - } - - updateAnimations(); - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene15::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - if (_vm->_isLeavingScene) { - _vm->_sceneDone = true; - } else if (_s15_nextSlotSequenceId != -1) { - _vm->_gameSys->setAnimation(_s15_nextSlotSequenceId, 1, 0); - _vm->_gameSys->insertSequence(_s15_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _s15_currSlotSequenceId = _s15_nextSlotSequenceId; - _s15_nextSlotSequenceId = -1; - switch (_s15_currSlotSequenceId) { - case 0xDC: - if (_vm->_grabCursorSpriteIndex == kItemQuarter) { - _vm->invRemove(kItemQuarter); - } else { - _vm->invRemove(kItemQuarterWithHole); - _vm->setFlag(kGFUnk13); - } - _vm->setGrabCursorSprite(-1); - break; - case 0xDB: - _vm->setFlag(kGFUnk14); - _vm->setGrabCursorSprite(-1); - _s15_nextSlotSequenceId = 0xD8; - break; - case 0xD9: - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->clearFlag(kGFGnapControlsToyUFO); - _vm->invAdd(kItemQuarter); - _vm->_newGrabCursorSpriteIndex = kItemQuarter; - } else if (_vm->isFlag(kGFUnk13)) { - _vm->clearFlag(kGFUnk13); - _vm->invAdd(kItemQuarterWithHole); - _vm->_newGrabCursorSpriteIndex = kItemQuarterWithHole; - } - _vm->_newSceneNum = 12; - _vm->_isLeavingScene = true; - break; - case 0xD8: - case 0xDA: - if (_s15_currUpperButtonSequenceId != -1) { - _vm->_gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); - _s15_currUpperButtonSequenceId = -1; - } - if (_s15_currLowerButtonSequenceId != -1) { - _vm->_gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); - _s15_currLowerButtonSequenceId = -1; - } - break; - } - } else if (_s15_nextRecordSequenceId != -1) { - _vm->_gameSys->setAnimation(_s15_nextRecordSequenceId, 1, 0); - _vm->_gameSys->insertSequence(_s15_nextRecordSequenceId, 1, _s15_currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _s15_currRecordSequenceId = _s15_nextRecordSequenceId; - _s15_nextRecordSequenceId = -1; - if (_s15_currRecordSequenceId == 0xD3) { - _vm->invRemove(kItemDiceQuarterHole); - _vm->_newSceneNum = 16; - _vm->_isLeavingScene = true; - } - _vm->_gameSys->removeSequence(_s15_currUpperButtonSequenceId, 1, true); - _s15_currUpperButtonSequenceId = -1; - _vm->_gameSys->removeSequence(_s15_currLowerButtonSequenceId, 1, true); - _s15_currLowerButtonSequenceId = -1; - } else if (_s15_nextUpperButtonSequenceId != -1) { - _vm->_gameSys->setAnimation(_s15_nextUpperButtonSequenceId, 1, 0); - if (_s15_currUpperButtonSequenceId == -1) - _vm->_gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(_s15_nextUpperButtonSequenceId, 1, _s15_currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _s15_currUpperButtonSequenceId = _s15_nextUpperButtonSequenceId; - _s15_nextUpperButtonSequenceId = -1; - if (_s15_currLowerButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { - if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) - _s15_nextRecordSequenceId = 0xD3; - else - _s15_nextRecordSequenceId = 0xD4; - } - } else if (_s15_nextLowerButtonSequenceId != -1) { - _vm->_gameSys->setAnimation(_s15_nextLowerButtonSequenceId, 1, 0); - if (_s15_currLowerButtonSequenceId == -1) - _vm->_gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(_s15_nextLowerButtonSequenceId, 1, _s15_currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _s15_currLowerButtonSequenceId = _s15_nextLowerButtonSequenceId; - _s15_nextLowerButtonSequenceId = -1; - if (_s15_currUpperButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { - if (_s15_currUpperButtonSequenceId == 0xCC && _s15_currLowerButtonSequenceId == 0xCE) - _s15_nextRecordSequenceId = 0xD3; - else - _s15_nextRecordSequenceId = 0xD4; - } - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene15.h b/engines/gnap/scenes/scene15.h deleted file mode 100644 index 584efbb106..0000000000 --- a/engines/gnap/scenes/scene15.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE15_H -#define GNAP_SCENE15_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene15: public Scene { -public: - Scene15(GnapEngine *vm); - ~Scene15() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s15_nextRecordSequenceId; - int _s15_currRecordSequenceId; - int _s15_nextSlotSequenceId; - int _s15_currSlotSequenceId; - int _s15_nextUpperButtonSequenceId; - int _s15_currUpperButtonSequenceId; - int _s15_nextLowerButtonSequenceId; - int _s15_currLowerButtonSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE15_H diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp deleted file mode 100644 index 00b3f19fa5..0000000000 --- a/engines/gnap/scenes/scene17.cpp +++ /dev/null @@ -1,852 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene17.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSPhone1 = 1, - kHSPhone2 = 2, - kHSExitGrubCity = 3, - kHSDevice = 4, - kHSExitToyStore = 5, - kHSWrench = 6, - kHSWalkArea1 = 7, - kHSWalkArea2 = 8, - kHSWalkArea3 = 9 -}; - -enum { - kASTryGetWrench = 0, - kASGetWrench2 = 1, - kASGetWrenchDone = 2, - kASGetWrench1 = 3, - kASPlatUsePhone = 4, - kASPutCoinIntoPhone = 5, - kASGetCoinFromPhone = 6, - kASGetCoinFromPhoneDone = 7, - kASPutCoinIntoPhoneDone = 8, - kASGnapUsePhone = 9, - kASGetWrenchGnapReady = 10, - kASGnapHangUpPhone = 11, - kASPlatPhoningAssistant = 12, - kASPlatHangUpPhone = 14, - kASLeaveScene = 15 -}; - -Scene17::Scene17(GnapEngine *vm) : Scene(vm) { - _s17_platTryGetWrenchCtr = 0; - _s17_wrenchCtr = 2; - _s17_nextCarWindowSequenceId = -1; - _s17_nextWrenchSequenceId = -1; - _s17_canTryGetWrench = true; - _s17_platPhoneCtr = 0; - _s17_nextPhoneSequenceId = -1; - _s17_currPhoneSequenceId = -1; -} - -int Scene17::init() { - return 0x263; -} - -void Scene17::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 1, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSPhone1, 61, 280, 97, 322, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - _vm->setHotspot(kHSPhone2, 80, 204, 178, 468, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - _vm->setHotspot(kHSExitGrubCity, 196, 207, 280, 304, SF_EXIT_U_CURSOR, 3, 5); - _vm->setHotspot(kHSExitToyStore, 567, 211, 716, 322, SF_EXIT_U_CURSOR, 5, 6); - _vm->setHotspot(kHSWrench, 586, 455, 681, 547, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 434); - _vm->setHotspot(kHSWalkArea2, 541, 0, 800, 600); - _vm->setHotspot(kHSWalkArea3, 0, 204, 173, 468); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFGrassTaken)) - _vm->_hotspots[kHSWrench]._flags = SF_NONE; - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->_hotspots[kHSDevice]._flags = SF_DISABLED; - _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; - } - _vm->_hotspotsCount = 10; -} - -void Scene17::update() { - _vm->gameUpdateTick(); - _vm->updateMouseCursor(); - _vm->updateGrabCursorSprite(0, 0); - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } -} - -void Scene17::platHangUpPhone() { - int savedGnapActionStatus = _vm->_gnapActionStatus; - - if (_vm->_platypusActionStatus == kASPlatPhoningAssistant) { - _vm->_gnapActionStatus = kASPlatHangUpPhone; - _vm->updateMouseCursor(); - _s17_platPhoneCtr = 0; - _vm->_platypusActionStatus = -1; - _vm->_gameSys->setAnimation(0x257, 254, 4); - _vm->_gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) - _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x25B, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0x25B; - _vm->_platypusSequenceDatNum = 0; - _s17_currPhoneSequenceId = -1; - _s17_nextPhoneSequenceId = -1; - _vm->clearFlag(kGFPlatypusTalkingToAssistant); - while (_vm->_gameSys->getAnimationStatus(1) != 2) - _vm->gameUpdateTick(); - _vm->_gnapActionStatus = savedGnapActionStatus; - _vm->updateMouseCursor(); - } - updateHotspots(); -} - -void Scene17::run() { - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(8); - _vm->_sceneWaiting = false; - _vm->_timers[4] = _vm->getRandom(100) + 200; - _vm->_timers[3] = 200; - _vm->_timers[5] = _vm->getRandom(30) + 80; - _vm->_timers[6] = _vm->getRandom(30) + 200; - _vm->_timers[7] = _vm->getRandom(100) + 100; - - if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); - } else { - if (_vm->_s18_garbageCanPos >= 8) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); - } else if (_vm->_s18_garbageCanPos >= 6) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); - } else if (_vm->_s18_garbageCanPos >= 5) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); - } else if (_vm->_s18_garbageCanPos >= 4) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); - } else { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); - } - } - - if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFGrassTaken)) - _s17_currWrenchSequenceId = 0x22D; - else - _s17_currWrenchSequenceId = 0x22F; - - _s17_currCarWindowSequenceId = 0x244; - - if (_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_gameSys->setAnimation(_s17_currWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_s17_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gameSys->setAnimation(0, 0, 3); - } else { - _vm->_gameSys->setAnimation(_s17_currCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_s17_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); - } - - _s17_canTryGetWrench = true; - - if (_vm->isFlag(kGFUnk18)) - _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { - if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(4, 6, kDirBottomRight); - _vm->initPlatypusPos(5, 6, kDirNone); - _vm->endSceneInit(); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); - } else if (_vm->isFlag(kGFUnk27)) { - _vm->initGnapPos(3, 9, kDirUpLeft); - _vm->_platX = _vm->_hotspotsWalkPos[2].x; - _vm->_platY = _vm->_hotspotsWalkPos[2].y; - _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; - _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceId = 0x25A; - _vm->_platypusSequenceDatNum = 0; - _vm->endSceneInit(); - _vm->clearFlag(kGFSpringTaken); - _vm->clearFlag(kGFUnk16); - _vm->_platypusActionStatus = kASPlatPhoningAssistant; - platHangUpPhone(); - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->clearFlag(kGFPlatypusTalkingToAssistant); - _vm->clearFlag(kGFUnk27); - updateHotspots(); - } else if (_vm->isFlag(kGFUnk25)) { - _vm->clearFlag(kGFSpringTaken); - _vm->clearFlag(kGFUnk16); - _vm->initPlatypusPos(7, 9, kDirNone); - _vm->_gnapX = _vm->_hotspotsWalkPos[2].x; - _vm->_gnapY = _vm->_hotspotsWalkPos[2].y; - _vm->_gnapId = 20 * _vm->_hotspotsWalkPos[2].y; - _vm->_gameSys->insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 601; - _vm->_gnapActionStatus = kASGnapHangUpPhone; - _vm->clearFlag(kGFUnk25); - _vm->_gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - _vm->_gameSys->setAnimation(0x257, 254, 0); - _vm->_gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); - } else if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->clearFlag(kGFSpringTaken); - _vm->clearFlag(kGFUnk16); - _vm->_sceneWaiting = true; - _vm->initGnapPos(3, 9, kDirUpLeft); - _vm->_platX = _vm->_hotspotsWalkPos[2].x; - _vm->_platY = _vm->_hotspotsWalkPos[2].y; - _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; - _s17_currPhoneSequenceId = 0x251; - _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_s17_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceId = 0x25A; - _vm->_platypusSequenceDatNum = 0; - _vm->endSceneInit(); - _vm->_gameSys->setAnimation(_s17_currPhoneSequenceId, 254, 1); - _vm->_platypusActionStatus = kASPlatPhoningAssistant; - updateHotspots(); - } else if (_vm->_prevSceneNum == 18) { - _vm->initGnapPos(6, 6, kDirBottomRight); - _vm->initPlatypusPos(5, 6, kDirNone); - _vm->endSceneInit(); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); - } else { - if (_vm->isFlag(kGFSpringTaken)) { - _vm->initGnapPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); - _vm->initPlatypusPos(1, 9, kDirNone); - _vm->endSceneInit(); - } else { - _vm->initGnapPos(3, 7, kDirBottomRight); - _vm->initPlatypusPos(1, 7, kDirNone); - _vm->endSceneInit(); - } - _vm->clearFlag(kGFSpringTaken); - _vm->clearFlag(kGFUnk16); - _vm->endSceneInit(); - } - } else { - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gnapId = 120; - _vm->_gnapSequenceId = 0x23D; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platX = -1; - _vm->_platY = 8; - _vm->_platypusId = 160; - _vm->_gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, - kSeqScale | kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); - // TODO delayTicksA(2, 9); - _vm->endSceneInit(); - _vm->_platypusSequenceId = 0x7C1; - _vm->_platypusSequenceDatNum = 1; - _vm->_platypusFacing = kDirBottomRight; - _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == 3) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - if (_vm->isFlag(kGFGrassTaken)) { - _vm->gnapUseJointOnPlatypus(); - } else { - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); - _vm->_platypusActionStatus = kASGetWrench1; - _vm->_gnapActionStatus = kASGetWrench1; - _vm->_timers[5] = _vm->getRandom(30) + 80; - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemJoint); - } - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - case GRAB_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWrench: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFGrassTaken)) { - _vm->playGnapImpossible(0, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - case GRAB_CURSOR: - _vm->playGnapScratchingHead(8, 7); - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (_s17_canTryGetWrench) { - platHangUpPhone(); - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kASTryGetWrench; - _vm->_gnapActionStatus = kASTryGetWrench; - _vm->_timers[5] = _vm->getRandom(30) + 80; - } else - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSPhone1: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASPutCoinIntoPhone; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 3); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFUnk18)) { - platHangUpPhone(); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGetCoinFromPhone; - } else - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (_vm->isFlag(kGFUnk18)) { - platHangUpPhone(); - _vm->_isLeavingScene = true; - _vm->gnapUseDeviceOnPlatypuss(); - _vm->_platypusFacing = kDirUpLeft; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); - _vm->setFlag(kGFUnk16); - _vm->_platypusActionStatus = kASPlatUsePhone; - _vm->_gnapActionStatus = kASPlatUsePhone; - } else - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSPhone2: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASPutCoinIntoPhone; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 3); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFUnk18)) { - platHangUpPhone(); - _vm->_isLeavingScene = true; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGnapUsePhone; - _vm->setFlag(kGFSpringTaken); - } else - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (_vm->isFlag(kGFUnk18)) { - platHangUpPhone(); - _vm->_isLeavingScene = true; - _vm->gnapUseDeviceOnPlatypuss(); - _vm->_platypusFacing = kDirUpLeft; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); - _vm->setFlag(kGFUnk16); - _vm->_platypusActionStatus = kASPlatUsePhone; - _vm->_gnapActionStatus = kASPlatUsePhone; - } else - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitToyStore: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 18; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - if (_vm->_platypusActionStatus != kASPlatPhoningAssistant) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); - } - break; - - case kHSExitGrubCity: - if (_vm->_gnapActionStatus < 0) { - platHangUpPhone(); - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = 0; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->platypusSub426234(); - _vm->updateGnapIdleSequence2(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 200; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) - _vm->_gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - switch (_vm->getRandom(3)) { - case 0: - _vm->_gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - _vm->_gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - } - if (_vm->_platypusActionStatus < 0 && !_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(30) + 80; - if (_vm->isFlag(kGFGrassTaken) && _s17_nextWrenchSequenceId == -1) { - _s17_nextWrenchSequenceId = 0x236; - } else if (_s17_canTryGetWrench) { - switch (_vm->getRandom(6)) { - case 0: - _s17_nextWrenchSequenceId = 0x231; - break; - case 1: - _s17_nextWrenchSequenceId = 0x232; - break; - case 2: - case 3: - _s17_nextWrenchSequenceId = 0x23C; - break; - case 4: - case 5: - _s17_nextWrenchSequenceId = 0x22E; - break; - } - } else { - --_s17_wrenchCtr; - if (_s17_wrenchCtr) { - switch (_vm->getRandom(6)) { - case 0: - _s17_nextWrenchSequenceId = 0x237; - break; - case 1: - _s17_nextWrenchSequenceId = 0x238; - break; - case 2: - _s17_nextWrenchSequenceId = 0x239; - break; - case 3: - _s17_nextWrenchSequenceId = 0x23A; - break; - case 4: - _s17_nextWrenchSequenceId = 0x23B; - break; - case 5: - _s17_nextWrenchSequenceId = 0x235; - break; - } - } else { - _s17_wrenchCtr = 2; - _s17_nextWrenchSequenceId = 0x235; - } - } - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(30) + 200; - if (_s17_nextCarWindowSequenceId == -1 && !_vm->isFlag(kGFGrassTaken)) - _s17_nextCarWindowSequenceId = 0x246; - } - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene17::updateAnimations() { - static const int kPlatPhoneSequenceIds[] = { - 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257 - }; - - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASGetWrench1: - _vm->_gnapActionStatus = kASGetWrenchGnapReady; - break; - case kASGetCoinFromPhone: - _vm->playGnapPullOutDevice(1, 3); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x250, 100, 0); - _vm->_gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); - _vm->invAdd(kItemDiceQuarterHole); - _vm->clearFlag(kGFUnk18); - _vm->_gnapActionStatus = kASGetCoinFromPhoneDone; - break; - case kASGetCoinFromPhoneDone: - _vm->setGrabCursorSprite(kItemDiceQuarterHole); - _vm->_gnapActionStatus = -1; - break; - case kASPutCoinIntoPhone: - _vm->_gameSys->setAnimation(0x24C, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x24C; - _vm->invRemove(kItemDiceQuarterHole); - _vm->setGrabCursorSprite(-1); - _vm->setFlag(kGFUnk18); - _vm->_gnapActionStatus = kASPutCoinIntoPhoneDone; - break; - case kASPutCoinIntoPhoneDone: - _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - break; - case kASGnapUsePhone: - _vm->_gameSys->setAnimation(0x24D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 53; - break; - case kASGnapHangUpPhone: - _vm->_gameSys->insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x258; - _vm->_gnapActionStatus = -1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { - case kASTryGetWrench: - _vm->_platypusActionStatus = -1; - ++_s17_platTryGetWrenchCtr; - if (_s17_platTryGetWrenchCtr % 2 != 0) - _s17_nextWrenchSequenceId = 0x233; - else - _s17_nextWrenchSequenceId = 0x234; - _s17_canTryGetWrench = false; - break; - case kASGetWrench1: - _s17_nextWrenchSequenceId = 0x230; - break; - case kASGetWrench2: - _s17_nextCarWindowSequenceId = 0x249; - break; - case kASGetWrenchDone: - _vm->_platypusActionStatus = -1; - _vm->invAdd(kItemWrench); - _vm->setGrabCursorSprite(kItemWrench); - break; - case kASPlatUsePhone: - _vm->_gameSys->setAnimation(0x24E, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x24E; - _vm->_platypusActionStatus = kASLeaveScene; - _vm->_newSceneNum = 53; - break; - case kASPlatPhoningAssistant: - ++_s17_platPhoneCtr; - if (_s17_platPhoneCtr >= 7) { - _s17_platPhoneCtr = 0; - _s17_nextPhoneSequenceId = -1; - _s17_currPhoneSequenceId = -1; - _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x25B; - _vm->_platypusActionStatus = -1; - _vm->clearFlag(kGFPlatypusTalkingToAssistant); - _vm->_sceneWaiting = false; - updateHotspots(); - } else { - _s17_nextPhoneSequenceId = kPlatPhoneSequenceIds[_s17_platPhoneCtr]; - _vm->_gameSys->setAnimation(_s17_nextPhoneSequenceId, 254, 1); - _vm->_gameSys->insertSequence(_s17_nextPhoneSequenceId, 254, _s17_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x25A; - _s17_currPhoneSequenceId = _s17_nextPhoneSequenceId; - } - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - switch (_s17_nextWrenchSequenceId) { - case 0x233: - _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(0x243, _vm->_platypusId, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, - kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; - _s17_nextWrenchSequenceId = -1; - _vm->_platypusSequenceId = 0x243; - _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x243, _vm->_platypusId, 1); - break; - case 0x234: - _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(0x242, _vm->_platypusId, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, - kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; - _s17_nextWrenchSequenceId = -1; - _vm->_platypusSequenceId = 0x242; - _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x242, _vm->_platypusId, 1); - break; - case 0x231: - if (_vm->getRandom(2) != 0) - _s17_nextCarWindowSequenceId = 0x245; - else - _s17_nextCarWindowSequenceId = 0x248; - _vm->_gameSys->setAnimation(0, 0, 2); - break; - case 0x232: - _s17_nextCarWindowSequenceId = 0x247; - _vm->_gameSys->setAnimation(0, 0, 2); - break; - case 0x22E: - case 0x235: - if (_s17_nextWrenchSequenceId == 0x235) - _vm->_hotspots[kHSWrench]._flags &= ~SF_DISABLED; - else - _vm->_hotspots[kHSWrench]._flags |= SF_DISABLED; - _s17_canTryGetWrench = !_s17_canTryGetWrench; - _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; - _s17_nextWrenchSequenceId = -1; - break; - case 0x230: - if (_vm->_gnapActionStatus == kASGetWrenchGnapReady) { - _vm->_gameSys->setAnimation(0, 0, 2); - if (_s17_canTryGetWrench) { - _vm->_gameSys->insertSequence(0x22E, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s17_currWrenchSequenceId = 0x22E; - _s17_canTryGetWrench = false; - } - _vm->_gameSys->setAnimation(0x23F, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x23F, _vm->_platypusId, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, - kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 1; - _vm->_platypusSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x875; - _vm->_platypusSequenceId = 0x23F; - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); - _vm->_platypusActionStatus = kASGetWrench2; - } - break; - default: - if (_s17_nextWrenchSequenceId != -1) { - _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; - _s17_nextWrenchSequenceId = -1; - } - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s17_nextCarWindowSequenceId) { - case 0x246: - _vm->_gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; - _s17_nextCarWindowSequenceId = -1; - break; - case 0x245: - case 0x247: - case 0x248: - _vm->_gameSys->setAnimation(_s17_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_s17_nextWrenchSequenceId, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(2) != 2) - update(); - _vm->_gameSys->setAnimation(_s17_nextCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s17_currCarWindowSequenceId = _s17_nextCarWindowSequenceId; - _s17_nextCarWindowSequenceId = -1; - _s17_currWrenchSequenceId = _s17_nextWrenchSequenceId; - _s17_nextWrenchSequenceId = -1; - break; - case 0x249: - _vm->_gameSys->setAnimation(0x230, 40, 2); - _vm->_gameSys->setAnimation(0x240, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x230, 40, _s17_currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_s17_nextCarWindowSequenceId, 40, _s17_currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x23E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x23E; - _vm->_gnapSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x240; - _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x24A, 40, 3); - _vm->_gameSys->insertSequence(0x24A, 40, _s17_nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(2) != 2) { - update(); - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0x24A, 40, 3); - _vm->_gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); - } - } - _vm->_gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x24B, 40, 3); - _vm->_gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); - _s17_currCarWindowSequenceId = 0x24B; - _s17_nextCarWindowSequenceId = -1; - _s17_currWrenchSequenceId = 0x22D; - _s17_nextWrenchSequenceId = -1; - _vm->setFlag(kGFGrassTaken); - _vm->_gnapActionStatus = -1; - _vm->_platypusActionStatus = 2; - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(30) + 80; - break; - } - } - -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene17.h b/engines/gnap/scenes/scene17.h deleted file mode 100644 index a653cca5e7..0000000000 --- a/engines/gnap/scenes/scene17.h +++ /dev/null @@ -1,61 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE17_H -#define GNAP_SCENE17_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene17: public Scene { -public: - Scene17(GnapEngine *vm); - ~Scene17() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - bool _s17_canTryGetWrench; - int _s17_wrenchCtr; - int _s17_platPhoneCtr; - int _s17_platTryGetWrenchCtr; - int _s17_nextPhoneSequenceId; - int _s17_currPhoneSequenceId; - int _s17_nextWrenchSequenceId; - int _s17_currWrenchSequenceId; - int _s17_nextCarWindowSequenceId; - int _s17_currCarWindowSequenceId; - - void update(); - void platHangUpPhone(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE17_H diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp deleted file mode 100644 index 6f4ef67d07..0000000000 --- a/engines/gnap/scenes/scene18.cpp +++ /dev/null @@ -1,1030 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene18.h" - -namespace Gnap { - -static const int kScene18SequenceIds[] = { - 0x219, 0x21A, 0x21B, 0x21C, 0x21D -}; - -enum { - kHSPlatypus = 0, - kHSGarbageCan = 1, - kHSDevice = 2, - kHSExitToyStore = 3, - kHSExitPhoneBooth = 4, - kHSExitGrubCity = 5, - kHSHydrantTopValve = 6, - kHSHydrantRightValve = 7, - kHSCowboyHat = 8, - kHSWalkArea1 = 9, - kHSWalkArea2 = 10 -}; - -enum { - kASOpenRightValveNoGarbageCanDone = 0, - kASOpenRightValveNoGarbageCan = 1, - kASCloseRightValveNoGarbageCan = 2, - kASOpenTopValveDone = 3, - kASOpenTopValve = 4, - kASCloseTopValve = 5, - kASGrabGarbageCanFromStreet = 6, - kASGrabCowboyHat = 7, - kASGrabGarbageCanFromHydrant = 8, - kASPutGarbageCanOnRunningHydrant = 9, - kASPutGarbageCanOnRunningHydrant2 = 10, - kASGrabCowboyHatDone = 11, - kASStandingOnHydrant = 12, - kASOpenRightValveWithGarbageCan = 13, - kASOpenRightValveWithGarbageCanDone = 14, - kASCloseRightValveWithGarbageCan = 15, - kASPutGarbageCanOnHydrant = 16, - kASPutGarbageCanOnHydrantDone = 17, - kASPlatComesHere = 18, - kASCloseRightValveWithGarbageCanDone = 19, - kASLeaveScene = 20 -}; - -Scene18::Scene18(GnapEngine *vm) : Scene(vm) { - _s18_cowboyHatSurface = nullptr; - - _s18_platPhoneCtr = 0; - _s18_platPhoneIter = 0; - _s18_nextPhoneSequenceId = -1; - _s18_currPhoneSequenceId = -1; -} - -Scene18::~Scene18() { - delete _s18_cowboyHatSurface; -} - -int Scene18::init() { - _vm->_gameSys->setAnimation(0, 0, 3); - return 0x222; -} - -void Scene18::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSGarbageCan, _vm->_gridMinX + 75 * _vm->_s18_garbageCanPos - 35, _vm->_gridMinY + 230, _vm->_gridMinX + 75 * _vm->_s18_garbageCanPos + 35, _vm->_gridMinY + 318, - SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, _vm->_s18_garbageCanPos, 7); - _vm->setHotspot(kHSExitToyStore, 460, 238, 592, 442, SF_EXIT_U_CURSOR, 7, 7); - _vm->setHotspot(kHSExitPhoneBooth, 275, 585, 525, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - _vm->setHotspot(kHSExitGrubCity, 0, 350, 15, 600, SF_EXIT_L_CURSOR, 0, 9); - _vm->setHotspot(kHSHydrantTopValve, 100, 345, 182, 410, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 8); - _vm->setHotspot(kHSHydrantRightValve, 168, 423, 224, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHSCowboyHat, 184, 63, 289, 171, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 448); - _vm->setHotspot(kHSWalkArea2, 0, 0, 214, 515); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFTruckFilledWithGas)) { - if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; - _vm->_hotspots[kHSHydrantRightValve]._x1 = 148; - _vm->_hotspots[kHSHydrantRightValve]._y1 = 403; - _vm->_hotspots[kHSGarbageCan]._flags = SF_DISABLED; - _vm->_hotspotsWalkPos[kHSGarbageCan].x = 3; - _vm->_hotspotsWalkPos[kHSGarbageCan].y = 7; - } else { - _vm->_hotspots[kHSHydrantTopValve]._y1 = 246; - } - } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; - _vm->_hotspots[kHSHydrantTopValve]._x1 = 105; - _vm->_hotspots[kHSHydrantTopValve]._x2 = 192; - } else if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_hotspots[kHSGarbageCan]._x1 = 115; - _vm->_hotspots[kHSGarbageCan]._y1 = 365; - _vm->_hotspots[kHSGarbageCan]._x2 = 168; - _vm->_hotspots[kHSGarbageCan]._y2 = 470; - _vm->_hotspots[kHSGarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _vm->_hotspotsWalkPos[kHSGarbageCan].x = 3; - _vm->_hotspotsWalkPos[kHSGarbageCan].y = 7; - } - if (_vm->isFlag(kGFPlatyPussDisguised)) - _vm->_hotspots[kHSGarbageCan]._flags = SF_DISABLED; - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->_hotspots[kHSDevice]._flags = SF_DISABLED; - _vm->_hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; - _vm->_hotspots[kHSHydrantRightValve]._flags = SF_DISABLED; - _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; - } - if (_vm->isFlag(kGFUnk14)) { - _vm->_hotspots[kHSHydrantTopValve]._flags = SF_DISABLED; - _vm->_hotspots[kHSCowboyHat]._flags = SF_DISABLED; - } - _vm->_hotspotsCount = 11; -} - -void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { - // CHECKME: (x, y) is always set to (-1, -1) - - // TODO Cleanup - static const int kSequenceIds[] = { - 0x203, 0x204 - }; - - int gnapSeqId, gnapId, gnapDatNum, gnapGridX; - int clippedX, v12, v5, v10, v11, direction; - - if (x >= 0) - clippedX = x; - else - clippedX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; - if (clippedX >= _vm->_gnapX) - v10 = clippedX - 1; - else - v10 = clippedX + 1; - - if (a5 < 0) - a5 = 4; - v5 = v10; - if (v10 <= a5) - v5 = a5; - v11 = v5; - v12 = _vm->_gridMaxX - 1; - if (_vm->_gridMaxX - 1 >= v11) - v12 = v11; - - if (v12 == _vm->_gnapX) { - gnapSeqId = _vm->_gnapSequenceId; - gnapId = _vm->_gnapId; - gnapDatNum = _vm->_gnapSequenceDatNum; - gnapGridX = _vm->_gnapX; - if (_vm->_gnapX <= clippedX) - direction = 1; - else - direction = -1; - } else { - if (_vm->_gnapY == _vm->_platY) { - if (v12 >= _vm->_gnapX) { - if (v12 >= _vm->_platX && _vm->_gnapX <= _vm->_platX) - _vm->platypusMakeRoom(); - } else if (v12 <= _vm->_platX && _vm->_gnapX >= _vm->_platX) { - _vm->platypusMakeRoom(); - } - } - gnapSeqId = _vm->_gnapSequenceId; - gnapId = _vm->_gnapId; - gnapDatNum = _vm->_gnapSequenceDatNum; - gnapGridX = _vm->_gnapX; - int seqId = 0; - if (v12 < _vm->_gnapX) { - direction = -1; - seqId = 1; - } else - direction = 1; - int a2 = 20 * _vm->_gnapY + 1; - do { - if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnapY)) - break; - a2 += direction; - _vm->_gameSys->insertSequence(kSequenceIds[seqId], a2, - gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - gnapSeqId = kSequenceIds[seqId]; - gnapId = a2; - gnapDatNum = 0; - gnapGridX += direction; - } while (v12 != gnapGridX); - } - - if (argC >= 0) { - _vm->_gnapSequenceId = ridToEntryIndex(argC); - _vm->_gnapSequenceDatNum = ridToDatIndex(argC); - } else { - if (direction == 1) - _vm->_gnapSequenceId = 0x20A; - else - _vm->_gnapSequenceId = 0x209; - _vm->_gnapSequenceDatNum = 0; - } - - if (direction == 1) - _vm->_gnapIdleFacing = kDirBottomRight; - else - _vm->_gnapIdleFacing = kDirBottomLeft; - - _vm->_gnapId = 20 * _vm->_gnapY + 1; - - if (animationIndex >= 0) - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); - - _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - - _vm->_gnapX = gnapGridX; - -} - -void Scene18::putDownGarbageCan(int animationIndex) { - if (animationIndex >= 0) { - while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) - _vm->gameUpdateTick(); - } - if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) - _vm->_s18_garbageCanPos = _vm->_gnapX - 1; - else - _vm->_s18_garbageCanPos = _vm->_gnapX + 1; - _vm->clearFlag(kGFPlatyPussDisguised); - updateHotspots(); - if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) { - _vm->_gameSys->insertSequence(0x107BA, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7BA; - } else { - _vm->_gameSys->insertSequence(0x107B9, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B9; - } - _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18_garbageCanPos - 40), 0); - _vm->_gameSys->setAnimation(0x1FA, 19, 4); - _vm->_gameSys->insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18_garbageCanPos - 40), 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) - _vm->gameUpdateTick(); -} - -void Scene18::platEndPhoning(bool platFl) { - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _s18_platPhoneIter = 0; - _s18_platPhoneCtr = 0; - _vm->_platypusActionStatus = -1; - if (_s18_currPhoneSequenceId != -1) { - _vm->_gameSys->setAnimation(0x21E, 254, 3); - _vm->_gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(3) != 2) - _vm->gameUpdateTick(); - } - _vm->_gameSys->removeSequence(0x21F, 254, true); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->clearFlag(kGFPlatypusTalkingToAssistant); - if (platFl) { - _vm->_platypusActionStatus = kASPlatComesHere; - _vm->_timers[6] = 50; - _vm->_sceneWaiting = true; - } - _s18_currPhoneSequenceId = -1; - _s18_nextPhoneSequenceId = -1; - updateHotspots(); - } -} - -void Scene18::closeHydrantValve() { - _vm->_gnapActionStatus = kASLeaveScene; - _vm->updateMouseCursor(); - if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gnapActionStatus = kASCloseRightValveWithGarbageCan; - waitForGnapAction(); - } else { - _vm->_gnapActionStatus = kASCloseRightValveNoGarbageCan; - waitForGnapAction(); - } - } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); - _vm->_gnapActionStatus = kASCloseTopValve; - waitForGnapAction(); - } -} - -void Scene18::waitForGnapAction() { - while (_vm->_gnapActionStatus >= 0) { - updateAnimations(); - _vm->gameUpdateTick(); - } -} - -void Scene18::run() { - _s18_cowboyHatSurface = nullptr; - - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(4); - - _vm->_timers[5] = _vm->getRandom(100) + 100; - - _vm->queueInsertDeviceIcon(); - - _vm->clearFlag(kGFPlatyPussDisguised); - - if (!_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->playSound(0x22B, true); - } else { - _vm->_gameSys->insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); - } - } else { - _vm->_gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18_garbageCanPos - 40), 0); - if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->playSound(0x22B, true); - } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->playSound(0x22B, true); - } - } - - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - if (_vm->_prevSceneNum == 17) - _vm->initGnapPos(4, 11, kDirBottomRight); - else - _vm->initGnapPos(4, 7, kDirBottomRight); - _s18_platPhoneCtr = _vm->getRandom(5); - if (_vm->isFlag(kGFUnk27)) { - _vm->_gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - _s18_currPhoneSequenceId = -1; - platEndPhoning(true); - _vm->clearFlag(kGFUnk27); - } else { - _s18_currPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr]; - _s18_platPhoneIter = 0; - _vm->_gameSys->insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_s18_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - } - if (_vm->isFlag(kGFUnk27)) { - platEndPhoning(true); - _vm->clearFlag(kGFUnk27); - } else { - _vm->_gameSys->setAnimation(_s18_currPhoneSequenceId, 254, 3); - } - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); - } else { - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->clearFlag(kGFGnapControlsToyUFO); - _vm->setGrabCursorSprite(kItemCowboyHat); - _vm->_prevSceneNum = 19; - } - if (_vm->_prevSceneNum == 17) { - _vm->initGnapPos(4, 11, kDirBottomRight); - _vm->initPlatypusPos(5, 11, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); - } else if (_vm->_prevSceneNum == 19) { - _vm->initGnapPos(7, 7, kDirBottomRight); - _vm->initPlatypusPos(8, 7, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(-1, 10, kDirBottomRight); - _vm->initPlatypusPos(-1, 10, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(3, 7, -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); - } - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 20, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSCowboyHat: - if (_vm->_gnapActionStatus == kASStandingOnHydrant) { - _vm->_gnapActionStatus = kASGrabCowboyHat; - _vm->_sceneWaiting = false; - } else if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCowboyHat].x, _vm->_hotspotsWalkPos[kHSCowboyHat].y, 3, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 2); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCowboyHat].x, _vm->_hotspotsWalkPos[kHSCowboyHat].y, 0, _vm->getGnapSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSGarbageCan: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFUnk14)) { - if (_vm->_grabCursorSpriteIndex >= 0) - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y, 1, 5); - else - _vm->playGnapImpossible(0, 0); - } else { - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) - platEndPhoning(true); - if (_vm->_grabCursorSpriteIndex >= 0) { - if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGarbageCan].x - (_vm->_gnapX < _vm->_s18_garbageCanPos ? 1 : -1), - _vm->_hotspotsWalkPos[kHSGarbageCan].y, _vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y); - else - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y, 2, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHSGarbageCan].x - (_vm->_gnapX < _vm->_s18_garbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHSGarbageCan].y); - else if (!_vm->isFlag(kGFTruckFilledWithGas)) - _vm->playGnapScratchingHead(2, 4); - break; - case GRAB_CURSOR: - if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGarbageCan].x - (_vm->_gnapX < _vm->_s18_garbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHSGarbageCan].y, - -1, -1, 1); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_s18_garbageCanPos, _vm->_gnapY) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabGarbageCanFromStreet; - } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGarbageCan].x, _vm->_hotspotsWalkPos[kHSGarbageCan].y, 0, -1, 1)) - _vm->_gnapActionStatus = kASGrabGarbageCanFromHydrant; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - } - break; - - case kHSHydrantTopValve: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - // While carrying garbage can - if (_vm->_grabCursorSpriteIndex >= 0) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - _vm->playGnapScratchingHead(0, 0); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFTruckFilledWithGas)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); - _vm->_gnapActionStatus = kASPutGarbageCanOnRunningHydrant; - } else if (!_vm->isFlag(kGFBarnPadlockOpen)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); - _vm->_gnapActionStatus = kASPutGarbageCanOnHydrant; - } else { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - _vm->playGnapImpossible(0, 0); - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - _vm->playGnapImpossible(0, 0); - break; - } - } - } else { - if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); - _vm->_gnapActionStatus = kASOpenTopValve; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 1, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 5); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BA, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASCloseTopValve; - } else - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - } - break; - - case kHSHydrantRightValve: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFUnk14)) { - if (_vm->_grabCursorSpriteIndex == -1) { - _vm->playGnapImpossible(0, 0); - } else { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); - } - } else { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } - if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); - if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnapActionStatus = kASOpenRightValveWithGarbageCan; - else - _vm->_gnapActionStatus = kASOpenRightValveNoGarbageCan; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 1, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 5); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnapActionStatus = kASCloseRightValveWithGarbageCan; - else - _vm->_gnapActionStatus = kASCloseRightValveNoGarbageCan; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - } - break; - - case kHSExitToyStore: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } - if (_vm->isFlag(kGFPictureTaken)) { - _vm->playGnapImpossible(0, 0); - } else { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 19; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStore].x, _vm->_hotspotsWalkPos[kHSExitToyStore].y, 0, 0x107C0, 1); - _vm->_gnapActionStatus = kASLeaveScene; - if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStore].x + 1, _vm->_hotspotsWalkPos[kHSExitToyStore].y, -1, 0x107C2, 1); - } - } - break; - - case kHSExitPhoneBooth: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } - closeHydrantValve(); - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 17; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPhoneBooth].x, _vm->_hotspotsWalkPos[kHSExitPhoneBooth].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _vm->setFlag(kGFUnk27); - else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPhoneBooth].x + 1, _vm->_hotspotsWalkPos[kHSExitPhoneBooth].y, -1, 0x107C2, 1); - } - break; - - case kHSExitGrubCity: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } - closeHydrantValve(); - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitGrubCity].x, _vm->_hotspotsWalkPos[kHSExitGrubCity].y, 0, 0x107B2, 1); - _vm->_gnapActionStatus = kASLeaveScene; - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) - platEndPhoning(false); - else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitGrubCity].x, _vm->_hotspotsWalkPos[kHSExitGrubCity].y - 1, -1, 0x107CF, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - _vm->_mouseClickState._left = false; - } - break; - - default: - if (_vm->_gnapActionStatus != kASStandingOnHydrant && _vm->_mouseClickState._left) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); - putDownGarbageCan(0); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if ((_vm->isFlag(kGFTruckFilledWithGas) || _vm->isFlag(kGFBarnPadlockOpen)) && !_vm->isSoundPlaying(0x22B) && - _vm->_gnapActionStatus != kASOpenRightValveNoGarbageCanDone && _vm->_gnapActionStatus != kASOpenRightValveNoGarbageCan && - _vm->_gnapActionStatus != kASOpenTopValve && _vm->_gnapActionStatus != kASOpenTopValveDone && - _vm->_gnapActionStatus != kASOpenRightValveWithGarbageCan && _vm->_gnapActionStatus != kASOpenRightValveWithGarbageCanDone) - _vm->playSound(0x22B, true); - - if (!_vm->_isLeavingScene) { - if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - if (_vm->_platypusActionStatus == kASPlatComesHere) { - if (!_vm->_timers[6]) { - _vm->_platypusActionStatus = -1; - _vm->_sceneWaiting = false; - _vm->initPlatypusPos(-1, 10, kDirNone); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); - _vm->clearFlag(kGFPlatypusTalkingToAssistant); - } - } else { - _vm->_hotspots[kHSWalkArea1]._y2 += 48; - _vm->_hotspots[kHSWalkArea2]._x1 += 75; - _vm->updatePlatypusIdleSequence(); - _vm->_hotspots[kHSWalkArea2]._x1 -= 75; - _vm->_hotspots[kHSWalkArea1]._y2 -= 48; - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0) { - if (_vm->getRandom(2) == 1) - _vm->_gameSys->insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); - } - } - _vm->playSoundA(); - } - if (!_vm->isFlag(kGFPlatyPussDisguised)) - _vm->updateGnapIdleSequence(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } - - if (_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->deleteSurface(&_s18_cowboyHatSurface); -} - -void Scene18::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASGrabGarbageCanFromStreet: - if (_vm->_gnapIdleFacing != kDirUpRight && _vm->_gnapIdleFacing != kDirBottomRight) { - _vm->_gameSys->insertSequence(0x1FC, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - 675, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FC; - } else { - _vm->_gameSys->insertSequence(0x1FD, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - 525, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FD; - } - _vm->_gameSys->removeSequence(0x1FA, 19, true); - _vm->setFlag(kGFPlatyPussDisguised); - updateHotspots(); - _vm->_gnapActionStatus = -1; - break; - case kASGrabGarbageCanFromHydrant: - _vm->_gameSys->insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x1F9, 19, true); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FE; - _vm->clearFlag(kGFTruckKeysUsed); - _vm->setFlag(kGFPlatyPussDisguised); - updateHotspots(); - _vm->_gnapActionStatus = -1; - break; - case kASCloseRightValveNoGarbageCan: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20D, 39, true); - _vm->_gameSys->removeSequence(0x212, 39, true); - _vm->_gameSys->removeSequence(0x211, 39, true); - _vm->stopSound(0x22B); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x205; - _vm->clearFlag(kGFTruckFilledWithGas); - _vm->invAdd(kItemWrench); - _vm->setGrabCursorSprite(kItemWrench); - updateHotspots(); - _vm->_gnapActionStatus = -1; - break; - case kASOpenTopValve: - _vm->setFlag(kGFBarnPadlockOpen); - updateHotspots(); - _vm->playGnapPullOutDevice(2, 7); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantTopValve].x, _vm->_hotspotsWalkPos[kHSHydrantTopValve].y, 0, 0x107BB, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASOpenTopValveDone; - break; - case kASOpenTopValveDone: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->removeSequence(0x20C, 19, true); - _vm->_gameSys->setAnimation(0x217, 39, 5); - _vm->_gameSys->insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) - _vm->gameUpdateTick(); - _vm->playSound(0x22B, true); - _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x208; - _vm->invRemove(kItemWrench); - _vm->setGrabCursorSprite(-1); - _vm->_gnapActionStatus = -1; - break; - case kASCloseTopValve: - _vm->_gameSys->insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20E, 39, true); - _vm->_gameSys->removeSequence(0x216, 39, true); - _vm->_gameSys->removeSequence(0x217, 39, true); - _vm->stopSound(0x22B); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x206; - _vm->clearFlag(kGFBarnPadlockOpen); - _vm->invAdd(kItemWrench); - _vm->setGrabCursorSprite(kItemWrench); - updateHotspots(); - _vm->_gnapActionStatus = -1; - break; - case kASGrabCowboyHat: - _vm->_gameSys->setAnimation(0x200, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x200; - _vm->_gnapActionStatus = kASGrabCowboyHatDone; - break; - case kASGrabCowboyHatDone: - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _s18_cowboyHatSurface = _vm->addFullScreenSprite(0x1D2, 255); - _vm->_gameSys->setAnimation(0x218, 256, 0); - _vm->_gameSys->insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->_newSceneNum = 18; - _vm->invAdd(kItemCowboyHat); - _vm->invAdd(kItemWrench); - _vm->setFlag(kGFGnapControlsToyUFO); - _vm->setFlag(kGFUnk14); - _vm->clearFlag(kGFTruckFilledWithGas); - _vm->setFlag(kGFTruckKeysUsed); - _vm->setFlag(kGFUnk14); // CHECKME - Set 2 times? - updateHotspots(); - _vm->_gnapActionStatus = kASLeaveScene; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - case kASPutGarbageCanOnRunningHydrant: - _vm->setFlag(kGFTruckKeysUsed); - _vm->clearFlag(kGFPlatyPussDisguised); - _vm->_gameSys->requestRemoveSequence(0x211, 39); - _vm->_gameSys->requestRemoveSequence(0x212, 39); - _vm->_gameSys->insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->stopSound(0x22B); - _vm->_gameSys->setAnimation(0x210, _vm->_gnapId, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x210; - _vm->_gnapActionStatus = kASPutGarbageCanOnRunningHydrant2; - break; - case kASPutGarbageCanOnRunningHydrant2: - _vm->playSound(0x22B, true); - _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FF; - _vm->_sceneWaiting = true; - _vm->_gnapActionStatus = kASStandingOnHydrant; - break; - case kASStandingOnHydrant: - _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - break; - case kASOpenRightValveNoGarbageCan: - case kASOpenRightValveWithGarbageCan: - _vm->setFlag(kGFTruckFilledWithGas); - updateHotspots(); - _vm->playGnapPullOutDevice(2, 7); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHydrantRightValve].x, _vm->_hotspotsWalkPos[kHSHydrantRightValve].y, 0, 0x107BA, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - if (_vm->_gnapActionStatus == kASOpenRightValveNoGarbageCan) - _vm->_gnapActionStatus = kASOpenRightValveNoGarbageCanDone; - else - _vm->_gnapActionStatus = kASOpenRightValveWithGarbageCanDone; - break; - case kASOpenRightValveWithGarbageCanDone: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->requestRemoveSequence(0x1F9, 19); - _vm->_gameSys->removeSequence(0x20B, 19, true); - _vm->_gameSys->setAnimation(0x213, 39, 5); - _vm->_gameSys->insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) - _vm->gameUpdateTick(); - _vm->playSound(555, true); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x207; - _vm->invRemove(kItemWrench); - _vm->_gnapActionStatus = -1; - break; - case kASOpenRightValveNoGarbageCanDone: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->removeSequence(0x20B, 19, true); - _vm->_gameSys->setAnimation(0x211, 39, 5); - _vm->_gameSys->insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) - _vm->gameUpdateTick(); - _vm->playSound(0x22B, true); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x207; - _vm->invRemove(kItemWrench); - _vm->_gnapActionStatus = -1; - break; - case kASCloseRightValveWithGarbageCan: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20D, 39, true); - _vm->_gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); - _vm->stopSound(0x22B); - _vm->_gameSys->setAnimation(0x1F9, 19, 0); - _vm->_gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); - _vm->clearFlag(kGFTruckFilledWithGas); - _vm->invAdd(kItemWrench); - _vm->setGrabCursorSprite(kItemWrench); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - updateHotspots(); - _vm->_gnapSequenceDatNum = 1; - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapActionStatus = kASCloseRightValveWithGarbageCanDone; - break; - case kASCloseRightValveWithGarbageCanDone: - _vm->_gnapActionStatus = -1; - break; - case kASPutGarbageCanOnHydrant: - _vm->setFlag(kGFTruckKeysUsed); - _vm->clearFlag(kGFPlatyPussDisguised); - _vm->_gameSys->insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x20F, _vm->_gnapId, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x20F; - _vm->_gnapActionStatus = kASPutGarbageCanOnHydrantDone; - break; - case kASPutGarbageCanOnHydrantDone: - _vm->_gameSys->insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); - updateHotspots(); - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 3); - ++_s18_platPhoneIter; - if (_s18_platPhoneIter <= 4) { - ++_s18_platPhoneCtr; - _s18_nextPhoneSequenceId = kScene18SequenceIds[_s18_platPhoneCtr % 5]; - _vm->_gameSys->setAnimation(_s18_nextPhoneSequenceId, 254, 3); - _vm->_gameSys->insertSequence(_s18_nextPhoneSequenceId, 254, _s18_currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); - _s18_currPhoneSequenceId = _s18_nextPhoneSequenceId; - } else { - platEndPhoning(true); - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene18.h b/engines/gnap/scenes/scene18.h deleted file mode 100644 index 163a8cd751..0000000000 --- a/engines/gnap/scenes/scene18.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE18_H -#define GNAP_SCENE18_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene18: public Scene { -public: - Scene18(GnapEngine *vm); - ~Scene18(); - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - Graphics::Surface *_s18_cowboyHatSurface; - - int _s18_platPhoneCtr; - int _s18_platPhoneIter; - int _s18_nextPhoneSequenceId; - int _s18_currPhoneSequenceId; - - void gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5); - void putDownGarbageCan(int animationIndex); - void platEndPhoning(bool platFl); - void closeHydrantValve(); - void waitForGnapAction(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE18_H diff --git a/engines/gnap/scenes/scene19.cpp b/engines/gnap/scenes/scene19.cpp deleted file mode 100644 index cb5cd6d16d..0000000000 --- a/engines/gnap/scenes/scene19.cpp +++ /dev/null @@ -1,475 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene19.h" - -namespace Gnap { - -static const int kS19ShopAssistantSequenceIds[] = { - 0x6F, 0x70, 0x71, 0x72, 0x73 -}; - -enum { - kHSPlatypus = 0, - kHSExitOutsideToyStore = 1, - kHSDevice = 2, - kHSPicture = 3, - kHSShopAssistant = 4, - kHSToy1 = 5, - kHSToy2 = 6, - kHSToy3 = 7, - kHSPhone = 8, - kHSToy4 = 9, - kHSToy5 = 10, - kHSToy6 = 11, - kHSToy7 = 12, - kHSWalkArea1 = 13, - kHSWalkArea2 = 14, - kHSWalkArea3 = 15 -}; - -enum { - kASUsePhone = 0, - kASGrabToy = 1, - kASGrabPicture = 2, - kASGrabPictureDone = 3, - kASTalkShopAssistant = 4, - kASLeaveScene = 5 -}; - -Scene19::Scene19(GnapEngine *vm) : Scene(vm) { - _s19_toyGrabCtr = 0; - _s19_pictureSurface = 0; - _s19_shopAssistantCtr = 0; - _s19_pictureSurface = nullptr; -} - -Scene19::~Scene19() { - delete _s19_pictureSurface; -} - -int Scene19::init() { - _vm->playSound(0x79, false); - return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x77 : 0x76; -} - -void Scene19::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitOutsideToyStore, 36, 154, 142, 338, SF_EXIT_NW_CURSOR, 4, 6); - _vm->setHotspot(kHSPicture, 471, 237, 525, 283, SF_DISABLED, 7, 2); - _vm->setHotspot(kHSShopAssistant, 411, 151, 575, 279, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - _vm->setHotspot(kHSPhone, 647, 166, 693, 234, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); - _vm->setHotspot(kHSToy1, 181, 11, 319, 149, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 0); - _vm->setHotspot(kHSToy2, 284, 85, 611, 216, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 0); - _vm->setHotspot(kHSToy3, 666, 38, 755, 154, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 0); - _vm->setHotspot(kHSToy4, 154, 206, 285, 327, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 3); - _vm->setHotspot(kHSToy5, 494, 301, 570, 448, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 5); - _vm->setHotspot(kHSToy6, 0, 320, 188, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 6); - _vm->setHotspot(kHSToy7, 597, 434, 800, 600, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 170, 600); - _vm->setHotspot(kHSWalkArea2, 622, 0, 800, 600); - _vm->setHotspot(kHSWalkArea3, 0, 0, 800, 437); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->_hotspots[kHSToy1]._flags = SF_DISABLED; - _vm->_hotspots[kHSToy2]._flags = SF_DISABLED; - _vm->_hotspots[kHSToy3]._flags = SF_DISABLED; - _vm->_hotspots[kHSToy4]._flags = SF_DISABLED; - _vm->_hotspots[kHSToy5]._flags = SF_DISABLED; - _vm->_hotspots[kHSToy6]._flags = SF_DISABLED; - _vm->_hotspots[kHSToy7]._flags = SF_DISABLED; - _vm->_hotspots[kHSShopAssistant]._flags = SF_DISABLED; - _vm->_hotspots[kHSPhone]._flags = SF_DISABLED; - _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; - _vm->_hotspots[kHSPicture]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - } - _vm->_hotspotsCount = 16; -} - -void Scene19::run() { - _vm->queueInsertDeviceIcon(); - - _s19_toyGrabCtr = 0; - _s19_pictureSurface = 0; - - _vm->_gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFPictureTaken)) - _vm->_gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->initGnapPos(3, 6, kDirBottomRight); - _s19_currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; - _s19_nextShopAssistantSequenceId = _s19_currShopAssistantSequenceId; - _vm->_gameSys->setAnimation(_s19_currShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); - _s19_shopAssistantCtr = 0; - _vm->endSceneInit(); - _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); - updateHotspots(); - } else { - _s19_currShopAssistantSequenceId = 0x6D; - _s19_nextShopAssistantSequenceId = -1; - _vm->_gameSys->setAnimation(0x6D, 20, 4); - _vm->_gameSys->insertSequence(_s19_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[6] = _vm->getRandom(40) + 50; - _vm->initGnapPos(3, 6, kDirBottomRight); - _vm->initPlatypusPos(4, 6, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 5, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideToyStore: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 18; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107B2, 1); - _vm->_gnapActionStatus = kASLeaveScene; - if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _vm->setFlag(kGFUnk27); - else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x + 1, _vm->_hotspotsWalkPos[1].y, -1, 0x107C5, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - } - break; - - case kHSPicture: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 2); - break; - case GRAB_CURSOR: - if (!_vm->isFlag(kGFPictureTaken)) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabPicture; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSShopAssistant: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 2); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkShopAssistant; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSToy1: - case kHSToy2: - case kHSToy3: - case kHSToy4: - case kHSToy5: - case kHSToy6: - case kHSToy7: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); - _vm->_gnapActionStatus = kASGrabToy; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSPhone: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 1); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); - _vm->playGnapIdle(8, 2); - _vm->_gnapActionStatus = kASUsePhone; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = 0; - } - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updateGnapIdleSequence(); - if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->updatePlatypusIdleSequence(); - if (!_vm->_timers[6] && _s19_nextShopAssistantSequenceId == -1) { - _vm->_timers[6] = _vm->getRandom(40) + 50; - if (_vm->getRandom(4) != 0) { - _s19_nextShopAssistantSequenceId = 0x64; - } else if (_vm->isFlag(kGFPictureTaken)) { - _s19_nextShopAssistantSequenceId = 0x64; - } else { - _s19_nextShopAssistantSequenceId = 0x6C; - } - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } - - if (_s19_pictureSurface) - _vm->deleteSurface(&_s19_pictureSurface); -} - -void Scene19::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASUsePhone: - _s19_nextShopAssistantSequenceId = 0x67; - break; - case kASGrabToy: - ++_s19_toyGrabCtr; - switch (_s19_toyGrabCtr) { - case 1: - _s19_nextShopAssistantSequenceId = 0x62; - break; - case 2: - _s19_nextShopAssistantSequenceId = 0x6B; - break; - case 3: - _s19_nextShopAssistantSequenceId = 0x66; - break; - default: - _s19_nextShopAssistantSequenceId = 0x65; - break; - } - break; - case kASGrabPicture: - _vm->playGnapPullOutDevice(6, 2); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x68, 19, 0); - _vm->_gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); - _vm->invAdd(kItemPicture); - _vm->setFlag(kGFPictureTaken); - updateHotspots(); - _vm->_gnapActionStatus = kASGrabPictureDone; - break; - case kASGrabPictureDone: - _vm->setGrabCursorSprite(-1); - _vm->hideCursor(); - _s19_pictureSurface = _vm->addFullScreenSprite(0xF, 255); - _vm->_gameSys->setAnimation(0x61, 256, 0); - _vm->_gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _vm->setFlag(kGFUnk27); - _vm->showCursor(); - _vm->_newSceneNum = 17; - _vm->_isLeavingScene = true; - _vm->_sceneDone = true; - _s19_nextShopAssistantSequenceId = -1; - break; - case kASTalkShopAssistant: - _s19_nextShopAssistantSequenceId = 0x6D; - _vm->_gnapActionStatus = -1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - switch (_s19_nextShopAssistantSequenceId) { - case 0x6F: - case 0x70: - case 0x71: - case 0x72: - case 0x73: - _s19_shopAssistantCtr = (_s19_shopAssistantCtr + 1) % 5; - _s19_nextShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_s19_shopAssistantCtr]; - _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); - _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; - break; - case 0x62: - case 0x66: - case 0x6B: - _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; - _s19_nextShopAssistantSequenceId = -1; - _vm->_timers[5] = 10; - while (_vm->_timers[5]) { - _vm->gameUpdateTick(); - } - _vm->playGnapIdle(6, 2); - _vm->_gnapActionStatus = -1; - break; - case 0x67: - _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; - _s19_nextShopAssistantSequenceId = -1; - _vm->_gnapActionStatus = -1; - break; - case 0x65: - _vm->playGnapIdle(6, 2); - _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 0); - _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; - _s19_nextShopAssistantSequenceId = -1; - _vm->_newSceneNum = 18; - _vm->_gnapActionStatus = kASLeaveScene; - break; - case 0x6D: - _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_s19_nextShopAssistantSequenceId), 0, 0); - _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; - _s19_nextShopAssistantSequenceId = -1; - break; - case 0x64: - case 0x6C: - _vm->_gameSys->setAnimation(_s19_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_s19_nextShopAssistantSequenceId, 20, _s19_currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s19_currShopAssistantSequenceId = _s19_nextShopAssistantSequenceId; - _s19_nextShopAssistantSequenceId = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene19.h b/engines/gnap/scenes/scene19.h deleted file mode 100644 index 721b107cf5..0000000000 --- a/engines/gnap/scenes/scene19.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE19_H -#define GNAP_SCENE19_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene19: public Scene { -public: - Scene19(GnapEngine *vm); - ~Scene19(); - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s19_currShopAssistantSequenceId; - int _s19_nextShopAssistantSequenceId; - int _s19_toyGrabCtr; - int _s19_shopAssistantCtr; - - Graphics::Surface *_s19_pictureSurface; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE19_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 567270a1db..6f6a922a9b 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -27,17 +27,9 @@ #include "gnap/scenes/scenecore.h" #include "gnap/scenes/groupcs.h" #include "gnap/scenes/group0.h" +#include "gnap/scenes/group1.h" #include "gnap/scenes/intro.h" -#include "gnap/scenes/scene10.h" -#include "gnap/scenes/scene11.h" -#include "gnap/scenes/scene12.h" -#include "gnap/scenes/scene13.h" -#include "gnap/scenes/scene14.h" -#include "gnap/scenes/scene15.h" -#include "gnap/scenes/scene17.h" -#include "gnap/scenes/scene18.h" -#include "gnap/scenes/scene19.h" #include "gnap/scenes/scene20.h" #include "gnap/scenes/scene21.h" #include "gnap/scenes/scene22.h" -- cgit v1.2.3 From 4edfe094ea91c4a05a71613fc398d1b32851713f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 27 Apr 2016 23:04:00 +0200 Subject: GNAP: renaming and grouping of scenes in group 2 --- engines/gnap/module.mk | 11 +- engines/gnap/scenes/group2.cpp | 3549 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group2.h | 211 +++ engines/gnap/scenes/scene20.cpp | 732 -------- engines/gnap/scenes/scene20.h | 57 - engines/gnap/scenes/scene21.cpp | 344 ---- engines/gnap/scenes/scene21.h | 50 - engines/gnap/scenes/scene22.cpp | 292 --- engines/gnap/scenes/scene22.h | 52 - engines/gnap/scenes/scene23.cpp | 295 --- engines/gnap/scenes/scene23.h | 50 - engines/gnap/scenes/scene24.cpp | 262 --- engines/gnap/scenes/scene24.h | 52 - engines/gnap/scenes/scene25.cpp | 397 ----- engines/gnap/scenes/scene25.h | 52 - engines/gnap/scenes/scene26.cpp | 255 --- engines/gnap/scenes/scene26.h | 50 - engines/gnap/scenes/scene27.cpp | 421 ----- engines/gnap/scenes/scene27.h | 50 - engines/gnap/scenes/scene28.cpp | 448 ----- engines/gnap/scenes/scene28.h | 51 - engines/gnap/scenes/scene29.cpp | 358 ---- engines/gnap/scenes/scene29.h | 52 - engines/gnap/scenes/scenecore.cpp | 11 +- 24 files changed, 3762 insertions(+), 4340 deletions(-) create mode 100644 engines/gnap/scenes/group2.cpp create mode 100644 engines/gnap/scenes/group2.h delete mode 100644 engines/gnap/scenes/scene20.cpp delete mode 100644 engines/gnap/scenes/scene20.h delete mode 100644 engines/gnap/scenes/scene21.cpp delete mode 100644 engines/gnap/scenes/scene21.h delete mode 100644 engines/gnap/scenes/scene22.cpp delete mode 100644 engines/gnap/scenes/scene22.h delete mode 100644 engines/gnap/scenes/scene23.cpp delete mode 100644 engines/gnap/scenes/scene23.h delete mode 100644 engines/gnap/scenes/scene24.cpp delete mode 100644 engines/gnap/scenes/scene24.h delete mode 100644 engines/gnap/scenes/scene25.cpp delete mode 100644 engines/gnap/scenes/scene25.h delete mode 100644 engines/gnap/scenes/scene26.cpp delete mode 100644 engines/gnap/scenes/scene26.h delete mode 100644 engines/gnap/scenes/scene27.cpp delete mode 100644 engines/gnap/scenes/scene27.h delete mode 100644 engines/gnap/scenes/scene28.cpp delete mode 100644 engines/gnap/scenes/scene28.h delete mode 100644 engines/gnap/scenes/scene29.cpp delete mode 100644 engines/gnap/scenes/scene29.h diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 17dfad4aac..52d6a5a4d4 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -13,17 +13,8 @@ MODULE_OBJS := \ scenes/groupcs.o \ scenes/group0.o \ scenes/group1.o \ + scenes/group2.o \ scenes/intro.o \ - scenes/scene20.o \ - scenes/scene21.o \ - scenes/scene22.o \ - scenes/scene23.o \ - scenes/scene24.o \ - scenes/scene25.o \ - scenes/scene26.o \ - scenes/scene27.o \ - scenes/scene28.o \ - scenes/scene29.o \ scenes/scene30.o \ scenes/scene31.o \ scenes/scene32.o \ diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp new file mode 100644 index 0000000000..0a89b83dc5 --- /dev/null +++ b/engines/gnap/scenes/group2.cpp @@ -0,0 +1,3549 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/group2.h" + +namespace Gnap { + +enum { + kHS20Platypus = 0, + kHS20GroceryStoreHat = 1, + kHS20ExitParkingLot = 2, + kHS20StonerGuy = 3, + kHS20GroceryStoreGuy = 4, + kHS20Device = 5, + kHS20ExitInsideGrubCity = 6, + kHS20ExitOutsideCircusWorld = 7, + kHS20ExitOutsideToyStore = 8, + kHS20ExitPhone = 9, + kHS20WalkArea1 = 10, + kHS20WalkArea2 = 11 +}; + +enum { + kAS20LeaveScene = 0, + kAS20TalkStonerGuyNoJoint = 2, + kAS20TalkStonerGuyHasJoint = 3, + kAS20GrabJoint = 4, + kAS20ActionDone = 5, + kAS20TalkGroceryStoreGuy = 6, + kAS20GrabGroceryStoreGuy = 9, + kAS20GrabGroceryStoreHat = 10, + kAS20SwitchGroceryStoreHat = 11, + kAS20SwitchGroceryStoreHatDone = 12, + kAS20GrabJointDone = 13 +}; + +Scene20::Scene20(GnapEngine *vm) : Scene(vm) { + _stonerGuyCtr = 3; + _stonerGuyShowingJoint = false; + _groceryStoreGuyCtr = 0; +} + +int Scene20::init() { + return 0x186; +} + +void Scene20::updateHotspots() { + _vm->setHotspot(kHS20Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS20GroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); + _vm->setHotspot(kHS20ExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + _vm->setHotspot(kHS20StonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHS20GroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS20ExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); + _vm->setHotspot(kHS20ExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); + _vm->setHotspot(kHS20ExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); + _vm->setHotspot(kHS20ExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHS20WalkArea1, 0, 0, 800, 468); + _vm->setHotspot(kHS20WalkArea2, 605, 0, 800, 600); + _vm->setDeviceHotspot(kHS20Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 12; +} + +void Scene20::updateAnimationsCb() { + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + switch (_nextStonerGuySequenceId) { + case 0x16B: + if (!_vm->_timers[4]) { + _stonerGuyShowingJoint = false; + _vm->_gameSys->insertSequence(0x16B, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16B; + _nextStonerGuySequenceId = -1; + } + break; + case 0x16A: + // Grab joint + _vm->playGnapPullOutDevice(4, 4); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x16A, 21, 0); + _vm->_gameSys->insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16A; + _nextStonerGuySequenceId = -1; + _vm->invAdd(kItemJoint); + _vm->setFlag(kGFJointTaken); + _stonerGuyShowingJoint = false; + _vm->_gnapActionStatus = kAS20GrabJointDone; + break; + case 0x16E: + _vm->_gameSys->setAnimation(0x16E, 21, 2); + _vm->_gameSys->insertSequence(0x16E, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16E; + _nextStonerGuySequenceId = -1; + _nextGroceryStoreGuySequenceId = 0x175; + break; + case 0x16D: + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 0); + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + _vm->_gnapActionStatus = kAS20ActionDone; + break; + case 0x16F: + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + _vm->_gameSys->setAnimation(0x17A, 20, 3); + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17A, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = 0x17A; + _nextGroceryStoreGuySequenceId = -1; + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + break; + case 0x171: + _stonerGuyCtr = (_stonerGuyCtr + 1) % 3; + switch (_stonerGuyCtr) { + case 1: + _nextStonerGuySequenceId = 0x171; + break; + case 2: + _nextStonerGuySequenceId = 0x172; + break; + case 3: + _nextStonerGuySequenceId = 0x173; + break; + default: + _nextStonerGuySequenceId = 0x171; + break; + } + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17C, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + _currGroceryStoreGuySequenceId = 0x17C; + _nextGroceryStoreGuySequenceId = -1; + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + break; + default: + _nextStonerGuySequenceId = 0x16C; + _vm->_gameSys->setAnimation(0x16C, 21, 2); + _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = _nextStonerGuySequenceId; + _nextStonerGuySequenceId = -1; + break; + } + } +} + +void Scene20::stopSounds() { + _vm->stopSound(0x18E); + _vm->stopSound(0x18F); + _vm->stopSound(0x190); + _vm->stopSound(0x191); + _vm->stopSound(0x194); + _vm->stopSound(0x195); + _vm->stopSound(0x192); + _vm->stopSound(0x193); + _vm->stopSound(0x196); + _vm->stopSound(0x197); + _vm->stopSound(0x198); + _vm->stopSound(0x199); + _vm->stopSound(0x19A); +} + +void Scene20::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(8); + + _stonerGuyShowingJoint = false; + _vm->_timers[7] = _vm->getRandom(100) + 100; + + _stonerGuyCtr = (_stonerGuyCtr + 1) % 3; + switch (_stonerGuyCtr) { + case 1: + _currStonerGuySequenceId = 0x171; + break; + case 2: + _currStonerGuySequenceId = 0x172; + break; + case 3: + _currStonerGuySequenceId = 0x173; + break; + } + + _nextStonerGuySequenceId = -1; + _vm->_gameSys->setAnimation(_currStonerGuySequenceId, 21, 2); + _vm->_gameSys->insertSequence(_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[6] = _vm->getRandom(20) + 30; + + _currGroceryStoreGuySequenceId = 0x17C; + _nextGroceryStoreGuySequenceId = -1; + _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFSceneFlag1)) { + _vm->clearFlag(kGFSceneFlag1); + _vm->endSceneInit(); + _vm->_gameSys->setAnimation(0x182, 140, 0); + _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + } else { + switch (_vm->_prevSceneNum) { + case 17: + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + break; + case 18: + _vm->initGnapPos(11, 8, kDirBottomLeft); + _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + break; + case 21: + _vm->initGnapPos(-1, 8, kDirBottomLeft); + _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + break; + case 22: + _vm->initGnapPos(7, 6, kDirBottomRight); + _vm->initPlatypusPos(8, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + break; + default: + _vm->initGnapPos(8, 6, kDirBottomLeft); + _vm->initPlatypusPos(9, 6, kDirUnk4); + _vm->endSceneInit(); + _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; + break; + } + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + _vm->testWalk(0, 1, 7, 9, 8, 9); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS20Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS20Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(20); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20ExitParkingLot: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 21; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y + 1, -1, 0x107CF, 1); + _vm->_platypusFacing = kDirUnk4; + } + break; + + case kHS20ExitPhone: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 17; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x + 1, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, -1, 0x107C2, 1); + } + break; + + case kHS20ExitOutsideToyStore: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 18; + _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y + 1, -1, 0x107CD, 1); + _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; + } + break; + + case kHS20ExitInsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 22; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y - 1, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y, -1, 0x107C2, 1); + _vm->_platypusFacing = kDirUnk4; + } + break; + + case kHS20ExitOutsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + if (_stonerGuyShowingJoint) + _vm->_timers[4] = 0; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 24; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHS20StonerGuy: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(5, 4); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + if (_stonerGuyShowingJoint) + _vm->_gnapActionStatus = kAS20GrabJoint; + else + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + if (_vm->isFlag(kGFJointTaken)) + _vm->_gnapActionStatus = kAS20TalkStonerGuyNoJoint; + else + _vm->_gnapActionStatus = kAS20TalkStonerGuyHasJoint; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20GroceryStoreGuy: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 3); + break; + case GRAB_CURSOR: + _stonerGuyShowingJoint = false; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20GrabGroceryStoreGuy; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20TalkGroceryStoreGuy; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20GroceryStoreHat: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHat; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(1, 6); + break; + case GRAB_CURSOR: + _stonerGuyShowingJoint = false; + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS20GrabGroceryStoreHat; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS20WalkArea1: + case kHS20WalkArea2: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) { + _vm->_hotspots[kHS20WalkArea1]._y2 += 48; + _vm->updatePlatypusIdleSequence(); + _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; + } + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { + _vm->_timers[5] = _vm->getRandom(50) + 130; + if (_vm->getRandom(4) != 0) + _nextGroceryStoreGuySequenceId = 0x17C; + else + _nextGroceryStoreGuySequenceId = 0x17A; + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + switch (_vm->getRandom(3)) { + case 0: + _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + } + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene20::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS20LeaveScene: + _vm->_sceneDone = true; + break; + case kAS20TalkStonerGuyNoJoint: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = 0x16E; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; + break; + case kAS20TalkStonerGuyHasJoint: + _vm->_gameSys->setAnimation(0x168, 21, 2); + _vm->_gameSys->setAnimation(379, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x168; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = 0x16B; + _vm->_timers[5] = 200; + _vm->_timers[6] = 200; + _vm->_timers[4] = 100; + _stonerGuyShowingJoint = true; + _vm->_gnapActionStatus = -1; + break; + case kAS20GrabJoint: + _nextStonerGuySequenceId = 0x16A; + break; + case kAS20ActionDone: + _vm->_gnapActionStatus = -1; + break; + case kAS20TalkGroceryStoreGuy: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _groceryStoreGuyCtr = (_groceryStoreGuyCtr + 1) % 2; + if (_groceryStoreGuyCtr != 0) + _nextGroceryStoreGuySequenceId = 0x176; + else + _nextGroceryStoreGuySequenceId = 0x177; + _vm->_timers[5] = 100; + _vm->_timers[6] = 100; + break; + case kAS20GrabGroceryStoreGuy: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _vm->_timers[5] = 120; + _vm->_timers[6] = 120; + _nextGroceryStoreGuySequenceId = 0x178; + break; + case kAS20GrabGroceryStoreHat: + _vm->_gameSys->setAnimation(0x170, 21, 2); + _vm->_gameSys->setAnimation(0x17B, 20, 3); + _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _vm->stopSound(0x1A1); + stopSounds(); + _currGroceryStoreGuySequenceId = 0x17B; + _currStonerGuySequenceId = 0x170; + _nextGroceryStoreGuySequenceId = 0x179; + break; + case kAS20SwitchGroceryStoreHat: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x180; + _vm->_gnapSequenceDatNum = 0; + _vm->invRemove(kItemCowboyHat); + _vm->invAdd(kItemGroceryStoreHat); + _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHatDone; + break; + case kAS20SwitchGroceryStoreHatDone: + _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFGroceryStoreHatTaken); + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0x12C, 255); + _vm->_gameSys->setAnimation(0x181, 256, 0); + _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemGroceryStoreHat); + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = -1; + break; + case kAS20GrabJointDone: + _vm->setGrabCursorSprite(kItemJoint); + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextGroceryStoreGuySequenceId) { + case 0x176: + case 0x177: + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = 0x16D; + break; + case 0x178: + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17D; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16D; + _currGroceryStoreGuySequenceId = 0x178; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = -1; + break; + case 0x179: + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->setAnimation(0x16D, 21, 0); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x17E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gameSys->setAnimation(0x16D, 21, 2); + _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currStonerGuySequenceId = 0x16D; + _currGroceryStoreGuySequenceId = 377; + _nextGroceryStoreGuySequenceId = -1; + _nextStonerGuySequenceId = -1; + _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); + break; + case 0x17C: + _vm->_gameSys->setAnimation(0, 0, 3); + _nextStonerGuySequenceId = 0x171; + break; + case 0x17A: + _vm->_gameSys->setAnimation(0, 0, 3); + _nextStonerGuySequenceId = 0x16F; + break; + case 0x175: + _vm->_gameSys->setAnimation(0x175, 20, 0); + _vm->_gameSys->setAnimation(0x175, 20, 3); + _vm->_gameSys->insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = 0x175; + _nextGroceryStoreGuySequenceId = -1; + _vm->_gnapActionStatus = kAS20ActionDone; + break; + default: + if (_nextGroceryStoreGuySequenceId != -1) { + _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; + _nextGroceryStoreGuySequenceId = -1; + } + break; + } + } + + updateAnimationsCb(); +} + +/*****************************************************************************/ + +enum { + kHS21Platypus = 0, + kHS21Banana = 1, + kHS21OldLady = 2, + kHS21Device = 3, + kHS21ExitOutsideGrubCity = 4, + kHS21WalkArea1 = 5, + kHS21WalkArea2 = 6 +}; + +enum { + kAS21TalkOldLady = 0, + kAS21GrabBanana = 1, + kAS21GrabBananaDone = 2, + kAS21GrabOldLady = 3, + kAS21UseHatWithOldLady = 4, + kAS21UseHatWithOldLadyDone = 5, + kAS21LeaveScene = 6 +}; + +Scene21::Scene21(GnapEngine *vm) : Scene(vm) { + _currOldLadySequenceId = -1; + _nextOldLadySequenceId = -1; +} + +int Scene21::init() { + _vm->_gameSys->setAnimation(0, 0, 3); + return _vm->isFlag(kGFTwigTaken) ? 0x94 : 0x93; +} + +void Scene21::updateHotspots() { + _vm->setHotspot(kHS21Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS21Banana, 94, 394, 146, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 6); + _vm->setHotspot(kHS21OldLady, 402, 220, 528, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS21ExitOutsideGrubCity, 522, 498, 800, 600, SF_EXIT_SE_CURSOR | SF_WALKABLE, 5, 10); + _vm->setHotspot(kHS21WalkArea1, 0, 0, 800, 440); + _vm->setHotspot(kHS21WalkArea2, 698, 0, 800, 600); + _vm->setDeviceHotspot(kHS21Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk04) || !_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHS21Banana]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->isFlag(kGFTwigTaken)) + _vm->_hotspots[kHS21OldLady]._flags = SF_DISABLED; + _vm->_hotspotsCount = 7; +} + +void Scene21::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(6); + + _vm->_timers[5] = _vm->getRandom(100) + 100; + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFTwigTaken)) { + if (_vm->isFlag(kGFKeysTaken)) { + _vm->initGnapPos(5, 8, kDirBottomRight); + _vm->initPlatypusPos(6, 8, kDirNone); + _vm->_gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->clearFlag(kGFKeysTaken); + } else { + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + if (!_vm->isFlag(kGFUnk04)) + _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + } else { + _vm->initGnapPos(5, 11, kDirBottomRight); + _vm->initPlatypusPos(6, 11, kDirNone); + _currOldLadySequenceId = 0x89; + _vm->_gameSys->setAnimation(0x89, 79, 3); + _vm->_gameSys->insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); + _nextOldLadySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(30) + 50; + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS21Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS21Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS21Banana: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 5); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); + _vm->playGnapPullOutDevice(2, 5); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kAS21GrabBanana; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + break; + } + } + } + break; + + case kHS21OldLady: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { + _vm->_newSceneNum = 47; + _vm->gnapWalkTo(4, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS21UseHatWithOldLady; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 6, 7, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(7, 4); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS21GrabOldLady; + _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady].x, _vm->_hotspotsWalkPos[kHS21OldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS21TalkOldLady; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS21ExitOutsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, 0, 0x107B3, 1); + _vm->_gnapActionStatus = kAS21LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, -1, 0x107C2, 1); + } + break; + + case kHS21WalkArea1: + case kHS21WalkArea2: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(30) + 50; + switch (_vm->getRandom(5)) { + case 0: + _nextOldLadySequenceId = 0x88; + break; + case 1: + _nextOldLadySequenceId = 0x8A; + break; + default: + _nextOldLadySequenceId = 0x89; + break; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 100; + _vm->_gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene21::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS21TalkOldLady: + _nextOldLadySequenceId = 0x8B; + _vm->_gnapActionStatus = -1; + break; + case kAS21GrabBanana: + _vm->_gameSys->setAnimation(0x8C, 59, 0); + _vm->_gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFUnk04); + _vm->invAdd(kItemBanana); + updateHotspots(); + _vm->_gnapActionStatus = kAS21GrabBananaDone; + break; + case kAS21GrabBananaDone: + _vm->setGrabCursorSprite(kItemBanana); + _vm->_gnapActionStatus = -1; + break; + case kAS21GrabOldLady: + _vm->_timers[4] = _vm->getRandom(30) + 50; + _nextOldLadySequenceId = 0x87; + break; + case kAS21UseHatWithOldLady: + _vm->_gameSys->setAnimation(0x8F, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x8F; + _vm->_gnapActionStatus = kAS21UseHatWithOldLadyDone; + _vm->invAdd(kItemTickets); + _vm->invRemove(kItemGroceryStoreHat); + _vm->setGrabCursorSprite(-1); + break; + case kAS21UseHatWithOldLadyDone: + _nextOldLadySequenceId = 0x91; + break; + case kAS21LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextOldLadySequenceId != -1) { + if (_nextOldLadySequenceId == 0x87) { + _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); + _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x86; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = -1; + _currOldLadySequenceId = _nextOldLadySequenceId; + _nextOldLadySequenceId = -1; + } else if (_nextOldLadySequenceId == 0x91) { + _vm->_gameSys->setAnimation(0x91, 79, 0); + _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS21LeaveScene; + _currOldLadySequenceId = _nextOldLadySequenceId; + _nextOldLadySequenceId = -1; + } else { + _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); + _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + _currOldLadySequenceId = _nextOldLadySequenceId; + _nextOldLadySequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS22Platypus = 0, + kHS22ExitOutsideGrubCity = 1, + kHS22ExitBackGrubCity = 2, + kHS22Cashier = 3, + kHS22Device = 4, + kHS22WalkArea1 = 5, + kHS22WalkArea2 = 6 +}; + +enum { + kAS22LeaveScene = 0, + kAS22TalkCashier = 1 +}; + +Scene22::Scene22(GnapEngine *vm) : Scene(vm) { + _caughtBefore = false; + _cashierCtr = 3; +} + +int Scene22::init() { + return 0x5E; +} + +void Scene22::updateHotspots() { + _vm->setHotspot(kHS22Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS22ExitOutsideGrubCity, 0, 180, 184, 472, SF_EXIT_L_CURSOR, 3, 6); + _vm->setHotspot(kHS22ExitBackGrubCity, 785, 405, 800, 585, SF_EXIT_R_CURSOR, 11, 9); + _vm->setHotspot(kHS22Cashier, 578, 230, 660, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHS22WalkArea1, 553, 0, 800, 542); + _vm->setHotspot(kHS22WalkArea2, 0, 0, 552, 488); + _vm->setDeviceHotspot(kHS22Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene22::run() { + _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); + + _currCashierSequenceId = 0x59; + _nextCashierSequenceId = -1; + + _vm->_gameSys->setAnimation(0x59, 1, 3); + _vm->_gameSys->insertSequence(_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[6] = _vm->getRandom(30) + 20; + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(2, 8, kDirBottomRight); + _vm->initPlatypusPos(1, 8, kDirNone); + _vm->endSceneInit(); + } else { + _vm->initGnapPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); + _vm->initPlatypusPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); + } + + if (_vm->isFlag(kGFSceneFlag1)) { + int storeDetectiveSeqId; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemCereals); + if (_caughtBefore) { + switch (_vm->getRandom(3)) { + case 0: + storeDetectiveSeqId = 0x55; + break; + case 1: + storeDetectiveSeqId = 0x56; + break; + default: + storeDetectiveSeqId = 0x57; + break; + } + } else { + _caughtBefore = true; + storeDetectiveSeqId = 0x54; + } + _vm->_gameSys->waitForUpdate(); + _vm->_gameSys->requestClear1(); + _vm->_gameSys->drawSpriteToBackground(0, 0, 0x44); + _vm->_gameSys->setAnimation(storeDetectiveSeqId, 256, 4); + _vm->_gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(4) != 2) { + _vm->gameUpdateTick(); + } + _vm->_sceneDone = true; + _vm->_newSceneNum = 20; + _caughtBefore = true; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS22Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS22Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS22ExitOutsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS22LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); + } + break; + + case kHS22ExitBackGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 23; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS22LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, -1, 0x107C2, 1); + } + break; + + case kHS22Cashier: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 4); + break; + case GRAB_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, + 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS22TalkCashier; + break; + case PLAT_CURSOR: + _vm->gnapUseDeviceOnPlatypuss(); + break; + } + } + } + break; + + case kHS22WalkArea1: + case kHS22WalkArea2: + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[6] && _nextCashierSequenceId == -1) { + _vm->_timers[6] = _vm->getRandom(30) + 20; + if (_vm->getRandom(8) != 0) { + _nextCashierSequenceId = 0x59; + } else { + _cashierCtr = (_cashierCtr + 1) % 3; + switch (_cashierCtr) { + case 1: + _nextCashierSequenceId = 0x58; + break; + case 2: + _nextCashierSequenceId = 0x5A; + break; + case 3: + _nextCashierSequenceId = 0x5B; + break; + default: + _nextCashierSequenceId = 0x58; + break; + } + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 400; + _vm->_timers[1] = _vm->getRandom(20) + 30; + _vm->_timers[0] = _vm->getRandom(75) + 75; + } + + _vm->gameUpdateTick(); + } +} + +void Scene22::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS22LeaveScene: + _vm->_sceneDone = true; + break; + case kAS22TalkCashier: + _nextCashierSequenceId = 0x5C; + break; + } + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextCashierSequenceId, 1, 3); + _vm->_gameSys->insertSequence(_nextCashierSequenceId, 1, _currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _currCashierSequenceId = _nextCashierSequenceId; + _nextCashierSequenceId = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS23Platypus = 0, + kHS23ExitFrontGrubCity = 1, + kHS23Device = 2, + kHS23Cereals = 3, + kHS23WalkArea1 = 4, + kHS23WalkArea2 = 5 +}; + +enum { + kAS23LookCereals = 0, + kAS23GrabCereals = 1, + kAS23GrabCerealsDone = 2, + kAS23LeaveScene = 3 +}; + +Scene23::Scene23(GnapEngine *vm) : Scene(vm) { + _currStoreClerkSequenceId = -1; + _nextStoreClerkSequenceId = -1; +} + +int Scene23::init() { + return 0xC0; +} + +void Scene23::updateHotspots() { + _vm->setHotspot(kHS23Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS23ExitFrontGrubCity, 0, 250, 15, 550, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); + _vm->setHotspot(kHS23Cereals, 366, 332, 414, 408, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); + _vm->setHotspot(kHS23WalkArea1, 0, 0, 340, 460); + _vm->setHotspot(kHS23WalkArea2, 340, 0, 800, 501); + _vm->setDeviceHotspot(kHS23Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 6; +} + +void Scene23::run() { + _vm->_timers[4] = _vm->getRandom(100) + 200; + _vm->_timers[5] = _vm->getRandom(100) + 200; + + _currStoreClerkSequenceId = 0xB4; + _nextStoreClerkSequenceId = -1; + + _vm->_gameSys->setAnimation(0xB4, 1, 4); + _vm->_gameSys->insertSequence(_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _vm->queueInsertDeviceIcon(); + + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + + if (_vm->isFlag(kGFUnk24)) { + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + } else { + _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); + _vm->setFlag(kGFUnk24); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 3, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS23Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS23Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS23Cereals: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapMoan2(0, 0); + else { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS23LookCereals; + } + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFSceneFlag1)) + _vm->playGnapImpossible(0, 0); + else { + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, + 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->setFlag(kGFSceneFlag1); + _vm->_gnapActionStatus = kAS23GrabCereals; + _vm->invAdd(kItemCereals); + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS23ExitFrontGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 22; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS23LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y - 1, -1, 0x107C2, 1); + } + break; + + case kHS23WalkArea1: + case kHS23WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(100) + 200; + switch (_vm->getRandom(4)) { + case 0: + _vm->_gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + case 3: + _vm->_gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(100) + 200; + switch (_vm->getRandom(3)) { + case 0: + _vm->playSound(0xCE, false); + break; + case 1: + _vm->playSound(0xD0, false); + break; + case 2: + _vm->playSound(0xCF, false); + break; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene23::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS23LookCereals: + _vm->showFullScreenSprite(0x48); + _vm->_gnapActionStatus = -1; + break; + case kAS23GrabCereals: + _vm->_gameSys->setAnimation(0xBE, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->requestRemoveSequence(0xBF, 2); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0xBE; + _vm->_gnapActionStatus = kAS23GrabCerealsDone; + break; + case kAS23GrabCerealsDone: + _vm->setGrabCursorSprite(kItemCereals); + _vm->_gnapActionStatus = -1; + break; + case kAS23LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextStoreClerkSequenceId == -1) { + switch (_vm->getRandom(8)) { + case 0: + case 1: + case 2: + _nextStoreClerkSequenceId = 0xB4; + break; + case 3: + case 4: + case 5: + _nextStoreClerkSequenceId = 0xB5; + break; + default: + _nextStoreClerkSequenceId = 0xB6; + break; + } + _vm->_gameSys->setAnimation(_nextStoreClerkSequenceId, 1, 4); + _vm->_gameSys->insertSequence(_nextStoreClerkSequenceId, 1, _currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); + _currStoreClerkSequenceId = _nextStoreClerkSequenceId; + _nextStoreClerkSequenceId = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS24Platypus = 0, + kHS24ExitCircusWorld = 1, + kHS24ExitOutsideGrubCity = 2, + kHS24Device = 3, + kHS24WalkArea1 = 4, + kHS24WalkArea2 = 5, + kHS24WalkArea3 = 6 +}; + +enum { + kAS24LeaveScene = 0 +}; + +Scene24::Scene24(GnapEngine *vm) : Scene(vm) { + _currWomanSequenceId = -1; + _nextWomanSequenceId = -1; + _boySequenceId = -1; + _girlSequenceId = -1; +} + +int Scene24::init() { + return 0x3B; +} + +void Scene24::updateHotspots() { + _vm->setHotspot(kHS24Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS24ExitCircusWorld, 785, 128, 800, 600, SF_EXIT_R_CURSOR, 8, 7); + _vm->setHotspot(kHS24ExitOutsideGrubCity, 0, 213, 91, 600, SF_EXIT_NW_CURSOR, 1, 8); + _vm->setHotspot(kHS24WalkArea1, 0, 0, 0, 0); + _vm->setHotspot(kHS24WalkArea2, 530, 0, 800, 600); + _vm->setHotspot(kHS24WalkArea3, 0, 0, 800, 517); + _vm->setDeviceHotspot(kHS24Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene24::run() { + int counter = 0; + + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(9); + + _vm->_timers[7] = _vm->getRandom(100) + 100; + + _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_timers[5] = _vm->getRandom(20) + 40; + _vm->_timers[6] = _vm->getRandom(50) + 30; + + _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); + + _currWomanSequenceId = 0x35; + _girlSequenceId = 0x36; + _boySequenceId = 0x30; + + if (_vm->_debugLevel == 4) + _vm->startIdleTimer(8); + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 20) { + _vm->initGnapPos(1, 8, kDirBottomRight); + _vm->initPlatypusPos(2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(1, 9, -1, 0x107B9, 1); + _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(8, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + + case kHS24Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS24Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS24ExitCircusWorld: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 25; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS24LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHS24ExitOutsideGrubCity: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 20; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS24LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); + } + break; + + case kHS24WalkArea1: + case kHS24WalkArea2: + case kHS24WalkArea3: + if (_vm->_gnapActionStatus == -1) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x10940)) + _vm->playSound(0x10940, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_gameSys->insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _girlSequenceId = 0x37; + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 40; + _vm->_gameSys->insertSequence(0x31, 20, _boySequenceId, 20, kSeqSyncWait, 0, 0, 0); + _boySequenceId = 0x31; + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(50) + 30; + counter = (counter + 1) % 3; + switch (counter) { + case 0: + _nextWomanSequenceId = 0x32; + break; + case 1: + _nextWomanSequenceId = 0x33; + break; + case 2: + _nextWomanSequenceId = 0x34; + break; + } + _vm->_gameSys->insertSequence(_nextWomanSequenceId, 20, _currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); + _currWomanSequenceId = _nextWomanSequenceId; + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 100; + switch (_vm->getRandom(3)) { + case 0: + _vm->_gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 1: + _vm->_gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + case 2: + _vm->_gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); + break; + } + } + if (_vm->_debugLevel == 4) + _vm->updateIdleTimer(); + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene24::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS24LeaveScene) + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS25Platypus = 0, + kHS25TicketVendor = 1, + kHS25ExitOutsideCircusWorld = 2, + kHS25ExitInsideCircusWorld = 3, + kHS25Device = 4, + kHS25Posters1 = 5, + kHS25Posters2 = 6, + kHS25Posters3 = 7, + kHS25Posters4 = 8, + kHS25WalkArea1 = 9, + kHS25WalkArea2 = 10 +}; + +enum { + kAS25TalkTicketVendor = 0, + kAS25EnterCircusWihoutTicket = 1, + kAS25ShowTicketToVendor = 2, + kAS25ShowTicketToVendorDone = 3, + kAS25EnterCircusWihoutTicketDone = 4, + kAS25LeaveScene = 5 +}; + +Scene25::Scene25(GnapEngine *vm) : Scene(vm) { + _currTicketVendorSequenceId = -1; + _nextTicketVendorSequenceId = -1; +} + +int Scene25::init() { + return 0x62; +} + +void Scene25::updateHotspots() { + _vm->setHotspot(kHS25Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS25TicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5); + _vm->setHotspot(kHS25ExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10); + _vm->setHotspot(kHS25ExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6); + _vm->setHotspot(kHS25Posters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHS25Posters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); + _vm->setHotspot(kHS25Posters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7); + _vm->setHotspot(kHS25Posters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS25WalkArea1, 0, 0, 800, 439); + _vm->setHotspot(kHS25WalkArea2, 585, 0, 800, 600); + _vm->setDeviceHotspot(kHS25Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; +} + +void Scene25::playAnims(int index) { + if (index > 4) + return; + + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + switch (index) { + case 1: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x25); + break; + case 2: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x26); + break; + case 3: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x27); + break; + case 4: + _vm->_largeSprite = _vm->_gameSys->createSurface(0x28); + break; + } + _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->delayTicksCursor(5); + while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && + !_vm->isKeyStatus1(29)) { + _vm->gameUpdateTick(); + } + _vm->_mouseClickState._left = false; + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + _vm->delayTicksCursor(5); + _vm->deleteSurface(&_vm->_largeSprite); + _vm->showCursor(); +} + +void Scene25::run() { + _vm->playSound(0x10940, true); + _vm->startSoundTimerA(5); + + _currTicketVendorSequenceId = 0x52; + _vm->_gameSys->setAnimation(0x52, 39, 3); + _vm->_gameSys->insertSequence(_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + + _nextTicketVendorSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(20) + 20; + + _vm->queueInsertDeviceIcon(); + + if (_vm->_prevSceneNum == 24) { + _vm->initGnapPos(5, 11, kDirUpLeft); + _vm->initPlatypusPos(6, 11, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 7, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(5, 6, kDirBottomRight); + _vm->initPlatypusPos(6, 6, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS25Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS25Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS25TicketVendor: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemTickets) { + _vm->_gnapActionStatus = kAS25ShowTicketToVendor; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, + 0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); + _nextTicketVendorSequenceId = 0x5B; + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 1); + _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS25TalkTicketVendor; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS25ExitOutsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 24; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, 0, 0x107B4, 1); + _vm->_gnapActionStatus = kAS25LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, -1, 0x107C2, 1); + } + break; + + case kHS25ExitInsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFNeedleTaken)) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, 0, 0x107B1, 1); + _vm->_gnapActionStatus = kAS25LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, -1, 0x107C2, 1); + _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; + } else { + _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(4, 5, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS25EnterCircusWihoutTicket; + _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; + } + } + break; + + case kHS25Posters1: + case kHS25Posters2: + case kHS25Posters3: + case kHS25Posters4: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1); + if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) + _vm->_gnapIdleFacing = kDirUpLeft; + else if (_vm->_sceneClickedHotspot == 8) + _vm->_gnapIdleFacing = kDirBottomRight; + else + _vm->_gnapIdleFacing = kDirUpRight; + _vm->playGnapIdle(0, 0); + playAnims(8 - _vm->_sceneClickedHotspot + 1); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapMoan2(0, 0); + break; + } + } + } + break; + + case kHS25WalkArea1: + case kHS25WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && _vm->_gnapActionStatus == -1) { + _vm->_timers[4] = _vm->getRandom(20) + 20; + switch (_vm->getRandom(13)) { + case 0: + _nextTicketVendorSequenceId = 0x54; + break; + case 1: + _nextTicketVendorSequenceId = 0x58; + break; + case 2: + _nextTicketVendorSequenceId = 0x55; + break; + case 3: + _nextTicketVendorSequenceId = 0x5A; + break; + case 4: + case 5: + case 6: + case 7: + _nextTicketVendorSequenceId = 0x5B; + break; + case 8: + case 9: + case 10: + case 11: + _nextTicketVendorSequenceId = 0x5C; + break; + case 12: + _nextTicketVendorSequenceId = 0x5D; + break; + default: + _nextTicketVendorSequenceId = 0x52; + break; + } + } + _vm->playSoundA(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene25::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS25TalkTicketVendor: + _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; + _vm->_gnapActionStatus = -1; + break; + case kAS25EnterCircusWihoutTicket: + _nextTicketVendorSequenceId = 0x5E; + _vm->_gameSys->setAnimation(0x5E, 39, 0); + _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); + _currTicketVendorSequenceId = _nextTicketVendorSequenceId; + _nextTicketVendorSequenceId = -1; + _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; + _vm->playGnapIdle(0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1); + _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS25EnterCircusWihoutTicketDone; + break; + case kAS25EnterCircusWihoutTicketDone: + _vm->_gnapActionStatus = -1; + break; + case kAS25ShowTicketToVendor: + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemTickets); + _vm->setFlag(kGFNeedleTaken); + _vm->_gameSys->setAnimation(0x61, 40, 0); + _vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = kAS25ShowTicketToVendorDone; + break; + case kAS25ShowTicketToVendorDone: + _nextTicketVendorSequenceId = 0x53; + break; + case kAS25LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (_nextTicketVendorSequenceId == 0x53) { + _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currTicketVendorSequenceId = _nextTicketVendorSequenceId; + _nextTicketVendorSequenceId = -1; + _vm->_gnapActionStatus = -1; + } else if (_nextTicketVendorSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); + _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currTicketVendorSequenceId = _nextTicketVendorSequenceId; + _nextTicketVendorSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS26Platypus = 0, + kHS26ExitOutsideCircusWorld = 1, + kHS26ExitOutsideClown = 2, + kHS26ExitArcade = 3, + kHS26ExitElephant = 4, + kHS26ExitBeerStand = 5, + kHS26Device = 6, + kHS26WalkArea1 = 7, + kHS26WalkArea2 = 8 +}; + +enum { + kAS26LeaveScene = 0 +}; + +Scene26::Scene26(GnapEngine *vm) : Scene(vm) { + _currKidSequenceId = -1; + _nextKidSequenceId = -1; +} + +int Scene26::init() { + return _vm->isFlag(kGFUnk23) ? 0x61 : 0x60; +} + +void Scene26::updateHotspots() { + _vm->setHotspot(kHS26Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS26ExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10); + _vm->setHotspot(kHS26ExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8); + _vm->setHotspot(kHS26ExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8); + _vm->setHotspot(kHS26ExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8); + _vm->setHotspot(kHS26ExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8); + _vm->setHotspot(kHS26WalkArea1, 0, 0, 800, 500); + _vm->setHotspot(kHS26WalkArea2, 281, 0, 800, 600); + _vm->setDeviceHotspot(kHS26Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; +} + +void Scene26::run() { + _vm->startSoundTimerB(7); + _vm->playSound(0x1093B, true); + + _currKidSequenceId = 0x5B; + _nextKidSequenceId = -1; + _vm->_gameSys->setAnimation(0x5B, 160, 3); + _vm->_gameSys->insertSequence(_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); + + _vm->_timers[5] = _vm->getRandom(20) + 50; + _vm->_timers[4] = _vm->getRandom(20) + 50; + _vm->_timers[6] = _vm->getRandom(50) + 100; + + _vm->queueInsertDeviceIcon(); + + _vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); + + if (_vm->_prevSceneNum == 25) { + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(2, 8, kDirBottomRight); + _vm->initPlatypusPos(3, 8, kDirNone); + _vm->endSceneInit(); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS26Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS26Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS26ExitOutsideCircusWorld: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 25; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitArcade: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 29; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitElephant: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 30; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26ExitBeerStand: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 31; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS26LeaveScene; + } + break; + + case kHS26WalkArea1: + case kHS26WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5] && _nextKidSequenceId == -1) { + _vm->_timers[5] = _vm->getRandom(20) + 50; + if (_vm->getRandom(5) != 0) + _nextKidSequenceId = 0x5B; + else + _nextKidSequenceId = 0x5A; + } + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 130; + _vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[6]) { + _vm->_timers[6] = _vm->getRandom(50) + 100; + _vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene26::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS26LeaveScene) + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextKidSequenceId, 160, _currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextKidSequenceId, 160, 3); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS27Platypus = 0, + kHS27Janitor = 1, + kHS27Device = 2, + kHS27Bucket = 3, + kHS27ExitCircus = 4, + kHS27ExitArcade = 5, + kHS27ExitBeerStand = 6, + kHS27ExitClown = 7, + kHS27WalkArea1 = 8 +}; + +enum { + kAS27TalkJanitor = 0, + kAS27GrabBucket = 1, + kAS27GrabBucketDone = 2, + kAS27ShowPictureToJanitor = 3, + kAS27TryEnterClownTent = 4, + kAS27TryEnterClownTentDone = 5, + kAS27EnterClownTent = 6, + kAS27LeaveScene = 7 +}; + +Scene27::Scene27(GnapEngine *vm) : Scene(vm) { + _nextJanitorSequenceId = -1; + _currJanitorSequenceId = -1; +} + +int Scene27::init() { + return 0xD5; +} + +void Scene27::updateHotspots() { + _vm->setHotspot(kHS27Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS27Janitor, 488, 204, 664, 450, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 8); + _vm->setHotspot(kHS27Bucket, 129, 406, 186, 453, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 6); + _vm->setHotspot(kHS27ExitCircus, 200, 585, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS27ExitArcade, 0, 0, 15, 600, SF_EXIT_L_CURSOR, 0, 6); + _vm->setHotspot(kHS27ExitBeerStand, 785, 0, 800, 600, SF_EXIT_R_CURSOR, 11, 7); + _vm->setHotspot(kHS27ExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); + _vm->setHotspot(kHS27WalkArea1, 0, 0, 800, 507); + _vm->setDeviceHotspot(kHS27Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk13)) + _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; + _vm->_hotspotsCount = 9; +} + +void Scene27::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(4); + _vm->_timers[7] = _vm->getRandom(100) + 300; + _vm->queueInsertDeviceIcon(); + + if (!_vm->isFlag(kGFUnk13)) + _vm->_gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_debugLevel == 4) + _vm->startIdleTimer(6); + + _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); + + _currJanitorSequenceId = 0xCB; + _nextJanitorSequenceId = -1; + + _vm->_gameSys->setAnimation(0xCB, 39, 3); + _vm->_timers[5] = _vm->getRandom(20) + 60; + + switch (_vm->_prevSceneNum) { + case 26: + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + break; + case 29: + _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->initPlatypusPos(-1, 9, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + break; + case 31: + _vm->initGnapPos(12, 8, kDirBottomLeft); + _vm->initPlatypusPos(12, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); + break; + default: + _vm->initGnapPos(6, 8, kDirBottomRight); + _vm->initPlatypusPos(5, 9, kDirNone); + _vm->endSceneInit(); + break; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->_sceneClickedHotspot = -1; + if (_vm->_gnapActionStatus < 0) + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS27Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS27Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS27Janitor: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemPicture) { + _vm->_gnapIdleFacing = kDirUpLeft; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, 0x107BC, 1)) + _vm->_gnapActionStatus = kAS27ShowPictureToJanitor; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 3); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS27TalkJanitor; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS27Bucket: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 3, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(3, 3); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS27GrabBucket; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS27ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, -1, 0x107C7, 1); + } + break; + + case kHS27ExitArcade: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 29; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade].x, _vm->_hotspotsWalkPos[kHS27ExitArcade].y + 1, -1, 0x107CF, 1); + } + break; + + case kHS27ExitBeerStand: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 31; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand].x, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y + 1, -1, 0x107CD, 1); + } + break; + + case kHS27ExitClown: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFPlatypus)) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 28; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, _vm->_hotspotsWalkPos[kHS27ExitClown].y, 0, 0x107AD, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x + 1, _vm->_hotspotsWalkPos[kHS27ExitClown].y, -1, 0x107C4, 1); + } else { + _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7, 0, 0x107BC, 1); + _vm->_hotspots[kHS27WalkArea1]._flags &= SF_WALKABLE; + _vm->_gnapActionStatus = kAS27TryEnterClownTent; + } + } + break; + + case kHS27WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (_vm->_debugLevel == 4) + _vm->updateIdleTimer(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(3) != 0) + _nextJanitorSequenceId = 0xCB; + else + _nextJanitorSequenceId = 0xCF; + } + } + if (!_vm->_timers[7]) { + _vm->_timers[7] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0) + _vm->_gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene27::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS27TalkJanitor: + switch (_vm->getRandom(3)) { + case 0: + _nextJanitorSequenceId = 0xCC; + break; + case 1: + _nextJanitorSequenceId = 0xCD; + break; + case 2: + _nextJanitorSequenceId = 0xCE; + break; + } + break; + case kAS27GrabBucket: + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; + _vm->invAdd(kItemEmptyBucket); + _vm->setFlag(kGFUnk13); + _vm->_gameSys->setAnimation(0xD2, 39, 0); + _vm->_gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS27GrabBucketDone; + break; + case kAS27GrabBucketDone: + _vm->setGrabCursorSprite(kItemEmptyBucket); + _vm->_gnapActionStatus = -1; + break; + case kAS27ShowPictureToJanitor: + _nextJanitorSequenceId = 0xD0; + break; + case kAS27TryEnterClownTent: + _nextJanitorSequenceId = 0xD1; + _vm->_gameSys->insertSequence(0xD1, 39, _currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + _vm->_gnapActionStatus = kAS27TryEnterClownTentDone; + break; + case kAS27TryEnterClownTentDone: + _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); + _vm->_hotspots[kHS27WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = -1; + break; + case kAS27EnterClownTent: + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107B2, 1); + _vm->_gnapActionStatus = kAS27LeaveScene; + break; + case kAS27LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextJanitorSequenceId) { + case -1: + _nextJanitorSequenceId = 0xCB; + _vm->_gameSys->insertSequence(0xCB, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + break; + case 0xCC: + case 0xCD: + case 0xCE: + _vm->_gnapActionStatus = -1; + _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + break; + case 0xD0: + // Show picture to janitor + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + _vm->_gnapActionStatus = kAS27EnterClownTent; + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + _vm->setFlag(kGFPlatypus); + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemPicture); + _vm->_newSceneNum = 28; + break; + default: + _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + _currJanitorSequenceId = _nextJanitorSequenceId; + _nextJanitorSequenceId = -1; + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS28Platypus = 0, + kHS28Horn = 1, + kHS28Clown = 2, + kHS28ExitOutsideClown = 3, + kHS28EmptyBucket = 4, + kHS28Device = 5, + kHS28WalkArea1 = 6, + kHS28WalkArea2 = 7 +}; + +enum { + kAS28UseBeerBucketWithClown = 0, + kAS28UsePillBucketWithClown = 1, + kAS28GrabHornFails = 2, + kAS28GrabEmptyBucket = 3, + kAS28GrabHornSuccess = 4, + kAS28GrabHornSuccessDone = 5, + kAS28GrabEmptyBucketDone = 6, + kAS28GrabHornFailsDone = 7, + kAS28TalkClown = 8, + kAS28GnapWaiting = 9, + kAS28LeaveScene = 10 +}; + +Scene28::Scene28(GnapEngine *vm) : Scene(vm) { + _currClownSequenceId = -1; + _nextClownSequenceId = -1; + _clownTalkCtr = 0; +} + +int Scene28::init() { + return 0x125; +} + +void Scene28::updateHotspots() { + _vm->setHotspot(kHS28Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS28Horn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); + _vm->setHotspot(kHS28Clown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); + _vm->setHotspot(kHS28ExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); + _vm->setHotspot(kHS28EmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); + _vm->setHotspot(kHS28WalkArea1, 0, 0, 799, 523); + _vm->setHotspot(kHS28WalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); + _vm->setDeviceHotspot(kHS28Device, -1, -1, -1, -1); + if (_vm->invHas(kItemHorn)) + _vm->_hotspots[kHS28Horn]._flags = SF_DISABLED; + if (_vm->isFlag(kGFUnk22)) + _vm->_hotspots[kHS28EmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 8; +} + +void Scene28::run() { + _vm->playSound(0x1093C, true); + _nextClownSequenceId = -1; + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFUnk22)) + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFMudTaken)) { + if (_vm->isFlag(kGFUnk21)) { + _vm->_gameSys->setAnimation(0x11C, 39, 3); + _vm->_gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); + if (!_vm->invHas(kItemHorn)) + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); + _currClownSequenceId = 0x11C; + } else { + _currClownSequenceId = 0x11B; + _vm->_gameSys->setAnimation(0x11B, 39, 3); + _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(20) + 80; + } + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); + } else { + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->initGnapPos(8, 8, kDirBottomLeft); + _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->endSceneInit(); + _vm->playSequences(0xF7, 0x121, 0x122, 0x123); + _currClownSequenceId = 0x115; + _vm->setFlag(kGFMudTaken); + _vm->_gameSys->setAnimation(0x115, 39, 3); + _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); + _nextClownSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(20) + 80; + _vm->_gnapActionStatus = kAS28GnapWaiting; + while (_vm->_gameSys->getAnimationStatus(3) != 2) { + _vm->gameUpdateTick(); + _vm->updateMouseCursor(); + } + _vm->_gnapActionStatus = -1; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS28Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS28Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28Horn: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(2, 8, 3, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 4); + break; + case GRAB_CURSOR: + if (_vm->isFlag(kGFUnk21)) { + if (!_vm->invHas(kItemHorn)) { + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS28GrabHornSuccess; + } + } else { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); + _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y, 0, 0x107BB, 1); + _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS28GrabHornFails; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28Clown: + if (_vm->_gnapActionStatus < 0) { + if (_vm->isFlag(kGFUnk21)) { + if (_vm->_verbCursor == LOOK_CURSOR) + _vm->playGnapScratchingHead(5, 2); + else + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kAS28UseBeerBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gnapActionStatus = kAS28UsePillBucketWithClown; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(5, 2); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS28TalkClown; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, 0, 0x107BF, 1); + _vm->_gnapActionStatus = kAS28LeaveScene; + _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, -1, 0x107C2, 1); + } + break; + + case kHS28EmptyBucket: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); + } else if (_vm->isFlag(kGFUnk21)) { + _vm->playGnapImpossible(8, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 6); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); + _vm->_gnapActionStatus = kAS28GrabEmptyBucket; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS28WalkArea1: + case kHS28WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093C)) + _vm->playSound(0x1093C, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 80; + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFUnk21)) + _nextClownSequenceId = 0x114; + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene28::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS28UseBeerBucketWithClown: + _vm->setFlag(kGFUnk22); + _nextClownSequenceId = 0x113; + _vm->invRemove(kItemBucketWithBeer); + updateHotspots(); + break; + case kAS28UsePillBucketWithClown: + _nextClownSequenceId = 0x116; + _vm->invRemove(kItemBucketWithPill); + _vm->setFlag(kGFUnk22); + _vm->setFlag(kGFUnk21); + updateHotspots(); + break; + case kAS28GrabHornFails: + _nextClownSequenceId = 0x119; + break; + case kAS28GrabHornSuccess: + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x117, 59, 0); + _vm->_gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS28GrabHornSuccessDone; + break; + case kAS28GrabHornSuccessDone: + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0xF6, 255); + _vm->_gameSys->setAnimation(0x120, 256, 0); + _vm->_gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->setGrabCursorSprite(kItemHorn); + _vm->invAdd(kItemHorn); + updateHotspots(); + _vm->_gnapActionStatus = -1; + break; + case kAS28GrabEmptyBucket: + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->setAnimation(0x111, 99, 0); + _vm->_gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS28GrabEmptyBucketDone; + break; + case kAS28GrabEmptyBucketDone: + _vm->setGrabCursorSprite(kItemEmptyBucket); + _vm->clearFlag(kGFUnk22);; + updateHotspots(); + _vm->invAdd(kItemEmptyBucket); + _vm->_gnapActionStatus = -1; + break; + case kAS28GrabHornFailsDone: + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + _currClownSequenceId = 0x11B; + _nextClownSequenceId = -1; + _vm->_gnapActionStatus = -1; + _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); + break; + case kAS28TalkClown: + _clownTalkCtr = (_clownTalkCtr + 1) % 2; + if (_clownTalkCtr == 0) + _nextClownSequenceId = 0x11D; + else if (_clownTalkCtr == 1) + _nextClownSequenceId = 0x11E; + else if (_clownTalkCtr == 2) + _nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? + break; + case kAS28GnapWaiting: + _vm->_gnapActionStatus = -1; + break; + case kAS28LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextClownSequenceId) { + case 0x113: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currClownSequenceId = 0x11B; + _nextClownSequenceId = -1; + _vm->_gnapActionStatus = kAS28GnapWaiting; + break; + case 0x116: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); + _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x11C, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + _currClownSequenceId = _nextClownSequenceId; + _nextClownSequenceId = -1; + _vm->_gnapActionStatus = kAS28GnapWaiting; + break; + case 0x11D: + case 0x11E: + case 0x11F: + _vm->_gnapActionStatus = -1; + break; + case 0x119: + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); + _vm->_gameSys->removeSequence(_currClownSequenceId, 39, true); + _vm->_gnapActionStatus = kAS28GrabHornFailsDone; + _vm->_gnapSequenceId = _nextClownSequenceId; + _vm->_gnapSequenceDatNum = 0; + _nextClownSequenceId = -1; + break; + } + if (_nextClownSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 3); + _currClownSequenceId = _nextClownSequenceId; + _nextClownSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS29Platypus = 0, + kHS29Monkey = 1, + kHS29Device = 2, + kHS29ExitCircus = 3, + kHS29ExitOutsideClown = 4, + kHS29Aracde = 5, + kHS29WalkArea1 = 6 +}; + +enum { + kAS29UseBananaWithMonkey = 0, + kAS29LeaveScene = 2 +}; + +Scene29::Scene29(GnapEngine *vm) : Scene(vm) { + _currMonkeySequenceId = -1; + _nextMonkeySequenceId = -1; + _currManSequenceId = -1; + _nextManSequenceId = -1; +} + +int Scene29::init() { + return 0xF6; +} + +void Scene29::updateHotspots() { + _vm->setHotspot(kHS29Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS29Monkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); + _vm->setHotspot(kHS29ExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS29ExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); + _vm->setHotspot(kHS29Aracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHS29WalkArea1, 0, 0, 800, 478); + _vm->setDeviceHotspot(kHS29Device, -1, -1, -1, -1); + if (_vm->invHas(kItemHorn)) + _vm->_hotspots[kHS29Monkey]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + _vm->_hotspotsCount = 7; +} + +void Scene29::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); + _vm->queueInsertDeviceIcon(); + + if (_vm->invHas(kItemHorn)) { + _currMonkeySequenceId = 0xE8; + _nextMonkeySequenceId = -1; + _vm->_gameSys->setAnimation(0xE8, 159, 4); + _vm->_gameSys->insertSequence(_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _currManSequenceId = 0xED; + _nextManSequenceId = -1; + _vm->_gameSys->setAnimation(0xED, 39, 3); + _vm->_timers[4] = _vm->getRandom(20) + 60; + } else { + _vm->_gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 4); + _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 3); + } + + _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); + _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); + + if (_vm->_prevSceneNum == 27) { + _vm->initGnapPos(12, 7, kDirBottomRight); + _vm->initPlatypusPos(12, 8, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); + } else { + _vm->initGnapPos(-1, 7, kDirBottomRight); + _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS29Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS29Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS29Monkey: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemBanana) { + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS29UseBananaWithMonkey; + _vm->_newSceneNum = 51; + _vm->_isLeavingScene = true; + _vm->setGrabCursorSprite(-1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(5, 6); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS29ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, -1, -1, 1); + } + break; + + case kHS29ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y - 1, -1, 0x107CD, 1); + } + break; + + case kHS29Aracde: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->setGrabCursorSprite(-1); + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 52; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); + _vm->_gnapActionStatus = kAS29LeaveScene; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan2(0, 0); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS29WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_gnapActionStatus < 0) { + _vm->updateGnapIdleSequence(); + _vm->updatePlatypusIdleSequence(); + } + if (!_vm->_timers[4]) { + if (_vm->invHas(kItemHorn)) { + _vm->_timers[4] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0) { + switch (_vm->getRandom(5)) { + case 0: + _nextManSequenceId = 0xED; + break; + case 1: + _nextManSequenceId = 0xEE; + break; + case 2: + _nextManSequenceId = 0xEF; + break; + case 3: + _nextManSequenceId = 0xF0; + break; + case 4: + _nextManSequenceId = 0xF1; + break; + } + } + } + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene29::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS29UseBananaWithMonkey: + _nextMonkeySequenceId = 0xE5; + break; + case kAS29LeaveScene: + _vm->_sceneDone = true; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextManSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextManSequenceId, 39, _currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextManSequenceId, 39, 3); + _currManSequenceId = _nextManSequenceId; + _nextManSequenceId = -1; + } + + if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (_nextMonkeySequenceId == 0xE5) { + _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0xF2; + _vm->_gameSys->setAnimation(0xE6, 159, 0); + _vm->_gameSys->setAnimation(0, 159, 4); + _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = kAS29LeaveScene; + _currMonkeySequenceId = 0xE6; + _nextMonkeySequenceId = -1; + _vm->_timers[5] = 30; + while (_vm->_timers[5]) + _vm->gameUpdateTick(); + _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); + while (_vm->_gameSys->getAnimationStatus(1) != 2) + _vm->gameUpdateTick(); + } else if (_nextMonkeySequenceId == -1) { + switch (_vm->getRandom(6)) { + case 0: + _nextMonkeySequenceId = 0xE8; + break; + case 1: + _nextMonkeySequenceId = 0xE9; + break; + case 2: + _nextMonkeySequenceId = 0xEA; + break; + case 3: + _nextMonkeySequenceId = 0xEB; + break; + case 4: + _nextMonkeySequenceId = 0xEC; + break; + case 5: + _nextMonkeySequenceId = 0xE7; + break; + } + _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + _currMonkeySequenceId = _nextMonkeySequenceId; + _nextMonkeySequenceId = -1; + } else { + _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + _currMonkeySequenceId = _nextMonkeySequenceId; + _nextMonkeySequenceId = -1; + } + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group2.h b/engines/gnap/scenes/group2.h new file mode 100644 index 0000000000..3e84d4d500 --- /dev/null +++ b/engines/gnap/scenes/group2.h @@ -0,0 +1,211 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GROUP2_H +#define GNAP_GROUP2_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene20: public Scene { +public: + Scene20(GnapEngine *vm); + ~Scene20() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb(); + +private: + int _currStonerGuySequenceId; + int _nextStonerGuySequenceId; + int _currGroceryStoreGuySequenceId; + int _nextGroceryStoreGuySequenceId; + int _stonerGuyCtr; + int _groceryStoreGuyCtr; + bool _stonerGuyShowingJoint; + + void stopSounds(); +}; + +class Scene21: public Scene { +public: + Scene21(GnapEngine *vm); + ~Scene21() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currOldLadySequenceId; + int _nextOldLadySequenceId; +}; + +class Scene22: public Scene { +public: + Scene22(GnapEngine *vm); + ~Scene22() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currCashierSequenceId; + int _nextCashierSequenceId; + bool _caughtBefore; + int _cashierCtr; +}; + +class Scene23: public Scene { +public: + Scene23(GnapEngine *vm); + ~Scene23() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currStoreClerkSequenceId; + int _nextStoreClerkSequenceId; +}; + +class Scene24: public Scene { +public: + Scene24(GnapEngine *vm); + ~Scene24() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currWomanSequenceId; + int _nextWomanSequenceId; + int _boySequenceId; + int _girlSequenceId; +}; + +class Scene25: public Scene { +public: + Scene25(GnapEngine *vm); + ~Scene25() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currTicketVendorSequenceId; + int _nextTicketVendorSequenceId; + + void playAnims(int index); +}; + +class Scene26: public Scene { +public: + Scene26(GnapEngine *vm); + ~Scene26() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currKidSequenceId; + int _nextKidSequenceId; +}; + +class Scene27: public Scene { +public: + Scene27(GnapEngine *vm); + ~Scene27() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _nextJanitorSequenceId; + int _currJanitorSequenceId; +}; + +class Scene28: public Scene { +public: + Scene28(GnapEngine *vm); + ~Scene28() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currClownSequenceId; + int _nextClownSequenceId; + int _clownTalkCtr; +}; + +class Scene29: public Scene { +public: + Scene29(GnapEngine *vm); + ~Scene29() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currMonkeySequenceId; + int _nextMonkeySequenceId; + int _currManSequenceId; + int _nextManSequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_GROUP1_H diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp deleted file mode 100644 index c31f6229cb..0000000000 --- a/engines/gnap/scenes/scene20.cpp +++ /dev/null @@ -1,732 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene20.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSGroceryStoreHat = 1, - kHSExitParkingLot = 2, - kHSStonerGuy = 3, - kHSGroceryStoreGuy = 4, - kHSDevice = 5, - kHSExitInsideGrubCity = 6, - kHSExitOutsideCircusWorld = 7, - kHSExitOutsideToyStore = 8, - kHSExitPhone = 9, - kHSWalkArea1 = 10, - kHSWalkArea2 = 11 -}; - -enum { - kASLeaveScene = 0, - kASTalkStonerGuyNoJoint = 2, - kASTalkStonerGuyHasJoint = 3, - kASGrabJoint = 4, - kASActionDone = 5, - kASTalkGroceryStoreGuy = 6, - kASGrabGroceryStoreGuy = 9, - kASGrabGroceryStoreHat = 10, - kASSwitchGroceryStoreHat = 11, - kASSwitchGroceryStoreHatDone = 12, - kASGrabJointDone = 13 -}; - -Scene20::Scene20(GnapEngine *vm) : Scene(vm) { - _s20_stonerGuyCtr = 3; - _s20_stonerGuyShowingJoint = false; - _s20_groceryStoreGuyCtr = 0; -} - -int Scene20::init() { - return 0x186; -} - -void Scene20::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSGroceryStoreHat, 114, 441, 174, 486, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 7); - _vm->setHotspot(kHSExitParkingLot, 0, 300, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); - _vm->setHotspot(kHSStonerGuy, 276, 290, 386, 450, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - _vm->setHotspot(kHSGroceryStoreGuy, 123, 282, 258, 462, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHSExitInsideGrubCity, 519, 250, 581, 413, SF_EXIT_L_CURSOR, 8, 7); - _vm->setHotspot(kHSExitOutsideCircusWorld, 660, 222, 798, 442, SF_EXIT_NE_CURSOR, 9, 6); - _vm->setHotspot(kHSExitOutsideToyStore, 785, 350, 800, 600, SF_EXIT_R_CURSOR, 11, 8); - _vm->setHotspot(kHSExitPhone, 250, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 10); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 468); - _vm->setHotspot(kHSWalkArea2, 605, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 12; -} - -void Scene20::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - switch (_s20_nextStonerGuySequenceId) { - case 0x16B: - if (!_vm->_timers[4]) { - _s20_stonerGuyShowingJoint = false; - _vm->_gameSys->insertSequence(0x16B, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16B; - _s20_nextStonerGuySequenceId = -1; - } - break; - case 0x16A: - // Grab joint - _vm->playGnapPullOutDevice(4, 4); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x16A, 21, 0); - _vm->_gameSys->insertSequence(0x16A, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16A; - _s20_nextStonerGuySequenceId = -1; - _vm->invAdd(kItemJoint); - _vm->setFlag(kGFJointTaken); - _s20_stonerGuyShowingJoint = false; - _vm->_gnapActionStatus = kASGrabJointDone; - break; - case 0x16E: - _vm->_gameSys->setAnimation(0x16E, 21, 2); - _vm->_gameSys->insertSequence(0x16E, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16E; - _s20_nextStonerGuySequenceId = -1; - _s20_nextGroceryStoreGuySequenceId = 0x175; - break; - case 0x16D: - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 0); - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - _vm->_gnapActionStatus = kASActionDone; - break; - case 0x16F: - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(0x17A, 20, 3); - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17A, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = 0x17A; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - break; - case 0x171: - _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; - switch (_s20_stonerGuyCtr) { - case 1: - _s20_nextStonerGuySequenceId = 0x171; - break; - case 2: - _s20_nextStonerGuySequenceId = 0x172; - break; - case 3: - _s20_nextStonerGuySequenceId = 0x173; - break; - default: - _s20_nextStonerGuySequenceId = 0x171; - break; - } - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17C, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->setAnimation(_s20_nextStonerGuySequenceId, 21, 2); - _s20_currGroceryStoreGuySequenceId = 0x17C; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - break; - default: - _s20_nextStonerGuySequenceId = 0x16C; - _vm->_gameSys->setAnimation(0x16C, 21, 2); - _vm->_gameSys->insertSequence(_s20_nextStonerGuySequenceId, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = _s20_nextStonerGuySequenceId; - _s20_nextStonerGuySequenceId = -1; - break; - } - } -} - -void Scene20::stopSounds() { - _vm->stopSound(0x18E); - _vm->stopSound(0x18F); - _vm->stopSound(0x190); - _vm->stopSound(0x191); - _vm->stopSound(0x194); - _vm->stopSound(0x195); - _vm->stopSound(0x192); - _vm->stopSound(0x193); - _vm->stopSound(0x196); - _vm->stopSound(0x197); - _vm->stopSound(0x198); - _vm->stopSound(0x199); - _vm->stopSound(0x19A); -} - -void Scene20::run() { - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(8); - - _s20_stonerGuyShowingJoint = false; - _vm->_timers[7] = _vm->getRandom(100) + 100; - - _s20_stonerGuyCtr = (_s20_stonerGuyCtr + 1) % 3; - switch (_s20_stonerGuyCtr) { - case 1: - _s20_currStonerGuySequenceId = 0x171; - break; - case 2: - _s20_currStonerGuySequenceId = 0x172; - break; - case 3: - _s20_currStonerGuySequenceId = 0x173; - break; - } - - _s20_nextStonerGuySequenceId = -1; - _vm->_gameSys->setAnimation(_s20_currStonerGuySequenceId, 21, 2); - _vm->_gameSys->insertSequence(_s20_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[6] = _vm->getRandom(20) + 30; - - _s20_currGroceryStoreGuySequenceId = 0x17C; - _s20_nextGroceryStoreGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[5] = _vm->getRandom(50) + 130; - if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFSceneFlag1)) { - _vm->clearFlag(kGFSceneFlag1); - _vm->endSceneInit(); - _vm->_gameSys->setAnimation(0x182, 140, 0); - _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(11, 9, kDirUnk4); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); - } else { - switch (_vm->_prevSceneNum) { - case 17: - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); - break; - case 18: - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(11, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); - break; - case 21: - _vm->initGnapPos(-1, 8, kDirBottomLeft); - _vm->initPlatypusPos(-1, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); - break; - case 22: - _vm->initGnapPos(7, 6, kDirBottomRight); - _vm->initPlatypusPos(8, 6, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); - break; - default: - _vm->initGnapPos(8, 6, kDirBottomLeft); - _vm->initPlatypusPos(9, 6, kDirUnk4); - _vm->endSceneInit(); - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - break; - } - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - _vm->testWalk(0, 1, 7, 9, 8, 9); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(20); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitParkingLot: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 21; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitParkingLot].x, _vm->_hotspotsWalkPos[kHSExitParkingLot].y + 1, -1, 0x107CF, 1); - _vm->_platypusFacing = kDirUnk4; - } - break; - - case kHSExitPhone: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 17; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x, _vm->_hotspotsWalkPos[kHSExitPhone].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPhone].x + 1, _vm->_hotspotsWalkPos[kHSExitPhone].y, -1, 0x107C2, 1); - } - break; - - case kHSExitOutsideToyStore: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 18; - _vm->_hotspots[kHSWalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHSExitOutsideToyStore].y + 1, -1, 0x107CD, 1); - _vm->_hotspots[kHSWalkArea2]._flags &= ~SF_WALKABLE; - } - break; - - case kHSExitInsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y - 1, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideGrubCity].y, -1, 0x107C2, 1); - _vm->_platypusFacing = kDirUnk4; - } - break; - - case kHSExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - if (_s20_stonerGuyShowingJoint) - _vm->_timers[4] = 0; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); - } - break; - - case kHSStonerGuy: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 5, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(5, 4); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - if (_s20_stonerGuyShowingJoint) - _vm->_gnapActionStatus = kASGrabJoint; - else - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSStonerGuy].x, _vm->_hotspotsWalkPos[kHSStonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - if (_vm->isFlag(kGFJointTaken)) - _vm->_gnapActionStatus = kASTalkStonerGuyNoJoint; - else - _vm->_gnapActionStatus = kASTalkStonerGuyHasJoint; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSGroceryStoreGuy: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 2, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 3); - break; - case GRAB_CURSOR: - _s20_stonerGuyShowingJoint = false; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabGroceryStoreGuy; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkGroceryStoreGuy; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSGroceryStoreHat: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASSwitchGroceryStoreHat; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSGroceryStoreHat].x, _vm->_hotspotsWalkPos[kHSGroceryStoreHat].y, 1, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 6); - break; - case GRAB_CURSOR: - _s20_stonerGuyShowingJoint = false; - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSGroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHSGroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabGroceryStoreHat; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) { - _vm->_hotspots[kHSWalkArea1]._y2 += 48; - _vm->updatePlatypusIdleSequence(); - _vm->_hotspots[kHSWalkArea1]._y2 -= 48; - } - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->_timers[5] && _s20_nextGroceryStoreGuySequenceId == -1) { - _vm->_timers[5] = _vm->getRandom(50) + 130; - if (_vm->getRandom(4) != 0) - _s20_nextGroceryStoreGuySequenceId = 0x17C; - else - _s20_nextGroceryStoreGuySequenceId = 0x17A; - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - switch (_vm->getRandom(3)) { - case 0: - _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - } - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene20::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASTalkStonerGuyNoJoint: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = 0x16E; - _vm->_timers[5] = 100; - _vm->_timers[6] = 100; - break; - case kASTalkStonerGuyHasJoint: - _vm->_gameSys->setAnimation(0x168, 21, 2); - _vm->_gameSys->setAnimation(379, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x168; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = 0x16B; - _vm->_timers[5] = 200; - _vm->_timers[6] = 200; - _vm->_timers[4] = 100; - _s20_stonerGuyShowingJoint = true; - _vm->_gnapActionStatus = -1; - break; - case kASGrabJoint: - _s20_nextStonerGuySequenceId = 0x16A; - break; - case kASActionDone: - _vm->_gnapActionStatus = -1; - break; - case kASTalkGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _s20_groceryStoreGuyCtr = (_s20_groceryStoreGuyCtr + 1) % 2; - if (_s20_groceryStoreGuyCtr != 0) - _s20_nextGroceryStoreGuySequenceId = 0x176; - else - _s20_nextGroceryStoreGuySequenceId = 0x177; - _vm->_timers[5] = 100; - _vm->_timers[6] = 100; - break; - case kASGrabGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _vm->_timers[5] = 120; - _vm->_timers[6] = 120; - _s20_nextGroceryStoreGuySequenceId = 0x178; - break; - case kASGrabGroceryStoreHat: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->stopSound(0x1A1); - stopSounds(); - _s20_currGroceryStoreGuySequenceId = 0x17B; - _s20_currStonerGuySequenceId = 0x170; - _s20_nextGroceryStoreGuySequenceId = 0x179; - break; - case kASSwitchGroceryStoreHat: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x180; - _vm->_gnapSequenceDatNum = 0; - _vm->invRemove(kItemCowboyHat); - _vm->invAdd(kItemGroceryStoreHat); - _vm->_gnapActionStatus = kASSwitchGroceryStoreHatDone; - break; - case kASSwitchGroceryStoreHatDone: - _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); - _vm->setFlag(kGFGroceryStoreHatTaken); - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->addFullScreenSprite(0x12C, 255); - _vm->_gameSys->setAnimation(0x181, 256, 0); - _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - _vm->setGrabCursorSprite(kItemGroceryStoreHat); - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = -1; - break; - case kASGrabJointDone: - _vm->setGrabCursorSprite(kItemJoint); - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s20_nextGroceryStoreGuySequenceId) { - case 0x176: - case 0x177: - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = 0x16D; - break; - case 0x178: - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x17D; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16D; - _s20_currGroceryStoreGuySequenceId = 0x178; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = -1; - break; - case 0x179: - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x16D, 21, 0); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x17E; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s20_currStonerGuySequenceId = 0x16D; - _s20_currGroceryStoreGuySequenceId = 377; - _s20_nextGroceryStoreGuySequenceId = -1; - _s20_nextStonerGuySequenceId = -1; - _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); - break; - case 0x17C: - _vm->_gameSys->setAnimation(0, 0, 3); - _s20_nextStonerGuySequenceId = 0x171; - break; - case 0x17A: - _vm->_gameSys->setAnimation(0, 0, 3); - _s20_nextStonerGuySequenceId = 0x16F; - break; - case 0x175: - _vm->_gameSys->setAnimation(0x175, 20, 0); - _vm->_gameSys->setAnimation(0x175, 20, 3); - _vm->_gameSys->insertSequence(0x175, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = 0x175; - _s20_nextGroceryStoreGuySequenceId = -1; - _vm->_gnapActionStatus = kASActionDone; - break; - default: - if (_s20_nextGroceryStoreGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_s20_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_s20_nextGroceryStoreGuySequenceId, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s20_currGroceryStoreGuySequenceId = _s20_nextGroceryStoreGuySequenceId; - _s20_nextGroceryStoreGuySequenceId = -1; - } - break; - } - } - - updateAnimationsCb(); -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene20.h b/engines/gnap/scenes/scene20.h deleted file mode 100644 index 7496c87892..0000000000 --- a/engines/gnap/scenes/scene20.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE20_H -#define GNAP_SCENE20_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene20: public Scene { -public: - Scene20(GnapEngine *vm); - ~Scene20() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb(); - -private: - int _s20_currStonerGuySequenceId; - int _s20_nextStonerGuySequenceId; - int _s20_currGroceryStoreGuySequenceId; - int _s20_nextGroceryStoreGuySequenceId; - int _s20_stonerGuyCtr; - int _s20_groceryStoreGuyCtr; - bool _s20_stonerGuyShowingJoint; - - void stopSounds(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE20_H diff --git a/engines/gnap/scenes/scene21.cpp b/engines/gnap/scenes/scene21.cpp deleted file mode 100644 index 0e88537014..0000000000 --- a/engines/gnap/scenes/scene21.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene21.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSBanana = 1, - kHSOldLady = 2, - kHSDevice = 3, - kHSExitOutsideGrubCity = 4, - kHSWalkArea1 = 5, - kHSWalkArea2 = 6 -}; - -enum { - kASTalkOldLady = 0, - kASGrabBanana = 1, - kASGrabBananaDone = 2, - kASGrabOldLady = 3, - kASUseHatWithOldLady = 4, - kASUseHatWithOldLadyDone = 5, - kASLeaveScene = 6 -}; - -Scene21::Scene21(GnapEngine *vm) : Scene(vm) { - _s21_currOldLadySequenceId = -1; - _s21_nextOldLadySequenceId = -1; -} - -int Scene21::init() { - _vm->_gameSys->setAnimation(0, 0, 3); - return _vm->isFlag(kGFTwigTaken) ? 0x94 : 0x93; -} - -void Scene21::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSBanana, 94, 394, 146, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 2, 6); - _vm->setHotspot(kHSOldLady, 402, 220, 528, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSExitOutsideGrubCity, 522, 498, 800, 600, SF_EXIT_SE_CURSOR | SF_WALKABLE, 5, 10); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 440); - _vm->setHotspot(kHSWalkArea2, 698, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk04) || !_vm->isFlag(kGFTwigTaken)) - _vm->_hotspots[kHSBanana]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->isFlag(kGFTwigTaken)) - _vm->_hotspots[kHSOldLady]._flags = SF_DISABLED; - _vm->_hotspotsCount = 7; -} - -void Scene21::run() { - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(6); - - _vm->_timers[5] = _vm->getRandom(100) + 100; - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFTwigTaken)) { - if (_vm->isFlag(kGFKeysTaken)) { - _vm->initGnapPos(5, 8, kDirBottomRight); - _vm->initPlatypusPos(6, 8, kDirNone); - _vm->_gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); - if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - _vm->clearFlag(kGFKeysTaken); - } else { - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); - if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - } - } else { - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); - _s21_currOldLadySequenceId = 0x89; - _vm->_gameSys->setAnimation(0x89, 79, 3); - _vm->_gameSys->insertSequence(_s21_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); - _s21_nextOldLadySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(30) + 50; - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSBanana: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 5); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBanana].x, _vm->_hotspotsWalkPos[kHSBanana].y) | 0x10000, 1); - _vm->playGnapPullOutDevice(2, 5); - _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kASGrabBanana; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - break; - } - } - } - break; - - case kHSOldLady: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { - _vm->_newSceneNum = 47; - _vm->gnapWalkTo(4, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASUseHatWithOldLady; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 6, 7, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 4); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabOldLady; - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSOldLady].x, _vm->_hotspotsWalkPos[kHSOldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkOldLady; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107B3, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _s21_nextOldLadySequenceId == -1 && _vm->_gnapActionStatus == -1) { - _vm->_timers[4] = _vm->getRandom(30) + 50; - switch (_vm->getRandom(5)) { - case 0: - _s21_nextOldLadySequenceId = 0x88; - break; - case 1: - _s21_nextOldLadySequenceId = 0x8A; - break; - default: - _s21_nextOldLadySequenceId = 0x89; - break; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->_gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene21::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASTalkOldLady: - _s21_nextOldLadySequenceId = 0x8B; - _vm->_gnapActionStatus = -1; - break; - case kASGrabBanana: - _vm->_gameSys->setAnimation(0x8C, 59, 0); - _vm->_gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); - _vm->setFlag(kGFUnk04); - _vm->invAdd(kItemBanana); - updateHotspots(); - _vm->_gnapActionStatus = kASGrabBananaDone; - break; - case kASGrabBananaDone: - _vm->setGrabCursorSprite(kItemBanana); - _vm->_gnapActionStatus = -1; - break; - case kASGrabOldLady: - _vm->_timers[4] = _vm->getRandom(30) + 50; - _s21_nextOldLadySequenceId = 0x87; - break; - case kASUseHatWithOldLady: - _vm->_gameSys->setAnimation(0x8F, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x8F; - _vm->_gnapActionStatus = kASUseHatWithOldLadyDone; - _vm->invAdd(kItemTickets); - _vm->invRemove(kItemGroceryStoreHat); - _vm->setGrabCursorSprite(-1); - break; - case kASUseHatWithOldLadyDone: - _s21_nextOldLadySequenceId = 0x91; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s21_nextOldLadySequenceId != -1) { - if (_s21_nextOldLadySequenceId == 0x87) { - _vm->_gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x86; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; - _s21_nextOldLadySequenceId = -1; - } else if (_s21_nextOldLadySequenceId == 0x91) { - _vm->_gameSys->setAnimation(0x91, 79, 0); - _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASLeaveScene; - _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; - _s21_nextOldLadySequenceId = -1; - } else { - _vm->_gameSys->setAnimation(_s21_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_s21_nextOldLadySequenceId, 79, _s21_currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _s21_currOldLadySequenceId = _s21_nextOldLadySequenceId; - _s21_nextOldLadySequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene21.h b/engines/gnap/scenes/scene21.h deleted file mode 100644 index ea83e69a1e..0000000000 --- a/engines/gnap/scenes/scene21.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE21_H -#define GNAP_SCENE21_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene21: public Scene { -public: - Scene21(GnapEngine *vm); - ~Scene21() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s21_currOldLadySequenceId; - int _s21_nextOldLadySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE21_H diff --git a/engines/gnap/scenes/scene22.cpp b/engines/gnap/scenes/scene22.cpp deleted file mode 100644 index 494af92b85..0000000000 --- a/engines/gnap/scenes/scene22.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene22.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitOutsideGrubCity = 1, - kHSExitBackGrubCity = 2, - kHSCashier = 3, - kHSDevice = 4, - kHSWalkArea1 = 5, - kHSWalkArea2 = 6 -}; - -enum { - kASLeaveScene = 0, - kASTalkCashier = 1 -}; - -Scene22::Scene22(GnapEngine *vm) : Scene(vm) { - _s22_caughtBefore = false; - _s22_cashierCtr = 3; -} - -int Scene22::init() { - return 0x5E; -} - -void Scene22::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitOutsideGrubCity, 0, 180, 184, 472, SF_EXIT_L_CURSOR, 3, 6); - _vm->setHotspot(kHSExitBackGrubCity, 785, 405, 800, 585, SF_EXIT_R_CURSOR, 11, 9); - _vm->setHotspot(kHSCashier, 578, 230, 660, 376, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - _vm->setHotspot(kHSWalkArea1, 553, 0, 800, 542); - _vm->setHotspot(kHSWalkArea2, 0, 0, 552, 488); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene22::run() { - _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); - - _s22_currCashierSequenceId = 0x59; - _s22_nextCashierSequenceId = -1; - - _vm->_gameSys->setAnimation(0x59, 1, 3); - _vm->_gameSys->insertSequence(_s22_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[6] = _vm->getRandom(30) + 20; - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(2, 8, kDirBottomRight); - _vm->initPlatypusPos(1, 8, kDirNone); - _vm->endSceneInit(); - } else { - _vm->initGnapPos(11, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y, kDirBottomRight); - _vm->initPlatypusPos(11, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y + 1, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); - } - - if (_vm->isFlag(kGFSceneFlag1)) { - int storeDetectiveSeqId; - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemCereals); - if (_s22_caughtBefore) { - switch (_vm->getRandom(3)) { - case 0: - storeDetectiveSeqId = 0x55; - break; - case 1: - storeDetectiveSeqId = 0x56; - break; - default: - storeDetectiveSeqId = 0x57; - break; - } - } else { - _s22_caughtBefore = true; - storeDetectiveSeqId = 0x54; - } - _vm->_gameSys->waitForUpdate(); - _vm->_gameSys->requestClear1(); - _vm->_gameSys->drawSpriteToBackground(0, 0, 0x44); - _vm->_gameSys->setAnimation(storeDetectiveSeqId, 256, 4); - _vm->_gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) { - _vm->gameUpdateTick(); - } - _vm->_sceneDone = true; - _vm->_newSceneNum = 20; - _s22_caughtBefore = true; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); - } - break; - - case kHSExitBackGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 23; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHSExitBackGrubCity].y + 1, -1, 0x107C2, 1); - } - break; - - case kHSCashier: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCashier].x, _vm->_hotspotsWalkPos[kHSCashier].y, 8, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 4); - break; - case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCashier].x, _vm->_hotspotsWalkPos[kHSCashier].y, - 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkCashier; - break; - case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[6] && _s22_nextCashierSequenceId == -1) { - _vm->_timers[6] = _vm->getRandom(30) + 20; - if (_vm->getRandom(8) != 0) { - _s22_nextCashierSequenceId = 0x59; - } else { - _s22_cashierCtr = (_s22_cashierCtr + 1) % 3; - switch (_s22_cashierCtr) { - case 1: - _s22_nextCashierSequenceId = 0x58; - break; - case 2: - _s22_nextCashierSequenceId = 0x5A; - break; - case 3: - _s22_nextCashierSequenceId = 0x5B; - break; - default: - _s22_nextCashierSequenceId = 0x58; - break; - } - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = 400; - _vm->_timers[1] = _vm->getRandom(20) + 30; - _vm->_timers[0] = _vm->getRandom(75) + 75; - } - - _vm->gameUpdateTick(); - } -} - -void Scene22::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASTalkCashier: - _s22_nextCashierSequenceId = 0x5C; - break; - } - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s22_nextCashierSequenceId != -1) { - _vm->_gameSys->setAnimation(_s22_nextCashierSequenceId, 1, 3); - _vm->_gameSys->insertSequence(_s22_nextCashierSequenceId, 1, _s22_currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _s22_currCashierSequenceId = _s22_nextCashierSequenceId; - _s22_nextCashierSequenceId = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene22.h b/engines/gnap/scenes/scene22.h deleted file mode 100644 index 44afa10da7..0000000000 --- a/engines/gnap/scenes/scene22.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE22_H -#define GNAP_SCENE22_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene22: public Scene { -public: - Scene22(GnapEngine *vm); - ~Scene22() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s22_currCashierSequenceId; - int _s22_nextCashierSequenceId; - bool _s22_caughtBefore; - int _s22_cashierCtr; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE22_H diff --git a/engines/gnap/scenes/scene23.cpp b/engines/gnap/scenes/scene23.cpp deleted file mode 100644 index 75838f4482..0000000000 --- a/engines/gnap/scenes/scene23.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene23.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitFrontGrubCity = 1, - kHSDevice = 2, - kHSCereals = 3, - kHSWalkArea1 = 4, - kHSWalkArea2 = 5 -}; - -enum { - kASLookCereals = 0, - kASGrabCereals = 1, - kASGrabCerealsDone = 2, - kASLeaveScene = 3 -}; - -Scene23::Scene23(GnapEngine *vm) : Scene(vm) { - _s23_currStoreClerkSequenceId = -1; - _s23_nextStoreClerkSequenceId = -1; -} - -int Scene23::init() { - return 0xC0; -} - -void Scene23::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitFrontGrubCity, 0, 250, 15, 550, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 7); - _vm->setHotspot(kHSCereals, 366, 332, 414, 408, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 340, 460); - _vm->setHotspot(kHSWalkArea2, 340, 0, 800, 501); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 6; -} - -void Scene23::run() { - _vm->_timers[4] = _vm->getRandom(100) + 200; - _vm->_timers[5] = _vm->getRandom(100) + 200; - - _s23_currStoreClerkSequenceId = 0xB4; - _s23_nextStoreClerkSequenceId = -1; - - _vm->_gameSys->setAnimation(0xB4, 1, 4); - _vm->_gameSys->insertSequence(_s23_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - _vm->queueInsertDeviceIcon(); - - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 7, kDirNone); - _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - - if (_vm->isFlag(kGFUnk24)) { - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); - } else { - _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); - _vm->setFlag(kGFUnk24); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 3, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSCereals: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, 5, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapMoan2(0, 0); - else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASLookCereals; - } - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapImpossible(0, 0); - else { - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSCereals].x, _vm->_hotspotsWalkPos[kHSCereals].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->setFlag(kGFSceneFlag1); - _vm->_gnapActionStatus = kASGrabCereals; - _vm->invAdd(kItemCereals); - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitFrontGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHSExitFrontGrubCity].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHSExitFrontGrubCity].y - 1, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4] && _vm->_gnapActionStatus == -1) { - _vm->_timers[4] = _vm->getRandom(100) + 200; - switch (_vm->getRandom(4)) { - case 0: - _vm->_gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - case 3: - _vm->_gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(100) + 200; - switch (_vm->getRandom(3)) { - case 0: - _vm->playSound(0xCE, false); - break; - case 1: - _vm->playSound(0xD0, false); - break; - case 2: - _vm->playSound(0xCF, false); - break; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene23::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLookCereals: - _vm->showFullScreenSprite(0x48); - _vm->_gnapActionStatus = -1; - break; - case kASGrabCereals: - _vm->_gameSys->setAnimation(0xBE, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->requestRemoveSequence(0xBF, 2); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0xBE; - _vm->_gnapActionStatus = kASGrabCerealsDone; - break; - case kASGrabCerealsDone: - _vm->setGrabCursorSprite(kItemCereals); - _vm->_gnapActionStatus = -1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s23_nextStoreClerkSequenceId == -1) { - switch (_vm->getRandom(8)) { - case 0: - case 1: - case 2: - _s23_nextStoreClerkSequenceId = 0xB4; - break; - case 3: - case 4: - case 5: - _s23_nextStoreClerkSequenceId = 0xB5; - break; - default: - _s23_nextStoreClerkSequenceId = 0xB6; - break; - } - _vm->_gameSys->setAnimation(_s23_nextStoreClerkSequenceId, 1, 4); - _vm->_gameSys->insertSequence(_s23_nextStoreClerkSequenceId, 1, _s23_currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _s23_currStoreClerkSequenceId = _s23_nextStoreClerkSequenceId; - _s23_nextStoreClerkSequenceId = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene23.h b/engines/gnap/scenes/scene23.h deleted file mode 100644 index 73543c9997..0000000000 --- a/engines/gnap/scenes/scene23.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE23_H -#define GNAP_SCENE23_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene23: public Scene { -public: - Scene23(GnapEngine *vm); - ~Scene23() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s23_currStoreClerkSequenceId; - int _s23_nextStoreClerkSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE23_H diff --git a/engines/gnap/scenes/scene24.cpp b/engines/gnap/scenes/scene24.cpp deleted file mode 100644 index d7959d0843..0000000000 --- a/engines/gnap/scenes/scene24.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene24.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitCircusWorld = 1, - kHSExitOutsideGrubCity = 2, - kHSDevice = 3, - kHSWalkArea1 = 4, - kHSWalkArea2 = 5, - kHSWalkArea3 = 6 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene24::Scene24(GnapEngine *vm) : Scene(vm) { - _s24_currWomanSequenceId = -1; - _s24_nextWomanSequenceId = -1; - _s24_boySequenceId = -1; - _s24_girlSequenceId = -1; -} - -int Scene24::init() { - return 0x3B; -} - -void Scene24::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitCircusWorld, 785, 128, 800, 600, SF_EXIT_R_CURSOR, 8, 7); - _vm->setHotspot(kHSExitOutsideGrubCity, 0, 213, 91, 600, SF_EXIT_NW_CURSOR, 1, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 0, 0); - _vm->setHotspot(kHSWalkArea2, 530, 0, 800, 600); - _vm->setHotspot(kHSWalkArea3, 0, 0, 800, 517); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene24::run() { - int counter = 0; - - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(9); - - _vm->_timers[7] = _vm->getRandom(100) + 100; - - _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_timers[5] = _vm->getRandom(20) + 40; - _vm->_timers[6] = _vm->getRandom(50) + 30; - - _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); - - _s24_currWomanSequenceId = 0x35; - _s24_girlSequenceId = 0x36; - _s24_boySequenceId = 0x30; - - if (_vm->_debugLevel == 4) - _vm->startIdleTimer(8); - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(1, 8, kDirBottomRight); - _vm->initPlatypusPos(2, 8, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(1, 9, -1, 0x107B9, 1); - _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(8, 8, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitCircusWorld: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 25; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitCircusWorld].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitCircusWorld].y, -1, 0x107C2, 1); - } - break; - - case kHSExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 20; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideGrubCity].y, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - if (_vm->_gnapActionStatus == -1) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x10940)) - _vm->playSound(0x10940, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_gameSys->insertSequence(0x37, 20, _s24_girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s24_girlSequenceId = 0x37; - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 40; - _vm->_gameSys->insertSequence(0x31, 20, _s24_boySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s24_boySequenceId = 0x31; - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(50) + 30; - counter = (counter + 1) % 3; - switch (counter) { - case 0: - _s24_nextWomanSequenceId = 0x32; - break; - case 1: - _s24_nextWomanSequenceId = 0x33; - break; - case 2: - _s24_nextWomanSequenceId = 0x34; - break; - } - _vm->_gameSys->insertSequence(_s24_nextWomanSequenceId, 20, _s24_currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _s24_currWomanSequenceId = _s24_nextWomanSequenceId; - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 100; - switch (_vm->getRandom(3)) { - case 0: - _vm->_gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 1: - _vm->_gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - case 2: - _vm->_gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); - break; - } - } - if (_vm->_debugLevel == 4) - _vm->updateIdleTimer(); - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene24::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - } - -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene24.h b/engines/gnap/scenes/scene24.h deleted file mode 100644 index ea6d694d17..0000000000 --- a/engines/gnap/scenes/scene24.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE24_H -#define GNAP_SCENE24_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene24: public Scene { -public: - Scene24(GnapEngine *vm); - ~Scene24() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s24_currWomanSequenceId; - int _s24_nextWomanSequenceId; - int _s24_boySequenceId; - int _s24_girlSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE24_H diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp deleted file mode 100644 index 4731f72dab..0000000000 --- a/engines/gnap/scenes/scene25.cpp +++ /dev/null @@ -1,397 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene25.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSTicketVendor = 1, - kHSExitOutsideCircusWorld = 2, - kHSExitInsideCircusWorld = 3, - kHSDevice = 4, - kHSPosters1 = 5, - kHSPosters2 = 6, - kHSPosters3 = 7, - kHSPosters4 = 8, - kHSWalkArea1 = 9, - kHSWalkArea2 = 10 -}; - -enum { - kASTalkTicketVendor = 0, - kASEnterCircusWihoutTicket = 1, - kASShowTicketToVendor = 2, - kASShowTicketToVendorDone = 3, - kASEnterCircusWihoutTicketDone = 4, - kASLeaveScene = 5 -}; - -Scene25::Scene25(GnapEngine *vm) : Scene(vm) { - _s25_currTicketVendorSequenceId = -1; - _s25_nextTicketVendorSequenceId = -1; -} - -int Scene25::init() { - return 0x62; -} - -void Scene25::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSTicketVendor, 416, 94, 574, 324, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 5); - _vm->setHotspot(kHSExitOutsideCircusWorld, 0, 519, 205, 600, SF_EXIT_SW_CURSOR, 5, 10); - _vm->setHotspot(kHSExitInsideCircusWorld, 321, 70, 388, 350, SF_EXIT_NE_CURSOR, 3, 6); - _vm->setHotspot(kHSPosters1, 0, 170, 106, 326, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - _vm->setHotspot(kHSPosters2, 146, 192, 254, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 7); - _vm->setHotspot(kHSPosters3, 606, 162, 654, 368, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 7); - _vm->setHotspot(kHSPosters4, 708, 114, 754, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 439); - _vm->setHotspot(kHSWalkArea2, 585, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 11; -} - -void Scene25::playAnims(int index) { - if (index > 4) - return; - - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - switch (index) { - case 1: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x25); - break; - case 2: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x26); - break; - case 3: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x27); - break; - case 4: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x28); - break; - } - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->delayTicksCursor(5); - while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && - !_vm->isKeyStatus1(29)) { - _vm->gameUpdateTick(); - } - _vm->_mouseClickState._left = false; - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _vm->clearKeyStatus1(29); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); - _vm->delayTicksCursor(5); - _vm->deleteSurface(&_vm->_largeSprite); - _vm->showCursor(); -} - -void Scene25::run() { - _vm->playSound(0x10940, true); - _vm->startSoundTimerA(5); - - _s25_currTicketVendorSequenceId = 0x52; - _vm->_gameSys->setAnimation(0x52, 39, 3); - _vm->_gameSys->insertSequence(_s25_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); - - _s25_nextTicketVendorSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(20) + 20; - - _vm->queueInsertDeviceIcon(); - - if (_vm->_prevSceneNum == 24) { - _vm->initGnapPos(5, 11, kDirUpLeft); - _vm->initPlatypusPos(6, 11, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 7, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(5, 6, kDirBottomRight); - _vm->initPlatypusPos(6, 6, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSTicketVendor: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemTickets) { - _vm->_gnapActionStatus = kASShowTicketToVendor; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, - 0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 6, 1); - _s25_nextTicketVendorSequenceId = 0x5B; - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 1); - _s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSTicketVendor].x, _vm->_hotspotsWalkPos[kHSTicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkTicketVendor; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107B4, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, -1, 0x107C2, 1); - } - break; - - case kHSExitInsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFNeedleTaken)) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 26; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, 0, 0x107B1, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHSExitInsideCircusWorld].y, -1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - } else { - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(4, 5, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASEnterCircusWihoutTicket; - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - } - } - break; - - case kHSPosters1: - case kHSPosters2: - case kHSPosters3: - case kHSPosters4: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1); - if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) - _vm->_gnapIdleFacing = kDirUpLeft; - else if (_vm->_sceneClickedHotspot == 8) - _vm->_gnapIdleFacing = kDirBottomRight; - else - _vm->_gnapIdleFacing = kDirUpRight; - _vm->playGnapIdle(0, 0); - playAnims(8 - _vm->_sceneClickedHotspot + 1); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapMoan2(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4] && _s25_nextTicketVendorSequenceId == -1 && _vm->_gnapActionStatus == -1) { - _vm->_timers[4] = _vm->getRandom(20) + 20; - switch (_vm->getRandom(13)) { - case 0: - _s25_nextTicketVendorSequenceId = 0x54; - break; - case 1: - _s25_nextTicketVendorSequenceId = 0x58; - break; - case 2: - _s25_nextTicketVendorSequenceId = 0x55; - break; - case 3: - _s25_nextTicketVendorSequenceId = 0x5A; - break; - case 4: - case 5: - case 6: - case 7: - _s25_nextTicketVendorSequenceId = 0x5B; - break; - case 8: - case 9: - case 10: - case 11: - _s25_nextTicketVendorSequenceId = 0x5C; - break; - case 12: - _s25_nextTicketVendorSequenceId = 0x5D; - break; - default: - _s25_nextTicketVendorSequenceId = 0x52; - break; - } - } - _vm->playSoundA(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene25::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASTalkTicketVendor: - _s25_nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; - _vm->_gnapActionStatus = -1; - break; - case kASEnterCircusWihoutTicket: - _s25_nextTicketVendorSequenceId = 0x5E; - _vm->_gameSys->setAnimation(0x5E, 39, 0); - _vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); - _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; - _s25_nextTicketVendorSequenceId = -1; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->playGnapIdle(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASEnterCircusWihoutTicketDone; - break; - case kASEnterCircusWihoutTicketDone: - _vm->_gnapActionStatus = -1; - break; - case kASShowTicketToVendor: - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemTickets); - _vm->setFlag(kGFNeedleTaken); - _vm->_gameSys->setAnimation(0x61, 40, 0); - _vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = kASShowTicketToVendorDone; - break; - case kASShowTicketToVendorDone: - _s25_nextTicketVendorSequenceId = 0x53; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - if (_s25_nextTicketVendorSequenceId == 0x53) { - _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; - _s25_nextTicketVendorSequenceId = -1; - _vm->_gnapActionStatus = -1; - } else if (_s25_nextTicketVendorSequenceId != -1) { - _vm->_gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; - _s25_nextTicketVendorSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene25.h b/engines/gnap/scenes/scene25.h deleted file mode 100644 index 72df792be7..0000000000 --- a/engines/gnap/scenes/scene25.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE25_H -#define GNAP_SCENE25_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene25: public Scene { -public: - Scene25(GnapEngine *vm); - ~Scene25() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s25_currTicketVendorSequenceId; - int _s25_nextTicketVendorSequenceId; - - void playAnims(int index); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE25_H diff --git a/engines/gnap/scenes/scene26.cpp b/engines/gnap/scenes/scene26.cpp deleted file mode 100644 index a8075963da..0000000000 --- a/engines/gnap/scenes/scene26.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene26.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitOutsideCircusWorld = 1, - kHSExitOutsideClown = 2, - kHSExitArcade = 3, - kHSExitElephant = 4, - kHSExitBeerStand = 5, - kHSDevice = 6, - kHSWalkArea1 = 7, - kHSWalkArea2 = 8 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene26::Scene26(GnapEngine *vm) : Scene(vm) { - _s26_currKidSequenceId = -1; - _s26_nextKidSequenceId = -1; -} - -int Scene26::init() { - return _vm->isFlag(kGFUnk23) ? 0x61 : 0x60; -} - -void Scene26::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitOutsideCircusWorld, 0, 590, 300, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 1, 10); - _vm->setHotspot(kHSExitOutsideClown, 200, 265, 265, 350, SF_EXIT_U_CURSOR, 3, 8); - _vm->setHotspot(kHSExitArcade, 0, 295, 150, 400, SF_EXIT_NW_CURSOR, 2, 8); - _vm->setHotspot(kHSExitElephant, 270, 290, 485, 375, SF_EXIT_U_CURSOR, 5, 8); - _vm->setHotspot(kHSExitBeerStand, 530, 290, 620, 350, SF_EXIT_NE_CURSOR, 5, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 500); - _vm->setHotspot(kHSWalkArea2, 281, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 9; -} - -void Scene26::run() { - _vm->startSoundTimerB(7); - _vm->playSound(0x1093B, true); - - _s26_currKidSequenceId = 0x5B; - _s26_nextKidSequenceId = -1; - _vm->_gameSys->setAnimation(0x5B, 160, 3); - _vm->_gameSys->insertSequence(_s26_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); - - _vm->_timers[5] = _vm->getRandom(20) + 50; - _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_timers[6] = _vm->getRandom(50) + 100; - - _vm->queueInsertDeviceIcon(); - - _vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); - - if (_vm->_prevSceneNum == 25) { - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-2, 8, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(2, 8, kDirBottomRight); - _vm->initPlatypusPos(3, 8, kDirNone); - _vm->endSceneInit(); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 25; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideCircusWorld].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitArcade: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 29; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitArcade].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitElephant: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 30; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSExitBeerStand: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 31; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[5] && _s26_nextKidSequenceId == -1) { - _vm->_timers[5] = _vm->getRandom(20) + 50; - if (_vm->getRandom(5) != 0) - _s26_nextKidSequenceId = 0x5B; - else - _s26_nextKidSequenceId = 0x5A; - } - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 130; - _vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[6]) { - _vm->_timers[6] = _vm->getRandom(50) + 100; - _vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene26::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s26_nextKidSequenceId != -1) { - _vm->_gameSys->insertSequence(_s26_nextKidSequenceId, 160, _s26_currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s26_nextKidSequenceId, 160, 3); - _s26_currKidSequenceId = _s26_nextKidSequenceId; - _s26_nextKidSequenceId = -1; - } - -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene26.h b/engines/gnap/scenes/scene26.h deleted file mode 100644 index a29b0d8469..0000000000 --- a/engines/gnap/scenes/scene26.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE26_H -#define GNAP_SCENE26_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene26: public Scene { -public: - Scene26(GnapEngine *vm); - ~Scene26() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s26_currKidSequenceId; - int _s26_nextKidSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE26_H diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp deleted file mode 100644 index c2c32983b4..0000000000 --- a/engines/gnap/scenes/scene27.cpp +++ /dev/null @@ -1,421 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene27.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSJanitor = 1, - kHSDevice = 2, - kHSBucket = 3, - kHSExitCircus = 4, - kHSExitArcade = 5, - kHSExitBeerStand = 6, - kHSExitClown = 7, - kHSWalkArea1 = 8 -}; - -enum { - kASTalkJanitor = 0, - kASGrabBucket = 1, - kASGrabBucketDone = 2, - kASShowPictureToJanitor = 3, - kASTryEnterClownTent = 4, - kASTryEnterClownTentDone = 5, - kASEnterClownTent = 6, - kASLeaveScene = 7 -}; - -Scene27::Scene27(GnapEngine *vm) : Scene(vm) { - _s27_nextJanitorSequenceId = -1; - _s27_currJanitorSequenceId = -1; -} - -int Scene27::init() { - return 0xD5; -} - -void Scene27::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSJanitor, 488, 204, 664, 450, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 8); - _vm->setHotspot(kHSBucket, 129, 406, 186, 453, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 6); - _vm->setHotspot(kHSExitCircus, 200, 585, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitArcade, 0, 0, 15, 600, SF_EXIT_L_CURSOR, 0, 6); - _vm->setHotspot(kHSExitBeerStand, 785, 0, 800, 600, SF_EXIT_R_CURSOR, 11, 7); - _vm->setHotspot(kHSExitClown, 340, 240, 460, 420, SF_EXIT_U_CURSOR, 6, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 507); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk13)) - _vm->_hotspots[kHSBucket]._flags = SF_DISABLED; - _vm->_hotspotsCount = 9; -} - -void Scene27::run() { - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(4); - _vm->_timers[7] = _vm->getRandom(100) + 300; - _vm->queueInsertDeviceIcon(); - - if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_debugLevel == 4) - _vm->startIdleTimer(6); - - _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); - - _s27_currJanitorSequenceId = 0xCB; - _s27_nextJanitorSequenceId = -1; - - _vm->_gameSys->setAnimation(0xCB, 39, 3); - _vm->_timers[5] = _vm->getRandom(20) + 60; - - switch (_vm->_prevSceneNum) { - case 26: - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - break; - case 29: - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-1, 9, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); - break; - case 31: - _vm->initGnapPos(12, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); - break; - default: - _vm->initGnapPos(6, 8, kDirBottomRight); - _vm->initPlatypusPos(5, 9, kDirNone); - _vm->endSceneInit(); - break; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - _vm->_sceneClickedHotspot = -1; - if (_vm->_gnapActionStatus < 0) - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSJanitor: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemPicture) { - _vm->_gnapIdleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 0, 0x107BC, 1)) - _vm->_gnapActionStatus = kASShowPictureToJanitor; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 7, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 3); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSJanitor].x, _vm->_hotspotsWalkPos[kHSJanitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkJanitor; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSBucket: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 3, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 3); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBucket].x, _vm->_hotspotsWalkPos[kHSBucket].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabBucket; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitCircus: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 26; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C7, 1); - } - break; - - case kHSExitArcade: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 29; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitArcade].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitArcade].x, _vm->_hotspotsWalkPos[kHSExitArcade].y + 1, -1, 0x107CF, 1); - } - break; - - case kHSExitBeerStand: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 31; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitBeerStand].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBeerStand].x, _vm->_hotspotsWalkPos[kHSExitBeerStand].y + 1, -1, 0x107CD, 1); - } - break; - - case kHSExitClown: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatypus)) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 28; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x, _vm->_hotspotsWalkPos[kHSExitClown].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x + 1, _vm->_hotspotsWalkPos[kHSExitClown].y, -1, 0x107C4, 1); - } else { - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitClown].x, 7, 0, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= SF_WALKABLE; - _vm->_gnapActionStatus = kASTryEnterClownTent; - } - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (_vm->_debugLevel == 4) - _vm->updateIdleTimer(); - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0) { - if (_vm->getRandom(3) != 0) - _s27_nextJanitorSequenceId = 0xCB; - else - _s27_nextJanitorSequenceId = 0xCF; - } - } - if (!_vm->_timers[7]) { - _vm->_timers[7] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene27::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASTalkJanitor: - switch (_vm->getRandom(3)) { - case 0: - _s27_nextJanitorSequenceId = 0xCC; - break; - case 1: - _s27_nextJanitorSequenceId = 0xCD; - break; - case 2: - _s27_nextJanitorSequenceId = 0xCE; - break; - } - break; - case kASGrabBucket: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_hotspots[kHSBucket]._flags = SF_DISABLED; - _vm->invAdd(kItemEmptyBucket); - _vm->setFlag(kGFUnk13); - _vm->_gameSys->setAnimation(0xD2, 39, 0); - _vm->_gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASGrabBucketDone; - break; - case kASGrabBucketDone: - _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->_gnapActionStatus = -1; - break; - case kASShowPictureToJanitor: - _s27_nextJanitorSequenceId = 0xD0; - break; - case kASTryEnterClownTent: - _s27_nextJanitorSequenceId = 0xD1; - _vm->_gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - _vm->_gnapActionStatus = kASTryEnterClownTentDone; - break; - case kASTryEnterClownTentDone: - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = -1; - break; - case kASEnterClownTent: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107B2, 1); - _vm->_gnapActionStatus = kASLeaveScene; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s27_nextJanitorSequenceId) { - case -1: - _s27_nextJanitorSequenceId = 0xCB; - _vm->_gameSys->insertSequence(0xCB, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - break; - case 0xCC: - case 0xCD: - case 0xCE: - _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - break; - case 0xD0: - // Show picture to janitor - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); - _vm->_gnapActionStatus = kASEnterClownTent; - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - _vm->setFlag(kGFPlatypus); - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemPicture); - _vm->_newSceneNum = 28; - break; - default: - _vm->_gameSys->insertSequence(_s27_nextJanitorSequenceId, 39, _s27_currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); - _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; - _s27_nextJanitorSequenceId = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene27.h b/engines/gnap/scenes/scene27.h deleted file mode 100644 index 9ee00538bc..0000000000 --- a/engines/gnap/scenes/scene27.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE27_H -#define GNAP_SCENE27_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene27: public Scene { -public: - Scene27(GnapEngine *vm); - ~Scene27() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s27_nextJanitorSequenceId; - int _s27_currJanitorSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE27_H diff --git a/engines/gnap/scenes/scene28.cpp b/engines/gnap/scenes/scene28.cpp deleted file mode 100644 index ac55d90f01..0000000000 --- a/engines/gnap/scenes/scene28.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene28.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSHorn = 1, - kHSClown = 2, - kHSExitOutsideClown = 3, - kHSEmptyBucket = 4, - kHSDevice = 5, - kHSWalkArea1 = 6, - kHSWalkArea2 = 7 -}; - -enum { - kASUseBeerBucketWithClown = 0, - kASUsePillBucketWithClown = 1, - kASGrabHornFails = 2, - kASGrabEmptyBucket = 3, - kASGrabHornSuccess = 4, - kASGrabHornSuccessDone = 5, - kASGrabEmptyBucketDone = 6, - kASGrabHornFailsDone = 7, - kASTalkClown = 8, - kASGnapWaiting = 9, - kASLeaveScene = 10 -}; - -Scene28::Scene28(GnapEngine *vm) : Scene(vm) { - _s28_currClownSequenceId = -1; - _s28_nextClownSequenceId = -1; - _s28_clownTalkCtr = 0; -} - -int Scene28::init() { - return 0x125; -} - -void Scene28::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSHorn, 148, 352, 215, 383, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 1, 7); - _vm->setHotspot(kHSClown, 130, 250, 285, 413, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 5); - _vm->setHotspot(kHSExitOutsideClown, 660, 190, 799, 400, SF_EXIT_R_CURSOR, 9, 6); - _vm->setHotspot(kHSEmptyBucket, 582, 421, 643, 478, SF_WALKABLE | SF_DISABLED, 9, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 799, 523); - _vm->setHotspot(kHSWalkArea2, 0, 0, 0, 0, 7, SF_DISABLED); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->invHas(kItemHorn)) - _vm->_hotspots[kHSHorn]._flags = SF_DISABLED; - if (_vm->isFlag(kGFUnk22)) - _vm->_hotspots[kHSEmptyBucket]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _vm->_hotspotsCount = 8; -} - -void Scene28::run() { - _vm->playSound(0x1093C, true); - _s28_nextClownSequenceId = -1; - _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFUnk22)) - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFMudTaken)) { - if (_vm->isFlag(kGFUnk21)) { - _vm->_gameSys->setAnimation(0x11C, 39, 3); - _vm->_gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); - if (!_vm->invHas(kItemHorn)) - _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); - _s28_currClownSequenceId = 0x11C; - } else { - _s28_currClownSequenceId = 0x11B; - _vm->_gameSys->setAnimation(0x11B, 39, 3); - _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[4] = _vm->getRandom(20) + 80; - } - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirUnk4); - _vm->endSceneInit(); - } else { - _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirUnk4); - _vm->endSceneInit(); - _vm->playSequences(0xF7, 0x121, 0x122, 0x123); - _s28_currClownSequenceId = 0x115; - _vm->setFlag(kGFMudTaken); - _vm->_gameSys->setAnimation(0x115, 39, 3); - _vm->_gameSys->insertSequence(_s28_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); - _s28_nextClownSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(20) + 80; - _vm->_gnapActionStatus = kASGnapWaiting; - while (_vm->_gameSys->getAnimationStatus(3) != 2) { - _vm->gameUpdateTick(); - _vm->updateMouseCursor(); - } - _vm->_gnapActionStatus = -1; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSHorn: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(2, 8, 3, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 4); - break; - case GRAB_CURSOR: - if (_vm->isFlag(kGFUnk21)) { - if (!_vm->invHas(kItemHorn)) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabHornSuccess; - } - } else { - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSHorn].x, _vm->_hotspotsWalkPos[kHSHorn].y, 0, 0x107BB, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASGrabHornFails; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSClown: - if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFUnk21)) { - if (_vm->_verbCursor == LOOK_CURSOR) - _vm->playGnapScratchingHead(5, 2); - else - _vm->playGnapImpossible(0, 0); - } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kASUseBeerBucketWithClown; - } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 0, 0x107BC, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kASUsePillBucketWithClown; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSClown].x, _vm->_hotspotsWalkPos[kHSClown].y, 2, 4); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 2); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkClown; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, -1, 0x107C2, 1); - } - break; - - case kHSEmptyBucket: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); - } else if (_vm->isFlag(kGFUnk21)) { - _vm->playGnapImpossible(8, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 6); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSEmptyBucket].x, _vm->_hotspotsWalkPos[kHSEmptyBucket].y) | 0x10000, 1); - _vm->_gnapActionStatus = kASGrabEmptyBucket; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093C)) - _vm->playSound(0x1093C, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 80; - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFUnk21)) - _s28_nextClownSequenceId = 0x114; - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene28::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASUseBeerBucketWithClown: - _vm->setFlag(kGFUnk22); - _s28_nextClownSequenceId = 0x113; - _vm->invRemove(kItemBucketWithBeer); - updateHotspots(); - break; - case kASUsePillBucketWithClown: - _s28_nextClownSequenceId = 0x116; - _vm->invRemove(kItemBucketWithPill); - _vm->setFlag(kGFUnk22); - _vm->setFlag(kGFUnk21); - updateHotspots(); - break; - case kASGrabHornFails: - _s28_nextClownSequenceId = 0x119; - break; - case kASGrabHornSuccess: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x117, 59, 0); - _vm->_gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASGrabHornSuccessDone; - break; - case kASGrabHornSuccessDone: - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->addFullScreenSprite(0xF6, 255); - _vm->_gameSys->setAnimation(0x120, 256, 0); - _vm->_gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - _vm->setGrabCursorSprite(kItemHorn); - _vm->invAdd(kItemHorn); - updateHotspots(); - _vm->_gnapActionStatus = -1; - break; - case kASGrabEmptyBucket: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x111, 99, 0); - _vm->_gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASGrabEmptyBucketDone; - break; - case kASGrabEmptyBucketDone: - _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->clearFlag(kGFUnk22);; - updateHotspots(); - _vm->invAdd(kItemEmptyBucket); - _vm->_gnapActionStatus = -1; - break; - case kASGrabHornFailsDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _s28_currClownSequenceId = 0x11B; - _s28_nextClownSequenceId = -1; - _vm->_gnapActionStatus = -1; - _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); - break; - case kASTalkClown: - _s28_clownTalkCtr = (_s28_clownTalkCtr + 1) % 2; - if (_s28_clownTalkCtr == 0) - _s28_nextClownSequenceId = 0x11D; - else if (_s28_clownTalkCtr == 1) - _s28_nextClownSequenceId = 0x11E; - else if (_s28_clownTalkCtr == 2) - _s28_nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? - break; - case kASGnapWaiting: - _vm->_gnapActionStatus = -1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s28_nextClownSequenceId) { - case 0x113: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11B, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s28_currClownSequenceId = 0x11B; - _s28_nextClownSequenceId = -1; - _vm->_gnapActionStatus = kASGnapWaiting; - break; - case 0x116: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11C, 39, _s28_nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_s28_nextClownSequenceId), 0, 0); - _s28_currClownSequenceId = _s28_nextClownSequenceId; - _s28_nextClownSequenceId = -1; - _vm->_gnapActionStatus = kASGnapWaiting; - break; - case 0x11D: - case 0x11E: - case 0x11F: - _vm->_gnapActionStatus = -1; - break; - case 0x119: - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 0); - _vm->_gameSys->removeSequence(_s28_currClownSequenceId, 39, true); - _vm->_gnapActionStatus = kASGrabHornFailsDone; - _vm->_gnapSequenceId = _s28_nextClownSequenceId; - _vm->_gnapSequenceDatNum = 0; - _s28_nextClownSequenceId = -1; - break; - } - if (_s28_nextClownSequenceId != -1) { - _vm->_gameSys->insertSequence(_s28_nextClownSequenceId, 39, _s28_currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s28_nextClownSequenceId, 39, 3); - _s28_currClownSequenceId = _s28_nextClownSequenceId; - _s28_nextClownSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene28.h b/engines/gnap/scenes/scene28.h deleted file mode 100644 index 40fa93b15a..0000000000 --- a/engines/gnap/scenes/scene28.h +++ /dev/null @@ -1,51 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE28_H -#define GNAP_SCENE28_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene28: public Scene { -public: - Scene28(GnapEngine *vm); - ~Scene28() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s28_currClownSequenceId; - int _s28_nextClownSequenceId; - int _s28_clownTalkCtr; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE28_H diff --git a/engines/gnap/scenes/scene29.cpp b/engines/gnap/scenes/scene29.cpp deleted file mode 100644 index 5312a0bf8a..0000000000 --- a/engines/gnap/scenes/scene29.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene29.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSMonkey = 1, - kHSDevice = 2, - kHSExitCircus = 3, - kHSExitOutsideClown = 4, - kHSAracde = 5, - kHSWalkArea1 = 6 -}; - -enum { - kASUseBananaWithMonkey = 0, - kASLeaveScene = 2 -}; - -Scene29::Scene29(GnapEngine *vm) : Scene(vm) { - _s29_currMonkeySequenceId = -1; - _s29_nextMonkeySequenceId = -1; - _s29_currManSequenceId = -1; - _s29_nextManSequenceId = -1; -} - -int Scene29::init() { - return 0xF6; -} - -void Scene29::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSMonkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); - _vm->setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); - _vm->setHotspot(kHSAracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 478); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->invHas(kItemHorn)) - _vm->_hotspots[kHSMonkey]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _vm->_hotspotsCount = 7; -} - -void Scene29::run() { - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(6); - _vm->queueInsertDeviceIcon(); - - if (_vm->invHas(kItemHorn)) { - _s29_currMonkeySequenceId = 0xE8; - _s29_nextMonkeySequenceId = -1; - _vm->_gameSys->setAnimation(0xE8, 159, 4); - _vm->_gameSys->insertSequence(_s29_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _s29_currManSequenceId = 0xED; - _s29_nextManSequenceId = -1; - _vm->_gameSys->setAnimation(0xED, 39, 3); - _vm->_timers[4] = _vm->getRandom(20) + 60; - } else { - _vm->_gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); - } - - _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); - - if (_vm->_prevSceneNum == 27) { - _vm->initGnapPos(12, 7, kDirBottomRight); - _vm->initPlatypusPos(12, 8, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 7, -1, 0x107B9, 1); - _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); - } else { - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 7, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSMonkey: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemBanana) { - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASUseBananaWithMonkey; - _vm->_newSceneNum = 51; - _vm->_isLeavingScene = true; - _vm->setGrabCursorSprite(-1); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y, 5, 6); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 6); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[kHSMonkey].x, _vm->_hotspotsWalkPos[kHSMonkey].y); - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitCircus: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 26; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y - 1, -1, 0x107CD, 1); - } - break; - - case kHSAracde: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->setGrabCursorSprite(-1); - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 52; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y, 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y); - _vm->_gnapActionStatus = kASLeaveScene; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSAracde].x, _vm->_hotspotsWalkPos[kHSAracde].y, 2, 3); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan2(0, 0); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_gnapActionStatus < 0) { - _vm->updateGnapIdleSequence(); - _vm->updatePlatypusIdleSequence(); - } - if (!_vm->_timers[4]) { - if (_vm->invHas(kItemHorn)) { - _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0) { - switch (_vm->getRandom(5)) { - case 0: - _s29_nextManSequenceId = 0xED; - break; - case 1: - _s29_nextManSequenceId = 0xEE; - break; - case 2: - _s29_nextManSequenceId = 0xEF; - break; - case 3: - _s29_nextManSequenceId = 0xF0; - break; - case 4: - _s29_nextManSequenceId = 0xF1; - break; - } - } - } - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene29::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASUseBananaWithMonkey: - _s29_nextMonkeySequenceId = 0xE5; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s29_nextManSequenceId != -1) { - _vm->_gameSys->insertSequence(_s29_nextManSequenceId, 39, _s29_currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s29_nextManSequenceId, 39, 3); - _s29_currManSequenceId = _s29_nextManSequenceId; - _s29_nextManSequenceId = -1; - } - - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - if (_s29_nextMonkeySequenceId == 0xE5) { - _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0xF2; - _vm->_gameSys->setAnimation(0xE6, 159, 0); - _vm->_gameSys->setAnimation(0, 159, 4); - _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xE6, 159, _s29_nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kASLeaveScene; - _s29_currMonkeySequenceId = 0xE6; - _s29_nextMonkeySequenceId = -1; - _vm->_timers[5] = 30; - while (_vm->_timers[5]) - _vm->gameUpdateTick(); - _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); - while (_vm->_gameSys->getAnimationStatus(1) != 2) - _vm->gameUpdateTick(); - } else if (_s29_nextMonkeySequenceId == -1) { - switch (_vm->getRandom(6)) { - case 0: - _s29_nextMonkeySequenceId = 0xE8; - break; - case 1: - _s29_nextMonkeySequenceId = 0xE9; - break; - case 2: - _s29_nextMonkeySequenceId = 0xEA; - break; - case 3: - _s29_nextMonkeySequenceId = 0xEB; - break; - case 4: - _s29_nextMonkeySequenceId = 0xEC; - break; - case 5: - _s29_nextMonkeySequenceId = 0xE7; - break; - } - _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s29_nextMonkeySequenceId, 159, 4); - _s29_currMonkeySequenceId = _s29_nextMonkeySequenceId; - _s29_nextMonkeySequenceId = -1; - } else { - _vm->_gameSys->insertSequence(_s29_nextMonkeySequenceId, 159, _s29_currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s29_nextMonkeySequenceId, 159, 4); - _s29_currMonkeySequenceId = _s29_nextMonkeySequenceId; - _s29_nextMonkeySequenceId = -1; - } - } - -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene29.h b/engines/gnap/scenes/scene29.h deleted file mode 100644 index 3ce5d8d497..0000000000 --- a/engines/gnap/scenes/scene29.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE29_H -#define GNAP_SCENE29_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene29: public Scene { -public: - Scene29(GnapEngine *vm); - ~Scene29() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s29_currMonkeySequenceId; - int _s29_nextMonkeySequenceId; - int _s29_currManSequenceId; - int _s29_nextManSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE29_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 6f6a922a9b..52925ca08d 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -28,18 +28,9 @@ #include "gnap/scenes/groupcs.h" #include "gnap/scenes/group0.h" #include "gnap/scenes/group1.h" +#include "gnap/scenes/group2.h" #include "gnap/scenes/intro.h" -#include "gnap/scenes/scene20.h" -#include "gnap/scenes/scene21.h" -#include "gnap/scenes/scene22.h" -#include "gnap/scenes/scene23.h" -#include "gnap/scenes/scene24.h" -#include "gnap/scenes/scene25.h" -#include "gnap/scenes/scene26.h" -#include "gnap/scenes/scene27.h" -#include "gnap/scenes/scene28.h" -#include "gnap/scenes/scene29.h" #include "gnap/scenes/scene30.h" #include "gnap/scenes/scene31.h" #include "gnap/scenes/scene32.h" -- cgit v1.2.3 From d7bd157fef8feee89fe111bc6f1bbc670e1e9201 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 28 Apr 2016 06:54:39 +0200 Subject: GNAP: renaming and grouping of scenes in group 3 --- engines/gnap/module.mk | 7 +- engines/gnap/scenes/group3.cpp | 1682 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group3.h | 125 +++ engines/gnap/scenes/scene30.cpp | 285 ------- engines/gnap/scenes/scene30.h | 49 -- engines/gnap/scenes/scene31.cpp | 408 --------- engines/gnap/scenes/scene31.h | 53 -- engines/gnap/scenes/scene32.cpp | 199 ----- engines/gnap/scenes/scene32.h | 46 - engines/gnap/scenes/scene33.cpp | 328 -------- engines/gnap/scenes/scene33.h | 50 -- engines/gnap/scenes/scene38.cpp | 360 -------- engines/gnap/scenes/scene38.h | 46 - engines/gnap/scenes/scene39.cpp | 242 ------ engines/gnap/scenes/scene39.h | 50 -- engines/gnap/scenes/scenecore.cpp | 7 +- 16 files changed, 1809 insertions(+), 2128 deletions(-) create mode 100644 engines/gnap/scenes/group3.cpp create mode 100644 engines/gnap/scenes/group3.h delete mode 100644 engines/gnap/scenes/scene30.cpp delete mode 100644 engines/gnap/scenes/scene30.h delete mode 100644 engines/gnap/scenes/scene31.cpp delete mode 100644 engines/gnap/scenes/scene31.h delete mode 100644 engines/gnap/scenes/scene32.cpp delete mode 100644 engines/gnap/scenes/scene32.h delete mode 100644 engines/gnap/scenes/scene33.cpp delete mode 100644 engines/gnap/scenes/scene33.h delete mode 100644 engines/gnap/scenes/scene38.cpp delete mode 100644 engines/gnap/scenes/scene38.h delete mode 100644 engines/gnap/scenes/scene39.cpp delete mode 100644 engines/gnap/scenes/scene39.h diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 52d6a5a4d4..388b33b178 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -14,13 +14,8 @@ MODULE_OBJS := \ scenes/group0.o \ scenes/group1.o \ scenes/group2.o \ + scenes/group3.o \ scenes/intro.o \ - scenes/scene30.o \ - scenes/scene31.o \ - scenes/scene32.o \ - scenes/scene33.o \ - scenes/scene38.o \ - scenes/scene39.o \ scenes/scene40.o \ scenes/scene41.o \ scenes/scene42.o \ diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp new file mode 100644 index 0000000000..d61859a07c --- /dev/null +++ b/engines/gnap/scenes/group3.cpp @@ -0,0 +1,1682 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/group3.h" + +namespace Gnap { + +enum { + kHS30Platypus = 0, + kHS30PillMachine = 1, + kHS30Device = 2, + kHS30ExitCircus = 3, + kHS30WalkArea1 = 4 +}; + +enum { + kAS30LeaveScene = 0, + kAS30UsePillMachine = 1, + kAS30UsePillMachine2 = 2, + kAS30LookPillMachine = 3, + kAS30UsePillMachine3 = 4, + kAS30UsePillMachine4 = 5 +}; + +Scene30::Scene30(GnapEngine *vm) : Scene(vm) { + _kidSequenceId = -1; +} + +int Scene30::init() { + return _vm->isFlag(kGFUnk23) ? 0x10B : 0x10A; +} + +void Scene30::updateHotspots() { + _vm->setHotspot(kHS30Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS30PillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); + _vm->setHotspot(kHS30ExitCircus, 100, 590 - _vm->_deviceY1, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS30WalkArea1, 0, 0, 800, 514); + _vm->setDeviceHotspot(kHS30Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 5; +} + +void Scene30::run() { + bool hasTakenPill = false; + + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFUnk23)) + _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (!_vm->isFlag(kGFUnk13)) + _vm->_gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[5] = _vm->getRandom(50) + 180; + + _vm->_gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(100) + 300; + + _kidSequenceId = 0x101; + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS30Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS30Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS30PillMachine: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { + _vm->_hotspots[kHS30WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 0, 0x107BC, 1); + _vm->_hotspots[kHS30WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS30UsePillMachine; + hasTakenPill = true; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(9, 8, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS30LookPillMachine; + break; + case GRAB_CURSOR: + _vm->playGnapScratchingHead(8, 5); + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(8, 5); + break; + } + } + } + break; + + case kHS30ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + if (hasTakenPill) + _vm->_newSceneNum = 47; + else + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS30LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, -1, 0x107C2, 1); + } + break; + + case kHS30WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(5) == 1) { + _vm->_gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _kidSequenceId = 0x100; + } else { + _vm->_gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); + } + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 180; + if (_vm->_gnapActionStatus < 0) { + if (!_vm->isFlag(kGFUnk23) || hasTakenPill) + _vm->_gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); + } + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene30::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS30LeaveScene: + _vm->_sceneDone = true; + break; + case kAS30UsePillMachine: + _vm->setGrabCursorSprite(-1); + _vm->_gameSys->setAnimation(0x105, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x105; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS30UsePillMachine2; + break; + case kAS30UsePillMachine2: + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + _vm->addFullScreenSprite(0x3F, 255); + _vm->_gameSys->removeSequence(0x105, _vm->_gnapId, true); + _vm->_gameSys->setAnimation(0x102, 256, 0); + _vm->_gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->_gameSys->setAnimation(0x103, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->_gnapActionStatus = kAS30UsePillMachine3; + _vm->invAdd(kItemPill); + _vm->setFlag(kGFUnk23); + break; + case kAS30UsePillMachine3: + _vm->_gameSys->setAnimation(0x104, _vm->_gnapId, 0); + _vm->_gameSys->insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x104; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapActionStatus = kAS30UsePillMachine4; + _vm->setGrabCursorSprite(kItemDiceQuarterHole); + break; + case kAS30UsePillMachine4: + _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y + 1, -1, 0x107BC, 1); + _vm->_gnapActionStatus = -1; + break; + case kAS30LookPillMachine: + if (_vm->isFlag(kGFUnk23)) + _vm->showFullScreenSprite(0xE3); + else + _vm->showFullScreenSprite(0xE2); + _vm->_gnapActionStatus = -1; + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS31Platypus = 0, + kHS31MeasuringClown = 1, + kHS31BeerBarrel = 2, + kHS31Device = 3, + kHS31ExitCircus = 4, + kHS31ExitOutsideClown = 5, + kHS31WalkArea1 = 6 +}; + +enum { + kAS31UseBeerBarrel = 1, + kAS31FillEmptyBucketWithBeer = 2, + kAS31FillEmptyBucketWithBeerDone = 3, + kAS31PlatMeasuringClown = 4, + kAS31UseMeasuringClown = 5, + kAS31LeaveScene = 6 +}; + +Scene31::Scene31(GnapEngine *vm) : Scene(vm) { + _beerGuyDistracted = false; + _currClerkSequenceId = -1; + _nextClerkSequenceId = -1; + _clerkMeasureCtr = -1; + _clerkMeasureMaxCtr = 3; +} + +int Scene31::init() { + return 0x105; +} + +void Scene31::updateHotspots() { + _vm->setHotspot(kHS31Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS31MeasuringClown, 34, 150, 256, 436, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 6); + _vm->setHotspot(kHS31BeerBarrel, 452, 182, 560, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHS31ExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS31ExitOutsideClown, 0, 0, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS31WalkArea1, 0, 0, 800, 480); + _vm->setDeviceHotspot(kHS31Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene31::run() { + _vm->playSound(0x1093B, true); + _vm->startSoundTimerB(6); + + _vm->queueInsertDeviceIcon(); + + _beerGuyDistracted = false; + _vm->_gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); + + _currClerkSequenceId = 0xFB; + _nextClerkSequenceId = -1; + + _vm->_gameSys->setAnimation(0xFB, 39, 3); + + _vm->_timers[4] = _vm->getRandom(20) + 60; + _vm->_timers[5] = _vm->getRandom(50) + 180; + + if (_vm->_prevSceneNum == 27) { + _vm->initGnapPos(-1, 8, kDirBottomLeft); + _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(3, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); + } else { + _vm->initGnapPos(7, 12, kDirBottomRight); + _vm->initPlatypusPos(6, 12, kDirNone); + _vm->endSceneInit(); + _vm->gnapWalkTo(7, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107D2, 1); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS31Device: + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS31Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemJoint) { + _vm->gnapUseJointOnPlatypus(); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS31MeasuringClown: + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_verbCursor == LOOK_CURSOR) + _vm->playGnapScratchingHead(2, 2); + else + _vm->playGnapImpossible(0, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(2, 2); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, -1, -1, 1); + _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 0, 0x107B9, 1); + _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_gnapActionStatus = kAS31UseMeasuringClown; + _vm->_timers[4] = 300; + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + if (!_vm->invHas(kItemBucketWithBeer)) { + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 1, 0x107C2, 1); + _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 1, 0x107C2, 1); + _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; + _vm->_platypusActionStatus = kAS31PlatMeasuringClown; + _vm->_gnapActionStatus = kAS31PlatMeasuringClown; + _vm->_timers[4] = 300; + } else + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS31BeerBarrel: + if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { + _vm->setGrabCursorSprite(-1); + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); + _clerkMeasureMaxCtr += 5; + _vm->_gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); + _vm->playGnapPullOutDevice(6, 8); + _vm->playGnapUseDevice(0, 0); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS31FillEmptyBucketWithBeer; + _vm->_timers[4] = 300; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(6, 2); + break; + case GRAB_CURSOR: + if (_beerGuyDistracted) { + _vm->playGnapScratchingHead(6, 2); + } else { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS31UseBeerBarrel; + _vm->_gnapIdleFacing = kDirUpLeft; + } + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS31ExitCircus: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 26; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS31LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, -1, -1, 1); + } + break; + + case kHS31ExitOutsideClown: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 27; + _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS31LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y + 1, -1, 0x107CF, 1); + } + break; + + case kHS31WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1093B)) + _vm->playSound(0x1093B, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 60; + if (_vm->_gnapActionStatus < 0 && _nextClerkSequenceId == -1) { + switch (_vm->getRandom(6)){ + case 0: + _nextClerkSequenceId = 0xFF; + break; + case 1: + _nextClerkSequenceId = 0x100; + break; + case 2: + _nextClerkSequenceId = 0x101; + break; + default: + _nextClerkSequenceId = 0xFB; + break; + } + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 180; + if (_vm->_gnapActionStatus < 0) { + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); + } + } + _vm->playSoundB(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene31::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS31UseBeerBarrel: + _nextClerkSequenceId = 0xFE; + break; + case kAS31FillEmptyBucketWithBeer: + _vm->_gameSys->setAnimation(0x102, 59, 0); + _vm->_gameSys->insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapX = 5; + _vm->_gnapY = 7; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapSequenceId = 0x102; + _vm->_gnapId = 59; + _vm->_gnapActionStatus = kAS31FillEmptyBucketWithBeerDone; + break; + case kAS31FillEmptyBucketWithBeerDone: + _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->playGnapPullOutDevice(0, 0); + _vm->playGnapUseDevice(0, 0); + _vm->_gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->invAdd(kItemBucketWithBeer); + _vm->invRemove(kItemEmptyBucket); + _vm->setGrabCursorSprite(kItemBucketWithBeer); + break; + case kAS31UseMeasuringClown: + _nextClerkSequenceId = 0xFA; + _clerkMeasureMaxCtr = 1; + break; + case kAS31LeaveScene: + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusActionStatus == kAS31PlatMeasuringClown) { + _vm->_sceneWaiting = true; + _beerGuyDistracted = true; + _nextClerkSequenceId = 0xFA; + } + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2) { + switch (_nextClerkSequenceId) { + case 0xFA: + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xFC, 39, _nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xFC, 39, 3); + _currClerkSequenceId = 0xFC; + _nextClerkSequenceId = 0xFC; + _clerkMeasureCtr = 0; + break; + case 0xFC: + ++_clerkMeasureCtr; + if (_clerkMeasureCtr >= _clerkMeasureMaxCtr) { + if (_vm->_gnapActionStatus != 5) + _vm->_platypusActionStatus = -1; + _vm->_timers[0] = 40; + _vm->_gameSys->insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currClerkSequenceId = 0xFD; + _nextClerkSequenceId = -1; + if (_vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeer) + _vm->_gnapActionStatus = -1; + _beerGuyDistracted = false; + _clerkMeasureMaxCtr = 3; + _vm->_gameSys->setAnimation(0xFD, 39, 3); + _vm->_sceneWaiting = false; + } else { + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _currClerkSequenceId = _nextClerkSequenceId; + _nextClerkSequenceId = 0xFC; + _vm->_gameSys->setAnimation(0xFC, 39, 3); + } + break; + case 0xFE: + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + _currClerkSequenceId = _nextClerkSequenceId; + _nextClerkSequenceId = -1; + _vm->_gnapActionStatus = -1; + break; + default: + if (_nextClerkSequenceId != -1) { + _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + _currClerkSequenceId = _nextClerkSequenceId; + _nextClerkSequenceId = -1; + } + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS32Platypus = 0, + kHS32ExitTruck = 1, + kHS32Device = 2, + kHS32WalkArea1 = 3, + kHS32WalkArea2 = 4, + kHS32WalkArea3 = 5, + kHS32WalkArea4 = 6, + kHS32WalkArea5 = 7, + kHS32WalkArea6 = 8, + kHS32WalkArea7 = 9, + kHS32WalkArea8 = 10 +}; + +enum { + kAS32LeaveScene = 0 +}; + +Scene32::Scene32(GnapEngine *vm) : Scene(vm) { + +} + +int Scene32::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0xF : 0x10; +} + +void Scene32::updateHotspots() { + _vm->setHotspot(kHS32Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS32ExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); + _vm->setHotspot(kHS32WalkArea1, 0, 0, 162, 426); + _vm->setHotspot(kHS32WalkArea2, 162, 0, 237, 396); + _vm->setHotspot(kHS32WalkArea3, 237, 0, 319, 363); + _vm->setHotspot(kHS32WalkArea4, 520, 0, 800, 404); + _vm->setHotspot(kHS32WalkArea5, 300, 447, 800, 600); + _vm->setHotspot(kHS32WalkArea6, 678, 0, 800, 404); + _vm->setHotspot(kHS32WalkArea7, 0, 0, 520, 351); + _vm->setHotspot(kHS32WalkArea8, 0, 546, 300, 600); + _vm->setDeviceHotspot(kHS32Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 11; +} + +void Scene32::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(5); + _vm->queueInsertDeviceIcon(); + _vm->_timers[4] = _vm->getRandom(100) + 300; + + if (_vm->_prevSceneNum == 33) { + _vm->initGnapPos(11, 6, kDirBottomLeft); + _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->endSceneInit(); + _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); + _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); + } else { + _vm->initGnapPos(1, 6, kDirBottomRight); + _vm->initPlatypusPos(1, 7, kDirNone); + _vm->endSceneInit(); + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS32Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS32Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS32ExitTruck: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->setGrabCursorSprite(-1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS32LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y + 1, -1, 0x107CD, 1); + _vm->_newSceneNum = 33; + } + break; + + case kHS32WalkArea1: + case kHS32WalkArea2: + case kHS32WalkArea3: + case kHS32WalkArea4: + case kHS32WalkArea5: + case kHS32WalkArea6: + case kHS32WalkArea7: + case kHS32WalkArea8: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = 0; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene32::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS32LeaveScene) + _vm->_sceneDone = true; + } +} + +/*****************************************************************************/ + +enum { + kHS33Platypus = 0, + kHS33Chicken = 1, + kHS33Device = 2, + kHS33ExitHouse = 3, + kHS33ExitBarn = 4, + kHS33ExitCreek = 5, + kHS33ExitPigpen = 6, + kHS33WalkArea1 = 7, + kHS33WalkArea2 = 8 +}; + +enum { + kAS33LeaveScene = 0, + kAS33TalkChicken = 1, + kAS33UseChicken = 2, + kAS33UseChickenDone = 3 +}; + +Scene33::Scene33(GnapEngine *vm) : Scene(vm) { + _currChickenSequenceId = -1; + _nextChickenSequenceId = -1; +} + +int Scene33::init() { + return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x84 : 0x85; +} + +void Scene33::updateHotspots() { + _vm->setHotspot(kHS33Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS33Chicken, 606, 455, 702, 568, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS33ExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 3); + _vm->setHotspot(kHS33ExitBarn, 610, 75, 800, 164, SF_EXIT_U_CURSOR, 10, 3); + _vm->setHotspot(kHS33ExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHS33ExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS33WalkArea1, 120, 0, 514, 458); + _vm->setHotspot(kHS33WalkArea2, 0, 0, 800, 452); + _vm->setDeviceHotspot(kHS33Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; +} + +void Scene33::run() { + _vm->playSound(0x1091C, true); + _vm->startSoundTimerC(6); + _vm->queueInsertDeviceIcon(); + + _currChickenSequenceId = 0x7E; + _vm->_gameSys->setAnimation(0x7E, 179, 2); + _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _nextChickenSequenceId = -1; + _vm->_timers[5] = _vm->getRandom(20) + 30; + _vm->_timers[4] = _vm->getRandom(100) + 300; + + switch (_vm->_prevSceneNum) { + case 34: + _vm->initGnapPos(11, 7, kDirBottomLeft); + _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 7, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); + break; + case 37: + _vm->initGnapPos(7, 7, kDirBottomRight); + _vm->initPlatypusPos(8, 7, kDirNone); + _vm->endSceneInit(); + break; + case 32: + _vm->initGnapPos(-1, 6, kDirBottomRight); + _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->endSceneInit(); + _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + break; + default: + _vm->initGnapPos(3, 7, kDirBottomRight); + _vm->initPlatypusPos(2, 7, kDirNone); + _vm->endSceneInit(); + break; + } + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + _vm->testWalk(0, 0, 7, 6, 8, 6); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS33Device: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + + case kHS33Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS33Chicken: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 9, 9, 8); + } else { + switch (_vm->_verbCursor) { + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + _vm->_gnapActionStatus = kAS33UseChicken; + else + _vm->_gnapActionStatus = -1; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS33TalkChicken; + break; + case LOOK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS33ExitHouse: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_newSceneNum = 37; + if (_vm->_gnapX > 6) + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); + else + _vm->gnapWalkTo(6, 7, 0, 0x107B1, 1); + } + break; + + case kHS33ExitBarn: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_newSceneNum = 35; + if (_vm->_gnapX > 7) + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); + else + _vm->gnapWalkTo(7, 7, 0, 0x107B1, 1); + } + break; + + case kHS33ExitCreek: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 34; + } + break; + + case kHS33ExitPigpen: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 32; + } + break; + + case kHS33WalkArea1: + case kHS33WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->isSoundPlaying(0x1091C)) + _vm->playSound(0x1091C, true); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 300; + if (_vm->getRandom(2) != 0) + _vm->_gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); + else + _vm->_gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); + } + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kAS33TalkChicken && _vm->_gnapActionStatus != kAS33UseChicken) { + if (_vm->getRandom(6) != 0) { + _nextChickenSequenceId = 0x7E; + _vm->_timers[5] = _vm->getRandom(20) + 30; + } else { + _nextChickenSequenceId = 0x80; + _vm->_timers[5] = _vm->getRandom(20) + 50; + } + } + _vm->playSoundC(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +void Scene33::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { + case kAS33LeaveScene: + _vm->_sceneDone = true; + break; + case kAS33TalkChicken: + _nextChickenSequenceId = 0x7F; + break; + case kAS33UseChicken: + _nextChickenSequenceId = 0x81; + _vm->_timers[2] = 100; + break; + case kAS33UseChickenDone: + _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceId = 0x7B5; + _vm->_gnapSequenceDatNum = 1; + _currChickenSequenceId = 0x7E; + _vm->_gameSys->setAnimation(0x7E, 179, 2); + _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->_timers[5] = 30; + break; + default: + _vm->_gnapActionStatus = -1; + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (_nextChickenSequenceId == 0x81) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + _nextChickenSequenceId = -1; + _currChickenSequenceId = -1; + _vm->_gnapActionStatus = kAS33UseChickenDone; + _vm->_timers[5] = 500; + } else if (_nextChickenSequenceId == 0x7F) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + _vm->_gnapActionStatus = -1; + } else if (_nextChickenSequenceId != -1) { + _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); + _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + _currChickenSequenceId = _nextChickenSequenceId; + _nextChickenSequenceId = -1; + } + } +} + +/*****************************************************************************/ + +enum { + kHS38Platypus = 0, + kHS38ExitHouse = 1, + kHS38ExitCave = 2, + kHS38TrapDoorLid1 = 3, + kHS38TrapDoorLid2 = 4, + kHS38HuntingTrophy = 5, + kHS38WalkArea1 = 6, + kHS38Device = 7, + kHS38WalkArea2 = 8, + kHS38WalkArea3 = 9, + kHS38WalkArea4 = 10, + kHS38WalkArea5 = 11, + kHS38WalkArea6 = 12 +}; + +enum { + kAS38LeaveScene = 0, + kAS38ExitCave = 1, + kAS38UseHuntingTrophy = 2, + kAS38HoldingHuntingTrophy = 3, + kAS38ReleaseHuntingTrophy = 4, + kAS38UsePlatypusWithTrapDoor = 5, + kAS38PlatypusHoldingTrapDoor = 6 +}; + +Scene38::Scene38(GnapEngine *vm) : Scene(vm) { +} + +int Scene38::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0xA5; +} + +void Scene38::updateHotspots() { + _vm->setHotspot(kHS38Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS38ExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHS38ExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); + _vm->setHotspot(kHS38TrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); + _vm->setHotspot(kHS38TrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); + _vm->setHotspot(kHS38HuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHS38WalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); + _vm->setHotspot(kHS38WalkArea2, 0, 0, 799, 396); + _vm->setHotspot(kHS38WalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); + _vm->setHotspot(kHS38WalkArea4, 0, 0, 97, 445); + _vm->setHotspot(kHS38WalkArea5, 770, 0, 799, 445); + _vm->setHotspot(kHS38WalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); + _vm->setDeviceHotspot(kHS38Device, -1, -1, -1, -1); + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38Platypus]._flags = SF_WALKABLE | SF_DISABLED; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; + else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_DISABLED; + else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_hotspots[kHS38WalkArea6]._flags = SF_NONE; + _vm->_hotspotsCount = 13; +} + +void Scene38::run() { + _vm->queueInsertDeviceIcon(); + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->_prevSceneNum == 39) { + _vm->initGnapPos(3, 7, kDirBottomLeft); + _vm->initPlatypusPos(4, 7, kDirUnk4); + } else { + _vm->initGnapPos(3, 8, kDirBottomRight); + _vm->initPlatypusPos(4, 8, kDirNone); + } + _vm->endSceneInit(); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS38Device: + _vm->runMenu(); + updateHotspots(); + break; + + case kHS38Platypus: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + break; + + case kHS38ExitHouse: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + } else { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS38LeaveScene; + _vm->_newSceneNum = 37; + } + break; + + case kHS38ExitCave: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->_isLeavingScene = true; + } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + _vm->_sceneWaiting = false; + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kAS38ExitCave; + } + break; + + case kHS38TrapDoorLid1: + case kHS38TrapDoorLid2: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { + if (_vm->_verbCursor == PLAT_CURSOR && _vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) + _vm->_gnapActionStatus = kAS38UsePlatypusWithTrapDoor; + else + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + } + break; + + case kHS38HuntingTrophy: + if (_vm->_gnapActionStatus != kAS38HoldingHuntingTrophy) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 6, 2, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(0, 0); + break; + case GRAB_CURSOR: + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + _vm->playGnapImpossible(0, 0); + else { + _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); + _vm->platypusWalkTo(4, 8, -1, -1, 1); + _vm->_gnapActionStatus = kAS38UseHuntingTrophy; + } + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(2, 0); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS38WalkArea1: + // Nothing + break; + + case kHS38WalkArea2: + case kHS38WalkArea3: + case kHS38WalkArea4: + case kHS38WalkArea5: + case kHS38WalkArea6: + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left) { + if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + else if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + _vm->updatePlatypusIdleSequence(); + _vm->updateGnapIdleSequence(); + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene38::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case kAS38LeaveScene: + _vm->_sceneDone = true; + break; + case kAS38ExitCave: + _vm->_gameSys->removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); + _vm->_gameSys->insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA3; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0xA3, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS38LeaveScene; + break; + case kAS38UseHuntingTrophy: + _vm->_gameSys->removeSequence(0x9B, 0, true); + _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9C; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9C, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; + updateHotspots(); + break; + case kAS38HoldingHuntingTrophy: + if (_vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) + _vm->_sceneWaiting = true; + if (_vm->_gnapSequenceId == 0xA4) { + _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9D; + } else { + _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA4; + } + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); + break; + case kAS38ReleaseHuntingTrophy: + if (_vm->_gnapSequenceId == 0x9E) { + _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gnapActionStatus = -1; + } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0xA0; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + if (_vm->_isLeavingScene) { + _vm->_sceneWaiting = false; + _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->_newSceneNum = 39; + _vm->_gnapActionStatus = kAS38ExitCave; + } else { + _vm->_gnapActionStatus = -1; + } + } else { + _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapX = 3; + _vm->_gnapY = 6; + _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); + _vm->_sceneWaiting = false; + updateHotspots(); + } + break; + case kAS38UsePlatypusWithTrapDoor: + _vm->_sceneWaiting = false; + _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9F; + _vm->_gnapSequenceDatNum = 0; + _vm->_gameSys->setAnimation(0x9F, _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; + if (_vm->_platypusFacing != kDirNone) + _vm->playPlatypusSequence(0x107D5); + else + _vm->playPlatypusSequence(0x107D4); + _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); + _vm->_gameSys->insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA1; + _vm->_platypusSequenceDatNum = 0; + _vm->_platypusId = _vm->_gnapId + 1; + _vm->_gameSys->setAnimation(0xA1, _vm->_gnapId + 1, 1); + _vm->_platypusActionStatus = kAS38PlatypusHoldingTrapDoor; + updateHotspots(); + break; + } + } + + if (_vm->_gameSys->getAnimationStatus(1) == 2) { + _vm->_gameSys->setAnimation(0, 0, 1); + if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xA2; + _vm->_platypusSequenceDatNum = 0; + updateHotspots(); + _vm->_sceneWaiting = true; + } + } +} + +/*****************************************************************************/ + +enum { + kHS39Platypus = 0, + kHS39ExitInsideHouse = 1, + kHS39ExitUfoParty = 2, + kHS39Sign = 3, + kHS39Device = 4, + kHS39WalkArea1 = 5, + kHS39WalkArea2 = 6 +}; + +enum { + kAS39LeaveScene = 0 +}; + +Scene39::Scene39(GnapEngine *vm) : Scene(vm) { + _currGuySequenceId = -1; + _nextGuySequenceId = -1; +} + +int Scene39::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0x35; +} + +void Scene39::updateHotspots() { + _vm->setHotspot(kHS39Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS39ExitInsideHouse, 0, 0, 140, 206, SF_EXIT_U_CURSOR, 4, 8); + _vm->setHotspot(kHS39ExitUfoParty, 360, 204, 480, 430, SF_EXIT_R_CURSOR, 6, 8); + _vm->setHotspot(kHS39Sign, 528, 232, 607, 397, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 3); + _vm->setHotspot(kHS39WalkArea1, 0, 0, 800, 466); + _vm->setHotspot(kHS39WalkArea2, 502, 466, 800, 600); + _vm->setDeviceHotspot(kHS39Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 7; +} + +void Scene39::run() { + // Bug in the original? Timer was never initialized. + _vm->_timers[5] = 0; + + _vm->queueInsertDeviceIcon(); + _currGuySequenceId = 0x33; + + _vm->_gameSys->setAnimation(0x33, 21, 3); + _vm->_gameSys->insertSequence(_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); + + _nextGuySequenceId = -1; + if (_vm->_prevSceneNum == 38) { + _vm->initGnapPos(3, 7, kDirUpRight); + _vm->initPlatypusPos(2, 7, kDirUpLeft); + _vm->endSceneInit(); + } else { + _vm->initGnapPos(4, 7, kDirBottomRight); + _vm->initPlatypusPos(5, 7, kDirNone); + _vm->endSceneInit(); + } + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) { + _vm->playSound(0x1094B, true); + _vm->setSoundVolume(0x1094B, 60); + } + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS39Device: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 50; + break; + + case kHS39Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS39ExitUfoParty: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS39LeaveScene; + _vm->_newSceneNum = 40; + } + break; + + case kHS39Sign: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(0, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y, 0, -1, 1); + _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); + _vm->showFullScreenSprite(0x1C); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS39ExitInsideHouse: + if (_vm->_gnapActionStatus < 0) { + _vm->_sceneDone = true; + _vm->_isLeavingScene = true; + _vm->_newSceneNum = 38; + } + break; + + case kHS39WalkArea1: + case kHS39WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->_mouseClickState._left = false; + } + break; + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 50; + switch (_vm->getRandom(4)) { + case 0: + _nextGuySequenceId = 0x30; + break; + case 1: + _nextGuySequenceId = 0x31; + break; + case 2: + _nextGuySequenceId = 0x32; + break; + case 3: + _nextGuySequenceId = 0x33; + break; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[5] = _vm->getRandom(20) + 50; + } + + _vm->gameUpdateTick(); + } +} + +void Scene39::updateAnimations() { + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + _vm->_gameSys->setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus == kAS39LeaveScene) + _vm->_sceneDone = true; + else + _vm->_gnapActionStatus = -1; + } + + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { + _vm->_gameSys->setAnimation(_nextGuySequenceId, 21, 3); + _vm->_gameSys->insertSequence(_nextGuySequenceId, 21, _currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + _currGuySequenceId = _nextGuySequenceId; + _nextGuySequenceId = -1; + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group3.h b/engines/gnap/scenes/group3.h new file mode 100644 index 0000000000..fa57f1781e --- /dev/null +++ b/engines/gnap/scenes/group3.h @@ -0,0 +1,125 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GROUP3_H +#define GNAP_GROUP3_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene30: public Scene { +public: + Scene30(GnapEngine *vm); + ~Scene30() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _kidSequenceId; +}; + +class Scene31: public Scene { +public: + Scene31(GnapEngine *vm); + ~Scene31() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _beerGuyDistracted; + int _currClerkSequenceId; + int _nextClerkSequenceId; + int _clerkMeasureCtr; + int _clerkMeasureMaxCtr; +}; + +class Scene32: public Scene { +public: + Scene32(GnapEngine *vm); + ~Scene32() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +class Scene33: public Scene { +public: + Scene33(GnapEngine *vm); + ~Scene33() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currChickenSequenceId; + int _nextChickenSequenceId; +}; + +class Scene38: public Scene { +public: + Scene38(GnapEngine *vm); + ~Scene38() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +class Scene39: public Scene { +public: + Scene39(GnapEngine *vm); + ~Scene39() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currGuySequenceId; + int _nextGuySequenceId; +}; + +} // End of namespace Gnap + +#endif // GNAP_GROUP3_H diff --git a/engines/gnap/scenes/scene30.cpp b/engines/gnap/scenes/scene30.cpp deleted file mode 100644 index 02a389e571..0000000000 --- a/engines/gnap/scenes/scene30.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene30.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSPillMachine = 1, - kHSDevice = 2, - kHSExitCircus = 3, - kHSWalkArea1 = 4 -}; - -enum { - kASLeaveScene = 0, - kASUsePillMachine = 1, - kASUsePillMachine2 = 2, - kASLookPillMachine = 3, - kASUsePillMachine3 = 4, - kASUsePillMachine4 = 5 -}; - -Scene30::Scene30(GnapEngine *vm) : Scene(vm) { - _s30_kidSequenceId = -1; -} - -int Scene30::init() { - return _vm->isFlag(kGFUnk23) ? 0x10B : 0x10A; -} - -void Scene30::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSPillMachine, 598, 342, 658, 426, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 9, 7); - _vm->setHotspot(kHSExitCircus, 100, 590 - _vm->_deviceY1, 700, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 514); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 5; -} - -void Scene30::run() { - bool hasTakenPill = false; - - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(6); - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFUnk23)) - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[5] = _vm->getRandom(50) + 180; - - _vm->_gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[4] = _vm->getRandom(100) + 300; - - _s30_kidSequenceId = 0x101; - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSPillMachine: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y, 0, 0x107BC, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASUsePillMachine; - hasTakenPill = true; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y, 8, 5); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(9, 8, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASLookPillMachine; - break; - case GRAB_CURSOR: - _vm->playGnapScratchingHead(8, 5); - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(8, 5); - break; - } - } - } - break; - - case kHSExitCircus: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - if (hasTakenPill) - _vm->_newSceneNum = 47; - else - _vm->_newSceneNum = 26; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, 0x107C2, 1); - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0) { - if (_vm->getRandom(5) == 1) { - _vm->_gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x100, 40, _s30_kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s30_kidSequenceId = 0x100; - } else { - _vm->_gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); - } - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnapActionStatus < 0) { - if (!_vm->isFlag(kGFUnk23) || hasTakenPill) - _vm->_gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); - } - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene30::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASUsePillMachine: - _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x105, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x105; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASUsePillMachine2; - break; - case kASUsePillMachine2: - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - _vm->addFullScreenSprite(0x3F, 255); - _vm->_gameSys->removeSequence(0x105, _vm->_gnapId, true); - _vm->_gameSys->setAnimation(0x102, 256, 0); - _vm->_gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x103, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - _vm->_gnapActionStatus = kASUsePillMachine3; - _vm->invAdd(kItemPill); - _vm->setFlag(kGFUnk23); - break; - case kASUsePillMachine3: - _vm->_gameSys->setAnimation(0x104, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x104; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kASUsePillMachine4; - _vm->setGrabCursorSprite(kItemDiceQuarterHole); - break; - case kASUsePillMachine4: - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSPillMachine].x, _vm->_hotspotsWalkPos[kHSPillMachine].y + 1, -1, 0x107BC, 1); - _vm->_gnapActionStatus = -1; - break; - case kASLookPillMachine: - if (_vm->isFlag(kGFUnk23)) - _vm->showFullScreenSprite(0xE3); - else - _vm->showFullScreenSprite(0xE2); - _vm->_gnapActionStatus = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene30.h b/engines/gnap/scenes/scene30.h deleted file mode 100644 index e1b2476a5f..0000000000 --- a/engines/gnap/scenes/scene30.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE30_H -#define GNAP_SCENE30_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene30: public Scene { -public: - Scene30(GnapEngine *vm); - ~Scene30() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s30_kidSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE30_H diff --git a/engines/gnap/scenes/scene31.cpp b/engines/gnap/scenes/scene31.cpp deleted file mode 100644 index 0c3a1fa6c7..0000000000 --- a/engines/gnap/scenes/scene31.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene31.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSMeasuringClown = 1, - kHSBeerBarrel = 2, - kHSDevice = 3, - kHSExitCircus = 4, - kHSExitOutsideClown = 5, - kHSWalkArea1 = 6 -}; - -enum { - kASUseBeerBarrel = 1, - kASFillEmptyBucketWithBeer = 2, - kASFillEmptyBucketWithBeerDone = 3, - kASPlatMeasuringClown = 4, - kASUseMeasuringClown = 5, - kASLeaveScene = 6 -}; - -Scene31::Scene31(GnapEngine *vm) : Scene(vm) { - _s31_beerGuyDistracted = false; - _s31_currClerkSequenceId = -1; - _s31_nextClerkSequenceId = -1; - _s31_clerkMeasureCtr = -1; - _s31_clerkMeasureMaxCtr = 3; -} - -int Scene31::init() { - return 0x105; -} - -void Scene31::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSMeasuringClown, 34, 150, 256, 436, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 6); - _vm->setHotspot(kHSBeerBarrel, 452, 182, 560, 306, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - _vm->setHotspot(kHSExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitOutsideClown, 0, 0, 15, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 480); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene31::run() { - _vm->playSound(0x1093B, true); - _vm->startSoundTimerB(6); - - _vm->queueInsertDeviceIcon(); - - _s31_beerGuyDistracted = false; - _vm->_gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); - - _s31_currClerkSequenceId = 0xFB; - _s31_nextClerkSequenceId = -1; - - _vm->_gameSys->setAnimation(0xFB, 39, 3); - - _vm->_timers[4] = _vm->getRandom(20) + 60; - _vm->_timers[5] = _vm->getRandom(50) + 180; - - if (_vm->_prevSceneNum == 27) { - _vm->initGnapPos(-1, 8, kDirBottomLeft); - _vm->initPlatypusPos(-1, 9, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); - } else { - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); - _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107D2, 1); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSMeasuringClown: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { - if (_vm->_gnapActionStatus == kASPlatMeasuringClown) { - if (_vm->_verbCursor == LOOK_CURSOR) - _vm->playGnapScratchingHead(2, 2); - else - _vm->playGnapImpossible(0, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, 2, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 2); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, -1, -1, 1); - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y, 0, 0x107B9, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kASUseMeasuringClown; - _vm->_timers[4] = 300; - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - if (!_vm->invHas(kItemBucketWithBeer)) { - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y + 1, 1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea1]._flags |= SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSMeasuringClown].x, _vm->_hotspotsWalkPos[kHSMeasuringClown].y, 1, 0x107C2, 1); - _vm->_hotspots[kHSWalkArea1]._flags &= ~SF_WALKABLE; - _vm->_platypusActionStatus = kASPlatMeasuringClown; - _vm->_gnapActionStatus = kASPlatMeasuringClown; - _vm->_timers[4] = 300; - } else - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSBeerBarrel: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kASPlatMeasuringClown) { - if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _s31_beerGuyDistracted) { - _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y) | 0x10000, 1); - _s31_clerkMeasureMaxCtr += 5; - _vm->_gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->playGnapPullOutDevice(6, 8); - _vm->playGnapUseDevice(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASFillEmptyBucketWithBeer; - _vm->_timers[4] = 300; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 6, 2); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 2); - break; - case GRAB_CURSOR: - if (_s31_beerGuyDistracted) { - _vm->playGnapScratchingHead(6, 2); - } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBeerBarrel].x, _vm->_hotspotsWalkPos[kHSBeerBarrel].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASUseBeerBarrel; - _vm->_gnapIdleFacing = kDirUpLeft; - } - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitCircus: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 26; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCircus].x + 1, _vm->_hotspotsWalkPos[kHSExitCircus].y, -1, -1, 1); - } - break; - - case kHSExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 27; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitOutsideClown].x, _vm->_hotspotsWalkPos[kHSExitOutsideClown].y + 1, -1, 0x107CF, 1); - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1093B)) - _vm->playSound(0x1093B, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0 && _s31_nextClerkSequenceId == -1) { - switch (_vm->getRandom(6)){ - case 0: - _s31_nextClerkSequenceId = 0xFF; - break; - case 1: - _s31_nextClerkSequenceId = 0x100; - break; - case 2: - _s31_nextClerkSequenceId = 0x101; - break; - default: - _s31_nextClerkSequenceId = 0xFB; - break; - } - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnapActionStatus < 0) { - if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); - } - } - _vm->playSoundB(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene31::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASUseBeerBarrel: - _s31_nextClerkSequenceId = 0xFE; - break; - case kASFillEmptyBucketWithBeer: - _vm->_gameSys->setAnimation(0x102, 59, 0); - _vm->_gameSys->insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapX = 5; - _vm->_gnapY = 7; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x102; - _vm->_gnapId = 59; - _vm->_gnapActionStatus = kASFillEmptyBucketWithBeerDone; - break; - case kASFillEmptyBucketWithBeerDone: - _vm->_gnapIdleFacing = kDirBottomLeft; - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = -1; - _vm->invAdd(kItemBucketWithBeer); - _vm->invRemove(kItemEmptyBucket); - _vm->setGrabCursorSprite(kItemBucketWithBeer); - break; - case kASUseMeasuringClown: - _s31_nextClerkSequenceId = 0xFA; - _s31_clerkMeasureMaxCtr = 1; - break; - case kASLeaveScene: - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - if (_vm->_platypusActionStatus == kASPlatMeasuringClown) { - _vm->_sceneWaiting = true; - _s31_beerGuyDistracted = true; - _s31_nextClerkSequenceId = 0xFA; - } - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - switch (_s31_nextClerkSequenceId) { - case 0xFA: - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFC, 39, _s31_nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xFC, 39, 3); - _s31_currClerkSequenceId = 0xFC; - _s31_nextClerkSequenceId = 0xFC; - _s31_clerkMeasureCtr = 0; - break; - case 0xFC: - ++_s31_clerkMeasureCtr; - if (_s31_clerkMeasureCtr >= _s31_clerkMeasureMaxCtr) { - if (_vm->_gnapActionStatus != 5) - _vm->_platypusActionStatus = -1; - _vm->_timers[0] = 40; - _vm->_gameSys->insertSequence(0xFD, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s31_currClerkSequenceId = 0xFD; - _s31_nextClerkSequenceId = -1; - if (_vm->_gnapActionStatus != kASFillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kASFillEmptyBucketWithBeer) - _vm->_gnapActionStatus = -1; - _s31_beerGuyDistracted = false; - _s31_clerkMeasureMaxCtr = 3; - _vm->_gameSys->setAnimation(0xFD, 39, 3); - _vm->_sceneWaiting = false; - } else { - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s31_currClerkSequenceId = _s31_nextClerkSequenceId; - _s31_nextClerkSequenceId = 0xFC; - _vm->_gameSys->setAnimation(0xFC, 39, 3); - } - break; - case 0xFE: - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s31_nextClerkSequenceId, 39, 3); - _s31_currClerkSequenceId = _s31_nextClerkSequenceId; - _s31_nextClerkSequenceId = -1; - _vm->_gnapActionStatus = -1; - break; - default: - if (_s31_nextClerkSequenceId != -1) { - _vm->_gameSys->insertSequence(_s31_nextClerkSequenceId, 39, _s31_currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s31_nextClerkSequenceId, 39, 3); - _s31_currClerkSequenceId = _s31_nextClerkSequenceId; - _s31_nextClerkSequenceId = -1; - } - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene31.h b/engines/gnap/scenes/scene31.h deleted file mode 100644 index 09b7c65696..0000000000 --- a/engines/gnap/scenes/scene31.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE31_H -#define GNAP_SCENE31_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene31: public Scene { -public: - Scene31(GnapEngine *vm); - ~Scene31() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - bool _s31_beerGuyDistracted; - int _s31_currClerkSequenceId; - int _s31_nextClerkSequenceId; - int _s31_clerkMeasureCtr; - int _s31_clerkMeasureMaxCtr; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE31_H diff --git a/engines/gnap/scenes/scene32.cpp b/engines/gnap/scenes/scene32.cpp deleted file mode 100644 index 75d2efa22b..0000000000 --- a/engines/gnap/scenes/scene32.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene32.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitTruck = 1, - kHSDevice = 2, - kHSWalkArea1 = 3, - kHSWalkArea2 = 4, - kHSWalkArea3 = 5, - kHSWalkArea4 = 6, - kHSWalkArea5 = 7, - kHSWalkArea6 = 8, - kHSWalkArea7 = 9, - kHSWalkArea8 = 10 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene32::Scene32(GnapEngine *vm) : Scene(vm) { - -} - -int Scene32::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0xF : 0x10; -} - -void Scene32::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitTruck, 780, 226, 800, 455, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 6); - _vm->setHotspot(kHSWalkArea1, 0, 0, 162, 426); - _vm->setHotspot(kHSWalkArea2, 162, 0, 237, 396); - _vm->setHotspot(kHSWalkArea3, 237, 0, 319, 363); - _vm->setHotspot(kHSWalkArea4, 520, 0, 800, 404); - _vm->setHotspot(kHSWalkArea5, 300, 447, 800, 600); - _vm->setHotspot(kHSWalkArea6, 678, 0, 800, 404); - _vm->setHotspot(kHSWalkArea7, 0, 0, 520, 351); - _vm->setHotspot(kHSWalkArea8, 0, 546, 300, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 11; -} - -void Scene32::run() { - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(5); - _vm->queueInsertDeviceIcon(); - _vm->_timers[4] = _vm->getRandom(100) + 300; - - if (_vm->_prevSceneNum == 33) { - _vm->initGnapPos(11, 6, kDirBottomLeft); - _vm->initPlatypusPos(12, 6, kDirUnk4); - _vm->endSceneInit(); - _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); - _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); - } else { - _vm->initGnapPos(1, 6, kDirBottomRight); - _vm->initPlatypusPos(1, 7, kDirNone); - _vm->endSceneInit(); - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitTruck: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitTruck].x, _vm->_hotspotsWalkPos[kHSExitTruck].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitTruck].x, _vm->_hotspotsWalkPos[kHSExitTruck].y + 1, -1, 0x107CD, 1); - _vm->_newSceneNum = 33; - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: - case kHSWalkArea6: - case kHSWalkArea7: - case kHSWalkArea8: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = 0; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene32::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene32.h b/engines/gnap/scenes/scene32.h deleted file mode 100644 index d96e834091..0000000000 --- a/engines/gnap/scenes/scene32.h +++ /dev/null @@ -1,46 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE32_H -#define GNAP_SCENE32_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene32: public Scene { -public: - Scene32(GnapEngine *vm); - ~Scene32() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE32_H diff --git a/engines/gnap/scenes/scene33.cpp b/engines/gnap/scenes/scene33.cpp deleted file mode 100644 index d0dec3f58c..0000000000 --- a/engines/gnap/scenes/scene33.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene33.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSChicken = 1, - kHSDevice = 2, - kHSExitHouse = 3, - kHSExitBarn = 4, - kHSExitCreek = 5, - kHSExitPigpen = 6, - kHSWalkArea1 = 7, - kHSWalkArea2 = 8 -}; - -enum { - kASLeaveScene = 0, - kASTalkChicken = 1, - kASUseChicken = 2, - kASUseChickenDone = 3 -}; - -Scene33::Scene33(GnapEngine *vm) : Scene(vm) { - _s33_currChickenSequenceId = -1; - _s33_nextChickenSequenceId = -1; -} - -int Scene33::init() { - return _vm->isFlag(kGFPlatypusTalkingToAssistant) ? 0x84 : 0x85; -} - -void Scene33::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSChicken, 606, 455, 702, 568, SF_WALKABLE | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSExitHouse, 480, 120, 556, 240, SF_EXIT_U_CURSOR, 7, 3); - _vm->setHotspot(kHSExitBarn, 610, 75, 800, 164, SF_EXIT_U_CURSOR, 10, 3); - _vm->setHotspot(kHSExitCreek, 780, 336, 800, 556, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - _vm->setHotspot(kHSExitPigpen, 0, 300, 20, 600, SF_EXIT_L_CURSOR | SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSWalkArea1, 120, 0, 514, 458); - _vm->setHotspot(kHSWalkArea2, 0, 0, 800, 452); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 9; -} - -void Scene33::run() { - _vm->playSound(0x1091C, true); - _vm->startSoundTimerC(6); - _vm->queueInsertDeviceIcon(); - - _s33_currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _s33_nextChickenSequenceId = -1; - _vm->_timers[5] = _vm->getRandom(20) + 30; - _vm->_timers[4] = _vm->getRandom(100) + 300; - - switch (_vm->_prevSceneNum) { - case 34: - _vm->initGnapPos(11, 7, kDirBottomLeft); - _vm->initPlatypusPos(12, 7, kDirUnk4); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 7, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); - break; - case 37: - _vm->initGnapPos(7, 7, kDirBottomRight); - _vm->initPlatypusPos(8, 7, kDirNone); - _vm->endSceneInit(); - break; - case 32: - _vm->initGnapPos(-1, 6, kDirBottomRight); - _vm->initPlatypusPos(-1, 7, kDirNone); - _vm->endSceneInit(); - _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - break; - default: - _vm->initGnapPos(3, 7, kDirBottomRight); - _vm->initPlatypusPos(2, 7, kDirNone); - _vm->endSceneInit(); - break; - } - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - _vm->testWalk(0, 0, 7, 6, 8, 6); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSChicken: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 9, 9, 8); - } else { - switch (_vm->_verbCursor) { - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChicken].x, _vm->_hotspotsWalkPos[kHSChicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kASUseChicken; - else - _vm->_gnapActionStatus = -1; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChicken].x, _vm->_hotspotsWalkPos[kHSChicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkChicken; - break; - case LOOK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitHouse: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 37; - if (_vm->_gnapX > 6) - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); - else - _vm->gnapWalkTo(6, 7, 0, 0x107B1, 1); - } - break; - - case kHSExitBarn: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 35; - if (_vm->_gnapX > 7) - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); - else - _vm->gnapWalkTo(7, 7, 0, 0x107B1, 1); - } - break; - - case kHSExitCreek: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCreek].x, _vm->_hotspotsWalkPos[kHSExitCreek].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitCreek].x, _vm->_hotspotsWalkPos[kHSExitCreek].y, -1, 0x107CD, 1); - _vm->_newSceneNum = 34; - } - break; - - case kHSExitPigpen: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitPigpen].x, _vm->_hotspotsWalkPos[kHSExitPigpen].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitPigpen].x, _vm->_hotspotsWalkPos[kHSExitPigpen].y, -1, 0x107CF, 1); - _vm->_newSceneNum = 32; - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->isSoundPlaying(0x1091C)) - _vm->playSound(0x1091C, true); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); - else - _vm->_gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); - } - if (!_vm->_timers[5] && _s33_nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kASTalkChicken && _vm->_gnapActionStatus != kASUseChicken) { - if (_vm->getRandom(6) != 0) { - _s33_nextChickenSequenceId = 0x7E; - _vm->_timers[5] = _vm->getRandom(20) + 30; - } else { - _s33_nextChickenSequenceId = 0x80; - _vm->_timers[5] = _vm->getRandom(20) + 50; - } - } - _vm->playSoundC(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -void Scene33::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASTalkChicken: - _s33_nextChickenSequenceId = 0x7F; - break; - case kASUseChicken: - _s33_nextChickenSequenceId = 0x81; - _vm->_timers[2] = 100; - break; - case kASUseChickenDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; - _s33_currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_s33_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - _vm->_timers[5] = 30; - break; - default: - _vm->_gnapActionStatus = -1; - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s33_nextChickenSequenceId == 0x81) { - _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_s33_currChickenSequenceId, 179, true); - _s33_nextChickenSequenceId = -1; - _s33_currChickenSequenceId = -1; - _vm->_gnapActionStatus = kASUseChickenDone; - _vm->_timers[5] = 500; - } else if (_s33_nextChickenSequenceId == 0x7F) { - _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _s33_currChickenSequenceId = _s33_nextChickenSequenceId; - _s33_nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; - } else if (_s33_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_s33_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_s33_nextChickenSequenceId, 179, _s33_currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); - _s33_currChickenSequenceId = _s33_nextChickenSequenceId; - _s33_nextChickenSequenceId = -1; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene33.h b/engines/gnap/scenes/scene33.h deleted file mode 100644 index 4532a263f1..0000000000 --- a/engines/gnap/scenes/scene33.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE33_H -#define GNAP_SCENE33_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene33: public Scene { -public: - Scene33(GnapEngine *vm); - ~Scene33() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s33_currChickenSequenceId; - int _s33_nextChickenSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE33_H diff --git a/engines/gnap/scenes/scene38.cpp b/engines/gnap/scenes/scene38.cpp deleted file mode 100644 index 9360afdd54..0000000000 --- a/engines/gnap/scenes/scene38.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene38.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitHouse = 1, - kHSExitCave = 2, - kHSTrapDoorLid1 = 3, - kHSTrapDoorLid2 = 4, - kHSHuntingTrophy = 5, - kHSWalkArea1 = 6, - kHSDevice = 7, - kHSWalkArea2 = 8, - kHSWalkArea3 = 9, - kHSWalkArea4 = 10, - kHSWalkArea5 = 11, - kHSWalkArea6 = 12 -}; - -enum { - kASLeaveScene = 0, - kASExitCave = 1, - kASUseHuntingTrophy = 2, - kASHoldingHuntingTrophy = 3, - kASReleaseHuntingTrophy = 4, - kASUsePlatypusWithTrapDoor = 5, - kASPlatypusHoldingTrapDoor = 6 -}; - -Scene38::Scene38(GnapEngine *vm) : Scene(vm) { -} - -int Scene38::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - return 0xA5; -} - -void Scene38::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); - _vm->setHotspot(kHSExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); - _vm->setHotspot(kHSTrapDoorLid1, 525, 265, 640, 350, SF_DISABLED); - _vm->setHotspot(kHSTrapDoorLid2, 555, 350, 670, 430, SF_DISABLED); - _vm->setHotspot(kHSHuntingTrophy, 170, 85, 250, 190, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - _vm->setHotspot(kHSWalkArea1, 330, 270, 640, 380, SF_DISABLED | SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 0, 8); - _vm->setHotspot(kHSWalkArea2, 0, 0, 799, 396); - _vm->setHotspot(kHSWalkArea3, 0, 585, 799, 599, SF_WALKABLE | SF_DISABLED); - _vm->setHotspot(kHSWalkArea4, 0, 0, 97, 445); - _vm->setHotspot(kHSWalkArea5, 770, 0, 799, 445); - _vm->setHotspot(kHSWalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSPlatypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_hotspots[kHSExitCave]._flags = SF_EXIT_D_CURSOR; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_DISABLED; - else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_hotspots[kHSTrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_DISABLED; - else if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_hotspots[kHSTrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_hotspots[kHSWalkArea6]._flags = SF_NONE; - _vm->_hotspotsCount = 13; -} - -void Scene38::run() { - _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->_prevSceneNum == 39) { - _vm->initGnapPos(3, 7, kDirBottomLeft); - _vm->initPlatypusPos(4, 7, kDirUnk4); - } else { - _vm->initGnapPos(3, 8, kDirBottomRight); - _vm->initPlatypusPos(4, 8, kDirNone); - } - _vm->endSceneInit(); - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - break; - - case kHSExitHouse: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - } else { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 37; - } - break; - - case kHSExitCave: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->_isLeavingScene = true; - } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _vm->_sceneWaiting = false; - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); - _vm->_newSceneNum = 39; - _vm->_gnapActionStatus = kASExitCave; - } - break; - - case kHSTrapDoorLid1: - case kHSTrapDoorLid2: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) { - if (_vm->_verbCursor == PLAT_CURSOR && _vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) - _vm->_gnapActionStatus = kASUsePlatypusWithTrapDoor; - else - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - } - break; - - case kHSHuntingTrophy: - if (_vm->_gnapActionStatus != kASHoldingHuntingTrophy) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 6, 2, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(0, 0); - break; - case GRAB_CURSOR: - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) - _vm->playGnapImpossible(0, 0); - else { - _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); - _vm->platypusWalkTo(4, 8, -1, -1, 1); - _vm->_gnapActionStatus = kASUseHuntingTrophy; - } - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(2, 0); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - // Nothing - break; - - case kHSWalkArea2: - case kHSWalkArea3: - case kHSWalkArea4: - case kHSWalkArea5: - case kHSWalkArea6: - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - else if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left) { - if (_vm->_gnapActionStatus == kASHoldingHuntingTrophy) - _vm->_gnapActionStatus = kASReleaseHuntingTrophy; - else if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene38::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - _vm->_sceneDone = true; - break; - case kASExitCave: - _vm->_gameSys->removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); - _vm->_gameSys->insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA3; - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0xA3, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASLeaveScene; - break; - case kASUseHuntingTrophy: - _vm->_gameSys->removeSequence(0x9B, 0, true); - _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9C; - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9C, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASHoldingHuntingTrophy; - updateHotspots(); - break; - case kASHoldingHuntingTrophy: - if (_vm->_platypusActionStatus != kASPlatypusHoldingTrapDoor) - _vm->_sceneWaiting = true; - if (_vm->_gnapSequenceId == 0xA4) { - _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9D; - } else { - _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA4; - } - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); - break; - case kASReleaseHuntingTrophy: - if (_vm->_gnapSequenceId == 0x9E) { - _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - } else if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA0; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->_isLeavingScene) { - _vm->_sceneWaiting = false; - _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); - _vm->_newSceneNum = 39; - _vm->_gnapActionStatus = kASExitCave; - } else { - _vm->_gnapActionStatus = -1; - } - } else { - _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9E; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); - _vm->_sceneWaiting = false; - updateHotspots(); - } - break; - case kASUsePlatypusWithTrapDoor: - _vm->_sceneWaiting = false; - _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9F; - _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9F, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASHoldingHuntingTrophy; - if (_vm->_platypusFacing != kDirNone) - _vm->playPlatypusSequence(0x107D5); - else - _vm->playPlatypusSequence(0x107D4); - _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); - _vm->_gameSys->insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xA1; - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusId = _vm->_gnapId + 1; - _vm->_gameSys->setAnimation(0xA1, _vm->_gnapId + 1, 1); - _vm->_platypusActionStatus = kASPlatypusHoldingTrapDoor; - updateHotspots(); - break; - } - } - - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); - if (_vm->_platypusActionStatus == kASPlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xA2; - _vm->_platypusSequenceDatNum = 0; - updateHotspots(); - _vm->_sceneWaiting = true; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene38.h b/engines/gnap/scenes/scene38.h deleted file mode 100644 index 8ad8e73fa3..0000000000 --- a/engines/gnap/scenes/scene38.h +++ /dev/null @@ -1,46 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE38_H -#define GNAP_SCENE38_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene38: public Scene { -public: - Scene38(GnapEngine *vm); - ~Scene38() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE38_H diff --git a/engines/gnap/scenes/scene39.cpp b/engines/gnap/scenes/scene39.cpp deleted file mode 100644 index cfbdd5721a..0000000000 --- a/engines/gnap/scenes/scene39.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene39.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitInsideHouse = 1, - kHSExitUfoParty = 2, - kHSSign = 3, - kHSDevice = 4, - kHSWalkArea1 = 5, - kHSWalkArea2 = 6 -}; - -enum { - kASLeaveScene = 0 -}; - -Scene39::Scene39(GnapEngine *vm) : Scene(vm) { - _s39_currGuySequenceId = -1; - _s39_nextGuySequenceId = -1; -} - -int Scene39::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - return 0x35; -} - -void Scene39::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitInsideHouse, 0, 0, 140, 206, SF_EXIT_U_CURSOR, 4, 8); - _vm->setHotspot(kHSExitUfoParty, 360, 204, 480, 430, SF_EXIT_R_CURSOR, 6, 8); - _vm->setHotspot(kHSSign, 528, 232, 607, 397, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 3); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 466); - _vm->setHotspot(kHSWalkArea2, 502, 466, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 7; -} - -void Scene39::run() { - // Bug in the original? Timer was never initialized. - _vm->_timers[5] = 0; - - _vm->queueInsertDeviceIcon(); - _s39_currGuySequenceId = 0x33; - - _vm->_gameSys->setAnimation(0x33, 21, 3); - _vm->_gameSys->insertSequence(_s39_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); - - _s39_nextGuySequenceId = -1; - if (_vm->_prevSceneNum == 38) { - _vm->initGnapPos(3, 7, kDirUpRight); - _vm->initPlatypusPos(2, 7, kDirUpLeft); - _vm->endSceneInit(); - } else { - _vm->initGnapPos(4, 7, kDirBottomRight); - _vm->initPlatypusPos(5, 7, kDirNone); - _vm->endSceneInit(); - } - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) { - _vm->playSound(0x1094B, true); - _vm->setSoundVolume(0x1094B, 60); - } - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(20) + 50; - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitUfoParty: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_sceneDone = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 40; - } - break; - - case kHSSign: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSSign].x, _vm->_hotspotsWalkPos[kHSSign].y, 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHSSign].x, _vm->_hotspotsWalkPos[kHSSign].y); - _vm->showFullScreenSprite(0x1C); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSExitInsideHouse: - if (_vm->_gnapActionStatus < 0) { - _vm->_sceneDone = true; - _vm->_isLeavingScene = true; - _vm->_newSceneNum = 38; - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - _vm->_mouseClickState._left = false; - } - break; - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 50; - switch (_vm->getRandom(4)) { - case 0: - _s39_nextGuySequenceId = 0x30; - break; - case 1: - _s39_nextGuySequenceId = 0x31; - break; - case 2: - _s39_nextGuySequenceId = 0x32; - break; - case 3: - _s39_nextGuySequenceId = 0x33; - break; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[5] = _vm->getRandom(20) + 50; - } - - _vm->gameUpdateTick(); - } -} - -void Scene39::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kASLeaveScene) - _vm->_sceneDone = true; - else - _vm->_gnapActionStatus = -1; - } - - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s39_nextGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_s39_nextGuySequenceId, 21, 3); - _vm->_gameSys->insertSequence(_s39_nextGuySequenceId, 21, _s39_currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _s39_currGuySequenceId = _s39_nextGuySequenceId; - _s39_nextGuySequenceId = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene39.h b/engines/gnap/scenes/scene39.h deleted file mode 100644 index 68dfdfd8e4..0000000000 --- a/engines/gnap/scenes/scene39.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE39_H -#define GNAP_SCENE39_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene39: public Scene { -public: - Scene39(GnapEngine *vm); - ~Scene39() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _s39_currGuySequenceId; - int _s39_nextGuySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE39_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 52925ca08d..a9024b581b 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -29,14 +29,9 @@ #include "gnap/scenes/group0.h" #include "gnap/scenes/group1.h" #include "gnap/scenes/group2.h" +#include "gnap/scenes/group3.h" #include "gnap/scenes/intro.h" -#include "gnap/scenes/scene30.h" -#include "gnap/scenes/scene31.h" -#include "gnap/scenes/scene32.h" -#include "gnap/scenes/scene33.h" -#include "gnap/scenes/scene38.h" -#include "gnap/scenes/scene39.h" #include "gnap/scenes/scene40.h" #include "gnap/scenes/scene41.h" #include "gnap/scenes/scene42.h" -- cgit v1.2.3 From 4120f8795e1aad9180a5207a9e8a068543ee84df Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 28 Apr 2016 07:12:06 +0200 Subject: GNAP: renaming and grouping of scenes in group 4 --- engines/gnap/module.mk | 9 +- engines/gnap/scenes/group4.cpp | 3426 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group4.h | 193 +++ engines/gnap/scenes/scene40.cpp | 193 --- engines/gnap/scenes/scene40.h | 46 - engines/gnap/scenes/scene41.cpp | 589 ------- engines/gnap/scenes/scene41.h | 52 - engines/gnap/scenes/scene42.cpp | 503 ------ engines/gnap/scenes/scene42.h | 50 - engines/gnap/scenes/scene43.cpp | 484 ------ engines/gnap/scenes/scene43.h | 50 - engines/gnap/scenes/scene44.cpp | 527 ------ engines/gnap/scenes/scene44.h | 52 - engines/gnap/scenes/scene45.cpp | 425 ----- engines/gnap/scenes/scene45.h | 49 - engines/gnap/scenes/scene46.cpp | 376 ---- engines/gnap/scenes/scene46.h | 52 - engines/gnap/scenes/scene49.cpp | 527 ------ engines/gnap/scenes/scene49.h | 79 - engines/gnap/scenes/scenecore.cpp | 9 +- 20 files changed, 3621 insertions(+), 4070 deletions(-) create mode 100644 engines/gnap/scenes/group4.cpp create mode 100644 engines/gnap/scenes/group4.h delete mode 100644 engines/gnap/scenes/scene40.cpp delete mode 100644 engines/gnap/scenes/scene40.h delete mode 100644 engines/gnap/scenes/scene41.cpp delete mode 100644 engines/gnap/scenes/scene41.h delete mode 100644 engines/gnap/scenes/scene42.cpp delete mode 100644 engines/gnap/scenes/scene42.h delete mode 100644 engines/gnap/scenes/scene43.cpp delete mode 100644 engines/gnap/scenes/scene43.h delete mode 100644 engines/gnap/scenes/scene44.cpp delete mode 100644 engines/gnap/scenes/scene44.h delete mode 100644 engines/gnap/scenes/scene45.cpp delete mode 100644 engines/gnap/scenes/scene45.h delete mode 100644 engines/gnap/scenes/scene46.cpp delete mode 100644 engines/gnap/scenes/scene46.h delete mode 100644 engines/gnap/scenes/scene49.cpp delete mode 100644 engines/gnap/scenes/scene49.h diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 388b33b178..cdbda4a1da 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -15,15 +15,8 @@ MODULE_OBJS := \ scenes/group1.o \ scenes/group2.o \ scenes/group3.o \ + scenes/group4.o \ scenes/intro.o \ - scenes/scene40.o \ - scenes/scene41.o \ - scenes/scene42.o \ - scenes/scene43.o \ - scenes/scene44.o \ - scenes/scene45.o \ - scenes/scene46.o \ - scenes/scene49.o \ scenes/scene50.o \ scenes/scene51.o \ scenes/scene52.o \ diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp new file mode 100644 index 0000000000..7bb296147f --- /dev/null +++ b/engines/gnap/scenes/group4.cpp @@ -0,0 +1,3426 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/group4.h" + +namespace Gnap { + +enum { + kHS40Platypus = 0, + kHS40ExitCave = 1, + kHS40ExitToyStand = 2, + kHS40ExitBBQ = 3, + kHS40ExitUfo = 4, + kHS40ExitKissinBooth = 5, + kHS40ExitDancefloor = 6, + kHS40ExitShoe = 7, + kHS40Device = 8 +}; + +Scene40::Scene40(GnapEngine *vm) : Scene(vm) { +} + +int Scene40::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + return _vm->isFlag(kGFUnk23) ? 0x01 : 0x00; +} + +void Scene40::updateHotspots() { + _vm->setHotspot(kHS40Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_DISABLED | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS40ExitCave, 169, 510, 264, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHS40ExitToyStand, 238, 297, 328, 376, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHS40ExitBBQ, 328, 220, 401, 306, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHS40ExitUfo, 421, 215, 501, 282, SF_EXIT_U_CURSOR, 0, 8); + _vm->setHotspot(kHS40ExitKissinBooth, 476, 284, 556, 345, SF_EXIT_R_CURSOR, 0, 8); + _vm->setHotspot(kHS40ExitDancefloor, 317, 455, 445, 600, SF_EXIT_D_CURSOR, 0, 8); + _vm->setHotspot(kHS40ExitShoe, 455, 346, 549, 417, SF_EXIT_D_CURSOR, 0, 8); + _vm->setDeviceHotspot(kHS40Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; +} + +void Scene40::run() { + _vm->queueInsertDeviceIcon(); + _vm->endSceneInit(); + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case kHS40Device: + _vm->runMenu(); + updateHotspots(); + break; + + case kHS40Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS40ExitCave: + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 39; + _vm->_sceneDone = true; + } + break; + + case kHS40ExitToyStand: + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 41; + _vm->_sceneDone = true; + } + break; + + case kHS40ExitBBQ: + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 42; + _vm->_sceneDone = true; + } + break; + + case kHS40ExitUfo: + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 43; + _vm->_sceneDone = true; + } + break; + + case kHS40ExitKissinBooth: + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 44; + _vm->_sceneDone = true; + } + break; + + case kHS40ExitDancefloor: + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 45; + _vm->_sceneDone = true; + } + break; + + case kHS40ExitShoe: + if (_vm->_gnapActionStatus < 0) { + _vm->_newSceneNum = 46; + _vm->_sceneDone = true; + } + break; + + default: + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) + _vm->_mouseClickState._left = false; + break; + + } + + updateAnimations(); + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene40::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); + if (_vm->_gnapActionStatus) + _vm->_gnapActionStatus = -1; + else + _vm->_sceneDone = true; + } +} + +/*****************************************************************************/ + +enum { + kHS41Platypus = 0, + kHS41ExitCave = 1, + kHS41Exit = 2, + kHS41ExitBBQ = 3, + kHS41ToyVendor = 4, + kHS41Kid = 5, + kHS41ToyUfo = 6, + kHS41Device = 7, + kHS41WalkArea1 = 8 +}; + +enum { + kHS41UfoExitLeft = 1, + kHS41UfoExitRight = 2, + kHS41UfoDevice = 3, + kHS41UfoWalkArea1 = 4 +}; + +enum { + kAS41LeaveScene = 0, + kAS41UseQuarterWithToyVendor = 1, + kAS41TalkToyVendor = 2, + kAS41UseGumWithToyUfo = 3, + kAS41UseChickenBucketWithKid = 4, + kAS41GrabKid = 5, + kAS41GiveBackToyUfo = 6, + kAS41ToyUfoLeaveScene = 7, + kAS41ToyUfoRefresh = 8, + kAS41UfoGumAttached = 9 +}; + +Scene41::Scene41(GnapEngine *vm) : Scene(vm) { + _currKidSequenceId = -1; + _nextKidSequenceId = -1; + _currToyVendorSequenceId = -1; + _nextToyVendorSequenceId = -1; +} + +int Scene41::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + return 0x129; +} + +void Scene41::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHS41Platypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHS41UfoExitLeft, 0, 0, 10, 500, SF_EXIT_L_CURSOR | SF_DISABLED); + _vm->setHotspot(kHS41UfoExitRight, 790, 0, 799, 500, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHS41UfoWalkArea1, 0, 0, 800, 470, SF_DISABLED); + _vm->setDeviceHotspot(kHS41UfoDevice, -1, -1, -1, -1); + _vm->_hotspotsCount = 5; + } else { + _vm->setHotspot(kHS41Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS41ExitCave, 150, 590, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS41Exit, 0, 100, 10, 599, SF_EXIT_L_CURSOR | SF_DISABLED, 0, 8); + _vm->setHotspot(kHS41ExitBBQ, 790, 100, 799, 599, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); + _vm->setHotspot(kHS41ToyVendor, 320, 150, 430, 310, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS41Kid, 615, 340, 710, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS41ToyUfo, 0, 0, 0, 0, SF_GRAB_CURSOR); + _vm->setHotspot(kHS41WalkArea1, 0, 0, 800, 470); + _vm->setDeviceHotspot(kHS41Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; + } +} + +void Scene41::run() { + GameSys gameSys = *_vm->_gameSys; + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoX = 770; + if (_vm->_toyUfoY < 0 || _vm->_toyUfoY > 300) + _vm->_toyUfoY = 150; + if (!_vm->_timers[9]) + _vm->_gnapActionStatus = kAS41GiveBackToyUfo; + } else { + if (!_vm->isFlag(kGFUnk16) && !_vm->isFlag(kGFJointTaken) && !_vm->isFlag(kGFUnk18) && !_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->toyUfoSetStatus(kGFUnk16); + _vm->_toyUfoX = 600; + _vm->_toyUfoY = 200; + } + + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) + _currKidSequenceId = 0x11B; + else + _currKidSequenceId = 0x11D; + + _nextKidSequenceId = -1; + + gameSys.setAnimation(_currKidSequenceId, 1, 4); + gameSys.insertSequence(_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _currToyVendorSequenceId = 0x118; + _nextToyVendorSequenceId = -1; + + gameSys.setAnimation(0x118, 1, 3); + gameSys.insertSequence(_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_gnapSequenceId = 0x120; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapX = 7; + _vm->_gnapY = 7; + _vm->_gnapId = 140; + gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->initPlatypusPos(8, 10, kDirBottomLeft); + _vm->endSceneInit(); + } else if (_vm->_prevSceneNum == 45) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-2, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + } else if (_vm->_prevSceneNum == 42) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + } else { + _vm->initGnapPos(5, 8, kDirBottomRight); + _vm->initPlatypusPos(6, 8, kDirBottomLeft); + _vm->endSceneInit(); + } + + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); + + if (!_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_hotspots[kHS41ToyUfo]._x1 = _vm->_toyUfoX - 25; + _vm->_hotspots[kHS41ToyUfo]._y1 = _vm->_toyUfoY - 20; + _vm->_hotspots[kHS41ToyUfo]._x2 = _vm->_toyUfoX + 25; + _vm->_hotspots[kHS41ToyUfo]._y2 = _vm->_toyUfoY + 20; + } + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { + case kHS41UfoExitLeft: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kAS41ToyUfoLeaveScene; + _vm->_newSceneNum = 45; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); + } + break; + + case kHS41UfoExitRight: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kAS41ToyUfoLeaveScene; + _vm->_newSceneNum = 42; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); + } + break; + + case kHS41UfoDevice: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; + break; + } + } else { + switch (_vm->_sceneClickedHotspot) { + case kHS41Device: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; + break; + + case kHS41Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS41ExitCave: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitCave].x, _vm->_hotspotsWalkPos[kHS41ExitCave].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS41LeaveScene; + _vm->_newSceneNum = 40; + break; + + case kHS41Exit: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS41LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, -1, 0x107CF, 1); + _vm->_newSceneNum = 45; + break; + + case kHS41ExitBBQ: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS41LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, -1, 0x107CD, 1); + _vm->_newSceneNum = 42; + break; + + case kHS41ToyVendor: + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->_gnapActionStatus = kAS41UseQuarterWithToyVendor; + _vm->gnapWalkTo(4, 7, 0, 0x107BB, 9); + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(4, 7, 5, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(5, 0); + break; + case GRAB_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS41TalkToyVendor; + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS41Kid: + if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { + _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS41UseChickenBucketWithKid; + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(7, 7, 8, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(9, 0); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnapActionStatus = kAS41GrabKid; + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(7, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS41ToyUfo: + if (_vm->_grabCursorSpriteIndex == kItemGum) { + _vm->playGnapPullOutDevice(9, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + _vm->_gnapActionStatus = kAS41UseGumWithToyUfo; + } + break; + + case kHS41WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + } + } + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + if (!_vm->_timers[9] && _vm->_gnapActionStatus < 0) { + _vm->_gnapActionStatus = kAS41GiveBackToyUfo; + if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x122) { + gameSys.insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x123; + _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x123, _vm->_gnapId, 0); + } + } + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + int sequenceId; + if (_vm->_leftClickMouseX >= 400) { + if (_vm->_gnapSequenceId == 0x11F || _vm->_gnapSequenceId == 0x120 || _vm->_gnapSequenceId == 0x123 || _vm->_gnapSequenceId == 0x126) + sequenceId = 0x120; + else if (_vm->_leftClickMouseX - _vm->_toyUfoX >= 400) + sequenceId = 0x126; + else + sequenceId = 0x123; + } else { + if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x125 || _vm->_gnapSequenceId == 0x122) + sequenceId = 0x122; + else if (_vm->_toyUfoX - _vm->_leftClickMouseX >= 400) + sequenceId = 0x125; + else + sequenceId = 0x121; + } + gameSys.insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = sequenceId; + _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(sequenceId, _vm->_gnapId, 0); + _vm->_toyUfoActionStatus = kAS41ToyUfoRefresh; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + updateAnimations(); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { + switch (_vm->getRandom(3)) { + case 0: + _nextToyVendorSequenceId = 0x113; + break; + case 1: + _nextToyVendorSequenceId = 0x117; + break; + case 2: + _nextToyVendorSequenceId = 0x119; + break; + } + if (_nextToyVendorSequenceId == _currToyVendorSequenceId) + _nextToyVendorSequenceId = -1; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(30) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { + if (_vm->isFlag(kGFGnapControlsToyUFO)) + _nextKidSequenceId = 0x11B; + else if (_vm->getRandom(3) != 0) + _nextKidSequenceId = 0x11D; + else + _nextKidSequenceId = 0x11E; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_timers[5] = _vm->getRandom(30) + 20; + } + _vm->gameUpdateTick(); + } +} + +void Scene41::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { + case kAS41LeaveScene: + gameSys.setAnimation(0, 0, 0); + _vm->_sceneDone = true; + _vm->_gnapActionStatus = -1; + break; + case kAS41UseQuarterWithToyVendor: + gameSys.setAnimation(0, 0, 0); + _nextToyVendorSequenceId = 0x114; + _vm->_gnapActionStatus = -1; + break; + case kAS41TalkToyVendor: + gameSys.setAnimation(0, 0, 0); + _nextToyVendorSequenceId = 0x116; + _vm->_gnapActionStatus = -1; + break; + case kAS41UseGumWithToyUfo: + gameSys.setAnimation(0, 0, 0); + _vm->playGnapUseDevice(9, 0); + _vm->_gnapActionStatus = -1; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemGum); + _vm->_toyUfoActionStatus = kAS41UfoGumAttached; + break; + case kAS41UseChickenBucketWithKid: + if (gameSys.getAnimationStatus(4) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + _vm->setGrabCursorSprite(-1); + gameSys.insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x11F; + _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x11F, _vm->_gnapId, 0); + _nextKidSequenceId = 0x11A; + gameSys.insertSequence(0x11A, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = 0x11B; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_gnapActionStatus = -1; + _vm->setFlag(kGFGnapControlsToyUFO); + updateHotspots(); + _vm->_timers[9] = 600; + } + break; + case kAS41GrabKid: + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + gameSys.insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x110; + _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x110, _vm->_gnapId, 0); + _nextToyVendorSequenceId = 0x111; + gameSys.insertSequence(0x111, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(100) + 100; + _nextKidSequenceId = 0x10F; + gameSys.insertSequence(0x10F, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_gnapActionStatus = -1; + } + break; + case kAS41GiveBackToyUfo: + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + gameSys.insertSequence(0x124, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x124; + _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x124, _vm->_gnapId, 0); + _nextToyVendorSequenceId = 0x112; + gameSys.insertSequence(0x112, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(100) + 100; + _nextKidSequenceId = 0x11C; + gameSys.insertSequence(0x11C, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; + _vm->_timers[5] = _vm->getRandom(30) + 20; + _vm->_gnapActionStatus = -1; + _vm->clearFlag(kGFGnapControlsToyUFO); + updateHotspots(); + } + break; + } + } + + if (gameSys.getAnimationStatus(2) == 2) { + switch (_vm->_toyUfoActionStatus) { + case kAS41ToyUfoLeaveScene: + _vm->_sceneDone = true; + break; + case kAS41UfoGumAttached: + _vm->_toyUfoNextSequenceId = 0x873; + gameSys.insertSequence(0x10873, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 365, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + _vm->toyUfoSetStatus(kGFJointTaken); + break; + default: + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + break; + } + _vm->_toyUfoActionStatus = -1; + } + + if (gameSys.getAnimationStatus(3) == 2 && _nextToyVendorSequenceId != -1) { + gameSys.insertSequence(_nextToyVendorSequenceId, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(100) + 100; + } + + if (gameSys.getAnimationStatus(4) == 2 && _nextKidSequenceId != -1) { + gameSys.insertSequence(_nextKidSequenceId, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; + _vm->_timers[5] = _vm->getRandom(30) + 20; + if (_currKidSequenceId == 0x11E) { + _vm->_toyUfoActionStatus = kAS41ToyUfoRefresh; + _vm->toyUfoFlyTo(_vm->getRandom(300) + 500, _vm->getRandom(225) + 75, 0, 799, 0, 300, 2); + } + } +} + +/*****************************************************************************/ + +enum { + kHS42Platypus = 0, + kHS42ExitUfoParty = 1, + kHS42ExitToyStand = 2, + kHS42ExitUfo = 3, + kHS42BBQVendor = 4, + kHS42ChickenLeg = 5, + kHS42Device = 6, + kHS42WalkArea1 = 7, + kHS42WalkArea2 = 8 +}; + +enum { + kHS42UfoExitLeft = 1, + kHS42UfoExitRight = 2, + kHS42UfoHotSauce = 3, + kHS42UfoDevice = 4 +}; + +enum { + kAS42LeaveScene = 0, + kAS42TalkBBQVendor = 1, + kAS42UseQuarterWithBBQVendor = 2, + kAS42UseQuarterWithBBQVendorDone = 3, + kAS42GrabChickenLeg = 4, + kAS42ToyUfoLeaveScene = 5, + kAS42ToyUfoRefresh = 6, + kAS42ToyUfoPickUpHotSauce = 7 +}; + +Scene42::Scene42(GnapEngine *vm) : Scene(vm) { + _currBBQVendorSequenceId = -1; + _nextBBQVendorSequenceId = -1; +} + +int Scene42::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + if (_vm->isFlag(kGFPictureTaken) || (_vm->isFlag(kGFUnk18) && _vm->isFlag(kGFUnk23))) + return 0x153; + return 0x152; +} + +void Scene42::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHS42Platypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHS42UfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHS42UfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHS42UfoHotSauce, 335, 110, 440, 175, SF_DISABLED); + _vm->setDeviceHotspot(kHS42UfoDevice, -1, 534, -1, 599); + if ((_vm->isFlag(kGFPictureTaken) || _vm->isFlag(kGFUnk18)) && _vm->isFlag(kGFUnk23) && !_vm->isFlag(kGFUnk24)) + _vm->_hotspots[kHS42UfoHotSauce]._flags = SF_GRAB_CURSOR; + _vm->_hotspotsCount = 5; + } else { + _vm->setHotspot(kHS42Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS42ExitUfoParty, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS42ExitToyStand, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHS42ExitUfo, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHS42BBQVendor, 410, 200, 520, 365, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 8); + _vm->setHotspot(kHS42ChickenLeg, 530, 340, 620, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 7); + _vm->setHotspot(kHS42WalkArea1, 0, 0, 800, 445); + _vm->setHotspot(kHS42WalkArea2, 240, 0, 550, 495); + _vm->setDeviceHotspot(kHS42Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 9; + } +} + +void Scene42::run() { + GameSys gameSys = *_vm->_gameSys; + + _vm->queueInsertDeviceIcon(); + + _currBBQVendorSequenceId = 0x14A; + _nextBBQVendorSequenceId = -1; + + gameSys.setAnimation(0x14A, 1, 2); + gameSys.insertSequence(_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + if (_vm->_prevSceneNum == 43 && _vm->isFlag(kGFUnk18)) { + _vm->_toyUfoSequenceId = 0x872; + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_toyUfoX = 317; + _vm->_toyUfoY = 61; + _vm->toyUfoSetStatus(kGFJointTaken); + _vm->setFlag(kGFPictureTaken); + _vm->_timers[9] = 600; + } else { + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 41) + _vm->_toyUfoX = 30; + else + _vm->_toyUfoX = 770; + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + } + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + _vm->endSceneInit(); + if (_vm->_toyUfoSequenceId == 0x872) + _vm->setGrabCursorSprite(-1); + } else if (_vm->_prevSceneNum == 41) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + } else if (_vm->_prevSceneNum == 43) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + } else { + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + } + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { + case kHS42UfoExitLeft: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kAS42ToyUfoLeaveScene; + _vm->_newSceneNum = 41; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + } + break; + + case kHS42UfoExitRight: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = kAS42ToyUfoLeaveScene; + _vm->_newSceneNum = 43; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + } + break; + + case kHS42UfoHotSauce: + if (_vm->isFlag(kGFJointTaken)) { + _vm->_toyUfoActionStatus = kAS42ToyUfoPickUpHotSauce; + _vm->toyUfoFlyTo(384, 77, 0, 799, 0, 300, 3); + _vm->_timers[9] = 600; + } else { + _vm->_toyUfoActionStatus = kAS42ToyUfoRefresh; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } + break; + + case kHS42UfoDevice: + _vm->runMenu(); + updateHotspots(); + break; + } + } else { + switch (_vm->_sceneClickedHotspot) { + case kHS42Device: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 30; + break; + + case kHS42Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS42ExitUfoParty: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = kAS42LeaveScene; + _vm->platypusWalkTo(_vm->_platX, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, -1, 0x107C7, 1); + _vm->_newSceneNum = 40; + break; + + case kHS42ExitToyStand: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = kAS42LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_hotspotsWalkPos[kHS42ExitToyStand].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 41; + break; + + case kHS42ExitUfo: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = kAS42LeaveScene; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_hotspotsWalkPos[kHS42ExitUfo].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 43; + break; + + case kHS42BBQVendor: + if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, 0x107BB, 1); + _vm->_gnapActionStatus = kAS42UseQuarterWithBBQVendor; + if (_vm->_platY < 9) + _vm->platypusWalkTo(_vm->_platX, 9, -1, -1, 1); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = kAS42TalkBBQVendor; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS42ChickenLeg: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + break; + case GRAB_CURSOR: + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, 0, 0x107BC, 1); + _vm->_gnapActionStatus = kAS42GrabChickenLeg; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS42WalkArea1: + case kHS42WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = kAS42ToyUfoRefresh; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + updateAnimations(); + + _vm->toyUfoCheckTimer(); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 30; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextBBQVendorSequenceId == -1) { + switch (_vm->getRandom(8)) { + case 0: + _nextBBQVendorSequenceId = 0x14C; + break; + case 1: + case 2: + _nextBBQVendorSequenceId = 0x149; + break; + case 3: + case 4: + case 5: + case 6: + _nextBBQVendorSequenceId = 0x14D; + break; + case 7: + _nextBBQVendorSequenceId = 0x14A; + break; + } + if (_nextBBQVendorSequenceId == _currBBQVendorSequenceId && _nextBBQVendorSequenceId != 0x14D) + _nextBBQVendorSequenceId = -1; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 30; + } + + _vm->gameUpdateTick(); + } +} + +void Scene42::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { + case kAS42LeaveScene: + gameSys.setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; + _vm->_sceneDone = true; + break; + case kAS42TalkBBQVendor: + gameSys.setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; + _nextBBQVendorSequenceId = 0x14B; + break; + case kAS42UseQuarterWithBBQVendor: + case kAS42GrabChickenLeg: + if (gameSys.getAnimationStatus(2) == 2) { + int sequenceId; + if (_vm->_gnapActionStatus == kAS42UseQuarterWithBBQVendor) { + _vm->invRemove(kItemDiceQuarterHole); + _vm->invAdd(kItemChickenBucket); + _vm->setGrabCursorSprite(-1); + sequenceId = 0x150; + _nextBBQVendorSequenceId = 0x148; + } else if (_vm->isFlag(kGFUnk27)) { + if (_vm->isFlag(kGFUnk28)) { + sequenceId = 0x7B7; + _nextBBQVendorSequenceId = 0x145; + } else { + _vm->setFlag(kGFUnk28); + sequenceId = 0x14F; + _nextBBQVendorSequenceId = 0x147; + } + } else { + _vm->setFlag(kGFUnk27); + sequenceId = 0x14E; + _nextBBQVendorSequenceId = 0x146; + } + if (sequenceId == 0x7B7) { + gameSys.insertSequence(0x107B7, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), + 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->_gnapSequenceDatNum = 1; + } else { + gameSys.insertSequence(sequenceId, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceDatNum = 0; + } + _vm->_gnapSequenceId = sequenceId; + gameSys.setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); + if (_vm->_gnapActionStatus == kAS42UseQuarterWithBBQVendor) + _vm->_gnapActionStatus = kAS42UseQuarterWithBBQVendorDone; + else + _vm->_gnapActionStatus = -1; + gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); + _currBBQVendorSequenceId = _nextBBQVendorSequenceId; + if (_nextBBQVendorSequenceId == 0x145) + _nextBBQVendorSequenceId = 0x14A; + else + _nextBBQVendorSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(20) + 30; + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + } + break; + case kAS42UseQuarterWithBBQVendorDone: + gameSys.setAnimation(0, 0, 0); + _vm->setGrabCursorSprite(kItemChickenBucket); + _vm->_gnapActionStatus = -1; + break; + default: + gameSys.setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; + break; + } + } + + if (gameSys.getAnimationStatus(2) == 2 && _nextBBQVendorSequenceId != -1) { + gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); + _currBBQVendorSequenceId = _nextBBQVendorSequenceId; + _nextBBQVendorSequenceId = -1; + _vm->_timers[4] = _vm->getRandom(20) + 30; + } + + if (gameSys.getAnimationStatus(3) == 2) { + switch (_vm->_toyUfoActionStatus) { + case kAS42ToyUfoLeaveScene: + _vm->_sceneDone = true; + break; + case kAS42ToyUfoPickUpHotSauce: + gameSys.insertSequence(0x10870, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + _vm->setFlag(kGFUnk24); + updateHotspots(); + _vm->toyUfoSetStatus(kGFGroceryStoreHatTaken); + _vm->_toyUfoSequenceId = 0x870; + gameSys.setAnimation(0x10870, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoX = 0x181; + _vm->_toyUfoY = 53; + break; + default: + if (_vm->_toyUfoSequenceId == 0x872) { + _vm->hideCursor(); + _vm->addFullScreenSprite(0x13E, 255); + gameSys.setAnimation(0x151, 256, 0); + gameSys.insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + } + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, 3); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + _vm->_toyUfoId = (_vm->_toyUfoId + 1) % 10; + break; + } + _vm->_toyUfoActionStatus = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS43Platypus = 0, + kHS43Device = 1, + kHS43ExitUfoParty = 2, + kHS43ExitBBQ = 3, + kHS43ExitKissinBooth = 4, + kHS43TwoHeadedGuy = 5, + kHS43Key = 6, + kHS43Ufo = 7, + kHS43WalkArea1 = 8, + kHS43WalkArea2 = 9 +}; + +enum { + kHS43UfoExitLeft = 1, + kHS43UfoExitRight = 2, + kHS43UfoKey = 3, + kHS43UfoBucket = 4, + kHS43UfoDevice = 5 +}; + +Scene43::Scene43(GnapEngine *vm) : Scene(vm) { + _currTwoHeadedGuySequenceId = -1; + _nextTwoHeadedGuySequenceId = -1; +} + +int Scene43::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + return 0x13F; +} + +void Scene43::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHS43Platypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHS43UfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHS43UfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setHotspot(kHS43UfoKey, 140, 170, 185, 260, SF_GRAB_CURSOR); + _vm->setHotspot(kHS43UfoBucket, 475, 290, 545, 365, SF_DISABLED); + _vm->setDeviceHotspot(kHS43UfoDevice, -1, 534, -1, 599); + if (_vm->isFlag(kGFGroceryStoreHatTaken)) + _vm->_hotspots[kHS43UfoBucket]._flags = SF_GRAB_CURSOR; + // NOTE Bug in the original. Key hotspot wasn't disabled. + if (_vm->isFlag(kGFUnk14)) + _vm->_hotspots[kHS43UfoKey]._flags = SF_DISABLED; + _vm->_hotspotsCount = 6; + } else { + _vm->setHotspot(kHS43Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS43ExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS43ExitBBQ, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHS43ExitKissinBooth, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHS43TwoHeadedGuy, 470, 240, 700, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS43Key, 140, 170, 185, 260, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS43Ufo, 110, 0, 690, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS43WalkArea1, 0, 0, 800, 445); + _vm->setHotspot(kHS43WalkArea2, 465, 0, 800, 493); + _vm->setDeviceHotspot(kHS43Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk14)) + _vm->_hotspots[kHS43Key]._flags = SF_DISABLED; + _vm->_hotspotsCount = 10; + } +} + +void Scene43::run() { + GameSys gameSys = *_vm->_gameSys; + + _vm->queueInsertDeviceIcon(); + + if (!_vm->isFlag(kGFUnk14)) + gameSys.insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); + + _currTwoHeadedGuySequenceId = 0x13C; + _nextTwoHeadedGuySequenceId = -1; + + gameSys.setAnimation(0x13C, 1, 2); + gameSys.insertSequence(_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 42) + _vm->_toyUfoX = 30; + else + _vm->_toyUfoX = 770; + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); + } else { + switch (_vm->_prevSceneNum) { + case 42: + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + break; + case 44: + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + break; + case 54: + _vm->initGnapPos(4, 7, kDirBottomLeft); + _vm->initPlatypusPos(11, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + break; + default: + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + break; + } + } + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { + case kHS43UfoDevice: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + break; + + case kHS43UfoExitLeft: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 4; + _vm->_newSceneNum = 42; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + } + break; + + case kHS43UfoExitRight: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 4; + _vm->_newSceneNum = 44; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + } + break; + + case kHS43UfoKey: + if (_vm->isFlag(kGFJointTaken)) { + _vm->_toyUfoActionStatus = 6; + _vm->toyUfoFlyTo(163, 145, 0, 799, 0, 300, 3); + } else { + _vm->_toyUfoActionStatus = 5; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } + break; + + case kHS43UfoBucket: + _vm->_toyUfoActionStatus = 7; + _vm->toyUfoFlyTo(497, 143, 0, 799, 0, 300, 3); + _vm->_timers[9] = 600; + break; + } + } else { + switch (_vm->_sceneClickedHotspot) { + case kHS43Device: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + break; + + case kHS43Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS43ExitUfoParty: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS43ExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS43ExitUfoParty].y, -1, 0x107C7, 1); + _vm->_newSceneNum = 40; + break; + + case kHS43ExitBBQ: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_hotspotsWalkPos[kHS43ExitBBQ].y, -1, 0x107CF, 1); + _vm->_newSceneNum = 42; + break; + + case kHS43ExitKissinBooth: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_hotspotsWalkPos[kHS43ExitKissinBooth].y, -1, 0x107CD, 1); + _vm->_newSceneNum = 44; + break; + + case kHS43TwoHeadedGuy: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(6, 8, 7, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(7, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 2; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS43Key: + case kHS43Ufo: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(3, 7, 2, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(0, 0); + break; + case GRAB_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(3, 7, 0, 67515, 1); + _vm->_gnapActionStatus = 1; + break; + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS43WalkArea1: + case kHS43WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + } + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO) && (_vm->_toyUfoActionStatus == 5 || _vm->_toyUfoActionStatus == -1)) { + _vm->_toyUfoActionStatus = 5; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + updateAnimations(); + + _vm->toyUfoCheckTimer(); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { + _vm->_timers[4] = _vm->getRandom(100) + 100; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { + switch (_vm->getRandom(5)) { + case 0: + _nextTwoHeadedGuySequenceId = 0x13C; + break; + case 1: + _nextTwoHeadedGuySequenceId = 0x134; + break; + case 2: + _nextTwoHeadedGuySequenceId = 0x135; + break; + case 3: + _nextTwoHeadedGuySequenceId = 0x136; + break; + case 4: + _nextTwoHeadedGuySequenceId = 0x13A; + break; + } + if (_nextTwoHeadedGuySequenceId == _currTwoHeadedGuySequenceId) + _nextTwoHeadedGuySequenceId = -1; + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(100) + 100; + } + + _vm->gameUpdateTick(); + } + + if (_vm->_newSceneNum == 54) + _vm->clearFlag(kGFGnapControlsToyUFO); +} + +void Scene43::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + switch (_vm->_gnapActionStatus) { + case 0: + gameSys.setAnimation(0, 0, 0); + _vm->_sceneDone = true; + break; + + case 1: + if (gameSys.getAnimationStatus(2) == 2) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = _vm->getRandom(50) + 200; + gameSys.insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x13D; + _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x13D, _vm->_gnapId, 0); + _nextTwoHeadedGuySequenceId = 0x13B; + gameSys.insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(100) + 100; + _vm->_gnapActionStatus = -1; + } + break; + + default: + gameSys.setAnimation(0, 0, 0); + _vm->_gnapActionStatus = -1; + break; + } + } + + if (gameSys.getAnimationStatus(2) == 2) { + if (_currTwoHeadedGuySequenceId == 0x13A) { + if (_vm->isFlag(kGFGroceryStoreHatTaken)) { + _nextTwoHeadedGuySequenceId = 0x13E; + _vm->stopSound(0x108F6); + } else if (_vm->getRandom(2) != 0) { + _nextTwoHeadedGuySequenceId = 0x137; + } else { + _nextTwoHeadedGuySequenceId = 0x138; + } + } else if (_currTwoHeadedGuySequenceId == 0x13E) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 54; + } + if (_nextTwoHeadedGuySequenceId != -1) { + gameSys.insertSequence(_nextTwoHeadedGuySequenceId, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(100) + 100; + } + } + + if (gameSys.getAnimationStatus(3) == 2) { + switch (_vm->_toyUfoActionStatus) { + case 4: + _vm->_sceneDone = true; + _vm->_toyUfoActionStatus = -1; + break; + case 6: + gameSys.insertSequence(0x10871, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x1086F, 1, true); + _vm->setFlag(kGFUnk14); + updateHotspots(); + _vm->toyUfoSetStatus(kGFUnk18); + _vm->_toyUfoSequenceId = 0x871; + gameSys.setAnimation(0x10871, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoX = 96; + _vm->_toyUfoY = 131; + break; + case 7: + gameSys.insertSequence(0x10874, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + _vm->_toyUfoSequenceId = 0x874; + gameSys.setAnimation(0x10874, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = 8; + _vm->setFlag(kGFJointTaken); + _vm->_gnapActionStatus = 3; + break; + case 8: + _nextTwoHeadedGuySequenceId = 0x13A; + _vm->_toyUfoX = 514; + _vm->_toyUfoY = 125; + _vm->toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); + _vm->_toyUfoActionStatus = 9; + break; + case 9: + // Nothing + break; + default: + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); + _vm->_toyUfoActionStatus = -1; + break; + } + } +} + +/*****************************************************************************/ + +enum { + kHS44Platypus = 0, + kHS44ExitUfoParty = 1, + kHS44ExitUfo = 2, + kHS44ExitShow = 3, + kHS44KissingLady = 4, + kHS44Spring = 5, + kHS44SpringGuy = 6, + kHS44Device = 7, + kHS44WalkArea1 = 8, + kHS44WalkArea2 = 9 +}; + +enum { + kHS44UfoExitLeft = 1, + kHS44UfoExitRight = 2, + kHS44UfoDevice = 3 +}; + +Scene44::Scene44(GnapEngine *vm) : Scene(vm) { + _nextSpringGuySequenceId = -1; + _nextKissingLadySequenceId = -1; + _currSpringGuySequenceId = -1; + _currKissingLadySequenceId = -1; +} + +int Scene44::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); + return 0xFF; +} + +void Scene44::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHS44Platypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHS44UfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHS44UfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setDeviceHotspot(kHS44UfoDevice, -1, 534, -1, 599); + _vm->_hotspotsCount = 4; + } else { + _vm->setHotspot(kHS44Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS44ExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS44ExitUfo, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHS44ExitShow, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHS44KissingLady, 300, 160, 400, 315, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); + _vm->setHotspot(kHS44Spring, 580, 310, 635, 375, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS44SpringGuy, 610, 375, 690, 515, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); + _vm->setHotspot(kHS44WalkArea1, 0, 0, 800, 445); + _vm->setHotspot(kHS44WalkArea2, 617, 0, 800, 600); + _vm->setDeviceHotspot(kHS44Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk13)) + _vm->_hotspots[kHS44KissingLady]._flags = SF_DISABLED; + if (_vm->isFlag(kGFSpringTaken)) + _vm->_hotspots[kHS44Spring]._flags = SF_DISABLED; + _vm->_hotspotsCount = 10; + } +} + +void Scene44::run() { + GameSys gameSys = *_vm->_gameSys; + + _vm->queueInsertDeviceIcon(); + + gameSys.insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFSpringTaken)) + _currSpringGuySequenceId = 0xF8; + else + _currSpringGuySequenceId = 0xF9; + + _nextSpringGuySequenceId = -1; + gameSys.setAnimation(_currSpringGuySequenceId, 1, 4); + gameSys.insertSequence(_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFUnk13)) { + if (_vm->_prevSceneNum != 50 || _vm->_sceneSavegameLoaded) { + _currKissingLadySequenceId = 0xF6; + _nextKissingLadySequenceId = -1; + } else { + _vm->setGrabCursorSprite(kItemGum); + _currKissingLadySequenceId = 0xF5; + _nextKissingLadySequenceId = 0xF6; + gameSys.setAnimation(0xF5, 1, 2); + } + } else { + _currKissingLadySequenceId = 0xEC; + _nextKissingLadySequenceId = -1; + gameSys.setAnimation(0xEC, 1, 2); + } + + gameSys.insertSequence(_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 43) + _vm->_toyUfoX = 30; + else + _vm->_toyUfoX = 770; + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); + } else { + switch (_vm->_prevSceneNum) { + case 43: + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 7, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + break; + case 46: + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(7, 8, -1, 0x107D2, 1); + break; + case 50: + _vm->initGnapPos(4, 8, kDirBottomRight); + if (_vm->_sceneSavegameLoaded) { + _vm->initPlatypusPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); + } else if (!_vm->isFlag(kGFUnk13)) { + _vm->_timers[0] = 50; + _vm->_timers[1] = 20; + _vm->_platX = 5; + _vm->_platY = 8; + _vm->_platypusSequenceId = 0xFD; + _vm->_platypusFacing = kDirNone; + _vm->_platypusId = 160; + _vm->_platypusSequenceDatNum = 0; + gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); + } + _vm->endSceneInit(); + break; + default: + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + break; + } + } + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { + case kHS44UfoExitLeft: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 6; + _vm->_newSceneNum = 43; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); + } + break; + + case kHS44UfoExitRight: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 6; + _vm->_newSceneNum = 46; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); + } + break; + + case kHS44UfoDevice: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; + break; + } + } else if (_vm->_sceneClickedHotspot <= 9) { + switch (_vm->_sceneClickedHotspot) { + case kHS44Device: + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; + break; + + case kHS44Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS44ExitUfoParty: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS44ExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 40; + break; + + case kHS44ExitUfo: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_platY, -1, 0x107CF, 1); + _vm->_newSceneNum = 43; + break; + + case kHS44ExitShow: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitShow].x, _vm->_hotspotsWalkPos[kHS44ExitShow].y, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 46; + break; + + case kHS44KissingLady: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->_gnapActionStatus = 2; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, -1, 9); + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(4, 3); + break; + case GRAB_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 1; + break; + case PLAT_CURSOR: + _vm->gnapUseDeviceOnPlatypuss(); + _vm->platypusWalkTo(6, 7, 1, 0x107D2, 1); + if (_vm->_gnapX == 7 && _vm->_gnapY == 7) + _vm->gnapWalkStep(); + _vm->playGnapIdle(5, 7); + _vm->_platypusActionStatus = 4; + break; + } + } + break; + + case kHS44Spring: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(8, 7); + break; + case GRAB_CURSOR: + _vm->playGnapPullOutDevice(8, 0); + _vm->playGnapUseDevice(8, 0); + _nextSpringGuySequenceId = 0xFB; + _vm->invAdd(kItemSpring); + _vm->setFlag(kGFSpringTaken); + updateHotspots(); + break; + case TALK_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS44SpringGuy: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + if (_vm->isFlag(kGFSpringTaken)) + _vm->playGnapMoan1(8, 7); + else + _vm->playGnapScratchingHead(8, 7); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS44WalkArea1: + case kHS44WalkArea2: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + + } + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = 7; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + updateAnimations(); + _vm->toyUfoCheckTimer(); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextKissingLadySequenceId == -1) { + switch (_vm->getRandom(20)) { + case 0: + _nextKissingLadySequenceId = 0xED; + break; + case 1: + _nextKissingLadySequenceId = 0xEE; + break; + case 2: + _nextKissingLadySequenceId = 0xF0; + break; + case 3: + _nextKissingLadySequenceId = 0xF3; + break; + case 4: + _nextKissingLadySequenceId = 0xF4; + break; + default: + _nextKissingLadySequenceId = 0xEC; + break; + } + if (_nextKissingLadySequenceId != 0xEC && _nextKissingLadySequenceId == _currKissingLadySequenceId) + _nextKissingLadySequenceId = -1; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(20) + 20; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSpringGuySequenceId == -1) { + if (_vm->getRandom(5) != 0) { + if (!_vm->isFlag(kGFSpringTaken)) + _nextSpringGuySequenceId = 0xF9; + } else { + if (_vm->isFlag(kGFSpringTaken)) + _nextSpringGuySequenceId = 0xF8; + else + _nextSpringGuySequenceId = 0xFA; + } + } + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + _vm->_timers[4] = _vm->getRandom(20) + 20; + } + + _vm->gameUpdateTick(); + } +} + +void Scene44::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case 0: + _vm->_sceneDone = true; + break; + case 1: + _nextKissingLadySequenceId = 0xEF; + break; + case 2: + _nextKissingLadySequenceId = 0xF2; + break; + } + _vm->_gnapActionStatus = -1; + } + + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); + switch (_vm->_platypusActionStatus) { + case 4: + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + _vm->_platypusSequenceId = 0xFE; + _vm->_platypusSequenceDatNum = 0; + gameSys.setAnimation(0xFE, _vm->_platypusId, 1); + gameSys.removeSequence(_currKissingLadySequenceId, 1, true); + _vm->_platypusActionStatus = 5; + } + break; + case 5: + _vm->_sceneDone = true; + _vm->_newSceneNum = 50; + break; + default: + _vm->_platypusActionStatus = -1; + break; + } + } + + if (gameSys.getAnimationStatus(2) == 2) { + if (_nextKissingLadySequenceId == 0xF6) { + gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + _vm->initPlatypusPos(5, 8, kDirNone); + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; + gameSys.setAnimation(0, 0, 2); + } else if (_nextKissingLadySequenceId != -1) { + gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKissingLadySequenceId, 1, 2); + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(20) + 20; + } + } + + if (gameSys.getAnimationStatus(4) == 2) { + if (_currSpringGuySequenceId == 0xFB) { + _vm->setGrabCursorSprite(kItemSpring); + _nextSpringGuySequenceId = 0xF8; + } + if (_nextSpringGuySequenceId != -1) { + gameSys.insertSequence(_nextSpringGuySequenceId, 1, _currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextSpringGuySequenceId, 1, 4); + _currSpringGuySequenceId = _nextSpringGuySequenceId; + _nextSpringGuySequenceId = -1; + _vm->_timers[5] = _vm->getRandom(20) + 20; + } + } + + if (gameSys.getAnimationStatus(3) == 2) { + switch (_vm->_toyUfoActionStatus) { + case 6: + _vm->_sceneDone = true; + break; + default: + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); + break; + } + _vm->_toyUfoActionStatus = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS45Platypus = 0, + kHS45ExitUfoParty = 1, + kHS45ExitShoe = 2, + kHS45ExitRight = 3, + kHS45ExitDiscoBall = 4, + kHS45DiscoBall = 5, + kHS45Device = 6, + kHS45WalkArea1 = 7 +}; + +enum { + kHS45UfoExitLeft = 1, + kHS45UfoExitRight = 2, + kHS45UfoDevice = 3 +}; + +Scene45::Scene45(GnapEngine *vm) : Scene(vm) { + _currDancerSequenceId = -1; +} + +int Scene45::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 4); + gameSys.setAnimation(0, 0, 5); + return _vm->isFlag(kGFUnk23) ? 0xA2 : 0xA1; +} + +void Scene45::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHS45Platypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHS45UfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHS45UfoExitRight, 794, 0, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED); + _vm->setDeviceHotspot(kHS45UfoDevice, -1, 534, -1, 599); + _vm->_hotspotsCount = 4; + } else { + _vm->setHotspot(kHS45Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS45ExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS45ExitShoe, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHS45ExitRight, 794, 100, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED, 10, 8); + _vm->setHotspot(kHS45ExitDiscoBall, 200, 0, 600, 10, SF_DISABLED); + _vm->setHotspot(kHS45DiscoBall, 370, 10, 470, 125, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); + _vm->setHotspot(kHS45WalkArea1, 0, 0, 800, 472); + _vm->setDeviceHotspot(kHS45Device, -1, -1, -1, -1); + if (_vm->isFlag(kGFUnk22)) { + _vm->_hotspots[kHS45Platypus]._flags = SF_DISABLED; + _vm->_hotspots[kHS45ExitUfoParty]._flags = SF_DISABLED; + _vm->_hotspots[kHS45ExitShoe]._flags = SF_DISABLED; + _vm->_hotspots[kHS45ExitRight]._flags = SF_DISABLED; + _vm->_hotspots[kHS45ExitDiscoBall]._flags = SF_EXIT_U_CURSOR; + } + if (_vm->isFlag(kGFUnk23) || _vm->isFlag(kGFUnk22)) + _vm->_hotspots[kHS45DiscoBall]._flags = SF_DISABLED; + _vm->_hotspotsCount = 8; + } +} + +void Scene45::run() { + GameSys gameSys = *_vm->_gameSys; + + if (!_vm->isSoundPlaying(0x1094A)) + _vm->playSound(0x1094A, true); + + _vm->queueInsertDeviceIcon(); + + gameSys.insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); + _currDancerSequenceId = 0x8F; + gameSys.setAnimation(_currDancerSequenceId, 1, 2); + gameSys.insertSequence(_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 46) + _vm->_toyUfoX = 30; + else + _vm->_toyUfoX = 770; + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 5); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); + } else if (_vm->isFlag(kGFUnk22)) { + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + _vm->_gnapId = 1; + gameSys.setAnimation(0x9E, 1, 0); + _vm->_gnapActionStatus = 1; + gameSys.insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + _vm->initPlatypusPos(4, 8, kDirNone); + _vm->endSceneInit(); + } else if (_vm->_prevSceneNum == 46) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + } else if (_vm->_prevSceneNum == 41) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); + _vm->gnapWalkTo(10, 9, -1, 0x107BA, 1); + } else { + _vm->initGnapPos(2, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + } + + if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setFlag(kGFUnk21); + _vm->setGrabCursorSprite(-1); + gameSys.setAnimation(0x9D, _vm->_gnapId, 0); + gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) { + _vm->gameUpdateTick(); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); + int newSeqId = _vm->getRandom(7) + 0x8F; + gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; + } + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); + } + } + _vm->_gnapSequenceId = 0x9D; + _vm->_gnapSequenceDatNum = 0; + _vm->hideCursor(); + _vm->addFullScreenSprite(0x8A, 255); + gameSys.setAnimation(0xA0, 256, 0); + gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + gameSys.setAnimation(0x107BD, _vm->_gnapId, 0); + gameSys.insertSequence(0x107BD, _vm->_gnapId, + makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + _vm->removeFullScreenSprite(); + _vm->showCursor(); + _vm->_gnapSequenceId = 0x7BD; + _vm->_gnapSequenceDatNum = 1; + } + + _vm->playPlatypusSequence(0x9A); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094A)) + _vm->playSound(0x1094A, true); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { + case kHS45UfoExitLeft: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 2; + _vm->_newSceneNum = 46; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 5); + } + break; + + case kHS45UfoExitRight: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 2; + _vm->_newSceneNum = 41; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 5); + } + break; + + case kHS45UfoDevice: + _vm->runMenu(); + updateHotspots(); + break; + } + } else { + switch (_vm->_sceneClickedHotspot) { + case kHS45Device: + _vm->runMenu(); + updateHotspots(); + break; + + case kHS45Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + _vm->playPlatypusSequence(0x9A); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS45ExitUfoParty: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 40; + } + break; + + case kHS45ExitShoe: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_platY, -1, 0x107CF, 1); + _vm->_newSceneNum = 46; + } + break; + + case kHS45ExitRight: + if (_vm->_gnapActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_platY, -1, 0x107CD, 1); + _vm->_newSceneNum = 41; + } + break; + + case kHS45ExitDiscoBall: + _vm->clearFlag(kGFUnk22); + _vm->setFlag(kGFUnk23); + _vm->_sceneDone = true; + _vm->_newSceneNum = 54; + break; + + case kHS45DiscoBall: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex == kItemSpring) { + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall].x, _vm->_hotspotsWalkPos[kHS45DiscoBall].y, 0, 0x9F, 5); + _vm->_gnapActionStatus = 1; + _vm->setGrabCursorSprite(-1); + _vm->invRemove(kItemSpring); + } else if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapScratchingHead(5, 0); + break; + case GRAB_CURSOR: + case TALK_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + } + break; + + case kHS45WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + } + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = 3; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + updateAnimations(); + _vm->toyUfoCheckTimer(); + + if (!_vm->_isLeavingScene && _vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } + + _vm->_sceneWaiting = false; +} + +void Scene45::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case 0: + _vm->_sceneDone = true; + break; + case 1: + _vm->_sceneWaiting = true; + _vm->setFlag(kGFUnk22); + updateHotspots(); + gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + _vm->_gnapSequenceId = 0x9E; + _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x9E, _vm->_gnapId, 0); + break; + default: + _vm->_gnapActionStatus = -1; + break; + } + } + + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); + if (_vm->getRandom(2) != 0) + _vm->playPlatypusSequence(0x9B); + else + _vm->playPlatypusSequence(0x9C); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + } + + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); + int newSeqId = _vm->getRandom(7) + 0x8F; + gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; + } + + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); + } + + if (gameSys.getAnimationStatus(5) == 2) { + switch (_vm->_toyUfoActionStatus) { + case 2: + _vm->_sceneDone = true; + break; + default: + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 5); + break; + } + _vm->_toyUfoActionStatus = -1; + } +} + +/*****************************************************************************/ + +enum { + kHS46Platypus = 0, + kHS46ExitUfoParty = 1, + kHS46ExitKissinBooth = 2, + kHS46ExitDisco = 3, + kHS46SackGuy = 4, + kHS46ItchyGuy = 5, + kHS46Device = 6, + kHS46WalkArea1 = 7 +}; + +enum { + kHS46UfoExitLeft = 1, + kHS46UfoExitRight = 2, + kHS46UfoDevice = 3 +}; + +Scene46::Scene46(GnapEngine *vm) : Scene(vm) { + _currSackGuySequenceId = -1; + _nextItchyGuySequenceId = -1; + _nextSackGuySequenceId = -1; + _currItchyGuySequenceId = -1; +} + +int Scene46::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 4); + return 0x4E; +} + +void Scene46::updateHotspots() { + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->setHotspot(kHS46Platypus, 0, 0, 0, 0, SF_DISABLED); + _vm->setHotspot(kHS46UfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); + _vm->setHotspot(kHS46UfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); + _vm->setDeviceHotspot(kHS46UfoDevice, -1, 534, -1, 599); + _vm->_hotspotsCount = 4; + } else { + _vm->setHotspot(kHS46Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS46ExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); + _vm->setHotspot(kHS46ExitKissinBooth, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); + _vm->setHotspot(kHS46ExitDisco, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); + _vm->setHotspot(kHS46SackGuy, 180, 370, 235, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHS46ItchyGuy, 535, 210, 650, 480, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); + _vm->setHotspot(kHS46WalkArea1, 0, 0, 800, 485); + _vm->setDeviceHotspot(kHS46Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 8; + } +} + +void Scene46::run() { + GameSys gameSys = *_vm->_gameSys; + + _vm->queueInsertDeviceIcon(); + gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); + + _currSackGuySequenceId = 0x4B; + _nextSackGuySequenceId = -1; + gameSys.setAnimation(0x4B, 1, 3); + gameSys.insertSequence(_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + _currItchyGuySequenceId = 0x47; + _nextItchyGuySequenceId = -1; + gameSys.setAnimation(0x47, 1, 4); + gameSys.insertSequence(_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoId = 0; + _vm->_toyUfoActionStatus = -1; + _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); + _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; + if (_vm->_prevSceneNum == 44) + _vm->_toyUfoX = 30; + else + _vm->_toyUfoX = 770; + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->endSceneInit(); + } else if (_vm->_prevSceneNum == 44) { + _vm->initGnapPos(-1, 8, kDirUpRight); + _vm->initPlatypusPos(-1, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + } else if (_vm->_prevSceneNum == 45) { + _vm->initGnapPos(11, 8, kDirUpRight); + _vm->initPlatypusPos(12, 8, kDirUpLeft); + _vm->endSceneInit(); + _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + } else { + _vm->initGnapPos(5, 11, kDirUpRight); + _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->endSceneInit(); + _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); + _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); + } + + _vm->_timers[4] = _vm->getRandom(50) + 80; + _vm->_timers[5] = _vm->getRandom(50) + 80; + + while (!_vm->_sceneDone) { + if (!_vm->isSoundPlaying(0x1094B)) + _vm->playSound(0x1094B, true); + + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + switch (_vm->_sceneClickedHotspot) { + case kHS46UfoExitLeft: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 3; + _vm->_newSceneNum = 44; + _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); + } + break; + + case kHS46UfoExitRight: + if (_vm->_toyUfoActionStatus < 0) { + _vm->_isLeavingScene = true; + _vm->_toyUfoActionStatus = 3; + _vm->_newSceneNum = 45; + _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); + } + break; + + case kHS46UfoDevice: + _vm->runMenu(); + updateHotspots(); + break; + } + } else { + switch (_vm->_sceneClickedHotspot) { + case kHS46Device: + _vm->runMenu(); + updateHotspots(); + break; + + case kHS46Platypus: + if (_vm->_gnapActionStatus < 0) { + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + break; + case GRAB_CURSOR: + _vm->gnapKissPlatypus(0); + break; + case TALK_CURSOR: + _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + break; + case PLAT_CURSOR: + _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + break; + } + } + } + break; + + case kHS46SackGuy: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 2; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS46ItchyGuy: + if (_vm->_grabCursorSpriteIndex >= 0) { + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); + } else { + switch (_vm->_verbCursor) { + case LOOK_CURSOR: + _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); + break; + case TALK_CURSOR: + _vm->_gnapIdleFacing = kDirUpRight; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnapActionStatus = 1; + break; + case GRAB_CURSOR: + case PLAT_CURSOR: + _vm->playGnapImpossible(0, 0); + break; + } + } + break; + + case kHS46ExitUfoParty: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y, 0, 0x107AE, 1); + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 40; + break; + + case kHS46ExitKissinBooth: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_platY, -1, 0x107CF, 1); + _vm->_newSceneNum = 44; + break; + + case kHS46ExitDisco: + _vm->_isLeavingScene = true; + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->_gnapActionStatus = 0; + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_platY, -1, 0x107CD, 1); + _vm->_newSceneNum = 45; + break; + + case kHS46WalkArea1: + if (_vm->_gnapActionStatus < 0) + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + break; + } + } + + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + _vm->_mouseClickState._left = false; + if (_vm->isFlag(kGFGnapControlsToyUFO)) { + _vm->_toyUfoActionStatus = 4; + _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); + } else { + _vm->gnapWalkTo(-1, -1, -1, -1, 1); + } + } + + updateAnimations(); + _vm->toyUfoCheckTimer(); + + if (!_vm->_isLeavingScene) { + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updatePlatypusIdleSequence(); + if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->updateGnapIdleSequence(); + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(50) + 80; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextItchyGuySequenceId == -1) { + if (_vm->getRandom(2) != 0) + _nextItchyGuySequenceId = 0x49; + else + _nextItchyGuySequenceId = 0x48; + } + } + if (!_vm->_timers[5]) { + _vm->_timers[5] = _vm->getRandom(50) + 80; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSackGuySequenceId == -1) + _nextSackGuySequenceId = 0x4C; + } + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + + _vm->gameUpdateTick(); + } +} + +void Scene46::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); + switch (_vm->_gnapActionStatus) { + case 0: + _vm->_sceneDone = true; + break; + case 1: + _nextItchyGuySequenceId = 0x46; + break; + case 2: + _nextSackGuySequenceId = 0x4A; + break; + } + _vm->_gnapActionStatus = -1; + } + + if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { + gameSys.insertSequence(_nextSackGuySequenceId, 1, _currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextSackGuySequenceId, 1, 3); + _currSackGuySequenceId = _nextSackGuySequenceId; + _nextSackGuySequenceId = -1; + _vm->_timers[5] = _vm->getRandom(50) + 80; + } + + if (gameSys.getAnimationStatus(4) == 2 && _nextItchyGuySequenceId != -1) { + gameSys.insertSequence(_nextItchyGuySequenceId, 1, _currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextItchyGuySequenceId, 1, 4); + _currItchyGuySequenceId = _nextItchyGuySequenceId; + _nextItchyGuySequenceId = -1; + _vm->_timers[4] = _vm->getRandom(50) + 80; + } + + if (gameSys.getAnimationStatus(2) == 2) { + switch (_vm->_toyUfoActionStatus) { + case 3: + _vm->_sceneDone = true; + break; + default: + _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; + ++_vm->_toyUfoId; + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + break; + } + _vm->_toyUfoActionStatus = -1; + } +} + +/*****************************************************************************/ + +static const ObstacleDef kObstacleDefs[] = { + {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14}, + {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12}, + {0xCD, 11}, {0xCB, 15}, {0xB7, 12}, {0xCD, 11}, {0xCB, 10}, + {0xCF, 15}, {0xCF, 14}, {0xBD, 13}, {0xCF, 12}, {0xCD, 11}, + {0xCB, 15}, {0xCB, 13}, {0xB4, 12}, {0xCB, 11}, {0xCD, 10}, + {0xCF, 15}, {0xCD, 12}, {0xBA, 12}, {0xCD, 12}, {0xCF, 12}, + {0xCB, 15}, {0xCB, 9}, {0xCD, 9}, {0xCF, 9}, {0xCD, 9}, + {0xCB, 9}, {0xCD, 9}, {0xCF, 5}, {0xBD, 13}, {0xCF, 8}, + {0xCB, 8}, {0xCD, 15}, {0xB4, 1}, {0xBD, 7}, {0xCF, 7}, + {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15} +}; + +Scene49::Scene49(GnapEngine *vm) : Scene(vm) { + _scoreBarFlash = false; + _scoreBarPos = -1; + _scoreLevel = -1; + _obstacleIndex = -1; + _truckSequenceId = -1; + _truckId = -1; + _truckLaneNum = -1; + + for (int i = 0; i < 5; i++) { + _obstacles[i]._currSequenceId = -1; + _obstacles[i]._closerSequenceId = -1; + _obstacles[i]._passedSequenceId = -1; + _obstacles[i]._splashSequenceId = -1; + _obstacles[i]._collisionSequenceId = -1; + _obstacles[i]._prevId = -1; + _obstacles[i]._currId = -1; + _obstacles[i]._laneNum = -1; + } +} + +int Scene49::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + for (int i = 0; i < 5; ++i) + gameSys.setAnimation(0, 0, i + 2); + _vm->_timers[2] = 0; + _vm->_timers[0] = 0; + _vm->_timers[1] = 0; + _vm->clearKeyStatus1(28); + _vm->clearKeyStatus1(54); + _vm->clearKeyStatus1(52); + return 0xD5; +} + +void Scene49::updateHotspots() { + _vm->_hotspotsCount = 0; +} + +void Scene49::checkObstacles() { + if (_vm->_timers[2] == 0) { + if (_vm->_timers[3] == 0) { + for (int i = 0; i < 5; ++i) + clearObstacle(i); + } + + for (int j = 0; j < 5; ++j) { + if (_obstacles[j]._currSequenceId == 0) { + _vm->_timers[3] = 35; + _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId; + switch (_obstacles[j]._currSequenceId) { + case 0xB4: + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 180; + _obstacles[j]._passedSequenceId = 181; + _obstacles[j]._splashSequenceId = 182; + _obstacles[j]._collisionSequenceId = 192; + break; + case 0xB7: + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 183; + _obstacles[j]._passedSequenceId = 184; + _obstacles[j]._splashSequenceId = 185; + _obstacles[j]._collisionSequenceId = 193; + break; + case 0xBD: + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 189; + _obstacles[j]._passedSequenceId = 190; + _obstacles[j]._splashSequenceId = 191; + _obstacles[j]._collisionSequenceId = 195; + break; + case 0xBA: + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 186; + _obstacles[j]._passedSequenceId = 187; + _obstacles[j]._splashSequenceId = 188; + _obstacles[j]._collisionSequenceId = 194; + break; + case 0xCB: + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 203; + _obstacles[j]._passedSequenceId = 204; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 209; + break; + case 0xCD: + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 205; + _obstacles[j]._passedSequenceId = 206; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 210; + break; + case 0xCF: + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 207; + _obstacles[j]._passedSequenceId = 208; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 211; + break; + } + _obstacles[j]._prevId = _truckId; + _obstacles[j]._currId = _obstacles[j]._prevId; + _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2); + _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); + _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks; + ++_obstacleIndex; + if (_obstacleIndex == 50) + _obstacleIndex = 0; + break; + } + } + } +} + +void Scene49::updateObstacle(int id) { + GameSys gameSys = *_vm->_gameSys; + Scene49Obstacle &obstacle = _obstacles[id]; + + obstacle._currId = obstacle._prevId; + + switch (obstacle._laneNum) { + case 1: + obstacle._prevId = _truckId + 1; + break; + case 2: + if (_truckLaneNum != 2 && _truckLaneNum != 3) + obstacle._prevId = _truckId - 1; + else + obstacle._prevId = _truckId + 1; + break; + case 3: + if (_truckLaneNum != 1 && _truckLaneNum != 2) + obstacle._prevId = _truckId; + else + obstacle._prevId = _truckId - 1; + break; + } + + if (obstacle._currSequenceId == obstacle._closerSequenceId) { + if (_truckLaneNum == obstacle._laneNum) { + if (obstacle._splashSequenceId) { + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._collisionSequenceId; + _vm->playSound(224, false); + increaseScore(30); + } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) || + (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) || + (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) { + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._passedSequenceId; + } else { + gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0); + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + gameSys.insertSequence(obstacle._collisionSequenceId, 256, + _truckSequenceId, _truckId, + kSeqSyncExists, 0, 0, -50); + _truckSequenceId = obstacle._collisionSequenceId; + _truckId = 256; + obstacle._currSequenceId = obstacle._passedSequenceId; + _vm->playSound(225, false); + decreaseScore(30); + } + } else { + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._passedSequenceId; + } + } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { + if (_truckLaneNum == obstacle._laneNum) { + if (obstacle._splashSequenceId) { + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._collisionSequenceId; + _vm->playSound(224, false); + increaseScore(30); + } + } else if (obstacle._splashSequenceId) { + gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._splashSequenceId; + } + } else { + gameSys.setAnimation(0, 0, id + 2); + clearObstacle(id); + } +} + +void Scene49::increaseScore(int amount) { + if (_scoreBarPos + amount <= 556) { + _scoreBarPos += amount; + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); + } + _scoreLevel = _scoreBarPos + amount >= 556; +} + +void Scene49::decreaseScore(int amount) { + if (_scoreBarPos >= 226 && _scoreLevel == 0) { + if (_scoreBarFlash) + refreshScoreBar(); + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); + _scoreBarPos -= amount; + _scoreLevel = 0; + } +} + +void Scene49::refreshScoreBar() { + if (_scoreBarFlash) + _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); + else + _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); + _scoreBarFlash = !_scoreBarFlash; +} + +void Scene49::clearObstacle(int index) { + _obstacles[index]._currSequenceId = 0; + _obstacles[index]._closerSequenceId = 0; + _obstacles[index]._passedSequenceId = 0; + _obstacles[index]._splashSequenceId = 0; + _obstacles[index]._collisionSequenceId = 0; + _obstacles[index]._prevId = 0; + _obstacles[index]._currId = 0; + _obstacles[index]._laneNum = 0; +} + +void Scene49::run() { + GameSys gameSys = *_vm->_gameSys; + + bool animToggle6 = false; + bool animToggle5 = false; + bool animToggle4 = false; + bool animToggle3 = false; + bool streetAnimToggle = false; + bool bgAnimToggle = false; + + _vm->playSound(0xE2, true); + _vm->setSoundVolume(0xE2, 75); + + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + + _scoreBarPos = 196; + _scoreLevel = 0; + _scoreBarFlash = false; + + switch (_vm->getRandom(3)) { + case 0: + _truckSequenceId = 0xAD; + _truckLaneNum = 1; + break; + case 1: + _truckSequenceId = 0xAE; + _truckLaneNum = 2; + break; + case 2: + _truckSequenceId = 0xAF; + _truckLaneNum = 3; + break; + } + + int bgWidth1 = gameSys.getSpriteWidthById(0x5E); + int bgX1 = 600; + + int bgWidth2 = gameSys.getSpriteWidthById(0x5F); + int bgX2 = 400; + + int bgWidth3 = gameSys.getSpriteWidthById(4); + int bgX3 = 700; + + int bgWidth4 = gameSys.getSpriteWidthById(5); + int bgX4 = 500; + + int bgWidth5 = gameSys.getSpriteWidthById(6); + int bgX5 = 300; + + int bgWidth6 = gameSys.getSpriteWidthById(7); + int bgX6 = 100; + + gameSys.setAnimation(0xC8, 251, 1); + gameSys.setAnimation(_truckSequenceId, 256, 0); + gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); + gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); + gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); + gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); + gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); + gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); + gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); + gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); + + _vm->_timers[0] = 2; + + for (int i = 0; i < 5; ++i) + clearObstacle(i); + + _obstacleIndex = 0; + + _vm->_timers[2] = _vm->getRandom(20) + 10; + + _truckId = 256; + _vm->_timers[3] = 35; + + while (!_vm->_sceneDone) { + if (_vm->_timers[0] == 0) { + // Update background animations (clouds etc.) + --bgX1; + bgX2 -= 2; + bgX3 -= 5; + --bgX4; + --bgX5; + --bgX6; + if (bgX1 <= -bgWidth1) + bgX1 = 799; + if (bgX2 <= -bgWidth2) + bgX2 = 799; + if (bgX3 <= -bgWidth3) + bgX3 = 799; + if (bgX4 <= -bgWidth4) + bgX4 = 799; + if (bgX5 <= -bgWidth5) + bgX5 = 799; + if (bgX6 <= -bgWidth6) + bgX6 = 799; + bgAnimToggle = !bgAnimToggle; + gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); + gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); + gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); + gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); + gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); + gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); + _vm->_timers[0] = 2; + } + + if (gameSys.getAnimationStatus(1) == 2) { + streetAnimToggle = !streetAnimToggle; + gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); + gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); + } + + checkObstacles(); + + if (gameSys.getAnimationStatus(0) == 2) { + switch (_truckSequenceId) { + case 0xB1: + _truckLaneNum = 1; + break; + case 0xB0: + case 0xB3: + _truckLaneNum = 2; + break; + case 0xB2: + _truckLaneNum = 3; + break; + } + animToggle3 = !animToggle3; + if (_truckLaneNum == 1) { + gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAD; + } else if (_truckLaneNum == 2) { + gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAE; + } else { + gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAF; + } + _truckId = (animToggle3 ? 1 : 0) + 256; + if (_scoreLevel == 1) { + if (!gameSys.isSequenceActive(0xD4, 266)) { + gameSys.setAnimation(0xD4, 266, 8); + gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); + } + ++_scoreLevel; + _vm->_timers[1] = 2; + animToggle4 = false; + animToggle5 = false; + animToggle6 = false; + _scoreBarFlash = false; + } + } + + if (_scoreLevel != 0 && !_vm->_timers[1]) { + refreshScoreBar(); + _vm->_timers[1] = 8; + if (animToggle6) { + if (animToggle5) { + if (animToggle4 && !gameSys.isSequenceActive(212, 266)) + gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); + animToggle4 = !animToggle4; + } + animToggle5 = !animToggle5; + } + animToggle6 = !animToggle6; + } + + updateAnimations(); + + if (clearKeyStatus()) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 2; + _vm->_newCursorValue = 1; + } + + if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { + // Steer right + if (_truckSequenceId == 0xB3) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB1) + _truckLaneNum = 1; + if (_truckLaneNum != 3 && _truckLaneNum != 2) { + if (_scoreLevel) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 47; + } + } else { + int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1; + if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; + } + } + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + } + + if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { + // Steer left + if (_truckSequenceId == 0xB0) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB2) + _truckLaneNum = 3; + if (_truckLaneNum == 1 || _truckLaneNum == 2) { + int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2; + if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; + } + } + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + } + _vm->gameUpdateTick(); + } + _vm->stopSound(0xE2); +} + +void Scene49::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + for (int i = 0; i < 5; ++i) { + if (gameSys.getAnimationStatus(i + 2) == 2) { + if (_obstacles[i]._currSequenceId) + updateObstacle(i); + } + } + + if (gameSys.getAnimationStatus(8) == 2) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 47; + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group4.h b/engines/gnap/scenes/group4.h new file mode 100644 index 0000000000..db73bbddc4 --- /dev/null +++ b/engines/gnap/scenes/group4.h @@ -0,0 +1,193 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GROUP4_H +#define GNAP_GROUP4_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +class Scene40: public Scene { +public: + Scene40(GnapEngine *vm); + ~Scene40() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; +}; + +class Scene41: public Scene { +public: + Scene41(GnapEngine *vm); + ~Scene41() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currKidSequenceId; + int _nextKidSequenceId; + int _currToyVendorSequenceId; + int _nextToyVendorSequenceId; +}; + +class Scene42: public Scene { +public: + Scene42(GnapEngine *vm); + ~Scene42() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currBBQVendorSequenceId; + int _nextBBQVendorSequenceId; +}; + +class Scene43: public Scene { +public: + Scene43(GnapEngine *vm); + ~Scene43() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currTwoHeadedGuySequenceId; + int _nextTwoHeadedGuySequenceId; +}; + +class Scene44: public Scene { +public: + Scene44(GnapEngine *vm); + ~Scene44() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _nextSpringGuySequenceId; + int _nextKissingLadySequenceId; + int _currSpringGuySequenceId; + int _currKissingLadySequenceId; +}; + +class Scene45: public Scene { +public: + Scene45(GnapEngine *vm); + ~Scene45() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currDancerSequenceId; +}; + +class Scene46: public Scene { +public: + Scene46(GnapEngine *vm); + ~Scene46() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _currSackGuySequenceId; + int _nextItchyGuySequenceId; + int _nextSackGuySequenceId; + int _currItchyGuySequenceId; +}; + +struct Scene49Obstacle { + int _currSequenceId; + int _closerSequenceId; + int _passedSequenceId; + int _splashSequenceId; + int _collisionSequenceId; + int _prevId; + int _currId; + int _laneNum; +}; + +struct ObstacleDef { + int _sequenceId; + int _ticks; +}; + +class Scene49: public Scene { +public: + Scene49(GnapEngine *vm); + ~Scene49() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _scoreBarPos; + int _scoreLevel; + bool _scoreBarFlash; + int _obstacleIndex; + Scene49Obstacle _obstacles[5]; + int _truckSequenceId; + int _truckId; + int _truckLaneNum; + + void checkObstacles(); + void updateObstacle(int id); + void increaseScore(int amount); + void decreaseScore(int amount); + void refreshScoreBar(); + void clearObstacle(int index); +}; + +} // End of namespace Gnap + +#endif // GNAP_GROUP4_H diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp deleted file mode 100644 index ade66363dc..0000000000 --- a/engines/gnap/scenes/scene40.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene40.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitCave = 1, - kHSExitToyStand = 2, - kHSExitBBQ = 3, - kHSExitUfo = 4, - kHSExitKissinBooth = 5, - kHSExitDancefloor = 6, - kHSExitShoe = 7, - kHSDevice = 8 -}; - -Scene40::Scene40(GnapEngine *vm) : Scene(vm) { -} - -int Scene40::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - return _vm->isFlag(kGFUnk23) ? 0x01 : 0x00; -} - -void Scene40::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_DISABLED | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitCave, 169, 510, 264, 600, SF_EXIT_D_CURSOR, 0, 8); - _vm->setHotspot(kHSExitToyStand, 238, 297, 328, 376, SF_EXIT_L_CURSOR, 0, 8); - _vm->setHotspot(kHSExitBBQ, 328, 220, 401, 306, SF_EXIT_L_CURSOR, 0, 8); - _vm->setHotspot(kHSExitUfo, 421, 215, 501, 282, SF_EXIT_U_CURSOR, 0, 8); - _vm->setHotspot(kHSExitKissinBooth, 476, 284, 556, 345, SF_EXIT_R_CURSOR, 0, 8); - _vm->setHotspot(kHSExitDancefloor, 317, 455, 445, 600, SF_EXIT_D_CURSOR, 0, 8); - _vm->setHotspot(kHSExitShoe, 455, 346, 549, 417, SF_EXIT_D_CURSOR, 0, 8); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 9; -} - -void Scene40::run() { - _vm->queueInsertDeviceIcon(); - _vm->endSceneInit(); - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) - _vm->playSound(0x1094B, true); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitCave: - if (_vm->_gnapActionStatus < 0) { - _vm->_newSceneNum = 39; - _vm->_sceneDone = true; - } - break; - - case kHSExitToyStand: - if (_vm->_gnapActionStatus < 0) { - _vm->_newSceneNum = 41; - _vm->_sceneDone = true; - } - break; - - case kHSExitBBQ: - if (_vm->_gnapActionStatus < 0) { - _vm->_newSceneNum = 42; - _vm->_sceneDone = true; - } - break; - - case kHSExitUfo: - if (_vm->_gnapActionStatus < 0) { - _vm->_newSceneNum = 43; - _vm->_sceneDone = true; - } - break; - - case kHSExitKissinBooth: - if (_vm->_gnapActionStatus < 0) { - _vm->_newSceneNum = 44; - _vm->_sceneDone = true; - } - break; - - case kHSExitDancefloor: - if (_vm->_gnapActionStatus < 0) { - _vm->_newSceneNum = 45; - _vm->_sceneDone = true; - } - break; - - case kHSExitShoe: - if (_vm->_gnapActionStatus < 0) { - _vm->_newSceneNum = 46; - _vm->_sceneDone = true; - } - break; - - default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) - _vm->_mouseClickState._left = false; - break; - - } - - updateAnimations(); - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene40::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - if (gameSys.getAnimationStatus(0) == 2) { - gameSys.setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus) - _vm->_gnapActionStatus = -1; - else - _vm->_sceneDone = true; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene40.h b/engines/gnap/scenes/scene40.h deleted file mode 100644 index f4f10103df..0000000000 --- a/engines/gnap/scenes/scene40.h +++ /dev/null @@ -1,46 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE40_H -#define GNAP_SCENE40_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene40: public Scene { -public: - Scene40(GnapEngine *vm); - ~Scene40() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE40_H diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp deleted file mode 100644 index 605dff0abe..0000000000 --- a/engines/gnap/scenes/scene41.cpp +++ /dev/null @@ -1,589 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene41.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitCave = 1, - kHSExit = 2, - kHSExitBBQ = 3, - kHSToyVendor = 4, - kHSKid = 5, - kHSToyUfo = 6, - kHSDevice = 7, - kHSWalkArea1 = 8 -}; - -enum { - kHSUfoExitLeft = 1, - kHSUfoExitRight = 2, - kHSUfoDevice = 3, - kHSUfoWalkArea1 = 4 -}; - -enum { - kASLeaveScene = 0, - kASUseQuarterWithToyVendor = 1, - kASTalkToyVendor = 2, - kASUseGumWithToyUfo = 3, - kASUseChickenBucketWithKid = 4, - kASGrabKid = 5, - kASGiveBackToyUfo = 6, - kASToyUfoLeaveScene = 7, - kASToyUfoRefresh = 8, - kASUfoGumAttached = 9 -}; - -Scene41::Scene41(GnapEngine *vm) : Scene(vm) { - _currKidSequenceId = -1; - _nextKidSequenceId = -1; - _currToyVendorSequenceId = -1; - _nextToyVendorSequenceId = -1; -} - -int Scene41::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - gameSys.setAnimation(0, 0, 2); - return 0x129; -} - -void Scene41::updateHotspots() { - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 500, SF_EXIT_L_CURSOR | SF_DISABLED); - _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 500, SF_EXIT_R_CURSOR); - _vm->setHotspot(kHSUfoWalkArea1, 0, 0, 800, 470, SF_DISABLED); - _vm->setDeviceHotspot(kHSUfoDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 5; - } else { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitCave, 150, 590, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExit, 0, 100, 10, 599, SF_EXIT_L_CURSOR | SF_DISABLED, 0, 8); - _vm->setHotspot(kHSExitBBQ, 790, 100, 799, 599, SF_EXIT_R_CURSOR | SF_WALKABLE, 10, 8); - _vm->setHotspot(kHSToyVendor, 320, 150, 430, 310, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSKid, 615, 340, 710, 460, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSToyUfo, 0, 0, 0, 0, SF_GRAB_CURSOR); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 470); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 9; - } -} - -void Scene41::run() { - GameSys gameSys = *_vm->_gameSys; - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoX = 770; - if (_vm->_toyUfoY < 0 || _vm->_toyUfoY > 300) - _vm->_toyUfoY = 150; - if (!_vm->_timers[9]) - _vm->_gnapActionStatus = kASGiveBackToyUfo; - } else { - if (!_vm->isFlag(kGFUnk16) && !_vm->isFlag(kGFJointTaken) && !_vm->isFlag(kGFUnk18) && !_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->toyUfoSetStatus(kGFUnk16); - _vm->_toyUfoX = 600; - _vm->_toyUfoY = 200; - } - - _vm->_toyUfoId = 0; - _vm->_toyUfoActionStatus = -1; - _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - - gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); - gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - gameSys.insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) - _currKidSequenceId = 0x11B; - else - _currKidSequenceId = 0x11D; - - _nextKidSequenceId = -1; - - gameSys.setAnimation(_currKidSequenceId, 1, 4); - gameSys.insertSequence(_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - _currToyVendorSequenceId = 0x118; - _nextToyVendorSequenceId = -1; - - gameSys.setAnimation(0x118, 1, 3); - gameSys.insertSequence(_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_gnapSequenceId = 0x120; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapX = 7; - _vm->_gnapY = 7; - _vm->_gnapId = 140; - gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->initPlatypusPos(8, 10, kDirBottomLeft); - _vm->endSceneInit(); - } else if (_vm->_prevSceneNum == 45) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-2, 8, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - } else if (_vm->_prevSceneNum == 42) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); - } else { - _vm->initGnapPos(5, 8, kDirBottomRight); - _vm->initPlatypusPos(6, 8, kDirBottomLeft); - _vm->endSceneInit(); - } - - _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_timers[5] = _vm->getRandom(30) + 20; - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) - _vm->playSound(0x1094B, true); - - if (!_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_hotspots[kHSToyUfo]._x1 = _vm->_toyUfoX - 25; - _vm->_hotspots[kHSToyUfo]._y1 = _vm->_toyUfoY - 20; - _vm->_hotspots[kHSToyUfo]._x2 = _vm->_toyUfoX + 25; - _vm->_hotspots[kHSToyUfo]._y2 = _vm->_toyUfoY + 20; - } - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - switch (_vm->_sceneClickedHotspot) { - case kHSUfoExitLeft: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; - _vm->_newSceneNum = 45; - _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); - } - break; - - case kHSUfoExitRight: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; - _vm->_newSceneNum = 42; - _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); - } - break; - - case kHSUfoDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_timers[5] = _vm->getRandom(30) + 20; - break; - } - } else { - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_timers[5] = _vm->getRandom(30) + 20; - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitCave: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitCave].x, _vm->_hotspotsWalkPos[kHSExitCave].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->_newSceneNum = 40; - break; - - case kHSExit: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExit].x, -1, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExit].x, -1, -1, 0x107CF, 1); - _vm->_newSceneNum = 45; - break; - - case kHSExitBBQ: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, -1, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, -1, -1, 0x107CD, 1); - _vm->_newSceneNum = 42; - break; - - case kHSToyVendor: - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnapActionStatus = kASUseQuarterWithToyVendor; - _vm->gnapWalkTo(4, 7, 0, 0x107BB, 9); - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 7, 5, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(5, 0); - break; - case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkToyVendor; - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSKid: - if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { - _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASUseChickenBucketWithKid; - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 7, 8, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 0); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapActionStatus = kASGrabKid; - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSToyUfo: - if (_vm->_grabCursorSpriteIndex == kItemGum) { - _vm->playGnapPullOutDevice(9, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kASUseGumWithToyUfo; - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - } - } - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - if (!_vm->_timers[9] && _vm->_gnapActionStatus < 0) { - _vm->_gnapActionStatus = kASGiveBackToyUfo; - if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x122) { - gameSys.insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x123; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x123, _vm->_gnapId, 0); - } - } - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->_mouseClickState._left = false; - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - int sequenceId; - if (_vm->_leftClickMouseX >= 400) { - if (_vm->_gnapSequenceId == 0x11F || _vm->_gnapSequenceId == 0x120 || _vm->_gnapSequenceId == 0x123 || _vm->_gnapSequenceId == 0x126) - sequenceId = 0x120; - else if (_vm->_leftClickMouseX - _vm->_toyUfoX >= 400) - sequenceId = 0x126; - else - sequenceId = 0x123; - } else { - if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x125 || _vm->_gnapSequenceId == 0x122) - sequenceId = 0x122; - else if (_vm->_toyUfoX - _vm->_leftClickMouseX >= 400) - sequenceId = 0x125; - else - sequenceId = 0x121; - } - gameSys.insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = sequenceId; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(sequenceId, _vm->_gnapId, 0); - _vm->_toyUfoActionStatus = kASToyUfoRefresh; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - } - - updateAnimations(); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { - switch (_vm->getRandom(3)) { - case 0: - _nextToyVendorSequenceId = 0x113; - break; - case 1: - _nextToyVendorSequenceId = 0x117; - break; - case 2: - _nextToyVendorSequenceId = 0x119; - break; - } - if (_nextToyVendorSequenceId == _currToyVendorSequenceId) - _nextToyVendorSequenceId = -1; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { - if (_vm->isFlag(kGFGnapControlsToyUFO)) - _nextKidSequenceId = 0x11B; - else if (_vm->getRandom(3) != 0) - _nextKidSequenceId = 0x11D; - else - _nextKidSequenceId = 0x11E; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_timers[5] = _vm->getRandom(30) + 20; - } - _vm->gameUpdateTick(); - } -} - -void Scene41::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - gameSys.setAnimation(0, 0, 0); - _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; - break; - case kASUseQuarterWithToyVendor: - gameSys.setAnimation(0, 0, 0); - _nextToyVendorSequenceId = 0x114; - _vm->_gnapActionStatus = -1; - break; - case kASTalkToyVendor: - gameSys.setAnimation(0, 0, 0); - _nextToyVendorSequenceId = 0x116; - _vm->_gnapActionStatus = -1; - break; - case kASUseGumWithToyUfo: - gameSys.setAnimation(0, 0, 0); - _vm->playGnapUseDevice(9, 0); - _vm->_gnapActionStatus = -1; - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemGum); - _vm->_toyUfoActionStatus = kASUfoGumAttached; - break; - case kASUseChickenBucketWithKid: - if (gameSys.getAnimationStatus(4) == 2) { - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x11F; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x11F, _vm->_gnapId, 0); - _nextKidSequenceId = 0x11A; - gameSys.insertSequence(0x11A, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextKidSequenceId, 1, 4); - _currKidSequenceId = _nextKidSequenceId; - _nextKidSequenceId = 0x11B; - _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnapActionStatus = -1; - _vm->setFlag(kGFGnapControlsToyUFO); - updateHotspots(); - _vm->_timers[9] = 600; - } - break; - case kASGrabKid: - if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x110; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x110, _vm->_gnapId, 0); - _nextToyVendorSequenceId = 0x111; - gameSys.insertSequence(0x111, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); - _currToyVendorSequenceId = _nextToyVendorSequenceId; - _nextToyVendorSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(100) + 100; - _nextKidSequenceId = 0x10F; - gameSys.insertSequence(0x10F, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextKidSequenceId, 1, 4); - _currKidSequenceId = _nextKidSequenceId; - _nextKidSequenceId = -1; - _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnapActionStatus = -1; - } - break; - case kASGiveBackToyUfo: - if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x124, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x124; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x124, _vm->_gnapId, 0); - _nextToyVendorSequenceId = 0x112; - gameSys.insertSequence(0x112, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); - _currToyVendorSequenceId = _nextToyVendorSequenceId; - _nextToyVendorSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(100) + 100; - _nextKidSequenceId = 0x11C; - gameSys.insertSequence(0x11C, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextKidSequenceId, 1, 4); - _currKidSequenceId = _nextKidSequenceId; - _nextKidSequenceId = -1; - _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnapActionStatus = -1; - _vm->clearFlag(kGFGnapControlsToyUFO); - updateHotspots(); - } - break; - } - } - - if (gameSys.getAnimationStatus(2) == 2) { - switch (_vm->_toyUfoActionStatus) { - case kASToyUfoLeaveScene: - _vm->_sceneDone = true; - break; - case kASUfoGumAttached: - _vm->_toyUfoNextSequenceId = 0x873; - gameSys.insertSequence(0x10873, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, - kSeqSyncWait, 0, _vm->_toyUfoX - 365, _vm->_toyUfoY - 128); - _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); - _vm->toyUfoSetStatus(kGFJointTaken); - break; - default: - _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, - kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - ++_vm->_toyUfoId; - gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); - break; - } - _vm->_toyUfoActionStatus = -1; - } - - if (gameSys.getAnimationStatus(3) == 2 && _nextToyVendorSequenceId != -1) { - gameSys.insertSequence(_nextToyVendorSequenceId, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); - _currToyVendorSequenceId = _nextToyVendorSequenceId; - _nextToyVendorSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(100) + 100; - } - - if (gameSys.getAnimationStatus(4) == 2 && _nextKidSequenceId != -1) { - gameSys.insertSequence(_nextKidSequenceId, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextKidSequenceId, 1, 4); - _currKidSequenceId = _nextKidSequenceId; - _nextKidSequenceId = -1; - _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_currKidSequenceId == 0x11E) { - _vm->_toyUfoActionStatus = kASToyUfoRefresh; - _vm->toyUfoFlyTo(_vm->getRandom(300) + 500, _vm->getRandom(225) + 75, 0, 799, 0, 300, 2); - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene41.h b/engines/gnap/scenes/scene41.h deleted file mode 100644 index 0b0cd4ec40..0000000000 --- a/engines/gnap/scenes/scene41.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE41_H -#define GNAP_SCENE41_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene41: public Scene { -public: - Scene41(GnapEngine *vm); - ~Scene41() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _currKidSequenceId; - int _nextKidSequenceId; - int _currToyVendorSequenceId; - int _nextToyVendorSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE41_H diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp deleted file mode 100644 index 8bab50260b..0000000000 --- a/engines/gnap/scenes/scene42.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene42.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitUfoParty = 1, - kHSExitToyStand = 2, - kHSExitUfo = 3, - kHSBBQVendor = 4, - kHSChickenLeg = 5, - kHSDevice = 6, - kHSWalkArea1 = 7, - kHSWalkArea2 = 8 -}; - -enum { - kHSUfoExitLeft = 1, - kHSUfoExitRight = 2, - kHSUfoHotSauce = 3, - kHSUfoDevice = 4 -}; - -enum { - kASLeaveScene = 0, - kASTalkBBQVendor = 1, - kASUseQuarterWithBBQVendor = 2, - kASUseQuarterWithBBQVendorDone = 3, - kASGrabChickenLeg = 4, - kASToyUfoLeaveScene = 5, - kASToyUfoRefresh = 6, - kASToyUfoPickUpHotSauce = 7 -}; - -Scene42::Scene42(GnapEngine *vm) : Scene(vm) { - _currBBQVendorSequenceId = -1; - _nextBBQVendorSequenceId = -1; -} - -int Scene42::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - gameSys.setAnimation(0, 0, 2); - if (_vm->isFlag(kGFPictureTaken) || (_vm->isFlag(kGFUnk18) && _vm->isFlag(kGFUnk23))) - return 0x153; - return 0x152; -} - -void Scene42::updateHotspots() { - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - _vm->setHotspot(kHSUfoHotSauce, 335, 110, 440, 175, SF_DISABLED); - _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - if ((_vm->isFlag(kGFPictureTaken) || _vm->isFlag(kGFUnk18)) && _vm->isFlag(kGFUnk23) && !_vm->isFlag(kGFUnk24)) - _vm->_hotspots[kHSUfoHotSauce]._flags = SF_GRAB_CURSOR; - _vm->_hotspotsCount = 5; - } else { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitUfoParty, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitToyStand, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - _vm->setHotspot(kHSExitUfo, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - _vm->setHotspot(kHSBBQVendor, 410, 200, 520, 365, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 4, 8); - _vm->setHotspot(kHSChickenLeg, 530, 340, 620, 430, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 8, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 445); - _vm->setHotspot(kHSWalkArea2, 240, 0, 550, 495); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 9; - } -} - -void Scene42::run() { - GameSys gameSys = *_vm->_gameSys; - - _vm->queueInsertDeviceIcon(); - - _currBBQVendorSequenceId = 0x14A; - _nextBBQVendorSequenceId = -1; - - gameSys.setAnimation(0x14A, 1, 2); - gameSys.insertSequence(_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoId = 0; - _vm->_toyUfoActionStatus = -1; - if (_vm->_prevSceneNum == 43 && _vm->isFlag(kGFUnk18)) { - _vm->_toyUfoSequenceId = 0x872; - _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_toyUfoX = 317; - _vm->_toyUfoY = 61; - _vm->toyUfoSetStatus(kGFJointTaken); - _vm->setFlag(kGFPictureTaken); - _vm->_timers[9] = 600; - } else { - _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - if (_vm->_prevSceneNum == 41) - _vm->_toyUfoX = 30; - else - _vm->_toyUfoX = 770; - gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - } - gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); - _vm->endSceneInit(); - if (_vm->_toyUfoSequenceId == 0x872) - _vm->setGrabCursorSprite(-1); - } else if (_vm->_prevSceneNum == 41) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 9, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - } else if (_vm->_prevSceneNum == 43) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); - } else { - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - } - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) - _vm->playSound(0x1094B, true); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - switch (_vm->_sceneClickedHotspot) { - case kHSUfoExitLeft: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; - _vm->_newSceneNum = 41; - _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); - } - break; - - case kHSUfoExitRight: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = kASToyUfoLeaveScene; - _vm->_newSceneNum = 43; - _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); - } - break; - - case kHSUfoHotSauce: - if (_vm->isFlag(kGFJointTaken)) { - _vm->_toyUfoActionStatus = kASToyUfoPickUpHotSauce; - _vm->toyUfoFlyTo(384, 77, 0, 799, 0, 300, 3); - _vm->_timers[9] = 600; - } else { - _vm->_toyUfoActionStatus = kASToyUfoRefresh; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); - } - break; - - case kHSUfoDevice: - _vm->runMenu(); - updateHotspots(); - break; - } - } else { - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(20) + 30; - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitUfoParty: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_platX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); - _vm->_newSceneNum = 40; - break; - - case kHSExitToyStand: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStand].x, _vm->_gnapY, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitToyStand].x, _vm->_hotspotsWalkPos[kHSExitToyStand].y, -1, 0x107CF, 1); - _vm->_newSceneNum = 41; - break; - - case kHSExitUfo: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_gnapY, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kASLeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_hotspotsWalkPos[kHSExitUfo].y, -1, 0x107CD, 1); - _vm->_newSceneNum = 43; - break; - - case kHSBBQVendor: - if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBBQVendor].x, _vm->_hotspotsWalkPos[kHSBBQVendor].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kASUseQuarterWithBBQVendor; - if (_vm->_platY < 9) - _vm->platypusWalkTo(_vm->_platX, 9, -1, -1, 1); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSBBQVendor].x, _vm->_hotspotsWalkPos[kHSBBQVendor].y, _vm->_hotspotsWalkPos[kHSBBQVendor].x + 1, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHSBBQVendor].x - 1, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSBBQVendor].x, _vm->_hotspotsWalkPos[kHSBBQVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kASTalkBBQVendor; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSChickenLeg: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSChickenLeg].x, _vm->_hotspotsWalkPos[kHSChickenLeg].y, _vm->_hotspotsWalkPos[kHSChickenLeg].x - 1, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHSChickenLeg].x - 1, 0); - break; - case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSChickenLeg].x, _vm->_hotspotsWalkPos[kHSChickenLeg].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kASGrabChickenLeg; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - } - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->_mouseClickState._left = false; - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoActionStatus = kASToyUfoRefresh; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - } - - updateAnimations(); - - _vm->toyUfoCheckTimer(); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextBBQVendorSequenceId == -1) { - switch (_vm->getRandom(8)) { - case 0: - _nextBBQVendorSequenceId = 0x14C; - break; - case 1: - case 2: - _nextBBQVendorSequenceId = 0x149; - break; - case 3: - case 4: - case 5: - case 6: - _nextBBQVendorSequenceId = 0x14D; - break; - case 7: - _nextBBQVendorSequenceId = 0x14A; - break; - } - if (_nextBBQVendorSequenceId == _currBBQVendorSequenceId && _nextBBQVendorSequenceId != 0x14D) - _nextBBQVendorSequenceId = -1; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(20) + 30; - } - - _vm->gameUpdateTick(); - } -} - -void Scene42::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { - case kASLeaveScene: - gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; - _vm->_sceneDone = true; - break; - case kASTalkBBQVendor: - gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; - _nextBBQVendorSequenceId = 0x14B; - break; - case kASUseQuarterWithBBQVendor: - case kASGrabChickenLeg: - if (gameSys.getAnimationStatus(2) == 2) { - int sequenceId; - if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) { - _vm->invRemove(kItemDiceQuarterHole); - _vm->invAdd(kItemChickenBucket); - _vm->setGrabCursorSprite(-1); - sequenceId = 0x150; - _nextBBQVendorSequenceId = 0x148; - } else if (_vm->isFlag(kGFUnk27)) { - if (_vm->isFlag(kGFUnk28)) { - sequenceId = 0x7B7; - _nextBBQVendorSequenceId = 0x145; - } else { - _vm->setFlag(kGFUnk28); - sequenceId = 0x14F; - _nextBBQVendorSequenceId = 0x147; - } - } else { - _vm->setFlag(kGFUnk27); - sequenceId = 0x14E; - _nextBBQVendorSequenceId = 0x146; - } - if (sequenceId == 0x7B7) { - gameSys.insertSequence(0x107B7, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), - 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapSequenceDatNum = 1; - } else { - gameSys.insertSequence(sequenceId, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - } - _vm->_gnapSequenceId = sequenceId; - gameSys.setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); - if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) - _vm->_gnapActionStatus = kASUseQuarterWithBBQVendorDone; - else - _vm->_gnapActionStatus = -1; - gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); - _currBBQVendorSequenceId = _nextBBQVendorSequenceId; - if (_nextBBQVendorSequenceId == 0x145) - _nextBBQVendorSequenceId = 0x14A; - else - _nextBBQVendorSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(20) + 30; - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = _vm->getRandom(50) + 200; - } - break; - case kASUseQuarterWithBBQVendorDone: - gameSys.setAnimation(0, 0, 0); - _vm->setGrabCursorSprite(kItemChickenBucket); - _vm->_gnapActionStatus = -1; - break; - default: - gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; - break; - } - } - - if (gameSys.getAnimationStatus(2) == 2 && _nextBBQVendorSequenceId != -1) { - gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); - _currBBQVendorSequenceId = _nextBBQVendorSequenceId; - _nextBBQVendorSequenceId = -1; - _vm->_timers[4] = _vm->getRandom(20) + 30; - } - - if (gameSys.getAnimationStatus(3) == 2) { - switch (_vm->_toyUfoActionStatus) { - case kASToyUfoLeaveScene: - _vm->_sceneDone = true; - break; - case kASToyUfoPickUpHotSauce: - gameSys.insertSequence(0x10870, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); - _vm->setFlag(kGFUnk24); - updateHotspots(); - _vm->toyUfoSetStatus(kGFGroceryStoreHatTaken); - _vm->_toyUfoSequenceId = 0x870; - gameSys.setAnimation(0x10870, _vm->_toyUfoId, 3); - _vm->_toyUfoActionStatus = -1; - _vm->_toyUfoX = 0x181; - _vm->_toyUfoY = 53; - break; - default: - if (_vm->_toyUfoSequenceId == 0x872) { - _vm->hideCursor(); - _vm->addFullScreenSprite(0x13E, 255); - gameSys.setAnimation(0x151, 256, 0); - gameSys.insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - } - _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, 3); - gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, - _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, - kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - _vm->_toyUfoId = (_vm->_toyUfoId + 1) % 10; - break; - } - _vm->_toyUfoActionStatus = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene42.h b/engines/gnap/scenes/scene42.h deleted file mode 100644 index 8175e98110..0000000000 --- a/engines/gnap/scenes/scene42.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE42_H -#define GNAP_SCENE42_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene42: public Scene { -public: - Scene42(GnapEngine *vm); - ~Scene42() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _currBBQVendorSequenceId; - int _nextBBQVendorSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE42_H diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp deleted file mode 100644 index a3119bfb1e..0000000000 --- a/engines/gnap/scenes/scene43.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene43.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSDevice = 1, - kHSExitUfoParty = 2, - kHSExitBBQ = 3, - kHSExitKissinBooth = 4, - kHSTwoHeadedGuy = 5, - kHSKey = 6, - kHSUfo = 7, - kHSWalkArea1 = 8, - kHSWalkArea2 = 9 -}; - -enum { - kHSUfoExitLeft = 1, - kHSUfoExitRight = 2, - kHSUfoKey = 3, - kHSUfoBucket = 4, - kHSUfoDevice = 5 -}; - -Scene43::Scene43(GnapEngine *vm) : Scene(vm) { - _currTwoHeadedGuySequenceId = -1; - _nextTwoHeadedGuySequenceId = -1; -} - -int Scene43::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - gameSys.setAnimation(0, 0, 2); - return 0x13F; -} - -void Scene43::updateHotspots() { - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - _vm->setHotspot(kHSUfoKey, 140, 170, 185, 260, SF_GRAB_CURSOR); - _vm->setHotspot(kHSUfoBucket, 475, 290, 545, 365, SF_DISABLED); - _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_hotspots[kHSUfoBucket]._flags = SF_GRAB_CURSOR; - // NOTE Bug in the original. Key hotspot wasn't disabled. - if (_vm->isFlag(kGFUnk14)) - _vm->_hotspots[kHSUfoKey]._flags = SF_DISABLED; - _vm->_hotspotsCount = 6; - } else { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitBBQ, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - _vm->setHotspot(kHSExitKissinBooth, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - _vm->setHotspot(kHSTwoHeadedGuy, 470, 240, 700, 470, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSKey, 140, 170, 185, 260, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSUfo, 110, 0, 690, 350, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 445); - _vm->setHotspot(kHSWalkArea2, 465, 0, 800, 493); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk14)) - _vm->_hotspots[kHSKey]._flags = SF_DISABLED; - _vm->_hotspotsCount = 10; - } -} - -void Scene43::run() { - GameSys gameSys = *_vm->_gameSys; - - _vm->queueInsertDeviceIcon(); - - if (!_vm->isFlag(kGFUnk14)) - gameSys.insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); - - _currTwoHeadedGuySequenceId = 0x13C; - _nextTwoHeadedGuySequenceId = -1; - - gameSys.setAnimation(0x13C, 1, 2); - gameSys.insertSequence(_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoId = 0; - _vm->_toyUfoActionStatus = -1; - _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - if (_vm->_prevSceneNum == 42) - _vm->_toyUfoX = 30; - else - _vm->_toyUfoX = 770; - gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); - gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->endSceneInit(); - } else { - switch (_vm->_prevSceneNum) { - case 42: - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 9, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - break; - case 44: - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); - break; - case 54: - _vm->initGnapPos(4, 7, kDirBottomLeft); - _vm->initPlatypusPos(11, 8, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); - break; - default: - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - break; - } - } - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) - _vm->playSound(0x1094B, true); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - switch (_vm->_sceneClickedHotspot) { - case kHSUfoDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(100) + 100; - break; - - case kHSUfoExitLeft: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 4; - _vm->_newSceneNum = 42; - _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); - } - break; - - case kHSUfoExitRight: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 4; - _vm->_newSceneNum = 44; - _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); - } - break; - - case kHSUfoKey: - if (_vm->isFlag(kGFJointTaken)) { - _vm->_toyUfoActionStatus = 6; - _vm->toyUfoFlyTo(163, 145, 0, 799, 0, 300, 3); - } else { - _vm->_toyUfoActionStatus = 5; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); - } - break; - - case kHSUfoBucket: - _vm->_toyUfoActionStatus = 7; - _vm->toyUfoFlyTo(497, 143, 0, 799, 0, 300, 3); - _vm->_timers[9] = 600; - break; - } - } else { - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(100) + 100; - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitUfoParty: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfoParty].x, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitUfoParty].x, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, -1, 0x107C7, 1); - _vm->_newSceneNum = 40; - break; - - case kHSExitBBQ: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, _vm->_gnapY, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitBBQ].x, _vm->_hotspotsWalkPos[kHSExitBBQ].y, -1, 0x107CF, 1); - _vm->_newSceneNum = 42; - break; - - case kHSExitKissinBooth: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_gnapY, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_hotspotsWalkPos[kHSExitKissinBooth].y, -1, 0x107CD, 1); - _vm->_newSceneNum = 44; - break; - - case kHSTwoHeadedGuy: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 8, 7, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 2; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSKey: - case kHSUfo: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 7, 2, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(0, 0); - break; - case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(3, 7, 0, 67515, 1); - _vm->_gnapActionStatus = 1; - break; - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - } - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->_mouseClickState._left = false; - if (_vm->isFlag(kGFGnapControlsToyUFO) && (_vm->_toyUfoActionStatus == 5 || _vm->_toyUfoActionStatus == -1)) { - _vm->_toyUfoActionStatus = 5; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - } - - updateAnimations(); - - _vm->toyUfoCheckTimer(); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { - _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { - switch (_vm->getRandom(5)) { - case 0: - _nextTwoHeadedGuySequenceId = 0x13C; - break; - case 1: - _nextTwoHeadedGuySequenceId = 0x134; - break; - case 2: - _nextTwoHeadedGuySequenceId = 0x135; - break; - case 3: - _nextTwoHeadedGuySequenceId = 0x136; - break; - case 4: - _nextTwoHeadedGuySequenceId = 0x13A; - break; - } - if (_nextTwoHeadedGuySequenceId == _currTwoHeadedGuySequenceId) - _nextTwoHeadedGuySequenceId = -1; - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(100) + 100; - } - - _vm->gameUpdateTick(); - } - - if (_vm->_newSceneNum == 54) - _vm->clearFlag(kGFGnapControlsToyUFO); -} - -void Scene43::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { - case 0: - gameSys.setAnimation(0, 0, 0); - _vm->_sceneDone = true; - break; - - case 1: - if (gameSys.getAnimationStatus(2) == 2) { - _vm->_timers[2] = _vm->getRandom(30) + 20; - _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x13D; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x13D, _vm->_gnapId, 0); - _nextTwoHeadedGuySequenceId = 0x13B; - gameSys.insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); - _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; - _nextTwoHeadedGuySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_gnapActionStatus = -1; - } - break; - - default: - gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; - break; - } - } - - if (gameSys.getAnimationStatus(2) == 2) { - if (_currTwoHeadedGuySequenceId == 0x13A) { - if (_vm->isFlag(kGFGroceryStoreHatTaken)) { - _nextTwoHeadedGuySequenceId = 0x13E; - _vm->stopSound(0x108F6); - } else if (_vm->getRandom(2) != 0) { - _nextTwoHeadedGuySequenceId = 0x137; - } else { - _nextTwoHeadedGuySequenceId = 0x138; - } - } else if (_currTwoHeadedGuySequenceId == 0x13E) { - _vm->_sceneDone = true; - _vm->_newSceneNum = 54; - } - if (_nextTwoHeadedGuySequenceId != -1) { - gameSys.insertSequence(_nextTwoHeadedGuySequenceId, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); - _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; - _nextTwoHeadedGuySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(100) + 100; - } - } - - if (gameSys.getAnimationStatus(3) == 2) { - switch (_vm->_toyUfoActionStatus) { - case 4: - _vm->_sceneDone = true; - _vm->_toyUfoActionStatus = -1; - break; - case 6: - gameSys.insertSequence(0x10871, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); - gameSys.removeSequence(0x1086F, 1, true); - _vm->setFlag(kGFUnk14); - updateHotspots(); - _vm->toyUfoSetStatus(kGFUnk18); - _vm->_toyUfoSequenceId = 0x871; - gameSys.setAnimation(0x10871, _vm->_toyUfoId, 3); - _vm->_toyUfoActionStatus = -1; - _vm->_toyUfoX = 96; - _vm->_toyUfoY = 131; - break; - case 7: - gameSys.insertSequence(0x10874, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); - _vm->_toyUfoSequenceId = 0x874; - gameSys.setAnimation(0x10874, _vm->_toyUfoId, 3); - _vm->_toyUfoActionStatus = 8; - _vm->setFlag(kGFJointTaken); - _vm->_gnapActionStatus = 3; - break; - case 8: - _nextTwoHeadedGuySequenceId = 0x13A; - _vm->_toyUfoX = 514; - _vm->_toyUfoY = 125; - _vm->toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); - _vm->_toyUfoActionStatus = 9; - break; - case 9: - // Nothing - break; - default: - _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, - _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, - kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - ++_vm->_toyUfoId; - gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); - _vm->_toyUfoActionStatus = -1; - break; - } - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene43.h b/engines/gnap/scenes/scene43.h deleted file mode 100644 index fdf6d6e4c2..0000000000 --- a/engines/gnap/scenes/scene43.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE43_H -#define GNAP_SCENE43_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene43: public Scene { -public: - Scene43(GnapEngine *vm); - ~Scene43() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _currTwoHeadedGuySequenceId; - int _nextTwoHeadedGuySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE43_H diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp deleted file mode 100644 index 2e66df7991..0000000000 --- a/engines/gnap/scenes/scene44.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene44.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitUfoParty = 1, - kHSExitUfo = 2, - kHSExitShow = 3, - kHSKissingLady = 4, - kHSSpring = 5, - kHSSpringGuy = 6, - kHSDevice = 7, - kHSWalkArea1 = 8, - kHSWalkArea2 = 9 -}; - -enum { - kHSUfoExitLeft = 1, - kHSUfoExitRight = 2, - kHSUfoDevice = 3 -}; - -Scene44::Scene44(GnapEngine *vm) : Scene(vm) { - _nextSpringGuySequenceId = -1; - _nextKissingLadySequenceId = -1; - _currSpringGuySequenceId = -1; - _currKissingLadySequenceId = -1; -} - -int Scene44::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - gameSys.setAnimation(0, 0, 2); - gameSys.setAnimation(0, 0, 3); - return 0xFF; -} - -void Scene44::updateHotspots() { - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - _vm->_hotspotsCount = 4; - } else { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitUfo, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - _vm->setHotspot(kHSExitShow, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - _vm->setHotspot(kHSKissingLady, 300, 160, 400, 315, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 5, 7); - _vm->setHotspot(kHSSpring, 580, 310, 635, 375, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSSpringGuy, 610, 375, 690, 515, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 7, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 445); - _vm->setHotspot(kHSWalkArea2, 617, 0, 800, 600); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk13)) - _vm->_hotspots[kHSKissingLady]._flags = SF_DISABLED; - if (_vm->isFlag(kGFSpringTaken)) - _vm->_hotspots[kHSSpring]._flags = SF_DISABLED; - _vm->_hotspotsCount = 10; - } -} - -void Scene44::run() { - GameSys gameSys = *_vm->_gameSys; - - _vm->queueInsertDeviceIcon(); - - gameSys.insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); - gameSys.insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFSpringTaken)) - _currSpringGuySequenceId = 0xF8; - else - _currSpringGuySequenceId = 0xF9; - - _nextSpringGuySequenceId = -1; - gameSys.setAnimation(_currSpringGuySequenceId, 1, 4); - gameSys.insertSequence(_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFUnk13)) { - if (_vm->_prevSceneNum != 50 || _vm->_sceneSavegameLoaded) { - _currKissingLadySequenceId = 0xF6; - _nextKissingLadySequenceId = -1; - } else { - _vm->setGrabCursorSprite(kItemGum); - _currKissingLadySequenceId = 0xF5; - _nextKissingLadySequenceId = 0xF6; - gameSys.setAnimation(0xF5, 1, 2); - } - } else { - _currKissingLadySequenceId = 0xEC; - _nextKissingLadySequenceId = -1; - gameSys.setAnimation(0xEC, 1, 2); - } - - gameSys.insertSequence(_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoId = 0; - _vm->_toyUfoActionStatus = -1; - _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - if (_vm->_prevSceneNum == 43) - _vm->_toyUfoX = 30; - else - _vm->_toyUfoX = 770; - gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); - gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->endSceneInit(); - } else { - switch (_vm->_prevSceneNum) { - case 43: - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 7, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - break; - case 46: - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 8, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(7, 8, -1, 0x107D2, 1); - break; - case 50: - _vm->initGnapPos(4, 8, kDirBottomRight); - if (_vm->_sceneSavegameLoaded) { - _vm->initPlatypusPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); - } else if (!_vm->isFlag(kGFUnk13)) { - _vm->_timers[0] = 50; - _vm->_timers[1] = 20; - _vm->_platX = 5; - _vm->_platY = 8; - _vm->_platypusSequenceId = 0xFD; - _vm->_platypusFacing = kDirNone; - _vm->_platypusId = 160; - _vm->_platypusSequenceDatNum = 0; - gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); - } - _vm->endSceneInit(); - break; - default: - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); - break; - } - } - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) - _vm->playSound(0x1094B, true); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - switch (_vm->_sceneClickedHotspot) { - case kHSUfoExitLeft: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 6; - _vm->_newSceneNum = 43; - _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); - } - break; - - case kHSUfoExitRight: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 6; - _vm->_newSceneNum = 46; - _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); - } - break; - - case kHSUfoDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(20) + 20; - break; - } - } else if (_vm->_sceneClickedHotspot <= 9) { - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(20) + 20; - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitUfoParty: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfoParty].x, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; - _vm->_newSceneNum = 40; - break; - - case kHSExitUfo: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_gnapY, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitUfo].x, _vm->_platY, -1, 0x107CF, 1); - _vm->_newSceneNum = 43; - break; - - case kHSExitShow: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitShow].x, _vm->_hotspotsWalkPos[kHSExitShow].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; - _vm->_newSceneNum = 46; - break; - - case kHSKissingLady: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnapActionStatus = 2; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSKissingLady].x, _vm->_hotspotsWalkPos[kHSKissingLady].y, 0, -1, 9); - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHSKissingLady].x - 1, _vm->_hotspotsWalkPos[kHSKissingLady].y); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(4, 3); - break; - case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSKissingLady].x, _vm->_hotspotsWalkPos[kHSKissingLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 1; - break; - case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); - _vm->platypusWalkTo(6, 7, 1, 0x107D2, 1); - if (_vm->_gnapX == 7 && _vm->_gnapY == 7) - _vm->gnapWalkStep(); - _vm->playGnapIdle(5, 7); - _vm->_platypusActionStatus = 4; - break; - } - } - break; - - case kHSSpring: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSSpring].x, _vm->_hotspotsWalkPos[kHSSpring].y, 8, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 7); - break; - case GRAB_CURSOR: - _vm->playGnapPullOutDevice(8, 0); - _vm->playGnapUseDevice(8, 0); - _nextSpringGuySequenceId = 0xFB; - _vm->invAdd(kItemSpring); - _vm->setFlag(kGFSpringTaken); - updateHotspots(); - break; - case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSSpringGuy: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSSpringGuy].x, _vm->_hotspotsWalkPos[kHSSpringGuy].y, 8, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - if (_vm->isFlag(kGFSpringTaken)) - _vm->playGnapMoan1(8, 7); - else - _vm->playGnapScratchingHead(8, 7); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSSpringGuy].x, _vm->_hotspotsWalkPos[kHSSpringGuy].y, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSWalkArea1: - case kHSWalkArea2: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - - } - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->_mouseClickState._left = false; - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoActionStatus = 7; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - } - - updateAnimations(); - _vm->toyUfoCheckTimer(); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextKissingLadySequenceId == -1) { - switch (_vm->getRandom(20)) { - case 0: - _nextKissingLadySequenceId = 0xED; - break; - case 1: - _nextKissingLadySequenceId = 0xEE; - break; - case 2: - _nextKissingLadySequenceId = 0xF0; - break; - case 3: - _nextKissingLadySequenceId = 0xF3; - break; - case 4: - _nextKissingLadySequenceId = 0xF4; - break; - default: - _nextKissingLadySequenceId = 0xEC; - break; - } - if (_nextKissingLadySequenceId != 0xEC && _nextKissingLadySequenceId == _currKissingLadySequenceId) - _nextKissingLadySequenceId = -1; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSpringGuySequenceId == -1) { - if (_vm->getRandom(5) != 0) { - if (!_vm->isFlag(kGFSpringTaken)) - _nextSpringGuySequenceId = 0xF9; - } else { - if (_vm->isFlag(kGFSpringTaken)) - _nextSpringGuySequenceId = 0xF8; - else - _nextSpringGuySequenceId = 0xFA; - } - } - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - _vm->_timers[4] = _vm->getRandom(20) + 20; - } - - _vm->gameUpdateTick(); - } -} - -void Scene44::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - if (gameSys.getAnimationStatus(0) == 2) { - gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case 0: - _vm->_sceneDone = true; - break; - case 1: - _nextKissingLadySequenceId = 0xEF; - break; - case 2: - _nextKissingLadySequenceId = 0xF2; - break; - } - _vm->_gnapActionStatus = -1; - } - - if (gameSys.getAnimationStatus(1) == 2) { - gameSys.setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { - case 4: - if (gameSys.getAnimationStatus(2) == 2) { - gameSys.insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xFE; - _vm->_platypusSequenceDatNum = 0; - gameSys.setAnimation(0xFE, _vm->_platypusId, 1); - gameSys.removeSequence(_currKissingLadySequenceId, 1, true); - _vm->_platypusActionStatus = 5; - } - break; - case 5: - _vm->_sceneDone = true; - _vm->_newSceneNum = 50; - break; - default: - _vm->_platypusActionStatus = -1; - break; - } - } - - if (gameSys.getAnimationStatus(2) == 2) { - if (_nextKissingLadySequenceId == 0xF6) { - gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->initPlatypusPos(5, 8, kDirNone); - _currKissingLadySequenceId = _nextKissingLadySequenceId; - _nextKissingLadySequenceId = -1; - gameSys.setAnimation(0, 0, 2); - } else if (_nextKissingLadySequenceId != -1) { - gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextKissingLadySequenceId, 1, 2); - _currKissingLadySequenceId = _nextKissingLadySequenceId; - _nextKissingLadySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(20) + 20; - } - } - - if (gameSys.getAnimationStatus(4) == 2) { - if (_currSpringGuySequenceId == 0xFB) { - _vm->setGrabCursorSprite(kItemSpring); - _nextSpringGuySequenceId = 0xF8; - } - if (_nextSpringGuySequenceId != -1) { - gameSys.insertSequence(_nextSpringGuySequenceId, 1, _currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextSpringGuySequenceId, 1, 4); - _currSpringGuySequenceId = _nextSpringGuySequenceId; - _nextSpringGuySequenceId = -1; - _vm->_timers[5] = _vm->getRandom(20) + 20; - } - } - - if (gameSys.getAnimationStatus(3) == 2) { - switch (_vm->_toyUfoActionStatus) { - case 6: - _vm->_sceneDone = true; - break; - default: - _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, - _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, - kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - ++_vm->_toyUfoId; - gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); - break; - } - _vm->_toyUfoActionStatus = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene44.h b/engines/gnap/scenes/scene44.h deleted file mode 100644 index 3ba5438487..0000000000 --- a/engines/gnap/scenes/scene44.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE44_H -#define GNAP_SCENE44_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene44: public Scene { -public: - Scene44(GnapEngine *vm); - ~Scene44() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _nextSpringGuySequenceId; - int _nextKissingLadySequenceId; - int _currSpringGuySequenceId; - int _currKissingLadySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE44_H diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp deleted file mode 100644 index 95aac39065..0000000000 --- a/engines/gnap/scenes/scene45.cpp +++ /dev/null @@ -1,425 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene45.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitUfoParty = 1, - kHSExitShoe = 2, - kHSExitRight = 3, - kHSExitDiscoBall = 4, - kHSDiscoBall = 5, - kHSDevice = 6, - kHSWalkArea1 = 7 -}; - -enum { - kHSUfoExitLeft = 1, - kHSUfoExitRight = 2, - kHSUfoDevice = 3 -}; - -Scene45::Scene45(GnapEngine *vm) : Scene(vm) { - _currDancerSequenceId = -1; -} - -int Scene45::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - gameSys.setAnimation(0, 0, 2); - gameSys.setAnimation(0, 0, 3); - gameSys.setAnimation(0, 0, 4); - gameSys.setAnimation(0, 0, 5); - return _vm->isFlag(kGFUnk23) ? 0xA2 : 0xA1; -} - -void Scene45::updateHotspots() { - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - _vm->setHotspot(kHSUfoExitRight, 794, 0, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED); - _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - _vm->_hotspotsCount = 4; - } else { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitShoe, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - _vm->setHotspot(kHSExitRight, 794, 100, 799, 599, SF_EXIT_R_CURSOR | SF_DISABLED, 10, 8); - _vm->setHotspot(kHSExitDiscoBall, 200, 0, 600, 10, SF_DISABLED); - _vm->setHotspot(kHSDiscoBall, 370, 10, 470, 125, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 7); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 472); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk22)) { - _vm->_hotspots[kHSPlatypus]._flags = SF_DISABLED; - _vm->_hotspots[kHSExitUfoParty]._flags = SF_DISABLED; - _vm->_hotspots[kHSExitShoe]._flags = SF_DISABLED; - _vm->_hotspots[kHSExitRight]._flags = SF_DISABLED; - _vm->_hotspots[kHSExitDiscoBall]._flags = SF_EXIT_U_CURSOR; - } - if (_vm->isFlag(kGFUnk23) || _vm->isFlag(kGFUnk22)) - _vm->_hotspots[kHSDiscoBall]._flags = SF_DISABLED; - _vm->_hotspotsCount = 8; - } -} - -void Scene45::run() { - GameSys gameSys = *_vm->_gameSys; - - if (!_vm->isSoundPlaying(0x1094A)) - _vm->playSound(0x1094A, true); - - _vm->queueInsertDeviceIcon(); - - gameSys.insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(0x96, 1, 3); - gameSys.insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(0x99, 1, 4); - _currDancerSequenceId = 0x8F; - gameSys.setAnimation(_currDancerSequenceId, 1, 2); - gameSys.insertSequence(_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoId = 0; - _vm->_toyUfoActionStatus = -1; - _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - if (_vm->_prevSceneNum == 46) - _vm->_toyUfoX = 30; - else - _vm->_toyUfoX = 770; - gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 5); - gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->endSceneInit(); - } else if (_vm->isFlag(kGFUnk22)) { - _vm->_gnapSequenceId = 0x9E; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapId = 1; - gameSys.setAnimation(0x9E, 1, 0); - _vm->_gnapActionStatus = 1; - gameSys.insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->initPlatypusPos(4, 8, kDirNone); - _vm->endSceneInit(); - } else if (_vm->_prevSceneNum == 46) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 9, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); - } else if (_vm->_prevSceneNum == 41) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); - _vm->gnapWalkTo(10, 9, -1, 0x107BA, 1); - } else { - _vm->initGnapPos(2, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); - } - - if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->setFlag(kGFUnk21); - _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x9D, _vm->_gnapId, 0); - gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) { - _vm->gameUpdateTick(); - if (gameSys.getAnimationStatus(2) == 2) { - gameSys.setAnimation(0, 0, 2); - int newSeqId = _vm->getRandom(7) + 0x8F; - gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(newSeqId, 1, 2); - _currDancerSequenceId = newSeqId; - } - if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { - gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x96, 1, 3); - gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x99, 1, 4); - } - } - _vm->_gnapSequenceId = 0x9D; - _vm->_gnapSequenceDatNum = 0; - _vm->hideCursor(); - _vm->addFullScreenSprite(0x8A, 255); - gameSys.setAnimation(0xA0, 256, 0); - gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) - _vm->gameUpdateTick(); - gameSys.setAnimation(0x107BD, _vm->_gnapId, 0); - gameSys.insertSequence(0x107BD, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->removeFullScreenSprite(); - _vm->showCursor(); - _vm->_gnapSequenceId = 0x7BD; - _vm->_gnapSequenceDatNum = 1; - } - - _vm->playPlatypusSequence(0x9A); - gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094A)) - _vm->playSound(0x1094A, true); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - switch (_vm->_sceneClickedHotspot) { - case kHSUfoExitLeft: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 2; - _vm->_newSceneNum = 46; - _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 5); - } - break; - - case kHSUfoExitRight: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 2; - _vm->_newSceneNum = 41; - _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 5); - } - break; - - case kHSUfoDevice: - _vm->runMenu(); - updateHotspots(); - break; - } - } else { - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - _vm->playPlatypusSequence(0x9A); - gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSExitUfoParty: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; - _vm->_newSceneNum = 40; - } - break; - - case kHSExitShoe: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitShoe].x, _vm->_gnapY, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitShoe].x, _vm->_platY, -1, 0x107CF, 1); - _vm->_newSceneNum = 46; - } - break; - - case kHSExitRight: - if (_vm->_gnapActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitRight].x, _vm->_gnapY, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitRight].x, _vm->_platY, -1, 0x107CD, 1); - _vm->_newSceneNum = 41; - } - break; - - case kHSExitDiscoBall: - _vm->clearFlag(kGFUnk22); - _vm->setFlag(kGFUnk23); - _vm->_sceneDone = true; - _vm->_newSceneNum = 54; - break; - - case kHSDiscoBall: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex == kItemSpring) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSDiscoBall].x, _vm->_hotspotsWalkPos[kHSDiscoBall].y, 0, 0x9F, 5); - _vm->_gnapActionStatus = 1; - _vm->setGrabCursorSprite(-1); - _vm->invRemove(kItemSpring); - } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 0); - break; - case GRAB_CURSOR: - case TALK_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - } - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - } - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->_mouseClickState._left = false; - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoActionStatus = 3; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - } - - updateAnimations(); - _vm->toyUfoCheckTimer(); - - if (!_vm->_isLeavingScene && _vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } - - _vm->_sceneWaiting = false; -} - -void Scene45::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - if (gameSys.getAnimationStatus(0) == 2) { - gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case 0: - _vm->_sceneDone = true; - break; - case 1: - _vm->_sceneWaiting = true; - _vm->setFlag(kGFUnk22); - updateHotspots(); - gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9E; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x9E, _vm->_gnapId, 0); - break; - default: - _vm->_gnapActionStatus = -1; - break; - } - } - - if (gameSys.getAnimationStatus(1) == 2) { - gameSys.setAnimation(0, 0, 1); - if (_vm->getRandom(2) != 0) - _vm->playPlatypusSequence(0x9B); - else - _vm->playPlatypusSequence(0x9C); - gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); - } - - if (gameSys.getAnimationStatus(2) == 2) { - gameSys.setAnimation(0, 0, 2); - int newSeqId = _vm->getRandom(7) + 0x8F; - gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(newSeqId, 1, 2); - _currDancerSequenceId = newSeqId; - } - - if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { - gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x96, 1, 3); - gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x99, 1, 4); - } - - if (gameSys.getAnimationStatus(5) == 2) { - switch (_vm->_toyUfoActionStatus) { - case 2: - _vm->_sceneDone = true; - break; - default: - _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, - _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, - kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - ++_vm->_toyUfoId; - gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 5); - break; - } - _vm->_toyUfoActionStatus = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene45.h b/engines/gnap/scenes/scene45.h deleted file mode 100644 index 3aa7f9cb29..0000000000 --- a/engines/gnap/scenes/scene45.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE45_H -#define GNAP_SCENE45_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene45: public Scene { -public: - Scene45(GnapEngine *vm); - ~Scene45() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _currDancerSequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE45_H diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp deleted file mode 100644 index 5de3d4911d..0000000000 --- a/engines/gnap/scenes/scene46.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene46.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSExitUfoParty = 1, - kHSExitKissinBooth = 2, - kHSExitDisco = 3, - kHSSackGuy = 4, - kHSItchyGuy = 5, - kHSDevice = 6, - kHSWalkArea1 = 7 -}; - -enum { - kHSUfoExitLeft = 1, - kHSUfoExitRight = 2, - kHSUfoDevice = 3 -}; - -Scene46::Scene46(GnapEngine *vm) : Scene(vm) { - _currSackGuySequenceId = -1; - _nextItchyGuySequenceId = -1; - _nextSackGuySequenceId = -1; - _currItchyGuySequenceId = -1; -} - -int Scene46::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - gameSys.setAnimation(0, 0, 2); - gameSys.setAnimation(0, 0, 3); - gameSys.setAnimation(0, 0, 4); - return 0x4E; -} - -void Scene46::updateHotspots() { - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_DISABLED); - _vm->setHotspot(kHSUfoExitLeft, 0, 0, 10, 599, SF_EXIT_L_CURSOR); - _vm->setHotspot(kHSUfoExitRight, 790, 0, 799, 599, SF_EXIT_R_CURSOR); - _vm->setDeviceHotspot(kHSUfoDevice, -1, 534, -1, 599); - _vm->_hotspotsCount = 4; - } else { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSExitUfoParty, 150, 580, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); - _vm->setHotspot(kHSExitKissinBooth, 0, 100, 10, 599, SF_EXIT_L_CURSOR, 0, 8); - _vm->setHotspot(kHSExitDisco, 790, 100, 799, 599, SF_EXIT_R_CURSOR, 10, 8); - _vm->setHotspot(kHSSackGuy, 180, 370, 235, 490, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); - _vm->setHotspot(kHSItchyGuy, 535, 210, 650, 480, SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 6, 8); - _vm->setHotspot(kHSWalkArea1, 0, 0, 800, 485); - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 8; - } -} - -void Scene46::run() { - GameSys gameSys = *_vm->_gameSys; - - _vm->queueInsertDeviceIcon(); - gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); - - _currSackGuySequenceId = 0x4B; - _nextSackGuySequenceId = -1; - gameSys.setAnimation(0x4B, 1, 3); - gameSys.insertSequence(_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - _currItchyGuySequenceId = 0x47; - _nextItchyGuySequenceId = -1; - gameSys.setAnimation(0x47, 1, 4); - gameSys.insertSequence(_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoId = 0; - _vm->_toyUfoActionStatus = -1; - _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - if (_vm->_prevSceneNum == 44) - _vm->_toyUfoX = 30; - else - _vm->_toyUfoX = 770; - gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); - gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->endSceneInit(); - } else if (_vm->_prevSceneNum == 44) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 8, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); - } else if (_vm->_prevSceneNum == 45) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(12, 8, kDirUpLeft); - _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); - } else { - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); - _vm->endSceneInit(); - _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); - } - - _vm->_timers[4] = _vm->getRandom(50) + 80; - _vm->_timers[5] = _vm->getRandom(50) + 80; - - while (!_vm->_sceneDone) { - if (!_vm->isSoundPlaying(0x1094B)) - _vm->playSound(0x1094B, true); - - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - switch (_vm->_sceneClickedHotspot) { - case kHSUfoExitLeft: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 3; - _vm->_newSceneNum = 44; - _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); - } - break; - - case kHSUfoExitRight: - if (_vm->_toyUfoActionStatus < 0) { - _vm->_isLeavingScene = true; - _vm->_toyUfoActionStatus = 3; - _vm->_newSceneNum = 45; - _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); - } - break; - - case kHSUfoDevice: - _vm->runMenu(); - updateHotspots(); - break; - } - } else { - switch (_vm->_sceneClickedHotspot) { - case kHSDevice: - _vm->runMenu(); - updateHotspots(); - break; - - case kHSPlatypus: - if (_vm->_gnapActionStatus < 0) { - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); - break; - case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); - break; - case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); - break; - case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); - break; - } - } - } - break; - - case kHSSackGuy: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSSackGuy].x, _vm->_hotspotsWalkPos[kHSSackGuy].y, 2, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHSSackGuy].x + 1, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSSackGuy].x, _vm->_hotspotsWalkPos[kHSSackGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 2; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSItchyGuy: - if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHSItchyGuy].x, _vm->_hotspotsWalkPos[kHSItchyGuy].y, 7, 0); - } else { - switch (_vm->_verbCursor) { - case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHSItchyGuy].x - 1, 0); - break; - case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSItchyGuy].x, _vm->_hotspotsWalkPos[kHSItchyGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 1; - break; - case GRAB_CURSOR: - case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); - break; - } - } - break; - - case kHSExitUfoParty: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHSExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; - _vm->_newSceneNum = 40; - break; - - case kHSExitKissinBooth: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_gnapY, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitKissinBooth].x, _vm->_platY, -1, 0x107CF, 1); - _vm->_newSceneNum = 44; - break; - - case kHSExitDisco: - _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHSExitDisco].x, _vm->_gnapY, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHSExitDisco].x, _vm->_platY, -1, 0x107CD, 1); - _vm->_newSceneNum = 45; - break; - - case kHSWalkArea1: - if (_vm->_gnapActionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - break; - } - } - - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { - _vm->_mouseClickState._left = false; - if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_toyUfoActionStatus = 4; - _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); - } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); - } - } - - updateAnimations(); - _vm->toyUfoCheckTimer(); - - if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextItchyGuySequenceId == -1) { - if (_vm->getRandom(2) != 0) - _nextItchyGuySequenceId = 0x49; - else - _nextItchyGuySequenceId = 0x48; - } - } - if (!_vm->_timers[5]) { - _vm->_timers[5] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSackGuySequenceId == -1) - _nextSackGuySequenceId = 0x4C; - } - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - - _vm->gameUpdateTick(); - } -} - -void Scene46::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - if (gameSys.getAnimationStatus(0) == 2) { - gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { - case 0: - _vm->_sceneDone = true; - break; - case 1: - _nextItchyGuySequenceId = 0x46; - break; - case 2: - _nextSackGuySequenceId = 0x4A; - break; - } - _vm->_gnapActionStatus = -1; - } - - if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { - gameSys.insertSequence(_nextSackGuySequenceId, 1, _currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextSackGuySequenceId, 1, 3); - _currSackGuySequenceId = _nextSackGuySequenceId; - _nextSackGuySequenceId = -1; - _vm->_timers[5] = _vm->getRandom(50) + 80; - } - - if (gameSys.getAnimationStatus(4) == 2 && _nextItchyGuySequenceId != -1) { - gameSys.insertSequence(_nextItchyGuySequenceId, 1, _currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_nextItchyGuySequenceId, 1, 4); - _currItchyGuySequenceId = _nextItchyGuySequenceId; - _nextItchyGuySequenceId = -1; - _vm->_timers[4] = _vm->getRandom(50) + 80; - } - - if (gameSys.getAnimationStatus(2) == 2) { - switch (_vm->_toyUfoActionStatus) { - case 3: - _vm->_sceneDone = true; - break; - default: - _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, - _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, - kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - ++_vm->_toyUfoId; - gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); - break; - } - _vm->_toyUfoActionStatus = -1; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene46.h b/engines/gnap/scenes/scene46.h deleted file mode 100644 index 9a578288ad..0000000000 --- a/engines/gnap/scenes/scene46.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE46_H -#define GNAP_SCENE46_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene46: public Scene { -public: - Scene46(GnapEngine *vm); - ~Scene46() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _currSackGuySequenceId; - int _nextItchyGuySequenceId; - int _nextSackGuySequenceId; - int _currItchyGuySequenceId; -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE46_H diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp deleted file mode 100644 index 3753d987eb..0000000000 --- a/engines/gnap/scenes/scene49.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene49.h" - -namespace Gnap { - -static const ObstacleDef kObstacleDefs[] = { - {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14}, - {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12}, - {0xCD, 11}, {0xCB, 15}, {0xB7, 12}, {0xCD, 11}, {0xCB, 10}, - {0xCF, 15}, {0xCF, 14}, {0xBD, 13}, {0xCF, 12}, {0xCD, 11}, - {0xCB, 15}, {0xCB, 13}, {0xB4, 12}, {0xCB, 11}, {0xCD, 10}, - {0xCF, 15}, {0xCD, 12}, {0xBA, 12}, {0xCD, 12}, {0xCF, 12}, - {0xCB, 15}, {0xCB, 9}, {0xCD, 9}, {0xCF, 9}, {0xCD, 9}, - {0xCB, 9}, {0xCD, 9}, {0xCF, 5}, {0xBD, 13}, {0xCF, 8}, - {0xCB, 8}, {0xCD, 15}, {0xB4, 1}, {0xBD, 7}, {0xCF, 7}, - {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15} -}; - -Scene49::Scene49(GnapEngine *vm) : Scene(vm) { - _scoreBarFlash = false; - _scoreBarPos = -1; - _scoreLevel = -1; - _obstacleIndex = -1; - _truckSequenceId = -1; - _truckId = -1; - _truckLaneNum = -1; - - for (int i = 0; i < 5; i++) { - _obstacles[i]._currSequenceId = -1; - _obstacles[i]._closerSequenceId = -1; - _obstacles[i]._passedSequenceId = -1; - _obstacles[i]._splashSequenceId = -1; - _obstacles[i]._collisionSequenceId = -1; - _obstacles[i]._prevId = -1; - _obstacles[i]._currId = -1; - _obstacles[i]._laneNum = -1; - } -} - -int Scene49::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - for (int i = 0; i < 5; ++i) - gameSys.setAnimation(0, 0, i + 2); - _vm->_timers[2] = 0; - _vm->_timers[0] = 0; - _vm->_timers[1] = 0; - _vm->clearKeyStatus1(28); - _vm->clearKeyStatus1(54); - _vm->clearKeyStatus1(52); - return 0xD5; -} - -void Scene49::updateHotspots() { - _vm->_hotspotsCount = 0; -} - -void Scene49::checkObstacles() { - if (_vm->_timers[2] == 0) { - if (_vm->_timers[3] == 0) { - for (int i = 0; i < 5; ++i) - clearObstacle(i); - } - - for (int j = 0; j < 5; ++j) { - if (_obstacles[j]._currSequenceId == 0) { - _vm->_timers[3] = 35; - _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId; - switch (_obstacles[j]._currSequenceId) { - case 0xB4: - _obstacles[j]._laneNum = 1; - _obstacles[j]._closerSequenceId = 180; - _obstacles[j]._passedSequenceId = 181; - _obstacles[j]._splashSequenceId = 182; - _obstacles[j]._collisionSequenceId = 192; - break; - case 0xB7: - _obstacles[j]._laneNum = 2; - _obstacles[j]._closerSequenceId = 183; - _obstacles[j]._passedSequenceId = 184; - _obstacles[j]._splashSequenceId = 185; - _obstacles[j]._collisionSequenceId = 193; - break; - case 0xBD: - _obstacles[j]._laneNum = 3; - _obstacles[j]._closerSequenceId = 189; - _obstacles[j]._passedSequenceId = 190; - _obstacles[j]._splashSequenceId = 191; - _obstacles[j]._collisionSequenceId = 195; - break; - case 0xBA: - _obstacles[j]._laneNum = 2; - _obstacles[j]._closerSequenceId = 186; - _obstacles[j]._passedSequenceId = 187; - _obstacles[j]._splashSequenceId = 188; - _obstacles[j]._collisionSequenceId = 194; - break; - case 0xCB: - _obstacles[j]._laneNum = 1; - _obstacles[j]._closerSequenceId = 203; - _obstacles[j]._passedSequenceId = 204; - _obstacles[j]._splashSequenceId = 0; - _obstacles[j]._collisionSequenceId = 209; - break; - case 0xCD: - _obstacles[j]._laneNum = 2; - _obstacles[j]._closerSequenceId = 205; - _obstacles[j]._passedSequenceId = 206; - _obstacles[j]._splashSequenceId = 0; - _obstacles[j]._collisionSequenceId = 210; - break; - case 0xCF: - _obstacles[j]._laneNum = 3; - _obstacles[j]._closerSequenceId = 207; - _obstacles[j]._passedSequenceId = 208; - _obstacles[j]._splashSequenceId = 0; - _obstacles[j]._collisionSequenceId = 211; - break; - } - _obstacles[j]._prevId = _truckId; - _obstacles[j]._currId = _obstacles[j]._prevId; - _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2); - _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); - _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks; - ++_obstacleIndex; - if (_obstacleIndex == 50) - _obstacleIndex = 0; - break; - } - } - - } - -} - -void Scene49::updateObstacle(int id) { - GameSys gameSys = *_vm->_gameSys; - Scene49Obstacle &obstacle = _obstacles[id]; - - obstacle._currId = obstacle._prevId; - - switch (obstacle._laneNum) { - case 1: - obstacle._prevId = _truckId + 1; - break; - case 2: - if (_truckLaneNum != 2 && _truckLaneNum != 3) - obstacle._prevId = _truckId - 1; - else - obstacle._prevId = _truckId + 1; - break; - case 3: - if (_truckLaneNum != 1 && _truckLaneNum != 2) - obstacle._prevId = _truckId; - else - obstacle._prevId = _truckId - 1; - break; - } - - if (obstacle._currSequenceId == obstacle._closerSequenceId) { - if (_truckLaneNum == obstacle._laneNum) { - if (obstacle._splashSequenceId) { - gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._collisionSequenceId; - _vm->playSound(224, false); - increaseScore(30); - } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) || - (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) || - (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) { - gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._passedSequenceId; - } else { - gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0); - gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - gameSys.insertSequence(obstacle._collisionSequenceId, 256, - _truckSequenceId, _truckId, - kSeqSyncExists, 0, 0, -50); - _truckSequenceId = obstacle._collisionSequenceId; - _truckId = 256; - obstacle._currSequenceId = obstacle._passedSequenceId; - _vm->playSound(225, false); - decreaseScore(30); - } - } else { - gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._passedSequenceId; - } - } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { - if (_truckLaneNum == obstacle._laneNum) { - if (obstacle._splashSequenceId) { - gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._collisionSequenceId; - _vm->playSound(224, false); - increaseScore(30); - } - } else if (obstacle._splashSequenceId) { - gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._splashSequenceId; - } - } else { - gameSys.setAnimation(0, 0, id + 2); - clearObstacle(id); - } -} - -void Scene49::increaseScore(int amount) { - if (_scoreBarPos + amount <= 556) { - _scoreBarPos += amount; - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); - } - _scoreLevel = _scoreBarPos + amount >= 556; -} - -void Scene49::decreaseScore(int amount) { - if (_scoreBarPos >= 226 && _scoreLevel == 0) { - if (_scoreBarFlash) - refreshScoreBar(); - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); - _scoreBarPos -= amount; - _scoreLevel = 0; - } -} - -void Scene49::refreshScoreBar() { - if (_scoreBarFlash) - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); - else - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); - _scoreBarFlash = !_scoreBarFlash; -} - -void Scene49::clearObstacle(int index) { - _obstacles[index]._currSequenceId = 0; - _obstacles[index]._closerSequenceId = 0; - _obstacles[index]._passedSequenceId = 0; - _obstacles[index]._splashSequenceId = 0; - _obstacles[index]._collisionSequenceId = 0; - _obstacles[index]._prevId = 0; - _obstacles[index]._currId = 0; - _obstacles[index]._laneNum = 0; -} - -void Scene49::run() { - GameSys gameSys = *_vm->_gameSys; - - bool animToggle6 = false; - bool animToggle5 = false; - bool animToggle4 = false; - bool animToggle3 = false; - bool streetAnimToggle = false; - bool bgAnimToggle = false; - - _vm->playSound(0xE2, true); - _vm->setSoundVolume(0xE2, 75); - - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - - _scoreBarPos = 196; - _scoreLevel = 0; - _scoreBarFlash = false; - - switch (_vm->getRandom(3)) { - case 0: - _truckSequenceId = 0xAD; - _truckLaneNum = 1; - break; - case 1: - _truckSequenceId = 0xAE; - _truckLaneNum = 2; - break; - case 2: - _truckSequenceId = 0xAF; - _truckLaneNum = 3; - break; - } - - int bgWidth1 = gameSys.getSpriteWidthById(0x5E); - int bgX1 = 600; - - int bgWidth2 = gameSys.getSpriteWidthById(0x5F); - int bgX2 = 400; - - int bgWidth3 = gameSys.getSpriteWidthById(4); - int bgX3 = 700; - - int bgWidth4 = gameSys.getSpriteWidthById(5); - int bgX4 = 500; - - int bgWidth5 = gameSys.getSpriteWidthById(6); - int bgX5 = 300; - - int bgWidth6 = gameSys.getSpriteWidthById(7); - int bgX6 = 100; - - gameSys.setAnimation(0xC8, 251, 1); - gameSys.setAnimation(_truckSequenceId, 256, 0); - gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); - gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); - gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); - gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); - gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); - gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); - gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); - gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); - - _vm->_timers[0] = 2; - - for (int i = 0; i < 5; ++i) - clearObstacle(i); - - _obstacleIndex = 0; - - _vm->_timers[2] = _vm->getRandom(20) + 10; - - _truckId = 256; - _vm->_timers[3] = 35; - - while (!_vm->_sceneDone) { - if (_vm->_timers[0] == 0) { - // Update background animations (clouds etc.) - --bgX1; - bgX2 -= 2; - bgX3 -= 5; - --bgX4; - --bgX5; - --bgX6; - if (bgX1 <= -bgWidth1) - bgX1 = 799; - if (bgX2 <= -bgWidth2) - bgX2 = 799; - if (bgX3 <= -bgWidth3) - bgX3 = 799; - if (bgX4 <= -bgWidth4) - bgX4 = 799; - if (bgX5 <= -bgWidth5) - bgX5 = 799; - if (bgX6 <= -bgWidth6) - bgX6 = 799; - bgAnimToggle = !bgAnimToggle; - gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); - gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); - gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); - gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); - gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); - gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); - _vm->_timers[0] = 2; - } - - if (gameSys.getAnimationStatus(1) == 2) { - streetAnimToggle = !streetAnimToggle; - gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); - gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); - } - - checkObstacles(); - - if (gameSys.getAnimationStatus(0) == 2) { - switch (_truckSequenceId) { - case 0xB1: - _truckLaneNum = 1; - break; - case 0xB0: - case 0xB3: - _truckLaneNum = 2; - break; - case 0xB2: - _truckLaneNum = 3; - break; - } - animToggle3 = !animToggle3; - if (_truckLaneNum == 1) { - gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); - gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); - _truckSequenceId = 0xAD; - } else if (_truckLaneNum == 2) { - gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); - gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); - _truckSequenceId = 0xAE; - } else { - gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); - gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); - _truckSequenceId = 0xAF; - } - _truckId = (animToggle3 ? 1 : 0) + 256; - if (_scoreLevel == 1) { - if (!gameSys.isSequenceActive(0xD4, 266)) { - gameSys.setAnimation(0xD4, 266, 8); - gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); - } - ++_scoreLevel; - _vm->_timers[1] = 2; - animToggle4 = false; - animToggle5 = false; - animToggle6 = false; - _scoreBarFlash = false; - } - } - - if (_scoreLevel != 0 && !_vm->_timers[1]) { - refreshScoreBar(); - _vm->_timers[1] = 8; - if (animToggle6) { - if (animToggle5) { - if (animToggle4 && !gameSys.isSequenceActive(212, 266)) - gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); - animToggle4 = !animToggle4; - } - animToggle5 = !animToggle5; - } - animToggle6 = !animToggle6; - } - - updateAnimations(); - - if (clearKeyStatus()) { - _vm->_sceneDone = true; - _vm->_newSceneNum = 2; - _vm->_newCursorValue = 1; - } - - if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { - // Steer right - if (_truckSequenceId == 0xB3) - _truckLaneNum = 2; - if (_truckSequenceId == 0xB1) - _truckLaneNum = 1; - if (_truckLaneNum != 3 && _truckLaneNum != 2) { - if (_scoreLevel) { - _vm->_sceneDone = true; - _vm->_newSceneNum = 47; - } - } else { - int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1; - if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) { - gameSys.setAnimation(steerSequenceId, 256, 0); - gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); - _truckSequenceId = steerSequenceId; - _truckId = 256; - } - } - _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); - } - - if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { - // Steer left - if (_truckSequenceId == 0xB0) - _truckLaneNum = 2; - if (_truckSequenceId == 0xB2) - _truckLaneNum = 3; - if (_truckLaneNum == 1 || _truckLaneNum == 2) { - int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2; - if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) { - gameSys.setAnimation(steerSequenceId, 256, 0); - gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); - _truckSequenceId = steerSequenceId; - _truckId = 256; - } - } - _vm->clearKeyStatus1(Common::KEYCODE_LEFT); - } - _vm->gameUpdateTick(); - } - _vm->stopSound(0xE2); -} - -void Scene49::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - for (int i = 0; i < 5; ++i) { - if (gameSys.getAnimationStatus(i + 2) == 2) { - if (_obstacles[i]._currSequenceId) - updateObstacle(i); - } - } - - if (gameSys.getAnimationStatus(8) == 2) { - _vm->_sceneDone = true; - _vm->_newSceneNum = 47; - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene49.h b/engines/gnap/scenes/scene49.h deleted file mode 100644 index d69d9771c9..0000000000 --- a/engines/gnap/scenes/scene49.h +++ /dev/null @@ -1,79 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE49_H -#define GNAP_SCENE49_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -struct Scene49Obstacle { - int _currSequenceId; - int _closerSequenceId; - int _passedSequenceId; - int _splashSequenceId; - int _collisionSequenceId; - int _prevId; - int _currId; - int _laneNum; -}; - -struct ObstacleDef { - int _sequenceId; - int _ticks; -}; - -class Scene49: public Scene { -public: - Scene49(GnapEngine *vm); - ~Scene49() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _scoreBarPos; - int _scoreLevel; - bool _scoreBarFlash; - int _obstacleIndex; - Scene49Obstacle _obstacles[5]; - int _truckSequenceId; - int _truckId; - int _truckLaneNum; - - void checkObstacles(); - void updateObstacle(int id); - void increaseScore(int amount); - void decreaseScore(int amount); - void refreshScoreBar(); - void clearObstacle(int index); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE49_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index a9024b581b..6fc51d862c 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -30,16 +30,9 @@ #include "gnap/scenes/group1.h" #include "gnap/scenes/group2.h" #include "gnap/scenes/group3.h" +#include "gnap/scenes/group4.h" #include "gnap/scenes/intro.h" -#include "gnap/scenes/scene40.h" -#include "gnap/scenes/scene41.h" -#include "gnap/scenes/scene42.h" -#include "gnap/scenes/scene43.h" -#include "gnap/scenes/scene44.h" -#include "gnap/scenes/scene45.h" -#include "gnap/scenes/scene46.h" -#include "gnap/scenes/scene49.h" #include "gnap/scenes/scene50.h" #include "gnap/scenes/scene51.h" #include "gnap/scenes/scene52.h" -- cgit v1.2.3 From 8a91335bfa4a23ab0cbc5427ab3a407bcbe5f2ef Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 28 Apr 2016 07:26:11 +0200 Subject: GNAP: renaming and grouping of scenes in group Arcade and Group 5 --- engines/gnap/module.mk | 6 +- engines/gnap/scenes/arcade.cpp | 2730 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/arcade.h | 290 ++++ engines/gnap/scenes/group4.cpp | 497 ------- engines/gnap/scenes/group4.h | 45 - engines/gnap/scenes/group5.cpp | 395 ++++++ engines/gnap/scenes/group5.h | 57 + engines/gnap/scenes/scene50.cpp | 498 ------- engines/gnap/scenes/scene50.h | 87 -- engines/gnap/scenes/scene51.cpp | 897 ------------ engines/gnap/scenes/scene51.h | 101 -- engines/gnap/scenes/scene52.cpp | 894 ------------ engines/gnap/scenes/scene52.h | 118 -- engines/gnap/scenes/scene53.cpp | 395 ------ engines/gnap/scenes/scene53.h | 57 - engines/gnap/scenes/scenecore.cpp | 8 +- 16 files changed, 3477 insertions(+), 3598 deletions(-) create mode 100644 engines/gnap/scenes/arcade.cpp create mode 100644 engines/gnap/scenes/arcade.h create mode 100644 engines/gnap/scenes/group5.cpp create mode 100644 engines/gnap/scenes/group5.h delete mode 100644 engines/gnap/scenes/scene50.cpp delete mode 100644 engines/gnap/scenes/scene50.h delete mode 100644 engines/gnap/scenes/scene51.cpp delete mode 100644 engines/gnap/scenes/scene51.h delete mode 100644 engines/gnap/scenes/scene52.cpp delete mode 100644 engines/gnap/scenes/scene52.h delete mode 100644 engines/gnap/scenes/scene53.cpp delete mode 100644 engines/gnap/scenes/scene53.h diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index cdbda4a1da..79849cf293 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -10,17 +10,15 @@ MODULE_OBJS := \ menu.o \ resource.o \ sound.o \ + scenes/arcade.o \ scenes/groupcs.o \ scenes/group0.o \ scenes/group1.o \ scenes/group2.o \ scenes/group3.o \ scenes/group4.o \ + scenes/group5.o \ scenes/intro.o \ - scenes/scene50.o \ - scenes/scene51.o \ - scenes/scene52.o \ - scenes/scene53.o \ scenes/scenecore.o # This module can be built as a plugin diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp new file mode 100644 index 0000000000..3b1b1b0807 --- /dev/null +++ b/engines/gnap/scenes/arcade.cpp @@ -0,0 +1,2730 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/arcade.h" + +namespace Gnap { + +static const ObstacleDef kObstacleDefs[] = { + {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14}, + {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12}, + {0xCD, 11}, {0xCB, 15}, {0xB7, 12}, {0xCD, 11}, {0xCB, 10}, + {0xCF, 15}, {0xCF, 14}, {0xBD, 13}, {0xCF, 12}, {0xCD, 11}, + {0xCB, 15}, {0xCB, 13}, {0xB4, 12}, {0xCB, 11}, {0xCD, 10}, + {0xCF, 15}, {0xCD, 12}, {0xBA, 12}, {0xCD, 12}, {0xCF, 12}, + {0xCB, 15}, {0xCB, 9}, {0xCD, 9}, {0xCF, 9}, {0xCD, 9}, + {0xCB, 9}, {0xCD, 9}, {0xCF, 5}, {0xBD, 13}, {0xCF, 8}, + {0xCB, 8}, {0xCD, 15}, {0xB4, 1}, {0xBD, 7}, {0xCF, 7}, + {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15} +}; + +Scene49::Scene49(GnapEngine *vm) : Scene(vm) { + _scoreBarFlash = false; + _scoreBarPos = -1; + _scoreLevel = -1; + _obstacleIndex = -1; + _truckSequenceId = -1; + _truckId = -1; + _truckLaneNum = -1; + + for (int i = 0; i < 5; i++) { + _obstacles[i]._currSequenceId = -1; + _obstacles[i]._closerSequenceId = -1; + _obstacles[i]._passedSequenceId = -1; + _obstacles[i]._splashSequenceId = -1; + _obstacles[i]._collisionSequenceId = -1; + _obstacles[i]._prevId = -1; + _obstacles[i]._currId = -1; + _obstacles[i]._laneNum = -1; + } +} + +int Scene49::init() { + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + for (int i = 0; i < 5; ++i) + gameSys.setAnimation(0, 0, i + 2); + _vm->_timers[2] = 0; + _vm->_timers[0] = 0; + _vm->_timers[1] = 0; + _vm->clearKeyStatus1(28); + _vm->clearKeyStatus1(54); + _vm->clearKeyStatus1(52); + return 0xD5; +} + +void Scene49::updateHotspots() { + _vm->_hotspotsCount = 0; +} + +void Scene49::checkObstacles() { + if (_vm->_timers[2] == 0) { + if (_vm->_timers[3] == 0) { + for (int i = 0; i < 5; ++i) + clearObstacle(i); + } + + for (int j = 0; j < 5; ++j) { + if (_obstacles[j]._currSequenceId == 0) { + _vm->_timers[3] = 35; + _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId; + switch (_obstacles[j]._currSequenceId) { + case 0xB4: + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 180; + _obstacles[j]._passedSequenceId = 181; + _obstacles[j]._splashSequenceId = 182; + _obstacles[j]._collisionSequenceId = 192; + break; + case 0xB7: + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 183; + _obstacles[j]._passedSequenceId = 184; + _obstacles[j]._splashSequenceId = 185; + _obstacles[j]._collisionSequenceId = 193; + break; + case 0xBD: + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 189; + _obstacles[j]._passedSequenceId = 190; + _obstacles[j]._splashSequenceId = 191; + _obstacles[j]._collisionSequenceId = 195; + break; + case 0xBA: + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 186; + _obstacles[j]._passedSequenceId = 187; + _obstacles[j]._splashSequenceId = 188; + _obstacles[j]._collisionSequenceId = 194; + break; + case 0xCB: + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 203; + _obstacles[j]._passedSequenceId = 204; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 209; + break; + case 0xCD: + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 205; + _obstacles[j]._passedSequenceId = 206; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 210; + break; + case 0xCF: + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 207; + _obstacles[j]._passedSequenceId = 208; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 211; + break; + } + _obstacles[j]._prevId = _truckId; + _obstacles[j]._currId = _obstacles[j]._prevId; + _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2); + _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); + _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks; + ++_obstacleIndex; + if (_obstacleIndex == 50) + _obstacleIndex = 0; + break; + } + } + } +} + +void Scene49::updateObstacle(int id) { + GameSys gameSys = *_vm->_gameSys; + Scene49Obstacle &obstacle = _obstacles[id]; + + obstacle._currId = obstacle._prevId; + + switch (obstacle._laneNum) { + case 1: + obstacle._prevId = _truckId + 1; + break; + case 2: + if (_truckLaneNum != 2 && _truckLaneNum != 3) + obstacle._prevId = _truckId - 1; + else + obstacle._prevId = _truckId + 1; + break; + case 3: + if (_truckLaneNum != 1 && _truckLaneNum != 2) + obstacle._prevId = _truckId; + else + obstacle._prevId = _truckId - 1; + break; + } + + if (obstacle._currSequenceId == obstacle._closerSequenceId) { + if (_truckLaneNum == obstacle._laneNum) { + if (obstacle._splashSequenceId) { + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._collisionSequenceId; + _vm->playSound(224, false); + increaseScore(30); + } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) || + (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) || + (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) { + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._passedSequenceId; + } else { + gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0); + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + gameSys.insertSequence(obstacle._collisionSequenceId, 256, + _truckSequenceId, _truckId, + kSeqSyncExists, 0, 0, -50); + _truckSequenceId = obstacle._collisionSequenceId; + _truckId = 256; + obstacle._currSequenceId = obstacle._passedSequenceId; + _vm->playSound(225, false); + decreaseScore(30); + } + } else { + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._passedSequenceId; + } + } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { + if (_truckLaneNum == obstacle._laneNum) { + if (obstacle._splashSequenceId) { + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._collisionSequenceId; + _vm->playSound(224, false); + increaseScore(30); + } + } else if (obstacle._splashSequenceId) { + gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId, + obstacle._currSequenceId, obstacle._currId, + kSeqSyncWait, 0, 0, -50); + obstacle._currSequenceId = obstacle._splashSequenceId; + } + } else { + gameSys.setAnimation(0, 0, id + 2); + clearObstacle(id); + } +} + +void Scene49::increaseScore(int amount) { + if (_scoreBarPos + amount <= 556) { + _scoreBarPos += amount; + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); + } + _scoreLevel = _scoreBarPos + amount >= 556; +} + +void Scene49::decreaseScore(int amount) { + if (_scoreBarPos >= 226 && _scoreLevel == 0) { + if (_scoreBarFlash) + refreshScoreBar(); + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); + _scoreBarPos -= amount; + _scoreLevel = 0; + } +} + +void Scene49::refreshScoreBar() { + if (_scoreBarFlash) + _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); + else + _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); + _scoreBarFlash = !_scoreBarFlash; +} + +void Scene49::clearObstacle(int index) { + _obstacles[index]._currSequenceId = 0; + _obstacles[index]._closerSequenceId = 0; + _obstacles[index]._passedSequenceId = 0; + _obstacles[index]._splashSequenceId = 0; + _obstacles[index]._collisionSequenceId = 0; + _obstacles[index]._prevId = 0; + _obstacles[index]._currId = 0; + _obstacles[index]._laneNum = 0; +} + +void Scene49::run() { + GameSys gameSys = *_vm->_gameSys; + + bool animToggle6 = false; + bool animToggle5 = false; + bool animToggle4 = false; + bool animToggle3 = false; + bool streetAnimToggle = false; + bool bgAnimToggle = false; + + _vm->playSound(0xE2, true); + _vm->setSoundVolume(0xE2, 75); + + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + + _scoreBarPos = 196; + _scoreLevel = 0; + _scoreBarFlash = false; + + switch (_vm->getRandom(3)) { + case 0: + _truckSequenceId = 0xAD; + _truckLaneNum = 1; + break; + case 1: + _truckSequenceId = 0xAE; + _truckLaneNum = 2; + break; + case 2: + _truckSequenceId = 0xAF; + _truckLaneNum = 3; + break; + } + + int bgWidth1 = gameSys.getSpriteWidthById(0x5E); + int bgX1 = 600; + + int bgWidth2 = gameSys.getSpriteWidthById(0x5F); + int bgX2 = 400; + + int bgWidth3 = gameSys.getSpriteWidthById(4); + int bgX3 = 700; + + int bgWidth4 = gameSys.getSpriteWidthById(5); + int bgX4 = 500; + + int bgWidth5 = gameSys.getSpriteWidthById(6); + int bgX5 = 300; + + int bgWidth6 = gameSys.getSpriteWidthById(7); + int bgX6 = 100; + + gameSys.setAnimation(0xC8, 251, 1); + gameSys.setAnimation(_truckSequenceId, 256, 0); + gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); + gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); + gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); + gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); + gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); + gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); + gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); + gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); + + _vm->_timers[0] = 2; + + for (int i = 0; i < 5; ++i) + clearObstacle(i); + + _obstacleIndex = 0; + + _vm->_timers[2] = _vm->getRandom(20) + 10; + + _truckId = 256; + _vm->_timers[3] = 35; + + while (!_vm->_sceneDone) { + if (_vm->_timers[0] == 0) { + // Update background animations (clouds etc.) + --bgX1; + bgX2 -= 2; + bgX3 -= 5; + --bgX4; + --bgX5; + --bgX6; + if (bgX1 <= -bgWidth1) + bgX1 = 799; + if (bgX2 <= -bgWidth2) + bgX2 = 799; + if (bgX3 <= -bgWidth3) + bgX3 = 799; + if (bgX4 <= -bgWidth4) + bgX4 = 799; + if (bgX5 <= -bgWidth5) + bgX5 = 799; + if (bgX6 <= -bgWidth6) + bgX6 = 799; + bgAnimToggle = !bgAnimToggle; + gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); + gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); + gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); + gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); + gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); + gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); + _vm->_timers[0] = 2; + } + + if (gameSys.getAnimationStatus(1) == 2) { + streetAnimToggle = !streetAnimToggle; + gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); + gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); + } + + checkObstacles(); + + if (gameSys.getAnimationStatus(0) == 2) { + switch (_truckSequenceId) { + case 0xB1: + _truckLaneNum = 1; + break; + case 0xB0: + case 0xB3: + _truckLaneNum = 2; + break; + case 0xB2: + _truckLaneNum = 3; + break; + } + animToggle3 = !animToggle3; + if (_truckLaneNum == 1) { + gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAD; + } else if (_truckLaneNum == 2) { + gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAE; + } else { + gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAF; + } + _truckId = (animToggle3 ? 1 : 0) + 256; + if (_scoreLevel == 1) { + if (!gameSys.isSequenceActive(0xD4, 266)) { + gameSys.setAnimation(0xD4, 266, 8); + gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); + } + ++_scoreLevel; + _vm->_timers[1] = 2; + animToggle4 = false; + animToggle5 = false; + animToggle6 = false; + _scoreBarFlash = false; + } + } + + if (_scoreLevel != 0 && !_vm->_timers[1]) { + refreshScoreBar(); + _vm->_timers[1] = 8; + if (animToggle6) { + if (animToggle5) { + if (animToggle4 && !gameSys.isSequenceActive(212, 266)) + gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); + animToggle4 = !animToggle4; + } + animToggle5 = !animToggle5; + } + animToggle6 = !animToggle6; + } + + updateAnimations(); + + if (clearKeyStatus()) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 2; + _vm->_newCursorValue = 1; + } + + if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { + // Steer right + if (_truckSequenceId == 0xB3) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB1) + _truckLaneNum = 1; + if (_truckLaneNum != 3 && _truckLaneNum != 2) { + if (_scoreLevel) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 47; + } + } else { + int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1; + if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; + } + } + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + } + + if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { + // Steer left + if (_truckSequenceId == 0xB0) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB2) + _truckLaneNum = 3; + if (_truckLaneNum == 1 || _truckLaneNum == 2) { + int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2; + if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; + } + } + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + } + _vm->gameUpdateTick(); + } + _vm->stopSound(0xE2); +} + +void Scene49::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + + for (int i = 0; i < 5; ++i) { + if (gameSys.getAnimationStatus(i + 2) == 2) { + if (_obstacles[i]._currSequenceId) + updateObstacle(i); + } + } + + if (gameSys.getAnimationStatus(8) == 2) { + _vm->_sceneDone = true; + _vm->_newSceneNum = 47; + } +} + +/*****************************************************************************/ + +Scene50::Scene50(GnapEngine *vm) : Scene(vm) { + _fightDone = false; + + _roundNum = -1; + _timeRemaining = -1; + _leftTongueRoundsWon = -1; + _rightTongueRoundsWon = -1; + _leftTongueSequenceId = -1; + _leftTongueId = -1; + _leftTongueNextSequenceId = -1; + _leftTongueNextId = -1; + _rightTongueSequenceId = -1; + _rightTongueId = -1; + _rightTongueNextSequenceId = -1; + _rightTongueNextId = -1; + _leftTongueEnergy = -1; + _rightTongueEnergy = -1; + + _timesPlayed = 0; + _timesPlayedModifier = 0; + _attackCounter = 0; + _leftTongueEnergyBarPos = 10; + _leftTongueNextIdCtr = 0; + _rightTongueEnergyBarPos = 10; + _rightTongueNextIdCtr = 0; +} + +int Scene50::init() { + return 0xC7; +} + +void Scene50::updateHotspots() { + _vm->_hotspotsCount = 0; +} + +bool Scene50::tongueWinsRound(int tongueNum) { + if (tongueNum == 1) + ++_leftTongueRoundsWon; + else + ++_rightTongueRoundsWon; + playWinBadgeAnim(tongueNum); + bool fightOver = _rightTongueRoundsWon == 2 || _leftTongueRoundsWon == 2; + playWinAnim(tongueNum, fightOver); + return fightOver; +} + +void Scene50::playWinAnim(int tongueNum, bool fightOver) { + if (tongueNum == 1) { + if (fightOver) { + _vm->_gameSys->insertSequence(0xAD, 140, 0xAC, 140, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB4, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBD, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); + _leftTongueSequenceId = 0xB4; + _rightTongueSequenceId = 0xBC; + _rightTongueId = 100; + _leftTongueId = 100; + _vm->_gameSys->setAnimation(0xB4, 100, 6); + _vm->_gameSys->setAnimation(_rightTongueSequenceId, 100, 5); + waitForAnim(6); + waitForAnim(5); + _vm->invAdd(kItemGum); + _vm->setFlag(kGFUnk13); + } else { + _vm->_gameSys->insertSequence(0xB4, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBD, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); + _leftTongueSequenceId = 0xB4; + _rightTongueSequenceId = 0xBC; + _rightTongueId = 100; + _leftTongueId = 100; + _vm->_gameSys->setAnimation(0xB4, 100, 6); + _vm->_gameSys->setAnimation(_rightTongueSequenceId, 100, 5); + waitForAnim(6); + waitForAnim(5); + } + } else { + _vm->_gameSys->insertSequence(0xBE, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xBE, 100, 5); + waitForAnim(5); + _vm->_gameSys->insertSequence(0xBF, 100, 0xBE, 100, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB5, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0); + _rightTongueSequenceId = 0xBF; + _leftTongueSequenceId = 0xB5; + _rightTongueId = 100; + _leftTongueId = 100; + _vm->_gameSys->setAnimation(0xB5, 100, 6); + _vm->_gameSys->setAnimation(_rightTongueSequenceId, 100, 5); + waitForAnim(6); + waitForAnim(5); + } + // TODO delayTicksA(1, 7); +} + +void Scene50::delayTicks() { + // TODO delayTicksA(3, 7); +} + +void Scene50::initRound() { + _leftTongueEnergy = 10; + _rightTongueEnergy = 10; + _fightDone = false; + _vm->_timers[3] = getRightTongueActionTicks(); + _vm->_timers[4] = 0; + _vm->_timers[6] = 0; + _vm->_gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0); + _vm->_gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0); + _timeRemaining = 40; + drawCountdown(40); +} + +bool Scene50::updateCountdown() { + if (!_vm->_timers[5]) { + --_timeRemaining; + if (_timeRemaining < 0) { + return true; + } else { + _vm->_timers[5] = 15; + drawCountdown(_timeRemaining); + } + } + return false; +} + +void Scene50::drawCountdown(int value) { + char str[8]; + sprintf(str, "%02d", value); + _vm->_gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str); +} + +void Scene50::playTonguesIdle() { + _vm->_gameSys->insertSequence(0xBA, 100, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xC2, 100, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0); + _leftTongueSequenceId = 0xBA; + _rightTongueSequenceId = 0xC2; + _rightTongueNextSequenceId = -1; + _leftTongueNextSequenceId = -1; + _leftTongueId = 100; + _rightTongueId = 100; + _vm->_gameSys->setAnimation(0xC2, 100, 5); + _vm->_gameSys->setAnimation(_leftTongueSequenceId, _leftTongueId, 6); +} + +void Scene50::playRoundAnim(int roundNum) { + int sequenceId = 0; + + switch (roundNum) { + case 1: + sequenceId = 0xAF; + break; + case 2: + sequenceId = 0xB0; + break; + case 3: + sequenceId = 0xB1; + break; + } + + _vm->_gameSys->insertSequence(sequenceId, 256, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(sequenceId, 256, 7); + waitForAnim(7); + + _vm->_gameSys->insertSequence(0xAB, 256, sequenceId, 256, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->setAnimation(0xAB, 256, 7); + waitForAnim(7); +} + +bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { + if (newLeftBarPos != _leftTongueEnergyBarPos) { + if (newLeftBarPos < 0) + newLeftBarPos = 0; + _leftTongueEnergyBarPos = newLeftBarPos; + _vm->_gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); + } + + if (newRightBarPos != _rightTongueEnergyBarPos) { + if (newRightBarPos < 0) + newRightBarPos = 0; + _rightTongueEnergyBarPos = newRightBarPos; + if (newRightBarPos != 10) + _vm->_gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); + } + + if (newLeftBarPos * newRightBarPos > 0) + return false; + + _leftTongueEnergyBarPos = 10; + _rightTongueEnergyBarPos = 10; + return true; +} + +void Scene50::waitForAnim(int animationIndex) { + while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { + _vm->gameUpdateTick(); + } + _vm->_gameSys->setAnimation(0, 0, animationIndex); +} + +int Scene50::checkInput() { + int sequenceId = -1; + + if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + sequenceId = 0xB6; + } else if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + sequenceId = 0xB3; + } else if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE)) { + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _fightDone = true; + } + + return sequenceId; +} + +int Scene50::getRightTongueAction() { + int sequenceId = -1; + + if (!_vm->_timers[3]) { + _vm->_timers[3] = getRightTongueActionTicks(); + if (_rightTongueEnergy >= _leftTongueEnergy) { + switch (_vm->getRandom(5)) { + case 0: + sequenceId = 0xBE; + break; + case 1: + sequenceId = 0xBE; + break; + case 2: + sequenceId = 0xBB; + break; + case 3: + sequenceId = 0xBB; + break; + case 4: + sequenceId = 0xBB; + break; + } + } else { + switch (_vm->getRandom(4)) { + case 0: + sequenceId = 0xBE; + break; + case 1: + sequenceId = 0xBB; + break; + case 2: + sequenceId = 0xBE; + break; + case 3: + sequenceId = 0xBE; + break; + } + } + } + + return sequenceId; +} + +void Scene50::updateAnimations() { + if (!_vm->_timers[4]) + _attackCounter = 0; + + if (_vm->_gameSys->getAnimationStatus(5) == 2) { + if (_rightTongueSequenceId == 0xBE) { + if (_leftTongueSequenceId != 0xB3 && _leftTongueSequenceId != 0xB8) + _rightTongueNextSequenceId = 0xBF; + else + _rightTongueNextSequenceId = 0xC0; + } + if (_rightTongueNextSequenceId == -1) + _rightTongueNextSequenceId = 0xC2; + if (_rightTongueNextSequenceId == 0xBF) { + _leftTongueNextId = getLeftTongueNextId(); + _rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(_rightTongueNextSequenceId, _rightTongueNextId, 5); + _vm->_gameSys->setAnimation(0xB9, _leftTongueNextId, 6); + _vm->_gameSys->insertSequence(_rightTongueNextSequenceId, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xB9, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncExists, 0, 0, 0); + _rightTongueSequenceId = _rightTongueNextSequenceId; + _rightTongueNextSequenceId = -1; + _leftTongueSequenceId = 0xB9; + _leftTongueNextSequenceId = -1; + _rightTongueId = _rightTongueNextId; + _leftTongueId = _leftTongueNextId; + _leftTongueEnergy -= _vm->getRandom(2) + 1;//CHECKME + } else { + _rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(_rightTongueNextSequenceId, _rightTongueNextId, 5); + _vm->_gameSys->insertSequence(_rightTongueNextSequenceId, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncWait, 0, 0, 0); + _rightTongueSequenceId = _rightTongueNextSequenceId; + _rightTongueNextSequenceId = -1; + _rightTongueId = _rightTongueNextId; + } + } + + if (_vm->_gameSys->getAnimationStatus(6) == 2) { + if (_leftTongueSequenceId == 0xB6) { + ++_attackCounter; + if (_timesPlayedModifier + 3 <= _attackCounter) { + _leftTongueNextSequenceId = 0xB8; + } else { + _vm->_timers[4] = 20; + //CHECKME + if (_rightTongueSequenceId != 0xBB && _rightTongueSequenceId != 0xC0 && _vm->getRandom(8) != _roundNum) + _leftTongueNextSequenceId = 0xB7; + else + _leftTongueNextSequenceId = 0xB8; + } + } + if (_leftTongueNextSequenceId == 0xB3) + --_attackCounter; + if (_leftTongueNextSequenceId == -1) + _leftTongueNextSequenceId = 0xBA; + if (_leftTongueNextSequenceId == 0xB7) { + _leftTongueNextId = getLeftTongueNextId(); + _rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(_leftTongueNextSequenceId, _leftTongueNextId, 6); + _vm->_gameSys->setAnimation(0xC1, _rightTongueNextId, 5); + _vm->_gameSys->insertSequence(_leftTongueNextSequenceId, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xC1, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncExists, 0, 0, 0); + _leftTongueSequenceId = _leftTongueNextSequenceId; + _leftTongueNextSequenceId = -1; + _rightTongueSequenceId = 0xC1; + _rightTongueNextSequenceId = -1; + _rightTongueId = _rightTongueNextId; + _leftTongueId = _leftTongueNextId; + --_rightTongueEnergy; + } else if (_leftTongueNextSequenceId != 0xB8 || _rightTongueSequenceId != 0xC2) { + _leftTongueNextId = getLeftTongueNextId(); + _vm->_gameSys->setAnimation(_leftTongueNextSequenceId, _leftTongueNextId, 6); + _vm->_gameSys->insertSequence(_leftTongueNextSequenceId, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0); + _leftTongueSequenceId = _leftTongueNextSequenceId; + _leftTongueNextSequenceId = -1; + _leftTongueId = _leftTongueNextId; + } else { + _leftTongueNextId = getLeftTongueNextId(); + _rightTongueNextId = getRightTongueNextId(); + _vm->_gameSys->setAnimation(0xBB, _rightTongueNextId, 5); + _vm->_gameSys->setAnimation(_leftTongueNextSequenceId, _leftTongueNextId, 6); + _vm->_gameSys->insertSequence(_leftTongueNextSequenceId, _leftTongueNextId, _leftTongueSequenceId, _leftTongueId, kSeqSyncWait, 0, 0, 0); + _vm->_gameSys->insertSequence(0xBB, _rightTongueNextId, _rightTongueSequenceId, _rightTongueId, kSeqSyncExists, 0, 0, 0); + _rightTongueSequenceId = 0xBB; + _rightTongueId = _rightTongueNextId; + _rightTongueNextSequenceId = -1; + _leftTongueSequenceId = _leftTongueNextSequenceId; + _leftTongueNextSequenceId = -1; + _leftTongueId = _leftTongueNextId; + } + } +} + +int Scene50::getRightTongueActionTicks() { + return 15 - 5 * _roundNum + 1; +} + +int Scene50::getLeftTongueNextId() { + _leftTongueNextIdCtr = (_leftTongueNextIdCtr + 1) % 3; + return _leftTongueNextIdCtr + 100; +} + +int Scene50::getRightTongueNextId() { + _rightTongueNextIdCtr = (_rightTongueNextIdCtr + 1) % 3; + return _rightTongueNextIdCtr + 100; +} + +void Scene50::playWinBadgeAnim(int tongueNum) { + int sequenceId; + + if (tongueNum == 1) { + if (_leftTongueRoundsWon == 1) + sequenceId = 0xC3; + else + sequenceId = 0xC4; + } else { + if (_rightTongueRoundsWon == 1) + sequenceId = 0xC5; + else + sequenceId = 0xC6; + } + + _vm->_gameSys->setAnimation(sequenceId, 120, 7); + _vm->_gameSys->insertSequence(sequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + waitForAnim(7); +} + +void Scene50::run() { + ++_timesPlayed; + _timesPlayedModifier = _timesPlayed / 4; + _leftTongueRoundsWon = 0; + _rightTongueRoundsWon = 0; + // initFont(); + _leftTongueSequenceId = 186; + _rightTongueSequenceId = 194; + _rightTongueNextSequenceId = -1; + _leftTongueNextSequenceId = -1; + _leftTongueId = 100; + _rightTongueId = 100; + + _vm->_gameSys->setAnimation(194, 100, 5); + _vm->_gameSys->setAnimation(_leftTongueSequenceId, _leftTongueId, 6); + _vm->_gameSys->insertSequence(_leftTongueSequenceId, _leftTongueId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(_rightTongueSequenceId, _rightTongueId, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->insertSequence(172, 140, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + + initRound(); + + _roundNum = 1; + + _vm->setGrabCursorSprite(-1); + _vm->hideCursor(); + + // TODO delayTicksA(1, 7); + + playRoundAnim(_roundNum); + + _vm->_timers[5] = 15; + + while (!_fightDone) { + /* TODO + if (sceneXX_sub_4466B1()) + _fightDone = true; + */ + + int playerSequenceId = checkInput(); + if (playerSequenceId != -1) + _leftTongueNextSequenceId = playerSequenceId; + + int rightSequenceId = getRightTongueAction(); + if (rightSequenceId != -1) + _rightTongueNextSequenceId = rightSequenceId; + + updateAnimations(); + + if (updateCountdown() || + updateEnergyBars(_leftTongueEnergy, _rightTongueEnergy)) { + bool v0; + if (_rightTongueEnergy < _leftTongueEnergy) + v0 = tongueWinsRound(1); + else + v0 = tongueWinsRound(2); + if (v0) { + delayTicks(); + _fightDone = true; + } else { + ++_roundNum; + initRound(); + playTonguesIdle(); + updateEnergyBars(_leftTongueEnergy, _rightTongueEnergy); + playRoundAnim(_roundNum); + _vm->_timers[5] = 15; + } + } + _vm->gameUpdateTick(); + } + + // freeFont(); + + _vm->_gameSys->setAnimation(0, 0, 7); + _vm->_gameSys->setAnimation(0, 0, 6); + _vm->_gameSys->setAnimation(0, 0, 5); + _vm->_gameSys->setAnimation(0, 0, 3); + + _vm->showCursor(); +} + +/*****************************************************************************/ + +static const int kDigitSequenceIds[] = { + 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, + 0xCF, 0xD0, 0xD1, 0xD2, 0xD3 +}; + +static const int kDigitPositions[4] = { + 0, 34, 83, 119 +}; + +/* + 0xBA Falling banana peel + 0xBC Banana peel goes away + 0xBD Falling coin + 0xBE Fallen coin + 0xC0 Falling banknote + 0xB6 Platypus tripping (right) + 0xB7 Platypus tripping (left) + 0x76 Platypus jumping (right) +*/ + +Scene51::Scene51(GnapEngine *vm) : Scene(vm) { + _dropLoseCash = false; + + _cashAmount = -1; + _guySequenceId = -1; + _guyNextSequenceId = -1; + _itemsCaughtCtr = -1; + _dropSpeedTicks = -1; + _nextDropItemKind = -1; + _itemInsertX = -1; + _itemInsertDirection = -1; + _platypusSequenceId = -1; + _platypusNextSequenceId = -1; + _platypusJumpSequenceId = -1; + _itemsCtr = -1; + _itemsCtr1 = -1; + _itemsCtr2 = -1; + + for (int i = 0; i < 4; i++) { + _digits[i] = 0; + _digitSequenceIds[4] = -1; + } + + for (int i = 0; i < 6; i++) { + _items[i]._currSequenceId = -1; + _items[i]._droppedSequenceId; + _items[i]._x = 0; + _items[i]._y = 0; + _items[i]._collisionX; + _items[i]._canCatch = false; + _items[i]._isCollision = false; + _items[i]._x2 = 0; + _items[i]._id = -1; + } +} + +int Scene51::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + for (int i = 0; i < 6; ++i) + _vm->_gameSys->setAnimation(0, 0, i + 1); + return 0xD4; +} + +void Scene51::updateHotspots() { + _vm->_hotspotsCount = 0; +} + +void Scene51::clearItem(Scene51Item *item) { + item->_currSequenceId = 0; + item->_droppedSequenceId = 0; + item->_x = 0; + item->_y = 0; + item->_x2 = 0; + item->_collisionX = 0; + item->_canCatch = false; +} + +void Scene51::dropNextItem() { + if (_vm->_timers[0]) + return; + + int index = 0; + while (index < 6 && _items[index]._currSequenceId) + ++index; + + if (index == 6) + return; + + switch (_nextDropItemKind) { + case 0: + if (_vm->getRandom(10) != 0 || _itemsCtr2 >= 2) { + _items[index]._currSequenceId = 0xBD; + } else { + --_itemsCtr1; + _items[index]._currSequenceId = 0xBA; + ++_itemsCtr2; + } + break; + + case 1: + if (_vm->getRandom(8) != 0 || _itemsCtr2 >= 2) { + if (_vm->getRandom(5) == 0) { + if (_itemInsertDirection) + _itemInsertX -= 70; + else + _itemInsertX += 70; + } + _items[index]._currSequenceId = 0xBD; + } else { + --_itemsCtr1; + _items[index]._currSequenceId = 0xBA; + ++_itemsCtr2; + } + break; + + case 2: + if (_vm->getRandom(6) != 0 || _itemsCtr2 >= 2) { + _items[index]._currSequenceId = 0xBD; + } else { + --_itemsCtr1; + _items[index]._currSequenceId = 0xBA; + ++_itemsCtr2; + } + break; + + case 3: + case 4: + if (_itemsCtr == 0) + _itemsCtr1 = 3; + _items[index]._currSequenceId = 0xC0; + break; + + case 5: + case 6: + if (_vm->getRandom(5) != 0 || _itemsCtr2 >= 2) { + if (_vm->getRandom(5) != 0) + _items[index]._currSequenceId = 0xBD; + else + _items[index]._currSequenceId = 0xC0; + } else { + --_itemsCtr1; + _items[index]._currSequenceId = 0xBA; + ++_itemsCtr2; + } + break; + + case 7: + if (_vm->getRandom(5) != 0 || _itemsCtr2 >= 2) { + if (_vm->getRandom(5) == 0) { + if (_itemInsertDirection) + _itemInsertX -= 40; + else + _itemInsertX += 40; + } + if (_vm->getRandom(9) != 0) + _items[index]._currSequenceId = 0xBD; + else + _items[index]._currSequenceId = 0xC0; + } else { + --_itemsCtr1; + _items[index]._currSequenceId = 0xBA; + ++_itemsCtr2; + } + break; + + default: + if (_vm->getRandom(4) != 0 || _itemsCtr2 >= 2) { + if (_vm->getRandom(9) != 0) + _items[index]._currSequenceId = 0xBD; + else + _items[index]._currSequenceId = 0xC0; + } else { + --_itemsCtr1; + _items[index]._currSequenceId = 0xBA; + ++_itemsCtr2; + } + break; + } + + if (_itemInsertDirection) { + _itemInsertX -= 73; + if (_itemInsertX < 129) { + _itemInsertX += 146; + _itemInsertDirection = 0; + } + } else { + _itemInsertX += 73; + if (_itemInsertX > 685) { + _itemInsertX -= 146; + _itemInsertDirection = 1; + } + } + + if (_itemInsertX > 685) + _itemInsertX = 685; + + if (_itemInsertX < 129) + _itemInsertX = 129; + + if (_items[index]._currSequenceId == 0xBA) { + _items[index]._x2 = _vm->getRandom(350) + 200; + _items[index]._x = _items[index]._x2 - 362; + _items[index]._y = 15; + _items[index]._id = 249 - index; + } else { + _items[index]._collisionX = _itemInsertX; + _items[index]._x = _items[index]._collisionX - 395; + if (_items[index]._currSequenceId == 0xC0) + _items[index]._x -= 65; + _items[index]._id = index + 250; + _items[index]._canCatch = true; + } + + _vm->_gameSys->setAnimation(_items[index]._currSequenceId, _items[index]._id, index + 1); + _vm->_gameSys->insertSequence(_items[index]._currSequenceId, _items[index]._id, 0, 0, + kSeqNone, 0, _items[index]._x, _items[index]._y); + + _vm->_timers[0] = _dropSpeedTicks; + + if (_nextDropItemKind >= 3) + _vm->_timers[0] = 20; + + if (_nextDropItemKind >= 5) + _vm->_timers[0] = 5; + + if (_nextDropItemKind == 8) + _vm->_timers[0] = 4; + + ++_itemsCtr; +} + +void Scene51::updateItemAnimations() { + for (int i = 0; i < 6; ++i) { + if (_vm->_gameSys->getAnimationStatus(i + 1) == 2) + updateItemAnimation(&_items[i], i); + } +} + +int Scene51::checkCollision(int sequenceId) { + bool jumpingLeft = false, jumpingRight = false; + int v8, v4; + int result = 0; + + if (!isJumping(sequenceId)) + return false; + + bool checkFl = false; + for (int i = 0; i < 6; i++) + checkFl |= _items[i]._isCollision; + + if (!checkFl) + return false; + + if (isJumpingRight(sequenceId)) { + v8 = getPosRight(sequenceId); + v4 = getPosRight(sequenceId + 1); + jumpingRight = true; + } else if (isJumpingLeft(sequenceId)) { + v4 = getPosLeft(sequenceId - 1) + 33; + v8 = getPosLeft(sequenceId) + 33; + jumpingLeft = true; + } + + if (jumpingRight || jumpingLeft) { + int v5 = 0; + int i; + for (i = 0; i < 6; ++i) { + if (_items[i]._isCollision) { + if (jumpingRight && _items[i]._x2 > v8 && _items[i]._x2 < v4) { + v5 = v8 - 359; + if (v5 == 0) + v5 = 1; + _platypusNextSequenceId = 0xB6; + break; + } else if (jumpingLeft && _items[i]._x2 < v4 && _items[i]._x2 > v8) { + v5 = v8 - 344; + if (v5 == 0) + v5 = 1; + _platypusNextSequenceId = 0xB7; + break; + } + } + } + if (v5) { + _vm->_gameSys->setAnimation(0xBC, _items[i]._id, i + 1); + _vm->_gameSys->insertSequence(0xBC, _items[i]._id, _items[i]._currSequenceId, _items[i]._id, kSeqSyncWait, 0, _items[i]._x, 15); + _items[i]._isCollision = false; + _items[i]._currSequenceId = 0xBC; + --_itemsCtr2; + } + result = v5; + } + + return result; +} + +void Scene51::updateItemAnimation(Scene51Item *item, int index) { + + switch (item->_currSequenceId) { + case 0xBD: + case 0xC0: + case 0xC1: + // Falling coin and banknote + if (!itemIsCaught(item)) { + if (_dropLoseCash) { + if (item->_currSequenceId == 0xBD) + _cashAmount -= 2; + else + _cashAmount -= 25; + if (_cashAmount < 0) + _cashAmount = 0; + updateCash(_cashAmount); + } + item->_droppedSequenceId = item->_currSequenceId + 1; + if (item->_currSequenceId != 0xC0) { + item->_canCatch = false; + _dropLoseCash = true; + _itemsCtr = 0; + _vm->_timers[0] = 10; + } + if (item->_droppedSequenceId) { + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; + } + } else { + _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); + _vm->_gameSys->setAnimation(0, 0, index + 1); + _vm->playSound(218, false); + if (incCashAmount(item->_currSequenceId) == 1995) { + winMinigame(); + _vm->_sceneDone = true; + } else { + clearItem(item); + ++_itemsCaughtCtr; + if (_itemsCaughtCtr == 5) + --_dropSpeedTicks; + if (_itemsCaughtCtr == 8) + --_dropSpeedTicks; + if (_itemsCaughtCtr == 11) + --_dropSpeedTicks; + if (_itemsCaughtCtr == 14) + --_dropSpeedTicks; + if (_itemsCaughtCtr >= 15 && _dropSpeedTicks > 4) + --_dropSpeedTicks; + if (_itemsCtr1 <= _itemsCaughtCtr) { + ++_nextDropItemKind; + _dropSpeedTicks = 10; + _itemsCtr = 0; + _itemsCtr1 = 20; + _dropLoseCash = false; + _itemsCaughtCtr = 0; + removeCollidedItems(); + } + } + } + break; + + case 0xBE: + // Fallen coin + item->_droppedSequenceId = item->_currSequenceId + 1; + if (item->_droppedSequenceId) { + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; + } + break; + + case 0xBF: + case 0xC2: + // Bouncing coin and banknote + _vm->_gameSys->setAnimation(0, 0, index + 1); + _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); + clearItem(item); + break; + + case 0xBA: + // Falling banana peel + item->_droppedSequenceId = 0xBB; + item->_y = 15; + if (item->_droppedSequenceId) { + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; + } + break; + + case 0xBB: + item->_isCollision = true; + item->_droppedSequenceId = 0; + _vm->_gameSys->setAnimation(0, 0, index + 1); + break; + + case 0xBC: + _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); + _vm->_gameSys->setAnimation(0, 0, index + 1); + clearItem(item); + break; + + default: + if (item->_droppedSequenceId) { + _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); + _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); + item->_currSequenceId = item->_droppedSequenceId; + item->_y = 0; + } + break; + } +} + +void Scene51::removeCollidedItems() { + for (int i = 0; i < 6; ++i) { + if (_items[i]._isCollision) { + _vm->_gameSys->removeSequence(_items[i]._currSequenceId, _items[i]._id, true); + _vm->_gameSys->setAnimation(0, 0, i + 1); + clearItem(&_items[i]); + } + } + _itemsCtr2 = 0; +} + +int Scene51::itemIsCaught(Scene51Item *item) { + if (!item->_canCatch) + return 0; + + if (isJumpingRight(_platypusJumpSequenceId)) { + int v4 = getPosRight(_platypusJumpSequenceId) + 97; + if (item->_collisionX < v4 && v4 - item->_collisionX < 56) + return 1; + } else { + int v2 = getPosLeft(_platypusJumpSequenceId); + if (item->_collisionX > v2 && item->_collisionX - v2 < 56) + return 1; + } + + if (item->_currSequenceId == 0xC1) { + int v3 = item->_collisionX + 100; + if (isJumpingRight(_platypusJumpSequenceId)) { + if (ABS(getPosRight(_platypusJumpSequenceId) + 46 - v3) < 56) + return 1; + } else if (ABS(getPosLeft(_platypusJumpSequenceId) + 46 - v3) < 56) { + return 1; + } + } + + return 0; +} + +bool Scene51::isJumpingRight(int sequenceId) { + return sequenceId >= 0x76 && sequenceId <= 0x95; +} + +bool Scene51::isJumpingLeft(int sequenceId) { + return sequenceId >= 0x96 && sequenceId <= 0xB5; +} + +bool Scene51::isJumping(int sequenceId) { + return sequenceId >= 0x76 && sequenceId <= 0xB5; +} + +void Scene51::waitForAnim(int animationIndex) { + while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { + // pollMessages(); + updateItemAnimations(); + _vm->gameUpdateTick(); + } +} + +int Scene51::getPosRight(int sequenceId) { + static const int kRightPosTbl[] = { + 131, 159, 178, 195, 203, 219, 238, 254, + 246, 274, 293, 310, 318, 334, 353, 369, + 362, 390, 409, 426, 434, 450, 469, 485, + 477, 505, 524, 541, 549, 565, 584, 600 + }; + + if (sequenceId >= 118 && sequenceId <= 149) + return kRightPosTbl[sequenceId - 118]; + return -1; +} + +int Scene51::getPosLeft(int sequenceId) { + static const int kLeftPosTbl[] = { + 580, 566, 550, 536, 526, 504, 488, 469, + 460, 446, 430, 416, 406, 384, 368, 349, + 342, 328, 312, 298, 288, 266, 250, 231, + 220, 206, 190, 176, 166, 144, 128, 109 + }; + + if (sequenceId >= 150 && sequenceId <= 181) + return kLeftPosTbl[sequenceId - 150]; + return -1; +} + +void Scene51::playIntroAnim() { + int soundCtr = 0; + + _platypusSequenceId = 0x76; + _platypusNextSequenceId = 0x76; + + for (int i = 0; i < 6; ++i) + clearItem(&_items[i]); + + _items[0]._currSequenceId = 0xBA; + _items[0]._x2 = 320; + _items[0]._x = -42; + _items[0]._y = 15; + _items[0]._id = 249; + _items[0]._isCollision = true; + + _vm->_gameSys->insertSequence(_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0); + _vm->_gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _items[0]._x, _items[0]._y); + _vm->_gameSys->setAnimation(0xBA, 249, 1); + _vm->_gameSys->setAnimation(_platypusSequenceId, 256, 0); + + while (_platypusSequenceId < 0x80) { + waitForAnim(0); + ++_platypusNextSequenceId; + _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, -179, 0); + _platypusSequenceId = _platypusNextSequenceId; + ++soundCtr; + if (soundCtr % 4 == 0) + _vm->playSound(214, false); + } + + _platypusNextSequenceId = 0x75; + + while (_platypusSequenceId != 0x84) { + waitForAnim(0); + ++_platypusNextSequenceId; + int oldSequenceId = _platypusNextSequenceId; + int v0 = checkCollision(_platypusNextSequenceId); + _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, v0, 0); + _platypusSequenceId = _platypusNextSequenceId; + if (v0) { + _platypusNextSequenceId = oldSequenceId; + } else { + ++soundCtr; + if (soundCtr % 4 == 0) + _vm->playSound(214, false); + } + } + waitForAnim(0); +} + +void Scene51::updateGuyAnimation() { + if (!_vm->_timers[4]) { + _vm->_timers[4] = _vm->getRandom(20) + 60; + + switch (_vm->getRandom(5)) { + case 0: + _guyNextSequenceId = 0xC3; + break; + case 1: + _guyNextSequenceId = 0xC4; + break; + case 2: + _guyNextSequenceId = 0xC5; + break; + case 3: + _guyNextSequenceId = 0xC6; + break; + case 4: + _guyNextSequenceId = 0xC7; + break; + } + + _vm->_gameSys->insertSequence(_guyNextSequenceId, 39, _guySequenceId, 39, kSeqSyncWait, 0, 0, 0); + _guySequenceId = _guyNextSequenceId; + _guyNextSequenceId = -1; + } +} + +int Scene51::incCashAmount(int sequenceId) { + switch (sequenceId) { + case 0xBD: + _cashAmount += 10; + break; + case 0xC0: + case 0xC1: + _cashAmount += 100; + break; + case 0xB6: + case 0xB7: + _cashAmount -= 10 * _vm->getRandom(5) + 50; + if (_cashAmount < 0) + _cashAmount = 0; + break; + } + if (_cashAmount > 1995) + _cashAmount = 1995; + updateCash(_cashAmount); + return _cashAmount; +} + +void Scene51::winMinigame() { + updateCash(1995); + _vm->playSound(218, false); + // TODO delayTicksA(1, 5); + _vm->_newSceneNum = 48; + _vm->invRemove(kItemBanana); +} + +void Scene51::playCashAppearAnim() { + _vm->_gameSys->setAnimation(0xC8, 252, 0); + _vm->_gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + _vm->gameUpdateTick(); + // checkGameAppStatus(); + } +} + +void Scene51::updateCash(int amount) { + drawDigit(amount / 1000, 0); + drawDigit(amount / 100 % 10, 1); + drawDigit(amount / 10 % 10, 2); + drawDigit(amount % 10, 3); +} + +void Scene51::drawDigit(int digit, int position) { + if (digit != _digits[position]) { + _vm->_gameSys->insertSequence(kDigitSequenceIds[digit], 253, + _digitSequenceIds[position], 253, + kSeqSyncWait, 0, kDigitPositions[position] - 20, -20); + _digitSequenceIds[position] = kDigitSequenceIds[digit]; + _digits[position] = digit; + } +} + +void Scene51::initCashDisplay() { + for (int position = 0; position < 4; ++position) { + _digits[position] = 0; + _digitSequenceIds[position] = kDigitSequenceIds[0]; + _vm->_gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0, + kSeqNone, 0, kDigitPositions[position] - 20, -20); + } + _cashAmount = 0; +} + +void Scene51::run() { + int soundCtr = 0; + bool isIdle = true; + + _itemsCtr = 0; + _vm->_newSceneNum = _vm->_prevSceneNum; + _cashAmount = 0; + _platypusJumpSequenceId = 0x84; + _vm->endSceneInit(); + + _vm->hideCursor(); + _vm->setGrabCursorSprite(-1); + + _guySequenceId = 0xC3; + _guyNextSequenceId = -1; + + _vm->_gameSys->insertSequence(0xC3, 39, 0, 0, kSeqNone, 0, 0, 0); + _vm->_timers[4] = _vm->getRandom(20) + 60; + + playCashAppearAnim(); + initCashDisplay(); + playIntroAnim(); + + _platypusNextSequenceId = 0x74; + _vm->_gameSys->setAnimation(0x74, 256, 0); + _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 362, 0); + _platypusSequenceId = _platypusNextSequenceId; + + _itemInsertDirection = 0; + _itemInsertX = 685; + _dropSpeedTicks = 10; + _nextDropItemKind = 0; + + for (int i = 0; i < 6; ++i) + clearItem(&_items[i]); + + _itemInsertX = _vm->getRandom(556) + 129; + _vm->_timers[0] = 15; + + _itemsCaughtCtr = 0; + _dropLoseCash = false; + _itemsCtr1 = 20; + + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + + bool isCollision = false; + bool startWalk = true; + + while (!_vm->_sceneDone) { + if (clearKeyStatus()) + _vm->_sceneDone = true; + + _vm->gameUpdateTick(); + + updateGuyAnimation(); + dropNextItem(); + updateItemAnimations(); + + if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + if (isJumpingRight(_platypusJumpSequenceId)) { + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB8, 256, 0); + _vm->_gameSys->insertSequence(0xB8, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 348, 0); + _platypusSequenceId = 0xB8; + waitForAnim(0); + _platypusNextSequenceId += 6; + if (_platypusNextSequenceId > 0x95) + _platypusNextSequenceId = 0x95; + _platypusJumpSequenceId = _platypusNextSequenceId; + } else { + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB9, 256, 0); + _vm->_gameSys->insertSequence(0xB9, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_platypusJumpSequenceId) - 338, 0); + _platypusSequenceId = 0xB9; + waitForAnim(0); + _platypusNextSequenceId += 6; + if (_platypusNextSequenceId > 0xB5) + _platypusNextSequenceId = 0xB5; + _platypusJumpSequenceId = _platypusNextSequenceId; + } + isIdle = false; + } + + while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT) && _platypusNextSequenceId != 0x96) { + // pollMessages(); + if (_platypusNextSequenceId == 0xB6) + _platypusNextSequenceId = 0x76; + updateItemAnimations(); + if (startWalk) { + _platypusNextSequenceId = 0x86; + startWalk = false; + } + + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + int collisionX = checkCollision(_platypusNextSequenceId); + if (collisionX) + incCashAmount(_platypusNextSequenceId); + _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); + _platypusSequenceId = _platypusNextSequenceId; + if (collisionX) { + isCollision = true; + ++_platypusJumpSequenceId; + _platypusNextSequenceId = _platypusJumpSequenceId; + } else { + _platypusJumpSequenceId = _platypusNextSequenceId; + } + if (isJumpingRight(_platypusJumpSequenceId)) { + ++_platypusNextSequenceId; + if (!isCollision) { + if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB8, 256, 0); + _vm->_gameSys->insertSequence(0xB8, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 348, 0); + _platypusSequenceId = 0xB8; + waitForAnim(0); + _platypusNextSequenceId += 6; + if (_platypusNextSequenceId > 0x95) + _platypusNextSequenceId = 0x95; + _platypusJumpSequenceId = _platypusNextSequenceId; + } else { + ++soundCtr; + if (soundCtr % 4 == 0) + _vm->playSound(214, false); + } + } + } else { + _platypusNextSequenceId = 150 - (_platypusJumpSequenceId - 150); + } + isCollision = false; + isIdle = false; + } + _vm->gameUpdateTick(); + } + + while (_vm->isKeyStatus2(Common::KEYCODE_LEFT) && _platypusNextSequenceId != 0xB6) { + // pollMessages(); + updateItemAnimations(); + if (startWalk) { + _platypusNextSequenceId = 0xA5; + startWalk = false; + } + + if (_vm->_gameSys->getAnimationStatus(0) == 2) { + int collisionX = checkCollision(_platypusNextSequenceId); + if (collisionX) + incCashAmount(_platypusNextSequenceId); + _vm->_gameSys->setAnimation(_platypusNextSequenceId, 256, 0); + _vm->_gameSys->insertSequence(_platypusNextSequenceId, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); + _platypusSequenceId = _platypusNextSequenceId; + if (collisionX) { + isCollision = true; + ++_platypusJumpSequenceId; + _platypusNextSequenceId = _platypusJumpSequenceId; + } else { + _platypusJumpSequenceId = _platypusNextSequenceId; + } + if (isJumpingLeft(_platypusJumpSequenceId)) { + ++_platypusNextSequenceId; + if (!isCollision) { + if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + waitForAnim(0); + _vm->_gameSys->setAnimation(0xB9, 256, 0); + _vm->_gameSys->insertSequence(0xB9, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_platypusJumpSequenceId) - 338, 0); + _platypusSequenceId = 0xB9; + waitForAnim(0); + _platypusNextSequenceId += 6; + if (_platypusNextSequenceId > 0xB5) + _platypusNextSequenceId = 0xB5; + _platypusJumpSequenceId = _platypusNextSequenceId; + } else { + ++soundCtr; + if (soundCtr % 4 == 0) + _vm->playSound(214, false); + } + } + } else { + _platypusNextSequenceId = 182 - (_platypusJumpSequenceId - 118); + } + isCollision = false; + isIdle = false; + } + _vm->gameUpdateTick(); + } + + if (!isIdle && _vm->_gameSys->getAnimationStatus(0) == 2) { + if (isJumpingRight(_platypusJumpSequenceId)) { + _vm->_gameSys->setAnimation(0x74, 256, 0); + _vm->_gameSys->insertSequence(0x74, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_platypusJumpSequenceId) - 362, 0); + _platypusSequenceId = 0x74; + } else { + _vm->_gameSys->setAnimation(0x75, 256, 0); + _vm->_gameSys->insertSequence(0x75, 256, _platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_platypusJumpSequenceId) - 341, 0); + _platypusSequenceId = 0x75; + } + waitForAnim(0); + isIdle = true; + } + } + + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + + _vm->_gameSys->setAnimation(0, 0, 0); + for (int i = 0; i < 6; ++i) + _vm->_gameSys->setAnimation(0, 0, i + 1); + + _vm->showCursor(); +} + +/*****************************************************************************/ + +Scene52::Scene52(GnapEngine *vm) : Scene(vm) { + _gameScore = 0; + _aliensInitialized = false; + _alienDirection = 0; + _soundToggle = false; +} + +int Scene52::init() { + initAnims(); + return 0x2B; +} + +void Scene52::updateHotspots() { + _vm->_hotspotsCount = 0; +} + +void Scene52::update() { + for (int rowNum = 0; rowNum < 7; ++rowNum) { + _vm->gameUpdateTick(); + if (_vm->_gameSys->getAnimationStatus(_alienRowAnims[rowNum]) == 2) { + updateAlienRow(rowNum); + rowNum = 0; + } + } + + if (_liveAlienRows == 0 && !_alienSingle) { + _alienWave = false; + _vm->playSound(48, false); + ++_alienCounter; + if (_alienCounter != 3) { + _vm->_timers[0] = 50; + _vm->_timers[2] = 100; + _alienRowDownCtr = 0; + _alienSingle = true; + } + } + + if (_alienSingle && !_vm->_timers[0]) { + initAliens(); + _alienSingle = false; + _vm->_timers[2] = 5; + _alienWave = true; + } + + if ((_alienRowDownCtr || _liveAlienRows == 0) && !_alienSingle) { + moveDownAlienRow(); + _alienRowDownCtr = 0; + } + + if (_vm->isKeyStatus1(Common::KEYCODE_UP) || _vm->isKeyStatus1(Common::KEYCODE_SPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + if (!_aliensCount) + fireShipCannon(_shipPosX); + } + + if (_shipCannonFiring) + updateShipCannon(); + + fireAlienCannon(); + updateAlienCannons(); + + if (_aliensCount == 1) { + _alienWave = false; + _vm->_timers[3] = 20; + _vm->_timers[2] = 100; + ++_aliensCount; + } + + if (_aliensCount && !_vm->_timers[3]) { + updateAliens(); + loseShip(); + if (_shipsLeft != 0) { + _vm->_timers[3] = 40; + while (_vm->_timers[3]) { + updateAlienCannons(); + if (_shipCannonFiring) + updateShipCannon(); + _vm->gameUpdateTick(); + } + initAliens(); + _shipPosX = (800 - _shipMidX) / 2; + _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _shipPosX, _arcadeScreenBottom); + _ufoSequenceId = _nextUfoSequenceId; + _vm->_timers[2] = 5; + _alienWave = true; + } else { + _vm->_sceneDone = true; + } + } + + if (_vm->_timers[1] || getFreeShipCannon() == -1) { + _nextUfoSequenceId = 34; + if (_ufoSequenceId != 34) + _shipFlag = true; + } else { + _nextUfoSequenceId = 34; + if (_ufoSequenceId != 34) + _shipFlag = true; + } + + if (_shipFlag) { + if (_vm->_gameSys->getAnimationStatus(7) == 2) { + _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom); + _ufoSequenceId = _nextUfoSequenceId; + } + _shipFlag = false; + } + + if (_alienWave && !_vm->_timers[0]) { + playSound(); + int v0 = _alienSpeed; + if (_alienSpeed >= 10) + v0 = 10; + int v1 = v0; + if (v0 < 2) + v1 = 2; + _vm->_timers[0] = v1; + } +} + +void Scene52::initShipCannon(int bottomY) { + _shipCannonFired = false; + _shipCannonWidth = MAX(_vm->_gameSys->getSpriteWidthById(14), _vm->_gameSys->getSpriteWidthById(16)); + _shipCannonHeight = MAX(_vm->_gameSys->getSpriteHeightById(14), _vm->_gameSys->getSpriteHeightById(16)); + _shipCannonTopY = bottomY - _shipCannonHeight; + _shipCannonFiring = false; +} + +void Scene52::initAlienCannons() { + for (int i = 0; i < 3; ++i) { + _alienCannonIds[i] = 0; + _alienCannonFired[i] = 0; + } + _alienCannonSequenceIds[0] = 30; + _alienCannonSequenceIds[1] = 31; + _alienCannonSequenceIds[2] = 32; +} + +void Scene52::fireShipCannon(int posX) { + if (_vm->_timers[1]) + return; + + int cannonNum = getFreeShipCannon(); + if (cannonNum != -1) { + _shipCannonPosX = _shipMidX / 2 + posX - _shipCannonWidth / 2; + _shipCannonPosY = _shipCannonTopY; + _vm->_gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8); + _vm->_gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _shipCannonPosX, _shipCannonPosY); + _vm->playSound(0x2D, false); + if (shipCannonHitShield(cannonNum)) { + _vm->_gameSys->setAnimation(0, 0, cannonNum + 8); + _vm->_gameSys->removeSequence(0x23, cannonNum + 256, true); + } else { + _shipCannonFired = true; + _shipCannonPosY -= 13; + _shipCannonFiring = true; + } + _vm->_timers[1] = 5; + } +} + +void Scene52::fireAlienCannon() { + if (_vm->_timers[2]) + return; + + int cannonNum = getFreeAlienCannon(); + if (cannonNum != -1) { + int alienX1 = _alienLeftX + _alienRowXOfs[0]; + int alienX2 = _alienLeftX + _alienRowXOfs[0] + 5 * _alienWidth - (_alienWidth / 2 - 15); + _alienCannonPosX[cannonNum] = _vm->getRandom(alienX2 - alienX1) + alienX1; + _alienCannonPosY[cannonNum] = 104; + _alienCannonFired[cannonNum] = 1; + _vm->_gameSys->setAnimation(_alienCannonSequenceIds[cannonNum], _alienCannonIds[cannonNum] + 256, cannonNum + 9); + _vm->_gameSys->insertSequence(_alienCannonSequenceIds[cannonNum], _alienCannonIds[cannonNum] + 256, 0, 0, + kSeqNone, 0, _alienCannonPosX[cannonNum], _alienCannonPosY[cannonNum]); + _alienCannonPosY[cannonNum] -= 13; + _vm->_timers[2] = 5; + } +} + +int Scene52::getFreeShipCannon() { + if (!_shipCannonFired) + return 0; + return -1; +} + +int Scene52::getFreeAlienCannon() { + for (int i = 0; i < 3; ++i) + if (!_alienCannonFired[i]) + return i; + return -1; +} + +void Scene52::updateShipCannon() { + if (_shipCannonFired && _vm->_gameSys->getAnimationStatus(8) == 2) { + _shipCannonPosY -= 13; + if (_shipCannonPosY - 13 >= 135) { + if (updateHitAlien()) { + _vm->_gameSys->setAnimation(0, 0, 8); + _vm->_gameSys->removeSequence(35, 256, true); + _shipCannonFired = false; + drawScore(_gameScore); + } else { + _vm->_gameSys->setAnimation(35, 256, 8); + _vm->_gameSys->insertSequence(35, 256, 35, 256, kSeqSyncWait, 0, _shipCannonPosX, _shipCannonPosY); + _shipCannonPosY -= 13; + } + } else { + _vm->_gameSys->setAnimation(0, 0, 8); + _vm->_gameSys->removeSequence(35, 256, true); + _shipCannonFired = false; + } + } +} + +void Scene52::updateAlienCannons() { + for (int i = 0; i < 3; ++i) { + if (_alienCannonFired[i] && _vm->_gameSys->getAnimationStatus(i + 9) == 2) { + _alienCannonPosY[i] += 13; + if (_shipCannonHeight + _alienCannonPosY[i] + 13 <= 550) { + if (alienCannonHitShip(i)) { + _vm->_gameSys->setAnimation(0, 0, i + 9); + _alienCannonFired[i] = 0; + shipExplode(); + } else if (alienCannonHitShield(i)) { + _alienCannonFired[i] = 0; + } else { + _vm->_gameSys->insertSequence(_alienCannonSequenceIds[i], 1 - _alienCannonIds[i] + 256, 0, 0, + kSeqNone, 0, _alienCannonPosX[i], _alienCannonPosY[i]); + _vm->_gameSys->setAnimation(_alienCannonSequenceIds[i], 1 - _alienCannonIds[i] + 256, i + 9); + _alienCannonIds[i] = 1 - _alienCannonIds[i]; + _alienCannonPosY[i] += 13; + } + } else { + _vm->_gameSys->setAnimation(0, 0, i + 9); + _alienCannonFired[i] = 0; + } + } + } +} + +void Scene52::initAliens() { + if (!_aliensInitialized) { + initAlienSize(); + _aliensInitialized = true; + } + + _liveAlienRows = 0; + _alienSpeed = 0; + _bottomAlienFlag = false; + _aliensCount = 0; + _alienSingle = false; + _alienRowDownCtr = 0; + + initShields(); + + _alienRowKind[0] = -1; + _alienRowKind[1] = -1; + _alienRowKind[2] = -1; + _alienRowKind[3] = -1; + _alienRowKind[4] = _vm->getRandom(2) != 0 ? 24 : 27; + _alienRowKind[5] = _vm->getRandom(2) != 0 ? 25 : 28; + _alienRowKind[6] = _vm->getRandom(2) != 0 ? 26 : 29; + + for (int i = 0; i < 7; ++i) { + _alienRowAnims[i] = i; + _alienRowXOfs[i] = 0; + initAlienRowKind(i, _alienRowKind[i]); + insertAlienRow(i); + } +} + +void Scene52::initAlienRowKind(int rowNum, int alienKind) { + for (int i = 0; i < 5; ++i) + _items[rowNum][i] = alienKind; +} + +void Scene52::insertAlienRow(int rowNum) { + if (_alienRowKind[rowNum] >= 0) { + insertAlienRowAliens(rowNum); + _alienRowIds[rowNum] = 256; + _vm->_gameSys->setAnimation(_alienRowKind[rowNum], _alienRowIds[rowNum], _alienRowAnims[rowNum]); + ++_liveAlienRows; + } +} + +void Scene52::insertAlienRowAliens(int rowNum) { + int xOffs = _alienLeftX; + int yOffs = _alienTopY - 52 * rowNum - _alienHeight + 10; + for (int i = 0; i < 5; ++i) { + if (_items[rowNum][i] >= 0) { + _vm->_gameSys->insertSequence(_items[rowNum][i], i + 256, 0, 0, kSeqNone, 0, xOffs, yOffs); + ++_alienSpeed; + } + xOffs += _alienWidth; + } +} + +void Scene52::updateAlienRow(int rowNum) { + if (_alienRowKind[rowNum] != -1 && !checkAlienRow(rowNum)) { + updateAlienRowXOfs(); + _alienRowIds[rowNum] = -1; + int xOffs = _alienLeftX + _alienRowXOfs[rowNum]; + int yOffs = _alienTopY - 52 * rowNum - _alienHeight + 10; + for (int i = 0; i < 5; ++i) { + if (_items[rowNum][i] >= 0) { + _vm->_gameSys->insertSequence(_items[rowNum][i], i + 256, _items[rowNum][i], i + 256, kSeqSyncWait, 0, xOffs, yOffs); + if (_alienRowIds[rowNum] == -1) + _alienRowIds[rowNum] = i + 256; + } else if (_items[rowNum][i] == -2) { + _vm->_gameSys->removeSequence(_alienRowKind[rowNum], i + 256, true); + _items[rowNum][i] = -1; + --_alienSpeed; + } + xOffs += _alienWidth; + } + if (_alienRowIds[rowNum] == -1) { + _vm->_gameSys->setAnimation(0, 0, _alienRowAnims[rowNum]); + // MessageBoxA(0, "No live aliens!", "Error 3:", 0x30u); + } else { + _vm->_gameSys->setAnimation(_alienRowKind[rowNum], _alienRowIds[rowNum], _alienRowAnims[rowNum]); + } + if (rowNum == 1) { + for (int j = 0; j < 3; ++j) { + if (_shieldSpriteIds[j] != -1) { + _vm->_gameSys->fillSurface(0, _shieldPosX[j], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _shieldSpriteIds[j] = -1; + } + } + } + if (rowNum == 0 && _bottomAlienFlag) + shipExplode(); + } +} + +void Scene52::moveDownAlienRow() { + int v2[5], v3, v1, v0, v4; + + for (int i = 0; i < 5; ++i) + v2[i] = _items[0][i]; + + v3 = _alienRowIds[0]; + v1 = _alienRowAnims[0]; + v0 = _alienRowKind[0]; + v4 = _alienRowXOfs[0]; + + for (int j = 0; j < 7; ++j) { + for (int i = 0; i < 5; ++i) + _items[j][i] = _items[j + 1][i]; + _alienRowIds[j] = _alienRowIds[j + 1]; + _alienRowAnims[j] = _alienRowAnims[j + 1]; + _alienRowKind[j] = _alienRowKind[j + 1]; + _alienRowXOfs[j] = _alienRowXOfs[j + 1]; + } + + for (int i = 0; i < 5; ++i) + _items[6][i] = v2[i]; + + _alienRowIds[6] = v3; + _alienRowAnims[6] = v1; + _alienRowKind[6] = v0; + _alienRowXOfs[6] = v4; + + updateAlien(6); + initAlienRowKind(6, _alienRowKind[6]); + insertAlienRow(6); + + _bottomAlienFlag = _alienRowKind[0] > -1; +} + +int Scene52::updateHitAlien() { + int result = 0, rowNum, ya; + + int y = _shipCannonTopY - _shipCannonPosY; + + if (y == 26) { + rowNum = 1; + ya = _shipCannonPosY + 26; + } else { + if (y % 52) + return 0; + rowNum = y / 52 + 1; + ya = _shipCannonPosY; + } + + if (rowNum < 7) { + int hitAlienNum = getHitAlienNum(rowNum); + if (hitAlienNum != -1 && _items[rowNum][hitAlienNum] >= 0) { + _gameScore = ((_items[rowNum][hitAlienNum] - 24) % 3 + _gameScore + 1) % 1000; + _items[rowNum][hitAlienNum] = -2; + _vm->playSound(44, false); + _vm->_gameSys->insertSequence(0x21, 266, 0, 0, + kSeqNone, 0, _alienLeftX + hitAlienNum * _alienWidth + _alienRowXOfs[rowNum] - 10, ya - _alienHeight); + result = 1; + } + } + + return result; +} + +int Scene52::getHitAlienNum(int rowNum) { + int result = -1; + + int v3 = _alienLeftX + _alienRowXOfs[rowNum]; + + if (_shipCannonPosX >= v3) { + int v8 = _alienWidth / 2 - 15; + if (v3 + 5 * _alienWidth - v8 >= _shipCannonPosX) { + int v4 = v3 + _alienWidth; + if (_shipCannonPosX >= v4 - v8) { + int v5 = v4 + _alienWidth; + if (_shipCannonPosX >= v5 - v8) { + int v6 = v5 + _alienWidth; + if (_shipCannonPosX >= v6 - v8) { + int v7 = v6 + _alienWidth; + if (_shipCannonPosX >= v7 - v8) { + if (_shipCannonPosX >= v7 + _alienWidth - v8) + result = -1; + else + result = 4; + } else { + result = 3; + } + } else { + result = 2; + } + } else { + result = 1; + } + } else { + result = 0; + } + } else { + result = -1; + } + } else { + result = -1; + } + return result; +} + +int Scene52::alienCannonHitShip(int cannonNum) { + int result = 0; + + if (_aliensCount) { + result = 0; + } else { + int cannonY = _alienCannonPosY[cannonNum] - 13; + if (_arcadeScreenBottom <= cannonY) { + if (_shipMidY + _arcadeScreenBottom > cannonY) { + if (_alienCannonPosX[cannonNum] >= _shipPosX) + result = _alienCannonPosX[cannonNum] < _shipMidX + _shipPosX; + else + result = 0; + } else { + result = 0; + } + } else { + result = 0; + } + } + return result; +} + +int Scene52::alienCannonHitShield(int cannonNum) { + int result = 0; + + int v3 = _alienCannonPosY[cannonNum] + 39; + if (_arcadeScreenBottom - 44 > v3) + return 0; + + if (_arcadeScreenBottom <= v3) + return 0; + + if (_alienCannonPosX[cannonNum] < _shieldPosX[0]) + return 0; + + if (_alienCannonPosX[cannonNum] > _shieldPosX[2] + 33) + return 0; + + int shieldNum = -1; + if (_alienCannonPosX[cannonNum] < _shieldPosX[0] + 33) + shieldNum = 0; + + if (shieldNum < 0 && _alienCannonPosX[cannonNum] < _shieldPosX[1]) + return 0; + + if (shieldNum < 0 && _alienCannonPosX[cannonNum] < _shieldPosX[1] + 33) + shieldNum = 1; + + if (shieldNum < 0) { + if (_alienCannonPosX[cannonNum] < _shieldPosX[2]) + return 0; + shieldNum = 2; + } + + if (_shieldSpriteIds[shieldNum] == -1) { + result = 0; + } else { + ++_shieldSpriteIds[shieldNum]; + if (_shieldSpriteIds[shieldNum] <= 21) { + _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]); + } else { + _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _shieldSpriteIds[shieldNum] = -1; + } + _vm->_gameSys->setAnimation(0, 0, cannonNum + 9); + _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _alienCannonPosX[cannonNum] - 18, _arcadeScreenBottom - 44); + _vm->playSound(0x2C, false); + result = 1; + } + + return result; +} + +bool Scene52::shipCannonHitShield(int cannonNum) { + bool result = false; + + if (_shipCannonPosX < _shieldPosX[0]) + return result; + + if (_shipCannonPosX > _shieldPosX[2] + 33) + return result; + + int shieldNum = -1; + if (_shipCannonPosX < _shieldPosX[0] + 33) + shieldNum = 0; + + if (shieldNum < 0 && _shipCannonPosX < _shieldPosX[1]) + return result; + + if (shieldNum < 0 && _shipCannonPosX < _shieldPosX[1] + 33) + shieldNum = 1; + + if (shieldNum < 0) { + if (_shipCannonPosX < _shieldPosX[2]) + return result; + shieldNum = 2; + } + + if (_shieldSpriteIds[shieldNum] == -1) { + result = false; + } else { + ++_shieldSpriteIds[shieldNum]; + if (_shieldSpriteIds[shieldNum] <= 21) { + _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]); + } else { + _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _shieldSpriteIds[shieldNum] = -1; + } + _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _shipCannonPosX - 18, _arcadeScreenBottom - 44); + _vm->playSound(0x2C, false); + result = true; + } + + return result; +} + +bool Scene52::shipCannonHitAlien() { + bool result = false; + + if (_aliensCount || checkAlienRow(0)) + return false; + + int alienNextX = _alienLeftX + _alienRowXOfs[0]; + if (_shipMidX + _shipPosX >= alienNextX) { + int startX = _alienWidth / 2 - 15; + if (alienNextX + 5 * _alienWidth - startX >= _shipPosX) { + int alienNextDeltaX = alienNextX + _alienWidth; + if (_items[0][0] <= -1 || alienNextDeltaX - startX <= _shipPosX) { + alienNextDeltaX += _alienWidth; + if (_items[0][1] <= -1 || alienNextDeltaX - startX <= _shipPosX) { + alienNextDeltaX += _alienWidth; + if (_items[0][2] <= -1 || alienNextDeltaX - startX <= _shipPosX) { + alienNextDeltaX += _alienWidth; + if (_items[0][3] <= -1 || alienNextDeltaX - startX <= _shipPosX) { + alienNextDeltaX += _alienWidth; + result = _items[0][4] > -1 && alienNextDeltaX - startX > _shipPosX; + } else { + result = true; + } + } else { + result = true; + } + } else { + result = true; + } + } else { + result = true; + } + } else { + result = false; + } + } else { + result = false; + } + + return result; +} + +void Scene52::shipExplode() { + if (!_aliensCount) { + _vm->_gameSys->setAnimation(0, 0, 7); + _vm->_gameSys->removeSequence(_ufoSequenceId, 256, true); + _vm->playSound(44, false); + _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _shipPosX, _arcadeScreenBottom); + _aliensCount = 1; + _vm->playSound(0x31, false); + } +} + +bool Scene52::checkAlienRow(int rowNum) { + for (int i = 0; i < 5; ++i) { + if (_items[rowNum][i] >= 0) + return false; + } + + bool found = false; + for (int j = 0; j < 5; ++j) + if (_items[rowNum][j] == -2) { + _vm->_gameSys->removeSequence(_alienRowKind[rowNum], j + 256, true); + _items[rowNum][j] = -1; + --_alienSpeed; + found = true; + } + + if (found) { + _vm->_gameSys->setAnimation(0, 0, _alienRowAnims[rowNum]); + --_liveAlienRows; + } + + if (_liveAlienRows < 0) + _liveAlienRows = 0; + + return true; +} + +void Scene52::updateAlienRowXOfs() { + int amount = 2 * (3 - _liveAlienRows) + 1; + + if (_alienSpeed == 2) + amount *= 4; + else if (_alienSpeed == 1) + amount *= 10; + + if (_alienDirection) { + for (int i = 0; i < 7; ++i) { + _alienRowXOfs[i] -= amount; + if (_alienRowXOfs[i] <= -100) { + _alienRowXOfs[i] = -100; + _alienDirection = 0; + ++_alienRowDownCtr; + } + } + } else { + for (int j = 0; j < 7; ++j) { + _alienRowXOfs[j] += amount; + if (_alienRowXOfs[j] >= 100) { + _alienRowXOfs[j] = 100; + _alienDirection = 1; + ++_alienRowDownCtr; + } + } + } +} + +void Scene52::initAlienSize() { + _alienWidth = _vm->_gameSys->getSpriteWidthById(0); + if (_vm->_gameSys->getSpriteWidthById(1) > _alienWidth) + _alienWidth = _vm->_gameSys->getSpriteWidthById(1); + if (_vm->_gameSys->getSpriteWidthById(4) > _alienWidth) + _alienWidth = _vm->_gameSys->getSpriteWidthById(4); + if (_vm->_gameSys->getSpriteWidthById(5) > _alienWidth) + _alienWidth = _vm->_gameSys->getSpriteWidthById(5); + if (_vm->_gameSys->getSpriteWidthById(12) > _alienWidth) + _alienWidth = _vm->_gameSys->getSpriteWidthById(12); + if (_vm->_gameSys->getSpriteWidthById(13) > _alienWidth) + _alienWidth = _vm->_gameSys->getSpriteWidthById(13); + + _alienHeight = _vm->_gameSys->getSpriteHeightById(0); + if (_vm->_gameSys->getSpriteHeightById(1) > _alienHeight) + _alienHeight = _vm->_gameSys->getSpriteHeightById(1); + if (_vm->_gameSys->getSpriteHeightById(4) > _alienHeight) + _alienHeight = _vm->_gameSys->getSpriteHeightById(4); + if (_vm->_gameSys->getSpriteHeightById(5) > _alienHeight) + _alienHeight = _vm->_gameSys->getSpriteHeightById(5); + if (_vm->_gameSys->getSpriteHeightById(12) > _alienHeight) + _alienHeight = _vm->_gameSys->getSpriteHeightById(12); + if (_vm->_gameSys->getSpriteHeightById(13) > _alienHeight) + _alienHeight = _vm->_gameSys->getSpriteHeightById(13); + + _alienTopY = _shipCannonTopY + 52; + _alienLeftX = (800 - 5 * _alienWidth) / 2; +} + +void Scene52::playSound() { + if (_soundToggle) { + _vm->playSound(0x2F, false); + _soundToggle = false; + } else { + _vm->playSound(0x2E, false); + _soundToggle = true; + } +} + +void Scene52::updateAliens() { + for (int i = 0; i < 7; ++i) + updateAlien(i); +} + +void Scene52::updateAlien(int rowNum) { + if (_alienRowKind[rowNum] >= 0 && !checkAlienRow(rowNum)) { + for (int i = 0; i < 5; ++i) { + if (_items[rowNum][i] >= 0) + _items[rowNum][i] = -2; + } + checkAlienRow(rowNum); + } +} + +void Scene52::loseShip() { + --_shipsLeft; + if (_shipsLeft == 2) { + _vm->_gameSys->fillSurface(0, 120, 140, _shipMidX, _shipMidY, 0, 0, 0); + } else if (_shipsLeft == 1) { + _vm->_gameSys->fillSurface(0, 120, 185, _shipMidX, _shipMidY, 0, 0, 0); + } +} + +void Scene52::initShields() { + for (int i = 0; i < 3; ++i) { + _vm->_gameSys->drawSpriteToBackground(_shieldPosX[i], _arcadeScreenBottom - 44, 17); + _shieldSpriteIds[i] = 17; + } +} + +void Scene52::initAnims() { + for (int i = 0; i < 7; ++i) + _vm->_gameSys->setAnimation(0, 0, i); + _vm->_gameSys->setAnimation(0, 0, 7); + for (int j = 0; j < 1; ++j) + _vm->_gameSys->setAnimation(0, 0, j + 8); + for (int k = 0; k < 3; ++k) + _vm->_gameSys->setAnimation(0, 0, k + 9); +} + +void Scene52::drawScore(int score) { + char str[4]; + sprintf(str, "%03d", score); + _vm->_gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); +} + +void Scene52::run() { + _vm->_timers[1] = 0; + + _vm->hideCursor(); + + // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000); + // TODO setFontSize(24); + + _gameScore = 0; + _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); + _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); + + drawScore(0); + + _shipMidX = 33; + _shipMidY = _vm->_gameSys->getSpriteHeightById(15); + _shipPosX = (800 - _shipMidX) / 2; + _arcadeScreenBottom = 496; + _arcadeScreenRight = 595 - _shipMidX; + _arcadeScreenLeft = 210; + _shipsLeft = 3; + _alienCounter = 0; + + _shieldPosX[0] = 247; + _shieldPosX[1] = 387; + _shieldPosX[2] = 525; + + for (int i = 0; i < 3; ++i) + _shieldSpriteIds[i] = -1; + + _vm->_gameSys->drawSpriteToBackground(120, 140, 0xF); + _vm->_gameSys->drawSpriteToBackground(120, 185, 0xF); + + initShipCannon(_arcadeScreenBottom); + initAlienCannons(); + initAliens(); + + _nextUfoSequenceId = 0x22; + _vm->_gameSys->setAnimation(0x22, 256, 7); + _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _shipPosX, _arcadeScreenBottom); + + _ufoSequenceId = _nextUfoSequenceId; + + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); + _vm->clearKeyStatus1(Common::KEYCODE_UP); + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + + _vm->_timers[2] = 5; + _shipFlag = false; + + _vm->_timers[0] = 10; + _alienWave = true; + + while (!_vm->_sceneDone) { + _vm->gameUpdateTick(); + + while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT)) { + update(); + if (_vm->_gameSys->getAnimationStatus(7) == 2) { + if (_shipPosX < _arcadeScreenRight) { + _shipPosX += 15; + if (_shipPosX > _arcadeScreenRight) + _shipPosX = _arcadeScreenRight; + _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom); + _ufoSequenceId = _nextUfoSequenceId; + if (_bottomAlienFlag && shipCannonHitAlien()) + shipExplode(); + } + break; + } + } + + while (_vm->isKeyStatus2(Common::KEYCODE_LEFT)) { + update(); + if (_vm->_gameSys->getAnimationStatus(7) == 2) { + if (_shipPosX > _arcadeScreenLeft) { + _shipPosX -= 15; + if (_shipPosX < _arcadeScreenLeft) + _shipPosX = _arcadeScreenLeft; + _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7); + _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom); + _ufoSequenceId = _nextUfoSequenceId; + if (_bottomAlienFlag && shipCannonHitAlien()) + shipExplode(); + } + break; + } + } + + update(); + + if (clearKeyStatus()) { + _alienWave = false; + _vm->_gameSys->waitForUpdate(); + initAnims(); + _vm->clearKeyStatus1(30); + _vm->_sceneDone = true; + } + } + + // TODO freeFont(); + + _vm->_gameSys->waitForUpdate(); +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/arcade.h b/engines/gnap/scenes/arcade.h new file mode 100644 index 0000000000..4255a2d6b0 --- /dev/null +++ b/engines/gnap/scenes/arcade.h @@ -0,0 +1,290 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_ARCADE_H +#define GNAP_ARCADE_H + +#include "gnap/debugger.h" + +namespace Gnap { + +class GnapEngine; +class CutScene; + +struct Scene49Obstacle { + int _currSequenceId; + int _closerSequenceId; + int _passedSequenceId; + int _splashSequenceId; + int _collisionSequenceId; + int _prevId; + int _currId; + int _laneNum; +}; + +struct ObstacleDef { + int _sequenceId; + int _ticks; +}; + +class Scene49: public Scene { +public: + Scene49(GnapEngine *vm); + ~Scene49() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + int _scoreBarPos; + int _scoreLevel; + bool _scoreBarFlash; + int _obstacleIndex; + Scene49Obstacle _obstacles[5]; + int _truckSequenceId; + int _truckId; + int _truckLaneNum; + + void checkObstacles(); + void updateObstacle(int id); + void increaseScore(int amount); + void decreaseScore(int amount); + void refreshScoreBar(); + void clearObstacle(int index); +}; + +/*****************************************************************************/ + +class Scene50: public Scene { +public: + Scene50(GnapEngine *vm); + ~Scene50() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations(); + virtual void updateAnimationsCb() {}; + +private: + bool _fightDone; + int _timesPlayed; + int _timesPlayedModifier; + int _attackCounter; + int _roundNum; + int _timeRemaining; + int _leftTongueRoundsWon; + int _rightTongueRoundsWon; + int _leftTongueEnergyBarPos; + int _rightTongueEnergyBarPos; + int _leftTongueSequenceId; + int _leftTongueId; + int _leftTongueNextSequenceId; + int _leftTongueNextId; + int _leftTongueNextIdCtr; + int _rightTongueSequenceId; + int _rightTongueId; + int _rightTongueNextSequenceId; + int _rightTongueNextId; + int _rightTongueNextIdCtr; + int _leftTongueEnergy; + int _rightTongueEnergy; + + bool tongueWinsRound(int tongueNum); + void playWinAnim(int tongueNum, bool fightOver); + void delayTicks(); + void initRound(); + bool updateCountdown(); + void drawCountdown(int value); + void playTonguesIdle(); + void playRoundAnim(int roundNum); + bool updateEnergyBars(int newLeftBarPos, int newRightBarPos); + void waitForAnim(int animationIndex); + int checkInput(); + int getRightTongueAction(); + int getRightTongueActionTicks(); + int getLeftTongueNextId(); + int getRightTongueNextId(); + void playWinBadgeAnim(int tongueNum); +}; + +/*****************************************************************************/ + +struct Scene51Item { + int _currSequenceId; + int _droppedSequenceId; + int _x, _y; + int _collisionX; + bool _canCatch; + bool _isCollision; + int _x2; + int _id; +}; + +class Scene51: public Scene { +public: + Scene51(GnapEngine *vm); + ~Scene51() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations() {}; + virtual void updateAnimationsCb() {}; + +private: + bool _dropLoseCash; + + int _cashAmount; + int _digits[4]; + int _digitSequenceIds[4]; + int _guySequenceId; + int _guyNextSequenceId; + int _itemsCaughtCtr; + int _dropSpeedTicks; + int _nextDropItemKind; + int _itemInsertX; + int _itemInsertDirection; + int _platypusSequenceId; + int _platypusNextSequenceId; + int _platypusJumpSequenceId; + int _itemsCtr; + int _itemsCtr1; + int _itemsCtr2; + + Scene51Item _items[6]; + + void clearItem(Scene51Item *item); + void dropNextItem(); + void updateItemAnimations(); + int checkCollision(int sequenceId); + void updateItemAnimation(Scene51Item *item, int index); + void removeCollidedItems(); + int itemIsCaught(Scene51Item *item); + bool isJumpingRight(int sequenceId); + bool isJumpingLeft(int sequenceId); + bool isJumping(int sequenceId); + void waitForAnim(int animationIndex); + int getPosRight(int sequenceId); + int getPosLeft(int sequenceId); + void playIntroAnim(); + void updateGuyAnimation(); + int incCashAmount(int sequenceId); + void winMinigame(); + void playCashAppearAnim(); + void updateCash(int amount); + void drawDigit(int digit, int position); + void initCashDisplay(); +}; + +/*****************************************************************************/ + +class Scene52: public Scene { +public: + Scene52(GnapEngine *vm); + ~Scene52() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations() {}; + virtual void updateAnimationsCb() {}; + +private: + int _liveAlienRows; + int _gameScore; + bool _soundToggle; + int _arcadeScreenLeft; + int _arcadeScreenRight; + int _arcadeScreenBottom; + int _shipsLeft; + int _shieldSpriteIds[3]; + int _shieldPosX[3]; + int _shipPosX; + int _shipCannonPosX, _shipCannonPosY; + bool _shipCannonFiring; + bool _shipCannonFired; + int _shipCannonWidth, _shipCannonHeight; + int _shipCannonTopY; + int _shipMidX, _shipMidY; + bool _shipFlag; + bool _aliensInitialized; + int _alienSpeed, _alienDirection; + int _alienWidth, _alienHeight; + int _alienLeftX, _alienTopY; + int _alienRowDownCtr; + int _alienRowKind[7]; + int _alienRowAnims[7]; + int _alienRowIds[7]; + int _alienRowXOfs[7]; + int _alienCannonFired[3]; + int _alienCannonPosX[3]; + int _alienCannonPosY[3]; + int _alienCannonSequenceIds[3]; + int _alienCannonIds[3]; + bool _alienWave, _alienSingle; + int _alienCounter; + bool _bottomAlienFlag; + int _aliensCount; + int _items[8][5]; + int _nextUfoSequenceId, _ufoSequenceId; + + void update(); + void initShipCannon(int bottomY); + void initAlienCannons(); + void fireShipCannon(int posX); + void fireAlienCannon(); + int getFreeShipCannon(); + int getFreeAlienCannon(); + void updateShipCannon(); + void updateAlienCannons(); + void initAliens(); + void initAlienRowKind(int rowNum, int alienKind); + void insertAlienRow(int rowNum); + void insertAlienRowAliens(int rowNum); + void updateAlienRow(int rowNum); + void moveDownAlienRow(); + int updateHitAlien(); + int getHitAlienNum(int rowNum); + int alienCannonHitShip(int cannonNum); + int alienCannonHitShield(int cannonNum); + bool shipCannonHitShield(int cannonNum); + bool shipCannonHitAlien(); + void shipExplode(); + bool checkAlienRow(int rowNum); + void updateAlienRowXOfs(); + void initAlienSize(); + void playSound(); + void updateAliens(); + void updateAlien(int rowNum); + void loseShip(); + void initShields(); + void initAnims(); + void drawScore(int score); +}; + +} // End of namespace Gnap + +#endif // GNAP_ARCADE_H diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 7bb296147f..90cb91f393 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -2926,501 +2926,4 @@ void Scene46::updateAnimations() { } } -/*****************************************************************************/ - -static const ObstacleDef kObstacleDefs[] = { - {0xB4, 15}, {0xCB, 14}, {0xCD, 13}, {0xCF, 15}, {0xBA, 14}, - {0xCD, 13}, {0xCF, 12}, {0xCB, 15}, {0xBD, 13}, {0xCF, 12}, - {0xCD, 11}, {0xCB, 15}, {0xB7, 12}, {0xCD, 11}, {0xCB, 10}, - {0xCF, 15}, {0xCF, 14}, {0xBD, 13}, {0xCF, 12}, {0xCD, 11}, - {0xCB, 15}, {0xCB, 13}, {0xB4, 12}, {0xCB, 11}, {0xCD, 10}, - {0xCF, 15}, {0xCD, 12}, {0xBA, 12}, {0xCD, 12}, {0xCF, 12}, - {0xCB, 15}, {0xCB, 9}, {0xCD, 9}, {0xCF, 9}, {0xCD, 9}, - {0xCB, 9}, {0xCD, 9}, {0xCF, 5}, {0xBD, 13}, {0xCF, 8}, - {0xCB, 8}, {0xCD, 15}, {0xB4, 1}, {0xBD, 7}, {0xCF, 7}, - {0xCD, 7}, {0xCB, 7}, {0xCD, 7}, {0xCF, 15}, {0xCF, 15} -}; - -Scene49::Scene49(GnapEngine *vm) : Scene(vm) { - _scoreBarFlash = false; - _scoreBarPos = -1; - _scoreLevel = -1; - _obstacleIndex = -1; - _truckSequenceId = -1; - _truckId = -1; - _truckLaneNum = -1; - - for (int i = 0; i < 5; i++) { - _obstacles[i]._currSequenceId = -1; - _obstacles[i]._closerSequenceId = -1; - _obstacles[i]._passedSequenceId = -1; - _obstacles[i]._splashSequenceId = -1; - _obstacles[i]._collisionSequenceId = -1; - _obstacles[i]._prevId = -1; - _obstacles[i]._currId = -1; - _obstacles[i]._laneNum = -1; - } -} - -int Scene49::init() { - GameSys gameSys = *_vm->_gameSys; - - gameSys.setAnimation(0, 0, 0); - gameSys.setAnimation(0, 0, 1); - for (int i = 0; i < 5; ++i) - gameSys.setAnimation(0, 0, i + 2); - _vm->_timers[2] = 0; - _vm->_timers[0] = 0; - _vm->_timers[1] = 0; - _vm->clearKeyStatus1(28); - _vm->clearKeyStatus1(54); - _vm->clearKeyStatus1(52); - return 0xD5; -} - -void Scene49::updateHotspots() { - _vm->_hotspotsCount = 0; -} - -void Scene49::checkObstacles() { - if (_vm->_timers[2] == 0) { - if (_vm->_timers[3] == 0) { - for (int i = 0; i < 5; ++i) - clearObstacle(i); - } - - for (int j = 0; j < 5; ++j) { - if (_obstacles[j]._currSequenceId == 0) { - _vm->_timers[3] = 35; - _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId; - switch (_obstacles[j]._currSequenceId) { - case 0xB4: - _obstacles[j]._laneNum = 1; - _obstacles[j]._closerSequenceId = 180; - _obstacles[j]._passedSequenceId = 181; - _obstacles[j]._splashSequenceId = 182; - _obstacles[j]._collisionSequenceId = 192; - break; - case 0xB7: - _obstacles[j]._laneNum = 2; - _obstacles[j]._closerSequenceId = 183; - _obstacles[j]._passedSequenceId = 184; - _obstacles[j]._splashSequenceId = 185; - _obstacles[j]._collisionSequenceId = 193; - break; - case 0xBD: - _obstacles[j]._laneNum = 3; - _obstacles[j]._closerSequenceId = 189; - _obstacles[j]._passedSequenceId = 190; - _obstacles[j]._splashSequenceId = 191; - _obstacles[j]._collisionSequenceId = 195; - break; - case 0xBA: - _obstacles[j]._laneNum = 2; - _obstacles[j]._closerSequenceId = 186; - _obstacles[j]._passedSequenceId = 187; - _obstacles[j]._splashSequenceId = 188; - _obstacles[j]._collisionSequenceId = 194; - break; - case 0xCB: - _obstacles[j]._laneNum = 1; - _obstacles[j]._closerSequenceId = 203; - _obstacles[j]._passedSequenceId = 204; - _obstacles[j]._splashSequenceId = 0; - _obstacles[j]._collisionSequenceId = 209; - break; - case 0xCD: - _obstacles[j]._laneNum = 2; - _obstacles[j]._closerSequenceId = 205; - _obstacles[j]._passedSequenceId = 206; - _obstacles[j]._splashSequenceId = 0; - _obstacles[j]._collisionSequenceId = 210; - break; - case 0xCF: - _obstacles[j]._laneNum = 3; - _obstacles[j]._closerSequenceId = 207; - _obstacles[j]._passedSequenceId = 208; - _obstacles[j]._splashSequenceId = 0; - _obstacles[j]._collisionSequenceId = 211; - break; - } - _obstacles[j]._prevId = _truckId; - _obstacles[j]._currId = _obstacles[j]._prevId; - _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2); - _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); - _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks; - ++_obstacleIndex; - if (_obstacleIndex == 50) - _obstacleIndex = 0; - break; - } - } - } -} - -void Scene49::updateObstacle(int id) { - GameSys gameSys = *_vm->_gameSys; - Scene49Obstacle &obstacle = _obstacles[id]; - - obstacle._currId = obstacle._prevId; - - switch (obstacle._laneNum) { - case 1: - obstacle._prevId = _truckId + 1; - break; - case 2: - if (_truckLaneNum != 2 && _truckLaneNum != 3) - obstacle._prevId = _truckId - 1; - else - obstacle._prevId = _truckId + 1; - break; - case 3: - if (_truckLaneNum != 1 && _truckLaneNum != 2) - obstacle._prevId = _truckId; - else - obstacle._prevId = _truckId - 1; - break; - } - - if (obstacle._currSequenceId == obstacle._closerSequenceId) { - if (_truckLaneNum == obstacle._laneNum) { - if (obstacle._splashSequenceId) { - gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._collisionSequenceId; - _vm->playSound(224, false); - increaseScore(30); - } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) || - (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) || - (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) { - gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._passedSequenceId; - } else { - gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0); - gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - gameSys.insertSequence(obstacle._collisionSequenceId, 256, - _truckSequenceId, _truckId, - kSeqSyncExists, 0, 0, -50); - _truckSequenceId = obstacle._collisionSequenceId; - _truckId = 256; - obstacle._currSequenceId = obstacle._passedSequenceId; - _vm->playSound(225, false); - decreaseScore(30); - } - } else { - gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._passedSequenceId; - } - } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { - if (_truckLaneNum == obstacle._laneNum) { - if (obstacle._splashSequenceId) { - gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._collisionSequenceId; - _vm->playSound(224, false); - increaseScore(30); - } - } else if (obstacle._splashSequenceId) { - gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); - gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId, - obstacle._currSequenceId, obstacle._currId, - kSeqSyncWait, 0, 0, -50); - obstacle._currSequenceId = obstacle._splashSequenceId; - } - } else { - gameSys.setAnimation(0, 0, id + 2); - clearObstacle(id); - } -} - -void Scene49::increaseScore(int amount) { - if (_scoreBarPos + amount <= 556) { - _scoreBarPos += amount; - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); - } - _scoreLevel = _scoreBarPos + amount >= 556; -} - -void Scene49::decreaseScore(int amount) { - if (_scoreBarPos >= 226 && _scoreLevel == 0) { - if (_scoreBarFlash) - refreshScoreBar(); - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); - _scoreBarPos -= amount; - _scoreLevel = 0; - } -} - -void Scene49::refreshScoreBar() { - if (_scoreBarFlash) - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); - else - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); - _scoreBarFlash = !_scoreBarFlash; -} - -void Scene49::clearObstacle(int index) { - _obstacles[index]._currSequenceId = 0; - _obstacles[index]._closerSequenceId = 0; - _obstacles[index]._passedSequenceId = 0; - _obstacles[index]._splashSequenceId = 0; - _obstacles[index]._collisionSequenceId = 0; - _obstacles[index]._prevId = 0; - _obstacles[index]._currId = 0; - _obstacles[index]._laneNum = 0; -} - -void Scene49::run() { - GameSys gameSys = *_vm->_gameSys; - - bool animToggle6 = false; - bool animToggle5 = false; - bool animToggle4 = false; - bool animToggle3 = false; - bool streetAnimToggle = false; - bool bgAnimToggle = false; - - _vm->playSound(0xE2, true); - _vm->setSoundVolume(0xE2, 75); - - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - - _scoreBarPos = 196; - _scoreLevel = 0; - _scoreBarFlash = false; - - switch (_vm->getRandom(3)) { - case 0: - _truckSequenceId = 0xAD; - _truckLaneNum = 1; - break; - case 1: - _truckSequenceId = 0xAE; - _truckLaneNum = 2; - break; - case 2: - _truckSequenceId = 0xAF; - _truckLaneNum = 3; - break; - } - - int bgWidth1 = gameSys.getSpriteWidthById(0x5E); - int bgX1 = 600; - - int bgWidth2 = gameSys.getSpriteWidthById(0x5F); - int bgX2 = 400; - - int bgWidth3 = gameSys.getSpriteWidthById(4); - int bgX3 = 700; - - int bgWidth4 = gameSys.getSpriteWidthById(5); - int bgX4 = 500; - - int bgWidth5 = gameSys.getSpriteWidthById(6); - int bgX5 = 300; - - int bgWidth6 = gameSys.getSpriteWidthById(7); - int bgX6 = 100; - - gameSys.setAnimation(0xC8, 251, 1); - gameSys.setAnimation(_truckSequenceId, 256, 0); - gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); - gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); - gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); - gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); - gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); - gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); - gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); - gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); - - _vm->_timers[0] = 2; - - for (int i = 0; i < 5; ++i) - clearObstacle(i); - - _obstacleIndex = 0; - - _vm->_timers[2] = _vm->getRandom(20) + 10; - - _truckId = 256; - _vm->_timers[3] = 35; - - while (!_vm->_sceneDone) { - if (_vm->_timers[0] == 0) { - // Update background animations (clouds etc.) - --bgX1; - bgX2 -= 2; - bgX3 -= 5; - --bgX4; - --bgX5; - --bgX6; - if (bgX1 <= -bgWidth1) - bgX1 = 799; - if (bgX2 <= -bgWidth2) - bgX2 = 799; - if (bgX3 <= -bgWidth3) - bgX3 = 799; - if (bgX4 <= -bgWidth4) - bgX4 = 799; - if (bgX5 <= -bgWidth5) - bgX5 = 799; - if (bgX6 <= -bgWidth6) - bgX6 = 799; - bgAnimToggle = !bgAnimToggle; - gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); - gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); - gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); - gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); - gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); - gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); - _vm->_timers[0] = 2; - } - - if (gameSys.getAnimationStatus(1) == 2) { - streetAnimToggle = !streetAnimToggle; - gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); - gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); - } - - checkObstacles(); - - if (gameSys.getAnimationStatus(0) == 2) { - switch (_truckSequenceId) { - case 0xB1: - _truckLaneNum = 1; - break; - case 0xB0: - case 0xB3: - _truckLaneNum = 2; - break; - case 0xB2: - _truckLaneNum = 3; - break; - } - animToggle3 = !animToggle3; - if (_truckLaneNum == 1) { - gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); - gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); - _truckSequenceId = 0xAD; - } else if (_truckLaneNum == 2) { - gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); - gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); - _truckSequenceId = 0xAE; - } else { - gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); - gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); - _truckSequenceId = 0xAF; - } - _truckId = (animToggle3 ? 1 : 0) + 256; - if (_scoreLevel == 1) { - if (!gameSys.isSequenceActive(0xD4, 266)) { - gameSys.setAnimation(0xD4, 266, 8); - gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); - } - ++_scoreLevel; - _vm->_timers[1] = 2; - animToggle4 = false; - animToggle5 = false; - animToggle6 = false; - _scoreBarFlash = false; - } - } - - if (_scoreLevel != 0 && !_vm->_timers[1]) { - refreshScoreBar(); - _vm->_timers[1] = 8; - if (animToggle6) { - if (animToggle5) { - if (animToggle4 && !gameSys.isSequenceActive(212, 266)) - gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); - animToggle4 = !animToggle4; - } - animToggle5 = !animToggle5; - } - animToggle6 = !animToggle6; - } - - updateAnimations(); - - if (clearKeyStatus()) { - _vm->_sceneDone = true; - _vm->_newSceneNum = 2; - _vm->_newCursorValue = 1; - } - - if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { - // Steer right - if (_truckSequenceId == 0xB3) - _truckLaneNum = 2; - if (_truckSequenceId == 0xB1) - _truckLaneNum = 1; - if (_truckLaneNum != 3 && _truckLaneNum != 2) { - if (_scoreLevel) { - _vm->_sceneDone = true; - _vm->_newSceneNum = 47; - } - } else { - int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1; - if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) { - gameSys.setAnimation(steerSequenceId, 256, 0); - gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); - _truckSequenceId = steerSequenceId; - _truckId = 256; - } - } - _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); - } - - if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { - // Steer left - if (_truckSequenceId == 0xB0) - _truckLaneNum = 2; - if (_truckSequenceId == 0xB2) - _truckLaneNum = 3; - if (_truckLaneNum == 1 || _truckLaneNum == 2) { - int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2; - if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) { - gameSys.setAnimation(steerSequenceId, 256, 0); - gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); - _truckSequenceId = steerSequenceId; - _truckId = 256; - } - } - _vm->clearKeyStatus1(Common::KEYCODE_LEFT); - } - _vm->gameUpdateTick(); - } - _vm->stopSound(0xE2); -} - -void Scene49::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; - - for (int i = 0; i < 5; ++i) { - if (gameSys.getAnimationStatus(i + 2) == 2) { - if (_obstacles[i]._currSequenceId) - updateObstacle(i); - } - } - - if (gameSys.getAnimationStatus(8) == 2) { - _vm->_sceneDone = true; - _vm->_newSceneNum = 47; - } -} - } // End of namespace Gnap diff --git a/engines/gnap/scenes/group4.h b/engines/gnap/scenes/group4.h index db73bbddc4..28f03eec6d 100644 --- a/engines/gnap/scenes/group4.h +++ b/engines/gnap/scenes/group4.h @@ -143,51 +143,6 @@ private: int _currItchyGuySequenceId; }; -struct Scene49Obstacle { - int _currSequenceId; - int _closerSequenceId; - int _passedSequenceId; - int _splashSequenceId; - int _collisionSequenceId; - int _prevId; - int _currId; - int _laneNum; -}; - -struct ObstacleDef { - int _sequenceId; - int _ticks; -}; - -class Scene49: public Scene { -public: - Scene49(GnapEngine *vm); - ~Scene49() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - int _scoreBarPos; - int _scoreLevel; - bool _scoreBarFlash; - int _obstacleIndex; - Scene49Obstacle _obstacles[5]; - int _truckSequenceId; - int _truckId; - int _truckLaneNum; - - void checkObstacles(); - void updateObstacle(int id); - void increaseScore(int amount); - void decreaseScore(int amount); - void refreshScoreBar(); - void clearObstacle(int index); -}; - } // End of namespace Gnap #endif // GNAP_GROUP4_H diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp new file mode 100644 index 0000000000..68b957f753 --- /dev/null +++ b/engines/gnap/scenes/group5.cpp @@ -0,0 +1,395 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/gamesys.h" +#include "gnap/resource.h" +#include "gnap/scenes/group5.h" + +namespace Gnap { + +enum { + kHS53Platypus = 0, + kHS53Device = 1, + kHS53PhoneKey1 = 2, + kHS53PhoneKey2 = 3, + kHS53PhoneKey3 = 4, + kHS53PhoneKey4 = 5, + kHS53PhoneKey5 = 6, + kHS53PhoneKey6 = 7, + kHS53PhoneKey7 = 8, + kHS53PhoneKey8 = 9, + kHS53PhoneKey9 = 10, + kHS53PhoneKey0 = 11, + kHS53PhoneKeySharp = 12, + kHS53PhoneKeyStar = 13, + kHS53PhoneExit = 14 +}; + +Scene53::Scene53(GnapEngine *vm) : Scene(vm) { + _isGnapPhoning = false; + _currHandSequenceId = -1; + _callsMadeCtr = 0; + _callsRndUsed = 0; +} + +int Scene53::init() { + _vm->_gameSys->setAnimation(0, 0, 0); + _vm->_gameSys->setAnimation(0, 0, 1); + return 0x75; +} + +void Scene53::updateHotspots() { + _vm->setHotspot(kHS53Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); + _vm->setHotspot(kHS53PhoneKey1, 336, 238, 361, 270, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey2, 376, 243, 405, 274, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey3, 415, 248, 441, 276, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey4, 329, 276, 358, 303, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey5, 378, 282, 408, 311, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey6, 417, 286, 446, 319, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey7, 332, 311, 361, 342, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey8, 376, 318, 407, 349, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey9, 417, 320, 447, 353, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKey0, 377, 352, 405, 384, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKeySharp, 419, 358, 450, 394, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneKeyStar, 328, 346, 359, 379, SF_GRAB_CURSOR); + _vm->setHotspot(kHS53PhoneExit, 150, 585, 650, 600, SF_EXIT_D_CURSOR); + + _vm->setDeviceHotspot(kHS53Device, -1, -1, -1, -1); + _vm->_hotspotsCount = 15; +} + +int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { + static const int kGnapHandSequenceIds[13] = { + 0x00, + 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, + 0x4C, 0x4D, 0x4E, 0x50, 0x51, 0x4F + }; + + static const int kPlatypusHandSequenceIds[13] = { + 0x00, + 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x5C, 0x5D, 0x5B + }; + + if (_isGnapPhoning) { + _vm->_gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); + _vm->_gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currHandSequenceId = kGnapHandSequenceIds[buttonNum]; + } else { + _vm->_gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); + _vm->_gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; + } + + _vm->_gnapActionStatus = 6; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + // checkGameAppStatus(); + _vm->updateMouseCursor(); + _vm->gameUpdateTick(); + } + _vm->_gnapActionStatus = -1; + + if (buttonNum < 11) + phoneNumber = buttonNum % 10 + 10 * phoneNumber; + + return phoneNumber; +} + +int Scene53::getRandomCallIndex() { + int index, tries = 0; + if (_callsRndUsed == 0x7FFF) + _callsRndUsed = 0; + do { + index = _vm->getRandom(16); + if (++tries == 300) + _callsRndUsed = 0; + } while (_callsRndUsed & (1 << index)); + _callsRndUsed |= (1 << index); + return index; +} + +void Scene53::runRandomCall() { + static const int kCallSequenceIds[15] = { + 0x60, 0x61, 0x62, 0x63, 0x64, + 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6A, 0x6B, 0x6C, 0x6D, 0x71 + }; + + ++_callsMadeCtr; + + if (_callsMadeCtr <= 10) { + int index; + + do { + index = getRandomCallIndex(); + } while (!_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); + _vm->_gameSys->setAnimation(kCallSequenceIds[index], 1, 6); + _vm->_gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); + } else { + _vm->_gameSys->setAnimation(0x74, 1, 6); + _vm->_gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); + _callsMadeCtr = 0; + } + + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _vm->_gnapActionStatus = -1; +} + +void Scene53::runChitChatLine() { + bool flag = false; + int sequenceId = -1; + + _vm->_gameSys->setAnimation(0x6E, 1, 6); + _vm->_gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); + + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _vm->_gnapActionStatus = -1; + + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currHandSequenceId = 0x45; + } else { + _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + _currHandSequenceId = 0x5E; + } + + _vm->_hotspots[kHS53Device]._flags = SF_DISABLED; + + while (!flag) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case 2: + sequenceId = 0x6F; + flag = 1; + break; + case 3: + sequenceId = 0x70; + flag = 1; + break; + case 4: + sequenceId = 0x71; + flag = 1; + break; + case 14: + sequenceId = -1; + flag = 1; + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 17; + break; + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); + break; + } + + if (flag && sequenceId != -1) { + _vm->stopSound(0xA0); + pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); + _vm->_gnapActionStatus = 1; + _vm->_gameSys->setAnimation(sequenceId, 1, 6); + _vm->_gameSys->insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _vm->_gnapActionStatus = -1; + _vm->_gameSys->setAnimation(0x72, 1, 6); + _vm->_gameSys->insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); + _vm->_gnapActionStatus = 1; + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _vm->_gnapActionStatus = -1; + } + } + + updateHotspots(); + + _vm->_gnapActionStatus = 1; + + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->setAnimation(0x73, 40, 6); + _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _currHandSequenceId = 0x73; + _vm->_gnapActionStatus = -1; + } +} + +void Scene53::run() { + int phoneNumber = 0; + int phoneNumberLen = 0; + + _vm->queueInsertDeviceIcon(); + + if (_vm->isFlag(kGFSpringTaken)) { + _currHandSequenceId = 0x45; + _isGnapPhoning = true; + } else { + _currHandSequenceId = 0x5E; + _isGnapPhoning = false; + } + + _vm->_gameSys->insertSequence(_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + _vm->endSceneInit(); + _vm->setVerbCursor(GRAB_CURSOR); + _vm->playSound(0xA0, true); + + while (!_vm->_sceneDone) { + _vm->updateMouseCursor(); + _vm->updateCursorByHotspot(); + + _vm->testWalk(0, 0, -1, -1, -1, -1); + + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); + _vm->updateGrabCursorSprite(0, 0); + + switch (_vm->_sceneClickedHotspot) { + case 1: + if (_vm->_gnapActionStatus < 0) { + _vm->runMenu(); + updateHotspots(); + } + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + _vm->stopSound(0xA0); + ++phoneNumberLen; + phoneNumber = pressPhoneNumberButton(phoneNumber, _vm->_sceneClickedHotspot - 1); + debugC(kDebugBasic, "phoneNumber: %d", phoneNumber); + if (phoneNumberLen == 7) { + _vm->_gnapActionStatus = 1; + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->setAnimation(0x73, 40, 6); + _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _currHandSequenceId = 0x73; + _vm->_gnapActionStatus = -1; + } + if (phoneNumber == 7284141) { + runChitChatLine(); + phoneNumber = 0; + phoneNumberLen = 0; + _vm->_sceneDone = true; + _vm->_newSceneNum = 17; + } else if (phoneNumber != 5556789 || _vm->isFlag(kGFPictureTaken)) { + runRandomCall(); + phoneNumber = 0; + phoneNumberLen = 0; + _vm->_sceneDone = true; + _vm->_newSceneNum = 17; + } else { + phoneNumber = 0; + phoneNumberLen = 0; + _vm->_sceneDone = true; + _vm->_newSceneNum = 17; + if (_isGnapPhoning) + _vm->setFlag(kGFUnk25); + else + _vm->setFlag(kGFPlatypusTalkingToAssistant); + } + } + break; + case 12: + case 13: + pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); + break; + case 14: + if (_vm->_gnapActionStatus < 0) { + _vm->_gnapActionStatus = 1; + if (_vm->isFlag(kGFSpringTaken)) { + _vm->_gameSys->setAnimation(0x73, 40, 6); + _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (_vm->_gameSys->getAnimationStatus(6) != 2) { + _vm->updateMouseCursor(); + // checkGameAppStatus(); + _vm->gameUpdateTick(); + } + _currHandSequenceId = 0x73; + _vm->_gnapActionStatus = -1; + } + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->_gnapActionStatus = 0; + _vm->_newSceneNum = 17; + } + break; + } + + _vm->checkGameKeys(); + + if (_vm->isKeyStatus1(8)) { + _vm->clearKeyStatus1(8); + _vm->runMenu(); + updateHotspots(); + } + _vm->gameUpdateTick(); + } +} + +} // End of namespace Gnap diff --git a/engines/gnap/scenes/group5.h b/engines/gnap/scenes/group5.h new file mode 100644 index 0000000000..d9ffc19b74 --- /dev/null +++ b/engines/gnap/scenes/group5.h @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_GROUP5_H +#define GNAP_GROUP5_H + +#include "gnap/debugger.h" +#include "gnap/scenes/scenecore.h" + +namespace Gnap { + +class GnapEngine; + +class Scene53: public Scene { +public: + Scene53(GnapEngine *vm); + ~Scene53() {} + + virtual int init(); + virtual void updateHotspots(); + virtual void run(); + virtual void updateAnimations() {}; + virtual void updateAnimationsCb() {}; + +private: + bool _isGnapPhoning; + int _currHandSequenceId; + int _callsMadeCtr; + uint _callsRndUsed; + + int pressPhoneNumberButton(int phoneNumber, int buttonNum); + int getRandomCallIndex(); + void runRandomCall(); + void runChitChatLine(); +}; + +} // End of namespace Gnap +#endif // GNAP_GROUP5_H diff --git a/engines/gnap/scenes/scene50.cpp b/engines/gnap/scenes/scene50.cpp deleted file mode 100644 index 68f29f3d78..0000000000 --- a/engines/gnap/scenes/scene50.cpp +++ /dev/null @@ -1,498 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene50.h" - -namespace Gnap { - -Scene50::Scene50(GnapEngine *vm) : Scene(vm) { - _s50_fightDone = false; - - _s50_roundNum = -1; - _s50_timeRemaining = -1; - _s50_leftTongueRoundsWon = -1; - _s50_rightTongueRoundsWon = -1; - _s50_leftTongueSequenceId = -1; - _s50_leftTongueId = -1; - _s50_leftTongueNextSequenceId = -1; - _s50_leftTongueNextId = -1; - _s50_rightTongueSequenceId = -1; - _s50_rightTongueId = -1; - _s50_rightTongueNextSequenceId = -1; - _s50_rightTongueNextId = -1; - _s50_leftTongueEnergy = -1; - _s50_rightTongueEnergy = -1; - - _s50_timesPlayed = 0; - _s50_timesPlayedModifier = 0; - _s50_attackCounter = 0; - _s50_leftTongueEnergyBarPos = 10; - _s50_leftTongueNextIdCtr = 0; - _s50_rightTongueEnergyBarPos = 10; - _s50_rightTongueNextIdCtr = 0; -} - -int Scene50::init() { - return 0xC7; -} - -void Scene50::updateHotspots() { - _vm->_hotspotsCount = 0; -} - -bool Scene50::tongueWinsRound(int tongueNum) { - if (tongueNum == 1) - ++_s50_leftTongueRoundsWon; - else - ++_s50_rightTongueRoundsWon; - playWinBadgeAnim(tongueNum); - bool fightOver = _s50_rightTongueRoundsWon == 2 || _s50_leftTongueRoundsWon == 2; - playWinAnim(tongueNum, fightOver); - return fightOver; -} - -void Scene50::playWinAnim(int tongueNum, bool fightOver) { - if (tongueNum == 1) { - if (fightOver) { - _vm->_gameSys->insertSequence(0xAD, 140, 0xAC, 140, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); - _s50_leftTongueSequenceId = 0xB4; - _s50_rightTongueSequenceId = 0xBC; - _s50_rightTongueId = 100; - _s50_leftTongueId = 100; - _vm->_gameSys->setAnimation(0xB4, 100, 6); - _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); - waitForAnim(6); - waitForAnim(5); - _vm->invAdd(kItemGum); - _vm->setFlag(kGFUnk13); - } else { - _vm->_gameSys->insertSequence(0xB4, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBD, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBC, 100, 0xBD, 100, kSeqSyncWait, 0, 0, 0); - _s50_leftTongueSequenceId = 0xB4; - _s50_rightTongueSequenceId = 0xBC; - _s50_rightTongueId = 100; - _s50_leftTongueId = 100; - _vm->_gameSys->setAnimation(0xB4, 100, 6); - _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); - waitForAnim(6); - waitForAnim(5); - } - } else { - _vm->_gameSys->insertSequence(0xBE, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xBE, 100, 5); - waitForAnim(5); - _vm->_gameSys->insertSequence(0xBF, 100, 0xBE, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xB5, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _s50_rightTongueSequenceId = 0xBF; - _s50_leftTongueSequenceId = 0xB5; - _s50_rightTongueId = 100; - _s50_leftTongueId = 100; - _vm->_gameSys->setAnimation(0xB5, 100, 6); - _vm->_gameSys->setAnimation(_s50_rightTongueSequenceId, 100, 5); - waitForAnim(6); - waitForAnim(5); - } - // TODO delayTicksA(1, 7); -} - -void Scene50::delayTicks() { - // TODO delayTicksA(3, 7); -} - -void Scene50::initRound() { - _s50_leftTongueEnergy = 10; - _s50_rightTongueEnergy = 10; - _s50_fightDone = false; - _vm->_timers[3] = getRightTongueActionTicks(); - _vm->_timers[4] = 0; - _vm->_timers[6] = 0; - _vm->_gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0); - _vm->_gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0); - _s50_timeRemaining = 40; - drawCountdown(40); -} - -bool Scene50::updateCountdown() { - if (!_vm->_timers[5]) { - --_s50_timeRemaining; - if (_s50_timeRemaining < 0) { - return true; - } else { - _vm->_timers[5] = 15; - drawCountdown(_s50_timeRemaining); - } - } - return false; -} - -void Scene50::drawCountdown(int value) { - char str[8]; - sprintf(str, "%02d", value); - _vm->_gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0); - _vm->_gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str); -} - -void Scene50::playTonguesIdle() { - _vm->_gameSys->insertSequence(0xBA, 100, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xC2, 100, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _s50_leftTongueSequenceId = 0xBA; - _s50_rightTongueSequenceId = 0xC2; - _s50_rightTongueNextSequenceId = -1; - _s50_leftTongueNextSequenceId = -1; - _s50_leftTongueId = 100; - _s50_rightTongueId = 100; - _vm->_gameSys->setAnimation(0xC2, 100, 5); - _vm->_gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); -} - -void Scene50::playRoundAnim(int roundNum) { - int sequenceId = 0; - - switch (roundNum) { - case 1: - sequenceId = 0xAF; - break; - case 2: - sequenceId = 0xB0; - break; - case 3: - sequenceId = 0xB1; - break; - } - - _vm->_gameSys->insertSequence(sequenceId, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(sequenceId, 256, 7); - waitForAnim(7); - - _vm->_gameSys->insertSequence(0xAB, 256, sequenceId, 256, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xAB, 256, 7); - waitForAnim(7); -} - -bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { - if (newLeftBarPos != _s50_leftTongueEnergyBarPos) { - if (newLeftBarPos < 0) - newLeftBarPos = 0; - _s50_leftTongueEnergyBarPos = newLeftBarPos; - _vm->_gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); - } - - if (newRightBarPos != _s50_rightTongueEnergyBarPos) { - if (newRightBarPos < 0) - newRightBarPos = 0; - _s50_rightTongueEnergyBarPos = newRightBarPos; - if (newRightBarPos != 10) - _vm->_gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); - } - - if (newLeftBarPos * newRightBarPos > 0) - return false; - - _s50_leftTongueEnergyBarPos = 10; - _s50_rightTongueEnergyBarPos = 10; - return true; -} - -void Scene50::waitForAnim(int animationIndex) { - while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { - _vm->gameUpdateTick(); - } - _vm->_gameSys->setAnimation(0, 0, animationIndex); -} - -int Scene50::checkInput() { - int sequenceId = -1; - - if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { - _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); - sequenceId = 0xB6; - } else if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { - _vm->clearKeyStatus1(Common::KEYCODE_LEFT); - sequenceId = 0xB3; - } else if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE)) { - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _s50_fightDone = true; - } - - return sequenceId; -} - -int Scene50::getRightTongueAction() { - int sequenceId = -1; - - if (!_vm->_timers[3]) { - _vm->_timers[3] = getRightTongueActionTicks(); - if (_s50_rightTongueEnergy >= _s50_leftTongueEnergy) { - switch (_vm->getRandom(5)) { - case 0: - sequenceId = 0xBE; - break; - case 1: - sequenceId = 0xBE; - break; - case 2: - sequenceId = 0xBB; - break; - case 3: - sequenceId = 0xBB; - break; - case 4: - sequenceId = 0xBB; - break; - } - } else { - switch (_vm->getRandom(4)) { - case 0: - sequenceId = 0xBE; - break; - case 1: - sequenceId = 0xBB; - break; - case 2: - sequenceId = 0xBE; - break; - case 3: - sequenceId = 0xBE; - break; - } - } - } - - return sequenceId; -} - -void Scene50::updateAnimations() { - if (!_vm->_timers[4]) - _s50_attackCounter = 0; - - if (_vm->_gameSys->getAnimationStatus(5) == 2) { - if (_s50_rightTongueSequenceId == 0xBE) { - if (_s50_leftTongueSequenceId != 0xB3 && _s50_leftTongueSequenceId != 0xB8) - _s50_rightTongueNextSequenceId = 0xBF; - else - _s50_rightTongueNextSequenceId = 0xC0; - } - if (_s50_rightTongueNextSequenceId == -1) - _s50_rightTongueNextSequenceId = 0xC2; - if (_s50_rightTongueNextSequenceId == 0xBF) { - _s50_leftTongueNextId = getLeftTongueNextId(); - _s50_rightTongueNextId = getRightTongueNextId(); - _vm->_gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); - _vm->_gameSys->setAnimation(0xB9, _s50_leftTongueNextId, 6); - _vm->_gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncExists, 0, 0, 0); - _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; - _s50_rightTongueNextSequenceId = -1; - _s50_leftTongueSequenceId = 0xB9; - _s50_leftTongueNextSequenceId = -1; - _s50_rightTongueId = _s50_rightTongueNextId; - _s50_leftTongueId = _s50_leftTongueNextId; - _s50_leftTongueEnergy -= _vm->getRandom(2) + 1;//CHECKME - } else { - _s50_rightTongueNextId = getRightTongueNextId(); - _vm->_gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); - _vm->_gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; - _s50_rightTongueNextSequenceId = -1; - _s50_rightTongueId = _s50_rightTongueNextId; - } - } - - if (_vm->_gameSys->getAnimationStatus(6) == 2) { - if (_s50_leftTongueSequenceId == 0xB6) { - ++_s50_attackCounter; - if (_s50_timesPlayedModifier + 3 <= _s50_attackCounter) { - _s50_leftTongueNextSequenceId = 0xB8; - } else { - _vm->_timers[4] = 20; - //CHECKME - if (_s50_rightTongueSequenceId != 0xBB && _s50_rightTongueSequenceId != 0xC0 && _vm->getRandom(8) != _s50_roundNum) - _s50_leftTongueNextSequenceId = 0xB7; - else - _s50_leftTongueNextSequenceId = 0xB8; - } - } - if (_s50_leftTongueNextSequenceId == 0xB3) - --_s50_attackCounter; - if (_s50_leftTongueNextSequenceId == -1) - _s50_leftTongueNextSequenceId = 0xBA; - if (_s50_leftTongueNextSequenceId == 0xB7) { - _s50_leftTongueNextId = getLeftTongueNextId(); - _s50_rightTongueNextId = getRightTongueNextId(); - _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); - _vm->_gameSys->setAnimation(0xC1, _s50_rightTongueNextId, 5); - _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); - _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; - _s50_leftTongueNextSequenceId = -1; - _s50_rightTongueSequenceId = 0xC1; - _s50_rightTongueNextSequenceId = -1; - _s50_rightTongueId = _s50_rightTongueNextId; - _s50_leftTongueId = _s50_leftTongueNextId; - --_s50_rightTongueEnergy; - } else if (_s50_leftTongueNextSequenceId != 0xB8 || _s50_rightTongueSequenceId != 0xC2) { - _s50_leftTongueNextId = getLeftTongueNextId(); - _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); - _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; - _s50_leftTongueNextSequenceId = -1; - _s50_leftTongueId = _s50_leftTongueNextId; - } else { - _s50_leftTongueNextId = getLeftTongueNextId(); - _s50_rightTongueNextId = getRightTongueNextId(); - _vm->_gameSys->setAnimation(0xBB, _s50_rightTongueNextId, 5); - _vm->_gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); - _vm->_gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); - _s50_rightTongueSequenceId = 0xBB; - _s50_rightTongueId = _s50_rightTongueNextId; - _s50_rightTongueNextSequenceId = -1; - _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; - _s50_leftTongueNextSequenceId = -1; - _s50_leftTongueId = _s50_leftTongueNextId; - } - } -} - -int Scene50::getRightTongueActionTicks() { - return 15 - 5 * _s50_roundNum + 1; -} - -int Scene50::getLeftTongueNextId() { - _s50_leftTongueNextIdCtr = (_s50_leftTongueNextIdCtr + 1) % 3; - return _s50_leftTongueNextIdCtr + 100; -} - -int Scene50::getRightTongueNextId() { - _s50_rightTongueNextIdCtr = (_s50_rightTongueNextIdCtr + 1) % 3; - return _s50_rightTongueNextIdCtr + 100; -} - -void Scene50::playWinBadgeAnim(int tongueNum) { - int sequenceId; - - if (tongueNum == 1) { - if (_s50_leftTongueRoundsWon == 1) - sequenceId = 0xC3; - else - sequenceId = 0xC4; - } else { - if (_s50_rightTongueRoundsWon == 1) - sequenceId = 0xC5; - else - sequenceId = 0xC6; - } - - _vm->_gameSys->setAnimation(sequenceId, 120, 7); - _vm->_gameSys->insertSequence(sequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); - waitForAnim(7); -} - -void Scene50::run() { - ++_s50_timesPlayed; - _s50_timesPlayedModifier = _s50_timesPlayed / 4; - _s50_leftTongueRoundsWon = 0; - _s50_rightTongueRoundsWon = 0; - // initFont(); - _s50_leftTongueSequenceId = 186; - _s50_rightTongueSequenceId = 194; - _s50_rightTongueNextSequenceId = -1; - _s50_leftTongueNextSequenceId = -1; - _s50_leftTongueId = 100; - _s50_rightTongueId = 100; - - _vm->_gameSys->setAnimation(194, 100, 5); - _vm->_gameSys->setAnimation(_s50_leftTongueSequenceId, _s50_leftTongueId, 6); - _vm->_gameSys->insertSequence(_s50_leftTongueSequenceId, _s50_leftTongueId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_s50_rightTongueSequenceId, _s50_rightTongueId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(172, 140, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - - initRound(); - - _s50_roundNum = 1; - - _vm->setGrabCursorSprite(-1); - _vm->hideCursor(); - - // TODO delayTicksA(1, 7); - - playRoundAnim(_s50_roundNum); - - _vm->_timers[5] = 15; - - while (!_s50_fightDone) { - /* TODO - if (sceneXX_sub_4466B1()) - _s50_fightDone = true; - */ - - int playerSequenceId = checkInput(); - if (playerSequenceId != -1) - _s50_leftTongueNextSequenceId = playerSequenceId; - - int rightSequenceId = getRightTongueAction(); - if (rightSequenceId != -1) - _s50_rightTongueNextSequenceId = rightSequenceId; - - updateAnimations(); - - if (updateCountdown() || - updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy)) { - bool v0; - if (_s50_rightTongueEnergy < _s50_leftTongueEnergy) - v0 = tongueWinsRound(1); - else - v0 = tongueWinsRound(2); - if (v0) { - delayTicks(); - _s50_fightDone = true; - } else { - ++_s50_roundNum; - initRound(); - playTonguesIdle(); - updateEnergyBars(_s50_leftTongueEnergy, _s50_rightTongueEnergy); - playRoundAnim(_s50_roundNum); - _vm->_timers[5] = 15; - } - } - _vm->gameUpdateTick(); - } - - // freeFont(); - - _vm->_gameSys->setAnimation(0, 0, 7); - _vm->_gameSys->setAnimation(0, 0, 6); - _vm->_gameSys->setAnimation(0, 0, 5); - _vm->_gameSys->setAnimation(0, 0, 3); - - _vm->showCursor(); -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene50.h b/engines/gnap/scenes/scene50.h deleted file mode 100644 index 6cc4bc35cb..0000000000 --- a/engines/gnap/scenes/scene50.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE50_H -#define GNAP_SCENE50_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene50: public Scene { -public: - Scene50(GnapEngine *vm); - ~Scene50() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations(); - virtual void updateAnimationsCb() {}; - -private: - bool _s50_fightDone; - int _s50_timesPlayed; - int _s50_timesPlayedModifier; - int _s50_attackCounter; - int _s50_roundNum; - int _s50_timeRemaining; - int _s50_leftTongueRoundsWon; - int _s50_rightTongueRoundsWon; - int _s50_leftTongueEnergyBarPos; - int _s50_rightTongueEnergyBarPos; - int _s50_leftTongueSequenceId; - int _s50_leftTongueId; - int _s50_leftTongueNextSequenceId; - int _s50_leftTongueNextId; - int _s50_leftTongueNextIdCtr; - int _s50_rightTongueSequenceId; - int _s50_rightTongueId; - int _s50_rightTongueNextSequenceId; - int _s50_rightTongueNextId; - int _s50_rightTongueNextIdCtr; - int _s50_leftTongueEnergy; - int _s50_rightTongueEnergy; - - bool tongueWinsRound(int tongueNum); - void playWinAnim(int tongueNum, bool fightOver); - void delayTicks(); - void initRound(); - bool updateCountdown(); - void drawCountdown(int value); - void playTonguesIdle(); - void playRoundAnim(int roundNum); - bool updateEnergyBars(int newLeftBarPos, int newRightBarPos); - void waitForAnim(int animationIndex); - int checkInput(); - int getRightTongueAction(); - int getRightTongueActionTicks(); - int getLeftTongueNextId(); - int getRightTongueNextId(); - void playWinBadgeAnim(int tongueNum); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE50_H diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp deleted file mode 100644 index dc93c6ba4d..0000000000 --- a/engines/gnap/scenes/scene51.cpp +++ /dev/null @@ -1,897 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene51.h" - -namespace Gnap { - -static const int kDigitSequenceIds[] = { - 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, - 0xCF, 0xD0, 0xD1, 0xD2, 0xD3 -}; - -static const int kDigitPositions[4] = { - 0, 34, 83, 119 -}; - -/* - 0xBA Falling banana peel - 0xBC Banana peel goes away - 0xBD Falling coin - 0xBE Fallen coin - 0xC0 Falling banknote - 0xB6 Platypus tripping (right) - 0xB7 Platypus tripping (left) - 0x76 Platypus jumping (right) -*/ - -Scene51::Scene51(GnapEngine *vm) : Scene(vm) { - _s51_dropLoseCash = false; - - _s51_cashAmount = -1; - _s51_guySequenceId = -1; - _s51_guyNextSequenceId = -1; - _s51_itemsCaughtCtr = -1; - _s51_dropSpeedTicks = -1; - _s51_nextDropItemKind = -1; - _s51_itemInsertX = -1; - _s51_itemInsertDirection = -1; - _s51_platypusSequenceId = -1; - _s51_platypusNextSequenceId = -1; - _s51_platypusJumpSequenceId = -1; - _s51_itemsCtr = -1; - _s51_itemsCtr1 = -1; - _s51_itemsCtr2 = -1; - - for (int i = 0; i < 4; i++) { - _s51_digits[i] = 0; - _s51_digitSequenceIds[4] = -1; - } - - for (int i = 0; i < 6; i++) { - _s51_items[i]._currSequenceId = -1; - _s51_items[i]._droppedSequenceId; - _s51_items[i]._x = 0; - _s51_items[i]._y = 0; - _s51_items[i]._collisionX; - _s51_items[i]._canCatch = false; - _s51_items[i]._isCollision = false; - _s51_items[i]._x2 = 0; - _s51_items[i]._id = -1; - } -} - -int Scene51::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - for (int i = 0; i < 6; ++i) - _vm->_gameSys->setAnimation(0, 0, i + 1); - return 0xD4; -} - -void Scene51::updateHotspots() { - _vm->_hotspotsCount = 0; -} - -void Scene51::clearItem(Scene51Item *item) { - item->_currSequenceId = 0; - item->_droppedSequenceId = 0; - item->_x = 0; - item->_y = 0; - item->_x2 = 0; - item->_collisionX = 0; - item->_canCatch = false; -} - -void Scene51::dropNextItem() { - if (_vm->_timers[0]) - return; - - int index = 0; - while (index < 6 && _s51_items[index]._currSequenceId) - ++index; - - if (index == 6) - return; - - switch (_s51_nextDropItemKind) { - case 0: - if (_vm->getRandom(10) != 0 || _s51_itemsCtr2 >= 2) { - _s51_items[index]._currSequenceId = 0xBD; - } else { - --_s51_itemsCtr1; - _s51_items[index]._currSequenceId = 0xBA; - ++_s51_itemsCtr2; - } - break; - - case 1: - if (_vm->getRandom(8) != 0 || _s51_itemsCtr2 >= 2) { - if (_vm->getRandom(5) == 0) { - if (_s51_itemInsertDirection) - _s51_itemInsertX -= 70; - else - _s51_itemInsertX += 70; - } - _s51_items[index]._currSequenceId = 0xBD; - } else { - --_s51_itemsCtr1; - _s51_items[index]._currSequenceId = 0xBA; - ++_s51_itemsCtr2; - } - break; - - case 2: - if (_vm->getRandom(6) != 0 || _s51_itemsCtr2 >= 2) { - _s51_items[index]._currSequenceId = 0xBD; - } else { - --_s51_itemsCtr1; - _s51_items[index]._currSequenceId = 0xBA; - ++_s51_itemsCtr2; - } - break; - - case 3: - case 4: - if (_s51_itemsCtr == 0) - _s51_itemsCtr1 = 3; - _s51_items[index]._currSequenceId = 0xC0; - break; - - case 5: - case 6: - if (_vm->getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { - if (_vm->getRandom(5) != 0) - _s51_items[index]._currSequenceId = 0xBD; - else - _s51_items[index]._currSequenceId = 0xC0; - } else { - --_s51_itemsCtr1; - _s51_items[index]._currSequenceId = 0xBA; - ++_s51_itemsCtr2; - } - break; - - case 7: - if (_vm->getRandom(5) != 0 || _s51_itemsCtr2 >= 2) { - if (_vm->getRandom(5) == 0) { - if (_s51_itemInsertDirection) - _s51_itemInsertX -= 40; - else - _s51_itemInsertX += 40; - } - if (_vm->getRandom(9) != 0) - _s51_items[index]._currSequenceId = 0xBD; - else - _s51_items[index]._currSequenceId = 0xC0; - } else { - --_s51_itemsCtr1; - _s51_items[index]._currSequenceId = 0xBA; - ++_s51_itemsCtr2; - } - break; - - default: - if (_vm->getRandom(4) != 0 || _s51_itemsCtr2 >= 2) { - if (_vm->getRandom(9) != 0) - _s51_items[index]._currSequenceId = 0xBD; - else - _s51_items[index]._currSequenceId = 0xC0; - } else { - --_s51_itemsCtr1; - _s51_items[index]._currSequenceId = 0xBA; - ++_s51_itemsCtr2; - } - break; - } - - if (_s51_itemInsertDirection) { - _s51_itemInsertX -= 73; - if (_s51_itemInsertX < 129) { - _s51_itemInsertX += 146; - _s51_itemInsertDirection = 0; - } - } else { - _s51_itemInsertX += 73; - if (_s51_itemInsertX > 685) { - _s51_itemInsertX -= 146; - _s51_itemInsertDirection = 1; - } - } - - if (_s51_itemInsertX > 685) - _s51_itemInsertX = 685; - - if (_s51_itemInsertX < 129) - _s51_itemInsertX = 129; - - if (_s51_items[index]._currSequenceId == 0xBA) { - _s51_items[index]._x2 = _vm->getRandom(350) + 200; - _s51_items[index]._x = _s51_items[index]._x2 - 362; - _s51_items[index]._y = 15; - _s51_items[index]._id = 249 - index; - } else { - _s51_items[index]._collisionX = _s51_itemInsertX; - _s51_items[index]._x = _s51_items[index]._collisionX - 395; - if (_s51_items[index]._currSequenceId == 0xC0) - _s51_items[index]._x -= 65; - _s51_items[index]._id = index + 250; - _s51_items[index]._canCatch = true; - } - - _vm->_gameSys->setAnimation(_s51_items[index]._currSequenceId, _s51_items[index]._id, index + 1); - _vm->_gameSys->insertSequence(_s51_items[index]._currSequenceId, _s51_items[index]._id, 0, 0, - kSeqNone, 0, _s51_items[index]._x, _s51_items[index]._y); - - _vm->_timers[0] = _s51_dropSpeedTicks; - - if (_s51_nextDropItemKind >= 3) - _vm->_timers[0] = 20; - - if (_s51_nextDropItemKind >= 5) - _vm->_timers[0] = 5; - - if (_s51_nextDropItemKind == 8) - _vm->_timers[0] = 4; - - ++_s51_itemsCtr; -} - -void Scene51::updateItemAnimations() { - for (int i = 0; i < 6; ++i) { - if (_vm->_gameSys->getAnimationStatus(i + 1) == 2) - updateItemAnimation(&_s51_items[i], i); - } -} - -int Scene51::checkCollision(int sequenceId) { - bool jumpingLeft = false, jumpingRight = false; - int v8, v4; - int result = 0; - - if (!isJumping(sequenceId)) - return false; - - bool checkFl = false; - for (int i = 0; i < 6; i++) - checkFl |= _s51_items[i]._isCollision; - - if (!checkFl) - return false; - - if (isJumpingRight(sequenceId)) { - v8 = getPosRight(sequenceId); - v4 = getPosRight(sequenceId + 1); - jumpingRight = true; - } else if (isJumpingLeft(sequenceId)) { - v4 = getPosLeft(sequenceId - 1) + 33; - v8 = getPosLeft(sequenceId) + 33; - jumpingLeft = true; - } - - if (jumpingRight || jumpingLeft) { - int v5 = 0; - int i; - for (i = 0; i < 6; ++i) { - if (_s51_items[i]._isCollision) { - if (jumpingRight && _s51_items[i]._x2 > v8 && _s51_items[i]._x2 < v4) { - v5 = v8 - 359; - if (v5 == 0) - v5 = 1; - _s51_platypusNextSequenceId = 0xB6; - break; - } else if (jumpingLeft && _s51_items[i]._x2 < v4 && _s51_items[i]._x2 > v8) { - v5 = v8 - 344; - if (v5 == 0) - v5 = 1; - _s51_platypusNextSequenceId = 0xB7; - break; - } - } - } - if (v5) { - _vm->_gameSys->setAnimation(0xBC, _s51_items[i]._id, i + 1); - _vm->_gameSys->insertSequence(0xBC, _s51_items[i]._id, _s51_items[i]._currSequenceId, _s51_items[i]._id, kSeqSyncWait, 0, _s51_items[i]._x, 15); - _s51_items[i]._isCollision = false; - _s51_items[i]._currSequenceId = 0xBC; - --_s51_itemsCtr2; - } - result = v5; - } - - return result; -} - -void Scene51::updateItemAnimation(Scene51Item *item, int index) { - - switch (item->_currSequenceId) { - case 0xBD: - case 0xC0: - case 0xC1: - // Falling coin and banknote - if (!itemIsCaught(item)) { - if (_s51_dropLoseCash) { - if (item->_currSequenceId == 0xBD) - _s51_cashAmount -= 2; - else - _s51_cashAmount -= 25; - if (_s51_cashAmount < 0) - _s51_cashAmount = 0; - updateCash(_s51_cashAmount); - } - item->_droppedSequenceId = item->_currSequenceId + 1; - if (item->_currSequenceId != 0xC0) { - item->_canCatch = false; - _s51_dropLoseCash = true; - _s51_itemsCtr = 0; - _vm->_timers[0] = 10; - } - if (item->_droppedSequenceId) { - _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); - item->_currSequenceId = item->_droppedSequenceId; - item->_y = 0; - } - } else { - _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); - _vm->_gameSys->setAnimation(0, 0, index + 1); - _vm->playSound(218, false); - if (incCashAmount(item->_currSequenceId) == 1995) { - winMinigame(); - _vm->_sceneDone = true; - } else { - clearItem(item); - ++_s51_itemsCaughtCtr; - if (_s51_itemsCaughtCtr == 5) - --_s51_dropSpeedTicks; - if (_s51_itemsCaughtCtr == 8) - --_s51_dropSpeedTicks; - if (_s51_itemsCaughtCtr == 11) - --_s51_dropSpeedTicks; - if (_s51_itemsCaughtCtr == 14) - --_s51_dropSpeedTicks; - if (_s51_itemsCaughtCtr >= 15 && _s51_dropSpeedTicks > 4) - --_s51_dropSpeedTicks; - if (_s51_itemsCtr1 <= _s51_itemsCaughtCtr) { - ++_s51_nextDropItemKind; - _s51_dropSpeedTicks = 10; - _s51_itemsCtr = 0; - _s51_itemsCtr1 = 20; - _s51_dropLoseCash = false; - _s51_itemsCaughtCtr = 0; - removeCollidedItems(); - } - } - } - break; - - case 0xBE: - // Fallen coin - item->_droppedSequenceId = item->_currSequenceId + 1; - if (item->_droppedSequenceId) { - _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); - item->_currSequenceId = item->_droppedSequenceId; - item->_y = 0; - } - break; - - case 0xBF: - case 0xC2: - // Bouncing coin and banknote - _vm->_gameSys->setAnimation(0, 0, index + 1); - _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); - clearItem(item); - break; - - case 0xBA: - // Falling banana peel - item->_droppedSequenceId = 0xBB; - item->_y = 15; - if (item->_droppedSequenceId) { - _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); - item->_currSequenceId = item->_droppedSequenceId; - item->_y = 0; - } - break; - - case 0xBB: - item->_isCollision = true; - item->_droppedSequenceId = 0; - _vm->_gameSys->setAnimation(0, 0, index + 1); - break; - - case 0xBC: - _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); - _vm->_gameSys->setAnimation(0, 0, index + 1); - clearItem(item); - break; - - default: - if (item->_droppedSequenceId) { - _vm->_gameSys->setAnimation(item->_droppedSequenceId, item->_id, index + 1); - _vm->_gameSys->insertSequence(item->_droppedSequenceId, item->_id, item->_currSequenceId, item->_id, kSeqSyncWait, 0, item->_x, item->_y); - item->_currSequenceId = item->_droppedSequenceId; - item->_y = 0; - } - break; - } -} - -void Scene51::removeCollidedItems() { - for (int i = 0; i < 6; ++i) { - if (_s51_items[i]._isCollision) { - _vm->_gameSys->removeSequence(_s51_items[i]._currSequenceId, _s51_items[i]._id, true); - _vm->_gameSys->setAnimation(0, 0, i + 1); - clearItem(&_s51_items[i]); - } - } - _s51_itemsCtr2 = 0; -} - -int Scene51::itemIsCaught(Scene51Item *item) { - if (!item->_canCatch) - return 0; - - if (isJumpingRight(_s51_platypusJumpSequenceId)) { - int v4 = getPosRight(_s51_platypusJumpSequenceId) + 97; - if (item->_collisionX < v4 && v4 - item->_collisionX < 56) - return 1; - } else { - int v2 = getPosLeft(_s51_platypusJumpSequenceId); - if (item->_collisionX > v2 && item->_collisionX - v2 < 56) - return 1; - } - - if (item->_currSequenceId == 0xC1) { - int v3 = item->_collisionX + 100; - if (isJumpingRight(_s51_platypusJumpSequenceId)) { - if (ABS(getPosRight(_s51_platypusJumpSequenceId) + 46 - v3) < 56) - return 1; - } else if (ABS(getPosLeft(_s51_platypusJumpSequenceId) + 46 - v3) < 56) { - return 1; - } - } - - return 0; -} - -bool Scene51::isJumpingRight(int sequenceId) { - return sequenceId >= 0x76 && sequenceId <= 0x95; -} - -bool Scene51::isJumpingLeft(int sequenceId) { - return sequenceId >= 0x96 && sequenceId <= 0xB5; -} - -bool Scene51::isJumping(int sequenceId) { - return sequenceId >= 0x76 && sequenceId <= 0xB5; -} - -void Scene51::waitForAnim(int animationIndex) { - while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { - // pollMessages(); - updateItemAnimations(); - _vm->gameUpdateTick(); - } -} - -int Scene51::getPosRight(int sequenceId) { - static const int kRightPosTbl[] = { - 131, 159, 178, 195, 203, 219, 238, 254, - 246, 274, 293, 310, 318, 334, 353, 369, - 362, 390, 409, 426, 434, 450, 469, 485, - 477, 505, 524, 541, 549, 565, 584, 600 - }; - - if (sequenceId >= 118 && sequenceId <= 149) - return kRightPosTbl[sequenceId - 118]; - return -1; -} - -int Scene51::getPosLeft(int sequenceId) { - static const int kLeftPosTbl[] = { - 580, 566, 550, 536, 526, 504, 488, 469, - 460, 446, 430, 416, 406, 384, 368, 349, - 342, 328, 312, 298, 288, 266, 250, 231, - 220, 206, 190, 176, 166, 144, 128, 109 - }; - - if (sequenceId >= 150 && sequenceId <= 181) - return kLeftPosTbl[sequenceId - 150]; - return -1; -} - -void Scene51::playIntroAnim() { - int soundCtr = 0; - - _s51_platypusSequenceId = 0x76; - _s51_platypusNextSequenceId = 0x76; - - for (int i = 0; i < 6; ++i) - clearItem(&_s51_items[i]); - - _s51_items[0]._currSequenceId = 0xBA; - _s51_items[0]._x2 = 320; - _s51_items[0]._x = -42; - _s51_items[0]._y = 15; - _s51_items[0]._id = 249; - _s51_items[0]._isCollision = true; - - _vm->_gameSys->insertSequence(_s51_platypusSequenceId, 256, 0, 0, kSeqNone, 0, -179, 0); - _vm->_gameSys->insertSequence(0xBA, 249, 0, 0, kSeqNone, 0, _s51_items[0]._x, _s51_items[0]._y); - _vm->_gameSys->setAnimation(0xBA, 249, 1); - _vm->_gameSys->setAnimation(_s51_platypusSequenceId, 256, 0); - - while (_s51_platypusSequenceId < 0x80) { - waitForAnim(0); - ++_s51_platypusNextSequenceId; - _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, -179, 0); - _s51_platypusSequenceId = _s51_platypusNextSequenceId; - ++soundCtr; - if (soundCtr % 4 == 0) - _vm->playSound(214, false); - } - - _s51_platypusNextSequenceId = 0x75; - - while (_s51_platypusSequenceId != 0x84) { - waitForAnim(0); - ++_s51_platypusNextSequenceId; - int oldSequenceId = _s51_platypusNextSequenceId; - int v0 = checkCollision(_s51_platypusNextSequenceId); - _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, v0, 0); - _s51_platypusSequenceId = _s51_platypusNextSequenceId; - if (v0) { - _s51_platypusNextSequenceId = oldSequenceId; - } else { - ++soundCtr; - if (soundCtr % 4 == 0) - _vm->playSound(214, false); - } - } - waitForAnim(0); -} - -void Scene51::updateGuyAnimation() { - if (!_vm->_timers[4]) { - _vm->_timers[4] = _vm->getRandom(20) + 60; - - switch (_vm->getRandom(5)) { - case 0: - _s51_guyNextSequenceId = 0xC3; - break; - case 1: - _s51_guyNextSequenceId = 0xC4; - break; - case 2: - _s51_guyNextSequenceId = 0xC5; - break; - case 3: - _s51_guyNextSequenceId = 0xC6; - break; - case 4: - _s51_guyNextSequenceId = 0xC7; - break; - } - - _vm->_gameSys->insertSequence(_s51_guyNextSequenceId, 39, _s51_guySequenceId, 39, kSeqSyncWait, 0, 0, 0); - _s51_guySequenceId = _s51_guyNextSequenceId; - _s51_guyNextSequenceId = -1; - } -} - -int Scene51::incCashAmount(int sequenceId) { - switch (sequenceId) { - case 0xBD: - _s51_cashAmount += 10; - break; - case 0xC0: - case 0xC1: - _s51_cashAmount += 100; - break; - case 0xB6: - case 0xB7: - _s51_cashAmount -= 10 * _vm->getRandom(5) + 50; - if (_s51_cashAmount < 0) - _s51_cashAmount = 0; - break; - } - if (_s51_cashAmount > 1995) - _s51_cashAmount = 1995; - updateCash(_s51_cashAmount); - return _s51_cashAmount; -} - -void Scene51::winMinigame() { - updateCash(1995); - _vm->playSound(218, false); - // TODO delayTicksA(1, 5); - _vm->_newSceneNum = 48; - _vm->invRemove(kItemBanana); -} - -void Scene51::playCashAppearAnim() { - _vm->_gameSys->setAnimation(0xC8, 252, 0); - _vm->_gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { - _vm->gameUpdateTick(); - // checkGameAppStatus(); - } -} - -void Scene51::updateCash(int amount) { - drawDigit(amount / 1000, 0); - drawDigit(amount / 100 % 10, 1); - drawDigit(amount / 10 % 10, 2); - drawDigit(amount % 10, 3); -} - -void Scene51::drawDigit(int digit, int position) { - if (digit != _s51_digits[position]) { - _vm->_gameSys->insertSequence(kDigitSequenceIds[digit], 253, - _s51_digitSequenceIds[position], 253, - kSeqSyncWait, 0, kDigitPositions[position] - 20, -20); - _s51_digitSequenceIds[position] = kDigitSequenceIds[digit]; - _s51_digits[position] = digit; - } -} - -void Scene51::initCashDisplay() { - for (int position = 0; position < 4; ++position) { - _s51_digits[position] = 0; - _s51_digitSequenceIds[position] = kDigitSequenceIds[0]; - _vm->_gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0, - kSeqNone, 0, kDigitPositions[position] - 20, -20); - } - _s51_cashAmount = 0; -} - -void Scene51::run() { - int soundCtr = 0; - bool isIdle = true; - - _s51_itemsCtr = 0; - _vm->_newSceneNum = _vm->_prevSceneNum; - _s51_cashAmount = 0; - _s51_platypusJumpSequenceId = 0x84; - _vm->endSceneInit(); - - _vm->hideCursor(); - _vm->setGrabCursorSprite(-1); - - _s51_guySequenceId = 0xC3; - _s51_guyNextSequenceId = -1; - - _vm->_gameSys->insertSequence(0xC3, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_timers[4] = _vm->getRandom(20) + 60; - - playCashAppearAnim(); - initCashDisplay(); - playIntroAnim(); - - _s51_platypusNextSequenceId = 0x74; - _vm->_gameSys->setAnimation(0x74, 256, 0); - _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 362, 0); - _s51_platypusSequenceId = _s51_platypusNextSequenceId; - - _s51_itemInsertDirection = 0; - _s51_itemInsertX = 685; - _s51_dropSpeedTicks = 10; - _s51_nextDropItemKind = 0; - - for (int i = 0; i < 6; ++i) - clearItem(&_s51_items[i]); - - _s51_itemInsertX = _vm->getRandom(556) + 129; - _vm->_timers[0] = 15; - - _s51_itemsCaughtCtr = 0; - _s51_dropLoseCash = false; - _s51_itemsCtr1 = 20; - - _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); - _vm->clearKeyStatus1(Common::KEYCODE_LEFT); - _vm->clearKeyStatus1(Common::KEYCODE_UP); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - - bool isCollision = false; - bool startWalk = true; - - while (!_vm->_sceneDone) { - if (clearKeyStatus()) - _vm->_sceneDone = true; - - _vm->gameUpdateTick(); - - updateGuyAnimation(); - dropNextItem(); - updateItemAnimations(); - - if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { - _vm->clearKeyStatus1(Common::KEYCODE_UP); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - if (isJumpingRight(_s51_platypusJumpSequenceId)) { - waitForAnim(0); - _vm->_gameSys->setAnimation(0xB8, 256, 0); - _vm->_gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 348, 0); - _s51_platypusSequenceId = 0xB8; - waitForAnim(0); - _s51_platypusNextSequenceId += 6; - if (_s51_platypusNextSequenceId > 0x95) - _s51_platypusNextSequenceId = 0x95; - _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; - } else { - waitForAnim(0); - _vm->_gameSys->setAnimation(0xB9, 256, 0); - _vm->_gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); - _s51_platypusSequenceId = 0xB9; - waitForAnim(0); - _s51_platypusNextSequenceId += 6; - if (_s51_platypusNextSequenceId > 0xB5) - _s51_platypusNextSequenceId = 0xB5; - _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; - } - isIdle = false; - } - - while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT) && _s51_platypusNextSequenceId != 0x96) { - // pollMessages(); - if (_s51_platypusNextSequenceId == 0xB6) - _s51_platypusNextSequenceId = 0x76; - updateItemAnimations(); - if (startWalk) { - _s51_platypusNextSequenceId = 0x86; - startWalk = false; - } - - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - int collisionX = checkCollision(_s51_platypusNextSequenceId); - if (collisionX) - incCashAmount(_s51_platypusNextSequenceId); - _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); - _s51_platypusSequenceId = _s51_platypusNextSequenceId; - if (collisionX) { - isCollision = true; - ++_s51_platypusJumpSequenceId; - _s51_platypusNextSequenceId = _s51_platypusJumpSequenceId; - } else { - _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; - } - if (isJumpingRight(_s51_platypusJumpSequenceId)) { - ++_s51_platypusNextSequenceId; - if (!isCollision) { - if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { - _vm->clearKeyStatus1(Common::KEYCODE_UP); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - waitForAnim(0); - _vm->_gameSys->setAnimation(0xB8, 256, 0); - _vm->_gameSys->insertSequence(0xB8, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 348, 0); - _s51_platypusSequenceId = 0xB8; - waitForAnim(0); - _s51_platypusNextSequenceId += 6; - if (_s51_platypusNextSequenceId > 0x95) - _s51_platypusNextSequenceId = 0x95; - _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; - } else { - ++soundCtr; - if (soundCtr % 4 == 0) - _vm->playSound(214, false); - } - } - } else { - _s51_platypusNextSequenceId = 150 - (_s51_platypusJumpSequenceId - 150); - } - isCollision = false; - isIdle = false; - } - _vm->gameUpdateTick(); - } - - while (_vm->isKeyStatus2(Common::KEYCODE_LEFT) && _s51_platypusNextSequenceId != 0xB6) { - // pollMessages(); - updateItemAnimations(); - if (startWalk) { - _s51_platypusNextSequenceId = 0xA5; - startWalk = false; - } - - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - int collisionX = checkCollision(_s51_platypusNextSequenceId); - if (collisionX) - incCashAmount(_s51_platypusNextSequenceId); - _vm->_gameSys->setAnimation(_s51_platypusNextSequenceId, 256, 0); - _vm->_gameSys->insertSequence(_s51_platypusNextSequenceId, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, collisionX, 0); - _s51_platypusSequenceId = _s51_platypusNextSequenceId; - if (collisionX) { - isCollision = true; - ++_s51_platypusJumpSequenceId; - _s51_platypusNextSequenceId = _s51_platypusJumpSequenceId; - } else { - _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; - } - if (isJumpingLeft(_s51_platypusJumpSequenceId)) { - ++_s51_platypusNextSequenceId; - if (!isCollision) { - if (_vm->isKeyStatus2(Common::KEYCODE_UP) || _vm->isKeyStatus2(Common::KEYCODE_SPACE)) { - _vm->clearKeyStatus1(Common::KEYCODE_UP); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - waitForAnim(0); - _vm->_gameSys->setAnimation(0xB9, 256, 0); - _vm->_gameSys->insertSequence(0xB9, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 338, 0); - _s51_platypusSequenceId = 0xB9; - waitForAnim(0); - _s51_platypusNextSequenceId += 6; - if (_s51_platypusNextSequenceId > 0xB5) - _s51_platypusNextSequenceId = 0xB5; - _s51_platypusJumpSequenceId = _s51_platypusNextSequenceId; - } else { - ++soundCtr; - if (soundCtr % 4 == 0) - _vm->playSound(214, false); - } - } - } else { - _s51_platypusNextSequenceId = 182 - (_s51_platypusJumpSequenceId - 118); - } - isCollision = false; - isIdle = false; - } - _vm->gameUpdateTick(); - } - - if (!isIdle && _vm->_gameSys->getAnimationStatus(0) == 2) { - if (isJumpingRight(_s51_platypusJumpSequenceId)) { - _vm->_gameSys->setAnimation(0x74, 256, 0); - _vm->_gameSys->insertSequence(0x74, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosRight(_s51_platypusJumpSequenceId) - 362, 0); - _s51_platypusSequenceId = 0x74; - } else { - _vm->_gameSys->setAnimation(0x75, 256, 0); - _vm->_gameSys->insertSequence(0x75, 256, _s51_platypusSequenceId, 256, kSeqSyncWait, 0, getPosLeft(_s51_platypusJumpSequenceId) - 341, 0); - _s51_platypusSequenceId = 0x75; - } - waitForAnim(0); - isIdle = true; - } - } - - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _vm->clearKeyStatus1(Common::KEYCODE_UP); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); - _vm->clearKeyStatus1(Common::KEYCODE_LEFT); - - _vm->_gameSys->setAnimation(0, 0, 0); - for (int i = 0; i < 6; ++i) - _vm->_gameSys->setAnimation(0, 0, i + 1); - - _vm->showCursor(); -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene51.h b/engines/gnap/scenes/scene51.h deleted file mode 100644 index 44fbd3d4d1..0000000000 --- a/engines/gnap/scenes/scene51.h +++ /dev/null @@ -1,101 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE51_H -#define GNAP_SCENE51_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -struct Scene51Item { - int _currSequenceId; - int _droppedSequenceId; - int _x, _y; - int _collisionX; - bool _canCatch; - bool _isCollision; - int _x2; - int _id; -}; - -class Scene51: public Scene { -public: - Scene51(GnapEngine *vm); - ~Scene51() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations() {}; - virtual void updateAnimationsCb() {}; - -private: - bool _s51_dropLoseCash; - - int _s51_cashAmount; - int _s51_digits[4]; - int _s51_digitSequenceIds[4]; - int _s51_guySequenceId; - int _s51_guyNextSequenceId; - int _s51_itemsCaughtCtr; - int _s51_dropSpeedTicks; - int _s51_nextDropItemKind; - int _s51_itemInsertX; - int _s51_itemInsertDirection; - int _s51_platypusSequenceId; - int _s51_platypusNextSequenceId; - int _s51_platypusJumpSequenceId; - int _s51_itemsCtr; - int _s51_itemsCtr1; - int _s51_itemsCtr2; - - Scene51Item _s51_items[6]; - - void clearItem(Scene51Item *item); - void dropNextItem(); - void updateItemAnimations(); - int checkCollision(int sequenceId); - void updateItemAnimation(Scene51Item *item, int index); - void removeCollidedItems(); - int itemIsCaught(Scene51Item *item); - bool isJumpingRight(int sequenceId); - bool isJumpingLeft(int sequenceId); - bool isJumping(int sequenceId); - void waitForAnim(int animationIndex); - int getPosRight(int sequenceId); - int getPosLeft(int sequenceId); - void playIntroAnim(); - void updateGuyAnimation(); - int incCashAmount(int sequenceId); - void winMinigame(); - void playCashAppearAnim(); - void updateCash(int amount); - void drawDigit(int digit, int position); - void initCashDisplay(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE51_H diff --git a/engines/gnap/scenes/scene52.cpp b/engines/gnap/scenes/scene52.cpp deleted file mode 100644 index ba1b0ff79e..0000000000 --- a/engines/gnap/scenes/scene52.cpp +++ /dev/null @@ -1,894 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene52.h" - -namespace Gnap { - -Scene52::Scene52(GnapEngine *vm) : Scene(vm) { - _s52_gameScore = 0; - _s52_aliensInitialized = false; - _s52_alienDirection = 0; - _s52_soundToggle = false; -} - -int Scene52::init() { - initAnims(); - return 0x2B; -} - -void Scene52::updateHotspots() { - _vm->_hotspotsCount = 0; -} - -void Scene52::update() { - for (int rowNum = 0; rowNum < 7; ++rowNum) { - _vm->gameUpdateTick(); - if (_vm->_gameSys->getAnimationStatus(_s52_alienRowAnims[rowNum]) == 2) { - updateAlienRow(rowNum); - rowNum = 0; - } - } - - if (_s52_liveAlienRows == 0 && !_s52_alienSingle) { - _s52_alienWave = false; - _vm->playSound(48, false); - ++_s52_alienCounter; - if (_s52_alienCounter != 3) { - _vm->_timers[0] = 50; - _vm->_timers[2] = 100; - _s52_alienRowDownCtr = 0; - _s52_alienSingle = true; - } - } - - if (_s52_alienSingle && !_vm->_timers[0]) { - initAliens(); - _s52_alienSingle = false; - _vm->_timers[2] = 5; - _s52_alienWave = true; - } - - if ((_s52_alienRowDownCtr || _s52_liveAlienRows == 0) && !_s52_alienSingle) { - moveDownAlienRow(); - _s52_alienRowDownCtr = 0; - } - - if (_vm->isKeyStatus1(Common::KEYCODE_UP) || _vm->isKeyStatus1(Common::KEYCODE_SPACE)) { - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(Common::KEYCODE_UP); - if (!_s52_aliensCount) - fireShipCannon(_s52_shipPosX); - } - - if (_s52_shipCannonFiring) - updateShipCannon(); - - fireAlienCannon(); - updateAlienCannons(); - - if (_s52_aliensCount == 1) { - _s52_alienWave = false; - _vm->_timers[3] = 20; - _vm->_timers[2] = 100; - ++_s52_aliensCount; - } - - if (_s52_aliensCount && !_vm->_timers[3]) { - updateAliens(); - loseShip(); - if (_s52_shipsLeft != 0) { - _vm->_timers[3] = 40; - while (_vm->_timers[3]) { - updateAlienCannons(); - if (_s52_shipCannonFiring) - updateShipCannon(); - _vm->gameUpdateTick(); - } - initAliens(); - _s52_shipPosX = (800 - _s52_shipMidX) / 2; - _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); - _s52_ufoSequenceId = _s52_nextUfoSequenceId; - _vm->_timers[2] = 5; - _s52_alienWave = true; - } else { - _vm->_sceneDone = true; - } - } - - if (_vm->_timers[1] || getFreeShipCannon() == -1) { - _s52_nextUfoSequenceId = 34; - if (_s52_ufoSequenceId != 34) - _s52_shipFlag = true; - } else { - _s52_nextUfoSequenceId = 34; - if (_s52_ufoSequenceId != 34) - _s52_shipFlag = true; - } - - if (_s52_shipFlag) { - if (_vm->_gameSys->getAnimationStatus(7) == 2) { - _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); - _s52_ufoSequenceId = _s52_nextUfoSequenceId; - } - _s52_shipFlag = false; - } - - if (_s52_alienWave && !_vm->_timers[0]) { - playSound(); - int v0 = _s52_alienSpeed; - if (_s52_alienSpeed >= 10) - v0 = 10; - int v1 = v0; - if (v0 < 2) - v1 = 2; - _vm->_timers[0] = v1; - } -} - -void Scene52::initShipCannon(int bottomY) { - _s52_shipCannonFired = false; - _s52_shipCannonWidth = MAX(_vm->_gameSys->getSpriteWidthById(14), _vm->_gameSys->getSpriteWidthById(16)); - _s52_shipCannonHeight = MAX(_vm->_gameSys->getSpriteHeightById(14), _vm->_gameSys->getSpriteHeightById(16)); - _s52_shipCannonTopY = bottomY - _s52_shipCannonHeight; - _s52_shipCannonFiring = false; -} - -void Scene52::initAlienCannons() { - for (int i = 0; i < 3; ++i) { - _s52_alienCannonIds[i] = 0; - _s52_alienCannonFired[i] = 0; - } - _s52_alienCannonSequenceIds[0] = 30; - _s52_alienCannonSequenceIds[1] = 31; - _s52_alienCannonSequenceIds[2] = 32; -} - -void Scene52::fireShipCannon(int posX) { - if (_vm->_timers[1]) - return; - - int cannonNum = getFreeShipCannon(); - if (cannonNum != -1) { - _s52_shipCannonPosX = _s52_shipMidX / 2 + posX - _s52_shipCannonWidth / 2; - _s52_shipCannonPosY = _s52_shipCannonTopY; - _vm->_gameSys->setAnimation(0x23, cannonNum + 256, cannonNum + 8); - _vm->_gameSys->insertSequence(0x23, cannonNum + 256, 0, 0, kSeqNone, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); - _vm->playSound(0x2D, false); - if (shipCannonHitShield(cannonNum)) { - _vm->_gameSys->setAnimation(0, 0, cannonNum + 8); - _vm->_gameSys->removeSequence(0x23, cannonNum + 256, true); - } else { - _s52_shipCannonFired = true; - _s52_shipCannonPosY -= 13; - _s52_shipCannonFiring = true; - } - _vm->_timers[1] = 5; - } -} - -void Scene52::fireAlienCannon() { - if (_vm->_timers[2]) - return; - - int cannonNum = getFreeAlienCannon(); - if (cannonNum != -1) { - int alienX1 = _s52_alienLeftX + _s52_alienRowXOfs[0]; - int alienX2 = _s52_alienLeftX + _s52_alienRowXOfs[0] + 5 * _s52_alienWidth - (_s52_alienWidth / 2 - 15); - _s52_alienCannonPosX[cannonNum] = _vm->getRandom(alienX2 - alienX1) + alienX1; - _s52_alienCannonPosY[cannonNum] = 104; - _s52_alienCannonFired[cannonNum] = 1; - _vm->_gameSys->setAnimation(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, cannonNum + 9); - _vm->_gameSys->insertSequence(_s52_alienCannonSequenceIds[cannonNum], _s52_alienCannonIds[cannonNum] + 256, 0, 0, - kSeqNone, 0, _s52_alienCannonPosX[cannonNum], _s52_alienCannonPosY[cannonNum]); - _s52_alienCannonPosY[cannonNum] -= 13; - _vm->_timers[2] = 5; - } -} - -int Scene52::getFreeShipCannon() { - if (!_s52_shipCannonFired) - return 0; - return -1; -} - -int Scene52::getFreeAlienCannon() { - for (int i = 0; i < 3; ++i) - if (!_s52_alienCannonFired[i]) - return i; - return -1; -} - -void Scene52::updateShipCannon() { - if (_s52_shipCannonFired && _vm->_gameSys->getAnimationStatus(8) == 2) { - _s52_shipCannonPosY -= 13; - if (_s52_shipCannonPosY - 13 >= 135) { - if (updateHitAlien()) { - _vm->_gameSys->setAnimation(0, 0, 8); - _vm->_gameSys->removeSequence(35, 256, true); - _s52_shipCannonFired = false; - drawScore(_s52_gameScore); - } else { - _vm->_gameSys->setAnimation(35, 256, 8); - _vm->_gameSys->insertSequence(35, 256, 35, 256, kSeqSyncWait, 0, _s52_shipCannonPosX, _s52_shipCannonPosY); - _s52_shipCannonPosY -= 13; - } - } else { - _vm->_gameSys->setAnimation(0, 0, 8); - _vm->_gameSys->removeSequence(35, 256, true); - _s52_shipCannonFired = false; - } - } -} - -void Scene52::updateAlienCannons() { - for (int i = 0; i < 3; ++i) { - if (_s52_alienCannonFired[i] && _vm->_gameSys->getAnimationStatus(i + 9) == 2) { - _s52_alienCannonPosY[i] += 13; - if (_s52_shipCannonHeight + _s52_alienCannonPosY[i] + 13 <= 550) { - if (alienCannonHitShip(i)) { - _vm->_gameSys->setAnimation(0, 0, i + 9); - _s52_alienCannonFired[i] = 0; - shipExplode(); - } else if (alienCannonHitShield(i)) { - _s52_alienCannonFired[i] = 0; - } else { - _vm->_gameSys->insertSequence(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, 0, 0, - kSeqNone, 0, _s52_alienCannonPosX[i], _s52_alienCannonPosY[i]); - _vm->_gameSys->setAnimation(_s52_alienCannonSequenceIds[i], 1 - _s52_alienCannonIds[i] + 256, i + 9); - _s52_alienCannonIds[i] = 1 - _s52_alienCannonIds[i]; - _s52_alienCannonPosY[i] += 13; - } - } else { - _vm->_gameSys->setAnimation(0, 0, i + 9); - _s52_alienCannonFired[i] = 0; - } - } - } -} - -void Scene52::initAliens() { - if (!_s52_aliensInitialized) { - initAlienSize(); - _s52_aliensInitialized = true; - } - - _s52_liveAlienRows = 0; - _s52_alienSpeed = 0; - _s52_bottomAlienFlag = false; - _s52_aliensCount = 0; - _s52_alienSingle = false; - _s52_alienRowDownCtr = 0; - - initShields(); - - _s52_alienRowKind[0] = -1; - _s52_alienRowKind[1] = -1; - _s52_alienRowKind[2] = -1; - _s52_alienRowKind[3] = -1; - _s52_alienRowKind[4] = _vm->getRandom(2) != 0 ? 24 : 27; - _s52_alienRowKind[5] = _vm->getRandom(2) != 0 ? 25 : 28; - _s52_alienRowKind[6] = _vm->getRandom(2) != 0 ? 26 : 29; - - for (int i = 0; i < 7; ++i) { - _s52_alienRowAnims[i] = i; - _s52_alienRowXOfs[i] = 0; - initAlienRowKind(i, _s52_alienRowKind[i]); - insertAlienRow(i); - } -} - -void Scene52::initAlienRowKind(int rowNum, int alienKind) { - for (int i = 0; i < 5; ++i) - _s52_items[rowNum][i] = alienKind; -} - -void Scene52::insertAlienRow(int rowNum) { - if (_s52_alienRowKind[rowNum] >= 0) { - insertAlienRowAliens(rowNum); - _s52_alienRowIds[rowNum] = 256; - _vm->_gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); - ++_s52_liveAlienRows; - } -} - -void Scene52::insertAlienRowAliens(int rowNum) { - int xOffs = _s52_alienLeftX; - int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10; - for (int i = 0; i < 5; ++i) { - if (_s52_items[rowNum][i] >= 0) { - _vm->_gameSys->insertSequence(_s52_items[rowNum][i], i + 256, 0, 0, kSeqNone, 0, xOffs, yOffs); - ++_s52_alienSpeed; - } - xOffs += _s52_alienWidth; - } -} - -void Scene52::updateAlienRow(int rowNum) { - if (_s52_alienRowKind[rowNum] != -1 && !checkAlienRow(rowNum)) { - updateAlienRowXOfs(); - _s52_alienRowIds[rowNum] = -1; - int xOffs = _s52_alienLeftX + _s52_alienRowXOfs[rowNum]; - int yOffs = _s52_alienTopY - 52 * rowNum - _s52_alienHeight + 10; - for (int i = 0; i < 5; ++i) { - if (_s52_items[rowNum][i] >= 0) { - _vm->_gameSys->insertSequence(_s52_items[rowNum][i], i + 256, _s52_items[rowNum][i], i + 256, kSeqSyncWait, 0, xOffs, yOffs); - if (_s52_alienRowIds[rowNum] == -1) - _s52_alienRowIds[rowNum] = i + 256; - } else if (_s52_items[rowNum][i] == -2) { - _vm->_gameSys->removeSequence(_s52_alienRowKind[rowNum], i + 256, true); - _s52_items[rowNum][i] = -1; - --_s52_alienSpeed; - } - xOffs += _s52_alienWidth; - } - if (_s52_alienRowIds[rowNum] == -1) { - _vm->_gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); - // MessageBoxA(0, "No live aliens!", "Error 3:", 0x30u); - } else { - _vm->_gameSys->setAnimation(_s52_alienRowKind[rowNum], _s52_alienRowIds[rowNum], _s52_alienRowAnims[rowNum]); - } - if (rowNum == 1) { - for (int j = 0; j < 3; ++j) { - if (_s52_shieldSpriteIds[j] != -1) { - _vm->_gameSys->fillSurface(0, _s52_shieldPosX[j], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); - _s52_shieldSpriteIds[j] = -1; - } - } - } - if (rowNum == 0 && _s52_bottomAlienFlag) - shipExplode(); - } -} - -void Scene52::moveDownAlienRow() { - int v2[5], v3, v1, v0, v4; - - for (int i = 0; i < 5; ++i) - v2[i] = _s52_items[0][i]; - - v3 = _s52_alienRowIds[0]; - v1 = _s52_alienRowAnims[0]; - v0 = _s52_alienRowKind[0]; - v4 = _s52_alienRowXOfs[0]; - - for (int j = 0; j < 7; ++j) { - for (int i = 0; i < 5; ++i) - _s52_items[j][i] = _s52_items[j + 1][i]; - _s52_alienRowIds[j] = _s52_alienRowIds[j + 1]; - _s52_alienRowAnims[j] = _s52_alienRowAnims[j + 1]; - _s52_alienRowKind[j] = _s52_alienRowKind[j + 1]; - _s52_alienRowXOfs[j] = _s52_alienRowXOfs[j + 1]; - } - - for (int i = 0; i < 5; ++i) - _s52_items[6][i] = v2[i]; - - _s52_alienRowIds[6] = v3; - _s52_alienRowAnims[6] = v1; - _s52_alienRowKind[6] = v0; - _s52_alienRowXOfs[6] = v4; - - updateAlien(6); - initAlienRowKind(6, _s52_alienRowKind[6]); - insertAlienRow(6); - - _s52_bottomAlienFlag = _s52_alienRowKind[0] > -1; -} - -int Scene52::updateHitAlien() { - int result = 0, rowNum, ya; - - int y = _s52_shipCannonTopY - _s52_shipCannonPosY; - - if (y == 26) { - rowNum = 1; - ya = _s52_shipCannonPosY + 26; - } else { - if (y % 52) - return 0; - rowNum = y / 52 + 1; - ya = _s52_shipCannonPosY; - } - - if (rowNum < 7) { - int hitAlienNum = getHitAlienNum(rowNum); - if (hitAlienNum != -1 && _s52_items[rowNum][hitAlienNum] >= 0) { - _s52_gameScore = ((_s52_items[rowNum][hitAlienNum] - 24) % 3 + _s52_gameScore + 1) % 1000; - _s52_items[rowNum][hitAlienNum] = -2; - _vm->playSound(44, false); - _vm->_gameSys->insertSequence(0x21, 266, 0, 0, - kSeqNone, 0, _s52_alienLeftX + hitAlienNum * _s52_alienWidth + _s52_alienRowXOfs[rowNum] - 10, ya - _s52_alienHeight); - result = 1; - } - } - - return result; -} - -int Scene52::getHitAlienNum(int rowNum) { - int result = -1; - - int v3 = _s52_alienLeftX + _s52_alienRowXOfs[rowNum]; - - if (_s52_shipCannonPosX >= v3) { - int v8 = _s52_alienWidth / 2 - 15; - if (v3 + 5 * _s52_alienWidth - v8 >= _s52_shipCannonPosX) { - int v4 = v3 + _s52_alienWidth; - if (_s52_shipCannonPosX >= v4 - v8) { - int v5 = v4 + _s52_alienWidth; - if (_s52_shipCannonPosX >= v5 - v8) { - int v6 = v5 + _s52_alienWidth; - if (_s52_shipCannonPosX >= v6 - v8) { - int v7 = v6 + _s52_alienWidth; - if (_s52_shipCannonPosX >= v7 - v8) { - if (_s52_shipCannonPosX >= v7 + _s52_alienWidth - v8) - result = -1; - else - result = 4; - } else { - result = 3; - } - } else { - result = 2; - } - } else { - result = 1; - } - } else { - result = 0; - } - } else { - result = -1; - } - } else { - result = -1; - } - return result; -} - -int Scene52::alienCannonHitShip(int cannonNum) { - int result = 0; - - if (_s52_aliensCount) { - result = 0; - } else { - int cannonY = _s52_alienCannonPosY[cannonNum] - 13; - if (_s52_arcadeScreenBottom <= cannonY) { - if (_s52_shipMidY + _s52_arcadeScreenBottom > cannonY) { - if (_s52_alienCannonPosX[cannonNum] >= _s52_shipPosX) - result = _s52_alienCannonPosX[cannonNum] < _s52_shipMidX + _s52_shipPosX; - else - result = 0; - } else { - result = 0; - } - } else { - result = 0; - } - } - return result; -} - -int Scene52::alienCannonHitShield(int cannonNum) { - int result = 0; - - int v3 = _s52_alienCannonPosY[cannonNum] + 39; - if (_s52_arcadeScreenBottom - 44 > v3) - return 0; - - if (_s52_arcadeScreenBottom <= v3) - return 0; - - if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[0]) - return 0; - - if (_s52_alienCannonPosX[cannonNum] > _s52_shieldPosX[2] + 33) - return 0; - - int shieldNum = -1; - if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[0] + 33) - shieldNum = 0; - - if (shieldNum < 0 && _s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[1]) - return 0; - - if (shieldNum < 0 && _s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[1] + 33) - shieldNum = 1; - - if (shieldNum < 0) { - if (_s52_alienCannonPosX[cannonNum] < _s52_shieldPosX[2]) - return 0; - shieldNum = 2; - } - - if (_s52_shieldSpriteIds[shieldNum] == -1) { - result = 0; - } else { - ++_s52_shieldSpriteIds[shieldNum]; - if (_s52_shieldSpriteIds[shieldNum] <= 21) { - _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); - } else { - _vm->_gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); - _s52_shieldSpriteIds[shieldNum] = -1; - } - _vm->_gameSys->setAnimation(0, 0, cannonNum + 9); - _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_alienCannonPosX[cannonNum] - 18, _s52_arcadeScreenBottom - 44); - _vm->playSound(0x2C, false); - result = 1; - } - - return result; -} - -bool Scene52::shipCannonHitShield(int cannonNum) { - bool result = false; - - if (_s52_shipCannonPosX < _s52_shieldPosX[0]) - return result; - - if (_s52_shipCannonPosX > _s52_shieldPosX[2] + 33) - return result; - - int shieldNum = -1; - if (_s52_shipCannonPosX < _s52_shieldPosX[0] + 33) - shieldNum = 0; - - if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1]) - return result; - - if (shieldNum < 0 && _s52_shipCannonPosX < _s52_shieldPosX[1] + 33) - shieldNum = 1; - - if (shieldNum < 0) { - if (_s52_shipCannonPosX < _s52_shieldPosX[2]) - return result; - shieldNum = 2; - } - - if (_s52_shieldSpriteIds[shieldNum] == -1) { - result = false; - } else { - ++_s52_shieldSpriteIds[shieldNum]; - if (_s52_shieldSpriteIds[shieldNum] <= 21) { - _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, _s52_shieldSpriteIds[shieldNum]); - } else { - _vm->_gameSys->fillSurface(0, _s52_shieldPosX[shieldNum], _s52_arcadeScreenBottom - 44, 33, 44, 0, 0, 0); - _s52_shieldSpriteIds[shieldNum] = -1; - } - _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _s52_shipCannonPosX - 18, _s52_arcadeScreenBottom - 44); - _vm->playSound(0x2C, false); - result = true; - } - - return result; -} - -bool Scene52::shipCannonHitAlien() { - bool result = false; - - if (_s52_aliensCount || checkAlienRow(0)) - return false; - - int alienNextX = _s52_alienLeftX + _s52_alienRowXOfs[0]; - if (_s52_shipMidX + _s52_shipPosX >= alienNextX) { - int startX = _s52_alienWidth / 2 - 15; - if (alienNextX + 5 * _s52_alienWidth - startX >= _s52_shipPosX) { - int alienNextDeltaX = alienNextX + _s52_alienWidth; - if (_s52_items[0][0] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { - alienNextDeltaX += _s52_alienWidth; - if (_s52_items[0][1] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { - alienNextDeltaX += _s52_alienWidth; - if (_s52_items[0][2] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { - alienNextDeltaX += _s52_alienWidth; - if (_s52_items[0][3] <= -1 || alienNextDeltaX - startX <= _s52_shipPosX) { - alienNextDeltaX += _s52_alienWidth; - result = _s52_items[0][4] > -1 && alienNextDeltaX - startX > _s52_shipPosX; - } else { - result = true; - } - } else { - result = true; - } - } else { - result = true; - } - } else { - result = true; - } - } else { - result = false; - } - } else { - result = false; - } - - return result; -} - -void Scene52::shipExplode() { - if (!_s52_aliensCount) { - _vm->_gameSys->setAnimation(0, 0, 7); - _vm->_gameSys->removeSequence(_s52_ufoSequenceId, 256, true); - _vm->playSound(44, false); - _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); - _s52_aliensCount = 1; - _vm->playSound(0x31, false); - } -} - -bool Scene52::checkAlienRow(int rowNum) { - for (int i = 0; i < 5; ++i) { - if (_s52_items[rowNum][i] >= 0) - return false; - } - - bool found = false; - for (int j = 0; j < 5; ++j) - if (_s52_items[rowNum][j] == -2) { - _vm->_gameSys->removeSequence(_s52_alienRowKind[rowNum], j + 256, true); - _s52_items[rowNum][j] = -1; - --_s52_alienSpeed; - found = true; - } - - if (found) { - _vm->_gameSys->setAnimation(0, 0, _s52_alienRowAnims[rowNum]); - --_s52_liveAlienRows; - } - - if (_s52_liveAlienRows < 0) - _s52_liveAlienRows = 0; - - return true; -} - -void Scene52::updateAlienRowXOfs() { - int amount = 2 * (3 - _s52_liveAlienRows) + 1; - - if (_s52_alienSpeed == 2) - amount *= 4; - else if (_s52_alienSpeed == 1) - amount *= 10; - - if (_s52_alienDirection) { - for (int i = 0; i < 7; ++i) { - _s52_alienRowXOfs[i] -= amount; - if (_s52_alienRowXOfs[i] <= -100) { - _s52_alienRowXOfs[i] = -100; - _s52_alienDirection = 0; - ++_s52_alienRowDownCtr; - } - } - } else { - for (int j = 0; j < 7; ++j) { - _s52_alienRowXOfs[j] += amount; - if (_s52_alienRowXOfs[j] >= 100) { - _s52_alienRowXOfs[j] = 100; - _s52_alienDirection = 1; - ++_s52_alienRowDownCtr; - } - } - } -} - -void Scene52::initAlienSize() { - _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(0); - if (_vm->_gameSys->getSpriteWidthById(1) > _s52_alienWidth) - _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(1); - if (_vm->_gameSys->getSpriteWidthById(4) > _s52_alienWidth) - _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(4); - if (_vm->_gameSys->getSpriteWidthById(5) > _s52_alienWidth) - _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(5); - if (_vm->_gameSys->getSpriteWidthById(12) > _s52_alienWidth) - _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(12); - if (_vm->_gameSys->getSpriteWidthById(13) > _s52_alienWidth) - _s52_alienWidth = _vm->_gameSys->getSpriteWidthById(13); - - _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(0); - if (_vm->_gameSys->getSpriteHeightById(1) > _s52_alienHeight) - _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(1); - if (_vm->_gameSys->getSpriteHeightById(4) > _s52_alienHeight) - _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(4); - if (_vm->_gameSys->getSpriteHeightById(5) > _s52_alienHeight) - _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(5); - if (_vm->_gameSys->getSpriteHeightById(12) > _s52_alienHeight) - _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(12); - if (_vm->_gameSys->getSpriteHeightById(13) > _s52_alienHeight) - _s52_alienHeight = _vm->_gameSys->getSpriteHeightById(13); - - _s52_alienTopY = _s52_shipCannonTopY + 52; - _s52_alienLeftX = (800 - 5 * _s52_alienWidth) / 2; -} - -void Scene52::playSound() { - if (_s52_soundToggle) { - _vm->playSound(0x2F, false); - _s52_soundToggle = false; - } else { - _vm->playSound(0x2E, false); - _s52_soundToggle = true; - } -} - -void Scene52::updateAliens() { - for (int i = 0; i < 7; ++i) - updateAlien(i); -} - -void Scene52::updateAlien(int rowNum) { - if (_s52_alienRowKind[rowNum] >= 0 && !checkAlienRow(rowNum)) { - for (int i = 0; i < 5; ++i) { - if (_s52_items[rowNum][i] >= 0) - _s52_items[rowNum][i] = -2; - } - checkAlienRow(rowNum); - } -} - -void Scene52::loseShip() { - --_s52_shipsLeft; - if (_s52_shipsLeft == 2) { - _vm->_gameSys->fillSurface(0, 120, 140, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); - } else if (_s52_shipsLeft == 1) { - _vm->_gameSys->fillSurface(0, 120, 185, _s52_shipMidX, _s52_shipMidY, 0, 0, 0); - } -} - -void Scene52::initShields() { - for (int i = 0; i < 3; ++i) { - _vm->_gameSys->drawSpriteToBackground(_s52_shieldPosX[i], _s52_arcadeScreenBottom - 44, 17); - _s52_shieldSpriteIds[i] = 17; - } -} - -void Scene52::initAnims() { - for (int i = 0; i < 7; ++i) - _vm->_gameSys->setAnimation(0, 0, i); - _vm->_gameSys->setAnimation(0, 0, 7); - for (int j = 0; j < 1; ++j) - _vm->_gameSys->setAnimation(0, 0, j + 8); - for (int k = 0; k < 3; ++k) - _vm->_gameSys->setAnimation(0, 0, k + 9); -} - -void Scene52::drawScore(int score) { - char str[4]; - sprintf(str, "%03d", score); - _vm->_gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); - _vm->_gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); -} - -void Scene52::run() { - _vm->_timers[1] = 0; - - _vm->hideCursor(); - - // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000); - // TODO setFontSize(24); - - _s52_gameScore = 0; - _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); - _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); - - drawScore(0); - - _s52_shipMidX = 33; - _s52_shipMidY = _vm->_gameSys->getSpriteHeightById(15); - _s52_shipPosX = (800 - _s52_shipMidX) / 2; - _s52_arcadeScreenBottom = 496; - _s52_arcadeScreenRight = 595 - _s52_shipMidX; - _s52_arcadeScreenLeft = 210; - _s52_shipsLeft = 3; - _s52_alienCounter = 0; - - _s52_shieldPosX[0] = 247; - _s52_shieldPosX[1] = 387; - _s52_shieldPosX[2] = 525; - - for (int i = 0; i < 3; ++i) - _s52_shieldSpriteIds[i] = -1; - - _vm->_gameSys->drawSpriteToBackground(120, 140, 0xF); - _vm->_gameSys->drawSpriteToBackground(120, 185, 0xF); - - initShipCannon(_s52_arcadeScreenBottom); - initAlienCannons(); - initAliens(); - - _s52_nextUfoSequenceId = 0x22; - _vm->_gameSys->setAnimation(0x22, 256, 7); - _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, 0, 0, kSeqNone, 0, _s52_shipPosX, _s52_arcadeScreenBottom); - - _s52_ufoSequenceId = _s52_nextUfoSequenceId; - - _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); - _vm->clearKeyStatus1(Common::KEYCODE_LEFT); - _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(Common::KEYCODE_UP); - _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - - _vm->_timers[2] = 5; - _s52_shipFlag = false; - - _vm->_timers[0] = 10; - _s52_alienWave = true; - - while (!_vm->_sceneDone) { - _vm->gameUpdateTick(); - - while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT)) { - update(); - if (_vm->_gameSys->getAnimationStatus(7) == 2) { - if (_s52_shipPosX < _s52_arcadeScreenRight) { - _s52_shipPosX += 15; - if (_s52_shipPosX > _s52_arcadeScreenRight) - _s52_shipPosX = _s52_arcadeScreenRight; - _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); - _s52_ufoSequenceId = _s52_nextUfoSequenceId; - if (_s52_bottomAlienFlag && shipCannonHitAlien()) - shipExplode(); - } - break; - } - } - - while (_vm->isKeyStatus2(Common::KEYCODE_LEFT)) { - update(); - if (_vm->_gameSys->getAnimationStatus(7) == 2) { - if (_s52_shipPosX > _s52_arcadeScreenLeft) { - _s52_shipPosX -= 15; - if (_s52_shipPosX < _s52_arcadeScreenLeft) - _s52_shipPosX = _s52_arcadeScreenLeft; - _vm->_gameSys->setAnimation(_s52_nextUfoSequenceId, 256, 7); - _vm->_gameSys->insertSequence(_s52_nextUfoSequenceId, 256, _s52_ufoSequenceId, 256, kSeqSyncWait, 0, _s52_shipPosX, _s52_arcadeScreenBottom); - _s52_ufoSequenceId = _s52_nextUfoSequenceId; - if (_s52_bottomAlienFlag && shipCannonHitAlien()) - shipExplode(); - } - break; - } - } - - update(); - - if (clearKeyStatus()) { - _s52_alienWave = false; - _vm->_gameSys->waitForUpdate(); - initAnims(); - _vm->clearKeyStatus1(30); - _vm->_sceneDone = true; - } - } - - // TODO freeFont(); - - _vm->_gameSys->waitForUpdate(); -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene52.h b/engines/gnap/scenes/scene52.h deleted file mode 100644 index 0fbc29cb71..0000000000 --- a/engines/gnap/scenes/scene52.h +++ /dev/null @@ -1,118 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE52_H -#define GNAP_SCENE52_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene52: public Scene { -public: - Scene52(GnapEngine *vm); - ~Scene52() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations() {}; - virtual void updateAnimationsCb() {}; - -private: - int _s52_liveAlienRows; - int _s52_gameScore; - bool _s52_soundToggle; - int _s52_arcadeScreenLeft; - int _s52_arcadeScreenRight; - int _s52_arcadeScreenBottom; - int _s52_shipsLeft; - int _s52_shieldSpriteIds[3]; - int _s52_shieldPosX[3]; - int _s52_shipPosX; - int _s52_shipCannonPosX, _s52_shipCannonPosY; - bool _s52_shipCannonFiring; - bool _s52_shipCannonFired; - int _s52_shipCannonWidth, _s52_shipCannonHeight; - int _s52_shipCannonTopY; - int _s52_shipMidX, _s52_shipMidY; - bool _s52_shipFlag; - bool _s52_aliensInitialized; - int _s52_alienSpeed, _s52_alienDirection; - int _s52_alienWidth, _s52_alienHeight; - int _s52_alienLeftX, _s52_alienTopY; - int _s52_alienRowDownCtr; - int _s52_alienRowKind[7]; - int _s52_alienRowAnims[7]; - int _s52_alienRowIds[7]; - int _s52_alienRowXOfs[7]; - int _s52_alienCannonFired[3]; - int _s52_alienCannonPosX[3]; - int _s52_alienCannonPosY[3]; - int _s52_alienCannonSequenceIds[3]; - int _s52_alienCannonIds[3]; - bool _s52_alienWave, _s52_alienSingle; - int _s52_alienCounter; - bool _s52_bottomAlienFlag; - int _s52_aliensCount; - int _s52_items[8][5]; - int _s52_nextUfoSequenceId, _s52_ufoSequenceId; - - void update(); - void initShipCannon(int bottomY); - void initAlienCannons(); - void fireShipCannon(int posX); - void fireAlienCannon(); - int getFreeShipCannon(); - int getFreeAlienCannon(); - void updateShipCannon(); - void updateAlienCannons(); - void initAliens(); - void initAlienRowKind(int rowNum, int alienKind); - void insertAlienRow(int rowNum); - void insertAlienRowAliens(int rowNum); - void updateAlienRow(int rowNum); - void moveDownAlienRow(); - int updateHitAlien(); - int getHitAlienNum(int rowNum); - int alienCannonHitShip(int cannonNum); - int alienCannonHitShield(int cannonNum); - bool shipCannonHitShield(int cannonNum); - bool shipCannonHitAlien(); - void shipExplode(); - bool checkAlienRow(int rowNum); - void updateAlienRowXOfs(); - void initAlienSize(); - void playSound(); - void updateAliens(); - void updateAlien(int rowNum); - void loseShip(); - void initShields(); - void initAnims(); - void drawScore(int score); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE52_H diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp deleted file mode 100644 index 7c461464be..0000000000 --- a/engines/gnap/scenes/scene53.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gnap/gnap.h" -#include "gnap/gamesys.h" -#include "gnap/resource.h" -#include "gnap/scenes/scene53.h" - -namespace Gnap { - -enum { - kHSPlatypus = 0, - kHSDevice = 1, - kHSPhoneKey1 = 2, - kHSPhoneKey2 = 3, - kHSPhoneKey3 = 4, - kHSPhoneKey4 = 5, - kHSPhoneKey5 = 6, - kHSPhoneKey6 = 7, - kHSPhoneKey7 = 8, - kHSPhoneKey8 = 9, - kHSPhoneKey9 = 10, - kHSPhoneKey0 = 11, - kHSPhoneKeySharp = 12, - kHSPhoneKeyStar = 13, - kHSPhoneExit = 14 -}; - -Scene53::Scene53(GnapEngine *vm) : Scene(vm) { - _s53_isGnapPhoning = false; - _s53_currHandSequenceId = -1; - _s53_callsMadeCtr = 0; - _s53_callsRndUsed = 0; -} - -int Scene53::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - return 0x75; -} - -void Scene53::updateHotspots() { - _vm->setHotspot(kHSPlatypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); - _vm->setHotspot(kHSPhoneKey1, 336, 238, 361, 270, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey2, 376, 243, 405, 274, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey3, 415, 248, 441, 276, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey4, 329, 276, 358, 303, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey5, 378, 282, 408, 311, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey6, 417, 286, 446, 319, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey7, 332, 311, 361, 342, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey8, 376, 318, 407, 349, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey9, 417, 320, 447, 353, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKey0, 377, 352, 405, 384, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKeySharp, 419, 358, 450, 394, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneKeyStar, 328, 346, 359, 379, SF_GRAB_CURSOR); - _vm->setHotspot(kHSPhoneExit, 150, 585, 650, 600, SF_EXIT_D_CURSOR); - - _vm->setDeviceHotspot(kHSDevice, -1, -1, -1, -1); - _vm->_hotspotsCount = 15; -} - -int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { - static const int kGnapHandSequenceIds[13] = { - 0x00, - 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, - 0x4C, 0x4D, 0x4E, 0x50, 0x51, 0x4F - }; - - static const int kPlatypusHandSequenceIds[13] = { - 0x00, - 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5A, 0x5C, 0x5D, 0x5B - }; - - if (_s53_isGnapPhoning) { - _vm->_gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); - _vm->_gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s53_currHandSequenceId = kGnapHandSequenceIds[buttonNum]; - } else { - _vm->_gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); - _vm->_gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s53_currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; - } - - _vm->_gnapActionStatus = 6; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - // checkGameAppStatus(); - _vm->updateMouseCursor(); - _vm->gameUpdateTick(); - } - _vm->_gnapActionStatus = -1; - - if (buttonNum < 11) - phoneNumber = buttonNum % 10 + 10 * phoneNumber; - - return phoneNumber; -} - -int Scene53::getRandomCallIndex() { - int index, tries = 0; - if (_s53_callsRndUsed == 0x7FFF) - _s53_callsRndUsed = 0; - do { - index = _vm->getRandom(16); - if (++tries == 300) - _s53_callsRndUsed = 0; - } while (_s53_callsRndUsed & (1 << index)); - _s53_callsRndUsed |= (1 << index); - return index; -} - -void Scene53::runRandomCall() { - static const int kCallSequenceIds[15] = { - 0x60, 0x61, 0x62, 0x63, 0x64, - 0x65, 0x66, 0x67, 0x68, 0x69, - 0x6A, 0x6B, 0x6C, 0x6D, 0x71 - }; - - ++_s53_callsMadeCtr; - - if (_s53_callsMadeCtr <= 10) { - int index; - - do { - index = getRandomCallIndex(); - } while (!_s53_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); - _vm->_gameSys->setAnimation(kCallSequenceIds[index], 1, 6); - _vm->_gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); - } else { - _vm->_gameSys->setAnimation(0x74, 1, 6); - _vm->_gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); - _s53_callsMadeCtr = 0; - } - - _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - _vm->updateMouseCursor(); - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _vm->_gnapActionStatus = -1; -} - -void Scene53::runChitChatLine() { - bool flag = false; - int sequenceId = -1; - - _vm->_gameSys->setAnimation(0x6E, 1, 6); - _vm->_gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); - - _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - _vm->updateMouseCursor(); - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _vm->_gnapActionStatus = -1; - - if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s53_currHandSequenceId = 0x45; - } else { - _vm->_gameSys->insertSequence(0x45, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _s53_currHandSequenceId = 0x5E; - } - - _vm->_hotspots[kHSDevice]._flags = SF_DISABLED; - - while (!flag) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case 2: - sequenceId = 0x6F; - flag = 1; - break; - case 3: - sequenceId = 0x70; - flag = 1; - break; - case 4: - sequenceId = 0x71; - flag = 1; - break; - case 14: - sequenceId = -1; - flag = 1; - _vm->_isLeavingScene = true; - _vm->_sceneDone = true; - _vm->_gnapActionStatus = 0; - _vm->_newSceneNum = 17; - break; - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); - break; - } - - if (flag && sequenceId != -1) { - _vm->stopSound(0xA0); - pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); - _vm->_gnapActionStatus = 1; - _vm->_gameSys->setAnimation(sequenceId, 1, 6); - _vm->_gameSys->insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - _vm->updateMouseCursor(); - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _vm->_gnapActionStatus = -1; - _vm->_gameSys->setAnimation(0x72, 1, 6); - _vm->_gameSys->insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - _vm->updateMouseCursor(); - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _vm->_gnapActionStatus = -1; - } - } - - updateHotspots(); - - _vm->_gnapActionStatus = 1; - - if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - _vm->updateMouseCursor(); - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _s53_currHandSequenceId = 0x73; - _vm->_gnapActionStatus = -1; - } -} - -void Scene53::run() { - int phoneNumber = 0; - int phoneNumberLen = 0; - - _vm->queueInsertDeviceIcon(); - - if (_vm->isFlag(kGFSpringTaken)) { - _s53_currHandSequenceId = 0x45; - _s53_isGnapPhoning = true; - } else { - _s53_currHandSequenceId = 0x5E; - _s53_isGnapPhoning = false; - } - - _vm->_gameSys->insertSequence(_s53_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->endSceneInit(); - _vm->setVerbCursor(GRAB_CURSOR); - _vm->playSound(0xA0, true); - - while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); - _vm->updateCursorByHotspot(); - - _vm->testWalk(0, 0, -1, -1, -1, -1); - - _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); - _vm->updateGrabCursorSprite(0, 0); - - switch (_vm->_sceneClickedHotspot) { - case 1: - if (_vm->_gnapActionStatus < 0) { - _vm->runMenu(); - updateHotspots(); - } - break; - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - _vm->stopSound(0xA0); - ++phoneNumberLen; - phoneNumber = pressPhoneNumberButton(phoneNumber, _vm->_sceneClickedHotspot - 1); - debugC(kDebugBasic, "phoneNumber: %d", phoneNumber); - if (phoneNumberLen == 7) { - _vm->_gnapActionStatus = 1; - if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - _vm->updateMouseCursor(); - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _s53_currHandSequenceId = 0x73; - _vm->_gnapActionStatus = -1; - } - if (phoneNumber == 7284141) { - runChitChatLine(); - phoneNumber = 0; - phoneNumberLen = 0; - _vm->_sceneDone = true; - _vm->_newSceneNum = 17; - } else if (phoneNumber != 5556789 || _vm->isFlag(kGFPictureTaken)) { - runRandomCall(); - phoneNumber = 0; - phoneNumberLen = 0; - _vm->_sceneDone = true; - _vm->_newSceneNum = 17; - } else { - phoneNumber = 0; - phoneNumberLen = 0; - _vm->_sceneDone = true; - _vm->_newSceneNum = 17; - if (_s53_isGnapPhoning) - _vm->setFlag(kGFUnk25); - else - _vm->setFlag(kGFPlatypusTalkingToAssistant); - } - } - break; - case 12: - case 13: - pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); - break; - case 14: - if (_vm->_gnapActionStatus < 0) { - _vm->_gnapActionStatus = 1; - if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _s53_currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { - _vm->updateMouseCursor(); - // checkGameAppStatus(); - _vm->gameUpdateTick(); - } - _s53_currHandSequenceId = 0x73; - _vm->_gnapActionStatus = -1; - } - _vm->_isLeavingScene = true; - _vm->_sceneDone = true; - _vm->_gnapActionStatus = 0; - _vm->_newSceneNum = 17; - } - break; - } - - _vm->checkGameKeys(); - - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); - _vm->runMenu(); - updateHotspots(); - } - _vm->gameUpdateTick(); - } -} - -} // End of namespace Gnap diff --git a/engines/gnap/scenes/scene53.h b/engines/gnap/scenes/scene53.h deleted file mode 100644 index 724411784e..0000000000 --- a/engines/gnap/scenes/scene53.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GNAP_SCENE53_H -#define GNAP_SCENE53_H - -#include "gnap/debugger.h" -#include "gnap/scenes/scenecore.h" - -namespace Gnap { - -class GnapEngine; - -class Scene53: public Scene { -public: - Scene53(GnapEngine *vm); - ~Scene53() {} - - virtual int init(); - virtual void updateHotspots(); - virtual void run(); - virtual void updateAnimations() {}; - virtual void updateAnimationsCb() {}; - -private: - bool _s53_isGnapPhoning; - int _s53_currHandSequenceId; - int _s53_callsMadeCtr; - uint _s53_callsRndUsed; - - int pressPhoneNumberButton(int phoneNumber, int buttonNum); - int getRandomCallIndex(); - void runRandomCall(); - void runChitChatLine(); -}; - -} // End of namespace Gnap -#endif // GNAP_SCENE53_H diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 6fc51d862c..2b67d59d37 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -25,19 +25,17 @@ #include "gnap/resource.h" #include "gnap/scenes/scenecore.h" + +#include "gnap/scenes/arcade.h" #include "gnap/scenes/groupcs.h" #include "gnap/scenes/group0.h" #include "gnap/scenes/group1.h" #include "gnap/scenes/group2.h" #include "gnap/scenes/group3.h" #include "gnap/scenes/group4.h" +#include "gnap/scenes/group5.h" #include "gnap/scenes/intro.h" -#include "gnap/scenes/scene50.h" -#include "gnap/scenes/scene51.h" -#include "gnap/scenes/scene52.h" -#include "gnap/scenes/scene53.h" - namespace Gnap { int GnapEngine::initSceneLogic() { -- cgit v1.2.3 From 5e950a7acf9e077aa673b3f5b0e575888c250d3c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 28 Apr 2016 23:38:49 +0200 Subject: GNAP: Move enums to header files --- engines/gnap/scenes/group0.cpp | 216 ------------------------------------- engines/gnap/scenes/group0.h | 218 +++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group1.cpp | 238 ---------------------------------------- engines/gnap/scenes/group1.h | 240 +++++++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group2.cpp | 196 --------------------------------- engines/gnap/scenes/group2.h | 196 +++++++++++++++++++++++++++++++++ 6 files changed, 654 insertions(+), 650 deletions(-) diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 5e455555a7..2ad6d88ba0 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -27,32 +27,6 @@ namespace Gnap { -enum { - kHS01Platypus = 0, - kHS01ExitTruck = 1, - kHS01Mud = 2, - kHS01Pigs = 3, - kHS01Spaceship = 4, - kHS01Device = 5, - kHS01WalkArea1 = 6, - kHS01WalkArea2 = 7, - kHS01WalkArea3 = 8, - kHS01WalkArea4 = 9, - kHS01WalkArea5 = 10, - kHS01WalkArea6 = 11, - kHS01WalkArea7 = 12, - kHS01WalkArea8 = 13 -}; - -enum { - kAS01LookSpaceship = 1, - kAS01LookSpaceshipDone = 2, - kAS01LeaveScene = 3, - kAS01TakeMud = 5, - kAS01LookPigs = 6, - kAS01UsePigs = 7 -}; - Scene01::Scene01(GnapEngine *vm) : Scene(vm) { _pigsIdCtr = 0; _smokeIdCtr = 0; @@ -382,38 +356,6 @@ void Scene01::updateAnimations() { /*****************************************************************************/ -enum { - kHS02Platypus = 0, - kHS02Chicken = 1, - kHS02Truck1 = 2, - kHS02Truck2 = 3, - kHS02TruckGrill = 4, - kHS02Device = 5, - kHS02ExitHouse = 6, - kHS02ExitBarn = 7, - kHS02ExitCreek = 8, - kHS02ExitPigpen = 9, - kHS02WalkArea1 = 10, - kHS02WalkArea2 = 11, - kHS02WalkArea3 = 12, - kHS02WalkArea4 = 13 -}; - -enum { - kAS02UseTruckNoKeys = 0, - kAS02UseGasWithTruck = 1, - kAS02UseTruckGas = 2, - kAS02UseTruckNoGas = 3, - kAS02GrabTruckGrill = 5, - kAS02LeaveScene = 6, - kAS02TalkChicken = 7, - kAS02GrabChicken = 8, - kAS02GrabChickenDone = 9, - kAS02UseTruckNoKeysDone = 11, - kAS02UseGasWithTruckDone = 12, - kAS02UseTwigWithChicken = 16 -}; - Scene02::Scene02(GnapEngine *vm) : Scene(vm) { _truckGrillCtr = 0; _nextChickenSequenceId = 0; @@ -892,31 +834,6 @@ void Scene02::updateAnimations() { /*****************************************************************************/ -enum { - kHS03Platypus = 0, - kHS03Grass = 1, - kHS03ExitTruck = 2, - kHS03Creek = 3, - kHS03TrappedPlatypus = 4, - kHS03Device = 5, - kHS03WalkAreas1 = 6, - kHS03WalkAreas2 = 7, - kHS03PlatypusWalkArea = 8, - kHS03WalkAreas3 = 9 -}; - -enum { - kAS03LeaveScene = 0, - kAS03FreePlatypus = 1, - kAS03HypnotizePlat = 2, - kAS03HypnotizeScaredPlat= 3, - kAS03FreePlatypusDone = 4, - kAS03GrabPlatypus = 5, - kAS03GrabCreek = 6, - kAS03GrabCreekDone = 7, - kAS03GrabScaredPlatypus = 8 -}; - Scene03::Scene03(GnapEngine *vm) : Scene(vm) { _nextPlatSequenceId = -1; _platypusScared = false; @@ -1382,34 +1299,6 @@ void Scene03::updateAnimations() { /*****************************************************************************/ -enum { - kHS04Platypus = 0, - kHS04Twig = 1, - kHS04Dog = 2, - kHS04Axe = 3, - kHS04Door = 4, - kHS04ExitTruck = 5, - kHS04Device = 6, - kHS04Window = 7, - kHS04ExitBarn = 8, - kHS04WalkArea1 = 9, - kHS04WalkArea2 = 10 -}; - -enum { - kAS04OpenDoor = 1, - kAS04GetKeyFirst = 2, - kAS04GetKeyAnother = 3, - kAS04LeaveScene = 4, - kAS04GetKeyFirstDone = 6, - kAS04GetKeyFirst2 = 7, - kAS04GetKeyAnother2 = 8, - kAS04GetKeyAnotherDone = 9, - kAS04OpenDoorDone = 10, - kAS04GrabDog = 12, - kAS04GrabAxe = 13 -}; - Scene04::Scene04(GnapEngine *vm) : Scene(vm) { _dogIdCtr = 0; _triedWindow = false; @@ -1926,31 +1815,6 @@ void Scene04::updateAnimations() { /*****************************************************************************/ -enum { - kHS05Platypus = 0, - kHS05Haystack = 1, - kHS05Padlock = 2, - kHS05Ladder = 3, - kHS05ExitHouse = 4, - kHS05Chicken = 5, - kHS05Device = 6, - kHS05WalkArea1 = 7, - kHS05WalkArea2 = 8, - kHS05WalkArea3 = 9 -}; - -enum { - kAS05PlatSearchHaystack = 0, - kAS05TryPickPadlock = 1, - kAS05PickPadlock = 2, - kAS05TalkChicken = 3, - kAS05GrabChicken = 4, - kAS05GrabLadder = 5, - kAS05EnterBarn = 6, - kAS05UseTwigWithChicken = 11, - kAS05LeaveScene = 12 -}; - Scene05::Scene05(GnapEngine *vm) : Scene(vm) { _nextChickenSequenceId = -1; _currChickenSequenceId = -1; @@ -2364,29 +2228,6 @@ void Scene05::updateAnimations() { /*****************************************************************************/ -enum { - kHS06Platypus = 0, - kHS06Gas = 1, - kHS06Ladder = 2, - kHS06Horse = 3, - kHS06ExitOutsideBarn = 4, - kHS06Device = 5, - kHS06WalkArea1 = 6, - kHS06WalkArea2 = 7, - kHS06WalkArea3 = 8, - kHS06WalkArea4 = 9, - kHS06WalkArea5 = 10 -}; - -enum { - kAS06TryToGetGas = 0, - kAS06TryToClimbLadder = 1, - kAS06TryToClimbLadderDone = 2, - kAS06TalkToHorse = 3, - kAS06UseTwigOnHorse = 4, - kAS06LeaveScene = 5 -}; - Scene06::Scene06(GnapEngine *vm) : Scene(vm) { _horseTurnedBack = false;; _nextPlatSequenceId = -1; @@ -2782,21 +2623,6 @@ void Scene06::updateAnimations() { /*****************************************************************************/ -enum { - kHS07Platypus = 0, - kHS07ExitHouse = 1, - kHS07Dice = 2, - kHS07Device = 3, - kHS07WalkArea1 = 4, - kHS07WalkArea2 = 5, - kHS07WalkArea3 = 6 -}; - -enum { - kAS07Wait = 0, - kAS07LeaveScene = 1 -}; - Scene07::Scene07(GnapEngine *vm) : Scene(vm) { } @@ -3024,31 +2850,6 @@ void Scene07::updateAnimations() { /*****************************************************************************/ -enum { - kH08SPlatypus = 0, - kHS08ExitBackdoor = 1, - kHS08ExitCrash = 2, - kHS08Man = 3, - kHS08Door = 4, - kHS08Meat = 5, - kHS08Bone = 6, - kHS08Toy = 7, - kHS08WalkArea1 = 8, - kHS08Device = 9, - kHS08WalkArea2 = 10 -}; - -enum { - kAS08LeaveScene = 0, - kAS08TalkMan = 1, - kAS08LookMan = 2, - kAS08LookDog = 3, - kAS08GrabDog = 4, - kAS08TalkDog = 5, - kAS08PlatWithMan = 6, - kAS08PlatWithDog = 7 -}; - Scene08::Scene08(GnapEngine *vm) : Scene(vm) { _nextDogSequenceId = -1; _currDogSequenceId = -1; @@ -3523,23 +3324,6 @@ void Scene08::updateAnimations() { /*****************************************************************************/ -enum { - kHS09Platypus = 0, - kHS09ExitKitchen = 1, - kHS09ExitHouse = 2, - kHS09Trash = 3, - kHS09Device = 4, - kHS09WalkArea1 = 5, - kHS09WalkArea2 = 6, - kHS09WalkArea3 = 7 -}; - -enum { - kAS09LeaveScene = 0, - kAS09SearchTrash = 1, - kAS09SearchTrashDone = 2 -}; - Scene09::Scene09(GnapEngine *vm) : Scene(vm) { } diff --git a/engines/gnap/scenes/group0.h b/engines/gnap/scenes/group0.h index b8df3af0ff..b288512471 100644 --- a/engines/gnap/scenes/group0.h +++ b/engines/gnap/scenes/group0.h @@ -27,6 +27,224 @@ namespace Gnap { +enum { + kHS01Platypus = 0, + kHS01ExitTruck = 1, + kHS01Mud = 2, + kHS01Pigs = 3, + kHS01Spaceship = 4, + kHS01Device = 5, + kHS01WalkArea1 = 6, + kHS01WalkArea2 = 7, + kHS01WalkArea3 = 8, + kHS01WalkArea4 = 9, + kHS01WalkArea5 = 10, + kHS01WalkArea6 = 11, + kHS01WalkArea7 = 12, + kHS01WalkArea8 = 13 +}; + +enum { + kHS02Platypus = 0, + kHS02Chicken = 1, + kHS02Truck1 = 2, + kHS02Truck2 = 3, + kHS02TruckGrill = 4, + kHS02Device = 5, + kHS02ExitHouse = 6, + kHS02ExitBarn = 7, + kHS02ExitCreek = 8, + kHS02ExitPigpen = 9, + kHS02WalkArea1 = 10, + kHS02WalkArea2 = 11, + kHS02WalkArea3 = 12, + kHS02WalkArea4 = 13 +}; + +enum { + kHS03Platypus = 0, + kHS03Grass = 1, + kHS03ExitTruck = 2, + kHS03Creek = 3, + kHS03TrappedPlatypus = 4, + kHS03Device = 5, + kHS03WalkAreas1 = 6, + kHS03WalkAreas2 = 7, + kHS03PlatypusWalkArea = 8, + kHS03WalkAreas3 = 9 +}; + +enum { + kHS04Platypus = 0, + kHS04Twig = 1, + kHS04Dog = 2, + kHS04Axe = 3, + kHS04Door = 4, + kHS04ExitTruck = 5, + kHS04Device = 6, + kHS04Window = 7, + kHS04ExitBarn = 8, + kHS04WalkArea1 = 9, + kHS04WalkArea2 = 10 +}; + +enum { + kHS05Platypus = 0, + kHS05Haystack = 1, + kHS05Padlock = 2, + kHS05Ladder = 3, + kHS05ExitHouse = 4, + kHS05Chicken = 5, + kHS05Device = 6, + kHS05WalkArea1 = 7, + kHS05WalkArea2 = 8, + kHS05WalkArea3 = 9 +}; + +enum { + kHS06Platypus = 0, + kHS06Gas = 1, + kHS06Ladder = 2, + kHS06Horse = 3, + kHS06ExitOutsideBarn = 4, + kHS06Device = 5, + kHS06WalkArea1 = 6, + kHS06WalkArea2 = 7, + kHS06WalkArea3 = 8, + kHS06WalkArea4 = 9, + kHS06WalkArea5 = 10 +}; + +enum { + kHS07Platypus = 0, + kHS07ExitHouse = 1, + kHS07Dice = 2, + kHS07Device = 3, + kHS07WalkArea1 = 4, + kHS07WalkArea2 = 5, + kHS07WalkArea3 = 6 +}; + +enum { + kH08SPlatypus = 0, + kHS08ExitBackdoor = 1, + kHS08ExitCrash = 2, + kHS08Man = 3, + kHS08Door = 4, + kHS08Meat = 5, + kHS08Bone = 6, + kHS08Toy = 7, + kHS08WalkArea1 = 8, + kHS08Device = 9, + kHS08WalkArea2 = 10 +}; + +enum { + kHS09Platypus = 0, + kHS09ExitKitchen = 1, + kHS09ExitHouse = 2, + kHS09Trash = 3, + kHS09Device = 4, + kHS09WalkArea1 = 5, + kHS09WalkArea2 = 6, + kHS09WalkArea3 = 7 +}; + +enum { + kAS01LookSpaceship = 1, + kAS01LookSpaceshipDone = 2, + kAS01LeaveScene = 3, + kAS01TakeMud = 5, + kAS01LookPigs = 6, + kAS01UsePigs = 7 +}; + +enum { + kAS02UseTruckNoKeys = 0, + kAS02UseGasWithTruck = 1, + kAS02UseTruckGas = 2, + kAS02UseTruckNoGas = 3, + kAS02GrabTruckGrill = 5, + kAS02LeaveScene = 6, + kAS02TalkChicken = 7, + kAS02GrabChicken = 8, + kAS02GrabChickenDone = 9, + kAS02UseTruckNoKeysDone = 11, + kAS02UseGasWithTruckDone = 12, + kAS02UseTwigWithChicken = 16 +}; + +enum { + kAS03LeaveScene = 0, + kAS03FreePlatypus = 1, + kAS03HypnotizePlat = 2, + kAS03HypnotizeScaredPlat= 3, + kAS03FreePlatypusDone = 4, + kAS03GrabPlatypus = 5, + kAS03GrabCreek = 6, + kAS03GrabCreekDone = 7, + kAS03GrabScaredPlatypus = 8 +}; + +enum { + kAS04OpenDoor = 1, + kAS04GetKeyFirst = 2, + kAS04GetKeyAnother = 3, + kAS04LeaveScene = 4, + kAS04GetKeyFirstDone = 6, + kAS04GetKeyFirst2 = 7, + kAS04GetKeyAnother2 = 8, + kAS04GetKeyAnotherDone = 9, + kAS04OpenDoorDone = 10, + kAS04GrabDog = 12, + kAS04GrabAxe = 13 +}; + +enum { + kAS05PlatSearchHaystack = 0, + kAS05TryPickPadlock = 1, + kAS05PickPadlock = 2, + kAS05TalkChicken = 3, + kAS05GrabChicken = 4, + kAS05GrabLadder = 5, + kAS05EnterBarn = 6, + kAS05UseTwigWithChicken = 11, + kAS05LeaveScene = 12 +}; + +enum { + kAS06TryToGetGas = 0, + kAS06TryToClimbLadder = 1, + kAS06TryToClimbLadderDone = 2, + kAS06TalkToHorse = 3, + kAS06UseTwigOnHorse = 4, + kAS06LeaveScene = 5 +}; + +enum { + kAS07Wait = 0, + kAS07LeaveScene = 1 +}; + +enum { + kAS08LeaveScene = 0, + kAS08TalkMan = 1, + kAS08LookMan = 2, + kAS08LookDog = 3, + kAS08GrabDog = 4, + kAS08TalkDog = 5, + kAS08PlatWithMan = 6, + kAS08PlatWithDog = 7 +}; + +enum { + kAS09LeaveScene = 0, + kAS09SearchTrash = 1, + kAS09SearchTrashDone = 2 +}; + +/*****************************************************************************/ + class GnapEngine; class CutScene; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index fa5b5d07e4..d746eb54ff 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -27,27 +27,6 @@ namespace Gnap { -enum { - kHS10Platypus = 0, - kHS10ExitBar = 1, - kHS10ExitBackdoor = 2, - kHS10Cook = 3, - kHS10Tongs = 4, - kHS10Box = 5, - kHS10Oven = 6, - kHS10WalkArea1 = 7, - kHS10Device = 8, - kHS10WalkArea2 = 9, - kHS10WalkArea3 = 10, - kHS10WalkArea4 = 11 -}; - -enum { - kAS10LeaveScene = 0, - kAS10AnnoyCook = 1, - kAS10PlatWithBox = 4 -}; - Scene10::Scene10(GnapEngine *vm) : Scene(vm) { _nextCookSequenceId = -1; _currCookSequenceId = -1; @@ -499,32 +478,6 @@ void Scene10::updateAnimationsCb() { /*****************************************************************************/ -enum { - kHS11Platypus = 0, - kHS11ExitKitchen = 1, - kHS11ExitToilet = 2, - kHS11ExitLeft = 3, - kHS11GoggleGuy = 4, - kHS11HookGuy = 5, - kHS11Billard = 6, - kHS11WalkArea1 = 7, - kHS11Device = 8, - kHS11WalkArea2 = 9, - kHS11WalkArea3 = 10, - kHS11WalkArea4 = 11, - kHS11WalkArea5 = 12 -}; - -enum { - kAS11LeaveScene = 0, - kAS11ShowMagazineToGoggleGuy = 3, - kAS11TalkGoggleGuy = 4, - kAS11GrabHookGuy = 6, - kAS11ShowItemToHookGuy = 8, - kAS11TalkHookGuy = 9, - kAS11GrabBillardBall = 11 -}; - Scene11::Scene11(GnapEngine *vm) : Scene(vm) { _billardBallCtr = 0; _nextHookGuySequenceId = -1; @@ -958,41 +911,6 @@ void Scene11::updateAnimations() { /*****************************************************************************/ -enum { - kHS12Platypus = 0, - kHS12ExitRight = 1, - kHS12ToothGuy = 2, - kHS12Barkeeper = 3, - kHS12BeardGuy = 4, - kHS12Jukebox = 5, - kHS12WalkArea1 = 6, - kHS12Device = 7, - kHS12WalkArea2 = 8, - kHS12WalkArea3 = 9, - kHS12WalkArea4 = 10 -}; - -enum { - kAS12LeaveScene = 0, - kAS12QuarterToToothGuyDone = 1, - kAS12TalkToothGuy = 2, - kAS12GrabToothGuy = 4, - kAS12ShowItemToToothGuy = 5, - kAS12QuarterWithHoleToToothGuy = 6, - kAS12QuarterToToothGuy = 7, - kAS12TalkBeardGuy = 8, - kAS12LookBeardGuy = 9, - kAS12GrabBeardGuy = 10, - kAS12ShowItemToBeardGuy = 11, - kAS12TalkBarkeeper = 12, - kAS12LookBarkeeper = 13, - kAS12ShowItemToBarkeeper = 15, - kAS12QuarterWithBarkeeper = 16, - kAS12PlatWithBarkeeper = 17, - kAS12PlatWithToothGuy = 18, - kAS12PlatWithBeardGuy = 19 -}; - Scene12::Scene12(GnapEngine *vm) : Scene(vm) { _nextBeardGuySequenceId = -1; _currBeardGuySequenceId = -1; @@ -1497,37 +1415,6 @@ void Scene12::updateAnimations() { /*****************************************************************************/ -enum { - kHS13Platypus = 0, - kHS13ExitBar = 1, - kHS13WalkArea1 = 2, - kHS13BackToilet = 3, - kHS13FrontToilet = 4, - kHS13Urinal = 5, - kHS13Scribble = 6, - kHS13Sink = 7, - kHS13WalkArea2 = 8, - kHS13Device = 9, - kHS13WalkArea3 = 10, - kHS13WalkArea4 = 11, - kHS13WalkArea5 = 12, - kHS13WalkArea6 = 13, - kHS13WalkArea7 = 14, - kHS13WalkArea8 = 15, - kHS13WalkArea9 = 16 -}; - -enum { - kAS13LeaveScene = 0, - kAS13BackToilet = 1, - kAS13FrontToilet = 2, - kAS13LookScribble = 6, - kAS13GrabSink = 7, - kAS13GrabSinkDone = 8, - kAS13Wait = 12, - kAS13GrabUrinal = 13 -}; - Scene13::Scene13(GnapEngine *vm) : Scene(vm) { _backToiletCtr = -1; } @@ -1920,14 +1807,6 @@ void Scene13::updateAnimations() { /*****************************************************************************/ -enum { - kHS14Platypus = 0, - kHS14Exit = 1, - kHS14Coin = 2, - kHS14Toilet = 3, - kHS14Device = 4 -}; - Scene14::Scene14(GnapEngine *vm) : Scene(vm) { } @@ -2081,26 +1960,6 @@ void Scene14::updateAnimations() { /*****************************************************************************/ -enum { - kHS15Platypus = 0, - kHS15Exit = 1, - kHS15Button1 = 2, - kHS15Button2 = 3, - kHS15Button3 = 4, - kHS15Button4 = 5, - kHS15Button5 = 6, - kHS15Button6 = 7, - kHS15ButtonA = 8, - kHS15ButtonB = 9, - kHS15ButtonC = 10, - kHS15ButtonD = 11, - kHS15ButtonE = 12, - kHS15ButtonF = 13, - kHS15CoinSlot = 14, - kHS15PlayButton = 15, - kHS15Device = 16 -}; - Scene15::Scene15(GnapEngine *vm) : Scene(vm) { _nextRecordSequenceId = -1; _currRecordSequenceId = -1; @@ -2397,37 +2256,6 @@ void Scene15::updateAnimations() { /*****************************************************************************/ -enum { - kHS17Platypus = 0, - kHS17Phone1 = 1, - kHS17Phone2 = 2, - kHS17ExitGrubCity = 3, - kHS17Device = 4, - kHS17ExitToyStore = 5, - kHS17Wrench = 6, - kHS17WalkArea1 = 7, - kHS17WalkArea2 = 8, - kHS17WalkArea3 = 9 -}; - -enum { - kAS17TryGetWrench = 0, - kAS17GetWrench2 = 1, - kAS17GetWrenchDone = 2, - kAS17GetWrench1 = 3, - kAS17PlatUsePhone = 4, - kAS17PutCoinIntoPhone = 5, - kAS17GetCoinFromPhone = 6, - kAS17GetCoinFromPhoneDone = 7, - kAS17PutCoinIntoPhoneDone = 8, - kAS17GnapUsePhone = 9, - kAS17GetWrenchGnapReady = 10, - kAS17GnapHangUpPhone = 11, - kAS17PlatPhoningAssistant = 12, - kAS17PlatHangUpPhone = 14, - kAS17LeaveScene = 15 -}; - Scene17::Scene17(GnapEngine *vm) : Scene(vm) { _platTryGetWrenchCtr = 0; _wrenchCtr = 2; @@ -3225,44 +3053,6 @@ static const int kScene18SequenceIds[] = { 0x219, 0x21A, 0x21B, 0x21C, 0x21D }; -enum { - kHS18Platypus = 0, - kHS18GarbageCan = 1, - kHS18Device = 2, - kHS18ExitToyStore = 3, - kHS18ExitPhoneBooth = 4, - kHS18ExitGrubCity = 5, - kHS18HydrantTopValve = 6, - kHS18HydrantRightValve = 7, - kHS18CowboyHat = 8, - kHS18WalkArea1 = 9, - kHS18WalkArea2 = 10 -}; - -enum { - kAS18OpenRightValveNoGarbageCanDone = 0, - kAS18OpenRightValveNoGarbageCan = 1, - kAS18CloseRightValveNoGarbageCan = 2, - kAS18OpenTopValveDone = 3, - kAS18OpenTopValve = 4, - kAS18CloseTopValve = 5, - kAS18GrabGarbageCanFromStreet = 6, - kAS18GrabCowboyHat = 7, - kAS18GrabGarbageCanFromHydrant = 8, - kAS18PutGarbageCanOnRunningHydrant = 9, - kAS18PutGarbageCanOnRunningHydrant2 = 10, - kAS18GrabCowboyHatDone = 11, - kAS18StandingOnHydrant = 12, - kAS18OpenRightValveWithGarbageCan = 13, - kAS18OpenRightValveWithGarbageCanDone = 14, - kAS18CloseRightValveWithGarbageCan = 15, - kAS18PutGarbageCanOnHydrant = 16, - kAS18PutGarbageCanOnHydrantDone = 17, - kAS18PlatComesHere = 18, - kAS18CloseRightValveWithGarbageCanDone = 19, - kAS18LeaveScene = 20 -}; - Scene18::Scene18(GnapEngine *vm) : Scene(vm) { _cowboyHatSurface = nullptr; @@ -4227,34 +4017,6 @@ static const int kS19ShopAssistantSequenceIds[] = { 0x6F, 0x70, 0x71, 0x72, 0x73 }; -enum { - kHS19Platypus = 0, - kHS19ExitOutsideToyStore = 1, - kHS19Device = 2, - kHS19Picture = 3, - kHS19ShopAssistant = 4, - kHS19Toy1 = 5, - kHS19Toy2 = 6, - kHS19Toy3 = 7, - kHS19Phone = 8, - kHS19Toy4 = 9, - kHS19Toy5 = 10, - kHS19Toy6 = 11, - kHS19Toy7 = 12, - kHS19WalkArea1 = 13, - kHS19WalkArea2 = 14, - kHS19WalkArea3 = 15 -}; - -enum { - kAS19UsePhone = 0, - kAS19GrabToy = 1, - kAS19GrabPicture = 2, - kAS19GrabPictureDone = 3, - kAS19TalkShopAssistant = 4, - kAS19LeaveScene = 5 -}; - Scene19::Scene19(GnapEngine *vm) : Scene(vm) { _toyGrabCtr = 0; _pictureSurface = 0; diff --git a/engines/gnap/scenes/group1.h b/engines/gnap/scenes/group1.h index 451a652ffd..a1f86e249e 100644 --- a/engines/gnap/scenes/group1.h +++ b/engines/gnap/scenes/group1.h @@ -27,6 +27,246 @@ namespace Gnap { +enum { + kHS10Platypus = 0, + kHS10ExitBar = 1, + kHS10ExitBackdoor = 2, + kHS10Cook = 3, + kHS10Tongs = 4, + kHS10Box = 5, + kHS10Oven = 6, + kHS10WalkArea1 = 7, + kHS10Device = 8, + kHS10WalkArea2 = 9, + kHS10WalkArea3 = 10, + kHS10WalkArea4 = 11 +}; + +enum { + kHS11Platypus = 0, + kHS11ExitKitchen = 1, + kHS11ExitToilet = 2, + kHS11ExitLeft = 3, + kHS11GoggleGuy = 4, + kHS11HookGuy = 5, + kHS11Billard = 6, + kHS11WalkArea1 = 7, + kHS11Device = 8, + kHS11WalkArea2 = 9, + kHS11WalkArea3 = 10, + kHS11WalkArea4 = 11, + kHS11WalkArea5 = 12 +}; + +enum { + kHS12Platypus = 0, + kHS12ExitRight = 1, + kHS12ToothGuy = 2, + kHS12Barkeeper = 3, + kHS12BeardGuy = 4, + kHS12Jukebox = 5, + kHS12WalkArea1 = 6, + kHS12Device = 7, + kHS12WalkArea2 = 8, + kHS12WalkArea3 = 9, + kHS12WalkArea4 = 10 +}; + +enum { + kHS13Platypus = 0, + kHS13ExitBar = 1, + kHS13WalkArea1 = 2, + kHS13BackToilet = 3, + kHS13FrontToilet= 4, + kHS13Urinal = 5, + kHS13Scribble = 6, + kHS13Sink = 7, + kHS13WalkArea2 = 8, + kHS13Device = 9, + kHS13WalkArea3 = 10, + kHS13WalkArea4 = 11, + kHS13WalkArea5 = 12, + kHS13WalkArea6 = 13, + kHS13WalkArea7 = 14, + kHS13WalkArea8 = 15, + kHS13WalkArea9 = 16 +}; + +enum { + kHS14Platypus = 0, + kHS14Exit = 1, + kHS14Coin = 2, + kHS14Toilet = 3, + kHS14Device = 4 +}; + +enum { + kHS15Platypus = 0, + kHS15Exit = 1, + kHS15Button1 = 2, + kHS15Button2 = 3, + kHS15Button3 = 4, + kHS15Button4 = 5, + kHS15Button5 = 6, + kHS15Button6 = 7, + kHS15ButtonA = 8, + kHS15ButtonB = 9, + kHS15ButtonC = 10, + kHS15ButtonD = 11, + kHS15ButtonE = 12, + kHS15ButtonF = 13, + kHS15CoinSlot = 14, + kHS15PlayButton = 15, + kHS15Device = 16 +}; + +enum { + kHS17Platypus = 0, + kHS17Phone1 = 1, + kHS17Phone2 = 2, + kHS17ExitGrubCity = 3, + kHS17Device = 4, + kHS17ExitToyStore = 5, + kHS17Wrench = 6, + kHS17WalkArea1 = 7, + kHS17WalkArea2 = 8, + kHS17WalkArea3 = 9 +}; + +enum { + kHS18Platypus = 0, + kHS18GarbageCan = 1, + kHS18Device = 2, + kHS18ExitToyStore = 3, + kHS18ExitPhoneBooth = 4, + kHS18ExitGrubCity = 5, + kHS18HydrantTopValve = 6, + kHS18HydrantRightValve = 7, + kHS18CowboyHat = 8, + kHS18WalkArea1 = 9, + kHS18WalkArea2 = 10 +}; + +enum { + kHS19Platypus = 0, + kHS19ExitOutsideToyStore= 1, + kHS19Device = 2, + kHS19Picture = 3, + kHS19ShopAssistant = 4, + kHS19Toy1 = 5, + kHS19Toy2 = 6, + kHS19Toy3 = 7, + kHS19Phone = 8, + kHS19Toy4 = 9, + kHS19Toy5 = 10, + kHS19Toy6 = 11, + kHS19Toy7 = 12, + kHS19WalkArea1 = 13, + kHS19WalkArea2 = 14, + kHS19WalkArea3 = 15 +}; + +enum { + kAS10LeaveScene = 0, + kAS10AnnoyCook = 1, + kAS10PlatWithBox = 4 +}; + +enum { + kAS11LeaveScene = 0, + kAS11ShowMagazineToGoggleGuy = 3, + kAS11TalkGoggleGuy = 4, + kAS11GrabHookGuy = 6, + kAS11ShowItemToHookGuy = 8, + kAS11TalkHookGuy = 9, + kAS11GrabBillardBall = 11 +}; + +enum { + kAS12LeaveScene = 0, + kAS12QuarterToToothGuyDone = 1, + kAS12TalkToothGuy = 2, + kAS12GrabToothGuy = 4, + kAS12ShowItemToToothGuy = 5, + kAS12QuarterWithHoleToToothGuy = 6, + kAS12QuarterToToothGuy = 7, + kAS12TalkBeardGuy = 8, + kAS12LookBeardGuy = 9, + kAS12GrabBeardGuy = 10, + kAS12ShowItemToBeardGuy = 11, + kAS12TalkBarkeeper = 12, + kAS12LookBarkeeper = 13, + kAS12ShowItemToBarkeeper = 15, + kAS12QuarterWithBarkeeper = 16, + kAS12PlatWithBarkeeper = 17, + kAS12PlatWithToothGuy = 18, + kAS12PlatWithBeardGuy = 19 +}; + +enum { + kAS13LeaveScene = 0, + kAS13BackToilet = 1, + kAS13FrontToilet = 2, + kAS13LookScribble = 6, + kAS13GrabSink = 7, + kAS13GrabSinkDone = 8, + kAS13Wait = 12, + kAS13GrabUrinal = 13 +}; + +enum { + kAS17TryGetWrench = 0, + kAS17GetWrench2 = 1, + kAS17GetWrenchDone = 2, + kAS17GetWrench1 = 3, + kAS17PlatUsePhone = 4, + kAS17PutCoinIntoPhone = 5, + kAS17GetCoinFromPhone = 6, + kAS17GetCoinFromPhoneDone = 7, + kAS17PutCoinIntoPhoneDone = 8, + kAS17GnapUsePhone = 9, + kAS17GetWrenchGnapReady = 10, + kAS17GnapHangUpPhone = 11, + kAS17PlatPhoningAssistant = 12, + kAS17PlatHangUpPhone = 14, + kAS17LeaveScene = 15 +}; + +enum { + kAS18OpenRightValveNoGarbageCanDone = 0, + kAS18OpenRightValveNoGarbageCan = 1, + kAS18CloseRightValveNoGarbageCan = 2, + kAS18OpenTopValveDone = 3, + kAS18OpenTopValve = 4, + kAS18CloseTopValve = 5, + kAS18GrabGarbageCanFromStreet = 6, + kAS18GrabCowboyHat = 7, + kAS18GrabGarbageCanFromHydrant = 8, + kAS18PutGarbageCanOnRunningHydrant = 9, + kAS18PutGarbageCanOnRunningHydrant2 = 10, + kAS18GrabCowboyHatDone = 11, + kAS18StandingOnHydrant = 12, + kAS18OpenRightValveWithGarbageCan = 13, + kAS18OpenRightValveWithGarbageCanDone = 14, + kAS18CloseRightValveWithGarbageCan = 15, + kAS18PutGarbageCanOnHydrant = 16, + kAS18PutGarbageCanOnHydrantDone = 17, + kAS18PlatComesHere = 18, + kAS18CloseRightValveWithGarbageCanDone = 19, + kAS18LeaveScene = 20 +}; + +enum { + kAS19UsePhone = 0, + kAS19GrabToy = 1, + kAS19GrabPicture = 2, + kAS19GrabPictureDone = 3, + kAS19TalkShopAssistant = 4, + kAS19LeaveScene = 5 +}; + +/*****************************************************************************/ + class GnapEngine; class CutScene; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 0a89b83dc5..293d58ce05 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -27,35 +27,6 @@ namespace Gnap { -enum { - kHS20Platypus = 0, - kHS20GroceryStoreHat = 1, - kHS20ExitParkingLot = 2, - kHS20StonerGuy = 3, - kHS20GroceryStoreGuy = 4, - kHS20Device = 5, - kHS20ExitInsideGrubCity = 6, - kHS20ExitOutsideCircusWorld = 7, - kHS20ExitOutsideToyStore = 8, - kHS20ExitPhone = 9, - kHS20WalkArea1 = 10, - kHS20WalkArea2 = 11 -}; - -enum { - kAS20LeaveScene = 0, - kAS20TalkStonerGuyNoJoint = 2, - kAS20TalkStonerGuyHasJoint = 3, - kAS20GrabJoint = 4, - kAS20ActionDone = 5, - kAS20TalkGroceryStoreGuy = 6, - kAS20GrabGroceryStoreGuy = 9, - kAS20GrabGroceryStoreHat = 10, - kAS20SwitchGroceryStoreHat = 11, - kAS20SwitchGroceryStoreHatDone = 12, - kAS20GrabJointDone = 13 -}; - Scene20::Scene20(GnapEngine *vm) : Scene(vm) { _stonerGuyCtr = 3; _stonerGuyShowingJoint = false; @@ -731,26 +702,6 @@ void Scene20::updateAnimations() { /*****************************************************************************/ -enum { - kHS21Platypus = 0, - kHS21Banana = 1, - kHS21OldLady = 2, - kHS21Device = 3, - kHS21ExitOutsideGrubCity = 4, - kHS21WalkArea1 = 5, - kHS21WalkArea2 = 6 -}; - -enum { - kAS21TalkOldLady = 0, - kAS21GrabBanana = 1, - kAS21GrabBananaDone = 2, - kAS21GrabOldLady = 3, - kAS21UseHatWithOldLady = 4, - kAS21UseHatWithOldLadyDone = 5, - kAS21LeaveScene = 6 -}; - Scene21::Scene21(GnapEngine *vm) : Scene(vm) { _currOldLadySequenceId = -1; _nextOldLadySequenceId = -1; @@ -1047,21 +998,6 @@ void Scene21::updateAnimations() { /*****************************************************************************/ -enum { - kHS22Platypus = 0, - kHS22ExitOutsideGrubCity = 1, - kHS22ExitBackGrubCity = 2, - kHS22Cashier = 3, - kHS22Device = 4, - kHS22WalkArea1 = 5, - kHS22WalkArea2 = 6 -}; - -enum { - kAS22LeaveScene = 0, - kAS22TalkCashier = 1 -}; - Scene22::Scene22(GnapEngine *vm) : Scene(vm) { _caughtBefore = false; _cashierCtr = 3; @@ -1311,22 +1247,6 @@ void Scene22::updateAnimations() { /*****************************************************************************/ -enum { - kHS23Platypus = 0, - kHS23ExitFrontGrubCity = 1, - kHS23Device = 2, - kHS23Cereals = 3, - kHS23WalkArea1 = 4, - kHS23WalkArea2 = 5 -}; - -enum { - kAS23LookCereals = 0, - kAS23GrabCereals = 1, - kAS23GrabCerealsDone = 2, - kAS23LeaveScene = 3 -}; - Scene23::Scene23(GnapEngine *vm) : Scene(vm) { _currStoreClerkSequenceId = -1; _nextStoreClerkSequenceId = -1; @@ -1578,20 +1498,6 @@ void Scene23::updateAnimations() { /*****************************************************************************/ -enum { - kHS24Platypus = 0, - kHS24ExitCircusWorld = 1, - kHS24ExitOutsideGrubCity = 2, - kHS24Device = 3, - kHS24WalkArea1 = 4, - kHS24WalkArea2 = 5, - kHS24WalkArea3 = 6 -}; - -enum { - kAS24LeaveScene = 0 -}; - Scene24::Scene24(GnapEngine *vm) : Scene(vm) { _currWomanSequenceId = -1; _nextWomanSequenceId = -1; @@ -1811,29 +1717,6 @@ void Scene24::updateAnimations() { /*****************************************************************************/ -enum { - kHS25Platypus = 0, - kHS25TicketVendor = 1, - kHS25ExitOutsideCircusWorld = 2, - kHS25ExitInsideCircusWorld = 3, - kHS25Device = 4, - kHS25Posters1 = 5, - kHS25Posters2 = 6, - kHS25Posters3 = 7, - kHS25Posters4 = 8, - kHS25WalkArea1 = 9, - kHS25WalkArea2 = 10 -}; - -enum { - kAS25TalkTicketVendor = 0, - kAS25EnterCircusWihoutTicket = 1, - kAS25ShowTicketToVendor = 2, - kAS25ShowTicketToVendorDone = 3, - kAS25EnterCircusWihoutTicketDone = 4, - kAS25LeaveScene = 5 -}; - Scene25::Scene25(GnapEngine *vm) : Scene(vm) { _currTicketVendorSequenceId = -1; _nextTicketVendorSequenceId = -1; @@ -2180,22 +2063,6 @@ void Scene25::updateAnimations() { /*****************************************************************************/ -enum { - kHS26Platypus = 0, - kHS26ExitOutsideCircusWorld = 1, - kHS26ExitOutsideClown = 2, - kHS26ExitArcade = 3, - kHS26ExitElephant = 4, - kHS26ExitBeerStand = 5, - kHS26Device = 6, - kHS26WalkArea1 = 7, - kHS26WalkArea2 = 8 -}; - -enum { - kAS26LeaveScene = 0 -}; - Scene26::Scene26(GnapEngine *vm) : Scene(vm) { _currKidSequenceId = -1; _nextKidSequenceId = -1; @@ -2406,29 +2273,6 @@ void Scene26::updateAnimations() { /*****************************************************************************/ -enum { - kHS27Platypus = 0, - kHS27Janitor = 1, - kHS27Device = 2, - kHS27Bucket = 3, - kHS27ExitCircus = 4, - kHS27ExitArcade = 5, - kHS27ExitBeerStand = 6, - kHS27ExitClown = 7, - kHS27WalkArea1 = 8 -}; - -enum { - kAS27TalkJanitor = 0, - kAS27GrabBucket = 1, - kAS27GrabBucketDone = 2, - kAS27ShowPictureToJanitor = 3, - kAS27TryEnterClownTent = 4, - kAS27TryEnterClownTentDone = 5, - kAS27EnterClownTent = 6, - kAS27LeaveScene = 7 -}; - Scene27::Scene27(GnapEngine *vm) : Scene(vm) { _nextJanitorSequenceId = -1; _currJanitorSequenceId = -1; @@ -2799,31 +2643,6 @@ void Scene27::updateAnimations() { /*****************************************************************************/ -enum { - kHS28Platypus = 0, - kHS28Horn = 1, - kHS28Clown = 2, - kHS28ExitOutsideClown = 3, - kHS28EmptyBucket = 4, - kHS28Device = 5, - kHS28WalkArea1 = 6, - kHS28WalkArea2 = 7 -}; - -enum { - kAS28UseBeerBucketWithClown = 0, - kAS28UsePillBucketWithClown = 1, - kAS28GrabHornFails = 2, - kAS28GrabEmptyBucket = 3, - kAS28GrabHornSuccess = 4, - kAS28GrabHornSuccessDone = 5, - kAS28GrabEmptyBucketDone = 6, - kAS28GrabHornFailsDone = 7, - kAS28TalkClown = 8, - kAS28GnapWaiting = 9, - kAS28LeaveScene = 10 -}; - Scene28::Scene28(GnapEngine *vm) : Scene(vm) { _currClownSequenceId = -1; _nextClownSequenceId = -1; @@ -3219,21 +3038,6 @@ void Scene28::updateAnimations() { /*****************************************************************************/ -enum { - kHS29Platypus = 0, - kHS29Monkey = 1, - kHS29Device = 2, - kHS29ExitCircus = 3, - kHS29ExitOutsideClown = 4, - kHS29Aracde = 5, - kHS29WalkArea1 = 6 -}; - -enum { - kAS29UseBananaWithMonkey = 0, - kAS29LeaveScene = 2 -}; - Scene29::Scene29(GnapEngine *vm) : Scene(vm) { _currMonkeySequenceId = -1; _nextMonkeySequenceId = -1; diff --git a/engines/gnap/scenes/group2.h b/engines/gnap/scenes/group2.h index 3e84d4d500..3b74d85bea 100644 --- a/engines/gnap/scenes/group2.h +++ b/engines/gnap/scenes/group2.h @@ -27,6 +27,202 @@ namespace Gnap { +enum { + kHS20Platypus = 0, + kHS20GroceryStoreHat = 1, + kHS20ExitParkingLot = 2, + kHS20StonerGuy = 3, + kHS20GroceryStoreGuy = 4, + kHS20Device = 5, + kHS20ExitInsideGrubCity = 6, + kHS20ExitOutsideCircusWorld = 7, + kHS20ExitOutsideToyStore = 8, + kHS20ExitPhone = 9, + kHS20WalkArea1 = 10, + kHS20WalkArea2 = 11 +}; + +enum { + kHS21Platypus = 0, + kHS21Banana = 1, + kHS21OldLady = 2, + kHS21Device = 3, + kHS21ExitOutsideGrubCity = 4, + kHS21WalkArea1 = 5, + kHS21WalkArea2 = 6 +}; + +enum { + kHS22Platypus = 0, + kHS22ExitOutsideGrubCity = 1, + kHS22ExitBackGrubCity = 2, + kHS22Cashier = 3, + kHS22Device = 4, + kHS22WalkArea1 = 5, + kHS22WalkArea2 = 6 +}; + +enum { + kHS23Platypus = 0, + kHS23ExitFrontGrubCity = 1, + kHS23Device = 2, + kHS23Cereals = 3, + kHS23WalkArea1 = 4, + kHS23WalkArea2 = 5 +}; + +enum { + kHS24Platypus = 0, + kHS24ExitCircusWorld = 1, + kHS24ExitOutsideGrubCity = 2, + kHS24Device = 3, + kHS24WalkArea1 = 4, + kHS24WalkArea2 = 5, + kHS24WalkArea3 = 6 +}; + +enum { + kHS25Platypus = 0, + kHS25TicketVendor = 1, + kHS25ExitOutsideCircusWorld = 2, + kHS25ExitInsideCircusWorld = 3, + kHS25Device = 4, + kHS25Posters1 = 5, + kHS25Posters2 = 6, + kHS25Posters3 = 7, + kHS25Posters4 = 8, + kHS25WalkArea1 = 9, + kHS25WalkArea2 = 10 +}; + +enum { + kHS26Platypus = 0, + kHS26ExitOutsideCircusWorld = 1, + kHS26ExitOutsideClown = 2, + kHS26ExitArcade = 3, + kHS26ExitElephant = 4, + kHS26ExitBeerStand = 5, + kHS26Device = 6, + kHS26WalkArea1 = 7, + kHS26WalkArea2 = 8 +}; + +enum { + kHS27Platypus = 0, + kHS27Janitor = 1, + kHS27Device = 2, + kHS27Bucket = 3, + kHS27ExitCircus = 4, + kHS27ExitArcade = 5, + kHS27ExitBeerStand = 6, + kHS27ExitClown = 7, + kHS27WalkArea1 = 8 +}; + +enum { + kHS28Platypus = 0, + kHS28Horn = 1, + kHS28Clown = 2, + kHS28ExitOutsideClown = 3, + kHS28EmptyBucket = 4, + kHS28Device = 5, + kHS28WalkArea1 = 6, + kHS28WalkArea2 = 7 +}; + +enum { + kHS29Platypus = 0, + kHS29Monkey = 1, + kHS29Device = 2, + kHS29ExitCircus = 3, + kHS29ExitOutsideClown = 4, + kHS29Aracde = 5, + kHS29WalkArea1 = 6 +}; + +enum { + kAS20LeaveScene = 0, + kAS20TalkStonerGuyNoJoint = 2, + kAS20TalkStonerGuyHasJoint = 3, + kAS20GrabJoint = 4, + kAS20ActionDone = 5, + kAS20TalkGroceryStoreGuy = 6, + kAS20GrabGroceryStoreGuy = 9, + kAS20GrabGroceryStoreHat = 10, + kAS20SwitchGroceryStoreHat = 11, + kAS20SwitchGroceryStoreHatDone = 12, + kAS20GrabJointDone = 13 +}; + +enum { + kAS21TalkOldLady = 0, + kAS21GrabBanana = 1, + kAS21GrabBananaDone = 2, + kAS21GrabOldLady = 3, + kAS21UseHatWithOldLady = 4, + kAS21UseHatWithOldLadyDone = 5, + kAS21LeaveScene = 6 +}; + +enum { + kAS22LeaveScene = 0, + kAS22TalkCashier = 1 +}; + +enum { + kAS23LookCereals = 0, + kAS23GrabCereals = 1, + kAS23GrabCerealsDone = 2, + kAS23LeaveScene = 3 +}; + +enum { + kAS24LeaveScene = 0 +}; + +enum { + kAS25TalkTicketVendor = 0, + kAS25EnterCircusWihoutTicket = 1, + kAS25ShowTicketToVendor = 2, + kAS25ShowTicketToVendorDone = 3, + kAS25EnterCircusWihoutTicketDone = 4, + kAS25LeaveScene = 5 +}; + +enum { + kAS26LeaveScene = 0 +}; + +enum { + kAS27TalkJanitor = 0, + kAS27GrabBucket = 1, + kAS27GrabBucketDone = 2, + kAS27ShowPictureToJanitor = 3, + kAS27TryEnterClownTent = 4, + kAS27TryEnterClownTentDone = 5, + kAS27EnterClownTent = 6, + kAS27LeaveScene = 7 +}; + +enum { + kAS28UseBeerBucketWithClown = 0, + kAS28UsePillBucketWithClown = 1, + kAS28GrabHornFails = 2, + kAS28GrabEmptyBucket = 3, + kAS28GrabHornSuccess = 4, + kAS28GrabHornSuccessDone = 5, + kAS28GrabEmptyBucketDone = 6, + kAS28GrabHornFailsDone = 7, + kAS28TalkClown = 8, + kAS28GnapWaiting = 9, + kAS28LeaveScene = 10 +}; + +enum { + kAS29UseBananaWithMonkey = 0, + kAS29LeaveScene = 2 +}; + class GnapEngine; class CutScene; -- cgit v1.2.3 From e0781ea43732fba5df1031093478f8270267b521 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 29 Apr 2016 00:00:09 +0200 Subject: GNAP: Move more enums to header files --- engines/gnap/scenes/group3.cpp | 117 +------------------------------- engines/gnap/scenes/group3.h | 115 +++++++++++++++++++++++++++++++ engines/gnap/scenes/group4.cpp | 148 ---------------------------------------- engines/gnap/scenes/group4.h | 150 +++++++++++++++++++++++++++++++++++++++++ engines/gnap/scenes/group5.cpp | 18 ----- engines/gnap/scenes/group5.h | 20 ++++++ 6 files changed, 286 insertions(+), 282 deletions(-) diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index d61859a07c..a9b86b7344 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -27,23 +27,6 @@ namespace Gnap { -enum { - kHS30Platypus = 0, - kHS30PillMachine = 1, - kHS30Device = 2, - kHS30ExitCircus = 3, - kHS30WalkArea1 = 4 -}; - -enum { - kAS30LeaveScene = 0, - kAS30UsePillMachine = 1, - kAS30UsePillMachine2 = 2, - kAS30LookPillMachine = 3, - kAS30UsePillMachine3 = 4, - kAS30UsePillMachine4 = 5 -}; - Scene30::Scene30(GnapEngine *vm) : Scene(vm) { _kidSequenceId = -1; } @@ -284,25 +267,6 @@ void Scene30::updateAnimations() { /*****************************************************************************/ -enum { - kHS31Platypus = 0, - kHS31MeasuringClown = 1, - kHS31BeerBarrel = 2, - kHS31Device = 3, - kHS31ExitCircus = 4, - kHS31ExitOutsideClown = 5, - kHS31WalkArea1 = 6 -}; - -enum { - kAS31UseBeerBarrel = 1, - kAS31FillEmptyBucketWithBeer = 2, - kAS31FillEmptyBucketWithBeerDone = 3, - kAS31PlatMeasuringClown = 4, - kAS31UseMeasuringClown = 5, - kAS31LeaveScene = 6 -}; - Scene31::Scene31(GnapEngine *vm) : Scene(vm) { _beerGuyDistracted = false; _currClerkSequenceId = -1; @@ -664,27 +628,7 @@ void Scene31::updateAnimations() { /*****************************************************************************/ -enum { - kHS32Platypus = 0, - kHS32ExitTruck = 1, - kHS32Device = 2, - kHS32WalkArea1 = 3, - kHS32WalkArea2 = 4, - kHS32WalkArea3 = 5, - kHS32WalkArea4 = 6, - kHS32WalkArea5 = 7, - kHS32WalkArea6 = 8, - kHS32WalkArea7 = 9, - kHS32WalkArea8 = 10 -}; - -enum { - kAS32LeaveScene = 0 -}; - -Scene32::Scene32(GnapEngine *vm) : Scene(vm) { - -} +Scene32::Scene32(GnapEngine *vm) : Scene(vm) {} int Scene32::init() { _vm->_gameSys->setAnimation(0, 0, 0); @@ -835,25 +779,6 @@ void Scene32::updateAnimations() { /*****************************************************************************/ -enum { - kHS33Platypus = 0, - kHS33Chicken = 1, - kHS33Device = 2, - kHS33ExitHouse = 3, - kHS33ExitBarn = 4, - kHS33ExitCreek = 5, - kHS33ExitPigpen = 6, - kHS33WalkArea1 = 7, - kHS33WalkArea2 = 8 -}; - -enum { - kAS33LeaveScene = 0, - kAS33TalkChicken = 1, - kAS33UseChicken = 2, - kAS33UseChickenDone = 3 -}; - Scene33::Scene33(GnapEngine *vm) : Scene(vm) { _currChickenSequenceId = -1; _nextChickenSequenceId = -1; @@ -1135,32 +1060,6 @@ void Scene33::updateAnimations() { /*****************************************************************************/ -enum { - kHS38Platypus = 0, - kHS38ExitHouse = 1, - kHS38ExitCave = 2, - kHS38TrapDoorLid1 = 3, - kHS38TrapDoorLid2 = 4, - kHS38HuntingTrophy = 5, - kHS38WalkArea1 = 6, - kHS38Device = 7, - kHS38WalkArea2 = 8, - kHS38WalkArea3 = 9, - kHS38WalkArea4 = 10, - kHS38WalkArea5 = 11, - kHS38WalkArea6 = 12 -}; - -enum { - kAS38LeaveScene = 0, - kAS38ExitCave = 1, - kAS38UseHuntingTrophy = 2, - kAS38HoldingHuntingTrophy = 3, - kAS38ReleaseHuntingTrophy = 4, - kAS38UsePlatypusWithTrapDoor = 5, - kAS38PlatypusHoldingTrapDoor = 6 -}; - Scene38::Scene38(GnapEngine *vm) : Scene(vm) { } @@ -1467,20 +1366,6 @@ void Scene38::updateAnimations() { /*****************************************************************************/ -enum { - kHS39Platypus = 0, - kHS39ExitInsideHouse = 1, - kHS39ExitUfoParty = 2, - kHS39Sign = 3, - kHS39Device = 4, - kHS39WalkArea1 = 5, - kHS39WalkArea2 = 6 -}; - -enum { - kAS39LeaveScene = 0 -}; - Scene39::Scene39(GnapEngine *vm) : Scene(vm) { _currGuySequenceId = -1; _nextGuySequenceId = -1; diff --git a/engines/gnap/scenes/group3.h b/engines/gnap/scenes/group3.h index fa57f1781e..e80debb149 100644 --- a/engines/gnap/scenes/group3.h +++ b/engines/gnap/scenes/group3.h @@ -27,6 +27,121 @@ namespace Gnap { +enum { + kHS30Platypus = 0, + kHS30PillMachine = 1, + kHS30Device = 2, + kHS30ExitCircus = 3, + kHS30WalkArea1 = 4 +}; + +enum { + kHS31Platypus = 0, + kHS31MeasuringClown = 1, + kHS31BeerBarrel = 2, + kHS31Device = 3, + kHS31ExitCircus = 4, + kHS31ExitOutsideClown = 5, + kHS31WalkArea1 = 6 +}; + +enum { + kHS32Platypus = 0, + kHS32ExitTruck = 1, + kHS32Device = 2, + kHS32WalkArea1 = 3, + kHS32WalkArea2 = 4, + kHS32WalkArea3 = 5, + kHS32WalkArea4 = 6, + kHS32WalkArea5 = 7, + kHS32WalkArea6 = 8, + kHS32WalkArea7 = 9, + kHS32WalkArea8 = 10 +}; + +enum { + kHS33Platypus = 0, + kHS33Chicken = 1, + kHS33Device = 2, + kHS33ExitHouse = 3, + kHS33ExitBarn = 4, + kHS33ExitCreek = 5, + kHS33ExitPigpen = 6, + kHS33WalkArea1 = 7, + kHS33WalkArea2 = 8 +}; + +enum { + kHS38Platypus = 0, + kHS38ExitHouse = 1, + kHS38ExitCave = 2, + kHS38TrapDoorLid1 = 3, + kHS38TrapDoorLid2 = 4, + kHS38HuntingTrophy = 5, + kHS38WalkArea1 = 6, + kHS38Device = 7, + kHS38WalkArea2 = 8, + kHS38WalkArea3 = 9, + kHS38WalkArea4 = 10, + kHS38WalkArea5 = 11, + kHS38WalkArea6 = 12 +}; + +enum { + kHS39Platypus = 0, + kHS39ExitInsideHouse = 1, + kHS39ExitUfoParty = 2, + kHS39Sign = 3, + kHS39Device = 4, + kHS39WalkArea1 = 5, + kHS39WalkArea2 = 6 +}; + +enum { + kAS30LeaveScene = 0, + kAS30UsePillMachine = 1, + kAS30UsePillMachine2 = 2, + kAS30LookPillMachine = 3, + kAS30UsePillMachine3 = 4, + kAS30UsePillMachine4 = 5 +}; + +enum { + kAS31UseBeerBarrel = 1, + kAS31FillEmptyBucketWithBeer = 2, + kAS31FillEmptyBucketWithBeerDone = 3, + kAS31PlatMeasuringClown = 4, + kAS31UseMeasuringClown = 5, + kAS31LeaveScene = 6 +}; + +enum { + kAS32LeaveScene = 0 +}; + +enum { + kAS33LeaveScene = 0, + kAS33TalkChicken = 1, + kAS33UseChicken = 2, + kAS33UseChickenDone = 3 +}; + +enum { + kAS38LeaveScene = 0, + kAS38ExitCave = 1, + kAS38UseHuntingTrophy = 2, + kAS38HoldingHuntingTrophy = 3, + kAS38ReleaseHuntingTrophy = 4, + kAS38UsePlatypusWithTrapDoor = 5, + kAS38PlatypusHoldingTrapDoor = 6 +}; + +enum { + kAS39LeaveScene = 0 +}; + +/*****************************************************************************/ + class GnapEngine; class CutScene; diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 90cb91f393..1550703e90 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -27,18 +27,6 @@ namespace Gnap { -enum { - kHS40Platypus = 0, - kHS40ExitCave = 1, - kHS40ExitToyStand = 2, - kHS40ExitBBQ = 3, - kHS40ExitUfo = 4, - kHS40ExitKissinBooth = 5, - kHS40ExitDancefloor = 6, - kHS40ExitShoe = 7, - kHS40Device = 8 -}; - Scene40::Scene40(GnapEngine *vm) : Scene(vm) { } @@ -192,38 +180,6 @@ void Scene40::updateAnimations() { /*****************************************************************************/ -enum { - kHS41Platypus = 0, - kHS41ExitCave = 1, - kHS41Exit = 2, - kHS41ExitBBQ = 3, - kHS41ToyVendor = 4, - kHS41Kid = 5, - kHS41ToyUfo = 6, - kHS41Device = 7, - kHS41WalkArea1 = 8 -}; - -enum { - kHS41UfoExitLeft = 1, - kHS41UfoExitRight = 2, - kHS41UfoDevice = 3, - kHS41UfoWalkArea1 = 4 -}; - -enum { - kAS41LeaveScene = 0, - kAS41UseQuarterWithToyVendor = 1, - kAS41TalkToyVendor = 2, - kAS41UseGumWithToyUfo = 3, - kAS41UseChickenBucketWithKid = 4, - kAS41GrabKid = 5, - kAS41GiveBackToyUfo = 6, - kAS41ToyUfoLeaveScene = 7, - kAS41ToyUfoRefresh = 8, - kAS41UfoGumAttached = 9 -}; - Scene41::Scene41(GnapEngine *vm) : Scene(vm) { _currKidSequenceId = -1; _nextKidSequenceId = -1; @@ -753,36 +709,6 @@ void Scene41::updateAnimations() { /*****************************************************************************/ -enum { - kHS42Platypus = 0, - kHS42ExitUfoParty = 1, - kHS42ExitToyStand = 2, - kHS42ExitUfo = 3, - kHS42BBQVendor = 4, - kHS42ChickenLeg = 5, - kHS42Device = 6, - kHS42WalkArea1 = 7, - kHS42WalkArea2 = 8 -}; - -enum { - kHS42UfoExitLeft = 1, - kHS42UfoExitRight = 2, - kHS42UfoHotSauce = 3, - kHS42UfoDevice = 4 -}; - -enum { - kAS42LeaveScene = 0, - kAS42TalkBBQVendor = 1, - kAS42UseQuarterWithBBQVendor = 2, - kAS42UseQuarterWithBBQVendorDone = 3, - kAS42GrabChickenLeg = 4, - kAS42ToyUfoLeaveScene = 5, - kAS42ToyUfoRefresh = 6, - kAS42ToyUfoPickUpHotSauce = 7 -}; - Scene42::Scene42(GnapEngine *vm) : Scene(vm) { _currBBQVendorSequenceId = -1; _nextBBQVendorSequenceId = -1; @@ -1228,27 +1154,6 @@ void Scene42::updateAnimations() { /*****************************************************************************/ -enum { - kHS43Platypus = 0, - kHS43Device = 1, - kHS43ExitUfoParty = 2, - kHS43ExitBBQ = 3, - kHS43ExitKissinBooth = 4, - kHS43TwoHeadedGuy = 5, - kHS43Key = 6, - kHS43Ufo = 7, - kHS43WalkArea1 = 8, - kHS43WalkArea2 = 9 -}; - -enum { - kHS43UfoExitLeft = 1, - kHS43UfoExitRight = 2, - kHS43UfoKey = 3, - kHS43UfoBucket = 4, - kHS43UfoDevice = 5 -}; - Scene43::Scene43(GnapEngine *vm) : Scene(vm) { _currTwoHeadedGuySequenceId = -1; _nextTwoHeadedGuySequenceId = -1; @@ -1684,25 +1589,6 @@ void Scene43::updateAnimations() { /*****************************************************************************/ -enum { - kHS44Platypus = 0, - kHS44ExitUfoParty = 1, - kHS44ExitUfo = 2, - kHS44ExitShow = 3, - kHS44KissingLady = 4, - kHS44Spring = 5, - kHS44SpringGuy = 6, - kHS44Device = 7, - kHS44WalkArea1 = 8, - kHS44WalkArea2 = 9 -}; - -enum { - kHS44UfoExitLeft = 1, - kHS44UfoExitRight = 2, - kHS44UfoDevice = 3 -}; - Scene44::Scene44(GnapEngine *vm) : Scene(vm) { _nextSpringGuySequenceId = -1; _nextKissingLadySequenceId = -1; @@ -2183,23 +2069,6 @@ void Scene44::updateAnimations() { /*****************************************************************************/ -enum { - kHS45Platypus = 0, - kHS45ExitUfoParty = 1, - kHS45ExitShoe = 2, - kHS45ExitRight = 3, - kHS45ExitDiscoBall = 4, - kHS45DiscoBall = 5, - kHS45Device = 6, - kHS45WalkArea1 = 7 -}; - -enum { - kHS45UfoExitLeft = 1, - kHS45UfoExitRight = 2, - kHS45UfoDevice = 3 -}; - Scene45::Scene45(GnapEngine *vm) : Scene(vm) { _currDancerSequenceId = -1; } @@ -2580,23 +2449,6 @@ void Scene45::updateAnimations() { /*****************************************************************************/ -enum { - kHS46Platypus = 0, - kHS46ExitUfoParty = 1, - kHS46ExitKissinBooth = 2, - kHS46ExitDisco = 3, - kHS46SackGuy = 4, - kHS46ItchyGuy = 5, - kHS46Device = 6, - kHS46WalkArea1 = 7 -}; - -enum { - kHS46UfoExitLeft = 1, - kHS46UfoExitRight = 2, - kHS46UfoDevice = 3 -}; - Scene46::Scene46(GnapEngine *vm) : Scene(vm) { _currSackGuySequenceId = -1; _nextItchyGuySequenceId = -1; diff --git a/engines/gnap/scenes/group4.h b/engines/gnap/scenes/group4.h index 28f03eec6d..542834de7d 100644 --- a/engines/gnap/scenes/group4.h +++ b/engines/gnap/scenes/group4.h @@ -27,6 +27,156 @@ namespace Gnap { +enum { + kHS40Platypus = 0, + kHS40ExitCave = 1, + kHS40ExitToyStand = 2, + kHS40ExitBBQ = 3, + kHS40ExitUfo = 4, + kHS40ExitKissinBooth = 5, + kHS40ExitDancefloor = 6, + kHS40ExitShoe = 7, + kHS40Device = 8 +}; + +enum { + kHS41Platypus = 0, + kHS41ExitCave = 1, + kHS41Exit = 2, + kHS41ExitBBQ = 3, + kHS41ToyVendor = 4, + kHS41Kid = 5, + kHS41ToyUfo = 6, + kHS41Device = 7, + kHS41WalkArea1 = 8 +}; + +enum { + kHS41UfoExitLeft = 1, + kHS41UfoExitRight = 2, + kHS41UfoDevice = 3, + kHS41UfoWalkArea1 = 4 +}; + +enum { + kHS42Platypus = 0, + kHS42ExitUfoParty = 1, + kHS42ExitToyStand = 2, + kHS42ExitUfo = 3, + kHS42BBQVendor = 4, + kHS42ChickenLeg = 5, + kHS42Device = 6, + kHS42WalkArea1 = 7, + kHS42WalkArea2 = 8 +}; + +enum { + kHS42UfoExitLeft = 1, + kHS42UfoExitRight = 2, + kHS42UfoHotSauce = 3, + kHS42UfoDevice = 4 +}; + +enum { + kHS43Platypus = 0, + kHS43Device = 1, + kHS43ExitUfoParty = 2, + kHS43ExitBBQ = 3, + kHS43ExitKissinBooth = 4, + kHS43TwoHeadedGuy = 5, + kHS43Key = 6, + kHS43Ufo = 7, + kHS43WalkArea1 = 8, + kHS43WalkArea2 = 9 +}; + +enum { + kHS43UfoExitLeft = 1, + kHS43UfoExitRight = 2, + kHS43UfoKey = 3, + kHS43UfoBucket = 4, + kHS43UfoDevice = 5 +}; + +enum { + kHS44Platypus = 0, + kHS44ExitUfoParty = 1, + kHS44ExitUfo = 2, + kHS44ExitShow = 3, + kHS44KissingLady = 4, + kHS44Spring = 5, + kHS44SpringGuy = 6, + kHS44Device = 7, + kHS44WalkArea1 = 8, + kHS44WalkArea2 = 9 +}; + +enum { + kHS44UfoExitLeft = 1, + kHS44UfoExitRight = 2, + kHS44UfoDevice = 3 +}; + +enum { + kHS45Platypus = 0, + kHS45ExitUfoParty = 1, + kHS45ExitShoe = 2, + kHS45ExitRight = 3, + kHS45ExitDiscoBall = 4, + kHS45DiscoBall = 5, + kHS45Device = 6, + kHS45WalkArea1 = 7 +}; + +enum { + kHS45UfoExitLeft = 1, + kHS45UfoExitRight = 2, + kHS45UfoDevice = 3 +}; + +enum { + kHS46Platypus = 0, + kHS46ExitUfoParty = 1, + kHS46ExitKissinBooth = 2, + kHS46ExitDisco = 3, + kHS46SackGuy = 4, + kHS46ItchyGuy = 5, + kHS46Device = 6, + kHS46WalkArea1 = 7 +}; + +enum { + kHS46UfoExitLeft = 1, + kHS46UfoExitRight = 2, + kHS46UfoDevice = 3 +}; + +enum { + kAS41LeaveScene = 0, + kAS41UseQuarterWithToyVendor = 1, + kAS41TalkToyVendor = 2, + kAS41UseGumWithToyUfo = 3, + kAS41UseChickenBucketWithKid = 4, + kAS41GrabKid = 5, + kAS41GiveBackToyUfo = 6, + kAS41ToyUfoLeaveScene = 7, + kAS41ToyUfoRefresh = 8, + kAS41UfoGumAttached = 9 +}; + +enum { + kAS42LeaveScene = 0, + kAS42TalkBBQVendor = 1, + kAS42UseQuarterWithBBQVendor = 2, + kAS42UseQuarterWithBBQVendorDone = 3, + kAS42GrabChickenLeg = 4, + kAS42ToyUfoLeaveScene = 5, + kAS42ToyUfoRefresh = 6, + kAS42ToyUfoPickUpHotSauce = 7 +}; + +/*****************************************************************************/ + class GnapEngine; class CutScene; diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 68b957f753..3bcab4cfc5 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -27,24 +27,6 @@ namespace Gnap { -enum { - kHS53Platypus = 0, - kHS53Device = 1, - kHS53PhoneKey1 = 2, - kHS53PhoneKey2 = 3, - kHS53PhoneKey3 = 4, - kHS53PhoneKey4 = 5, - kHS53PhoneKey5 = 6, - kHS53PhoneKey6 = 7, - kHS53PhoneKey7 = 8, - kHS53PhoneKey8 = 9, - kHS53PhoneKey9 = 10, - kHS53PhoneKey0 = 11, - kHS53PhoneKeySharp = 12, - kHS53PhoneKeyStar = 13, - kHS53PhoneExit = 14 -}; - Scene53::Scene53(GnapEngine *vm) : Scene(vm) { _isGnapPhoning = false; _currHandSequenceId = -1; diff --git a/engines/gnap/scenes/group5.h b/engines/gnap/scenes/group5.h index d9ffc19b74..c7d209b6b3 100644 --- a/engines/gnap/scenes/group5.h +++ b/engines/gnap/scenes/group5.h @@ -28,6 +28,26 @@ namespace Gnap { +enum { + kHS53Platypus = 0, + kHS53Device = 1, + kHS53PhoneKey1 = 2, + kHS53PhoneKey2 = 3, + kHS53PhoneKey3 = 4, + kHS53PhoneKey4 = 5, + kHS53PhoneKey5 = 6, + kHS53PhoneKey6 = 7, + kHS53PhoneKey7 = 8, + kHS53PhoneKey8 = 9, + kHS53PhoneKey9 = 10, + kHS53PhoneKey0 = 11, + kHS53PhoneKeySharp = 12, + kHS53PhoneKeyStar = 13, + kHS53PhoneExit = 14 +}; + +/*****************************************************************************/ + class GnapEngine; class Scene53: public Scene { -- cgit v1.2.3 From 25fc9c0a1390c51f4a35f596b4a87b315d520a25 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 29 Apr 2016 07:16:14 +0200 Subject: GNAP: Janitorial - Remove trailing spaces and tabs --- engines/gnap/detection.cpp | 4 +- engines/gnap/gamesys.cpp | 90 ++++++------- engines/gnap/gamesys.h | 26 ++-- engines/gnap/gnap.h | 100 +++++++------- engines/gnap/grid.cpp | 18 +-- engines/gnap/menu.cpp | 14 +- engines/gnap/scenes/arcade.cpp | 40 +++--- engines/gnap/scenes/arcade.h | 2 +- engines/gnap/scenes/group0.cpp | 282 ++++++++++++++++++++-------------------- engines/gnap/scenes/group0.h | 2 +- engines/gnap/scenes/group1.cpp | 282 ++++++++++++++++++++-------------------- engines/gnap/scenes/group1.h | 2 +- engines/gnap/scenes/group2.cpp | 282 ++++++++++++++++++++-------------------- engines/gnap/scenes/group3.cpp | 48 +++---- engines/gnap/scenes/group4.cpp | 264 ++++++++++++++++++------------------- engines/gnap/scenes/group5.cpp | 42 +++--- engines/gnap/scenes/groupcs.cpp | 2 +- engines/gnap/sound.cpp | 6 +- 18 files changed, 753 insertions(+), 753 deletions(-) diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index cb4802c4cd..79fafd4e5f 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -89,9 +89,9 @@ bool GnapMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || (f == kSavesSupportCreationDate); -#if 0 +#if 0 (f == kSavesSupportThumbnail) || -#endif +#endif } bool Gnap::GnapEngine::hasFeature(EngineFeature f) const { diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index e983440c92..e7899a24e3 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -147,9 +147,9 @@ void GameSys::requestRemoveSequence(int sequenceId, int id) { _reqRemoveSequenceItem = true; _removeSequenceItemSequenceId = sequenceId; _removeSequenceItemValue = id; - + handleReqRemoveSequenceItem(); //CHECKME? - + //ResetEvent(reqClearEvent); //ReleaseMutex(removeSequence2Mutex); //WaitForSingleObject(reqClearEvent, INFINITE); @@ -169,13 +169,13 @@ int GameSys::isSequenceActive(int sequenceId, int id) { void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, int a6, int a7) { debugC(kDebugBasic, "GameSys::setBackgroundSurface() Setting background image"); - + _backgroundSurface = surface; if (!_backgroundSurface) { _backgroundImageError = true; return; } - + if (!_frontSurface || _frontSurface->w != surface->w || _frontSurface->h != surface->h) { debugC(kDebugBasic, "GameSys::setBackgroundSurface() Creating background working surface"); if (_frontSurface) @@ -245,11 +245,11 @@ Graphics::Surface *GameSys::allocSurface(int width, int height) { Graphics::Surface *GameSys::createSurface(int resourceId) { debugC(kDebugBasic, "GameSys::createSurface() resourceId: %08X", resourceId); - + SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); Graphics::Surface *surface = allocSurface(spriteResource->_width, spriteResource->_height); _vm->_spriteCache->release(resourceId); - + drawSpriteToSurface(surface, 0, 0, resourceId); return surface; @@ -266,14 +266,14 @@ void GameSys::drawSpriteToSurface(Graphics::Surface *surface, int x, int y, int void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r, byte g, byte b, const char *text) { // NOTE Not that nice but will have to do for now - + bool doDirty = false; if (!surface) { surface = _backgroundSurface; doDirty = true; } - + uint32 color = surface->format.RGBToColor(r, g, b); for (const char *cp = text; *cp != 0; ++cp) { @@ -293,11 +293,11 @@ void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r } x += w + 1; } - + if (doDirty) { insertDirtyRect(Common::Rect(x, y, x + getTextWidth(text), y + 16)); } - + } int GameSys::getTextHeight(const char *text) { @@ -327,10 +327,10 @@ int GameSys::getTextWidth(const char *text) { void GameSys::fillSurface(Graphics::Surface *surface, int x, int y, int width, int height, byte r, byte g, byte b) { Common::Rect rect(x, y, x + width, y + height); if (!surface) { - _backgroundSurface->fillRect(rect, _backgroundSurface->format.RGBToColor(r, g, b)); + _backgroundSurface->fillRect(rect, _backgroundSurface->format.RGBToColor(r, g, b)); insertDirtyRect(rect); } else { - surface->fillRect(rect, surface->format.RGBToColor(r, g, b)); + surface->fillRect(rect, surface->format.RGBToColor(r, g, b)); } } @@ -400,7 +400,7 @@ void GameSys::drawBitmap(int resourceId) { } } bmpSurface->free(); - delete bmpSurface; + delete bmpSurface; insertDirtyRect(Common::Rect(0, 0, 800, 600)); } @@ -436,18 +436,18 @@ int GameSys::seqLocateGfx(int sequenceId, int id, int *outGfxIndex) { void GameSys::seqInsertGfx(int index, int duration) { Sequence *seqItem = &_seqItems[index]; - SequenceResource *sequenceResource = _vm->_sequenceCache->get(seqItem->_sequenceId); + SequenceResource *sequenceResource = _vm->_sequenceCache->get(seqItem->_sequenceId); if (sequenceResource->_animationsCount > 50 - _gfxItemsCount) return; int gfxIndex; seqLocateGfx(seqItem->_sequenceId, seqItem->_id, &gfxIndex); - + if (gfxIndex != _gfxItemsCount) memcpy(&_gfxItems[gfxIndex + sequenceResource->_animationsCount], &_gfxItems[gfxIndex], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); _gfxItemsCount += sequenceResource->_animationsCount; - + for (int i = 0; i < sequenceResource->_animationsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i + gfxIndex]; SequenceAnimation *animation = &sequenceResource->_animations[i]; @@ -489,7 +489,7 @@ void GameSys::seqInsertGfx(int index, int duration) { gfxItem->_currFrame = animation->frames[j - 1]; if (gfxItem->_currFrame._spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) gfxItem->_currFrame._rect.translate(seqItem->_x, seqItem->_y); - // Update sprite scaling + // Update sprite scaling if ((seqItem->_flags & 1) && gfxItem->_currFrame._rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame._rect.bottom <= _backgroundImageValue3) { int scaleValue = _backgroundImageValue2 + (gfxItem->_currFrame._rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / @@ -580,7 +580,7 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { break; } } - + if (!foundAnimation) return; @@ -605,7 +605,7 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) { } void GameSys::restoreBackgroundRect(const Common::Rect &rect) { - Common::Rect clipRect; + Common::Rect clipRect; if (!intersectRect(clipRect, rect, _screenRect)) return; byte *src = (byte*)_backgroundSurface->getBasePtr(clipRect.left, clipRect.top); @@ -621,14 +621,14 @@ void GameSys::restoreBackgroundRect(const Common::Rect &rect) { void GameSys::blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphics::Surface *sourceSurface, Common::Rect &sourceRect, bool transparent) { - + const int sourcePitch = sourceSurface->pitch; byte *dst = (byte*)destSurface->getBasePtr(x, y); byte *src = (byte*)sourceSurface->getBasePtr(sourceRect.left, sourceRect.top); int width = sourceRect.width(); int height = sourceRect.height(); while (height--) { - byte *rsrc = src; + byte *rsrc = src; byte *rdst = dst; for (int xc = 0; xc < width; ++xc) { uint32 pixel = READ_LE_UINT32(rsrc); @@ -644,14 +644,14 @@ void GameSys::blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphi void GameSys::blitSprite32(Graphics::Surface *destSurface, int x, int y, byte *sourcePixels, int sourceWidth, Common::Rect &sourceRect, uint32 *sourcePalette, bool transparent) { - + const int sourcePitch = (sourceWidth + 3) & 0xFFFFFFFC; byte *dst = (byte*)destSurface->getBasePtr(x, y); byte *src = sourcePixels + sourceRect.left + sourcePitch * sourceRect.top; int width = sourceRect.width(); int height = sourceRect.height(); while (height--) { - byte *rdst = dst; + byte *rdst = dst; for (int xc = 0; xc < width; ++xc) { byte srcPixel = src[xc]; if (!transparent || srcPixel) { @@ -669,7 +669,7 @@ void GameSys::blitSprite32(Graphics::Surface *destSurface, int x, int y, byte *s void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &frameRect, Common::Rect &destRect, byte *sourcePixels, int sourceWidth, Common::Rect &sourceRect, uint32 *sourcePalette) { - + if (frameRect.height() <= 0 || frameRect.width() <= 0) return; @@ -739,17 +739,17 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &frame, Common::Rect *subRect) { debugC(kDebugBasic, "GameSys::seqDrawStaticFrame() rect: (%d, %d, %d, %d)", frame._rect.left, frame._rect.top, frame._rect.right, frame._rect.bottom); - + Common::Rect srcRect = subRect ? *subRect : frame._rect; Common::Rect clipRect; - + if (!intersectRect(clipRect, srcRect, _screenRect)) { debugC(kDebugBasic, "GameSys::seqDrawStaticFrame() Surface not inside screen"); return; } const int x = clipRect.left, y = clipRect.top; - + clipRect.translate(-frame._rect.left, -frame._rect.top); // TODO Save transparent flag somewhere @@ -759,10 +759,10 @@ void GameSys::seqDrawStaticFrame(Graphics::Surface *surface, SequenceFrame &fram void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame &frame, Common::Rect *subRect) { debugC(kDebugBasic, "GameSys::seqDrawSpriteFrame() spriteId: %04X; rect: (%d, %d, %d, %d)", frame._spriteId, frame._rect.left, frame._rect.top, frame._rect.right, frame._rect.bottom); - + Common::Rect srcRect = subRect ? *subRect : frame._rect; Common::Rect clipRect; - + if (!intersectRect(clipRect, srcRect, _screenRect)) { debugC(kDebugBasic, "GameSys::seqDrawSpriteFrame() Sprite not inside screen"); return; @@ -772,7 +772,7 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & byte *sourcePixels = spriteResource->_pixels; const int x = clipRect.left, y = clipRect.top; - + debugC(kDebugBasic, "GameSys::seqDrawSpriteFrame() destX: %d; destY: %d; frame.isScaled: %d", x, y, frame._isScaled ? 1 : 0); // 32bit sprite drawing @@ -790,7 +790,7 @@ void GameSys::drawSprites() { // TODO Split into multiple functions for clarity - // Restore dirty background and collect rects to be redrawn for all sprites + // Restore dirty background and collect rects to be redrawn for all sprites // which aren't marked to be redrawn yet Common::Rect intersectingRect; for (uint i = 0; i < _dirtyRects.size(); ++i) { @@ -798,7 +798,7 @@ void GameSys::drawSprites() { for (int j = 0; j < _gfxItemsCount; ++j) _gfxItems[j].testUpdRect(_dirtyRects[i]); } - + for (int k = 0; k < _gfxItemsCount; ++k) { GfxItem *gfxItem2 = &_gfxItems[k]; @@ -846,10 +846,10 @@ void GameSys::drawSprites() { for (int m = 0; m < _gfxItemsCount; ++m) { GfxItem *gfxItem5 = &_gfxItems[m]; - + debugC(kDebugBasic, "DrawGfxItem(%d) updFlag: %d; currFrame.spriteId: %04X; updRectsCount: %d; flags: %04X; sequenceId: %08X", m, gfxItem5->_updFlag, gfxItem5->_currFrame._spriteId, gfxItem5->_updRectsCount, gfxItem5->_flags, gfxItem5->_sequenceId); - + if (gfxItem5->_updFlag) { if (gfxItem5->_currFrame._spriteId != -1) { if (gfxItem5->_flags & 1) { @@ -925,9 +925,9 @@ void GameSys::updateScreen() { updateRect(srcRect); updateRect(rcSrc2); } - gfxItem->_prevFrame = gfxItem->_currFrame; + gfxItem->_prevFrame = gfxItem->_currFrame; } - + updateRect(Common::Rect(0, 0, 800, 600)); debugC(kDebugBasic, "GameSys::updateScreen() OK"); @@ -1002,15 +1002,15 @@ void GameSys::handleReqRemoveSpriteDrawItems() { void GameSys::fatUpdateFrame() { debugC(kDebugBasic, "GameSys::fatUpdateFrame()"); - + int32 clockDelta = _gameSysClock - _lastUpdateClock; _lastUpdateClock = _gameSysClock; - + debugC(kDebugBasic, "GameSys::fatUpdateFrame() clockDelta: %d", clockDelta); - + if (clockDelta <= 0) return; - + int duration, currFrameNum; // NOTE Skipped avi code (reqAviStart) @@ -1080,7 +1080,7 @@ void GameSys::fatUpdateFrame() { gfxItem->_currFrame = animation->frames[currFrameNum - 1]; if (gfxItem->_currFrame._spriteId != -1 && (seqItem->_x != 0 || seqItem->_y != 0)) gfxItem->_currFrame._rect.translate(seqItem->_x, seqItem->_y); - // Update sprite scaling + // Update sprite scaling if ((seqItem->_flags & 1) && gfxItem->_currFrame._rect.bottom >= _backgroundImageValue1 && gfxItem->_currFrame._rect.bottom <= _backgroundImageValue3) { int v17 = _backgroundImageValue2 + (gfxItem->_currFrame._rect.bottom - _backgroundImageValue1) * (_backgroundImageValue4 - _backgroundImageValue2) / @@ -1152,7 +1152,7 @@ void GameSys::fatUpdateFrame() { } _newSpriteDrawItemsCount = 0; } - + if (_grabSpriteChanged) { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; @@ -1171,7 +1171,7 @@ void GameSys::fatUpdateFrame() { } _grabSpriteChanged = false; } - + // NOTE Skipped avi code (reqAviStart) debugC(kDebugBasic, "GameSys::fatUpdateFrame() _fatSequenceItems.size(): %d", _fatSequenceItems.size()); @@ -1254,12 +1254,12 @@ void GameSys::fatUpdate() { _gfxItems[i]._updFlag = false; _gfxItems[i]._updRectsCount = 0; } - + handleReqRemoveSequenceItem(); handleReqRemoveSequenceItems(); handleReqRemoveSpriteDrawItems(); // NOTE Skipped avi stuff (reqAviStop) - + fatUpdateFrame(); } diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index a011a616f5..29a5f97db3 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -130,43 +130,43 @@ public: void drawBitmap(int resourceId); public: GnapEngine *_vm; - + Common::Array _dirtyRects; - SpriteDrawItem _newSpriteDrawItems[kMaxSpriteDrawItems]; + SpriteDrawItem _newSpriteDrawItems[kMaxSpriteDrawItems]; int _newSpriteDrawItemsCount; RemoveSequenceItem _removeSequenceItems[kMaxSequenceItems]; int _removeSequenceItemsCount; - + RemoveSpriteDrawItem _removeSpriteDrawItems[kMaxSpriteDrawItems]; int _removeSpriteDrawItemsCount; - + int _grabSpriteId; Common::Rect _grabSpriteRect; bool _grabSpriteChanged; Graphics::Surface *_grabSpriteSurface1, *_grabSpriteSurface2; - + bool _reqRemoveSequenceItem; int _removeSequenceItemSequenceId, _removeSequenceItemValue; Common::Array _soundIds; - + //////////////////////////////////////////////////////////////////////////// - + Common::Array _seqItems; Common::Array _fatSequenceItems; - + GfxItem _gfxItems[kMaxGfxItems]; int _gfxItemsCount; - + Animation _animations[kMaxAnimations]; int _animationsCount; - + int _backgroundImageValue3, _backgroundImageValue1; int _backgroundImageValue4, _backgroundImageValue2; bool _backgroundImageError; // CHECKME: Unused - + int32 _gameSysClock, _lastUpdateClock; Graphics::Surface *_backgroundSurface; @@ -179,7 +179,7 @@ public: void seqRemoveGfx(int sequenceId, int id); bool updateSequenceDuration(int sequenceId, int id, int *outDuration); void updateAnimationsStatus(int sequenceId, int id); - + void restoreBackgroundRect(const Common::Rect &rect); void blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphics::Surface *sourceSurface, @@ -195,7 +195,7 @@ public: void drawSprites(); void updateRect(const Common::Rect &r); void updateScreen(); - + void handleReqRemoveSequenceItem(); void handleReqRemoveSequenceItems(); void handleReqRemoveSpriteDrawItems(); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 6c8995a331..8f86a866c0 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -279,11 +279,11 @@ private: Graphics::PixelFormat _pixelFormat; int _loadGameSlot; -public: +public: Common::RandomSource *_random; - + Common::PEResources *_exe; - + DatManager *_dat; SpriteCache *_spriteCache; SoundCache *_soundCache; @@ -294,38 +294,38 @@ public: Scene *_scene; int _lastUpdateClock; - + int _debugLevel; bool _gameDone; - + byte _keyPressState[512]; byte _keyDownState[512]; - + bool _isPaused; Graphics::Surface *_pauseSprite; int _timers[kMaxTimers], _savedTimers[kMaxTimers]; - + MouseButtonState _mouseButtonState; MouseButtonState _mouseClickState; - + uint32 _keyStatus1[2]; - + bool _sceneSavegameLoaded, _wasSavegameLoaded; - + Graphics::Surface *_backgroundSurface; - int _prevSceneNum, _currentSceneNum, _newSceneNum; + int _prevSceneNum, _currentSceneNum, _newSceneNum; bool _sceneDone, _sceneWaiting; uint32 _inventory, _gameFlags; - + Hotspot _hotspots[20]; Common::Point _hotspotsWalkPos[20]; int _hotspotsCount; int _sceneClickedHotspot; - + bool _isWaiting; bool _isLeavingScene; - + bool _isStockDatLoaded; int _newCursorValue, _cursorValue; @@ -333,32 +333,32 @@ public: int _verbCursor, _cursorIndex; int _mouseX, _mouseY; int _leftClickMouseX, _leftClickMouseY; - + Graphics::Surface *_grabCursorSprite; int _currGrabCursorX, _currGrabCursorY; int _grabCursorSpriteIndex, _newGrabCursorSpriteIndex; - + Graphics::Surface *_fullScreenSprite; int _fullScreenSpriteId; - + int _deviceX1, _deviceY1, _deviceX2, _deviceY2; - + int _soundTimerIndexA; int _soundTimerIndexB; int _soundTimerIndexC; int _idleTimerIndex; - + void updateEvents(); void gameUpdateTick(); void saveTimers(); void restoreTimers(); - + void pauseGame(); void resumeGame(); void updatePause(); - + int getRandom(int max); - + int readSavegameDescription(int savegameNum, Common::String &description); int loadSavegame(int savegameNum); Common::Error saveGameState(int slot, const Common::String &desc); @@ -367,57 +367,57 @@ public: void synchronize(Common::Serializer &s); void writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeader &header); static bool readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &header); - + void delayTicks(int a1); void delayTicksCursor(int a1); - + void setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags = 0, int16 walkX = -1, int16 walkY = -1); int getHotspotIndexAtPos(int16 x, int16 y); void updateCursorByHotspot(); int getClickedHotspotId(); - + int getInventoryItemSpriteNum(int index); - + void updateMouseCursor(); void setVerbCursor(int verbCursor); void setCursor(int cursorIndex); void showCursor(); void hideCursor(); - + void setGrabCursorSprite(int index); void createGrabCursorSprite(int spriteId); void freeGrabCursorSprite(); void updateGrabCursorSprite(int x, int y); - + void invClear(); void invAdd(int itemId); void invRemove(int itemId); bool invHas(int itemId); - + void clearFlags(); void setFlag(int num); void clearFlag(int num); bool isFlag(int num); - + Graphics::Surface *addFullScreenSprite(int resourceId, int id); void removeFullScreenSprite(); void showFullScreenSprite(int resourceId); - + void queueInsertDeviceIcon(); void insertDeviceIconActive(); void removeDeviceIconActive(); void setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int y2); - + int getSequenceTotalDuration(int resourceId); - + bool isSoundPlaying(int resourceId); void playSound(int resourceId, bool looping); void stopSound(int resourceId); void setSoundVolume(int resourceId, int volume); void updateTimers(); - + void initGameFlags(int num); void loadStockDat(); @@ -425,12 +425,12 @@ public: void initScene(); void endSceneInit(); void afterScene(); - + int initSceneLogic(); void runSceneLogic(); - + void checkGameKeys(); - + void startSoundTimerA(int timerIndex); int playSoundA(); void startSoundTimerB(int timerIndex); @@ -439,16 +439,16 @@ public: int playSoundC(); void startIdleTimer(int timerIndex); void updateIdleTimer(); - + void screenEffect(int dir, byte r, byte g, byte b); - + bool isKeyStatus1(int key); bool isKeyStatus2(int key); void clearKeyStatus1(int key); void clearAllKeyStatus1(); - + void deleteSurface(Graphics::Surface **surface); - + // Menu int _menuStatus; int _menuSpritesIndex; @@ -458,7 +458,7 @@ public: Graphics::Surface *_largeSprite; Graphics::Surface *_menuSaveLoadSprite; Graphics::Surface *_menuSprite2; - Graphics::Surface *_menuSprite1; + Graphics::Surface *_menuSprite1; char _savegameFilenames[7][30]; Graphics::Surface *_savegameSprites[7]; Graphics::Surface *_spriteHandle; @@ -474,14 +474,14 @@ public: void initSaveLoadHotspots(); void drawInventoryFrames(); void insertInventorySprites(); - void removeInventorySprites(); + void removeInventorySprites(); void runMenu(); void updateMenuStatusInventory(); void updateMenuStatusMainMenu(); void updateMenuStatusSaveGame(); void updateMenuStatusLoadGame(); void updateMenuStatusQueryQuit(); - + // Grid common int _gnapGridX, _gnapGridY; int _platGridX, _platGridY; @@ -507,14 +507,14 @@ public: bool gnapFindPath3(int gridX, int gridY); bool gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void gnapWalkStep(); - + // Platypus walking int _platWalkNodesCount; GridStruct _platWalkNodes[kMaxGridStructs]; int _platX, _platY; int _platWalkDestX, _platWalkDestY; int _platWalkDeltaX, _platWalkDeltaY, _platWalkDirX, _platWalkDirY, _platWalkDirXIncr, _platWalkDirYIncr; - + int getPlatypusWalkSequenceId(int deltaX, int deltaY); bool gridSub423750(int gridX, int gridY); bool gridSub423CC1(int gridX, int gridY, int index); @@ -556,7 +556,7 @@ public: void gnapKissPlatypus(int callback); void gnapUseJointOnPlatypus(); void gnapUseDisguiseOnPlatypus(); - + // Platypus Facing _platypusFacing; int _platypusActionStatus; @@ -566,15 +566,15 @@ public: void updatePlatypusIdleSequence(); void platypusSub426234(); void initPlatypusPos(int gridX, int gridY, Facing facing); - + // Scenes - + int _toyUfoNextSequenceId, _toyUfoSequenceId; int _toyUfoId; int _toyUfoActionStatus; int _toyUfoX; int _toyUfoY; - + void initGlobalSceneVars(); void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 0e10a715e8..dfdc52811a 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -75,7 +75,7 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { if ((gridX == _gnapX && gridY == _gnapY) || (gridX == _platX && gridY == _platY)) return true; - + const int x = _gridMinX + 75 * gridX; const int y = _gridMinY + 48 * gridY; @@ -92,7 +92,7 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { bool GnapEngine::gridSub41F08B(int gridX, int gridY) { bool result = false; - + _gnapWalkNodesCount = 0; _gnapWalkDirXIncr = 0; _gnapWalkDirYIncr = 0; @@ -148,7 +148,7 @@ bool GnapEngine::gridSub41F08B(int gridX, int gridY) { } ++_gnapWalkNodesCount; } - + while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = _gnapWalkDestY; @@ -553,7 +553,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapWalkDestX = CLIP(gridX, 0, _gridMaxX - 1); _gnapWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); - + if (animationIndex >= 0 && _gnapWalkDestX == _platX && _gnapWalkDestY == _platY) platypusMakeRoom(); @@ -562,7 +562,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen if (!done && gridSub41FAD5(_gnapX, _gnapY, 0)) done = true; - + if (!done && gnapFindPath3(_gnapX, _gnapY)) done = true; @@ -749,7 +749,7 @@ int GnapEngine::getPlatypusWalkSequenceId(int deltaX, int deltaY) { bool GnapEngine::gridSub423750(int gridX, int gridY) { bool result = false; - + _platWalkNodesCount = 0; _platWalkDirXIncr = 0; _platWalkDirYIncr = 0; @@ -1195,7 +1195,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { } bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { - + int datNum = flags & 3; bool done = false; @@ -1218,7 +1218,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (!done && gridSub42419A(_platX, _platY, 0)) done = true; - + if (!done && platFindPath3(_platX, _platY)) done = true; @@ -1349,7 +1349,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platX = _platWalkDestX; _platY = _platWalkDestY; - + return done; } diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index d1701d7d0e..89d14eb4b1 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -86,7 +86,7 @@ void GnapEngine::initMenuHotspots1() { void GnapEngine::initMenuHotspots2() { int curId = 0; - + for (int i = 0; i < 4; ++i) { _hotspots[curId]._x1 = 312; _hotspots[curId]._y1 = 48 * i + 85; @@ -330,7 +330,7 @@ void GnapEngine::runMenu() { updateMenuStatusQueryQuit(); break; } - + gameUpdateTick(); } @@ -376,7 +376,7 @@ void GnapEngine::runMenu() { _mouseClickState._left = false; removeDeviceIconActive(); - + freeMenuSprite();//??? CHECKME } @@ -465,7 +465,7 @@ void GnapEngine::updateMenuStatusMainMenu() { _sceneClickedHotspot = -1; if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); - + if (_sceneClickedHotspot != 1 && _sceneClickedHotspot != 0) { if (_sceneClickedHotspot != 2 && _hotspotsCount - 1 != _sceneClickedHotspot) { if (_sceneClickedHotspot == 3) { @@ -514,7 +514,7 @@ void GnapEngine::updateMenuStatusMainMenu() { clearKeyStatus1(29); clearKeyStatus1(30); } - + _gameSys->removeSpriteDrawItem(_largeSprite, 300); delayTicksCursor(5); deleteSurface(&_largeSprite); @@ -658,7 +658,7 @@ void GnapEngine::writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeade out->writeByte('\0'); // TODO: Add thumbnail - + // Write out the save date/time TimeDate td; g_system->getTimeAndDate(td); @@ -930,7 +930,7 @@ void GnapEngine::updateMenuStatusQueryQuit() { if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); - + /* _sceneClickedHotspot 0 Yes 1 No diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 3b1b1b0807..a857427f3d 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -357,7 +357,7 @@ void Scene49::run() { _truckId = 256; _vm->_timers[3] = 35; - + while (!_vm->_sceneDone) { if (_vm->_timers[0] == 0) { // Update background animations (clouds etc.) @@ -503,7 +503,7 @@ void Scene49::run() { } _vm->gameUpdateTick(); } - _vm->stopSound(0xE2); + _vm->stopSound(0xE2); } void Scene49::updateAnimations() { @@ -670,7 +670,7 @@ void Scene50::playTonguesIdle() { void Scene50::playRoundAnim(int roundNum) { int sequenceId = 0; - + switch (roundNum) { case 1: sequenceId = 0xAF; @@ -736,7 +736,7 @@ int Scene50::checkInput() { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _fightDone = true; } - + return sequenceId; } @@ -893,7 +893,7 @@ int Scene50::getRightTongueNextId() { void Scene50::playWinBadgeAnim(int tongueNum) { int sequenceId; - + if (tongueNum == 1) { if (_leftTongueRoundsWon == 1) sequenceId = 0xC3; @@ -983,7 +983,7 @@ void Scene50::run() { } // freeFont(); - + _vm->_gameSys->setAnimation(0, 0, 7); _vm->_gameSys->setAnimation(0, 0, 6); _vm->_gameSys->setAnimation(0, 0, 5); @@ -1243,10 +1243,10 @@ int Scene51::checkCollision(int sequenceId) { bool checkFl = false; for (int i = 0; i < 6; i++) checkFl |= _items[i]._isCollision; - + if (!checkFl) return false; - + if (isJumpingRight(sequenceId)) { v8 = getPosRight(sequenceId); v4 = getPosRight(sequenceId + 1); @@ -1565,7 +1565,7 @@ void Scene51::updateGuyAnimation() { _guyNextSequenceId = 0xC7; break; } - + _vm->_gameSys->insertSequence(_guyNextSequenceId, 39, _guySequenceId, 39, kSeqSyncWait, 0, 0, 0); _guySequenceId = _guyNextSequenceId; _guyNextSequenceId = -1; @@ -2203,7 +2203,7 @@ void Scene52::updateAlienRow(int rowNum) { void Scene52::moveDownAlienRow() { int v2[5], v3, v1, v0, v4; - + for (int i = 0; i < 5; ++i) v2[i] = _items[0][i]; @@ -2238,7 +2238,7 @@ void Scene52::moveDownAlienRow() { int Scene52::updateHitAlien() { int result = 0, rowNum, ya; - + int y = _shipCannonTopY - _shipCannonPosY; if (y == 26) { @@ -2262,7 +2262,7 @@ int Scene52::updateHitAlien() { result = 1; } } - + return result; } @@ -2309,7 +2309,7 @@ int Scene52::getHitAlienNum(int rowNum) { int Scene52::alienCannonHitShip(int cannonNum) { int result = 0; - + if (_aliensCount) { result = 0; } else { @@ -2332,7 +2332,7 @@ int Scene52::alienCannonHitShip(int cannonNum) { int Scene52::alienCannonHitShield(int cannonNum) { int result = 0; - + int v3 = _alienCannonPosY[cannonNum] + 39; if (_arcadeScreenBottom - 44 > v3) return 0; @@ -2361,7 +2361,7 @@ int Scene52::alienCannonHitShield(int cannonNum) { return 0; shieldNum = 2; } - + if (_shieldSpriteIds[shieldNum] == -1) { result = 0; } else { @@ -2383,7 +2383,7 @@ int Scene52::alienCannonHitShield(int cannonNum) { bool Scene52::shipCannonHitShield(int cannonNum) { bool result = false; - + if (_shipCannonPosX < _shieldPosX[0]) return result; @@ -2426,7 +2426,7 @@ bool Scene52::shipCannonHitShield(int cannonNum) { bool Scene52::shipCannonHitAlien() { bool result = false; - + if (_aliensCount || checkAlienRow(0)) return false; @@ -2621,7 +2621,7 @@ void Scene52::drawScore(int score) { void Scene52::run() { _vm->_timers[1] = 0; - + _vm->hideCursor(); // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000); @@ -2710,9 +2710,9 @@ void Scene52::run() { break; } } - + update(); - + if (clearKeyStatus()) { _alienWave = false; _vm->_gameSys->waitForUpdate(); diff --git a/engines/gnap/scenes/arcade.h b/engines/gnap/scenes/arcade.h index 4255a2d6b0..b99d26158f 100644 --- a/engines/gnap/scenes/arcade.h +++ b/engines/gnap/scenes/arcade.h @@ -225,7 +225,7 @@ private: int _shipPosX; int _shipCannonPosX, _shipCannonPosY; bool _shipCannonFiring; - bool _shipCannonFired; + bool _shipCannonFired; int _shipCannonWidth, _shipCannonHeight; int _shipCannonTopY; int _shipMidX, _shipMidY; diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 2ad6d88ba0..2255edaed3 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -68,7 +68,7 @@ void Scene01::updateHotspots() { void Scene01::run() { // NOTE Removed _s01_dword_474380 which was set when the mud was taken // which is also set in the global game flags. - + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); @@ -109,7 +109,7 @@ void Scene01::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - + case kHS01Device: if (_vm->_gnapActionStatus < 0) { _vm->runMenu(); @@ -277,12 +277,12 @@ void Scene01::run() { _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } -void Scene01::updateAnimations() { +void Scene01::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { @@ -399,9 +399,9 @@ void Scene02::run() { _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 30; _vm->_timers[4] = _vm->getRandom(100) + 300; - + _vm->queueInsertDeviceIcon(); - + switch (_vm->_prevSceneNum) { case 3: _vm->initGnapPos(11, 6, kDirBottomLeft); @@ -445,16 +445,16 @@ void Scene02::run() { _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); break; } - + while (!_vm->_sceneDone) { - _vm->updateMouseCursor(); + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 6, 7, 6, 8, 6); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS02Device: if (_vm->_gnapActionStatus < 0) { @@ -657,12 +657,12 @@ void Scene02::run() { } break; } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x1091C)) _vm->playSound(0x1091C, true); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->updatePlatypusIdleSequence(); @@ -687,15 +687,15 @@ void Scene02::run() { } _vm->playSoundC(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -807,7 +807,7 @@ void Scene02::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x150) { _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); @@ -874,24 +874,24 @@ void Scene03::updateHotspots() { void Scene03::run() { _vm->playSound(0x10925, true); _vm->startSoundTimerC(7); - + _vm->_gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); - + _platypusHypnotized = false; - + _vm->initGnapPos(3, 4, kDirBottomRight); - + _vm->_gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); - + _currFrogSequenceId = 0x1C6; _nextFrogSequenceId = -1; _vm->_gameSys->setAnimation(0x1C6, 253, 2); - + _vm->_timers[6] = _vm->getRandom(20) + 30; _vm->_timers[4] = _vm->getRandom(100) + 300; _vm->_timers[5] = _vm->getRandom(100) + 200; - + if (_vm->isFlag(kGFPlatypus)) { _vm->initPlatypusPos(5, 4, kDirNone); } else { @@ -901,27 +901,27 @@ void Scene03::run() { _vm->_platypusSequenceId = 0x1C2; _vm->_platypusSequenceDatNum = 0; } - + _vm->_gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); - + if (!_vm->isFlag(kGFGrassTaken)) _vm->_gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + _vm->endSceneInit(); - + if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(4, 7, -1, 0x107C2, 1); _vm->gnapWalkTo(3, 6, -1, 0x107B9, 1); - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS03Platypus: if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { @@ -1091,21 +1091,21 @@ void Scene03::run() { } } break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } break; - + } updateAnimations(); - + if (!_vm->isSoundPlaying(0x10925)) _vm->playSound(0x10925, true); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->updatePlatypusIdleSequence(); @@ -1140,9 +1140,9 @@ void Scene03::run() { } _vm->playSoundC(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -1151,7 +1151,7 @@ void Scene03::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; _vm->_timers[6] = _vm->getRandom(20) + 30; } - + _vm->gameUpdateTick(); } } @@ -1237,7 +1237,7 @@ void Scene03::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { _vm->_gameSys->setAnimation(0, 0, 1); @@ -1280,14 +1280,14 @@ void Scene03::updateAnimations() { _nextPlatSequenceId = -1; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { _vm->_gameSys->setAnimation(_nextFrogSequenceId, 253, 2); _vm->_gameSys->insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); _currFrogSequenceId = _nextFrogSequenceId; _nextFrogSequenceId = -1; } - + if (_vm->_gameSys->getAnimationStatus(5) == 2) { _vm->_gameSys->setAnimation(0, 0, 5); _vm->invAdd(kItemGrass); @@ -1342,7 +1342,7 @@ void Scene04::run() { _currDogSequenceId = 0x210; _nextDogSequenceId = -1; - + _vm->_gameSys->setAnimation(0x210, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _vm->_timers[6] = _vm->getRandom(20) + 60; @@ -1352,12 +1352,12 @@ void Scene04::run() { if (!_vm->isFlag(kGFPlatypusTalkingToAssistant) && _vm->_cursorValue == 4) _vm->_gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); - + if (!_vm->isFlag(kGFTwigTaken)) _vm->_gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + if (_vm->isFlag(kGFPlatyPussDisguised)) { _vm->_timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); @@ -1407,16 +1407,16 @@ void Scene04::run() { _vm->gnapWalkTo(9, 9, -1, 0x107BA, 1); } } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 4, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS04Device: if (_vm->_gnapActionStatus < 0) { @@ -1456,7 +1456,7 @@ void Scene04::run() { } } break; - + case kHS04Twig: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1480,7 +1480,7 @@ void Scene04::run() { } } break; - + case kHS04Axe: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1505,7 +1505,7 @@ void Scene04::run() { } } break; - + case kHS04Dog: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1537,7 +1537,7 @@ void Scene04::run() { } } break; - + case kHS04Door: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1568,7 +1568,7 @@ void Scene04::run() { } } break; - + case kHS04ExitTruck: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1582,7 +1582,7 @@ void Scene04::run() { _vm->_newSceneNum = 33; } break; - + case kHS04Window: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1612,7 +1612,7 @@ void Scene04::run() { } } break; - + case kHS04ExitBarn: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1626,27 +1626,27 @@ void Scene04::run() { _vm->_newSceneNum = 35; } break; - + case kHS04WalkArea1: case kHS04WalkArea2: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } break; - + } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x1091C)) _vm->playSound(0x1091C, true); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->platypusSub426234(); @@ -1672,15 +1672,15 @@ void Scene04::run() { } _vm->playSoundC(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -1778,7 +1778,7 @@ void Scene04::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2) { _vm->_gameSys->setAnimation(0, 0, 2); _vm->invAdd(kItemTwig); @@ -1786,7 +1786,7 @@ void Scene04::updateAnimations() { _vm->setFlag(kGFTwigTaken); updateHotspots(); } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_nextDogSequenceId == 0x201) { _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, @@ -1848,11 +1848,11 @@ void Scene05::updateHotspots() { void Scene05::run() { _vm->playSound(0x1091C, true); _vm->startSoundTimerC(7); - + _currChickenSequenceId = 0x142; _vm->_gameSys->setAnimation(0x142, 100, 3); _vm->_gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); - + _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(10) + 30; @@ -1860,9 +1860,9 @@ void Scene05::run() { if (_vm->isFlag(kGFBarnPadlockOpen)) _vm->_gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { _vm->initGnapPos(-1, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) @@ -1877,16 +1877,16 @@ void Scene05::run() { _vm->initPlatypusPos(7, 9, kDirNone); _vm->endSceneInit(); } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 12, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS05Device: if (_vm->_gnapActionStatus < 0) { @@ -2066,7 +2066,7 @@ void Scene05::run() { if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + case kHS05WalkArea3: // Nothing break; @@ -2077,14 +2077,14 @@ void Scene05::run() { _vm->_mouseClickState._left = false; } break; - + } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x1091C)) _vm->playSound(0x1091C, true); - + if (!_vm->_isLeavingScene) { if (_vm->isFlag(kGFPlatypus)) _vm->updatePlatypusIdleSequence(); @@ -2105,16 +2105,16 @@ void Scene05::run() { } _vm->playSoundC(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); _vm->_timers[5] = _vm->getRandom(20) + 30; } - + _vm->gameUpdateTick(); } } @@ -2178,7 +2178,7 @@ void Scene05::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { if (_vm->_platypusSequenceId == 0x146) { _vm->_platX = 4; @@ -2206,7 +2206,7 @@ void Scene05::updateAnimations() { _vm->_timers[1] = 300; } } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_nextChickenSequenceId == 0x14B) { _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); @@ -2258,7 +2258,7 @@ void Scene06::updateHotspots() { _vm->setHotspot(kHS06WalkArea4, 475, 469, 800, 505); _vm->setHotspot(kHS06WalkArea5, 0, 0, 800, 504); _vm->setDeviceHotspot(kHS06Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFGasTaken)) + if (_vm->isFlag(kGFGasTaken)) _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; if (_vm->_cursorValue == 4) { _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; @@ -2269,7 +2269,7 @@ void Scene06::updateHotspots() { void Scene06::run() { bool triedDeviceOnGas = false; - + _vm->startSoundTimerC(7); _horseTurnedBack = false; @@ -2285,28 +2285,28 @@ void Scene06::run() { _vm->_gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); else _vm->_gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); - + if (!_vm->isFlag(kGFGasTaken) && _vm->_cursorValue != 4) _vm->_gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + _vm->initGnapPos(5, 12, kDirBottomRight); _vm->initPlatypusPos(6, 12, kDirNone); _vm->endSceneInit(); - + _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 5, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS06Device: if (_vm->_gnapActionStatus < 0) { @@ -2314,7 +2314,7 @@ void Scene06::run() { updateHotspots(); } break; - + case kHS06Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { @@ -2474,7 +2474,7 @@ void Scene06::run() { } updateAnimations(); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0) _vm->updatePlatypusIdleSequence(); @@ -2504,15 +2504,15 @@ void Scene06::run() { } _vm->playSoundC(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -2555,7 +2555,7 @@ void Scene06::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { _vm->_gameSys->setAnimation(0, 0, 1); if (_vm->_platypusSequenceId == 0xFA) { @@ -2580,7 +2580,7 @@ void Scene06::updateAnimations() { _vm->_platypusActionStatus = 6; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { switch (_nextHorseSequenceId) { case 0xF2: @@ -2650,7 +2650,7 @@ void Scene07::run() { _vm->invRemove(kItemGas); _vm->invRemove(kItemNeedle); - + if (!_vm->isFlag(kGFPlatypus)) _vm->_gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); @@ -2761,7 +2761,7 @@ void Scene07::run() { case kHS07WalkArea2: _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + case kHS07WalkArea3: // Nothing break; @@ -2897,52 +2897,52 @@ void Scene08::run() { _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); - + _currDogSequenceId = 0x135; _nextDogSequenceId = 0x135; - + _vm->_gameSys->setAnimation(0x135, 100, 3); _vm->_gameSys->insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); - + _currManSequenceId = 0x140; _nextManSequenceId = -1; - + _vm->_gameSys->setAnimation(0x140, 100, 2); _vm->_gameSys->insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); - + _vm->_timers[4] = _vm->getRandom(50) + 75; - + if (!_vm->isFlag(kGFBarnPadlockOpen)) _vm->_gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); - + if (!_vm->isFlag(kGFTruckFilledWithGas)) _vm->_gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); - + if (!_vm->isFlag(kGFTruckKeysUsed)) _vm->_gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); - + _vm->initGnapPos(-1, 8, kDirBottomRight); _vm->initPlatypusPos(-1, 7, kDirNone); - + _vm->endSceneInit(); - + _vm->gnapWalkTo(1, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); - + _vm->_timers[5] = _vm->getRandom(40) + 50; - - while (!_vm->_sceneDone) { + + while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x10919)) _vm->playSound(0x10919, true); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS08Device: if (_vm->_gnapActionStatus < 0) { @@ -3156,7 +3156,7 @@ void Scene08::run() { } break; } - + updateAnimations(); if (!_vm->_isLeavingScene) { @@ -3185,9 +3185,9 @@ void Scene08::run() { } playRandomSound(5); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -3195,7 +3195,7 @@ void Scene08::run() { _vm->_timers[4] = _vm->getRandom(50) + 75; _vm->_timers[5] = _vm->getRandom(40) + 50; } - + _vm->gameUpdateTick(); } } @@ -3236,7 +3236,7 @@ void Scene08::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { _vm->_gameSys->setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { @@ -3249,14 +3249,14 @@ void Scene08::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { _vm->_gameSys->setAnimation(_nextManSequenceId, 100, 2); _vm->_gameSys->insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currManSequenceId = _nextManSequenceId; _nextManSequenceId = -1; } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_currDogSequenceId == 0x147) _vm->_platypusActionStatus = -1; @@ -3343,12 +3343,12 @@ void Scene09::updateHotspots() { _vm->_hotspotsCount = 8; } -void Scene09::run() { +void Scene09::run() { _vm->queueInsertDeviceIcon(); - + _vm->_gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); - + if (_vm->_prevSceneNum == 8) { _vm->initGnapPos(11, 8, kDirBottomLeft); _vm->initPlatypusPos(12, 7, kDirUnk4); @@ -3367,15 +3367,15 @@ void Scene09::run() { while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x10919)) _vm->playSound(0x10919, true); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS09Device: if (_vm->_gnapActionStatus < 0) { @@ -3454,9 +3454,9 @@ void Scene09::run() { } break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene && _vm->_gnapActionStatus != 1 && _vm->_gnapActionStatus != 2) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -3469,9 +3469,9 @@ void Scene09::run() { } playRandomSound(5); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -3479,7 +3479,7 @@ void Scene09::run() { _vm->_timers[4] = _vm->getRandom(150) + 50; _vm->_timers[5] = _vm->getRandom(40) + 50; } - + _vm->gameUpdateTick(); } } diff --git a/engines/gnap/scenes/group0.h b/engines/gnap/scenes/group0.h index b288512471..38ded681af 100644 --- a/engines/gnap/scenes/group0.h +++ b/engines/gnap/scenes/group0.h @@ -295,7 +295,7 @@ public: virtual void updateAnimationsCb() {} private: - bool _platypusHypnotized; + bool _platypusHypnotized; bool _platypusScared; int _nextPlatSequenceId; int _nextFrogSequenceId; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index d746eb54ff..90767500ed 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -57,16 +57,16 @@ void Scene10::updateHotspots() { void Scene10::run() { _currCookSequenceId = 0x103; - + _vm->_gameSys->setAnimation(0x103, 100, 2); _vm->_gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); - + _nextCookSequenceId = 0x106; if (!_vm->isFlag(kGFMudTaken)) _vm->_gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + if (_vm->_prevSceneNum == 9) { _vm->initGnapPos(11, 8, kDirBottomLeft); _vm->initPlatypusPos(12, 7, kDirUnk4); @@ -87,19 +87,19 @@ void Scene10::run() { while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1091E)) _vm->playSound(0x1091E, true); - + if (!_vm->isSoundPlaying(0x1091A)) _vm->playSound(0x1091A, true); - + _vm->updateMouseCursor(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->updateCursorByHotspot(); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS10Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { @@ -289,7 +289,7 @@ void Scene10::run() { updateHotspots(); } break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapActionIdle(0x10C); @@ -298,9 +298,9 @@ void Scene10::run() { } break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -324,15 +324,15 @@ void Scene10::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -349,7 +349,7 @@ void Scene10::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { _vm->_gameSys->setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { @@ -358,9 +358,9 @@ void Scene10::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextCookSequenceId != -1) { - + switch (_nextCookSequenceId) { case 0x109: _vm->_platX = 4; @@ -404,7 +404,7 @@ void Scene10::updateAnimations() { _currCookSequenceId = _nextCookSequenceId; break; } - + switch (_currCookSequenceId) { case 0x106: { // TODO: Refactor into a if + a switch @@ -516,13 +516,13 @@ void Scene11::updateHotspots() { void Scene11::run() { bool flag = true; - + _vm->_timers[7] = 50; _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; - + _currGoggleGuySequenceId = 0x1F9; _currHookGuySequenceId = 0x201; - + switch (_vm->_prevSceneNum) { case 13: _vm->initGnapPos(8, 5, kDirBottomLeft); @@ -544,41 +544,41 @@ void Scene11::run() { _vm->initPlatypusPos(6, 5, kDirUnk4); break; } - + _vm->queueInsertDeviceIcon(); - + _vm->_gameSys->insertSequence(_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); - + _nextHookGuySequenceId = -1; - + _vm->_gameSys->setAnimation(_currHookGuySequenceId, 120, 3); _vm->_gameSys->insertSequence(_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); - + _nextGoggleGuySequenceId = -1; - + _vm->_gameSys->setAnimation(_currGoggleGuySequenceId, 121, 2); - + _vm->_timers[5] = _vm->getRandom(100) + 75; _vm->_timers[4] = _vm->getRandom(40) + 20; _vm->_timers[6] = _vm->getRandom(100) + 100; _vm->endSceneInit(); - + if (_vm->_prevSceneNum == 12) { _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); - + while (!_vm->_sceneDone) { _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS11Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { @@ -718,18 +718,18 @@ void Scene11::run() { updateHotspots(); } break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } break; - + } updateAnimations(); - + if (!_vm->_isLeavingScene) { if (flag && !_vm->_timers[7]) { flag = false; @@ -786,9 +786,9 @@ void Scene11::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -796,7 +796,7 @@ void Scene11::run() { _vm->_timers[5] = _vm->getRandom(50) + 75; _vm->_timers[4] = _vm->getRandom(40) + 20; } - + _vm->gameUpdateTick(); } } @@ -867,7 +867,7 @@ void Scene11::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextGoggleGuySequenceId != -1) { _vm->_timers[5] = _vm->getRandom(100) + 75; _vm->_gameSys->insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); @@ -877,7 +877,7 @@ void Scene11::updateAnimations() { if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4) _vm->_gnapActionStatus = -1; } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_nextHookGuySequenceId == 0x204) { _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); @@ -902,7 +902,7 @@ void Scene11::updateAnimations() { _vm->_gnapActionStatus = -1; } } - + if (_vm->_gameSys->getAnimationStatus(4) == 2) { _vm->_gameSys->setAnimation(0, 0, 4); _vm->_hotspots[kHS11Billard]._flags &= ~SF_DISABLED; @@ -946,29 +946,29 @@ void Scene12::run() { _vm->_gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); - + _currToothGuySequenceId = 0x200; _nextToothGuySequenceId = -1; - + _vm->_gameSys->setAnimation(0x200, 50, 2); _vm->_gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); - + _currBeardGuySequenceId = 0x202; _nextBeardGuySequenceId = -1; - + _vm->_gameSys->setAnimation(0x202, 50, 4); _vm->_gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); - + _currBarkeeperSequenceId = 0x203; _nextBarkeeperSequenceId = -1; - + _vm->_gameSys->setAnimation(0x203, 50, 3); - + _vm->_timers[4] = 30; _vm->_timers[6] = _vm->getRandom(30) + 20; _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_timers[7] = _vm->getRandom(100) + 100; - + if (_vm->_prevSceneNum == 15) { _vm->initGnapPos(5, 6, kDirBottomRight); _vm->initPlatypusPos(3, 7, kDirNone); @@ -983,14 +983,14 @@ void Scene12::run() { while (!_vm->_sceneDone) { _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); _vm->updateGrabCursorSprite(0, 0); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS12Device: if (_vm->_gnapActionStatus < 0) { @@ -1160,9 +1160,9 @@ void Scene12::run() { break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -1218,9 +1218,9 @@ void Scene12::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -1229,7 +1229,7 @@ void Scene12::run() { _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_timers[6] = _vm->getRandom(30) + 20; } - + _vm->gameUpdateTick(); } } @@ -1326,7 +1326,7 @@ void Scene12::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { _vm->_gameSys->setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { @@ -1338,7 +1338,7 @@ void Scene12::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(2) == 2) { if (_currToothGuySequenceId == 0x1E9) { _vm->_gameSys->setAnimation(0, 0, 2); @@ -1381,7 +1381,7 @@ void Scene12::updateAnimations() { _vm->_platypusActionStatus = -1; } } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_vm->_gnapActionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { _vm->_gnapActionStatus = -1; @@ -1399,7 +1399,7 @@ void Scene12::updateAnimations() { _vm->_gnapActionStatus = -1; } } - + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextBeardGuySequenceId != -1) { _vm->_gameSys->insertSequence(_nextBeardGuySequenceId, 50, _currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); _vm->_gameSys->setAnimation(_nextBeardGuySequenceId, 50, 4); @@ -1465,9 +1465,9 @@ void Scene13::run() { int currSoundId = 0; _vm->queueInsertDeviceIcon(); - + _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - + if (_vm->_prevSceneNum == 14) { _vm->initGnapPos(6, 6, kDirBottomLeft); _vm->initPlatypusPos(9, 8, kDirNone); @@ -1484,15 +1484,15 @@ void Scene13::run() { while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1091A)) _vm->playSound(0x1091A, true); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS13Device: if (_vm->_gnapActionStatus < 0) { @@ -1663,7 +1663,7 @@ void Scene13::run() { case kHS13WalkArea1: // Nothing break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -1671,9 +1671,9 @@ void Scene13::run() { } break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); if (_vm->_platY == 5 || _vm->_platY == 6) @@ -1726,9 +1726,9 @@ void Scene13::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -1736,7 +1736,7 @@ void Scene13::run() { _vm->_timers[4] = _vm->getRandom(20) + 20; _vm->_timers[5] = _vm->getRandom(50) + 50; } - + _vm->gameUpdateTick(); } } @@ -1798,7 +1798,7 @@ void Scene13::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { _vm->_gameSys->setAnimation(0, 0, 1); _vm->_platypusActionStatus = -1; @@ -1831,12 +1831,12 @@ void Scene14::run() { _vm->_largeSprite = nullptr; _vm->queueInsertDeviceIcon(); - + if (!_vm->isFlag(kGFNeedleTaken)) _vm->_gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); - + _vm->endSceneInit(); - + if (!_vm->isFlag(kGFNeedleTaken) && _vm->invHas(kItemTongs)) _vm->_largeSprite = _vm->_gameSys->createSurface(1); @@ -1845,14 +1845,14 @@ void Scene14::run() { _vm->_gnapSequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } - - while (!_vm->_sceneDone) { + + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS14Device: if (_vm->_gnapActionStatus < 0) { @@ -1919,37 +1919,37 @@ void Scene14::run() { _vm->_mouseClickState._left = false; break; } - + updateAnimations(); _vm->checkGameKeys(); - + if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { _vm->_gameSys->insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } - + if (_vm->_largeSprite) _vm->deleteSurface(&_vm->_largeSprite); } -void Scene14::updateAnimations() { +void Scene14::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); _vm->_gameSys->setAnimation(0x10843, 301, 1); _vm->_gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); } - + if (_vm->_gameSys->getAnimationStatus(1) == 2) { _vm->_gameSys->setAnimation(0, 0, 1); _vm->_sceneDone = true; @@ -2008,23 +2008,23 @@ void Scene15::run() { _vm->_gameSys->setAnimation(0xD5, 1, 0); _vm->_gameSys->insertSequence(_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + _vm->endSceneInit(); - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->_hotspots[kHS15Platypus]._x1 = 0; _vm->_hotspots[kHS15Platypus]._y1 = 0; _vm->_hotspots[kHS15Platypus]._x2 = 0; _vm->_hotspots[kHS15Platypus]._y2 = 0; - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS15Device: if (_vm->_gnapActionStatus < 0) { @@ -2145,21 +2145,21 @@ void Scene15::run() { break; } - + updateAnimations(); _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } -void Scene15::updateAnimations() { +void Scene15::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { if (_vm->_isLeavingScene) { _vm->_sceneDone = true; @@ -2491,7 +2491,7 @@ void Scene17::run() { _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS17Device: if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == 3) { @@ -2565,7 +2565,7 @@ void Scene17::run() { } } break; - + case kHS17Phone1: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { @@ -2650,7 +2650,7 @@ void Scene17::run() { } } break; - + case kHS17ExitToyStore: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -2662,7 +2662,7 @@ void Scene17::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); } break; - + case kHS17ExitGrubCity: if (_vm->_gnapActionStatus < 0) { platHangUpPhone(); @@ -2674,14 +2674,14 @@ void Scene17::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); } break; - + case kHS17WalkArea1: case kHS17WalkArea2: case kHS17WalkArea3: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -2689,12 +2689,12 @@ void Scene17::run() { } break; } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x10940)) _vm->playSound(0x10940, true); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0) _vm->platypusSub426234(); @@ -2777,15 +2777,15 @@ void Scene17::run() { } _vm->playSoundA(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -3126,11 +3126,11 @@ void Scene18::updateHotspots() { void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { // CHECKME: (x, y) is always set to (-1, -1) - // TODO Cleanup + // TODO Cleanup static const int kSequenceIds[] = { 0x203, 0x204 }; - + int gnapSeqId, gnapId, gnapDatNum, gnapGridX; int clippedX, v12, v5, v10, v11, direction; @@ -3152,7 +3152,7 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, v12 = _vm->_gridMaxX - 1; if (_vm->_gridMaxX - 1 >= v11) v12 = v11; - + if (v12 == _vm->_gnapX) { gnapSeqId = _vm->_gnapSequenceId; gnapId = _vm->_gnapId; @@ -3195,7 +3195,7 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, gnapGridX += direction; } while (v12 != gnapGridX); } - + if (argC >= 0) { _vm->_gnapSequenceId = ridToEntryIndex(argC); _vm->_gnapSequenceDatNum = ridToDatIndex(argC); @@ -3206,17 +3206,17 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, _vm->_gnapSequenceId = 0x209; _vm->_gnapSequenceDatNum = 0; } - + if (direction == 1) _vm->_gnapIdleFacing = kDirBottomRight; else _vm->_gnapIdleFacing = kDirBottomLeft; - + _vm->_gnapId = 20 * _vm->_gnapY + 1; - + if (animationIndex >= 0) _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); - + _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); @@ -3311,13 +3311,13 @@ void Scene18::run() { _vm->playSound(0x10940, true); _vm->startSoundTimerA(4); - + _vm->_timers[5] = _vm->getRandom(100) + 100; - + _vm->queueInsertDeviceIcon(); - + _vm->clearFlag(kGFPlatyPussDisguised); - + if (!_vm->isFlag(kGFUnk14)) _vm->_gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); @@ -3341,7 +3341,7 @@ void Scene18::run() { _vm->playSound(0x22B, true); } } - + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { if (_vm->_prevSceneNum == 17) _vm->initGnapPos(4, 11, kDirBottomRight); @@ -3398,12 +3398,12 @@ void Scene18::run() { while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 20, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS18Device: if (_vm->_gnapActionStatus < 0) { @@ -3708,18 +3708,18 @@ void Scene18::run() { } break; } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x10940)) _vm->playSound(0x10940, true); - + if ((_vm->isFlag(kGFTruckFilledWithGas) || _vm->isFlag(kGFBarnPadlockOpen)) && !_vm->isSoundPlaying(0x22B) && _vm->_gnapActionStatus != kAS18OpenRightValveNoGarbageCanDone && _vm->_gnapActionStatus != kAS18OpenRightValveNoGarbageCan && _vm->_gnapActionStatus != kAS18OpenTopValve && _vm->_gnapActionStatus != kAS18OpenTopValveDone && _vm->_gnapActionStatus != kAS18OpenRightValveWithGarbageCan && _vm->_gnapActionStatus != kAS18OpenRightValveWithGarbageCanDone) _vm->playSound(0x22B, true); - + if (!_vm->_isLeavingScene) { if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { if (_vm->_platypusActionStatus == kAS18PlatComesHere) { @@ -3751,15 +3751,15 @@ void Scene18::run() { if (!_vm->isFlag(kGFPlatyPussDisguised)) _vm->updateGnapIdleSequence(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } @@ -3994,7 +3994,7 @@ void Scene18::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { _vm->_gameSys->setAnimation(0, 0, 3); ++_platPhoneIter; @@ -4101,7 +4101,7 @@ void Scene19::run() { _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); @@ -4274,7 +4274,7 @@ void Scene19::run() { } updateAnimations(); - + if (!_vm->_isLeavingScene) { _vm->updateGnapIdleSequence(); if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { @@ -4293,13 +4293,13 @@ void Scene19::run() { } _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } diff --git a/engines/gnap/scenes/group1.h b/engines/gnap/scenes/group1.h index a1f86e249e..2a9fe8c738 100644 --- a/engines/gnap/scenes/group1.h +++ b/engines/gnap/scenes/group1.h @@ -373,7 +373,7 @@ private: int _nextUpperButtonSequenceId; int _currUpperButtonSequenceId; int _nextLowerButtonSequenceId; - int _currLowerButtonSequenceId; + int _currLowerButtonSequenceId; }; class Scene17: public Scene { diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 293d58ce05..98b6752afe 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -173,26 +173,26 @@ void Scene20::run() { _currStonerGuySequenceId = 0x173; break; } - + _nextStonerGuySequenceId = -1; _vm->_gameSys->setAnimation(_currStonerGuySequenceId, 21, 2); _vm->_gameSys->insertSequence(_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - + _vm->_timers[6] = _vm->getRandom(20) + 30; - + _currGroceryStoreGuySequenceId = 0x17C; _nextGroceryStoreGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x17C, 20, 3); + _vm->_gameSys->setAnimation(0x17C, 20, 3); _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); - + _vm->_timers[5] = _vm->getRandom(50) + 130; if (_vm->isFlag(kGFGroceryStoreHatTaken)) _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); else _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + if (_vm->isFlag(kGFSceneFlag1)) { _vm->clearFlag(kGFSceneFlag1); _vm->endSceneInit(); @@ -247,17 +247,17 @@ void Scene20::run() { break; } } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); _vm->testWalk(0, 1, 7, 9, 8, 9); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS20Device: if (_vm->_gnapActionStatus < 0) { @@ -304,7 +304,7 @@ void Scene20::run() { _vm->_platypusFacing = kDirUnk4; } break; - + case kHS20ExitPhone: if (_vm->_gnapActionStatus < 0) { if (_stonerGuyShowingJoint) @@ -316,7 +316,7 @@ void Scene20::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x + 1, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, -1, 0x107C2, 1); } break; - + case kHS20ExitOutsideToyStore: if (_vm->_gnapActionStatus < 0) { if (_stonerGuyShowingJoint) @@ -330,7 +330,7 @@ void Scene20::run() { _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; } break; - + case kHS20ExitInsideGrubCity: if (_vm->_gnapActionStatus < 0) { if (_stonerGuyShowingJoint) @@ -343,7 +343,7 @@ void Scene20::run() { _vm->_platypusFacing = kDirUnk4; } break; - + case kHS20ExitOutsideCircusWorld: if (_vm->_gnapActionStatus < 0) { if (_stonerGuyShowingJoint) @@ -355,7 +355,7 @@ void Scene20::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, -1, 0x107C2, 1); } break; - + case kHS20StonerGuy: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -388,7 +388,7 @@ void Scene20::run() { } } break; - + case kHS20GroceryStoreGuy: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -416,7 +416,7 @@ void Scene20::run() { } } break; - + case kHS20GroceryStoreHat: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { @@ -444,26 +444,26 @@ void Scene20::run() { } } break; - + case kHS20WalkArea1: case kHS20WalkArea2: _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } break; - + } updateAnimations(); if (!_vm->isSoundPlaying(0x10940)) _vm->playSound(0x10940, true); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0) { _vm->_hotspots[kHS20WalkArea1]._y2 += 48; @@ -497,9 +497,9 @@ void Scene20::run() { } _vm->playSoundA(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -628,7 +628,7 @@ void Scene20::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { switch (_nextGroceryStoreGuySequenceId) { case 0x176: @@ -730,11 +730,11 @@ void Scene21::updateHotspots() { void Scene21::run() { _vm->playSound(0x10940, true); _vm->startSoundTimerA(6); - + _vm->_timers[5] = _vm->getRandom(100) + 100; - + _vm->queueInsertDeviceIcon(); - + if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { _vm->initGnapPos(5, 8, kDirBottomRight); @@ -765,14 +765,14 @@ void Scene21::run() { _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS21Device: if (_vm->_gnapActionStatus < 0) { @@ -862,7 +862,7 @@ void Scene21::run() { } } break; - + case kHS21ExitOutsideGrubCity: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -872,26 +872,26 @@ void Scene21::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, -1, 0x107C2, 1); } break; - + case kHS21WalkArea1: case kHS21WalkArea2: _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } break; - + } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x10940)) _vm->playSound(0x10940, true); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -915,15 +915,15 @@ void Scene21::run() { } _vm->playSoundA(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -970,7 +970,7 @@ void Scene21::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextOldLadySequenceId != -1) { if (_nextOldLadySequenceId == 0x87) { _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); @@ -1020,17 +1020,17 @@ void Scene22::updateHotspots() { void Scene22::run() { _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); - + _currCashierSequenceId = 0x59; _nextCashierSequenceId = -1; - + _vm->_gameSys->setAnimation(0x59, 1, 3); _vm->_gameSys->insertSequence(_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + _vm->_timers[6] = _vm->getRandom(30) + 20; - + _vm->queueInsertDeviceIcon(); - + if (_vm->_prevSceneNum == 20) { _vm->initGnapPos(2, 8, kDirBottomRight); _vm->initPlatypusPos(1, 8, kDirNone); @@ -1042,7 +1042,7 @@ void Scene22::run() { _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); } - + if (_vm->isFlag(kGFSceneFlag1)) { int storeDetectiveSeqId; _vm->setGrabCursorSprite(-1); @@ -1075,16 +1075,16 @@ void Scene22::run() { _vm->_newSceneNum = 20; _caughtBefore = true; } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS22Device: if (_vm->_gnapActionStatus < 0) { @@ -1138,7 +1138,7 @@ void Scene22::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, -1, 0x107C2, 1); } break; - + case kHS22Cashier: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1164,12 +1164,12 @@ void Scene22::run() { } } break; - + case kHS22WalkArea1: case kHS22WalkArea2: _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -1177,9 +1177,9 @@ void Scene22::run() { } break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -1206,9 +1206,9 @@ void Scene22::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -1218,7 +1218,7 @@ void Scene22::run() { _vm->_timers[1] = _vm->getRandom(20) + 30; _vm->_timers[0] = _vm->getRandom(75) + 75; } - + _vm->gameUpdateTick(); } } @@ -1236,7 +1236,7 @@ void Scene22::updateAnimations() { } _vm->_gnapActionStatus = -1; } - + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { _vm->_gameSys->setAnimation(_nextCashierSequenceId, 1, 3); _vm->_gameSys->insertSequence(_nextCashierSequenceId, 1, _currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); @@ -1269,21 +1269,21 @@ void Scene23::updateHotspots() { void Scene23::run() { _vm->_timers[4] = _vm->getRandom(100) + 200; _vm->_timers[5] = _vm->getRandom(100) + 200; - + _currStoreClerkSequenceId = 0xB4; _nextStoreClerkSequenceId = -1; - + _vm->_gameSys->setAnimation(0xB4, 1, 4); _vm->_gameSys->insertSequence(_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + _vm->queueInsertDeviceIcon(); - + _vm->initGnapPos(-1, 7, kDirBottomRight); _vm->initPlatypusPos(-2, 7, kDirNone); _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - + _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); if (_vm->isFlag(kGFUnk24)) { @@ -1295,16 +1295,16 @@ void Scene23::run() { _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); _vm->setFlag(kGFUnk24); } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 3, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS23Device: if (_vm->_gnapActionStatus < 0) { @@ -1312,7 +1312,7 @@ void Scene23::run() { updateHotspots(); } break; - + case kHS23Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { @@ -1338,7 +1338,7 @@ void Scene23::run() { } } break; - + case kHS23Cereals: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1374,7 +1374,7 @@ void Scene23::run() { } } break; - + case kHS23ExitFrontGrubCity: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1384,13 +1384,13 @@ void Scene23::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y - 1, -1, 0x107C2, 1); } break; - + case kHS23WalkArea1: case kHS23WalkArea2: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -1398,9 +1398,9 @@ void Scene23::run() { } break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -1434,15 +1434,15 @@ void Scene23::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -1472,7 +1472,7 @@ void Scene23::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextStoreClerkSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: @@ -1522,31 +1522,31 @@ void Scene24::updateHotspots() { void Scene24::run() { int counter = 0; - + _vm->playSound(0x10940, true); _vm->startSoundTimerA(9); - + _vm->_timers[7] = _vm->getRandom(100) + 100; - + _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); - + _vm->_timers[4] = _vm->getRandom(20) + 50; _vm->_timers[5] = _vm->getRandom(20) + 40; _vm->_timers[6] = _vm->getRandom(50) + 30; - + _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); - + _currWomanSequenceId = 0x35; _girlSequenceId = 0x36; _boySequenceId = 0x30; - + if (_vm->_debugLevel == 4) _vm->startIdleTimer(8); - + _vm->queueInsertDeviceIcon(); - + if (_vm->_prevSceneNum == 20) { _vm->initGnapPos(1, 8, kDirBottomRight); _vm->initPlatypusPos(2, 8, kDirNone); @@ -1560,16 +1560,16 @@ void Scene24::run() { _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS24Device: @@ -1578,7 +1578,7 @@ void Scene24::run() { updateHotspots(); } break; - + case kHS24Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { @@ -1604,7 +1604,7 @@ void Scene24::run() { } } break; - + case kHS24ExitCircusWorld: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1614,7 +1614,7 @@ void Scene24::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, -1, 0x107C2, 1); } break; - + case kHS24ExitOutsideGrubCity: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1625,14 +1625,14 @@ void Scene24::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); } break; - + case kHS24WalkArea1: case kHS24WalkArea2: case kHS24WalkArea3: if (_vm->_gnapActionStatus == -1) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -1640,12 +1640,12 @@ void Scene24::run() { } break; } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x10940)) _vm->playSound(0x10940, true); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -1694,9 +1694,9 @@ void Scene24::run() { _vm->updateIdleTimer(); _vm->playSoundA(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -1780,16 +1780,16 @@ void Scene25::playAnims(int index) { void Scene25::run() { _vm->playSound(0x10940, true); _vm->startSoundTimerA(5); - + _currTicketVendorSequenceId = 0x52; _vm->_gameSys->setAnimation(0x52, 39, 3); _vm->_gameSys->insertSequence(_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); - + _nextTicketVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 20; - + _vm->queueInsertDeviceIcon(); - + if (_vm->_prevSceneNum == 24) { _vm->initGnapPos(5, 11, kDirUpLeft); _vm->initPlatypusPos(6, 11, kDirUnk4); @@ -1803,14 +1803,14 @@ void Scene25::run() { _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS25Device: if (_vm->_gnapActionStatus < 0) { @@ -1818,7 +1818,7 @@ void Scene25::run() { updateHotspots(); } break; - + case kHS25Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { @@ -1844,7 +1844,7 @@ void Scene25::run() { } } break; - + case kHS25TicketVendor: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { @@ -1875,7 +1875,7 @@ void Scene25::run() { } } break; - + case kHS25ExitOutsideCircusWorld: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1885,7 +1885,7 @@ void Scene25::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, -1, 0x107C2, 1); } break; - + case kHS25ExitInsideCircusWorld: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFNeedleTaken)) { @@ -1904,7 +1904,7 @@ void Scene25::run() { } } break; - + case kHS25Posters1: case kHS25Posters2: case kHS25Posters3: @@ -1934,13 +1934,13 @@ void Scene25::run() { } } break; - + case kHS25WalkArea1: case kHS25WalkArea2: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -1948,9 +1948,9 @@ void Scene25::run() { } break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); @@ -1991,15 +1991,15 @@ void Scene25::run() { } _vm->playSoundA(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -2045,7 +2045,7 @@ void Scene25::updateAnimations() { break; } } - + if (_vm->_gameSys->getAnimationStatus(3) == 2) { if (_nextTicketVendorSequenceId == 0x53) { _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); @@ -2104,7 +2104,7 @@ void Scene26::run() { _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); - + if (_vm->_prevSceneNum == 25) { _vm->initGnapPos(-1, 8, kDirBottomRight); _vm->initPlatypusPos(-2, 8, kDirNone); @@ -2208,7 +2208,7 @@ void Scene26::run() { if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -2244,13 +2244,13 @@ void Scene26::run() { } _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -2310,10 +2310,10 @@ void Scene27::run() { _vm->startIdleTimer(6); _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); - + _currJanitorSequenceId = 0xCB; _nextJanitorSequenceId = -1; - + _vm->_gameSys->setAnimation(0xCB, 39, 3); _vm->_timers[5] = _vm->getRandom(20) + 60; @@ -2489,16 +2489,16 @@ void Scene27::run() { if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } break; - + } - + updateAnimations(); if (!_vm->isSoundPlaying(0x1093B)) @@ -2869,7 +2869,7 @@ void Scene28::run() { if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -2900,7 +2900,7 @@ void Scene28::run() { _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -3083,7 +3083,7 @@ void Scene29::run() { _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gameSys->setAnimation(0, 0, 3); } - + _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); @@ -3104,10 +3104,10 @@ void Scene29::run() { while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS29Device: if (_vm->_gnapActionStatus < 0) { @@ -3220,7 +3220,7 @@ void Scene29::run() { if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -3228,7 +3228,7 @@ void Scene29::run() { } break; } - + updateAnimations(); if (!_vm->isSoundPlaying(0x1093B)) @@ -3265,7 +3265,7 @@ void Scene29::run() { } _vm->playSoundB(); } - + _vm->checkGameKeys(); if (_vm->isKeyStatus1(8)) { @@ -3273,7 +3273,7 @@ void Scene29::run() { _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index a9b86b7344..6d31df8b8a 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -196,20 +196,20 @@ void Scene30::run() { } _vm->playSoundB(); } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } -void Scene30::updateAnimations() { +void Scene30::updateAnimations() { if (_vm->_gameSys->getAnimationStatus(0) == 2) { _vm->_gameSys->setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { @@ -474,12 +474,12 @@ void Scene31::run() { } break; } - + updateAnimations(); - + if (!_vm->isSoundPlaying(0x1093B)) _vm->playSound(0x1093B, true); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0) _vm->updatePlatypusIdleSequence(); @@ -523,7 +523,7 @@ void Scene31::run() { _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -1391,7 +1391,7 @@ void Scene39::updateHotspots() { void Scene39::run() { // Bug in the original? Timer was never initialized. _vm->_timers[5] = 0; - + _vm->queueInsertDeviceIcon(); _currGuySequenceId = 0x33; @@ -1409,16 +1409,16 @@ void Scene39::run() { _vm->initPlatypusPos(5, 7, kDirNone); _vm->endSceneInit(); } - + while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094B)) { _vm->playSound(0x1094B, true); _vm->setSoundVolume(0x1094B, 60); } - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); @@ -1430,7 +1430,7 @@ void Scene39::run() { updateHotspots(); _vm->_timers[5] = _vm->getRandom(20) + 50; break; - + case kHS39Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1454,7 +1454,7 @@ void Scene39::run() { } } break; - + case kHS39ExitUfoParty: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1464,7 +1464,7 @@ void Scene39::run() { _vm->_newSceneNum = 40; } break; - + case kHS39Sign: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1485,7 +1485,7 @@ void Scene39::run() { } } break; - + case kHS39ExitInsideHouse: if (_vm->_gnapActionStatus < 0) { _vm->_sceneDone = true; @@ -1493,13 +1493,13 @@ void Scene39::run() { _vm->_newSceneNum = 38; } break; - + case kHS39WalkArea1: case kHS39WalkArea2: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -1507,9 +1507,9 @@ void Scene39::run() { } break; } - + updateAnimations(); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0) _vm->updatePlatypusIdleSequence(); @@ -1533,16 +1533,16 @@ void Scene39::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); _vm->_timers[5] = _vm->getRandom(20) + 50; } - + _vm->gameUpdateTick(); } } @@ -1555,7 +1555,7 @@ void Scene39::updateAnimations() { else _vm->_gnapActionStatus = -1; } - + if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { _vm->_gameSys->setAnimation(_nextGuySequenceId, 21, 3); _vm->_gameSys->insertSequence(_nextGuySequenceId, 21, _currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 1550703e90..d84717e43b 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -61,18 +61,18 @@ void Scene40::run() { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case kHS40Device: _vm->runMenu(); updateHotspots(); break; - + case kHS40Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -96,72 +96,72 @@ void Scene40::run() { } } break; - + case kHS40ExitCave: if (_vm->_gnapActionStatus < 0) { _vm->_newSceneNum = 39; _vm->_sceneDone = true; } break; - + case kHS40ExitToyStand: if (_vm->_gnapActionStatus < 0) { _vm->_newSceneNum = 41; _vm->_sceneDone = true; } break; - + case kHS40ExitBBQ: if (_vm->_gnapActionStatus < 0) { _vm->_newSceneNum = 42; _vm->_sceneDone = true; } break; - + case kHS40ExitUfo: if (_vm->_gnapActionStatus < 0) { _vm->_newSceneNum = 43; _vm->_sceneDone = true; } break; - + case kHS40ExitKissinBooth: if (_vm->_gnapActionStatus < 0) { _vm->_newSceneNum = 44; _vm->_sceneDone = true; } break; - + case kHS40ExitDancefloor: if (_vm->_gnapActionStatus < 0) { _vm->_newSceneNum = 45; _vm->_sceneDone = true; } break; - + case kHS40ExitShoe: if (_vm->_gnapActionStatus < 0) { _vm->_newSceneNum = 46; _vm->_sceneDone = true; } break; - + default: if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) _vm->_mouseClickState._left = false; break; - + } - + updateAnimations(); _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -244,24 +244,24 @@ void Scene41::run() { gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); gameSys.insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) _currKidSequenceId = 0x11B; else _currKidSequenceId = 0x11D; - + _nextKidSequenceId = -1; - + gameSys.setAnimation(_currKidSequenceId, 1, 4); gameSys.insertSequence(_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + _currToyVendorSequenceId = 0x118; _nextToyVendorSequenceId = -1; - + gameSys.setAnimation(0x118, 1, 3); gameSys.insertSequence(_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_gnapSequenceId = 0x120; _vm->_gnapSequenceDatNum = 0; @@ -297,22 +297,22 @@ void Scene41::run() { while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094B)) _vm->playSound(0x1094B, true); - + if (!_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_hotspots[kHS41ToyUfo]._x1 = _vm->_toyUfoX - 25; _vm->_hotspots[kHS41ToyUfo]._y1 = _vm->_toyUfoY - 20; _vm->_hotspots[kHS41ToyUfo]._x2 = _vm->_toyUfoX + 25; _vm->_hotspots[kHS41ToyUfo]._y2 = _vm->_toyUfoY + 20; } - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { switch (_vm->_sceneClickedHotspot) { case kHS41UfoExitLeft: @@ -323,7 +323,7 @@ void Scene41::run() { _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 2); } break; - + case kHS41UfoExitRight: if (_vm->_toyUfoActionStatus < 0) { _vm->_isLeavingScene = true; @@ -332,7 +332,7 @@ void Scene41::run() { _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 2); } break; - + case kHS41UfoDevice: _vm->runMenu(); updateHotspots(); @@ -348,7 +348,7 @@ void Scene41::run() { _vm->_timers[4] = _vm->getRandom(100) + 100; _vm->_timers[5] = _vm->getRandom(30) + 20; break; - + case kHS41Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -372,14 +372,14 @@ void Scene41::run() { } } break; - + case kHS41ExitCave: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitCave].x, _vm->_hotspotsWalkPos[kHS41ExitCave].y, 0, 0x107AE, 1); _vm->_gnapActionStatus = kAS41LeaveScene; _vm->_newSceneNum = 40; break; - + case kHS41Exit: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, 0, 0x107AF, 1); @@ -387,7 +387,7 @@ void Scene41::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, -1, 0x107CF, 1); _vm->_newSceneNum = 45; break; - + case kHS41ExitBBQ: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, 0, 0x107AB, 1); @@ -395,7 +395,7 @@ void Scene41::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, -1, 0x107CD, 1); _vm->_newSceneNum = 42; break; - + case kHS41ToyVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->_gnapActionStatus = kAS41UseQuarterWithToyVendor; @@ -422,7 +422,7 @@ void Scene41::run() { } } break; - + case kHS41Kid: if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); @@ -450,7 +450,7 @@ void Scene41::run() { } } break; - + case kHS41ToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { _vm->playGnapPullOutDevice(9, 0); @@ -458,14 +458,14 @@ void Scene41::run() { _vm->_gnapActionStatus = kAS41UseGumWithToyUfo; } break; - + case kHS41WalkArea1: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { if (!_vm->_timers[9] && _vm->_gnapActionStatus < 0) { _vm->_gnapActionStatus = kAS41GiveBackToyUfo; @@ -477,7 +477,7 @@ void Scene41::run() { } } } - + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { @@ -509,7 +509,7 @@ void Scene41::run() { } updateAnimations(); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0) _vm->updatePlatypusIdleSequence(); @@ -545,9 +545,9 @@ void Scene41::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); @@ -660,7 +660,7 @@ void Scene41::updateAnimations() { break; } } - + if (gameSys.getAnimationStatus(2) == 2) { switch (_vm->_toyUfoActionStatus) { case kAS41ToyUfoLeaveScene: @@ -685,7 +685,7 @@ void Scene41::updateAnimations() { } _vm->_toyUfoActionStatus = -1; } - + if (gameSys.getAnimationStatus(3) == 2 && _nextToyVendorSequenceId != -1) { gameSys.insertSequence(_nextToyVendorSequenceId, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); @@ -693,7 +693,7 @@ void Scene41::updateAnimations() { _nextToyVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; } - + if (gameSys.getAnimationStatus(4) == 2 && _nextKidSequenceId != -1) { gameSys.insertSequence(_nextKidSequenceId, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextKidSequenceId, 1, 4); @@ -1193,7 +1193,7 @@ void Scene43::updateHotspots() { _vm->setHotspot(kHS43WalkArea1, 0, 0, 800, 445); _vm->setHotspot(kHS43WalkArea2, 465, 0, 800, 493); _vm->setDeviceHotspot(kHS43Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFUnk14)) + if (_vm->isFlag(kGFUnk14)) _vm->_hotspots[kHS43Key]._flags = SF_DISABLED; _vm->_hotspotsCount = 10; } @@ -1206,13 +1206,13 @@ void Scene43::run() { if (!_vm->isFlag(kGFUnk14)) gameSys.insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); - + _currTwoHeadedGuySequenceId = 0x13C; _nextTwoHeadedGuySequenceId = -1; - + gameSys.setAnimation(0x13C, 1, 2); gameSys.insertSequence(_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; _vm->_toyUfoActionStatus = -1; @@ -1256,19 +1256,19 @@ void Scene43::run() { break; } } - + while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094B)) _vm->playSound(0x1094B, true); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { switch (_vm->_sceneClickedHotspot) { case kHS43UfoDevice: @@ -1276,7 +1276,7 @@ void Scene43::run() { updateHotspots(); _vm->_timers[4] = _vm->getRandom(100) + 100; break; - + case kHS43UfoExitLeft: if (_vm->_toyUfoActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1285,7 +1285,7 @@ void Scene43::run() { _vm->toyUfoFlyTo(-35, -1, -35, 799, 0, 300, 3); } break; - + case kHS43UfoExitRight: if (_vm->_toyUfoActionStatus < 0) { _vm->_isLeavingScene = true; @@ -1294,7 +1294,7 @@ void Scene43::run() { _vm->toyUfoFlyTo(835, -1, 0, 835, 0, 300, 3); } break; - + case kHS43UfoKey: if (_vm->isFlag(kGFJointTaken)) { _vm->_toyUfoActionStatus = 6; @@ -1304,7 +1304,7 @@ void Scene43::run() { _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } break; - + case kHS43UfoBucket: _vm->_toyUfoActionStatus = 7; _vm->toyUfoFlyTo(497, 143, 0, 799, 0, 300, 3); @@ -1417,7 +1417,7 @@ void Scene43::run() { break; } } - + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO) && (_vm->_toyUfoActionStatus == 5 || _vm->_toyUfoActionStatus == -1)) { @@ -1427,11 +1427,11 @@ void Scene43::run() { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - + updateAnimations(); - + _vm->toyUfoCheckTimer(); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updatePlatypusIdleSequence(); @@ -1462,19 +1462,19 @@ void Scene43::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(100) + 100; } - + _vm->gameUpdateTick(); } - + if (_vm->_newSceneNum == 54) _vm->clearFlag(kGFGnapControlsToyUFO); } @@ -1513,7 +1513,7 @@ void Scene43::updateAnimations() { break; } } - + if (gameSys.getAnimationStatus(2) == 2) { if (_currTwoHeadedGuySequenceId == 0x13A) { if (_vm->isFlag(kGFGroceryStoreHatTaken)) { @@ -1536,7 +1536,7 @@ void Scene43::updateAnimations() { _vm->_timers[4] = _vm->getRandom(100) + 100; } } - + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case 4: @@ -1644,7 +1644,7 @@ void Scene44::run() { _currSpringGuySequenceId = 0xF8; else _currSpringGuySequenceId = 0xF9; - + _nextSpringGuySequenceId = -1; gameSys.setAnimation(_currSpringGuySequenceId, 1, 4); gameSys.insertSequence(_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); @@ -1664,9 +1664,9 @@ void Scene44::run() { _nextKissingLadySequenceId = -1; gameSys.setAnimation(0xEC, 1, 2); } - + gameSys.insertSequence(_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; _vm->_toyUfoActionStatus = -1; @@ -1721,19 +1721,19 @@ void Scene44::run() { break; } } - + while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094B)) _vm->playSound(0x1094B, true); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { switch (_vm->_sceneClickedHotspot) { case kHS44UfoExitLeft: @@ -1767,7 +1767,7 @@ void Scene44::run() { updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 20; break; - + case kHS44Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1798,7 +1798,7 @@ void Scene44::run() { _vm->_gnapActionStatus = 0; _vm->_newSceneNum = 40; break; - + case kHS44ExitUfo: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnapY, 0, 0x107AF, 1); @@ -1806,14 +1806,14 @@ void Scene44::run() { _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_platY, -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; - + case kHS44ExitShow: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitShow].x, _vm->_hotspotsWalkPos[kHS44ExitShow].y, 0, 0x107AB, 1); _vm->_gnapActionStatus = 0; _vm->_newSceneNum = 46; break; - + case kHS44KissingLady: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnapActionStatus = 2; @@ -1843,7 +1843,7 @@ void Scene44::run() { } } break; - + case kHS44Spring: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); @@ -1869,7 +1869,7 @@ void Scene44::run() { } } break; - + case kHS44SpringGuy: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); @@ -1892,16 +1892,16 @@ void Scene44::run() { } } break; - + case kHS44WalkArea1: case kHS44WalkArea2: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; - + } } - + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { @@ -1911,10 +1911,10 @@ void Scene44::run() { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - + updateAnimations(); _vm->toyUfoCheckTimer(); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) _vm->updatePlatypusIdleSequence(); @@ -1962,17 +1962,17 @@ void Scene44::run() { } } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 20; } - - _vm->gameUpdateTick(); + + _vm->gameUpdateTick(); } } @@ -1994,7 +1994,7 @@ void Scene44::updateAnimations() { } _vm->_gnapActionStatus = -1; } - + if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { @@ -2017,7 +2017,7 @@ void Scene44::updateAnimations() { break; } } - + if (gameSys.getAnimationStatus(2) == 2) { if (_nextKissingLadySequenceId == 0xF6) { gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); @@ -2033,7 +2033,7 @@ void Scene44::updateAnimations() { _vm->_timers[4] = _vm->getRandom(20) + 20; } } - + if (gameSys.getAnimationStatus(4) == 2) { if (_currSpringGuySequenceId == 0xFB) { _vm->setGrabCursorSprite(kItemSpring); @@ -2047,7 +2047,7 @@ void Scene44::updateAnimations() { _vm->_timers[5] = _vm->getRandom(20) + 20; } } - + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case 6: @@ -2119,7 +2119,7 @@ void Scene45::run() { if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); - + _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); @@ -2129,7 +2129,7 @@ void Scene45::run() { _currDancerSequenceId = 0x8F; gameSys.setAnimation(_currDancerSequenceId, 1, 2); gameSys.insertSequence(_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; _vm->_toyUfoActionStatus = -1; @@ -2170,7 +2170,7 @@ void Scene45::run() { _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); } - + if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->setFlag(kGFUnk21); _vm->setGrabCursorSprite(-1); @@ -2209,22 +2209,22 @@ void Scene45::run() { _vm->_gnapSequenceId = 0x7BD; _vm->_gnapSequenceDatNum = 1; } - + _vm->playPlatypusSequence(0x9A); gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); - + while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { switch (_vm->_sceneClickedHotspot) { case kHS45UfoExitLeft: @@ -2256,7 +2256,7 @@ void Scene45::run() { _vm->runMenu(); updateHotspots(); break; - + case kHS45Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2291,7 +2291,7 @@ void Scene45::run() { _vm->_newSceneNum = 40; } break; - + case kHS45ExitShoe: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -2301,7 +2301,7 @@ void Scene45::run() { _vm->_newSceneNum = 46; } break; - + case kHS45ExitRight: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; @@ -2342,7 +2342,7 @@ void Scene45::run() { } } break; - + case kHS45WalkArea1: if (_vm->_gnapActionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -2359,21 +2359,21 @@ void Scene45::run() { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - + updateAnimations(); _vm->toyUfoCheckTimer(); - + if (!_vm->_isLeavingScene && _vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } @@ -2403,7 +2403,7 @@ void Scene45::updateAnimations() { break; } } - + if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); if (_vm->getRandom(2) != 0) @@ -2412,7 +2412,7 @@ void Scene45::updateAnimations() { _vm->playPlatypusSequence(0x9C); gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); } - + if (gameSys.getAnimationStatus(2) == 2) { gameSys.setAnimation(0, 0, 2); int newSeqId = _vm->getRandom(7) + 0x8F; @@ -2420,14 +2420,14 @@ void Scene45::updateAnimations() { gameSys.setAnimation(newSeqId, 1, 2); _currDancerSequenceId = newSeqId; } - + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x96, 1, 3); gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x99, 1, 4); } - + if (gameSys.getAnimationStatus(5) == 2) { switch (_vm->_toyUfoActionStatus) { case 2: @@ -2492,17 +2492,17 @@ void Scene46::run() { _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); - + _currSackGuySequenceId = 0x4B; _nextSackGuySequenceId = -1; gameSys.setAnimation(0x4B, 1, 3); gameSys.insertSequence(_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + _currItchyGuySequenceId = 0x47; _nextItchyGuySequenceId = -1; gameSys.setAnimation(0x47, 1, 4); gameSys.insertSequence(_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; _vm->_toyUfoActionStatus = -1; @@ -2541,15 +2541,15 @@ void Scene46::run() { while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094B)) _vm->playSound(0x1094B, true); - + _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + if (_vm->isFlag(kGFGnapControlsToyUFO)) { switch (_vm->_sceneClickedHotspot) { case kHS46UfoExitLeft: @@ -2677,7 +2677,7 @@ void Scene46::run() { break; } } - + if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { @@ -2687,10 +2687,10 @@ void Scene46::run() { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } } - + updateAnimations(); _vm->toyUfoCheckTimer(); - + if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updatePlatypusIdleSequence(); @@ -2711,15 +2711,15 @@ void Scene46::run() { _nextSackGuySequenceId = 0x4C; } } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); updateHotspots(); } - + _vm->gameUpdateTick(); } } @@ -2742,7 +2742,7 @@ void Scene46::updateAnimations() { } _vm->_gnapActionStatus = -1; } - + if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { gameSys.insertSequence(_nextSackGuySequenceId, 1, _currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextSackGuySequenceId, 1, 3); @@ -2750,7 +2750,7 @@ void Scene46::updateAnimations() { _nextSackGuySequenceId = -1; _vm->_timers[5] = _vm->getRandom(50) + 80; } - + if (gameSys.getAnimationStatus(4) == 2 && _nextItchyGuySequenceId != -1) { gameSys.insertSequence(_nextItchyGuySequenceId, 1, _currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextItchyGuySequenceId, 1, 4); @@ -2758,7 +2758,7 @@ void Scene46::updateAnimations() { _nextItchyGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(50) + 80; } - + if (gameSys.getAnimationStatus(2) == 2) { switch (_vm->_toyUfoActionStatus) { case 3: diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 3bcab4cfc5..98b26ec8ec 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -62,7 +62,7 @@ void Scene53::updateHotspots() { int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { static const int kGnapHandSequenceIds[13] = { - 0x00, + 0x00, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x50, 0x51, 0x4F }; @@ -132,7 +132,7 @@ void Scene53::runRandomCall() { _vm->_gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); _callsMadeCtr = 0; } - + _vm->_gnapActionStatus = 1; while (_vm->_gameSys->getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); @@ -145,7 +145,7 @@ void Scene53::runRandomCall() { void Scene53::runChitChatLine() { bool flag = false; int sequenceId = -1; - + _vm->_gameSys->setAnimation(0x6E, 1, 6); _vm->_gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); @@ -164,17 +164,17 @@ void Scene53::runChitChatLine() { _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = 0x5E; } - + _vm->_hotspots[kHS53Device]._flags = SF_DISABLED; - + while (!flag) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case 2: sequenceId = 0x6F; @@ -208,7 +208,7 @@ void Scene53::runChitChatLine() { pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); break; } - + if (flag && sequenceId != -1) { _vm->stopSound(0xA0); pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); @@ -233,11 +233,11 @@ void Scene53::runChitChatLine() { _vm->_gnapActionStatus = -1; } } - + updateHotspots(); - + _vm->_gnapActionStatus = 1; - + if (_vm->isFlag(kGFSpringTaken)) { _vm->_gameSys->setAnimation(0x73, 40, 6); _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -254,9 +254,9 @@ void Scene53::runChitChatLine() { void Scene53::run() { int phoneNumber = 0; int phoneNumberLen = 0; - + _vm->queueInsertDeviceIcon(); - + if (_vm->isFlag(kGFSpringTaken)) { _currHandSequenceId = 0x45; _isGnapPhoning = true; @@ -264,21 +264,21 @@ void Scene53::run() { _currHandSequenceId = 0x5E; _isGnapPhoning = false; } - + _vm->_gameSys->insertSequence(_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->setVerbCursor(GRAB_CURSOR); _vm->playSound(0xA0, true); - + while (!_vm->_sceneDone) { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - + _vm->testWalk(0, 0, -1, -1, -1, -1); - + _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); - + switch (_vm->_sceneClickedHotspot) { case 1: if (_vm->_gnapActionStatus < 0) { @@ -319,7 +319,7 @@ void Scene53::run() { phoneNumberLen = 0; _vm->_sceneDone = true; _vm->_newSceneNum = 17; - } else if (phoneNumber != 5556789 || _vm->isFlag(kGFPictureTaken)) { + } else if (phoneNumber != 5556789 || _vm->isFlag(kGFPictureTaken)) { runRandomCall(); phoneNumber = 0; phoneNumberLen = 0; @@ -362,9 +362,9 @@ void Scene53::run() { } break; } - + _vm->checkGameKeys(); - + if (_vm->isKeyStatus1(8)) { _vm->clearKeyStatus1(8); _vm->runMenu(); diff --git a/engines/gnap/scenes/groupcs.cpp b/engines/gnap/scenes/groupcs.cpp index 92491a3847..c096eae27c 100644 --- a/engines/gnap/scenes/groupcs.cpp +++ b/engines/gnap/scenes/groupcs.cpp @@ -211,7 +211,7 @@ Scene477::Scene477(GnapEngine *vm) : CutScene(vm) {} int Scene477::init() { int v0, v4, v2, v3; - + _sequenceIdArr[0] = 0x316; _sequenceIdArr[1] = 0x31A; _sequenceIdArr[2] = 0x314; diff --git a/engines/gnap/sound.cpp b/engines/gnap/sound.cpp index 8fc216a880..a3e0e1c2d3 100644 --- a/engines/gnap/sound.cpp +++ b/engines/gnap/sound.cpp @@ -36,15 +36,15 @@ SoundMan::~SoundMan() { void SoundMan::playSound(int resourceId, bool looping) { SoundItem soundItem; soundItem._resourceId = resourceId; - + SoundResource *soundResource = _vm->_soundCache->get(resourceId); Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundResource->_data, soundResource->_size, DisposeAfterUse::NO); Audio::AudioStream *audioStream = Audio::makeLoopingAudioStream(Audio::makeWAVStream(stream, DisposeAfterUse::YES), looping ? 0 : 1); _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &soundItem._handle, audioStream); - + _items.push_back(soundItem); - + } void SoundMan::stopSound(int resourceId) { -- cgit v1.2.3 From 33b27b8db3b86fac77ef12a6cbda92050c5d3bd3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 30 Apr 2016 11:38:05 +0200 Subject: GNAP: Fix regression --- engines/gnap/scenes/arcade.cpp | 10 +++++----- engines/gnap/scenes/group4.cpp | 40 ++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index a857427f3d..f16fc6d2a7 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -62,7 +62,7 @@ Scene49::Scene49(GnapEngine *vm) : Scene(vm) { } int Scene49::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -158,9 +158,9 @@ void Scene49::checkObstacles() { } void Scene49::updateObstacle(int id) { - GameSys gameSys = *_vm->_gameSys; - Scene49Obstacle &obstacle = _obstacles[id]; + GameSys& gameSys = *_vm->_gameSys; + Scene49Obstacle &obstacle = _obstacles[id]; obstacle._currId = obstacle._prevId; switch (obstacle._laneNum) { @@ -283,7 +283,7 @@ void Scene49::clearObstacle(int index) { } void Scene49::run() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; bool animToggle6 = false; bool animToggle5 = false; @@ -507,7 +507,7 @@ void Scene49::run() { } void Scene49::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; for (int i = 0; i < 5; ++i) { if (gameSys.getAnimationStatus(i + 2) == 2) { diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index d84717e43b..c42119cb51 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -31,7 +31,7 @@ Scene40::Scene40(GnapEngine *vm) : Scene(vm) { } int Scene40::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -167,7 +167,7 @@ void Scene40::run() { } void Scene40::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -188,7 +188,7 @@ Scene41::Scene41(GnapEngine *vm) : Scene(vm) { } int Scene41::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -219,7 +219,7 @@ void Scene41::updateHotspots() { } void Scene41::run() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; _vm->queueInsertDeviceIcon(); @@ -560,7 +560,7 @@ void Scene41::run() { } void Scene41::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { @@ -715,7 +715,7 @@ Scene42::Scene42(GnapEngine *vm) : Scene(vm) { } int Scene42::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -750,7 +750,7 @@ void Scene42::updateHotspots() { } void Scene42::run() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; _vm->queueInsertDeviceIcon(); @@ -1024,7 +1024,7 @@ void Scene42::run() { } void Scene42::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { @@ -1160,7 +1160,7 @@ Scene43::Scene43(GnapEngine *vm) : Scene(vm) { } int Scene43::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -1200,7 +1200,7 @@ void Scene43::updateHotspots() { } void Scene43::run() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; _vm->queueInsertDeviceIcon(); @@ -1480,7 +1480,7 @@ void Scene43::run() { } void Scene43::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { @@ -1597,7 +1597,7 @@ Scene44::Scene44(GnapEngine *vm) : Scene(vm) { } int Scene44::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -1633,7 +1633,7 @@ void Scene44::updateHotspots() { } void Scene44::run() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; _vm->queueInsertDeviceIcon(); @@ -1977,7 +1977,7 @@ void Scene44::run() { } void Scene44::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -2074,7 +2074,7 @@ Scene45::Scene45(GnapEngine *vm) : Scene(vm) { } int Scene45::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -2115,7 +2115,7 @@ void Scene45::updateHotspots() { } void Scene45::run() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); @@ -2381,7 +2381,7 @@ void Scene45::run() { } void Scene45::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -2457,7 +2457,7 @@ Scene46::Scene46(GnapEngine *vm) : Scene(vm) { } int Scene46::init() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; gameSys.setAnimation(0, 0, 0); gameSys.setAnimation(0, 0, 1); @@ -2488,7 +2488,7 @@ void Scene46::updateHotspots() { } void Scene46::run() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); @@ -2725,7 +2725,7 @@ void Scene46::run() { } void Scene46::updateAnimations() { - GameSys gameSys = *_vm->_gameSys; + GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); -- cgit v1.2.3 From ce8e3281d4578d3f0833e8ce449fe6a9e6b4791e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 30 Apr 2016 13:37:57 +0200 Subject: GNAP: Reduce dereferencing of _gameSys --- engines/gnap/scenes/group0.cpp | 607 ++++++++++++++------------- engines/gnap/scenes/group1.cpp | 832 ++++++++++++++++++++------------------ engines/gnap/scenes/group2.cpp | 568 ++++++++++++++------------ engines/gnap/scenes/group3.cpp | 224 +++++----- engines/gnap/scenes/group5.cpp | 72 ++-- engines/gnap/scenes/intro.cpp | 27 +- engines/gnap/scenes/scenecore.cpp | 22 +- 7 files changed, 1258 insertions(+), 1094 deletions(-) diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 2255edaed3..68c962b999 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -38,8 +38,10 @@ Scene01::~Scene01() { } int Scene01::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 3); return 0x88; } @@ -68,20 +70,21 @@ void Scene01::updateHotspots() { void Scene01::run() { // NOTE Removed _s01_dword_474380 which was set when the mud was taken // which is also set in the global game flags. + GameSys& gameSys = *_vm->_gameSys; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); - _vm->_gameSys->setAnimation(134, 20, 4); - _vm->_gameSys->insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(134, 20, 4); + gameSys.insertSequence(134, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x7F, 40, 2); - _vm->_gameSys->insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x7F, 40, 2); + gameSys.insertSequence(0x7F, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(100) + 300; if (!_vm->isFlag(kGFMudTaken)) - _vm->_gameSys->insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(129, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -264,9 +267,9 @@ void Scene01::run() { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(1) == 0) - _vm->_gameSys->insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x84, 180, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x83, 180, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -283,20 +286,22 @@ void Scene01::run() { } void Scene01::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS01LookSpaceship: - _spaceshipSurface = _vm->_gameSys->createSurface(47); - _vm->_gameSys->insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); - _vm->_gameSys->setAnimation(133, 256, 0); - _vm->_gameSys->insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); + _spaceshipSurface = gameSys.createSurface(47); + gameSys.insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); + gameSys.setAnimation(133, 256, 0); + gameSys.insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = kAS01LookSpaceshipDone; break; case kAS01LookSpaceshipDone: - _vm->_gameSys->removeSequence(133, 256, true); - _vm->_gameSys->removeSpriteDrawItem(_spaceshipSurface, 255); + gameSys.removeSequence(133, 256, true); + gameSys.removeSpriteDrawItem(_spaceshipSurface, 255); _vm->deleteSurface(&_spaceshipSurface); _vm->_gnapActionStatus = -1; break; @@ -308,8 +313,8 @@ void Scene01::updateAnimations() { case kAS01TakeMud: _vm->playGnapPullOutDevice(2, 3); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(128, 40, 3); + gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(128, 40, 3); _vm->_gnapActionStatus = -1; break; @@ -323,32 +328,32 @@ void Scene01::updateAnimations() { case kAS01UsePigs: _vm->playGnapPullOutDevice(7, 2); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); + gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 3); + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0, 0, 3); _vm->invAdd(kItemMud); _vm->setGrabCursorSprite(kItemMud); _vm->setFlag(kGFMudTaken); updateHotspots(); } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { _smokeIdCtr = (_smokeIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x86, _smokeIdCtr + 20, 4); - _vm->_gameSys->insertSequence(0x86, _smokeIdCtr + 20, + gameSys.setAnimation(0x86, _smokeIdCtr + 20, 4); + gameSys.insertSequence(0x86, _smokeIdCtr + 20, 0x86, (_smokeIdCtr + 1) % 2 + 20, kSeqSyncWait, 0, 0, 0); } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { _pigsIdCtr = (_pigsIdCtr + 1) % 2; - _vm->_gameSys->setAnimation(0x7F, _pigsIdCtr + 40, 2); - _vm->_gameSys->insertSequence(0x7F, _pigsIdCtr + 40, + gameSys.setAnimation(0x7F, _pigsIdCtr + 40, 2); + gameSys.insertSequence(0x7F, _pigsIdCtr + 40, 0x7F, (_pigsIdCtr + 1) % 2 + 40, kSeqSyncWait, 0, 0, 0); } @@ -389,12 +394,14 @@ void Scene02::updateHotspots() { } void Scene02::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); _currChickenSequenceId = 0x14B; - _vm->_gameSys->setAnimation(0x14B, 179, 2); - _vm->_gameSys->insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x14B, 179, 2); + gameSys.insertSequence(0x14B, 179, 0, 0, kSeqNone, 0, 0, 0); _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -421,7 +428,7 @@ void Scene02::run() { if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(8, 6, 1, 0x107C2, 1); updateHotspots(); - _vm->_gameSys->waitForUpdate(); + gameSys.waitForUpdate(); break; case 47: _vm->clearFlag(kGFUnk25); @@ -672,9 +679,9 @@ void Scene02::run() { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x156, 256, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { if (_vm->getRandom(6) != 0) { @@ -701,18 +708,20 @@ void Scene02::run() { } void Scene02::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kAS02UseTruckNoKeys: - _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x14E, _vm->_gnapId, 0); + gameSys.insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x14E, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x14E; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS02UseTruckNoKeysDone; break; case kAS02UseGasWithTruck: - _vm->_gameSys->insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x151, _vm->_gnapId, 0); + gameSys.insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x151, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x151; _vm->_gnapSequenceDatNum = 0; _vm->invRemove(kItemGas); @@ -726,8 +735,8 @@ void Scene02::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->waitForUpdate(); + gameSys.insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); _vm->_gnapSequenceId = 0x14F; _vm->_gnapSequenceDatNum = 0; @@ -742,8 +751,8 @@ void Scene02::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->_timers[4] = 250; if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->waitForUpdate(); + gameSys.insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); _vm->_gnapSequenceId = 0x14F; _vm->_gnapSequenceDatNum = 0; @@ -767,8 +776,8 @@ void Scene02::updateAnimations() { break; } _truckGrillCtr = (_truckGrillCtr + 1) % 3; - _vm->_gameSys->insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); + gameSys.insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); _vm->_gnapSequenceId = _gnapTruckSequenceId; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; @@ -784,18 +793,18 @@ void Scene02::updateAnimations() { _vm->_timers[2] = 100; break; case kAS02GrabChickenDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _currChickenSequenceId = 0x14B; - _vm->_gameSys->setAnimation(0x14B, 179, 2); - _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x14B, 179, 2); + gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; _vm->_timers[5] = 30; break; case kAS02UseTwigWithChicken: _vm->playGnapShowItem(5, 0, 0); - _vm->_gameSys->insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _currChickenSequenceId = 0x155; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; @@ -808,24 +817,24 @@ void Scene02::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x150) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + gameSys.setAnimation(_nextChickenSequenceId, 179, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; _vm->_gnapActionStatus = kAS02GrabChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x14C) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; } @@ -843,9 +852,11 @@ Scene03::Scene03(GnapEngine *vm) : Scene(vm) { } int Scene03::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 5); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 5); return 0x1CC; } @@ -872,21 +883,22 @@ void Scene03::updateHotspots() { } void Scene03::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10925, true); _vm->startSoundTimerC(7); - _vm->_gameSys->insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x1CA, 251, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); _platypusHypnotized = false; - _vm->initGnapPos(3, 4, kDirBottomRight); - _vm->_gameSys->insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); _currFrogSequenceId = 0x1C6; _nextFrogSequenceId = -1; - _vm->_gameSys->setAnimation(0x1C6, 253, 2); + gameSys.setAnimation(0x1C6, 253, 2); _vm->_timers[6] = _vm->getRandom(20) + 30; _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -896,16 +908,16 @@ void Scene03::run() { _vm->initPlatypusPos(5, 4, kDirNone); } else { _vm->_timers[1] = _vm->getRandom(40) + 20; - _vm->_gameSys->setAnimation(0x1C2, 99, 1); - _vm->_gameSys->insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x1C2, 99, 1); + gameSys.insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceId = 0x1C2; _vm->_platypusSequenceDatNum = 0; } - _vm->_gameSys->insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFGrassTaken)) - _vm->_gameSys->insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1B2, 253, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -966,8 +978,8 @@ void Scene03::run() { case GRAB_CURSOR: _vm->playGnapPullOutDevice(9, 6); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1B3, 253, 5); + gameSys.insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1B3, 253, 5); _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; break; case TALK_CURSOR: @@ -1129,13 +1141,13 @@ void Scene03::run() { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) - _vm->_gameSys->insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 200; if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - _vm->_gameSys->setAnimation(0x1C5, 253, 4); - _vm->_gameSys->insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x1C5, 253, 4); + gameSys.insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundC(); @@ -1157,8 +1169,10 @@ void Scene03::run() { } void Scene03::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS03LeaveScene: _vm->_sceneDone = true; @@ -1172,9 +1186,9 @@ void Scene03::updateAnimations() { _vm->_platY = 6; _vm->_platypusFacing = kDirUnk4; _vm->_platypusId = 120; - _vm->_gameSys->insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, + gameSys.insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceDatNum = 1; _vm->_platypusSequenceId = 0x7CA; _vm->setFlag(kGFPlatypus); @@ -1184,13 +1198,13 @@ void Scene03::updateAnimations() { case kAS03HypnotizePlat: _vm->playGnapBrainPulsating(0, 0); _vm->addFullScreenSprite(0x106, 255); - _vm->_gameSys->setAnimation(0x1C9, 256, 1); - _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + gameSys.setAnimation(0x1C9, 256, 1); + gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); - _vm->_gameSys->setAnimation(0x1BA, 99, 1); - _vm->_gameSys->insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x1BA, 99, 1); + gameSys.insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; _vm->_gnapActionStatus = -1; @@ -1199,18 +1213,18 @@ void Scene03::updateAnimations() { break; case kAS03HypnotizeScaredPlat: _vm->playGnapBrainPulsating(0, 0); - _vm->_gameSys->insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1BF, 99, 1); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + gameSys.insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x1BF, 99, 1); + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->addFullScreenSprite(0x106, 255); - _vm->_gameSys->setAnimation(0x1C9, 256, 1); - _vm->_gameSys->insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + gameSys.setAnimation(0x1C9, 256, 1); + gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); - _vm->_gameSys->setAnimation(0x1BA, 99, 1); - _vm->_gameSys->insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1BA, 99, 1); + gameSys.insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; _vm->_gnapActionStatus = -1; @@ -1226,8 +1240,8 @@ void Scene03::updateAnimations() { _platypusHypnotized = false; break; case kAS03GrabCreek: - _vm->_gameSys->insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1B4, _vm->_gnapId, 0); + gameSys.insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1B4, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x1B4; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS03GrabCreekDone; @@ -1238,26 +1252,26 @@ void Scene03::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (gameSys.getAnimationStatus(1) == 2) { if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { - _vm->_gameSys->setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 1); _platypusScared = true; - _vm->_gameSys->insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x1B5; _vm->_gnapSequenceDatNum = 0; _vm->_gnapIdleFacing = kDirNone; _vm->_platypusSequenceId = _nextPlatSequenceId; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_nextPlatSequenceId, 99, 1); + gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { _vm->_gnapX = 3; _vm->_gnapY = 6; - _vm->_gameSys->insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1BC, 99, 0); + gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1BC, 99, 0); _vm->_gnapId = 20 * _vm->_gnapY; _vm->_gnapSequenceId = 0x1B6; _vm->_gnapSequenceDatNum = 0; @@ -1265,31 +1279,31 @@ void Scene03::updateAnimations() { _vm->_gnapActionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x1C2; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x1C2, 99, 1); + gameSys.setAnimation(0x1C2, 99, 1); _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == -1 && _platypusScared && !_platypusHypnotized) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0x1BE, 99, 1); - _vm->_gameSys->insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0x1BE, 99, 1); + gameSys.insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x1BE; _vm->_platypusSequenceDatNum = 0; _nextPlatSequenceId = -1; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextFrogSequenceId, 253, 2); - _vm->_gameSys->insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2 && _nextFrogSequenceId != -1) { + gameSys.setAnimation(_nextFrogSequenceId, 253, 2); + gameSys.insertSequence(_nextFrogSequenceId, 253, _currFrogSequenceId, 253, kSeqSyncWait, 0, 0, 0); _currFrogSequenceId = _nextFrogSequenceId; _nextFrogSequenceId = -1; } - if (_vm->_gameSys->getAnimationStatus(5) == 2) { - _vm->_gameSys->setAnimation(0, 0, 5); + if (gameSys.getAnimationStatus(5) == 2) { + gameSys.setAnimation(0, 0, 5); _vm->invAdd(kItemGrass); _vm->setGrabCursorSprite(kItemGrass); _vm->setFlag(kGFGrassTaken); @@ -1307,9 +1321,11 @@ Scene04::Scene04(GnapEngine *vm) : Scene(vm) { } int Scene04::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x214; } @@ -1335,15 +1351,17 @@ void Scene04::updateHotspots() { } void Scene04::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(4); - _vm->_gameSys->insertSequence(0x210, 139 - _dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x210, 139 - _dogIdCtr, 0, 0, kSeqNone, 0, 0, 0); _currDogSequenceId = 0x210; _nextDogSequenceId = -1; - _vm->_gameSys->setAnimation(0x210, 139 - _dogIdCtr, 3); + gameSys.setAnimation(0x210, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _vm->_timers[6] = _vm->getRandom(20) + 60; _vm->_timers[5] = _vm->getRandom(150) + 300; @@ -1351,10 +1369,10 @@ void Scene04::run() { _vm->_timers[8] = _vm->getRandom(150) + 400; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant) && _vm->_cursorValue == 4) - _vm->_gameSys->insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x212, 100, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFTwigTaken)) - _vm->_gameSys->insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1FE, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -1368,10 +1386,10 @@ void Scene04::run() { _vm->_platX = 6; _vm->_platY = 7; _vm->_platypusId = 141; - _vm->_gameSys->insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); - _vm->_gameSys->insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + gameSys.insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); _vm->endSceneInit(); _vm->invRemove(kItemDisguise); _vm->invAdd(kItemKeys); @@ -1382,9 +1400,9 @@ void Scene04::run() { _vm->_platypusFacing = kDirBottomRight; _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->waitForUpdate(); + gameSys.waitForUpdate(); } else { - _vm->_gameSys->insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 2) { _vm->initGnapPos(5, 11, kDirUpRight); if (_vm->isFlag(kGFPlatypus)) @@ -1469,8 +1487,8 @@ void Scene04::run() { case GRAB_CURSOR: _vm->playGnapPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); _vm->playGnapUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - _vm->_gameSys->insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x1FD, 100, 2); + gameSys.insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FD, 100, 2); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -1655,11 +1673,11 @@ void Scene04::run() { if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(150) + 300; if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(150) + 200; - _vm->_gameSys->insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1FC, 59, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 60; @@ -1668,7 +1686,7 @@ void Scene04::run() { } if (!_vm->_timers[8]) { _vm->_timers[8] = _vm->getRandom(150) + 400; - _vm->_gameSys->insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x213, 20, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -1686,49 +1704,51 @@ void Scene04::run() { } void Scene04::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS04LeaveScene: _vm->_sceneDone = true; break; case kAS04OpenDoor: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); _vm->_gnapX = 6; _vm->_gnapY = 7; - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + gameSys.insertSequence(0x107B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); - _vm->_gameSys->setAnimation(0x107B5, _vm->_gnapId, 0); + gameSys.setAnimation(0x107B5, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _vm->_gnapActionStatus = kAS04OpenDoorDone; break; case kAS04OpenDoorDone: - _vm->_gameSys->insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = -1; break; case kAS04GetKeyFirst: - _vm->_gameSys->insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x204, _vm->_gnapId, 0); + gameSys.insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x204, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x204; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyFirst2; break; case kAS04GetKeyFirst2: - _vm->_gameSys->insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x20B, 256, 0); + gameSys.insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x20B, 256, 0); _vm->_gnapSequenceId = 0x206; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyFirstDone; break; case kAS04GetKeyFirstDone: - _vm->_gameSys->requestRemoveSequence(0x1FF, 256); - _vm->_gameSys->requestRemoveSequence(0x20B, 256); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + gameSys.requestRemoveSequence(0x1FF, 256); + gameSys.requestRemoveSequence(0x20B, 256); + gameSys.insertSequence(0x107B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapIdleFacing = kDirBottomRight; @@ -1737,25 +1757,25 @@ void Scene04::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS04GetKeyAnother: - _vm->_gameSys->insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x202, _vm->_gnapId, 0); + gameSys.insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x202, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x202; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyAnother2; break; case kAS04GetKeyAnother2: - _vm->_gameSys->insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x20A, 256, 0); + gameSys.insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x20A, 256, 0); _vm->_gnapSequenceId = 0x203; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS04GetKeyAnotherDone; break; case kAS04GetKeyAnotherDone: - _vm->_gameSys->removeSequence(0x1FF, 256, true); - _vm->_gameSys->removeSequence(0x20A, 256, true); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, + gameSys.removeSequence(0x1FF, 256, true); + gameSys.removeSequence(0x20A, 256, true); + gameSys.insertSequence(0x107B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; @@ -1767,8 +1787,8 @@ void Scene04::updateAnimations() { _nextDogSequenceId = 0x201; break; case kAS04GrabAxe: - _vm->_gameSys->insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->requestRemoveSequence(0x212, 100); + gameSys.insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.requestRemoveSequence(0x212, 100); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x211; _vm->_gnapActionStatus = -1; @@ -1779,21 +1799,21 @@ void Scene04::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); _vm->invAdd(kItemTwig); _vm->setGrabCursorSprite(kItemTwig); _vm->setFlag(kGFTwigTaken); updateHotspots(); } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextDogSequenceId == 0x201) { - _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + gameSys.insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + gameSys.insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _currDogSequenceId = 0x201; _vm->_gnapSequenceId = 0x200; @@ -1802,10 +1822,10 @@ void Scene04::updateAnimations() { _vm->_timers[6] = _vm->getRandom(20) + 60; _nextDogSequenceId = -1; } else if (_nextDogSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, + gameSys.insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); + gameSys.setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = -1; @@ -1821,9 +1841,11 @@ Scene05::Scene05(GnapEngine *vm) : Scene(vm) { } int Scene05::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 3); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 3); return _vm->isFlag(kGFBarnPadlockOpen) ? 0x151 : 0x150; } @@ -1846,12 +1868,14 @@ void Scene05::updateHotspots() { } void Scene05::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(7); _currChickenSequenceId = 0x142; - _vm->_gameSys->setAnimation(0x142, 100, 3); - _vm->_gameSys->insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x142, 100, 3); + gameSys.insertSequence(0x142, 100, 0, 0, kSeqNone, 0, 0, 0); _nextChickenSequenceId = -1; @@ -1859,7 +1883,7 @@ void Scene05::run() { _vm->_timers[6] = _vm->getRandom(150) + 300; if (_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_gameSys->insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14A, 141, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2101,7 +2125,7 @@ void Scene05::run() { if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(150) + 300; if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -2120,22 +2144,24 @@ void Scene05::run() { } void Scene05::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS05LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kAS05TryPickPadlock: - _vm->_gameSys->insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x148; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; break; case kAS05PickPadlock: - _vm->_gameSys->setAnimation(0x147, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x147, _vm->_gnapId, 0); + gameSys.insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x147; _vm->_gnapSequenceDatNum = 0; _vm->setFlag(kGFBarnPadlockOpen); @@ -2154,10 +2180,10 @@ void Scene05::updateAnimations() { _nextChickenSequenceId = 0x14B; break; case kAS05GrabLadder: - while (_vm->_gameSys->isSequenceActive(0x149, 39)) + while (gameSys.isSequenceActive(0x149, 39)) _vm->gameUpdateTick(); - _vm->_gameSys->insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x14D; _vm->_gnapSequenceDatNum = 0; _vm->_timers[2] = 200; @@ -2165,10 +2191,10 @@ void Scene05::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS05EnterBarn: - _vm->_gameSys->insertSequence(0x107B1, 1, + gameSys.insertSequence(0x107B1, 1, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gameSys->setAnimation(0x107B1, 1, 0); + gameSys.setAnimation(0x107B1, 1, 0); _vm->_gnapActionStatus = kAS05LeaveScene; break; case kAS05UseTwigWithChicken: @@ -2179,11 +2205,11 @@ void Scene05::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (gameSys.getAnimationStatus(1) == 2) { if (_vm->_platypusSequenceId == 0x146) { _vm->_platX = 4; _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); + gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; _vm->_platypusId = 20 * _vm->_platY; @@ -2195,31 +2221,31 @@ void Scene05::updateAnimations() { _vm->_platypusActionStatus = -1; } if (_vm->_platypusActionStatus == kAS05PlatSearchHaystack) { - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->_platypusSequenceId = 0x146; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x146, 256, 1); + gameSys.setAnimation(0x146, 256, 1); _vm->_timers[1] = 300; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextChickenSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 100, 3); + gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x14C; _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 100, 3); + gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; } @@ -2236,9 +2262,11 @@ Scene06::Scene06(GnapEngine *vm) : Scene(vm) { } int Scene06::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); if (_vm->isFlag(kGFSceneFlag1)) { _vm->playSound(0x11B, false); _vm->clearFlag(kGFSceneFlag1); @@ -2268,26 +2296,27 @@ void Scene06::updateHotspots() { } void Scene06::run() { + GameSys& gameSys = *_vm->_gameSys; bool triedDeviceOnGas = false; _vm->startSoundTimerC(7); _horseTurnedBack = false; - _vm->_gameSys->insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF1, 120, 0, 0, kSeqNone, 0, 0, 0); _currHorseSequenceId = 0xF1; _nextHorseSequenceId = -1; - _vm->_gameSys->setAnimation(0xF1, 120, 2); + gameSys.setAnimation(0xF1, 120, 2); _vm->_timers[4] = _vm->getRandom(40) + 25; if (_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF7, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF8, 20, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFGasTaken) && _vm->_cursorValue != 4) - _vm->_gameSys->insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFE, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2518,23 +2547,25 @@ void Scene06::run() { } void Scene06::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS06LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kAS06TryToGetGas: - _vm->_gameSys->insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFC; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; break; case kAS06TryToClimbLadder: - _vm->_gameSys->insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xFD, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xFD, _vm->_gnapId, 0); + gameSys.insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFD; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS06TryToClimbLadderDone; @@ -2556,10 +2587,10 @@ void Scene06::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->_platypusSequenceId == 0xFA) { - _vm->_gameSys->setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 1); _vm->invAdd(kItemGas); _vm->setFlag(kGFGasTaken); _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; @@ -2567,7 +2598,7 @@ void Scene06::updateAnimations() { _vm->_platypusActionStatus = -1; _vm->_platX = 6; _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); + gameSys.insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; _vm->setFlag(kGFUnk04); @@ -2575,26 +2606,26 @@ void Scene06::updateAnimations() { _vm->showCursor(); } if (_nextPlatSequenceId == 0xFB) { - _vm->_gameSys->setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 1); _nextHorseSequenceId = 0xF2; _vm->_platypusActionStatus = 6; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { + if (gameSys.getAnimationStatus(2) == 2 && _nextHorseSequenceId != -1) { switch (_nextHorseSequenceId) { case 0xF2: _vm->setGrabCursorSprite(-1); _vm->hideCursor(); - _vm->_gameSys->setAnimation(0xFA, 256, 1); - _vm->_gameSys->insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xFA, 256, 1); + gameSys.insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xFA; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, + gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B7; _vm->_gnapSequenceDatNum = 1; @@ -2604,16 +2635,16 @@ void Scene06::updateAnimations() { _vm->invRemove(kItemTwig); break; case 0xF6: - _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(0xF6, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHorseSequenceId, 120, 2); + gameSys.insertSequence(0xF6, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _horseTurnedBack = true; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; _vm->_gnapActionStatus = -1; break; default: - _vm->_gameSys->setAnimation(_nextHorseSequenceId, 120, 2); - _vm->_gameSys->insertSequence(_nextHorseSequenceId, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHorseSequenceId, 120, 2); + gameSys.insertSequence(_nextHorseSequenceId, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; break; @@ -2644,15 +2675,17 @@ void Scene07::updateHotspots() { } void Scene07::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x90, 1, 0, 0, kSeqLoop, 0, 0, 0); _vm->invRemove(kItemGas); _vm->invRemove(kItemNeedle); if (!_vm->isFlag(kGFPlatypus)) - _vm->_gameSys->insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { _vm->initGnapPos(7, 7, kDirBottomLeft); @@ -2665,8 +2698,8 @@ void Scene07::run() { _vm->_gnapSequenceId = 0x8F; _vm->_gnapSequenceDatNum = 0; _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS07Wait; _vm->_platX = 3; _vm->_platY = 8; @@ -2674,7 +2707,7 @@ void Scene07::run() { _vm->_platypusSequenceId = 0x91; _vm->_platypusSequenceDatNum = 0; _vm->_platypusFacing = kDirNone; - _vm->_gameSys->insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); } @@ -2733,9 +2766,9 @@ void Scene07::run() { _vm->invAdd(kItemDice); updateHotspots(); _vm->playGnapPullOutDevice(3, 3); - _vm->_gameSys->setAnimation(0x8E, 1, 2); - _vm->_gameSys->insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, + gameSys.setAnimation(0x8E, 1, 2); + gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = _vm->getGnapSequenceId(gskUseDevice, 0, 0); @@ -2805,7 +2838,7 @@ void Scene07::run() { } else { _vm->playPlatypusSequence(0x107CB); } - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; @@ -2831,8 +2864,10 @@ void Scene07::run() { } void Scene07::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS07LeaveScene: _vm->_newSceneNum = 8; @@ -2842,8 +2877,8 @@ void Scene07::updateAnimations() { _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); _vm->setGrabCursorSprite(kItemDice); } } @@ -2883,9 +2918,11 @@ void Scene08::updateHotspots() { } void Scene08::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; if ( _nextDogSequenceId != 0x135 ) _nextDogSequenceId = 0x134; @@ -2893,33 +2930,35 @@ void Scene08::updateAnimationsCb() { } void Scene08::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14F, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x14E, 256, 0, 0, kSeqNone, 0, 0, 0); _currDogSequenceId = 0x135; _nextDogSequenceId = 0x135; - _vm->_gameSys->setAnimation(0x135, 100, 3); - _vm->_gameSys->insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x135, 100, 3); + gameSys.insertSequence(_currDogSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); _currManSequenceId = 0x140; _nextManSequenceId = -1; - _vm->_gameSys->setAnimation(0x140, 100, 2); - _vm->_gameSys->insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x140, 100, 2); + gameSys.insertSequence(_currManSequenceId, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(50) + 75; if (!_vm->isFlag(kGFBarnPadlockOpen)) - _vm->_gameSys->insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x144, 1, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gameSys->insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x145, 1, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gameSys->insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->initGnapPos(-1, 8, kDirBottomRight); _vm->initPlatypusPos(-1, 7, kDirNone); @@ -3031,13 +3070,13 @@ void Scene08::run() { case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 7, 5, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapScratchingHead(6, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS08LookDog; break; case GRAB_CURSOR: @@ -3201,8 +3240,10 @@ void Scene08::run() { } void Scene08::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS08LeaveScene: _vm->_sceneDone = true; @@ -3237,8 +3278,8 @@ void Scene08::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS08PlatWithDog: _nextDogSequenceId = 0x147; @@ -3250,14 +3291,14 @@ void Scene08::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextManSequenceId, 100, 2); - _vm->_gameSys->insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2 && _nextManSequenceId != -1) { + gameSys.setAnimation(_nextManSequenceId, 100, 2); + gameSys.insertSequence(_nextManSequenceId, 100, _currManSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currManSequenceId = _nextManSequenceId; _nextManSequenceId = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_currDogSequenceId == 0x147) _vm->_platypusActionStatus = -1; if (_currDogSequenceId == 0x149 || _currDogSequenceId == 0x14A || _currDogSequenceId == 0x14B) { @@ -3268,31 +3309,31 @@ void Scene08::updateAnimations() { } else if (_currDogSequenceId == 0x133) _nextManSequenceId = 0x139; if (_nextDogSequenceId == 0x149 || _nextDogSequenceId == 0x14A || _nextDogSequenceId == 0x14B) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); switch (_nextDogSequenceId) { case 0x149: _vm->setFlag(kGFBarnPadlockOpen); _vm->_hotspots[kHS08Meat]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x144, 1, true); + gameSys.removeSequence(0x144, 1, true); break; case 0x14A: _vm->setFlag(kGFTruckFilledWithGas); _vm->_hotspots[kHS08Bone]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x145, 1, true); + gameSys.removeSequence(0x145, 1, true); break; case 0x14B: _vm->setFlag(kGFTruckKeysUsed); _vm->_hotspots[kHS08Toy]._flags = SF_DISABLED | SF_WALKABLE; - _vm->_gameSys->removeSequence(0x146, 1, true); + gameSys.removeSequence(0x146, 1, true); break; } _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = 0x134; } else if (_nextDogSequenceId == 0x147) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = 0x134; _vm->_platX = 1; @@ -3304,15 +3345,15 @@ void Scene08::updateAnimations() { if (_vm->_gnapX == 1 && _vm->_gnapY == 8) _vm->gnapWalkStep(); } else if (_nextDogSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextDogSequenceId, 100, 3); - _vm->_gameSys->insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextDogSequenceId, 100, 3); + gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; if (_nextDogSequenceId != 0x135) _nextDogSequenceId = 0x134; if (_currDogSequenceId == 0x133) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x14D; _vm->_gnapIdleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; @@ -3344,10 +3385,12 @@ void Scene09::updateHotspots() { } void Scene09::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x4D, 1, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { _vm->initGnapPos(11, 8, kDirBottomLeft); @@ -3463,9 +3506,9 @@ void Scene09::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(150) + 100; if (_vm->_timers[4] & 1) - _vm->_gameSys->insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x49, 1, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x4A, 1, 0, 0, kSeqNone, 0, 0, 0); } playRandomSound(5); } @@ -3485,17 +3528,19 @@ void Scene09::run() { } void Scene09::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS09LeaveScene: _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kAS09SearchTrash: - _vm->_gameSys->setAnimation(0x4C, 120, 0); - _vm->_gameSys->insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x4B, 2, true); + gameSys.setAnimation(0x4C, 120, 0); + gameSys.insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x4B, 2, true); _vm->_gnapSequenceId = 0x4C; _vm->_gnapId = 120; _vm->_gnapIdleFacing = kDirUpLeft; @@ -3505,7 +3550,7 @@ void Scene09::updateAnimations() { _vm->_gnapActionStatus = kAS09SearchTrashDone; break; case kAS09SearchTrashDone: - _vm->_gameSys->insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[2] = 360; _vm->_timers[4] = _vm->getRandom(150) + 100; _vm->_gnapActionStatus = -1; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 90767500ed..70742fe27a 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -33,9 +33,11 @@ Scene10::Scene10(GnapEngine *vm) : Scene(vm) { } int Scene10::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x10F; } @@ -56,14 +58,16 @@ void Scene10::updateHotspots() { } void Scene10::run() { + GameSys& gameSys = *_vm->_gameSys; + _currCookSequenceId = 0x103; - _vm->_gameSys->setAnimation(0x103, 100, 2); - _vm->_gameSys->insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x103, 100, 2); + gameSys.insertSequence(0x103, 100, 0, 0, kSeqNone, 0, 0, 0); _nextCookSequenceId = 0x106; if (!_vm->isFlag(kGFMudTaken)) - _vm->_gameSys->insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x107, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -146,7 +150,7 @@ void Scene10::run() { case kHS10Cook: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 8, 6, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { @@ -239,7 +243,7 @@ void Scene10::run() { _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); _vm->_platypusActionStatus = kAS10PlatWithBox; _vm->_platypusFacing = kDirUnk4; - _vm->_largeSprite = _vm->_gameSys->createSurface(0xC3); + _vm->_largeSprite = gameSys.createSurface(0xC3); _vm->playGnapIdle(7, 6); } break; @@ -258,7 +262,7 @@ void Scene10::run() { case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(9, 6, 0, 0x107BB, 1); - _vm->_gameSys->insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x10E; _vm->_gnapId = 120; _vm->_gnapIdleFacing = kDirUpRight; @@ -320,7 +324,7 @@ void Scene10::run() { } else { sequenceId = 0x8A7; } - _vm->_gameSys->insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(sequenceId | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); } } } @@ -338,8 +342,10 @@ void Scene10::run() { } void Scene10::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS10LeaveScene: _vm->_sceneDone = true; @@ -350,8 +356,8 @@ void Scene10::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS10PlatWithBox: _nextCookSequenceId = 0x109; @@ -359,18 +365,18 @@ void Scene10::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextCookSequenceId != -1) { + if (gameSys.getAnimationStatus(2) == 2 && _nextCookSequenceId != -1) { switch (_nextCookSequenceId) { case 0x109: _vm->_platX = 4; _vm->_platY = 8; - _vm->_gameSys->insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107C9, 160, + gameSys.insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107C9, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->removeSequence(0x107, 100, true); + gameSys.removeSequence(0x107, 100, true); _currCookSequenceId = 0x109; _nextCookSequenceId = 0x843; _vm->_platypusSequenceId = 0x7C9; @@ -380,17 +386,17 @@ void Scene10::updateAnimations() { break; case 0x843: _vm->hideCursor(); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->insertSequence(0x10843, 301, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.insertSequence(0x10843, 301, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = 0x843; _nextCookSequenceId = 0x10A; break; case 0x10A: - _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextCookSequenceId, 100, 0x10843, 301, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = _nextCookSequenceId; _nextCookSequenceId = 0x104; _vm->showCursor(); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->delayTicksCursor(5); _vm->deleteSurface(&_vm->_largeSprite); _vm->setGrabCursorSprite(kItemTongs); @@ -400,7 +406,7 @@ void Scene10::updateAnimations() { _vm->gnapWalkStep(); break; default: - _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = _nextCookSequenceId; break; } @@ -417,7 +423,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x103; else if (rnd == 2) { _nextCookSequenceId = 0x106; - _vm->_gameSys->insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); } else _nextCookSequenceId = 0x106; } @@ -451,7 +457,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = 300; - _vm->_gameSys->insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x10C; _vm->_gnapIdleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; @@ -461,16 +467,18 @@ void Scene10::updateAnimations() { break; } if (_currCookSequenceId == 0x843) - _vm->_gameSys->setAnimation(_currCookSequenceId | 0x10000, 301, 2); + gameSys.setAnimation(_currCookSequenceId | 0x10000, 301, 2); else - _vm->_gameSys->setAnimation(_currCookSequenceId, 100, 2); + gameSys.setAnimation(_currCookSequenceId, 100, 2); } } void Scene10::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(_nextCookSequenceId, 100, 2); - _vm->_gameSys->insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(_nextCookSequenceId, 100, 2); + gameSys.insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); _currCookSequenceId = _nextCookSequenceId; _nextCookSequenceId = 0x106; } @@ -487,9 +495,11 @@ Scene11::Scene11(GnapEngine *vm) : Scene(vm) { } int Scene11::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 2); if (_vm->_prevSceneNum == 10 || _vm->_prevSceneNum == 13) { _vm->playSound(0x108EC, false); _vm->playSound(0x10928, false); @@ -515,6 +525,7 @@ void Scene11::updateHotspots() { } void Scene11::run() { + GameSys& gameSys = *_vm->_gameSys; bool flag = true; _vm->_timers[7] = 50; @@ -547,16 +558,16 @@ void Scene11::run() { _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currHookGuySequenceId, 120, 0, 0, kSeqNone, 0, 0, 0); _nextHookGuySequenceId = -1; - _vm->_gameSys->setAnimation(_currHookGuySequenceId, 120, 3); - _vm->_gameSys->insertSequence(_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currHookGuySequenceId, 120, 3); + gameSys.insertSequence(_currGoggleGuySequenceId, 121, 0, 0, kSeqNone, 0, 0, 0); _nextGoggleGuySequenceId = -1; - _vm->_gameSys->setAnimation(_currGoggleGuySequenceId, 121, 2); + gameSys.setAnimation(_currGoggleGuySequenceId, 121, 2); _vm->_timers[5] = _vm->getRandom(100) + 75; _vm->_timers[4] = _vm->getRandom(40) + 20; @@ -568,7 +579,7 @@ void Scene11::run() { _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } - _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); + gameSys.insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); while (!_vm->_sceneDone) { _vm->testWalk(0, 0, -1, -1, -1, -1); @@ -733,8 +744,8 @@ void Scene11::run() { if (!_vm->_isLeavingScene) { if (flag && !_vm->_timers[7]) { flag = false; - _vm->_gameSys->setAnimation(0x207, 257, 4); - _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x207, 257, 4); + gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } _vm->platypusSub426234(); _vm->updateGnapIdleSequence2(); @@ -775,13 +786,13 @@ void Scene11::run() { int _gnapRandomValue = _vm->getRandom(3); switch (_gnapRandomValue) { case 0: - _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -802,9 +813,11 @@ void Scene11::run() { } void Scene11::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { if (_vm->_gnapActionStatus != kAS11GrabBillardBall) - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS11LeaveScene: _vm->_sceneDone = true; @@ -825,20 +838,20 @@ void Scene11::updateAnimations() { _nextHookGuySequenceId = 0x206; break; case kAS11GrabBillardBall: - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2 && gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0, 0, 0); _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x1F4; _vm->_gnapId = 255; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->removeSequence(0x207, 257, true); - _vm->_gameSys->removeSequence(0x208, 256, true); + gameSys.removeSequence(0x207, 257, true); + gameSys.removeSequence(0x208, 256, true); _nextGoggleGuySequenceId = 0x1F8; _vm->_timers[5] = _vm->getRandom(100) + 75; - _vm->_gameSys->insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextGoggleGuySequenceId, 121, 2); + gameSys.insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGoggleGuySequenceId, 121, 2); _currGoggleGuySequenceId = _nextGoggleGuySequenceId; _nextGoggleGuySequenceId = -1; switch (_billardBallCtr) { @@ -853,36 +866,36 @@ void Scene11::updateAnimations() { break; } ++_billardBallCtr; - _vm->_gameSys->insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); + gameSys.insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); _currHookGuySequenceId = _nextHookGuySequenceId; _nextHookGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(40) + 20; - _vm->_gameSys->insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0); + gameSys.insertSequence(0x208, 256, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1F4) - 5, 0, 0); _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; - _vm->_gameSys->setAnimation(0x207, 257, 4); - _vm->_gameSys->insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); + gameSys.setAnimation(0x207, 257, 4); + gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); _vm->_gnapActionStatus = -1; } break; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _nextGoggleGuySequenceId != -1) { + if (gameSys.getAnimationStatus(2) == 2 && _nextGoggleGuySequenceId != -1) { _vm->_timers[5] = _vm->getRandom(100) + 75; - _vm->_gameSys->insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextGoggleGuySequenceId, 121, 2); + gameSys.insertSequence(_nextGoggleGuySequenceId, 121, _currGoggleGuySequenceId, 121, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGoggleGuySequenceId, 121, 2); _currGoggleGuySequenceId = _nextGoggleGuySequenceId; _nextGoggleGuySequenceId = -1; if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4) _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextHookGuySequenceId == 0x204) { - _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); - _vm->_gameSys->insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); + gameSys.insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _currHookGuySequenceId = 0x204; _nextHookGuySequenceId = -1; _vm->_gnapSequenceId = 0x1F5; @@ -893,8 +906,8 @@ void Scene11::updateAnimations() { if (_vm->_gnapActionStatus == kAS11GrabHookGuy) _vm->_gnapActionStatus = -1; } else if (_nextHookGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextHookGuySequenceId, 120, 3); + gameSys.insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); _currHookGuySequenceId = _nextHookGuySequenceId; _nextHookGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(40) + 20; @@ -903,8 +916,8 @@ void Scene11::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - _vm->_gameSys->setAnimation(0, 0, 4); + if (gameSys.getAnimationStatus(4) == 2) { + gameSys.setAnimation(0, 0, 4); _vm->_hotspots[kHS11Billard]._flags &= ~SF_DISABLED; } } @@ -940,29 +953,30 @@ void Scene12::updateHotspots() { } void Scene12::run() { + GameSys& gameSys = *_vm->_gameSys; int v18 = 1; _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x207, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x200, 50, 0, 0, kSeqNone, 0, 0, 0); _currToothGuySequenceId = 0x200; _nextToothGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x200, 50, 2); - _vm->_gameSys->insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x200, 50, 2); + gameSys.insertSequence(0x202, 50, 0, 0, kSeqNone, 0, 0, 0); _currBeardGuySequenceId = 0x202; _nextBeardGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x202, 50, 4); - _vm->_gameSys->insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x202, 50, 4); + gameSys.insertSequence(0x203, 50, 0, 0, kSeqNone, 0, 0, 0); _currBarkeeperSequenceId = 0x203; _nextBarkeeperSequenceId = -1; - _vm->_gameSys->setAnimation(0x203, 50, 3); + gameSys.setAnimation(0x203, 50, 3); _vm->_timers[4] = 30; _vm->_timers[6] = _vm->getRandom(30) + 20; @@ -1026,7 +1040,7 @@ void Scene12::run() { case kHS12ToothGuy: if (_vm->_grabCursorSpriteIndex == kItemQuarter) { - _vm->_largeSprite = _vm->_gameSys->createSurface(0x141); + _vm->_largeSprite = gameSys.createSurface(0x141); _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); _vm->_gnapIdleFacing = kDirUpLeft; _vm->_gnapActionStatus = kAS12QuarterToToothGuy; @@ -1095,7 +1109,7 @@ void Scene12::run() { break; case PLAT_CURSOR: _vm->playGnapPullOutDevice(_vm->_platX, _vm->_platY); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS12PlatWithBarkeeper; break; } @@ -1207,13 +1221,13 @@ void Scene12::run() { int _gnapRandomValue = _vm->getRandom(3); switch (_gnapRandomValue) { case 0: - _vm->_gameSys->insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A5 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A7 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8A6 | 0x10000, 179, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -1235,8 +1249,10 @@ void Scene12::run() { } void Scene12::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS12LeaveScene: _vm->_sceneDone = true; @@ -1287,7 +1303,7 @@ void Scene12::updateAnimations() { case kAS12QuarterToToothGuyDone: _vm->_gnapActionStatus = -1; _vm->showCursor(); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); _vm->setGrabCursorSprite(kItemQuarterWithHole); break; @@ -1327,8 +1343,8 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS12PlatWithToothGuy: _nextToothGuySequenceId = 0x1EB; @@ -1339,15 +1355,15 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { if (_currToothGuySequenceId == 0x1E9) { - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); _vm->hideCursor(); - _vm->_gameSys->setAnimation(0x10843, 301, 0); + gameSys.setAnimation(0x10843, 301, 0); _vm->_gnapActionStatus = kAS12QuarterToToothGuyDone; - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B7; _vm->_gnapSequenceDatNum = 1; @@ -1356,9 +1372,9 @@ void Scene12::updateAnimations() { _vm->invRemove(kItemQuarter); } if (_nextToothGuySequenceId == 0x1EF) { - _vm->_gameSys->setAnimation(_nextToothGuySequenceId, 50, 2); - _vm->_gameSys->insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); + gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; _vm->_gnapSequenceId = 0x205; @@ -1369,8 +1385,8 @@ void Scene12::updateAnimations() { if (_vm->_gnapActionStatus == kAS12GrabToothGuy) _vm->_gnapActionStatus = -1; } else if (_nextToothGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextToothGuySequenceId, 50, 2); + gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; _vm->_timers[4] = 50; @@ -1382,15 +1398,15 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_vm->_gnapActionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { _vm->_gnapActionStatus = -1; _vm->playGnapIdle(7, 6); _vm->_timers[5] = 0; } if (_nextBarkeeperSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextBarkeeperSequenceId, 50, _currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextBarkeeperSequenceId, 50, 3); + gameSys.insertSequence(_nextBarkeeperSequenceId, 50, _currBarkeeperSequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBarkeeperSequenceId, 50, 3); _currBarkeeperSequenceId = _nextBarkeeperSequenceId; _nextBarkeeperSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; @@ -1400,9 +1416,9 @@ void Scene12::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextBeardGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_nextBeardGuySequenceId, 50, _currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextBeardGuySequenceId, 50, 4); + if (gameSys.getAnimationStatus(4) == 2 && _nextBeardGuySequenceId != -1) { + gameSys.insertSequence(_nextBeardGuySequenceId, 50, _currBeardGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBeardGuySequenceId, 50, 4); _currBeardGuySequenceId = _nextBeardGuySequenceId; _nextBeardGuySequenceId = -1; _vm->_timers[6] = _vm->getRandom(30) + 20; @@ -1446,9 +1462,11 @@ void Scene13::updateHotspots() { } void Scene13::showScribble() { + GameSys& gameSys = *_vm->_gameSys; + _vm->hideCursor(); - _vm->_largeSprite = _vm->_gameSys->createSurface(0x6F); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + _vm->_largeSprite = gameSys.createSurface(0x6F); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) _vm->gameUpdateTick(); @@ -1456,17 +1474,18 @@ void Scene13::showScribble() { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(29); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); _vm->showCursor(); } void Scene13::run() { + GameSys& gameSys = *_vm->_gameSys; int currSoundId = 0; _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 14) { _vm->initGnapPos(6, 6, kDirBottomLeft); @@ -1543,8 +1562,8 @@ void Scene13::run() { case TALK_CURSOR: if (_vm->_gnapX == 5 && _vm->_gnapY == 5) { _backToiletCtr = MIN(5, _backToiletCtr + 1); - _vm->_gameSys->setAnimation(_backToiletCtr + 0xA3, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, + gameSys.setAnimation(_backToiletCtr + 0xA3, _vm->_gnapId, 0); + gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqScale | kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS13Wait; @@ -1742,8 +1761,10 @@ void Scene13::run() { } void Scene13::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS13LeaveScene: _vm->_sceneDone = true; @@ -1751,7 +1772,7 @@ void Scene13::updateAnimations() { break; case kAS13BackToilet: _backToiletCtr = MIN(5, _backToiletCtr + 1); - _vm->_gameSys->insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); + gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); _vm->_gnapSequenceId = _backToiletCtr + 0xA3; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; @@ -1765,9 +1786,9 @@ void Scene13::updateAnimations() { showScribble(); break; case kAS13GrabSink: - _vm->_gameSys->setAnimation(0xAB, 160, 0); - _vm->_gameSys->insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0xAA, 256, true); + gameSys.setAnimation(0xAB, 160, 0); + gameSys.insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0xAA, 256, true); _vm->_gnapSequenceId = 0xAB; _vm->_gnapId = 160; _vm->_gnapIdleFacing = kDirBottomRight; @@ -1778,15 +1799,15 @@ void Scene13::updateAnimations() { _vm->_gnapActionStatus = kAS13GrabSinkDone; break; case kAS13GrabSinkDone: - _vm->_gameSys->insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; break; case kAS13Wait: _vm->_gnapActionStatus = -1; break; case kAS13GrabUrinal: - _vm->_gameSys->setAnimation(0xA2, 120, 0); - _vm->_gameSys->insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xA2, 120, 0); + gameSys.insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA2; _vm->_gnapId = 120; _vm->_gnapIdleFacing = kDirBottomLeft; @@ -1799,8 +1820,8 @@ void Scene13::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); _vm->_platypusActionStatus = -1; } } @@ -1811,8 +1832,10 @@ Scene14::Scene14(GnapEngine *vm) : Scene(vm) { } int Scene14::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0x27; } @@ -1828,20 +1851,21 @@ void Scene14::updateHotspots() { } void Scene14::run() { - _vm->_largeSprite = nullptr; + GameSys& gameSys = *_vm->_gameSys; + _vm->_largeSprite = nullptr; _vm->queueInsertDeviceIcon(); if (!_vm->isFlag(kGFNeedleTaken)) - _vm->_gameSys->insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x23, 10, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); if (!_vm->isFlag(kGFNeedleTaken) && _vm->invHas(kItemTongs)) - _vm->_largeSprite = _vm->_gameSys->createSurface(1); + _vm->_largeSprite = gameSys.createSurface(1); if (!_vm->isFlag(kGFNeedleTaken)) { - _vm->_gameSys->insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -1872,8 +1896,8 @@ void Scene14::run() { _vm->setFlag(kGFNeedleTaken); _vm->setGrabCursorSprite(-1); _vm->hideCursor(); - _vm->_gameSys->setAnimation(0x26, 10, 0); - _vm->_gameSys->insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x26, 10, 0); + gameSys.insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playSound(0x108E9, false); } else { @@ -1882,15 +1906,15 @@ void Scene14::run() { _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - _vm->_gameSys->insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x23; break; case TALK_CURSOR: _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -1898,7 +1922,7 @@ void Scene14::run() { case kHS14Toilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1909,7 +1933,7 @@ void Scene14::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -1924,7 +1948,7 @@ void Scene14::run() { _vm->checkGameKeys(); if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { - _vm->_gameSys->insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -1943,15 +1967,17 @@ void Scene14::run() { } void Scene14::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - _vm->_gameSys->setAnimation(0x10843, 301, 1); - _vm->_gameSys->insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.setAnimation(0x10843, 301, 1); + gameSys.insertSequence(0x10843, 301, 0x26, 10, kSeqSyncWait, 0, 0, 0); } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); _vm->_sceneDone = true; _vm->_newSceneNum = 13; _vm->_grabCursorSpriteIndex = kItemQuarter; @@ -1997,6 +2023,8 @@ void Scene15::updateHotspots() { } void Scene15::run() { + GameSys& gameSys = *_vm->_gameSys; + _currSlotSequenceId = -1; _currUpperButtonSequenceId = -1; _currLowerButtonSequenceId = -1; @@ -2006,8 +2034,8 @@ void Scene15::run() { _currRecordSequenceId = 0xD5; _nextRecordSequenceId = -1; - _vm->_gameSys->setAnimation(0xD5, 1, 0); - _vm->_gameSys->insertSequence(_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0xD5, 1, 0); + gameSys.insertSequence(_currRecordSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2044,7 +2072,7 @@ void Scene15::run() { } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _nextSlotSequenceId = 0xDB; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2055,7 +2083,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2063,7 +2091,7 @@ void Scene15::run() { case kHS15PlayButton: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2082,7 +2110,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2095,7 +2123,7 @@ void Scene15::run() { case kHS15Button5: case kHS15Button6: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2108,7 +2136,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2121,7 +2149,7 @@ void Scene15::run() { case kHS15ButtonE: case kHS15ButtonF: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2134,7 +2162,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - _vm->_gameSys->insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); break; } } @@ -2160,12 +2188,14 @@ void Scene15::run() { } void Scene15::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { if (_vm->_isLeavingScene) { _vm->_sceneDone = true; } else if (_nextSlotSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextSlotSequenceId, 1, 0); - _vm->_gameSys->insertSequence(_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_nextSlotSequenceId, 1, 0); + gameSys.insertSequence(_nextSlotSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _currSlotSequenceId = _nextSlotSequenceId; _nextSlotSequenceId = -1; switch (_currSlotSequenceId) { @@ -2199,18 +2229,18 @@ void Scene15::updateAnimations() { case 0xD8: case 0xDA: if (_currUpperButtonSequenceId != -1) { - _vm->_gameSys->removeSequence(_currUpperButtonSequenceId, 1, true); + gameSys.removeSequence(_currUpperButtonSequenceId, 1, true); _currUpperButtonSequenceId = -1; } if (_currLowerButtonSequenceId != -1) { - _vm->_gameSys->removeSequence(_currLowerButtonSequenceId, 1, true); + gameSys.removeSequence(_currLowerButtonSequenceId, 1, true); _currLowerButtonSequenceId = -1; } break; } } else if (_nextRecordSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextRecordSequenceId, 1, 0); - _vm->_gameSys->insertSequence(_nextRecordSequenceId, 1, _currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextRecordSequenceId, 1, 0); + gameSys.insertSequence(_nextRecordSequenceId, 1, _currRecordSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currRecordSequenceId = _nextRecordSequenceId; _nextRecordSequenceId = -1; if (_currRecordSequenceId == 0xD3) { @@ -2218,16 +2248,16 @@ void Scene15::updateAnimations() { _vm->_newSceneNum = 16; _vm->_isLeavingScene = true; } - _vm->_gameSys->removeSequence(_currUpperButtonSequenceId, 1, true); + gameSys.removeSequence(_currUpperButtonSequenceId, 1, true); _currUpperButtonSequenceId = -1; - _vm->_gameSys->removeSequence(_currLowerButtonSequenceId, 1, true); + gameSys.removeSequence(_currLowerButtonSequenceId, 1, true); _currLowerButtonSequenceId = -1; } else if (_nextUpperButtonSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextUpperButtonSequenceId, 1, 0); + gameSys.setAnimation(_nextUpperButtonSequenceId, 1, 0); if (_currUpperButtonSequenceId == -1) - _vm->_gameSys->insertSequence(_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_nextUpperButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(_nextUpperButtonSequenceId, 1, _currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextUpperButtonSequenceId, 1, _currUpperButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currUpperButtonSequenceId = _nextUpperButtonSequenceId; _nextUpperButtonSequenceId = -1; if (_currLowerButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { @@ -2237,11 +2267,11 @@ void Scene15::updateAnimations() { _nextRecordSequenceId = 0xD4; } } else if (_nextLowerButtonSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextLowerButtonSequenceId, 1, 0); + gameSys.setAnimation(_nextLowerButtonSequenceId, 1, 0); if (_currLowerButtonSequenceId == -1) - _vm->_gameSys->insertSequence(_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_nextLowerButtonSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(_nextLowerButtonSequenceId, 1, _currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextLowerButtonSequenceId, 1, _currLowerButtonSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currLowerButtonSequenceId = _nextLowerButtonSequenceId; _nextLowerButtonSequenceId = -1; if (_currUpperButtonSequenceId != -1 && _vm->isFlag(kGFUnk14)) { @@ -2302,6 +2332,7 @@ void Scene17::update() { } void Scene17::platHangUpPhone() { + GameSys& gameSys = *_vm->_gameSys; int savedGnapActionStatus = _vm->_gnapActionStatus; if (_vm->_platypusActionStatus == kAS17PlatPhoningAssistant) { @@ -2309,18 +2340,18 @@ void Scene17::platHangUpPhone() { _vm->updateMouseCursor(); _platPhoneCtr = 0; _vm->_platypusActionStatus = -1; - _vm->_gameSys->setAnimation(0x257, 254, 4); - _vm->_gameSys->insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) + gameSys.setAnimation(0x257, 254, 4); + gameSys.insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (gameSys.getAnimationStatus(4) != 2) _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x25B, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x25B, _vm->_platypusId, 1); + gameSys.insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0x25B; _vm->_platypusSequenceDatNum = 0; _currPhoneSequenceId = -1; _nextPhoneSequenceId = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); _vm->_gnapActionStatus = savedGnapActionStatus; _vm->updateMouseCursor(); @@ -2329,6 +2360,8 @@ void Scene17::platHangUpPhone() { } void Scene17::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); _vm->_sceneWaiting = false; @@ -2339,23 +2372,23 @@ void Scene17::run() { _vm->_timers[7] = _vm->getRandom(100) + 100; if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gameSys->insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25F, 20, 0, 0, kSeqNone, 0, 0, 0); } else { if (_vm->_s18GarbageCanPos >= 8) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 97, 1); } else if (_vm->_s18GarbageCanPos >= 6) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 68, 2); } else if (_vm->_s18GarbageCanPos >= 5) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, 23, -1); } else if (_vm->_s18GarbageCanPos >= 4) { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -11, -5); } else { - _vm->_gameSys->insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); + gameSys.insertSequence(0x260, 20, 0, 0, kSeqNone, 0, -54, -8); } } if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_gameSys->insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x262, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); @@ -2367,22 +2400,22 @@ void Scene17::run() { _currCarWindowSequenceId = 0x244; if (_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x261, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(_currWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currWrenchSequenceId, 40, 2); + gameSys.insertSequence(_currWrenchSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 3); } else { - _vm->_gameSys->setAnimation(_currCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currCarWindowSequenceId, 40, 3); + gameSys.insertSequence(_currCarWindowSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); } _canTryGetWrench = true; if (_vm->isFlag(kGFUnk18)) - _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { if (_vm->_prevSceneNum == 20) { @@ -2396,8 +2429,8 @@ void Scene17::run() { _vm->_platX = _vm->_hotspotsWalkPos[2].x; _vm->_platY = _vm->_hotspotsWalkPos[2].y; _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; - _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceId = 0x25A; _vm->_platypusSequenceDatNum = 0; _vm->endSceneInit(); @@ -2405,7 +2438,7 @@ void Scene17::run() { _vm->clearFlag(kGFUnk16); _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; platHangUpPhone(); - _vm->_gameSys->setAnimation(0, 0, 4); + gameSys.setAnimation(0, 0, 4); _vm->clearFlag(kGFPlatypusTalkingToAssistant); _vm->clearFlag(kGFUnk27); updateHotspots(); @@ -2416,15 +2449,15 @@ void Scene17::run() { _vm->_gnapX = _vm->_hotspotsWalkPos[2].x; _vm->_gnapY = _vm->_hotspotsWalkPos[2].y; _vm->_gnapId = 20 * _vm->_hotspotsWalkPos[2].y; - _vm->_gameSys->insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 601; _vm->_gnapActionStatus = kAS17GnapHangUpPhone; _vm->clearFlag(kGFUnk25); - _vm->_gameSys->insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->_gameSys->setAnimation(0x257, 254, 0); - _vm->_gameSys->insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x257, 254, 0); + gameSys.insertSequence(0x257, 254, 0x251, 254, kSeqSyncWait, 0, 0, 0); } else if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); @@ -2434,12 +2467,12 @@ void Scene17::run() { _vm->_platY = _vm->_hotspotsWalkPos[2].y; _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; - _vm->_gameSys->insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceId = 0x25A; _vm->_platypusSequenceDatNum = 0; _vm->endSceneInit(); - _vm->_gameSys->setAnimation(_currPhoneSequenceId, 254, 1); + gameSys.setAnimation(_currPhoneSequenceId, 254, 1); _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; updateHotspots(); } else if (_vm->_prevSceneNum == 18) { @@ -2469,14 +2502,14 @@ void Scene17::run() { _vm->_gnapSequenceId = 0x23D; _vm->_gnapSequenceDatNum = 0; _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->_platX = -1; _vm->_platY = 8; _vm->_platypusId = 160; - _vm->_gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, + gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, kSeqScale | kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); - _vm->_gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); _vm->endSceneInit(); _vm->_platypusSequenceId = 0x7C1; @@ -2702,20 +2735,20 @@ void Scene17::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 200; if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) - _vm->_gameSys->insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { switch (_vm->getRandom(3)) { case 0: - _vm->_gameSys->insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25D, 255, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x25E, 255, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -2795,8 +2828,10 @@ void Scene17::updateAnimations() { 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257 }; - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS17GetWrench1: _vm->_gnapActionStatus = kAS17GetWrenchGnapReady; @@ -2804,8 +2839,8 @@ void Scene17::updateAnimations() { case kAS17GetCoinFromPhone: _vm->playGnapPullOutDevice(1, 3); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x250, 100, 0); - _vm->_gameSys->insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x250, 100, 0); + gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemDiceQuarterHole); _vm->clearFlag(kGFUnk18); _vm->_gnapActionStatus = kAS17GetCoinFromPhoneDone; @@ -2815,8 +2850,8 @@ void Scene17::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS17PutCoinIntoPhone: - _vm->_gameSys->setAnimation(0x24C, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24C, _vm->_gnapId, 0); + gameSys.insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x24C; _vm->invRemove(kItemDiceQuarterHole); @@ -2825,17 +2860,17 @@ void Scene17::updateAnimations() { _vm->_gnapActionStatus = kAS17PutCoinIntoPhoneDone; break; case kAS17PutCoinIntoPhoneDone: - _vm->_gameSys->insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; break; case kAS17GnapUsePhone: - _vm->_gameSys->setAnimation(0x24D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24D, _vm->_gnapId, 0); + gameSys.insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17GnapHangUpPhone: - _vm->_gameSys->insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x258; _vm->_gnapActionStatus = -1; @@ -2846,8 +2881,8 @@ void Scene17::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case kAS17TryGetWrench: _vm->_platypusActionStatus = -1; @@ -2870,8 +2905,8 @@ void Scene17::updateAnimations() { _vm->setGrabCursorSprite(kItemWrench); break; case kAS17PlatUsePhone: - _vm->_gameSys->setAnimation(0x24E, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24E, _vm->_platypusId, 1); + gameSys.insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x24E; _vm->_platypusActionStatus = kAS17LeaveScene; @@ -2883,7 +2918,7 @@ void Scene17::updateAnimations() { _platPhoneCtr = 0; _nextPhoneSequenceId = -1; _currPhoneSequenceId = -1; - _vm->_gameSys->insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x25B; _vm->_platypusActionStatus = -1; @@ -2892,9 +2927,9 @@ void Scene17::updateAnimations() { updateHotspots(); } else { _nextPhoneSequenceId = kPlatPhoneSequenceIds[_platPhoneCtr]; - _vm->_gameSys->setAnimation(_nextPhoneSequenceId, 254, 1); - _vm->_gameSys->insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextPhoneSequenceId, 254, 1); + gameSys.insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x25A; _currPhoneSequenceId = _nextPhoneSequenceId; @@ -2906,42 +2941,42 @@ void Scene17::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { switch (_nextWrenchSequenceId) { case 0x233: _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(0x243, _vm->_platypusId, + gameSys.insertSequence(0x243, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; _vm->_platypusSequenceId = 0x243; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x243, _vm->_platypusId, 1); + gameSys.setAnimation(0x243, _vm->_platypusId, 1); break; case 0x234: _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(0x242, _vm->_platypusId, + gameSys.insertSequence(0x242, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; _vm->_platypusSequenceId = 0x242; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x242, _vm->_platypusId, 1); + gameSys.setAnimation(0x242, _vm->_platypusId, 1); break; case 0x231: if (_vm->getRandom(2) != 0) _nextCarWindowSequenceId = 0x245; else _nextCarWindowSequenceId = 0x248; - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); break; case 0x232: _nextCarWindowSequenceId = 0x247; - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); break; case 0x22E: case 0x235: @@ -2950,22 +2985,22 @@ void Scene17::updateAnimations() { else _vm->_hotspots[kHS17Wrench]._flags |= SF_DISABLED; _canTryGetWrench = !_canTryGetWrench; - _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextWrenchSequenceId, 40, 2); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; break; case 0x230: if (_vm->_gnapActionStatus == kAS17GetWrenchGnapReady) { - _vm->_gameSys->setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 2); if (_canTryGetWrench) { - _vm->_gameSys->insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = 0x22E; _canTryGetWrench = false; } - _vm->_gameSys->setAnimation(0x23F, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x23F, _vm->_platypusId, + gameSys.setAnimation(0x23F, _vm->_platypusId, 1); + gameSys.insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x23F, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 1; @@ -2978,8 +3013,8 @@ void Scene17::updateAnimations() { break; default: if (_nextWrenchSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextWrenchSequenceId, 40, 2); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; } @@ -2987,51 +3022,51 @@ void Scene17::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextCarWindowSequenceId) { case 0x246: - _vm->_gameSys->setAnimation(_nextCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextCarWindowSequenceId, 40, 3); + gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currCarWindowSequenceId = _nextCarWindowSequenceId; _nextCarWindowSequenceId = -1; break; case 0x245: case 0x247: case 0x248: - _vm->_gameSys->setAnimation(_nextWrenchSequenceId, 40, 2); - _vm->_gameSys->insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(2) != 2) + gameSys.setAnimation(_nextWrenchSequenceId, 40, 2); + gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(2) != 2) update(); - _vm->_gameSys->setAnimation(_nextCarWindowSequenceId, 40, 3); - _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextCarWindowSequenceId, 40, 3); + gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currCarWindowSequenceId = _nextCarWindowSequenceId; _nextCarWindowSequenceId = -1; _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; break; case 0x249: - _vm->_gameSys->setAnimation(0x230, 40, 2); - _vm->_gameSys->setAnimation(0x240, _vm->_platypusId, 1); - _vm->_gameSys->insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x23E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x230, 40, 2); + gameSys.setAnimation(0x240, _vm->_platypusId, 1); + gameSys.insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x23E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x23E; _vm->_gnapSequenceDatNum = 0; _vm->_platypusSequenceId = 0x240; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x24A, 40, 3); - _vm->_gameSys->insertSequence(0x24A, 40, _nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(2) != 2) { + gameSys.setAnimation(0x24A, 40, 3); + gameSys.insertSequence(0x24A, 40, _nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(2) != 2) { update(); - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0x24A, 40, 3); - _vm->_gameSys->insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0x24A, 40, 3); + gameSys.insertSequence(0x24A, 40, 586, 40, kSeqSyncWait, 0, 0, 0); } } - _vm->_gameSys->insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x24B, 40, 3); - _vm->_gameSys->insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x22D, 40, 560, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24B, 40, 3); + gameSys.insertSequence(0x24B, 40, 586, 40, kSeqSyncWait, 0, 0, 0); _currCarWindowSequenceId = 0x24B; _nextCarWindowSequenceId = -1; _currWrenchSequenceId = 0x22D; @@ -3131,6 +3166,8 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, 0x203, 0x204 }; + GameSys& gameSys = *_vm->_gameSys; + int gnapSeqId, gnapId, gnapDatNum, gnapGridX; int clippedX, v12, v5, v10, v11, direction; @@ -3186,7 +3223,7 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnapY)) break; a2 += direction; - _vm->_gameSys->insertSequence(kSequenceIds[seqId], a2, + gameSys.insertSequence(kSequenceIds[seqId], a2, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); gnapSeqId = kSequenceIds[seqId]; @@ -3215,9 +3252,9 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, _vm->_gnapId = 20 * _vm->_gnapY + 1; if (animationIndex >= 0) - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); - _vm->_gameSys->insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); @@ -3226,8 +3263,10 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, } void Scene18::putDownGarbageCan(int animationIndex) { + GameSys& gameSys = *_vm->_gameSys; + if (animationIndex >= 0) { - while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) + while (gameSys.getAnimationStatus(animationIndex) != 2) _vm->gameUpdateTick(); } if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) @@ -3237,37 +3276,39 @@ void Scene18::putDownGarbageCan(int animationIndex) { _vm->clearFlag(kGFPlatyPussDisguised); updateHotspots(); if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) { - _vm->_gameSys->insertSequence(0x107BA, _vm->_gnapId, + gameSys.insertSequence(0x107BA, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7BA; } else { - _vm->_gameSys->insertSequence(0x107B9, _vm->_gnapId, + gameSys.insertSequence(0x107B9, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B9; } _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); - _vm->_gameSys->setAnimation(0x1FA, 19, 4); - _vm->_gameSys->insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) + gameSys.insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + gameSys.setAnimation(0x1FA, 19, 4); + gameSys.insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + while (gameSys.getAnimationStatus(4) != 2) _vm->gameUpdateTick(); } void Scene18::platEndPhoning(bool platFl) { + GameSys& gameSys = *_vm->_gameSys; + if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _platPhoneIter = 0; _platPhoneCtr = 0; _vm->_platypusActionStatus = -1; if (_currPhoneSequenceId != -1) { - _vm->_gameSys->setAnimation(0x21E, 254, 3); - _vm->_gameSys->insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(3) != 2) + gameSys.setAnimation(0x21E, 254, 3); + gameSys.insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); + while (gameSys.getAnimationStatus(3) != 2) _vm->gameUpdateTick(); } - _vm->_gameSys->removeSequence(0x21F, 254, true); - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.removeSequence(0x21F, 254, true); + gameSys.setAnimation(0, 0, 3); _vm->clearFlag(kGFPlatypusTalkingToAssistant); if (platFl) { _vm->_platypusActionStatus = kAS18PlatComesHere; @@ -3307,37 +3348,36 @@ void Scene18::waitForGnapAction() { } void Scene18::run() { + GameSys& gameSys = *_vm->_gameSys; + _cowboyHatSurface = nullptr; _vm->playSound(0x10940, true); _vm->startSoundTimerA(4); - _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->queueInsertDeviceIcon(); - _vm->clearFlag(kGFPlatyPussDisguised); if (!_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFTruckKeysUsed)) { if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gameSys->insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x214, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); _vm->playSound(0x22B, true); } else { - _vm->_gameSys->insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F9, 19, 0, 0, kSeqNone, 0, 0, 0); } } else { - _vm->_gameSys->insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); + gameSys.insertSequence(0x1FA, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gameSys->insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x212, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqLoop, 0, 0, 0); _vm->playSound(0x22B, true); } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x20E, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x217, 39, 0, 0, kSeqLoop, 0, 0, 0); _vm->playSound(0x22B, true); } } @@ -3349,7 +3389,7 @@ void Scene18::run() { _vm->initGnapPos(4, 7, kDirBottomRight); _platPhoneCtr = _vm->getRandom(5); if (_vm->isFlag(kGFUnk27)) { - _vm->_gameSys->insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _currPhoneSequenceId = -1; platEndPhoning(true); @@ -3357,15 +3397,15 @@ void Scene18::run() { } else { _currPhoneSequenceId = kScene18SequenceIds[_platPhoneCtr]; _platPhoneIter = 0; - _vm->_gameSys->insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x21F, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); } if (_vm->isFlag(kGFUnk27)) { platEndPhoning(true); _vm->clearFlag(kGFUnk27); } else { - _vm->_gameSys->setAnimation(_currPhoneSequenceId, 254, 3); + gameSys.setAnimation(_currPhoneSequenceId, 254, 3); } _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { @@ -3741,9 +3781,9 @@ void Scene18::run() { _vm->_timers[5] = _vm->getRandom(100) + 100; if (_vm->_gnapActionStatus < 0) { if (_vm->getRandom(2) == 1) - _vm->_gameSys->insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x221, 255, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundA(); @@ -3768,31 +3808,33 @@ void Scene18::run() { } void Scene18::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS18GrabGarbageCanFromStreet: if (_vm->_gnapIdleFacing != kDirUpRight && _vm->_gnapIdleFacing != kDirBottomRight) { - _vm->_gameSys->insertSequence(0x1FC, _vm->_gnapId, + gameSys.insertSequence(0x1FC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - 675, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FC; } else { - _vm->_gameSys->insertSequence(0x1FD, _vm->_gnapId, + gameSys.insertSequence(0x1FD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - 525, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FD; } - _vm->_gameSys->removeSequence(0x1FA, 19, true); + gameSys.removeSequence(0x1FA, 19, true); _vm->setFlag(kGFPlatyPussDisguised); updateHotspots(); _vm->_gnapActionStatus = -1; break; case kAS18GrabGarbageCanFromHydrant: - _vm->_gameSys->insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x1F9, 19, true); + gameSys.insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x1F9, 19, true); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FE; _vm->clearFlag(kGFTruckKeysUsed); @@ -3801,10 +3843,10 @@ void Scene18::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS18CloseRightValveNoGarbageCan: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20D, 39, true); - _vm->_gameSys->removeSequence(0x212, 39, true); - _vm->_gameSys->removeSequence(0x211, 39, true); + gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x20D, 39, true); + gameSys.removeSequence(0x212, 39, true); + gameSys.removeSequence(0x211, 39, true); _vm->stopSound(0x22B); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x205; @@ -3819,7 +3861,7 @@ void Scene18::updateAnimations() { updateHotspots(); _vm->playGnapPullOutDevice(2, 7); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BB, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; @@ -3827,15 +3869,15 @@ void Scene18::updateAnimations() { break; case kAS18OpenTopValveDone: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->removeSequence(0x20C, 19, true); - _vm->_gameSys->setAnimation(0x217, 39, 5); - _vm->_gameSys->insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) + gameSys.insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); + gameSys.removeSequence(0x20C, 19, true); + gameSys.setAnimation(0x217, 39, 5); + gameSys.insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(5) != 2) _vm->gameUpdateTick(); _vm->playSound(0x22B, true); - _vm->_gameSys->insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x208; _vm->invRemove(kItemWrench); @@ -3843,10 +3885,10 @@ void Scene18::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS18CloseTopValve: - _vm->_gameSys->insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20E, 39, true); - _vm->_gameSys->removeSequence(0x216, 39, true); - _vm->_gameSys->removeSequence(0x217, 39, true); + gameSys.insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x20E, 39, true); + gameSys.removeSequence(0x216, 39, true); + gameSys.removeSequence(0x217, 39, true); _vm->stopSound(0x22B); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x206; @@ -3857,8 +3899,8 @@ void Scene18::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS18GrabCowboyHat: - _vm->_gameSys->setAnimation(0x200, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x200, _vm->_gnapId, 0); + gameSys.insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x200; _vm->_gnapActionStatus = kAS18GrabCowboyHatDone; @@ -3867,9 +3909,9 @@ void Scene18::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _cowboyHatSurface = _vm->addFullScreenSprite(0x1D2, 255); - _vm->_gameSys->setAnimation(0x218, 256, 0); - _vm->_gameSys->insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0x218, 256, 0); + gameSys.insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->_newSceneNum = 18; _vm->invAdd(kItemCowboyHat); @@ -3889,27 +3931,27 @@ void Scene18::updateAnimations() { case kAS18PutGarbageCanOnRunningHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatyPussDisguised); - _vm->_gameSys->requestRemoveSequence(0x211, 39); - _vm->_gameSys->requestRemoveSequence(0x212, 39); - _vm->_gameSys->insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.requestRemoveSequence(0x211, 39); + gameSys.requestRemoveSequence(0x212, 39); + gameSys.insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); - _vm->_gameSys->setAnimation(0x210, _vm->_gnapId, 0); + gameSys.setAnimation(0x210, _vm->_gnapId, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x210; _vm->_gnapActionStatus = kAS18PutGarbageCanOnRunningHydrant2; break; case kAS18PutGarbageCanOnRunningHydrant2: _vm->playSound(0x22B, true); - _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FF, _vm->_gnapId, 0); + gameSys.insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FF; _vm->_sceneWaiting = true; _vm->_gnapActionStatus = kAS18StandingOnHydrant; break; case kAS18StandingOnHydrant: - _vm->_gameSys->setAnimation(0x1FF, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FF, _vm->_gnapId, 0); + gameSys.insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); break; case kAS18OpenRightValveNoGarbageCan: case kAS18OpenRightValveWithGarbageCan: @@ -3917,7 +3959,7 @@ void Scene18::updateAnimations() { updateHotspots(); _vm->playGnapPullOutDevice(2, 7); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; @@ -3928,16 +3970,16 @@ void Scene18::updateAnimations() { break; case kAS18OpenRightValveWithGarbageCanDone: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->requestRemoveSequence(0x1F9, 19); - _vm->_gameSys->removeSequence(0x20B, 19, true); - _vm->_gameSys->setAnimation(0x213, 39, 5); - _vm->_gameSys->insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) + gameSys.insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); + gameSys.requestRemoveSequence(0x1F9, 19); + gameSys.removeSequence(0x20B, 19, true); + gameSys.setAnimation(0x213, 39, 5); + gameSys.insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(5) != 2) _vm->gameUpdateTick(); _vm->playSound(555, true); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x207; _vm->invRemove(kItemWrench); @@ -3945,31 +3987,31 @@ void Scene18::updateAnimations() { break; case kAS18OpenRightValveNoGarbageCanDone: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); - _vm->_gameSys->removeSequence(0x20B, 19, true); - _vm->_gameSys->setAnimation(0x211, 39, 5); - _vm->_gameSys->insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(5) != 2) + gameSys.insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); + gameSys.removeSequence(0x20B, 19, true); + gameSys.setAnimation(0x211, 39, 5); + gameSys.insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(5) != 2) _vm->gameUpdateTick(); _vm->playSound(0x22B, true); - _vm->_gameSys->insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x207; _vm->invRemove(kItemWrench); _vm->_gnapActionStatus = -1; break; case kAS18CloseRightValveWithGarbageCan: - _vm->_gameSys->insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x20D, 39, true); - _vm->_gameSys->insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x20D, 39, true); + gameSys.insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); - _vm->_gameSys->setAnimation(0x1F9, 19, 0); - _vm->_gameSys->insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1F9, 19, 0); + gameSys.insertSequence(0x1F9, 19, 0x215, 39, kSeqSyncWait, 0, 0, 0); _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); updateHotspots(); _vm->_gnapSequenceDatNum = 1; _vm->_gnapSequenceId = 0x7B5; @@ -3981,29 +4023,29 @@ void Scene18::updateAnimations() { case kAS18PutGarbageCanOnHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatyPussDisguised); - _vm->_gameSys->insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x20F, _vm->_gnapId, 0); + gameSys.insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x20F, _vm->_gnapId, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x20F; _vm->_gnapActionStatus = kAS18PutGarbageCanOnHydrantDone; break; case kAS18PutGarbageCanOnHydrantDone: - _vm->_gameSys->insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); updateHotspots(); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { - _vm->_gameSys->setAnimation(0, 0, 3); + if (gameSys.getAnimationStatus(3) == 2) { + gameSys.setAnimation(0, 0, 3); ++_platPhoneIter; if (_platPhoneIter <= 4) { ++_platPhoneCtr; _nextPhoneSequenceId = kScene18SequenceIds[_platPhoneCtr % 5]; - _vm->_gameSys->setAnimation(_nextPhoneSequenceId, 254, 3); - _vm->_gameSys->insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextPhoneSequenceId, 254, 3); + gameSys.insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x21F, 254, 0x21F, 254, kSeqSyncWait, 0, 0, 0); _currPhoneSequenceId = _nextPhoneSequenceId; } else { platEndPhoning(true); @@ -4067,24 +4109,25 @@ void Scene19::updateHotspots() { } void Scene19::run() { - _vm->queueInsertDeviceIcon(); + GameSys& gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); _toyGrabCtr = 0; - _pictureSurface = 0; + _pictureSurface = nullptr; - _vm->_gameSys->insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x74, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x75, 254, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFPictureTaken)) - _vm->_gameSys->insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _vm->initGnapPos(3, 6, kDirBottomRight); _currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; _nextShopAssistantSequenceId = _currShopAssistantSequenceId; - _vm->_gameSys->setAnimation(_currShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(0x6E, 254, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _shopAssistantCtr = 0; _vm->endSceneInit(); _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); @@ -4092,8 +4135,8 @@ void Scene19::run() { } else { _currShopAssistantSequenceId = 0x6D; _nextShopAssistantSequenceId = -1; - _vm->_gameSys->setAnimation(0x6D, 20, 4); - _vm->_gameSys->insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x6D, 20, 4); + gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(40) + 50; _vm->initGnapPos(3, 6, kDirBottomRight); _vm->initPlatypusPos(4, 6, kDirNone); @@ -4308,8 +4351,10 @@ void Scene19::run() { } void Scene19::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS19UsePhone: _nextShopAssistantSequenceId = 0x67; @@ -4334,8 +4379,8 @@ void Scene19::updateAnimations() { case kAS19GrabPicture: _vm->playGnapPullOutDevice(6, 2); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x68, 19, 0); - _vm->_gameSys->insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x68, 19, 0); + gameSys.insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemPicture); _vm->setFlag(kGFPictureTaken); updateHotspots(); @@ -4345,9 +4390,9 @@ void Scene19::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->hideCursor(); _pictureSurface = _vm->addFullScreenSprite(0xF, 255); - _vm->_gameSys->setAnimation(0x61, 256, 0); - _vm->_gameSys->insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + gameSys.setAnimation(0x61, 256, 0); + gameSys.insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) { // checkGameAppStatus(); _vm->gameUpdateTick(); } @@ -4368,7 +4413,7 @@ void Scene19::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { switch (_nextShopAssistantSequenceId) { case 0x6F: case 0x70: @@ -4377,16 +4422,16 @@ void Scene19::updateAnimations() { case 0x73: _shopAssistantCtr = (_shopAssistantCtr + 1) % 5; _nextShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_shopAssistantCtr]; - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x6E, 254, 0x6E, 254, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; break; case 0x62: case 0x66: case 0x6B: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_timers[5] = 10; @@ -4397,32 +4442,32 @@ void Scene19::updateAnimations() { _vm->_gnapActionStatus = -1; break; case 0x67: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_gnapActionStatus = -1; break; case 0x65: _vm->playGnapIdle(6, 2); - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 0); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 0); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_newSceneNum = 18; _vm->_gnapActionStatus = kAS19LeaveScene; break; case 0x6D: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextShopAssistantSequenceId), 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x69, 19, 0x69, 19, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextShopAssistantSequenceId), 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; break; case 0x64: case 0x6C: - _vm->_gameSys->setAnimation(_nextShopAssistantSequenceId, 20, 4); - _vm->_gameSys->insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); + gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; break; @@ -4430,5 +4475,4 @@ void Scene19::updateAnimations() { } } - } // End of namespace Gnap diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 98b6752afe..df3fbf4a83 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -54,12 +54,14 @@ void Scene20::updateHotspots() { } void Scene20::updateAnimationsCb() { - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(2) == 2) { switch (_nextStonerGuySequenceId) { case 0x16B: if (!_vm->_timers[4]) { _stonerGuyShowingJoint = false; - _vm->_gameSys->insertSequence(0x16B, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x16B, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16B; _nextStonerGuySequenceId = -1; } @@ -68,8 +70,8 @@ void Scene20::updateAnimationsCb() { // Grab joint _vm->playGnapPullOutDevice(4, 4); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x16A, 21, 0); - _vm->_gameSys->insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16A, 21, 0); + gameSys.insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16A; _nextStonerGuySequenceId = -1; _vm->invAdd(kItemJoint); @@ -78,25 +80,25 @@ void Scene20::updateAnimationsCb() { _vm->_gnapActionStatus = kAS20GrabJointDone; break; case 0x16E: - _vm->_gameSys->setAnimation(0x16E, 21, 2); - _vm->_gameSys->insertSequence(0x16E, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16E, 21, 2); + gameSys.insertSequence(0x16E, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16E; _nextStonerGuySequenceId = -1; _nextGroceryStoreGuySequenceId = 0x175; break; case 0x16D: - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 0); - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 0); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = _nextStonerGuySequenceId; _nextStonerGuySequenceId = -1; _vm->_gnapActionStatus = kAS20ActionDone; break; case 0x16F: - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); - _vm->_gameSys->setAnimation(0x17A, 20, 3); - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17A, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); + gameSys.setAnimation(0x17A, 20, 3); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17A, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = 0x17A; _nextGroceryStoreGuySequenceId = -1; _currStonerGuySequenceId = _nextStonerGuySequenceId; @@ -118,10 +120,10 @@ void Scene20::updateAnimationsCb() { _nextStonerGuySequenceId = 0x171; break; } - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17C, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->setAnimation(_nextStonerGuySequenceId, 21, 2); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17C, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x17C, 20, 3); + gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); _currGroceryStoreGuySequenceId = 0x17C; _nextGroceryStoreGuySequenceId = -1; _currStonerGuySequenceId = _nextStonerGuySequenceId; @@ -129,8 +131,8 @@ void Scene20::updateAnimationsCb() { break; default: _nextStonerGuySequenceId = 0x16C; - _vm->_gameSys->setAnimation(0x16C, 21, 2); - _vm->_gameSys->insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16C, 21, 2); + gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = _nextStonerGuySequenceId; _nextStonerGuySequenceId = -1; break; @@ -155,6 +157,8 @@ void Scene20::stopSounds() { } void Scene20::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -175,30 +179,30 @@ void Scene20::run() { } _nextStonerGuySequenceId = -1; - _vm->_gameSys->setAnimation(_currStonerGuySequenceId, 21, 2); - _vm->_gameSys->insertSequence(_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currStonerGuySequenceId, 21, 2); + gameSys.insertSequence(_currStonerGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(20) + 30; _currGroceryStoreGuySequenceId = 0x17C; _nextGroceryStoreGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x17C, 20, 3); - _vm->_gameSys->insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x17C, 20, 3); + gameSys.insertSequence(0x17C, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[5] = _vm->getRandom(50) + 130; if (_vm->isFlag(kGFGroceryStoreHatTaken)) - _vm->_gameSys->insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x17F, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x174, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFSceneFlag1)) { _vm->clearFlag(kGFSceneFlag1); _vm->endSceneInit(); - _vm->_gameSys->setAnimation(0x182, 140, 0); - _vm->_gameSys->insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + gameSys.setAnimation(0x182, 140, 0); + gameSys.insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) { // checkGameAppStatus(); _vm->gameUpdateTick(); } @@ -484,13 +488,13 @@ void Scene20::run() { if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { switch (_vm->getRandom(3)) { case 0: - _vm->_gameSys->insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x184, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x185, 253, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -510,17 +514,19 @@ void Scene20::run() { } void Scene20::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS20LeaveScene: _vm->_sceneDone = true; break; case kAS20TalkStonerGuyNoJoint: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -531,11 +537,11 @@ void Scene20::updateAnimations() { _vm->_timers[6] = 100; break; case kAS20TalkStonerGuyHasJoint: - _vm->_gameSys->setAnimation(0x168, 21, 2); - _vm->_gameSys->setAnimation(379, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x168, 21, 2); + gameSys.setAnimation(379, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -555,10 +561,10 @@ void Scene20::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS20TalkGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -572,10 +578,10 @@ void Scene20::updateAnimations() { _vm->_timers[6] = 100; break; case kAS20GrabGroceryStoreGuy: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -585,10 +591,10 @@ void Scene20::updateAnimations() { _nextGroceryStoreGuySequenceId = 0x178; break; case kAS20GrabGroceryStoreHat: - _vm->_gameSys->setAnimation(0x170, 21, 2); - _vm->_gameSys->setAnimation(0x17B, 20, 3); - _vm->_gameSys->insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(0x170, 21, 2); + gameSys.setAnimation(0x17B, 20, 3); + gameSys.insertSequence(0x17B, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x170, 21, _currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _vm->stopSound(0x1A1); stopSounds(); _currGroceryStoreGuySequenceId = 0x17B; @@ -597,8 +603,8 @@ void Scene20::updateAnimations() { break; case kAS20SwitchGroceryStoreHat: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x180, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x180, _vm->_gnapId, 0); + gameSys.insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x180; _vm->_gnapSequenceDatNum = 0; _vm->invRemove(kItemCowboyHat); @@ -606,14 +612,14 @@ void Scene20::updateAnimations() { _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHatDone; break; case kAS20SwitchGroceryStoreHatDone: - _vm->_gameSys->insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); _vm->setFlag(kGFGroceryStoreHatTaken); _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0x12C, 255); - _vm->_gameSys->setAnimation(0x181, 256, 0); - _vm->_gameSys->insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0x181, 256, 0); + gameSys.insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); @@ -629,41 +635,41 @@ void Scene20::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextGroceryStoreGuySequenceId) { case 0x176: case 0x177: - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = 0x16D; break; case 0x178: - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x17D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.setAnimation(0x17D, _vm->_gnapId, 0); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x17D; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS20ActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16D, 21, 2); + gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; _currGroceryStoreGuySequenceId = 0x178; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = -1; break; case 0x179: - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->setAnimation(0x16D, 21, 0); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.setAnimation(0x16D, 21, 0); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x17E; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS20ActionDone; - _vm->_gameSys->setAnimation(0x16D, 21, 2); - _vm->_gameSys->insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x16D, 21, 2); + gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; _currGroceryStoreGuySequenceId = 377; _nextGroceryStoreGuySequenceId = -1; @@ -671,25 +677,25 @@ void Scene20::updateAnimations() { _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); break; case 0x17C: - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 3); _nextStonerGuySequenceId = 0x171; break; case 0x17A: - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 3); _nextStonerGuySequenceId = 0x16F; break; case 0x175: - _vm->_gameSys->setAnimation(0x175, 20, 0); - _vm->_gameSys->setAnimation(0x175, 20, 3); - _vm->_gameSys->insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x175, 20, 0); + gameSys.setAnimation(0x175, 20, 3); + gameSys.insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = 0x175; _nextGroceryStoreGuySequenceId = -1; _vm->_gnapActionStatus = kAS20ActionDone; break; default: if (_nextGroceryStoreGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - _vm->_gameSys->insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); + gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = _nextGroceryStoreGuySequenceId; _nextGroceryStoreGuySequenceId = -1; } @@ -709,6 +715,7 @@ Scene21::Scene21(GnapEngine *vm) : Scene(vm) { int Scene21::init() { _vm->_gameSys->setAnimation(0, 0, 3); + return _vm->isFlag(kGFTwigTaken) ? 0x94 : 0x93; } @@ -728,27 +735,27 @@ void Scene21::updateHotspots() { } void Scene21::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(6); - _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { _vm->initGnapPos(5, 8, kDirBottomRight); _vm->initPlatypusPos(6, 8, kDirNone); - _vm->_gameSys->insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->clearFlag(kGFKeysTaken); } else { _vm->initGnapPos(5, 11, kDirBottomRight); _vm->initPlatypusPos(6, 11, kDirNone); if (!_vm->isFlag(kGFUnk04)) - _vm->_gameSys->insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -757,8 +764,8 @@ void Scene21::run() { _vm->initGnapPos(5, 11, kDirBottomRight); _vm->initPlatypusPos(6, 11, kDirNone); _currOldLadySequenceId = 0x89; - _vm->_gameSys->setAnimation(0x89, 79, 3); - _vm->_gameSys->insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x89, 79, 3); + gameSys.insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); _nextOldLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); @@ -911,7 +918,7 @@ void Scene21::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 100; - _vm->_gameSys->insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x92, 255, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundA(); } @@ -929,16 +936,18 @@ void Scene21::run() { } void Scene21::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS21TalkOldLady: _nextOldLadySequenceId = 0x8B; _vm->_gnapActionStatus = -1; break; case kAS21GrabBanana: - _vm->_gameSys->setAnimation(0x8C, 59, 0); - _vm->_gameSys->insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x8C, 59, 0); + gameSys.insertSequence(0x8C, 59, 141, 59, kSeqSyncWait, 0, 0, 0); _vm->setFlag(kGFUnk04); _vm->invAdd(kItemBanana); updateHotspots(); @@ -953,8 +962,8 @@ void Scene21::updateAnimations() { _nextOldLadySequenceId = 0x87; break; case kAS21UseHatWithOldLady: - _vm->_gameSys->setAnimation(0x8F, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x8F, _vm->_gnapId, 0); + gameSys.insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x8F; _vm->_gnapActionStatus = kAS21UseHatWithOldLadyDone; @@ -971,25 +980,25 @@ void Scene21::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextOldLadySequenceId != -1) { + if (gameSys.getAnimationStatus(3) == 2 && _nextOldLadySequenceId != -1) { if (_nextOldLadySequenceId == 0x87) { - _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextOldLadySequenceId, 79, 3); + gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x86; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else if (_nextOldLadySequenceId == 0x91) { - _vm->_gameSys->setAnimation(0x91, 79, 0); - _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x91, 79, 0); + gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS21LeaveScene; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else { - _vm->_gameSys->setAnimation(_nextOldLadySequenceId, 79, 3); - _vm->_gameSys->insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextOldLadySequenceId, 79, 3); + gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } @@ -1019,13 +1028,15 @@ void Scene22::updateHotspots() { } void Scene22::run() { - _vm->_gameSys->insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); _currCashierSequenceId = 0x59; _nextCashierSequenceId = -1; - _vm->_gameSys->setAnimation(0x59, 1, 3); - _vm->_gameSys->insertSequence(_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x59, 1, 3); + gameSys.insertSequence(_currCashierSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(30) + 20; @@ -1063,12 +1074,12 @@ void Scene22::run() { _caughtBefore = true; storeDetectiveSeqId = 0x54; } - _vm->_gameSys->waitForUpdate(); - _vm->_gameSys->requestClear1(); - _vm->_gameSys->drawSpriteToBackground(0, 0, 0x44); - _vm->_gameSys->setAnimation(storeDetectiveSeqId, 256, 4); - _vm->_gameSys->insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(4) != 2) { + gameSys.waitForUpdate(); + gameSys.requestClear1(); + gameSys.drawSpriteToBackground(0, 0, 0x44); + gameSys.setAnimation(storeDetectiveSeqId, 256, 4); + gameSys.insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(4) != 2) { _vm->gameUpdateTick(); } _vm->_sceneDone = true; @@ -1224,8 +1235,10 @@ void Scene22::run() { } void Scene22::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS22LeaveScene: _vm->_sceneDone = true; @@ -1237,9 +1250,9 @@ void Scene22::updateAnimations() { _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextCashierSequenceId, 1, 3); - _vm->_gameSys->insertSequence(_nextCashierSequenceId, 1, _currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { + gameSys.setAnimation(_nextCashierSequenceId, 1, 3); + gameSys.insertSequence(_nextCashierSequenceId, 1, _currCashierSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currCashierSequenceId = _nextCashierSequenceId; _nextCashierSequenceId = -1; } @@ -1267,21 +1280,23 @@ void Scene23::updateHotspots() { } void Scene23::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->_timers[4] = _vm->getRandom(100) + 200; _vm->_timers[5] = _vm->getRandom(100) + 200; _currStoreClerkSequenceId = 0xB4; _nextStoreClerkSequenceId = -1; - _vm->_gameSys->setAnimation(0xB4, 1, 4); - _vm->_gameSys->insertSequence(_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0xB4, 1, 4); + gameSys.insertSequence(_currStoreClerkSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->queueInsertDeviceIcon(); _vm->initGnapPos(-1, 7, kDirBottomRight); _vm->initPlatypusPos(-2, 7, kDirNone); - _vm->_gameSys->insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); @@ -1290,7 +1305,7 @@ void Scene23::run() { _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); } else { _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); _vm->setFlag(kGFUnk24); @@ -1408,14 +1423,14 @@ void Scene23::run() { _vm->_timers[4] = _vm->getRandom(100) + 200; switch (_vm->getRandom(4)) { case 0: - _vm->_gameSys->insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xB7, 256, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xB8, 256, 0, 0, kSeqNone, 0, 0, 0); break; case 2: case 3: - _vm->_gameSys->insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xB9, 256, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -1448,17 +1463,19 @@ void Scene23::run() { } void Scene23::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS23LookCereals: _vm->showFullScreenSprite(0x48); _vm->_gnapActionStatus = -1; break; case kAS23GrabCereals: - _vm->_gameSys->setAnimation(0xBE, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->requestRemoveSequence(0xBF, 2); + gameSys.setAnimation(0xBE, _vm->_gnapId, 0); + gameSys.insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.requestRemoveSequence(0xBF, 2); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0xBE; _vm->_gnapActionStatus = kAS23GrabCerealsDone; @@ -1473,7 +1490,7 @@ void Scene23::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _nextStoreClerkSequenceId == -1) { + if (gameSys.getAnimationStatus(4) == 2 && _nextStoreClerkSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: case 1: @@ -1489,8 +1506,8 @@ void Scene23::updateAnimations() { _nextStoreClerkSequenceId = 0xB6; break; } - _vm->_gameSys->setAnimation(_nextStoreClerkSequenceId, 1, 4); - _vm->_gameSys->insertSequence(_nextStoreClerkSequenceId, 1, _currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextStoreClerkSequenceId, 1, 4); + gameSys.insertSequence(_nextStoreClerkSequenceId, 1, _currStoreClerkSequenceId, 1, kSeqSyncWait, 0, 0, 0); _currStoreClerkSequenceId = _nextStoreClerkSequenceId; _nextStoreClerkSequenceId = -1; } @@ -1521,6 +1538,7 @@ void Scene24::updateHotspots() { } void Scene24::run() { + GameSys& gameSys = *_vm->_gameSys; int counter = 0; _vm->playSound(0x10940, true); @@ -1528,15 +1546,15 @@ void Scene24::run() { _vm->_timers[7] = _vm->getRandom(100) + 100; - _vm->_gameSys->insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x2F, 256, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(20) + 50; _vm->_timers[5] = _vm->getRandom(20) + 40; _vm->_timers[6] = _vm->getRandom(50) + 30; - _vm->_gameSys->insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x36, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x30, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x35, 20, 0, 0, kSeqNone, 0, 0, 0); _currWomanSequenceId = 0x35; _girlSequenceId = 0x36; @@ -1651,12 +1669,12 @@ void Scene24::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 50; - _vm->_gameSys->insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); _girlSequenceId = 0x37; } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 40; - _vm->_gameSys->insertSequence(0x31, 20, _boySequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x31, 20, _boySequenceId, 20, kSeqSyncWait, 0, 0, 0); _boySequenceId = 0x31; } if (!_vm->_timers[6]) { @@ -1673,20 +1691,20 @@ void Scene24::run() { _nextWomanSequenceId = 0x34; break; } - _vm->_gameSys->insertSequence(_nextWomanSequenceId, 20, _currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextWomanSequenceId, 20, _currWomanSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currWomanSequenceId = _nextWomanSequenceId; } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; switch (_vm->getRandom(3)) { case 0: - _vm->_gameSys->insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x38, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 1: - _vm->_gameSys->insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x39, 253, 0, 0, kSeqNone, 0, 0, 0); break; case 2: - _vm->_gameSys->insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x3A, 253, 0, 0, kSeqNone, 0, 0, 0); break; } } @@ -1707,8 +1725,10 @@ void Scene24::run() { } void Scene24::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS24LeaveScene) _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; @@ -1745,23 +1765,25 @@ void Scene25::playAnims(int index) { if (index > 4) return; + GameSys& gameSys = *_vm->_gameSys; + _vm->hideCursor(); _vm->setGrabCursorSprite(-1); switch (index) { case 1: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x25); + _vm->_largeSprite = gameSys.createSurface(0x25); break; case 2: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x26); + _vm->_largeSprite = gameSys.createSurface(0x26); break; case 3: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x27); + _vm->_largeSprite = gameSys.createSurface(0x27); break; case 4: - _vm->_largeSprite = _vm->_gameSys->createSurface(0x28); + _vm->_largeSprite = gameSys.createSurface(0x28); break; } - _vm->_gameSys->insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); + gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); _vm->delayTicksCursor(5); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) { @@ -1771,19 +1793,21 @@ void Scene25::playAnims(int index) { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(29); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->_gameSys->removeSpriteDrawItem(_vm->_largeSprite, 300); + gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->delayTicksCursor(5); _vm->deleteSurface(&_vm->_largeSprite); _vm->showCursor(); } void Scene25::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x10940, true); _vm->startSoundTimerA(5); _currTicketVendorSequenceId = 0x52; - _vm->_gameSys->setAnimation(0x52, 39, 3); - _vm->_gameSys->insertSequence(_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x52, 39, 3); + gameSys.insertSequence(_currTicketVendorSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _nextTicketVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -2005,8 +2029,10 @@ void Scene25::run() { } void Scene25::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS25TalkTicketVendor: _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; @@ -2014,10 +2040,10 @@ void Scene25::updateAnimations() { break; case kAS25EnterCircusWihoutTicket: _nextTicketVendorSequenceId = 0x5E; - _vm->_gameSys->setAnimation(0x5E, 39, 0); - _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x5E, 39, 0); + gameSys.setAnimation(_nextTicketVendorSequenceId, 39, 3); + gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; @@ -2033,8 +2059,8 @@ void Scene25::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemTickets); _vm->setFlag(kGFNeedleTaken); - _vm->_gameSys->setAnimation(0x61, 40, 0); - _vm->_gameSys->insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x61, 40, 0); + gameSys.insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = kAS25ShowTicketToVendorDone; break; case kAS25ShowTicketToVendorDone: @@ -2046,15 +2072,15 @@ void Scene25::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { if (_nextTicketVendorSequenceId == 0x53) { - _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextTicketVendorSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextTicketVendorSequenceId, 39, 3); - _vm->_gameSys->insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTicketVendorSequenceId, 39, 3); + gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; } @@ -2086,13 +2112,15 @@ void Scene26::updateHotspots() { } void Scene26::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->startSoundTimerB(7); _vm->playSound(0x1093B, true); _currKidSequenceId = 0x5B; _nextKidSequenceId = -1; - _vm->_gameSys->setAnimation(0x5B, 160, 3); - _vm->_gameSys->insertSequence(_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x5B, 160, 3); + gameSys.insertSequence(_currKidSequenceId, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[5] = _vm->getRandom(20) + 50; _vm->_timers[4] = _vm->getRandom(20) + 50; @@ -2100,10 +2128,10 @@ void Scene26::run() { _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x58, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x5C, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x5D, 40, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 25) { _vm->initGnapPos(-1, 8, kDirBottomRight); @@ -2234,11 +2262,11 @@ void Scene26::run() { } if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 130; - _vm->_gameSys->insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x59, 40, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(50) + 100; - _vm->_gameSys->insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x5F, 40, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundB(); } @@ -2256,16 +2284,18 @@ void Scene26::run() { } void Scene26::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS26LeaveScene) _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextKidSequenceId, 160, _currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextKidSequenceId, 160, 3); + if (gameSys.getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { + gameSys.insertSequence(_nextKidSequenceId, 160, _currKidSequenceId, 160, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 160, 3); _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; } @@ -2298,23 +2328,25 @@ void Scene27::updateHotspots() { } void Scene27::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093B, true); _vm->startSoundTimerB(4); _vm->_timers[7] = _vm->getRandom(100) + 300; _vm->queueInsertDeviceIcon(); if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_debugLevel == 4) _vm->startIdleTimer(6); - _vm->_gameSys->insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); _currJanitorSequenceId = 0xCB; _nextJanitorSequenceId = -1; - _vm->_gameSys->setAnimation(0xCB, 39, 3); + gameSys.setAnimation(0xCB, 39, 3); _vm->_timers[5] = _vm->getRandom(20) + 60; switch (_vm->_prevSceneNum) { @@ -2522,7 +2554,7 @@ void Scene27::run() { if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 300; if (_vm->_gnapActionStatus < 0) - _vm->_gameSys->insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundB(); } @@ -2540,8 +2572,10 @@ void Scene27::run() { } void Scene27::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS27TalkJanitor: switch (_vm->getRandom(3)) { @@ -2562,8 +2596,8 @@ void Scene27::updateAnimations() { _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; _vm->invAdd(kItemEmptyBucket); _vm->setFlag(kGFUnk13); - _vm->_gameSys->setAnimation(0xD2, 39, 0); - _vm->_gameSys->insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xD2, 39, 0); + gameSys.insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS27GrabBucketDone; break; case kAS27GrabBucketDone: @@ -2575,9 +2609,9 @@ void Scene27::updateAnimations() { break; case kAS27TryEnterClownTent: _nextJanitorSequenceId = 0xD1; - _vm->_gameSys->insertSequence(0xD1, 39, _currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + gameSys.insertSequence(0xD1, 39, _currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; _vm->_gnapActionStatus = kAS27TryEnterClownTentDone; @@ -2598,12 +2632,12 @@ void Scene27::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextJanitorSequenceId) { case -1: _nextJanitorSequenceId = 0xCB; - _vm->_gameSys->insertSequence(0xCB, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.insertSequence(0xCB, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; break; @@ -2611,9 +2645,9 @@ void Scene27::updateAnimations() { case 0xCD: case 0xCE: _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; break; @@ -2621,8 +2655,8 @@ void Scene27::updateAnimations() { // Show picture to janitor _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 0); + gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _vm->_gnapActionStatus = kAS27EnterClownTent; _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; @@ -2632,8 +2666,8 @@ void Scene27::updateAnimations() { _vm->_newSceneNum = 28; break; default: - _vm->_gameSys->insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextJanitorSequenceId, 39, 3); + gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; break; @@ -2670,44 +2704,46 @@ void Scene28::updateHotspots() { } void Scene28::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093C, true); _nextClownSequenceId = -1; _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x124, 255, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFUnk22)) - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x112, 99, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFMudTaken)) { if (_vm->isFlag(kGFUnk21)) { - _vm->_gameSys->setAnimation(0x11C, 39, 3); - _vm->_gameSys->insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x11C, 39, 3); + gameSys.insertSequence(0x11C, 39, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->invHas(kItemHorn)) - _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x118, 59, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11C; } else { _currClownSequenceId = 0x11B; - _vm->_gameSys->setAnimation(0x11B, 39, 3); - _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x11B, 39, 3); + gameSys.insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(20) + 80; } _vm->initGnapPos(8, 8, kDirBottomLeft); _vm->initPlatypusPos(9, 8, kDirUnk4); _vm->endSceneInit(); } else { - _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->initGnapPos(8, 8, kDirBottomLeft); _vm->initPlatypusPos(9, 8, kDirUnk4); _vm->endSceneInit(); _vm->playSequences(0xF7, 0x121, 0x122, 0x123); _currClownSequenceId = 0x115; _vm->setFlag(kGFMudTaken); - _vm->_gameSys->setAnimation(0x115, 39, 3); - _vm->_gameSys->insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x115, 39, 3); + gameSys.insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _nextClownSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 80; _vm->_gnapActionStatus = kAS28GnapWaiting; - while (_vm->_gameSys->getAnimationStatus(3) != 2) { + while (gameSys.getAnimationStatus(3) != 2) { _vm->gameUpdateTick(); _vm->updateMouseCursor(); } @@ -2906,8 +2942,10 @@ void Scene28::run() { } void Scene28::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS28UseBeerBucketWithClown: _vm->setFlag(kGFUnk22); @@ -2928,17 +2966,17 @@ void Scene28::updateAnimations() { case kAS28GrabHornSuccess: _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x117, 59, 0); - _vm->_gameSys->insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x117, 59, 0); + gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS28GrabHornSuccessDone; break; case kAS28GrabHornSuccessDone: _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0xF6, 255); - _vm->_gameSys->setAnimation(0x120, 256, 0); - _vm->_gameSys->insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0x120, 256, 0); + gameSys.insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); @@ -2950,8 +2988,8 @@ void Scene28::updateAnimations() { case kAS28GrabEmptyBucket: _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->setAnimation(0x111, 99, 0); - _vm->_gameSys->insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x111, 99, 0); + gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS28GrabEmptyBucketDone; break; case kAS28GrabEmptyBucketDone: @@ -2962,10 +3000,10 @@ void Scene28::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS28GrabHornFailsDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _vm->_gameSys->insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; _vm->_gnapActionStatus = -1; @@ -2989,25 +3027,25 @@ void Scene28::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextClownSequenceId) { case 0x113: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 0); + gameSys.insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + gameSys.insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; _vm->_gnapActionStatus = kAS28GnapWaiting; break; case 0x116: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); - _vm->_gameSys->insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x11C, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 0); + gameSys.insertSequence(0x112, 99, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); + gameSys.insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x11C, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); _currClownSequenceId = _nextClownSequenceId; _nextClownSequenceId = -1; _vm->_gnapActionStatus = kAS28GnapWaiting; @@ -3018,9 +3056,9 @@ void Scene28::updateAnimations() { _vm->_gnapActionStatus = -1; break; case 0x119: - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 0); - _vm->_gameSys->removeSequence(_currClownSequenceId, 39, true); + gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 0); + gameSys.removeSequence(_currClownSequenceId, 39, true); _vm->_gnapActionStatus = kAS28GrabHornFailsDone; _vm->_gnapSequenceId = _nextClownSequenceId; _vm->_gnapSequenceDatNum = 0; @@ -3028,8 +3066,8 @@ void Scene28::updateAnimations() { break; } if (_nextClownSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClownSequenceId, 39, 3); + gameSys.insertSequence(_nextClownSequenceId, 39, _currClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClownSequenceId, 39, 3); _currClownSequenceId = _nextClownSequenceId; _nextClownSequenceId = -1; } @@ -3063,6 +3101,8 @@ void Scene29::updateHotspots() { } void Scene29::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); _vm->queueInsertDeviceIcon(); @@ -3070,22 +3110,22 @@ void Scene29::run() { if (_vm->invHas(kItemHorn)) { _currMonkeySequenceId = 0xE8; _nextMonkeySequenceId = -1; - _vm->_gameSys->setAnimation(0xE8, 159, 4); - _vm->_gameSys->insertSequence(_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0xE8, 159, 4); + gameSys.insertSequence(_currMonkeySequenceId, 159, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); _currManSequenceId = 0xED; _nextManSequenceId = -1; - _vm->_gameSys->setAnimation(0xED, 39, 3); + gameSys.setAnimation(0xED, 39, 3); _vm->_timers[4] = _vm->getRandom(20) + 60; } else { - _vm->_gameSys->insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->_gameSys->insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 3); + gameSys.insertSequence(0xF4, 19, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0, 0, 4); + gameSys.insertSequence(0xED, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0, 0, 3); } - _vm->_gameSys->insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0xF3, 39, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 27) { _vm->initGnapPos(12, 7, kDirBottomRight); @@ -3279,8 +3319,10 @@ void Scene29::run() { } void Scene29::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS29UseBananaWithMonkey: _nextMonkeySequenceId = 0xE5; @@ -3291,22 +3333,22 @@ void Scene29::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextManSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextManSequenceId, 39, _currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextManSequenceId, 39, 3); + if (gameSys.getAnimationStatus(3) == 2 && _nextManSequenceId != -1) { + gameSys.insertSequence(_nextManSequenceId, 39, _currManSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextManSequenceId, 39, 3); _currManSequenceId = _nextManSequenceId; _nextManSequenceId = -1; } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { if (_nextMonkeySequenceId == 0xE5) { - _vm->_gameSys->insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0xF2; - _vm->_gameSys->setAnimation(0xE6, 159, 0); - _vm->_gameSys->setAnimation(0, 159, 4); - _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xE6, 159, 0); + gameSys.setAnimation(0, 159, 4); + gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS29LeaveScene; _currMonkeySequenceId = 0xE6; _nextMonkeySequenceId = -1; @@ -3314,7 +3356,7 @@ void Scene29::updateAnimations() { while (_vm->_timers[5]) _vm->gameUpdateTick(); _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); - while (_vm->_gameSys->getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); } else if (_nextMonkeySequenceId == -1) { switch (_vm->getRandom(6)) { @@ -3337,13 +3379,13 @@ void Scene29::updateAnimations() { _nextMonkeySequenceId = 0xE7; break; } - _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextMonkeySequenceId, 159, 4); _currMonkeySequenceId = _nextMonkeySequenceId; _nextMonkeySequenceId = -1; } else { - _vm->_gameSys->insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextMonkeySequenceId, 159, 4); + gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextMonkeySequenceId, 159, 4); _currMonkeySequenceId = _nextMonkeySequenceId; _nextMonkeySequenceId = -1; } diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 6d31df8b8a..7526a9d71c 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -45,6 +45,7 @@ void Scene30::updateHotspots() { } void Scene30::run() { + GameSys& gameSys = *_vm->_gameSys; bool hasTakenPill = false; _vm->playSound(0x1093B, true); @@ -53,13 +54,13 @@ void Scene30::run() { _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFUnk23)) - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk13)) - _vm->_gameSys->insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x107, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[5] = _vm->getRandom(50) + 180; - _vm->_gameSys->insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x101, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(100) + 300; _kidSequenceId = 0x101; @@ -177,11 +178,11 @@ void Scene30::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_gnapActionStatus < 0) { if (_vm->getRandom(5) == 1) { - _vm->_gameSys->insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); _kidSequenceId = 0x100; } else { - _vm->_gameSys->insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFE, 40, 0, 0, kSeqNone, 0, 0, 0); } } } @@ -189,9 +190,9 @@ void Scene30::run() { _vm->_timers[5] = _vm->getRandom(50) + 180; if (_vm->_gnapActionStatus < 0) { if (!_vm->isFlag(kGFUnk23) || hasTakenPill) - _vm->_gameSys->insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x108, 20, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundB(); @@ -210,16 +211,18 @@ void Scene30::run() { } void Scene30::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS30LeaveScene: _vm->_sceneDone = true; break; case kAS30UsePillMachine: _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x105, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x105, _vm->_gnapId, 0); + gameSys.insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x105; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS30UsePillMachine2; @@ -228,13 +231,13 @@ void Scene30::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0x3F, 255); - _vm->_gameSys->removeSequence(0x105, _vm->_gnapId, true); - _vm->_gameSys->setAnimation(0x102, 256, 0); - _vm->_gameSys->insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.removeSequence(0x105, _vm->_gnapId, true); + gameSys.setAnimation(0x102, 256, 0); + gameSys.insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x103, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x103, _vm->_gnapId, 0); + gameSys.insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->_gnapActionStatus = kAS30UsePillMachine3; @@ -242,15 +245,15 @@ void Scene30::updateAnimations() { _vm->setFlag(kGFUnk23); break; case kAS30UsePillMachine3: - _vm->_gameSys->setAnimation(0x104, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x104, _vm->_gnapId, 0); + gameSys.insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x104; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = kAS30UsePillMachine4; _vm->setGrabCursorSprite(kItemDiceQuarterHole); break; case kAS30UsePillMachine4: - _vm->_gameSys->insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y + 1, -1, 0x107BC, 1); _vm->_gnapActionStatus = -1; break; @@ -291,18 +294,19 @@ void Scene31::updateHotspots() { } void Scene31::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); - _vm->queueInsertDeviceIcon(); _beerGuyDistracted = false; - _vm->_gameSys->insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFB, 39, 0, 0, kSeqNone, 0, 0, 0); _currClerkSequenceId = 0xFB; _nextClerkSequenceId = -1; - _vm->_gameSys->setAnimation(0xFB, 39, 3); + gameSys.setAnimation(0xFB, 39, 3); _vm->_timers[4] = _vm->getRandom(20) + 60; _vm->_timers[5] = _vm->getRandom(50) + 180; @@ -411,7 +415,7 @@ void Scene31::run() { _vm->setGrabCursorSprite(-1); _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); _clerkMeasureMaxCtr += 5; - _vm->_gameSys->insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->playGnapPullOutDevice(6, 8); _vm->playGnapUseDevice(0, 0); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); @@ -508,9 +512,9 @@ void Scene31::run() { _vm->_timers[5] = _vm->getRandom(50) + 180; if (_vm->_gnapActionStatus < 0) { if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x103, 20, 0, 0, kSeqNone, 0, 0, 0); } } _vm->playSoundB(); @@ -529,15 +533,17 @@ void Scene31::run() { } void Scene31::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS31UseBeerBarrel: _nextClerkSequenceId = 0xFE; break; case kAS31FillEmptyBucketWithBeer: - _vm->_gameSys->setAnimation(0x102, 59, 0); - _vm->_gameSys->insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x102, 59, 0); + gameSys.insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapX = 5; _vm->_gnapY = 7; _vm->_gnapSequenceDatNum = 0; @@ -549,7 +555,7 @@ void Scene31::updateAnimations() { _vm->_gnapIdleFacing = kDirBottomLeft; _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gameSys->insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = -1; _vm->invAdd(kItemBucketWithBeer); _vm->invRemove(kItemEmptyBucket); @@ -566,8 +572,8 @@ void Scene31::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->_platypusActionStatus == kAS31PlatMeasuringClown) { _vm->_sceneWaiting = true; _beerGuyDistracted = true; @@ -575,12 +581,12 @@ void Scene31::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_nextClerkSequenceId) { case 0xFA: - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFC, 39, _nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0xFC, 39, 3); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFC, 39, _nextClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xFC, 39, 3); _currClerkSequenceId = 0xFC; _nextClerkSequenceId = 0xFC; _clerkMeasureCtr = 0; @@ -591,33 +597,33 @@ void Scene31::updateAnimations() { if (_vm->_gnapActionStatus != 5) _vm->_platypusActionStatus = -1; _vm->_timers[0] = 40; - _vm->_gameSys->insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = 0xFD; _nextClerkSequenceId = -1; if (_vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeer) _vm->_gnapActionStatus = -1; _beerGuyDistracted = false; _clerkMeasureMaxCtr = 3; - _vm->_gameSys->setAnimation(0xFD, 39, 3); + gameSys.setAnimation(0xFD, 39, 3); _vm->_sceneWaiting = false; } else { - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = 0xFC; - _vm->_gameSys->setAnimation(0xFC, 39, 3); + gameSys.setAnimation(0xFC, 39, 3); } break; case 0xFE: - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClerkSequenceId, 39, 3); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = -1; _vm->_gnapActionStatus = -1; break; default: if (_nextClerkSequenceId != -1) { - _vm->_gameSys->insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_nextClerkSequenceId, 39, 3); + gameSys.insertSequence(_nextClerkSequenceId, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextClerkSequenceId, 39, 3); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = -1; } @@ -651,6 +657,8 @@ void Scene32::updateHotspots() { } void Scene32::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); _vm->queueInsertDeviceIcon(); @@ -751,9 +759,9 @@ void Scene32::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x0E, 180, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x0D, 180, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); } @@ -770,8 +778,10 @@ void Scene32::run() { } void Scene32::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS32LeaveScene) _vm->_sceneDone = true; } @@ -802,13 +812,15 @@ void Scene33::updateHotspots() { } void Scene33::run() { + GameSys& gameSys = *_vm->_gameSys; + _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); _vm->queueInsertDeviceIcon(); _currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x7E, 179, 2); + gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _nextChickenSequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 30; _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -978,9 +990,9 @@ void Scene33::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) - _vm->_gameSys->insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x83, 256, 0, 0, kSeqNone, 0, 0, 0); else - _vm->_gameSys->insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kAS33TalkChicken && _vm->_gnapActionStatus != kAS33UseChicken) { if (_vm->getRandom(6) != 0) { @@ -1006,7 +1018,9 @@ void Scene33::run() { } void Scene33::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kAS33LeaveScene: _vm->_sceneDone = true; @@ -1019,12 +1033,12 @@ void Scene33::updateAnimations() { _vm->_timers[2] = 100; break; case kAS33UseChickenDone: - _vm->_gameSys->insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _currChickenSequenceId = 0x7E; - _vm->_gameSys->setAnimation(0x7E, 179, 2); - _vm->_gameSys->insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x7E, 179, 2); + gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; _vm->_timers[5] = 30; break; @@ -1034,24 +1048,24 @@ void Scene33::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x81) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 0); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(_currChickenSequenceId, 179, true); + gameSys.setAnimation(_nextChickenSequenceId, 179, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; _vm->_gnapActionStatus = kAS33UseChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x7F) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextChickenSequenceId != -1) { - _vm->_gameSys->setAnimation(_nextChickenSequenceId, 179, 2); - _vm->_gameSys->insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextChickenSequenceId, 179, 2); + gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; } @@ -1064,8 +1078,10 @@ Scene38::Scene38(GnapEngine *vm) : Scene(vm) { } int Scene38::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0xA5; } @@ -1262,26 +1278,28 @@ void Scene38::run() { } void Scene38::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS38LeaveScene: _vm->_sceneDone = true; break; case kAS38ExitCave: - _vm->_gameSys->removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); - _vm->_gameSys->insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); + gameSys.insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA3; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0xA3, _vm->_gnapId, 0); + gameSys.setAnimation(0xA3, _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS38LeaveScene; break; case kAS38UseHuntingTrophy: - _vm->_gameSys->removeSequence(0x9B, 0, true); - _vm->_gameSys->insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x9B, 0, true); + gameSys.insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9C; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9C, _vm->_gnapId, 0); + gameSys.setAnimation(0x9C, _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; updateHotspots(); break; @@ -1289,21 +1307,21 @@ void Scene38::updateAnimations() { if (_vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) _vm->_sceneWaiting = true; if (_vm->_gnapSequenceId == 0xA4) { - _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9D; } else { - _vm->_gameSys->insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA4; } _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); + gameSys.setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); break; case kAS38ReleaseHuntingTrophy: if (_vm->_gnapSequenceId == 0x9E) { - _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapActionStatus = -1; } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA0; _vm->_gnapSequenceDatNum = 0; _vm->_gnapX = 3; @@ -1318,44 +1336,44 @@ void Scene38::updateAnimations() { _vm->_gnapActionStatus = -1; } } else { - _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9E; _vm->_gnapSequenceDatNum = 0; _vm->_gnapX = 3; _vm->_gnapY = 6; _vm->_gnapIdleFacing = kDirBottomRight; - _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); + gameSys.setAnimation(0x9E, _vm->_gnapId, 0); _vm->_sceneWaiting = false; updateHotspots(); } break; case kAS38UsePlatypusWithTrapDoor: _vm->_sceneWaiting = false; - _vm->_gameSys->insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9F; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9F, _vm->_gnapId, 0); + gameSys.setAnimation(0x9F, _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; if (_vm->_platypusFacing != kDirNone) _vm->playPlatypusSequence(0x107D5); else _vm->playPlatypusSequence(0x107D4); _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); - _vm->_gameSys->insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xA1; _vm->_platypusSequenceDatNum = 0; _vm->_platypusId = _vm->_gnapId + 1; - _vm->_gameSys->setAnimation(0xA1, _vm->_gnapId + 1, 1); + gameSys.setAnimation(0xA1, _vm->_gnapId + 1, 1); _vm->_platypusActionStatus = kAS38PlatypusHoldingTrapDoor; updateHotspots(); break; } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { - _vm->_gameSys->insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xA2; _vm->_platypusSequenceDatNum = 0; updateHotspots(); @@ -1372,8 +1390,10 @@ Scene39::Scene39(GnapEngine *vm) : Scene(vm) { } int Scene39::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0x35; } @@ -1389,15 +1409,17 @@ void Scene39::updateHotspots() { } void Scene39::run() { + GameSys& gameSys = *_vm->_gameSys; + // Bug in the original? Timer was never initialized. _vm->_timers[5] = 0; _vm->queueInsertDeviceIcon(); _currGuySequenceId = 0x33; - _vm->_gameSys->setAnimation(0x33, 21, 3); - _vm->_gameSys->insertSequence(_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.setAnimation(0x33, 21, 3); + gameSys.insertSequence(_currGuySequenceId, 21, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x34, 21, 0, 0, kSeqLoop, 0, 0, 0); _nextGuySequenceId = -1; if (_vm->_prevSceneNum == 38) { @@ -1548,17 +1570,19 @@ void Scene39::run() { } void Scene39::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys& gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus == kAS39LeaveScene) _vm->_sceneDone = true; else _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { - _vm->_gameSys->setAnimation(_nextGuySequenceId, 21, 3); - _vm->_gameSys->insertSequence(_nextGuySequenceId, 21, _currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { + gameSys.setAnimation(_nextGuySequenceId, 21, 3); + gameSys.insertSequence(_nextGuySequenceId, 21, _currGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currGuySequenceId = _nextGuySequenceId; _nextGuySequenceId = -1; } diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 98b26ec8ec..3ae20034fd 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -35,8 +35,10 @@ Scene53::Scene53(GnapEngine *vm) : Scene(vm) { } int Scene53::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys& gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return 0x75; } @@ -73,18 +75,19 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { 0x58, 0x59, 0x5A, 0x5C, 0x5D, 0x5B }; + GameSys& gameSys = *_vm->_gameSys; if (_isGnapPhoning) { - _vm->_gameSys->setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); - _vm->_gameSys->insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); + gameSys.insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = kGnapHandSequenceIds[buttonNum]; } else { - _vm->_gameSys->setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); - _vm->_gameSys->insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6); + gameSys.insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; } _vm->_gnapActionStatus = 6; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { // checkGameAppStatus(); _vm->updateMouseCursor(); _vm->gameUpdateTick(); @@ -117,6 +120,7 @@ void Scene53::runRandomCall() { 0x6A, 0x6B, 0x6C, 0x6D, 0x71 }; + GameSys& gameSys = *_vm->_gameSys; ++_callsMadeCtr; if (_callsMadeCtr <= 10) { @@ -125,16 +129,16 @@ void Scene53::runRandomCall() { do { index = getRandomCallIndex(); } while (!_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); - _vm->_gameSys->setAnimation(kCallSequenceIds[index], 1, 6); - _vm->_gameSys->insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(kCallSequenceIds[index], 1, 6); + gameSys.insertSequence(kCallSequenceIds[index], 1, 0, 0, kSeqNone, 16, 0, 0); } else { - _vm->_gameSys->setAnimation(0x74, 1, 6); - _vm->_gameSys->insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(0x74, 1, 6); + gameSys.insertSequence(0x74, 1, 0, 0, kSeqNone, 16, 0, 0); _callsMadeCtr = 0; } _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -143,14 +147,15 @@ void Scene53::runRandomCall() { } void Scene53::runChitChatLine() { + GameSys& gameSys = *_vm->_gameSys; bool flag = false; int sequenceId = -1; - _vm->_gameSys->setAnimation(0x6E, 1, 6); - _vm->_gameSys->insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(0x6E, 1, 6); + gameSys.insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -158,10 +163,10 @@ void Scene53::runChitChatLine() { _vm->_gnapActionStatus = -1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = 0x45; } else { - _vm->_gameSys->insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currHandSequenceId = 0x5E; } @@ -213,19 +218,19 @@ void Scene53::runChitChatLine() { _vm->stopSound(0xA0); pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); _vm->_gnapActionStatus = 1; - _vm->_gameSys->setAnimation(sequenceId, 1, 6); - _vm->_gameSys->insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(sequenceId, 1, 6); + gameSys.insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } _vm->_gnapActionStatus = -1; - _vm->_gameSys->setAnimation(0x72, 1, 6); - _vm->_gameSys->insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); + gameSys.setAnimation(0x72, 1, 6); + gameSys.insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); _vm->_gnapActionStatus = 1; - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -239,9 +244,9 @@ void Scene53::runChitChatLine() { _vm->_gnapActionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + gameSys.setAnimation(0x73, 40, 6); + gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -252,6 +257,7 @@ void Scene53::runChitChatLine() { } void Scene53::run() { + GameSys& gameSys = *_vm->_gameSys; int phoneNumber = 0; int phoneNumberLen = 0; @@ -265,7 +271,7 @@ void Scene53::run() { _isGnapPhoning = false; } - _vm->_gameSys->insertSequence(_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currHandSequenceId, 40, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->setVerbCursor(GRAB_CURSOR); _vm->playSound(0xA0, true); @@ -303,9 +309,9 @@ void Scene53::run() { if (phoneNumberLen == 7) { _vm->_gnapActionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + gameSys.setAnimation(0x73, 40, 6); + gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); @@ -345,9 +351,9 @@ void Scene53::run() { if (_vm->_gnapActionStatus < 0) { _vm->_gnapActionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gameSys->setAnimation(0x73, 40, 6); - _vm->_gameSys->insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(6) != 2) { + gameSys.setAnimation(0x73, 40, 6); + gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); diff --git a/engines/gnap/scenes/intro.cpp b/engines/gnap/scenes/intro.cpp index 0463f12ac6..fa23d6a2b3 100644 --- a/engines/gnap/scenes/intro.cpp +++ b/engines/gnap/scenes/intro.cpp @@ -55,6 +55,7 @@ void SceneIntro::run() { 0x1A, 0x14, 0x15, 0x16, 0x14, 0x19, 0}; + GameSys& gameSys = *_vm->_gameSys; int index = 0; bool skip = false; @@ -121,35 +122,35 @@ void SceneIntro::run() { delete videoDecoder; - _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _vm->_gameSys->insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x356, 2, 0); + gameSys.drawSpriteToBackground(0, 0, backgroundIdArr[index]); + gameSys.insertSequence(0x356, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x356, 2, 0); while (!_vm->_sceneDone) { _vm->gameUpdateTick(); - if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip ) { + if (gameSys.getAnimationStatus(0) == 2 || skip ) { skip = false; - _vm->_gameSys->requestClear2(false); - _vm->_gameSys->requestClear1(); + gameSys.requestClear2(false); + gameSys.requestClear1(); if ( index == 11 || index == 1 ) _vm->screenEffect(0, 0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); if (++index >= 31) _vm->_sceneDone = true; else { - _vm->_gameSys->insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0); if (index == 2) { _vm->playSound(0x10000, false); - _vm->_gameSys->insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); + gameSys.insertSequence(0x359, 2, 0, 0, 0, 0, 0, 0); } else if (index == 3) - _vm->_gameSys->insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x35B, 2, 0, 0, kSeqNone, 0, 0, 0); else if (index == 12) - _vm->_gameSys->insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x36A, 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->drawSpriteToBackground(0, 0, backgroundIdArr[index]); - _vm->_gameSys->setAnimation(animIdArr[index], 2, 0); + gameSys.drawSpriteToBackground(0, 0, backgroundIdArr[index]); + gameSys.setAnimation(animIdArr[index], 2, 0); if (index == 11) _vm->stopSound(0x10000); diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index 2b67d59d37..eb83632d89 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -650,6 +650,8 @@ bool Scene::clearKeyStatus() { } void CutScene::run() { + GameSys& gameSys = *_vm->_gameSys; + int itemIndex = 0; int soundId = -1; int volume = 100; @@ -667,11 +669,11 @@ void CutScene::run() { _vm->hideCursor(); - _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[0]); + gameSys.drawSpriteToBackground(0, 0, _resourceIdArr[0]); for (int j = 0; j < _sequenceCountArr[0]; ++j) - _vm->_gameSys->insertSequence(_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(_sequenceIdArr[0], 2, 0); + gameSys.insertSequence(_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_sequenceIdArr[0], 2, 0); _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); @@ -683,19 +685,19 @@ void CutScene::run() { while (!_vm->_sceneDone) { _vm->gameUpdateTick(); - if (_vm->_gameSys->getAnimationStatus(0) == 2 || skip) { + if (gameSys.getAnimationStatus(0) == 2 || skip) { skip = false; - _vm->_gameSys->requestClear2(false); - _vm->_gameSys->requestClear1(); - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.requestClear2(false); + gameSys.requestClear1(); + gameSys.setAnimation(0, 0, 0); firstSequenceIndex += _sequenceCountArr[itemIndex++]; if (itemIndex >= _itemsCount) { _vm->_sceneDone = true; } else { for (int m = 0; m < _sequenceCountArr[itemIndex]; ++m) - _vm->_gameSys->insertSequence(_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[itemIndex]); - _vm->_gameSys->setAnimation(_sequenceIdArr[firstSequenceIndex], 2, 0); + gameSys.insertSequence(_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.drawSpriteToBackground(0, 0, _resourceIdArr[itemIndex]); + gameSys.setAnimation(_sequenceIdArr[firstSequenceIndex], 2, 0); } } -- cgit v1.2.3 From 087492b15ffae0a3dd5c897c262427ba5a489dc6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 30 Apr 2016 14:38:51 +0200 Subject: GNAP: Remove useless parameters in gnapCarryGarbageCanTo --- engines/gnap/scenes/group1.cpp | 59 +++++++++++++++++------------------------- engines/gnap/scenes/group1.h | 2 +- 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 70742fe27a..4dc410c889 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -3158,9 +3158,7 @@ void Scene18::updateHotspots() { _vm->_hotspotsCount = 11; } -void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5) { - // CHECKME: (x, y) is always set to (-1, -1) - +void Scene18::gnapCarryGarbageCanTo(int a5) { // TODO Cleanup static const int kSequenceIds[] = { 0x203, 0x204 @@ -3169,12 +3167,10 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, GameSys& gameSys = *_vm->_gameSys; int gnapSeqId, gnapId, gnapDatNum, gnapGridX; - int clippedX, v12, v5, v10, v11, direction; + int v12, v5, v10, v11, direction; + + int clippedX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; - if (x >= 0) - clippedX = x; - else - clippedX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; if (clippedX >= _vm->_gnapX) v10 = clippedX - 1; else @@ -3233,16 +3229,11 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, } while (v12 != gnapGridX); } - if (argC >= 0) { - _vm->_gnapSequenceId = ridToEntryIndex(argC); - _vm->_gnapSequenceDatNum = ridToDatIndex(argC); - } else { - if (direction == 1) - _vm->_gnapSequenceId = 0x20A; - else - _vm->_gnapSequenceId = 0x209; - _vm->_gnapSequenceDatNum = 0; - } + if (direction == 1) + _vm->_gnapSequenceId = 0x20A; + else + _vm->_gnapSequenceId = 0x209; + _vm->_gnapSequenceDatNum = 0; if (direction == 1) _vm->_gnapIdleFacing = kDirBottomRight; @@ -3251,9 +3242,7 @@ void Scene18::gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, _vm->_gnapId = 20 * _vm->_gnapY + 1; - if (animationIndex >= 0) - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, animationIndex); - + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); @@ -3455,7 +3444,7 @@ void Scene18::run() { case kHS18Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemJoint) { @@ -3488,7 +3477,7 @@ void Scene18::run() { _vm->_sceneWaiting = false; } else if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex >= 0) { @@ -3560,32 +3549,32 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatyPussDisguised)) { // While carrying garbage can if (_vm->_grabCursorSpriteIndex >= 0) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); _vm->playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + gnapCarryGarbageCanTo(2); _vm->_gnapActionStatus = kAS18PutGarbageCanOnRunningHydrant; } else if (!_vm->isFlag(kGFBarnPadlockOpen)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, 2); + gnapCarryGarbageCanTo(2); _vm->_gnapActionStatus = kAS18PutGarbageCanOnHydrant; } else { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); _vm->playGnapImpossible(0, 0); } break; case TALK_CURSOR: case PLAT_CURSOR: - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); _vm->playGnapImpossible(0, 0); break; @@ -3631,7 +3620,7 @@ void Scene18::run() { } } else { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { @@ -3669,7 +3658,7 @@ void Scene18::run() { case kHS18ExitToyStore: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->isFlag(kGFPictureTaken)) { @@ -3688,7 +3677,7 @@ void Scene18::run() { case kHS18ExitPhoneBooth: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } closeHydrantValve(); @@ -3706,7 +3695,7 @@ void Scene18::run() { case kHS18ExitGrubCity: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } closeHydrantValve(); @@ -3727,7 +3716,7 @@ void Scene18::run() { case kHS18WalkArea2: if (_vm->_gnapActionStatus < 0) { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { _vm->gnapWalkTo(-1, -1, -1, -1, 1); @@ -3739,7 +3728,7 @@ void Scene18::run() { default: if (_vm->_gnapActionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { if (_vm->isFlag(kGFPlatyPussDisguised)) { - gnapCarryGarbageCanTo(-1, -1, 0, -1, -1); + gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { _vm->gnapWalkTo(-1, -1, -1, -1, 1); diff --git a/engines/gnap/scenes/group1.h b/engines/gnap/scenes/group1.h index 2a9fe8c738..568099d535 100644 --- a/engines/gnap/scenes/group1.h +++ b/engines/gnap/scenes/group1.h @@ -422,7 +422,7 @@ private: int _nextPhoneSequenceId; int _currPhoneSequenceId; - void gnapCarryGarbageCanTo(int x, int y, int animationIndex, int argC, int a5); + void gnapCarryGarbageCanTo(int a5); void putDownGarbageCan(int animationIndex); void platEndPhoning(bool platFl); void closeHydrantValve(); -- cgit v1.2.3 From f50891f9906ddcfbe91c0b506872fa03c111737e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 30 Apr 2016 15:40:36 +0200 Subject: GNAP: rework gnapCarryGarbageCanTo --- engines/gnap/scenes/group1.cpp | 73 ++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 4dc410c889..9a5542cc58 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -3158,49 +3158,44 @@ void Scene18::updateHotspots() { _vm->_hotspotsCount = 11; } -void Scene18::gnapCarryGarbageCanTo(int a5) { - // TODO Cleanup - static const int kSequenceIds[] = { - 0x203, 0x204 - }; - +void Scene18::gnapCarryGarbageCanTo(int gridX) { GameSys& gameSys = *_vm->_gameSys; int gnapSeqId, gnapId, gnapDatNum, gnapGridX; - int v12, v5, v10, v11, direction; + int destGridX, direction; - int clippedX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; + int curGridX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; - if (clippedX >= _vm->_gnapX) - v10 = clippedX - 1; + if (curGridX >= _vm->_gnapX) + destGridX = curGridX - 1; else - v10 = clippedX + 1; - - if (a5 < 0) - a5 = 4; - v5 = v10; - if (v10 <= a5) - v5 = a5; - v11 = v5; - v12 = _vm->_gridMaxX - 1; - if (_vm->_gridMaxX - 1 >= v11) - v12 = v11; - - if (v12 == _vm->_gnapX) { + destGridX = curGridX + 1; + + if (gridX < 0) + gridX = 4; + + if (destGridX <= gridX) + destGridX = gridX; + + int nextGridX = _vm->_gridMaxX - 1; + if (nextGridX >= destGridX) + nextGridX = destGridX; + + if (nextGridX == _vm->_gnapX) { gnapSeqId = _vm->_gnapSequenceId; gnapId = _vm->_gnapId; gnapDatNum = _vm->_gnapSequenceDatNum; gnapGridX = _vm->_gnapX; - if (_vm->_gnapX <= clippedX) + if (_vm->_gnapX <= curGridX) direction = 1; else direction = -1; } else { if (_vm->_gnapY == _vm->_platY) { - if (v12 >= _vm->_gnapX) { - if (v12 >= _vm->_platX && _vm->_gnapX <= _vm->_platX) + if (nextGridX >= _vm->_gnapX) { + if (nextGridX >= _vm->_platX && _vm->_gnapX <= _vm->_platX) _vm->platypusMakeRoom(); - } else if (v12 <= _vm->_platX && _vm->_gnapX >= _vm->_platX) { + } else if (nextGridX <= _vm->_platX && _vm->_gnapX >= _vm->_platX) { _vm->platypusMakeRoom(); } } @@ -3208,25 +3203,28 @@ void Scene18::gnapCarryGarbageCanTo(int a5) { gnapId = _vm->_gnapId; gnapDatNum = _vm->_gnapSequenceDatNum; gnapGridX = _vm->_gnapX; - int seqId = 0; - if (v12 < _vm->_gnapX) { + int seqId; + if (nextGridX < _vm->_gnapX) { direction = -1; - seqId = 1; - } else + seqId = 0x204; + } else { direction = 1; - int a2 = 20 * _vm->_gnapY + 1; + seqId = 0x203; + } + + int seqId2 = 20 * _vm->_gnapY + 1; do { if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnapY)) break; - a2 += direction; - gameSys.insertSequence(kSequenceIds[seqId], a2, + seqId2 += direction; + gameSys.insertSequence(seqId, seqId2, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - gnapSeqId = kSequenceIds[seqId]; - gnapId = a2; + gnapSeqId = seqId; + gnapId = seqId2; gnapDatNum = 0; gnapGridX += direction; - } while (v12 != gnapGridX); + } while (nextGridX != gnapGridX); } if (direction == 1) @@ -3248,7 +3246,6 @@ void Scene18::gnapCarryGarbageCanTo(int a5) { kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapX = gnapGridX; - } void Scene18::putDownGarbageCan(int animationIndex) { -- cgit v1.2.3 From a2d45c70e9419cedb2e71a46d408cb19c720b6c2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 30 Apr 2016 15:46:34 +0200 Subject: GNAP: For consistancy, use hex values for playSound calls --- engines/gnap/scenes/arcade.cpp | 24 ++++++++++++------------ engines/gnap/scenes/group0.cpp | 6 +++--- engines/gnap/scenes/group1.cpp | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index f16fc6d2a7..196d99a7f8 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -189,7 +189,7 @@ void Scene49::updateObstacle(int id) { obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; - _vm->playSound(224, false); + _vm->playSound(0xE0, false); increaseScore(30); } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) || (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) || @@ -211,7 +211,7 @@ void Scene49::updateObstacle(int id) { _truckSequenceId = obstacle._collisionSequenceId; _truckId = 256; obstacle._currSequenceId = obstacle._passedSequenceId; - _vm->playSound(225, false); + _vm->playSound(0xE1, false); decreaseScore(30); } } else { @@ -229,7 +229,7 @@ void Scene49::updateObstacle(int id) { obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; - _vm->playSound(224, false); + _vm->playSound(0xE0, false); increaseScore(30); } } else if (obstacle._splashSequenceId) { @@ -1323,7 +1323,7 @@ void Scene51::updateItemAnimation(Scene51Item *item, int index) { } else { _vm->_gameSys->removeSequence(item->_currSequenceId, item->_id, true); _vm->_gameSys->setAnimation(0, 0, index + 1); - _vm->playSound(218, false); + _vm->playSound(0xDA, false); if (incCashAmount(item->_currSequenceId) == 1995) { winMinigame(); _vm->_sceneDone = true; @@ -1520,7 +1520,7 @@ void Scene51::playIntroAnim() { _platypusSequenceId = _platypusNextSequenceId; ++soundCtr; if (soundCtr % 4 == 0) - _vm->playSound(214, false); + _vm->playSound(0xD6, false); } _platypusNextSequenceId = 0x75; @@ -1538,7 +1538,7 @@ void Scene51::playIntroAnim() { } else { ++soundCtr; if (soundCtr % 4 == 0) - _vm->playSound(214, false); + _vm->playSound(0xD6, false); } } waitForAnim(0); @@ -1596,7 +1596,7 @@ int Scene51::incCashAmount(int sequenceId) { void Scene51::winMinigame() { updateCash(1995); - _vm->playSound(218, false); + _vm->playSound(0xDA, false); // TODO delayTicksA(1, 5); _vm->_newSceneNum = 48; _vm->invRemove(kItemBanana); @@ -1769,7 +1769,7 @@ void Scene51::run() { } else { ++soundCtr; if (soundCtr % 4 == 0) - _vm->playSound(214, false); + _vm->playSound(0xD6, false); } } } else { @@ -1821,7 +1821,7 @@ void Scene51::run() { } else { ++soundCtr; if (soundCtr % 4 == 0) - _vm->playSound(214, false); + _vm->playSound(0xD6, false); } } } else { @@ -1890,7 +1890,7 @@ void Scene52::update() { if (_liveAlienRows == 0 && !_alienSingle) { _alienWave = false; - _vm->playSound(48, false); + _vm->playSound(0x30, false); ++_alienCounter; if (_alienCounter != 3) { _vm->_timers[0] = 50; @@ -2256,7 +2256,7 @@ int Scene52::updateHitAlien() { if (hitAlienNum != -1 && _items[rowNum][hitAlienNum] >= 0) { _gameScore = ((_items[rowNum][hitAlienNum] - 24) % 3 + _gameScore + 1) % 1000; _items[rowNum][hitAlienNum] = -2; - _vm->playSound(44, false); + _vm->playSound(0x2C, false); _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _alienLeftX + hitAlienNum * _alienWidth + _alienRowXOfs[rowNum] - 10, ya - _alienHeight); result = 1; @@ -2470,7 +2470,7 @@ void Scene52::shipExplode() { if (!_aliensCount) { _vm->_gameSys->setAnimation(0, 0, 7); _vm->_gameSys->removeSequence(_ufoSequenceId, 256, true); - _vm->playSound(44, false); + _vm->playSound(0x2C, false); _vm->_gameSys->insertSequence(0x21, 266, 0, 0, kSeqNone, 0, _shipPosX, _arcadeScreenBottom); _aliensCount = 1; _vm->playSound(0x31, false); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 68c962b999..d7f8aecfd2 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -319,9 +319,9 @@ void Scene01::updateAnimations() { break; case kAS01LookPigs: - _vm->playSound(138, false); - _vm->playSound(139, false); - _vm->playSound(140, false); + _vm->playSound(0x8A, false); + _vm->playSound(0x8B, false); + _vm->playSound(0x8C, false); _vm->_gnapActionStatus = -1; break; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 9a5542cc58..f9789e1a70 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -3964,7 +3964,7 @@ void Scene18::updateAnimations() { gameSys.insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); while (gameSys.getAnimationStatus(5) != 2) _vm->gameUpdateTick(); - _vm->playSound(555, true); + _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x207; -- cgit v1.2.3 From 99580a1b088c9e199a50116dc3dca915142b7547 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 May 2016 00:06:37 +0200 Subject: GNAP: Remove 3 CHECKMEs --- engines/gnap/gamesys.cpp | 3 --- engines/gnap/gamesys.h | 1 - engines/gnap/scenes/group1.cpp | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index e7899a24e3..ad9d0da35f 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -52,7 +52,6 @@ GameSys::GameSys(GnapEngine *vm) : _vm(vm) { _backgroundImageValue1 = 0; _backgroundImageValue4 = 1000; _backgroundImageValue2 = 1000; - _backgroundImageError = true; _gameSysClock = 0; _lastUpdateClock = 0; _backgroundSurface = nullptr; @@ -172,7 +171,6 @@ void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, i _backgroundSurface = surface; if (!_backgroundSurface) { - _backgroundImageError = true; return; } @@ -189,7 +187,6 @@ void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, i _vm->_system->copyRectToScreen(_frontSurface->getPixels(), _frontSurface->pitch, 0, 0, _frontSurface->w, _frontSurface->h); - _backgroundImageError = false; _backgroundImageValue1 = a4; _backgroundImageValue3 = a6; _backgroundImageValue2 = a5; diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index 29a5f97db3..a63b32d995 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -165,7 +165,6 @@ public: int _backgroundImageValue3, _backgroundImageValue1; int _backgroundImageValue4, _backgroundImageValue2; - bool _backgroundImageError; // CHECKME: Unused int32 _gameSysClock, _lastUpdateClock; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index f9789e1a70..22fa7a1dba 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -3906,7 +3906,7 @@ void Scene18::updateAnimations() { _vm->setFlag(kGFUnk14); _vm->clearFlag(kGFTruckFilledWithGas); _vm->setFlag(kGFTruckKeysUsed); - _vm->setFlag(kGFUnk14); // CHECKME - Set 2 times? + _vm->setFlag(kGFUnk14); // Useless, already set updateHotspots(); _vm->_gnapActionStatus = kAS18LeaveScene; break; -- cgit v1.2.3 From aee38421631479b6025585649172491f3251ce5e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 3 May 2016 07:47:15 +0200 Subject: GNAP: Some renaming --- engines/gnap/gamesys.cpp | 1 - engines/gnap/gnap.cpp | 6 ++--- engines/gnap/gnap.h | 7 +++-- engines/gnap/scenes/group0.cpp | 12 ++++----- engines/gnap/scenes/group1.cpp | 56 +++++++++++++++++++-------------------- engines/gnap/scenes/group2.cpp | 2 +- engines/gnap/scenes/group3.cpp | 2 +- engines/gnap/scenes/group4.cpp | 2 +- engines/gnap/scenes/scenecore.cpp | 4 +-- 9 files changed, 45 insertions(+), 47 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index ad9d0da35f..6a9cc0f10d 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -184,7 +184,6 @@ void GameSys::setBackgroundSurface(Graphics::Surface *surface, int a4, int a5, i } memcpy(_frontSurface->getPixels(), surface->getPixels(), surface->pitch * surface->h); - _vm->_system->copyRectToScreen(_frontSurface->getPixels(), _frontSurface->pitch, 0, 0, _frontSurface->w, _frontSurface->h); _backgroundImageValue1 = a4; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index c17790f707..e5169e4927 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1672,7 +1672,7 @@ void GnapEngine::gnapInitBrainPulseRndValue() { _gnapBrainPulseRndValue = 2 * getRandom(10); } -void GnapEngine::gnapUseDeviceOnPlatypuss() { +void GnapEngine::gnapUseDeviceOnPlatypus() { playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _platX, _platY))); if (_platypusFacing != kDirNone) { @@ -1805,7 +1805,7 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { _newSceneNum = 47; _isLeavingScene = true; _sceneDone = true; - setFlag(kGFPlatyPussDisguised); + setFlag(kGFPlatypusDisguised); } int GnapEngine::getPlatypusSequenceId() { @@ -1868,7 +1868,7 @@ void GnapEngine::updatePlatypusIdleSequence() { } } -void GnapEngine::platypusSub426234() { +void GnapEngine::updatePlatypusIdleSequence2() { if (_platypusActionStatus < 0 && _gnapActionStatus < 0) { if (_timers[0]) { if (!_timers[1]) { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 8f86a866c0..b388022231 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -183,7 +183,7 @@ enum { kGFBarnPadlockOpen = 7, kGFTruckFilledWithGas = 8, kGFTruckKeysUsed = 9, - kGFPlatyPussDisguised = 10, + kGFPlatypusDisguised = 10, kGFSceneFlag1 = 11, kGFGnapControlsToyUFO = 12, kGFUnk13 = 13, // Tongue Fight Won? @@ -550,7 +550,7 @@ public: void updateGnapIdleSequence2(); void initGnapPos(int gridX, int gridY, Facing facing); void gnapInitBrainPulseRndValue(); - void gnapUseDeviceOnPlatypuss(); + void gnapUseDeviceOnPlatypus(); void doCallback(int callback); bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); void gnapKissPlatypus(int callback); @@ -564,11 +564,10 @@ public: int getPlatypusSequenceId(); void playPlatypusSequence(int sequenceId); void updatePlatypusIdleSequence(); - void platypusSub426234(); + void updatePlatypusIdleSequence2(); void initPlatypusPos(int gridX, int gridY, Facing facing); // Scenes - int _toyUfoNextSequenceId, _toyUfoSequenceId; int _toyUfoId; int _toyUfoActionStatus; diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index d7f8aecfd2..4ec0d88c61 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -1376,7 +1376,7 @@ void Scene04::run() { _vm->queueInsertDeviceIcon(); - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { _vm->_timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); _vm->setGrabCursorSprite(kItemKeys); @@ -1394,7 +1394,7 @@ void Scene04::run() { _vm->invRemove(kItemDisguise); _vm->invAdd(kItemKeys); _vm->setFlag(kGFKeysTaken); - _vm->clearFlag(kGFPlatyPussDisguised); + _vm->clearFlag(kGFPlatypusDisguised); _vm->_platypusSequenceId = 0x20C; _vm->_platypusSequenceDatNum = 0; _vm->_platypusFacing = kDirBottomRight; @@ -1667,7 +1667,7 @@ void Scene04::run() { if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->platypusSub426234(); + _vm->updatePlatypusIdleSequence2(); if (_vm->_gnapActionStatus < 0) _vm->updateGnapIdleSequence2(); if (!_vm->_timers[5]) { @@ -1965,7 +1965,7 @@ void Scene05::run() { break; case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { _vm->_platypusActionStatus = kAS05PlatSearchHaystack; _vm->_platypusFacing = kDirUnk4; @@ -3057,7 +3057,7 @@ void Scene08::run() { break; case PLAT_CURSOR: _vm->gnapActionIdle(0x14D); - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); _vm->_platypusActionStatus = kAS08PlatWithMan; _vm->_platypusFacing = kDirNone; @@ -3093,7 +3093,7 @@ void Scene08::run() { case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); _vm->gnapActionIdle(0x14D); - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); _vm->_platypusActionStatus = kAS08PlatWithDog; _vm->_platypusFacing = kDirNone; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 22fa7a1dba..bd77c3c133 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -169,7 +169,7 @@ void Scene10::run() { break; case PLAT_CURSOR: _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(4, 6, -1, -1, 1); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS10AnnoyCook; @@ -206,7 +206,7 @@ void Scene10::run() { _vm->playGnapMoan2(-1, -1); else { _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, -1, -1, 1); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS10AnnoyCook; @@ -239,7 +239,7 @@ void Scene10::run() { _vm->invAdd(kItemTongs); _vm->setFlag(kGFMudTaken); _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); _vm->_platypusActionStatus = kAS10PlatWithBox; _vm->_platypusFacing = kDirUnk4; @@ -747,7 +747,7 @@ void Scene11::run() { gameSys.setAnimation(0x207, 257, 4); gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } - _vm->platypusSub426234(); + _vm->updatePlatypusIdleSequence2(); _vm->updateGnapIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 75; @@ -1071,7 +1071,7 @@ void Scene12::run() { _vm->_gnapActionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); _vm->_platypusActionStatus = kAS12PlatWithToothGuy; _vm->_platypusFacing = kDirUnk4; @@ -1141,7 +1141,7 @@ void Scene12::run() { _vm->_gnapActionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); _vm->_platypusActionStatus = kAS12PlatWithBeardGuy; _vm->_platypusFacing = kDirNone; @@ -2539,7 +2539,7 @@ void Scene17::run() { if (_vm->isFlag(kGFGrassTaken)) { _vm->gnapUseJointOnPlatypus(); } else { - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); _vm->_platypusActionStatus = kAS17GetWrench1; @@ -2586,7 +2586,7 @@ void Scene17::run() { case PLAT_CURSOR: if (_canTryGetWrench) { platHangUpPhone(); - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); _vm->_platypusActionStatus = kAS17TryGetWrench; _vm->_gnapActionStatus = kAS17TryGetWrench; @@ -2626,7 +2626,7 @@ void Scene17::run() { if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->_platypusFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); @@ -2670,7 +2670,7 @@ void Scene17::run() { if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->_platypusFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); @@ -2730,7 +2730,7 @@ void Scene17::run() { if (!_vm->_isLeavingScene) { if (_vm->_platypusActionStatus < 0) - _vm->platypusSub426234(); + _vm->updatePlatypusIdleSequence2(); _vm->updateGnapIdleSequence2(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 200; @@ -3143,7 +3143,7 @@ void Scene18::updateHotspots() { _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; } - if (_vm->isFlag(kGFPlatyPussDisguised)) + if (_vm->isFlag(kGFPlatypusDisguised)) _vm->_hotspots[kHS18GarbageCan]._flags = SF_DISABLED; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _vm->_hotspots[kHS18Device]._flags = SF_DISABLED; @@ -3259,7 +3259,7 @@ void Scene18::putDownGarbageCan(int animationIndex) { _vm->_s18GarbageCanPos = _vm->_gnapX - 1; else _vm->_s18GarbageCanPos = _vm->_gnapX + 1; - _vm->clearFlag(kGFPlatyPussDisguised); + _vm->clearFlag(kGFPlatypusDisguised); updateHotspots(); if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) { gameSys.insertSequence(0x107BA, _vm->_gnapId, @@ -3342,7 +3342,7 @@ void Scene18::run() { _vm->startSoundTimerA(4); _vm->_timers[5] = _vm->getRandom(100) + 100; _vm->queueInsertDeviceIcon(); - _vm->clearFlag(kGFPlatyPussDisguised); + _vm->clearFlag(kGFPlatypusDisguised); if (!_vm->isFlag(kGFUnk14)) gameSys.insertSequence(0x1F8, 19, 0, 0, kSeqNone, 0, 0, 0); @@ -3440,7 +3440,7 @@ void Scene18::run() { case kHS18Platypus: if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } @@ -3473,7 +3473,7 @@ void Scene18::run() { _vm->_gnapActionStatus = kAS18GrabCowboyHat; _vm->_sceneWaiting = false; } else if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } @@ -3543,7 +3543,7 @@ void Scene18::run() { case kHS18HydrantTopValve: if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { // While carrying garbage can if (_vm->_grabCursorSpriteIndex >= 0) { gnapCarryGarbageCanTo(-1); @@ -3616,7 +3616,7 @@ void Scene18::run() { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } } else { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } @@ -3654,7 +3654,7 @@ void Scene18::run() { case kHS18ExitToyStore: if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } @@ -3673,7 +3673,7 @@ void Scene18::run() { case kHS18ExitPhoneBooth: if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } @@ -3691,7 +3691,7 @@ void Scene18::run() { case kHS18ExitGrubCity: if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } @@ -3712,7 +3712,7 @@ void Scene18::run() { case kHS18WalkArea1: case kHS18WalkArea2: if (_vm->_gnapActionStatus < 0) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { @@ -3724,7 +3724,7 @@ void Scene18::run() { default: if (_vm->_gnapActionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { - if (_vm->isFlag(kGFPlatyPussDisguised)) { + if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { @@ -3774,7 +3774,7 @@ void Scene18::run() { } _vm->playSoundA(); } - if (!_vm->isFlag(kGFPlatyPussDisguised)) + if (!_vm->isFlag(kGFPlatypusDisguised)) _vm->updateGnapIdleSequence(); } @@ -3814,7 +3814,7 @@ void Scene18::updateAnimations() { _vm->_gnapSequenceId = 0x1FD; } gameSys.removeSequence(0x1FA, 19, true); - _vm->setFlag(kGFPlatyPussDisguised); + _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); _vm->_gnapActionStatus = -1; break; @@ -3824,7 +3824,7 @@ void Scene18::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FE; _vm->clearFlag(kGFTruckKeysUsed); - _vm->setFlag(kGFPlatyPussDisguised); + _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); _vm->_gnapActionStatus = -1; break; @@ -3916,7 +3916,7 @@ void Scene18::updateAnimations() { break; case kAS18PutGarbageCanOnRunningHydrant: _vm->setFlag(kGFTruckKeysUsed); - _vm->clearFlag(kGFPlatyPussDisguised); + _vm->clearFlag(kGFPlatypusDisguised); gameSys.requestRemoveSequence(0x211, 39); gameSys.requestRemoveSequence(0x212, 39); gameSys.insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -4008,7 +4008,7 @@ void Scene18::updateAnimations() { break; case kAS18PutGarbageCanOnHydrant: _vm->setFlag(kGFTruckKeysUsed); - _vm->clearFlag(kGFPlatyPussDisguised); + _vm->clearFlag(kGFPlatypusDisguised); gameSys.insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x20F, _vm->_gnapId, 0); _vm->_gnapSequenceDatNum = 0; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index df3fbf4a83..eeffa1664e 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -1169,7 +1169,7 @@ void Scene22::run() { _vm->_gnapActionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); break; } } diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 7526a9d71c..20f798c84e 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -393,7 +393,7 @@ void Scene31::run() { break; case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 1, 0x107C2, 1); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index c42119cb51..b9119b72ff 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -1833,7 +1833,7 @@ void Scene44::run() { _vm->_gnapActionStatus = 1; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypuss(); + _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(6, 7, 1, 0x107D2, 1); if (_vm->_gnapX == 7 && _vm->_gnapY == 7) _vm->gnapWalkStep(); diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index eb83632d89..c6e32e07c1 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -530,7 +530,7 @@ void GnapEngine::runSceneLogic() { _scene = new Scene472(this); _scene->init(); _newSceneNum = 11; - } else if (!isFlag(kGFPlatyPussDisguised) && _prevSceneNum == 2) {//CHECKME + } else if (!isFlag(kGFPlatypusDisguised) && _prevSceneNum == 2) {//CHECKME if (isFlag(kGFUnk25)) { _scene = new Scene473(this); _scene->init(); @@ -550,7 +550,7 @@ void GnapEngine::runSceneLogic() { _scene = new Scene476(this); _scene->init(); _newSceneNum = 26; - } else if (isFlag(kGFPlatyPussDisguised) && _cursorValue == 1) { + } else if (isFlag(kGFPlatypusDisguised) && _cursorValue == 1) { _scene = new Scene477(this); _scene->init(); _newSceneNum = 4; -- cgit v1.2.3 From 2e50019c05dbff0bbb559b72a201630605505c87 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 May 2016 07:13:48 +0200 Subject: GNAP: Introduce Character class - WIP --- engines/gnap/character.cpp | 37 +++++ engines/gnap/character.h | 58 ++++++++ engines/gnap/gnap.cpp | 303 +++++++++++++++++++++-------------------- engines/gnap/gnap.h | 14 +- engines/gnap/grid.cpp | 78 ++++++----- engines/gnap/module.mk | 1 + engines/gnap/scenes/group0.cpp | 109 +++++++-------- engines/gnap/scenes/group1.cpp | 159 +++++++++++---------- engines/gnap/scenes/group2.cpp | 60 ++++---- engines/gnap/scenes/group3.cpp | 35 +++-- engines/gnap/scenes/group4.cpp | 57 ++++---- 11 files changed, 495 insertions(+), 416 deletions(-) create mode 100644 engines/gnap/character.cpp create mode 100644 engines/gnap/character.h diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp new file mode 100644 index 0000000000..6e4ade35a5 --- /dev/null +++ b/engines/gnap/character.cpp @@ -0,0 +1,37 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gnap/gnap.h" +#include "gnap/character.h" + +namespace Gnap { + +Character::Character(GnapEngine *vm) : _vm(vm) { + _pos = Common::Point(0, 0); + _idleFacing = kDirNone; +} + +Character::~Character() {} + +PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) {} + +} // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h new file mode 100644 index 0000000000..5949b7a1eb --- /dev/null +++ b/engines/gnap/character.h @@ -0,0 +1,58 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GNAP_CHARACTER_H +#define GNAP_CHARACTER_H + +namespace Gnap { + +class GnapEngine; + +enum Facing { + kDirNone = 0, + kDirBottomRight = 1, + kDirBottomLeft = 3, + kDirUnk4 = 4, + kDirUpLeft = 5, + kDirUpRight = 7 +}; + +class Character { +public: + Character(GnapEngine *vm); + ~Character(); + + Common::Point _pos; + Facing _idleFacing; + +protected: + GnapEngine *_vm; +}; + +class PlayerGnap : public Character { +public: + PlayerGnap(GnapEngine *vm); +}; + +} // End of namespace Gnap + +#endif // GNAP_CHARACTER_H diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e5169e4927..ff9c79e9cd 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -148,12 +148,14 @@ Common::Error GnapEngine::run() { _gameSys = new GameSys(this); _soundMan = new SoundMan(this); _debugger = new Debugger(this); + _gnap = new PlayerGnap(this); _menuBackgroundSurface = nullptr; initGlobalSceneVars(); mainLoop(); + delete _gnap; delete _soundMan; delete _gameSys; delete _sequenceCache; @@ -943,25 +945,25 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { switch (kind) { case gskPullOutDevice: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x83F; - _gnapIdleFacing = kDirUpLeft; + _gnap->_idleFacing = kDirUpLeft; } else { sequenceId = 0x83D; - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x83B; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x839; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } } else { - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: sequenceId = 0x839; break; @@ -980,25 +982,25 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case gskPullOutDeviceNonWorking: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x829; - _gnapIdleFacing = kDirUpLeft; + _gnap->_idleFacing = kDirUpLeft; } else { sequenceId = 0x828; - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x827; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x826; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } } else { - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: sequenceId = 0x826; break; @@ -1017,40 +1019,40 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case gskScratchingHead: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x834; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x885; - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x834; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x833; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } } else { - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: sequenceId = 0x833; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; break; case kDirBottomLeft: sequenceId = 0x834; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; break; case kDirUpRight: sequenceId = 0x885; - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; break; default: sequenceId = 0x834; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; break; } } @@ -1058,25 +1060,25 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case gskIdle: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x7BC; - _gnapIdleFacing = kDirUpLeft; + _gnap->_idleFacing = kDirUpLeft; } else { sequenceId = 0x7BB; - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x7BA; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7B9; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } } else { - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: sequenceId = 0x7B9; break; @@ -1096,25 +1098,25 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case gskBrainPulsating: _gnapBrainPulseNum = (_gnapBrainPulseNum + 1) & 1; if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; - _gnapIdleFacing = kDirUpLeft; + _gnap->_idleFacing = kDirUpLeft; } else { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } } else { - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; break; @@ -1133,59 +1135,59 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case gskImpossible: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x831; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7A8; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x831; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { - if (_gnapX % 2) + if (_gnap->_pos.x % 2) sequenceId = 0x7A8; else sequenceId = 0x89A; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } - } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { + } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { sequenceId = 0x831; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { if (_currentSceneNum % 2) sequenceId = 0x7A8; else sequenceId = 0x89A; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } break; case gskDeflect: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x830; - _gnapIdleFacing = kDirUpLeft; + _gnap->_idleFacing = kDirUpLeft; } else { sequenceId = 0x82F; - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x82E; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7A7; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } } else { - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: sequenceId = 0x7A7; break; @@ -1206,7 +1208,7 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { break; case gskUseDevice: - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: sequenceId = 0x83A; break; @@ -1227,57 +1229,57 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { case gskMoan1: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x832; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x832; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } - } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { + } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { sequenceId = 0x832; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } break; case gskMoan2: if (gridX > 0 && gridY > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) { + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x832; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } else { - if (_gnapX > gridX) { + if (_gnap->_pos.x > gridX) { sequenceId = 0x832; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } } - } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { + } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { sequenceId = 0x832; - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; } else { sequenceId = 0x7AA; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } break; } @@ -1287,120 +1289,120 @@ int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { int sequenceId; - Facing facing = _gnapIdleFacing; + Facing facing = _gnap->_idleFacing; if (gridY > 0 && gridX > 0) { - if (_gnapY > gridY) { - if (_gnapX > gridX) - _gnapIdleFacing = kDirUpLeft; + if (_gnap->_pos.y > gridY) { + if (_gnap->_pos.x > gridX) + _gnap->_idleFacing = kDirUpLeft; else - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } else { - if (_gnapX > gridX) - _gnapIdleFacing = kDirUpLeft; + if (_gnap->_pos.x > gridX) + _gnap->_idleFacing = kDirUpLeft; else - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } - } else if (_gnapIdleFacing != kDirBottomRight && _gnapIdleFacing != kDirUpRight) { - _gnapIdleFacing = kDirUpLeft; + } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { + _gnap->_idleFacing = kDirUpLeft; } else { - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; } switch (index) { case 0: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x8A0; else sequenceId = 0x8A1; break; case 1: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x880; else sequenceId = 0x895; break; case 2: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x884; else sequenceId = 0x899; break; //Skip 3 case 4: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x881; else sequenceId = 0x896; break; case 5: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x883; else sequenceId = 0x898; break; case 6: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87E; else sequenceId = 0x893; break; case 7: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x848; else sequenceId = 0x890; break; case 8: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87D; else sequenceId = 0x892; break; case 9: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x882; else sequenceId = 0x897; break; case 10: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87C; else sequenceId = 0x891; break; case 11: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87C; else sequenceId = 0x891; break; case 12: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87D; else sequenceId = 0x892; break; case 13: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x888; else sequenceId = 0x89D; break; case 14: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87F; else sequenceId = 0x894; break; case 15: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87B; else sequenceId = 0x8A3; break; case 16: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x877; else sequenceId = 0x88C; @@ -1410,43 +1412,43 @@ int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { sequenceId = 0x887; break; case 19: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87A; else sequenceId = 0x88F; break; case 20: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x878; else sequenceId = 0x88D; break; case 21: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x879; else sequenceId = 0x88E; break; case 22: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x88A; else sequenceId = 0x89F; break; case 23: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x889; else sequenceId = 0x89E; break; case 24: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x886; else sequenceId = 0x89B; break; case 25: - if (_gnapIdleFacing == kDirUpRight) + if (_gnap->_idleFacing == kDirUpRight) sequenceId = 0x87A; else sequenceId = 0x88F; @@ -1456,7 +1458,7 @@ int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { //Skip 28 //Skip 29 default: - _gnapIdleFacing = facing; + _gnap->_idleFacing = facing; sequenceId = getGnapSequenceId(gskImpossible, 0, 0); break; } @@ -1473,7 +1475,7 @@ void GnapEngine::gnapIdle() { _gnapSequenceId == 0x831 || _gnapSequenceId == 0x89A)) { _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncExists, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); _gnapSequenceDatNum = 1; } @@ -1484,7 +1486,7 @@ void GnapEngine::gnapActionIdle(int sequenceId) { ridToEntryIndex(sequenceId) == _gnapSequenceId) { _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncExists, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); _gnapSequenceDatNum = 1; } @@ -1496,7 +1498,7 @@ void GnapEngine::playGnapSequence(int sequenceId) { gnapIdle(); _gameSys->insertSequence(sequenceId, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = ridToEntryIndex(sequenceId); _gnapSequenceDatNum = ridToDatIndex(sequenceId); } @@ -1554,7 +1556,7 @@ void GnapEngine::updateGnapIdleSequence() { if (_timers[3] == 0) { _timers[2] = 60; _timers[3] = 300; - if (_gnapIdleFacing == kDirBottomRight) { + if (_gnap->_idleFacing == kDirBottomRight) { switch (getRandom(5)) { case 0: playGnapSequence(0x107A6); @@ -1569,7 +1571,7 @@ void GnapEngine::updateGnapIdleSequence() { playGnapSequence(0x108A2); break; } - } else if (_gnapIdleFacing == kDirBottomLeft) { + } else if (_gnap->_idleFacing == kDirBottomLeft) { if (getRandom(5) > 2) playGnapSequence(0x10832); else @@ -1578,16 +1580,16 @@ void GnapEngine::updateGnapIdleSequence() { } } else { _timers[2] = getRandom(30) + 20; - if (_gnapIdleFacing == kDirBottomRight) { + if (_gnap->_idleFacing == kDirBottomRight) { _gameSys->insertSequence(0x107BD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = 0x7BD; _gnapSequenceDatNum = 1; - } else if (_gnapIdleFacing == kDirBottomLeft) { + } else if (_gnap->_idleFacing == kDirBottomLeft) { _gameSys->insertSequence(0x107BE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = 0x7BE; _gnapSequenceDatNum = 1; } @@ -1604,24 +1606,24 @@ void GnapEngine::updateGnapIdleSequence2() { if (_timers[3] == 0) { _timers[2] = 60; _timers[3] = 300; - if (_gnapIdleFacing == kDirBottomRight) { + if (_gnap->_idleFacing == kDirBottomRight) { playGnapSequence(0x107AA); - } else if (_gnapIdleFacing == kDirBottomLeft) { + } else if (_gnap->_idleFacing == kDirBottomLeft) { playGnapSequence(0x10832); } } } else { _timers[2] = getRandom(30) + 20; - if (_gnapIdleFacing == kDirBottomRight) { + if (_gnap->_idleFacing == kDirBottomRight) { _gameSys->insertSequence(0x107BD, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = 0x7BD; _gnapSequenceDatNum = 1; - } else if (_gnapIdleFacing == kDirBottomLeft) { + } else if (_gnap->_idleFacing == kDirBottomLeft) { _gameSys->insertSequence(0x107BE, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = 0x7BE; _gnapSequenceDatNum = 1; } @@ -1649,23 +1651,22 @@ bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gr void GnapEngine::initGnapPos(int gridX, int gridY, Facing facing) { _timers[2] = 30; _timers[3] = 300; - _gnapX = gridX; - _gnapY = gridY; + _gnap->_pos = Common::Point(gridX, gridY); if (facing == kDirNone) - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; else - _gnapIdleFacing = facing; - if (_gnapIdleFacing == kDirBottomLeft) { + _gnap->_idleFacing = facing; + if (_gnap->_idleFacing == kDirBottomLeft) { _gnapSequenceId = 0x7B8; } else { _gnapSequenceId = 0x7B5; - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } - _gnapId = 20 * _gnapY; + _gnapId = 20 * _gnap->_pos.y; _gnapSequenceDatNum = 1; - _gameSys->insertSequence(makeRid(1, _gnapSequenceId), 20 * _gnapY, + _gameSys->insertSequence(makeRid(1, _gnapSequenceId), 20 * _gnap->_pos.y, 0, 0, - kSeqScale, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqScale, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); } void GnapEngine::gnapInitBrainPulseRndValue() { @@ -1692,7 +1693,7 @@ void GnapEngine::gnapUseDeviceOnPlatypus() { int newSequenceId = getGnapSequenceId(gskUseDevice, 0, 0); _gameSys->insertSequence(makeRid(1, newSequenceId), _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnapX - _gnapGridX, 48 * _gnapY - _gnapGridY); + kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); _gnapSequenceId = newSequenceId; _gnapSequenceDatNum = 1; } @@ -1712,9 +1713,9 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in if (_gnapActionStatus <= -1 && _platypusActionStatus <= -1) { _gnapActionStatus = 100; - if (isPointBlocked(_platX + gridX, _platY + gridY) && (_platX + gridX != _gnapX || _platY + gridY != _gnapY)) + if (isPointBlocked(_platX + gridX, _platY + gridY) && (_gnap->_pos != Common::Point(_platX + gridX, _platY + gridY))) platypusWalkStep(); - if (!isPointBlocked(_platX + gridX, _platY + gridY) && (_platX + gridX != _gnapX || _platY + gridY != _gnapY)) { + if (!isPointBlocked(_platX + gridX, _platY + gridY) && (_gnap->_pos != Common::Point(_platX + gridX, _platY + gridY))) { gnapWalkTo(_platX + gridX, _platY + gridY, 0, 0x107B9, 1); while (_gameSys->getAnimationStatus(0) != 2) { updateMouseCursor(); @@ -1722,7 +1723,7 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in gameUpdateTick(); } _gameSys->setAnimation(0, 0, 0); - if (_platX + gridX == _gnapX && _platY + gridY == _gnapY) { + if (_gnap->_pos == Common::Point(_platX + gridX, _platY + gridY)) { _gameSys->setAnimation(platSequenceId, _platypusId, 1); playPlatypusSequence(platSequenceId); while (_gameSys->getAnimationStatus(1) != 2) { @@ -1745,7 +1746,7 @@ void GnapEngine::gnapKissPlatypus(int callback) { _gameSys->setAnimation(0x10847, _gnapId, 0); _gameSys->insertSequence(0x10847, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 15 * (5 * _gnapX - 20) - (21 - _gridMinX), 48 * (_gnapY - 6) - (146 - _gridMinY)); + kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 20) - (21 - _gridMinX), 48 * (_gnap->_pos.y - 6) - (146 - _gridMinY)); _gnapSequenceDatNum = 1; _gnapSequenceId = 0x847; _gameSys->insertSequence(0x107CB, _platypusId, @@ -1775,7 +1776,7 @@ void GnapEngine::gnapUseJointOnPlatypus() { _gameSys->setAnimation(0x10876, _platypusId, 0); _gameSys->insertSequence(0x10875, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 15 * (5 * _gnapX - 30), 48 * (_gnapY - 7)); + kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 30), 48 * (_gnap->_pos.y - 7)); _gnapSequenceDatNum = 1; _gnapSequenceId = 0x875; _gameSys->insertSequence(0x10876, _platypusId, @@ -1936,7 +1937,7 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ _gameSys->setAnimation(sequenceId2, _gnapId, 0); _gameSys->insertSequence(sequenceId2, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); + kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 25), 48 * (_gnap->_pos.y - 8)); _gnapSequenceId = sequenceId2; _gnapSequenceDatNum = 0; while (_gameSys->getAnimationStatus(0) != 2) @@ -1950,7 +1951,7 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ _gameSys->setAnimation(sequenceId3, _gnapId, 0); _gameSys->insertSequence(sequenceId3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 15 * (5 * _gnapX - 25), 48 * (_gnapY - 8)); + kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 25), 48 * (_gnap->_pos.y - 8)); removeFullScreenSprite(); showCursor(); _gnapSequenceId = sequenceId3; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index b388022231..d16ba24f92 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -42,6 +42,7 @@ #include "gnap/debugger.h" #include "gnap/resource.h" #include "gnap/scenes/scenecore.h" +#include "gnap/character.h" struct ADGameDescription; @@ -250,15 +251,6 @@ enum { // 0x7AF Gnap walks to the left 1 // 0x7B0 Gnap walks to the left 2 -enum Facing { - kDirNone = 0, - kDirBottomRight = 1, - kDirBottomLeft = 3, - kDirUnk4 = 4, - kDirUpLeft = 5, - kDirUpRight = 7 -}; - struct GnapSavegameHeader { uint8 _version; Common::String _saveName; @@ -292,6 +284,7 @@ public: SoundMan *_soundMan; Debugger *_debugger; Scene *_scene; + PlayerGnap *_gnap; int _lastUpdateClock; @@ -494,7 +487,6 @@ public: // Gnap walking int _gnapWalkNodesCount; GridStruct _gnapWalkNodes[kMaxGridStructs]; - int _gnapX, _gnapY; int _gnapWalkDestX, _gnapWalkDestY; int _gnapWalkDeltaX, _gnapWalkDeltaY, _gnapWalkDirX, _gnapWalkDirY, _gnapWalkDirXIncr, _gnapWalkDirYIncr; @@ -505,6 +497,7 @@ public: bool gridSub41F5FC(int gridX, int gridY, int index); bool gridSub41FAD5(int gridX, int gridY, int index); bool gnapFindPath3(int gridX, int gridY); + bool gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); bool gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void gnapWalkStep(); @@ -525,7 +518,6 @@ public: void platypusMakeRoom(); // Gnap - Facing _gnapIdleFacing; int _gnapActionStatus; int _gnapBrainPulseNum, _gnapBrainPulseRndValue; int _gnapSequenceId, _gnapSequenceDatNum, _gnapId; diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index dfdc52811a..ec90cf1e8a 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -73,7 +73,7 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { if (gridX < 0 || gridX >= _gridMaxX || gridY < 0 || gridY >= _gridMaxY) return true; - if ((gridX == _gnapX && gridY == _gnapY) || (gridX == _platX && gridY == _platY)) + if ((_gnap->_pos == Common::Point(gridX, gridY)) || (gridX == _platX && gridY == _platY)) return true; const int x = _gridMinX + 75 * gridX; @@ -537,8 +537,11 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { return done; } -bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { +bool GnapEngine::gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { + return gnapWalkTo(gridPos.x, gridPos.y, animationIndex, sequenceId, flags); +} +bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { int datNum = flags & 3; bool done = false; @@ -557,16 +560,17 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen if (animationIndex >= 0 && _gnapWalkDestX == _platX && _gnapWalkDestY == _platY) platypusMakeRoom(); - if (gridSub41F5FC(_gnapX, _gnapY, 0)) + // TODO: Simplify the cascade of Ifs + if (gridSub41F5FC(_gnap->_pos.x, _gnap->_pos.y, 0)) done = true; - if (!done && gridSub41FAD5(_gnapX, _gnapY, 0)) + if (!done && gridSub41FAD5(_gnap->_pos.x, _gnap->_pos.y, 0)) done = true; - if (!done && gnapFindPath3(_gnapX, _gnapY)) + if (!done && gnapFindPath3(_gnap->_pos.x, _gnap->_pos.y)) done = true; - if (!done && gridSub41F08B(_gnapX, _gnapY)) + if (!done && gridSub41F08B(_gnap->_pos.x, _gnap->_pos.y)) done = true; gnapIdle(); @@ -627,7 +631,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen if (_gnapWalkNodesCount > 0) { _gnapSequenceId = gnapSequenceId; _gnapId = gnapId; - _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); + _gnap->_idleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); _gnapSequenceDatNum = datNum; if (animationIndex >= 0) _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); @@ -640,26 +644,26 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapSequenceId = ridToEntryIndex(sequenceId); _gnapSequenceDatNum = ridToDatIndex(sequenceId); if (_gnapSequenceId == 0x7B9) { - _gnapIdleFacing = kDirBottomRight; + _gnap->_idleFacing = kDirBottomRight; } else { switch (_gnapSequenceId) { case 0x7BA: - _gnapIdleFacing = kDirBottomLeft; + _gnap->_idleFacing = kDirBottomLeft; break; case 0x7BB: - _gnapIdleFacing = kDirUpRight; + _gnap->_idleFacing = kDirUpRight; break; case 0x7BC: - _gnapIdleFacing = kDirUpLeft; + _gnap->_idleFacing = kDirUpLeft; break; } } } else { if (_gnapWalkNodesCount > 0) { _gnapSequenceId = getGnapWalkStopSequenceId(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); - _gnapIdleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); + _gnap->_idleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); } else if (gridX >= 0 || gridY >= 0) { - switch (_gnapIdleFacing) { + switch (_gnap->_idleFacing) { case kDirBottomRight: _gnapSequenceId = 0x7B9; break; @@ -674,14 +678,15 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen break; } } else { - int v10 = _leftClickMouseX - (_gridMinX + 75 * _gnapX); - int v11 = _leftClickMouseY - (_gridMinY + 48 * _gnapY); - if (_leftClickMouseX == _gridMinX + 75 * _gnapX) + //TODO: simplify the checks by using v10 and v11 + int v10 = _leftClickMouseX - (_gridMinX + 75 * _gnap->_pos.x); + int v11 = _leftClickMouseY - (_gridMinY + 48 * _gnap->_pos.y); + if (_leftClickMouseX == _gridMinX + 75 * _gnap->_pos.x) ++v10; - if (_leftClickMouseY == _gridMinY + 48 * _gnapY) + if (_leftClickMouseY == _gridMinY + 48 * _gnap->_pos.y) v11 = 1; _gnapSequenceId = getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); - _gnapIdleFacing = getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11)); + _gnap->_idleFacing = getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11)); } _gnapSequenceDatNum = datNum; } @@ -704,8 +709,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } } - _gnapX = _gnapWalkDestX; - _gnapY = _gnapWalkDestY; + _gnap->_pos = Common::Point(_gnapWalkDestX, _gnapWalkDestY); return done; } @@ -714,22 +718,22 @@ void GnapEngine::gnapWalkStep() { bool done = false; for (int i = 1; i < _gridMaxX && !done; ++i) { done = true; - if (!isPointBlocked(_gnapX + i, _gnapY)) - gnapWalkTo(_gnapX + i, _gnapY, -1, -1, 1); - else if (!isPointBlocked(_gnapX - i, _gnapY)) - gnapWalkTo(_gnapX - i, _gnapY, -1, -1, 1); - else if (!isPointBlocked(_gnapX, _gnapY + 1)) - gnapWalkTo(_gnapX, _gnapY + 1, -1, -1, 1); - else if (!isPointBlocked(_gnapX, _gnapY - 1)) - gnapWalkTo(_gnapX, _gnapY - 1, -1, -1, 1); - else if (!isPointBlocked(_gnapX + 1, _gnapY + 1)) - gnapWalkTo(_gnapX + 1, _gnapY + 1, -1, -1, 1); - else if (!isPointBlocked(_gnapX - 1, _gnapY + 1)) - gnapWalkTo(_gnapX - 1, _gnapY + 1, -1, -1, 1); - else if (!isPointBlocked(_gnapX + 1, _gnapY - 1)) - gnapWalkTo(_gnapX + 1, _gnapY - 1, -1, -1, 1); - else if (!isPointBlocked(_gnapX - 1, _gnapY - 1)) - gnapWalkTo(_gnapX - 1, _gnapY - 1, -1, -1, 1); + if (!isPointBlocked(_gnap->_pos.x + i, _gnap->_pos.y)) + gnapWalkTo(_gnap->_pos.x + i, _gnap->_pos.y, -1, -1, 1); + else if (!isPointBlocked(_gnap->_pos.x - i, _gnap->_pos.y)) + gnapWalkTo(_gnap->_pos.x - i, _gnap->_pos.y, -1, -1, 1); + else if (!isPointBlocked(_gnap->_pos.x, _gnap->_pos.y + 1)) + gnapWalkTo(_gnap->_pos.x, _gnap->_pos.y + 1, -1, -1, 1); + else if (!isPointBlocked(_gnap->_pos.x, _gnap->_pos.y - 1)) + gnapWalkTo(_gnap->_pos.x, _gnap->_pos.y - 1, -1, -1, 1); + else if (!isPointBlocked(_gnap->_pos.x + 1, _gnap->_pos.y + 1)) + gnapWalkTo(_gnap->_pos.x + 1, _gnap->_pos.y + 1, -1, -1, 1); + else if (!isPointBlocked(_gnap->_pos.x - 1, _gnap->_pos.y + 1)) + gnapWalkTo(_gnap->_pos.x - 1, _gnap->_pos.y + 1, -1, -1, 1); + else if (!isPointBlocked(_gnap->_pos.x + 1, _gnap->_pos.y - 1)) + gnapWalkTo(_gnap->_pos.x + 1, _gnap->_pos.y - 1, -1, -1, 1); + else if (!isPointBlocked(_gnap->_pos.x - 1, _gnap->_pos.y - 1)) + gnapWalkTo(_gnap->_pos.x - 1, _gnap->_pos.y - 1, -1, -1, 1); else done = false; } @@ -1210,7 +1214,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platWalkDestX = CLIP(gridX, 0, _gridMaxX - 1); _platWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); - if (animationIndex >= 0 && _platWalkDestX == _gnapX && _platWalkDestY == _gnapY) + if (animationIndex >= 0 && _gnap->_pos == Common::Point(_platWalkDestX, _platWalkDestY)) gnapWalkStep(); if (gridSub423CC1(_platX, _platY, 0)) diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 79849cf293..5305299cd2 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -1,6 +1,7 @@ MODULE := engines/gnap MODULE_OBJS := \ + character.o \ datarchive.o \ debugger.o \ detection.o \ diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 4ec0d88c61..019678d15f 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -21,6 +21,7 @@ */ #include "gnap/gnap.h" +#include "gnap/character.h" #include "gnap/gamesys.h" #include "gnap/resource.h" #include "gnap/scenes/group0.h" @@ -156,7 +157,7 @@ void Scene01::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnapActionStatus = kAS01LookSpaceship; break; @@ -199,17 +200,17 @@ void Scene01::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnapActionStatus = kAS01LookPigs; break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnapActionStatus = kAS01UsePigs; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); _vm->_gnapActionStatus = kAS01LookPigs; break; @@ -502,7 +503,7 @@ void Scene02::run() { case kHS02Chicken: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS02UseTwigWithChicken; @@ -514,14 +515,14 @@ void Scene02::run() { _vm->playGnapMoan2(9, 8); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnapActionStatus = kAS02GrabChicken; else _vm->_gnapActionStatus = -1; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS02TalkChicken; break; @@ -566,7 +567,7 @@ void Scene02::run() { _vm->_gnapActionStatus = kAS02UseTruckNoGas; } } else { - _vm->_gnapIdleFacing = kDirUnk4; + _vm->_gnap->_idleFacing = kDirUnk4; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _vm->_gnapActionStatus = kAS02UseTruckNoKeys; } @@ -590,7 +591,7 @@ void Scene02::run() { _vm->playGnapMoan2(2, 4); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS02GrabTruckGrill; break; @@ -793,7 +794,7 @@ void Scene02::updateAnimations() { _vm->_timers[2] = 100; break; case kAS02GrabChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _currChickenSequenceId = 0x14B; @@ -1060,7 +1061,7 @@ void Scene03::run() { if (_platypusHypnotized) { _vm->playGnapBrainPulsating(8, 4); } else { - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) _vm->_gnapActionStatus = kAS03HypnotizeScaredPlat; @@ -1260,22 +1261,21 @@ void Scene03::updateAnimations() { gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x1B5; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirNone; + _vm->_gnap->_idleFacing = kDirNone; _vm->_platypusSequenceId = _nextPlatSequenceId; _vm->_platypusSequenceDatNum = 0; gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; _vm->_gnapActionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { - _vm->_gnapX = 3; - _vm->_gnapY = 6; + _vm->_gnap->_pos = Common::Point(3, 6); gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1BC, 99, 0); - _vm->_gnapId = 20 * _vm->_gnapY; + _vm->_gnapId = 20 * _vm->_gnap->_pos.y; _vm->_gnapSequenceId = 0x1B6; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirNone; + _vm->_gnap->_idleFacing = kDirNone; _vm->_gnapActionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { @@ -1380,8 +1380,7 @@ void Scene04::run() { _vm->_timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); _vm->setGrabCursorSprite(kItemKeys); - _vm->_gnapX = 4; - _vm->_gnapY = 7; + _vm->_gnap->_pos = Common::Point(4, 7); _vm->_gnapId = 140; _vm->_platX = 6; _vm->_platY = 7; @@ -1509,7 +1508,7 @@ void Scene04::run() { _vm->playGnapMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); @@ -1531,19 +1530,19 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + if (_vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1)) { _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20F; } break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnapActionStatus = kAS04GrabDog; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1)) { + _vm->_gnap->_idleFacing = kDirBottomRight; + if (_vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1)) { _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20E; } @@ -1571,7 +1570,7 @@ void Scene04::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); _vm->_gnapActionStatus = kAS04OpenDoor; _vm->_timers[5] = 300; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; } else { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); @@ -1715,8 +1714,7 @@ void Scene04::updateAnimations() { case kAS04OpenDoor: gameSys.insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnapX = 6; - _vm->_gnapY = 7; + _vm->_gnap->_pos = Common::Point(6, 7); gameSys.insertSequence(0x107B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); @@ -1750,8 +1748,8 @@ void Scene04::updateAnimations() { gameSys.requestRemoveSequence(0x20B, 256); gameSys.insertSequence(0x107B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); - _vm->_gnapIdleFacing = kDirBottomRight; + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _vm->_gnapActionStatus = -1; @@ -1777,10 +1775,10 @@ void Scene04::updateAnimations() { gameSys.removeSequence(0x20A, 256, true); gameSys.insertSequence(0x107B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnapActionStatus = -1; break; case kAS04GrabDog: @@ -1970,7 +1968,7 @@ void Scene05::run() { _vm->_platypusActionStatus = kAS05PlatSearchHaystack; _vm->_platypusFacing = kDirUnk4; } - if (_vm->_gnapX == 4 && (_vm->_gnapY == 8 || _vm->_gnapY == 7)) + if (_vm->_gnap->_pos.x == 4 && (_vm->_gnap->_pos.y == 8 || _vm->_gnap->_pos.y == 7)) _vm->gnapWalkStep(); _vm->playGnapIdle(_vm->_platX, _vm->_platY); } @@ -1983,7 +1981,7 @@ void Scene05::run() { case kHS05Chicken: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS05UseTwigWithChicken; @@ -1995,12 +1993,12 @@ void Scene05::run() { _vm->playGnapMoan2(9, 7); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS05GrabChicken; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS05TalkChicken; break; @@ -2022,7 +2020,7 @@ void Scene05::run() { _vm->playGnapMoan2(2, 4); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS05GrabLadder; break; @@ -2057,7 +2055,7 @@ void Scene05::run() { _vm->playGnapScratchingHead(7, 4); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS05TryPickPadlock; @@ -2193,7 +2191,7 @@ void Scene05::updateAnimations() { case kAS05EnterBarn: gameSys.insertSequence(0x107B1, 1, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); gameSys.setAnimation(0x107B1, 1, 0); _vm->_gnapActionStatus = kAS05LeaveScene; break; @@ -2440,7 +2438,7 @@ void Scene06::run() { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); _vm->_platypusFacing = kDirNone; _vm->_gnapActionStatus = kAS06UseTwigOnHorse; @@ -2456,7 +2454,7 @@ void Scene06::run() { if (_horseTurnedBack) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { - _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; @@ -2571,8 +2569,7 @@ void Scene06::updateAnimations() { _vm->_gnapActionStatus = kAS06TryToClimbLadderDone; break; case kAS06TryToClimbLadderDone: - _vm->_gnapX = 6; - _vm->_gnapY = 7; + _vm->_gnap->_pos = Common::Point(6, 7); _vm->_gnapActionStatus = -1; break; case kAS06TalkToHorse: @@ -2626,7 +2623,7 @@ void Scene06::updateAnimations() { _vm->_platypusSequenceId = 0xFA; _vm->_platypusSequenceDatNum = 0; gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B7; _vm->_gnapSequenceDatNum = 1; _currHorseSequenceId = _nextHorseSequenceId; @@ -2692,12 +2689,11 @@ void Scene07::run() { _vm->initPlatypusPos(9, 7, kDirUnk4); _vm->endSceneInit(); } else { - _vm->_gnapX = 6; - _vm->_gnapY = 7; + _vm->_gnap->_pos = Common::Point(6, 7); _vm->_gnapId = 140; _vm->_gnapSequenceId = 0x8F; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS07Wait; @@ -2747,8 +2743,8 @@ void Scene07::run() { case kHS07ExitHouse: _vm->_isLeavingScene = true; - if (_vm->_gnapX > 8) - _vm->gnapWalkTo(_vm->_gnapX, 7, 0, 0x107AD, 1); + if (_vm->_gnap->_pos.x > 8) + _vm->gnapWalkTo(_vm->_gnap->_pos.x, 7, 0, 0x107AD, 1); else _vm->gnapWalkTo(8, 7, 0, 0x107AD, 1); _vm->_gnapActionStatus = kAS07LeaveScene; @@ -2770,7 +2766,7 @@ void Scene07::run() { gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = _vm->getGnapSequenceId(gskUseDevice, 0, 0); _vm->_gnapSequenceDatNum = 1; break; @@ -3044,13 +3040,13 @@ void Scene08::run() { _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS08LookMan; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; break; case GRAB_CURSOR: _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS08TalkMan; @@ -3082,10 +3078,10 @@ void Scene08::run() { case GRAB_CURSOR: _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS08GrabDog; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS08TalkDog; @@ -3342,7 +3338,7 @@ void Scene08::updateAnimations() { _vm->_platypusSequenceId = 0x148; _vm->_platypusFacing = kDirUnk4; _vm->_platypusSequenceDatNum = 0; - if (_vm->_gnapX == 1 && _vm->_gnapY == 8) + if (_vm->_gnap->_pos == Common::Point(1, 8)) _vm->gnapWalkStep(); } else if (_nextDogSequenceId != -1) { gameSys.setAnimation(_nextDogSequenceId, 100, 3); @@ -3355,7 +3351,7 @@ void Scene08::updateAnimations() { _vm->_timers[3] = _vm->getRandom(50) + 200; gameSys.insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x14D; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; } @@ -3543,10 +3539,9 @@ void Scene09::updateAnimations() { gameSys.removeSequence(0x4B, 2, true); _vm->_gnapSequenceId = 0x4C; _vm->_gnapId = 120; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 9; - _vm->_gnapY = 6; + _vm->_gnap->_pos = Common::Point(9, 6); _vm->_gnapActionStatus = kAS09SearchTrashDone; break; case kAS09SearchTrashDone: diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index bd77c3c133..017858b24c 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -159,10 +159,10 @@ void Scene10::run() { break; case GRAB_CURSOR: _vm->playGnapImpossible(0, 0); - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(4, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS10AnnoyCook; @@ -265,10 +265,9 @@ void Scene10::run() { gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x10E; _vm->_gnapId = 120; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 9; - _vm->_gnapY = 6; + _vm->_gnap->_pos = Common::Point(9, 6); _vm->_timers[2] = 360; break; case TALK_CURSOR: @@ -402,7 +401,7 @@ void Scene10::updateAnimations() { _vm->setGrabCursorSprite(kItemTongs); if (_vm->_platypusActionStatus == kAS10PlatWithBox) _vm->_platypusActionStatus = -1; - if (_vm->_gnapX == 4 && _vm->_gnapY == 8) + if (_vm->_gnap->_pos == Common::Point(4, 8)) _vm->gnapWalkStep(); break; default: @@ -459,7 +458,7 @@ void Scene10::updateAnimations() { _vm->_timers[3] = 300; gameSys.insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x10C; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; _vm->_gnapActionStatus = -1; _vm->_platypusActionStatus = -1; @@ -654,7 +653,7 @@ void Scene11::run() { _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS11TalkGoggleGuy; break; @@ -665,7 +664,7 @@ void Scene11::run() { case kHS11HookGuy: if (_vm->_gnapActionStatus < 0) { - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(5, 6, 0, 0x107BC, 9); _vm->_gnapActionStatus = kAS11ShowItemToHookGuy; @@ -680,7 +679,7 @@ void Scene11::run() { _vm->_gnapActionStatus = kAS11GrabHookGuy; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->gnapWalkTo(5, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS11TalkHookGuy; break; @@ -1042,18 +1041,18 @@ void Scene12::run() { if (_vm->_grabCursorSpriteIndex == kItemQuarter) { _vm->_largeSprite = gameSys.createSurface(0x141); _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnapActionStatus = kAS12QuarterToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnapActionStatus = kAS12QuarterWithHoleToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnapActionStatus = kAS12ShowItemToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else { @@ -1066,7 +1065,7 @@ void Scene12::run() { _vm->_gnapActionStatus = kAS12GrabToothGuy; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS12TalkToothGuy; break; @@ -1084,26 +1083,26 @@ void Scene12::run() { case kHS12Barkeeper: if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS12QuarterWithBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS12ShowItemToBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS12LookBarkeeper; break; case GRAB_CURSOR: _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(6, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS12TalkBarkeeper; break; @@ -1119,24 +1118,24 @@ void Scene12::run() { case kHS12BeardGuy: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(7, 6, 0, 0x107BB, 9); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS12ShowItemToBeardGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS12LookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS12GrabBeardGuy; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS12TalkBeardGuy; break; @@ -1364,7 +1363,7 @@ void Scene12::updateAnimations() { gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B7; _vm->_gnapSequenceDatNum = 1; _vm->setFlag(kGFTwigTaken); @@ -1560,7 +1559,7 @@ void Scene13::run() { case LOOK_CURSOR: case GRAB_CURSOR: case TALK_CURSOR: - if (_vm->_gnapX == 5 && _vm->_gnapY == 5) { + if (_vm->_gnap->_pos == Common::Point(5, 5)) { _backToiletCtr = MIN(5, _backToiletCtr + 1); gameSys.setAnimation(_backToiletCtr + 0xA3, _vm->_gnapId, 0); gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, @@ -1568,12 +1567,12 @@ void Scene13::run() { kSeqScale | kSeqSyncWait, 0, 0, 0); _vm->_gnapActionStatus = kAS13Wait; _vm->_gnapSequenceId = _backToiletCtr + 0xA3; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; } else { _vm->gnapWalkTo(5, 5, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS13BackToilet; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; } break; case PLAT_CURSOR: @@ -1594,7 +1593,7 @@ void Scene13::run() { case PLAT_CURSOR: _vm->gnapWalkTo(6, 7, 0, 0xA9, 5); _vm->_gnapActionStatus = kAS13FrontToilet; - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; break; } } @@ -1608,13 +1607,13 @@ void Scene13::run() { case LOOK_CURSOR: _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS13LookScribble; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; break; case GRAB_CURSOR: _vm->playGnapScratchingHead(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(7, 7, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0), 1); break; case PLAT_CURSOR: @@ -1631,7 +1630,7 @@ void Scene13::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 9, 6)); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnapActionStatus = kAS13Wait; break; case GRAB_CURSOR: @@ -1653,7 +1652,7 @@ void Scene13::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 5, 9)); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, -1, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnapActionStatus = kAS13Wait; break; case GRAB_CURSOR: @@ -1791,10 +1790,9 @@ void Scene13::updateAnimations() { gameSys.removeSequence(0xAA, 256, true); _vm->_gnapSequenceId = 0xAB; _vm->_gnapId = 160; - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 4; - _vm->_gnapY = 8; + _vm->_gnap->_pos = Common::Point(4, 8); _vm->_timers[2] = 360; _vm->_gnapActionStatus = kAS13GrabSinkDone; break; @@ -1810,10 +1808,9 @@ void Scene13::updateAnimations() { gameSys.insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA2; _vm->_gnapId = 120; - _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 4; - _vm->_gnapY = 6; + _vm->_gnap->_pos = Common::Point(4, 6); _vm->_timers[2] = 360; _vm->_gnapActionStatus = kAS13Wait; break; @@ -2446,8 +2443,7 @@ void Scene17::run() { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); _vm->initPlatypusPos(7, 9, kDirNone); - _vm->_gnapX = _vm->_hotspotsWalkPos[2].x; - _vm->_gnapY = _vm->_hotspotsWalkPos[2].y; + _vm->_gnap->_pos = _vm->_hotspotsWalkPos[2]; _vm->_gnapId = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; @@ -2496,12 +2492,11 @@ void Scene17::run() { _vm->endSceneInit(); } } else { - _vm->_gnapX = 3; - _vm->_gnapY = 6; + _vm->_gnap->_pos = Common::Point(3, 6); _vm->_gnapId = 120; _vm->_gnapSequenceId = 0x23D; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->_platX = -1; _vm->_platY = 8; @@ -2614,7 +2609,7 @@ void Scene17::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); _vm->_gnapActionStatus = kAS17GetCoinFromPhone; } else _vm->playGnapImpossible(0, 0); @@ -2656,7 +2651,7 @@ void Scene17::run() { if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); @@ -2688,7 +2683,7 @@ void Scene17::run() { if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS17LeaveScene; if (_vm->_platypusActionStatus != kAS17PlatPhoningAssistant) @@ -2701,7 +2696,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); _vm->_gnapActionStatus = kAS17LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); @@ -3166,7 +3161,7 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { int curGridX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; - if (curGridX >= _vm->_gnapX) + if (curGridX >= _vm->_gnap->_pos.x) destGridX = curGridX - 1; else destGridX = curGridX + 1; @@ -3181,30 +3176,30 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { if (nextGridX >= destGridX) nextGridX = destGridX; - if (nextGridX == _vm->_gnapX) { + if (nextGridX == _vm->_gnap->_pos.x) { gnapSeqId = _vm->_gnapSequenceId; gnapId = _vm->_gnapId; gnapDatNum = _vm->_gnapSequenceDatNum; - gnapGridX = _vm->_gnapX; - if (_vm->_gnapX <= curGridX) + gnapGridX = _vm->_gnap->_pos.x; + if (_vm->_gnap->_pos.x <= curGridX) direction = 1; else direction = -1; } else { - if (_vm->_gnapY == _vm->_platY) { - if (nextGridX >= _vm->_gnapX) { - if (nextGridX >= _vm->_platX && _vm->_gnapX <= _vm->_platX) + if (_vm->_gnap->_pos.y == _vm->_platY) { + if (nextGridX >= _vm->_gnap->_pos.x) { + if (nextGridX >= _vm->_platX && _vm->_gnap->_pos.x <= _vm->_platX) _vm->platypusMakeRoom(); - } else if (nextGridX <= _vm->_platX && _vm->_gnapX >= _vm->_platX) { + } else if (nextGridX <= _vm->_platX && _vm->_gnap->_pos.x >= _vm->_platX) { _vm->platypusMakeRoom(); } } gnapSeqId = _vm->_gnapSequenceId; gnapId = _vm->_gnapId; gnapDatNum = _vm->_gnapSequenceDatNum; - gnapGridX = _vm->_gnapX; + gnapGridX = _vm->_gnap->_pos.x; int seqId; - if (nextGridX < _vm->_gnapX) { + if (nextGridX < _vm->_gnap->_pos.x) { direction = -1; seqId = 0x204; } else { @@ -3212,14 +3207,14 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { seqId = 0x203; } - int seqId2 = 20 * _vm->_gnapY + 1; + int seqId2 = 20 * _vm->_gnap->_pos.y + 1; do { - if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnapY)) + if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnap->_pos.y)) break; seqId2 += direction; gameSys.insertSequence(seqId, seqId2, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); gnapSeqId = seqId; gnapId = seqId2; gnapDatNum = 0; @@ -3234,18 +3229,18 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { _vm->_gnapSequenceDatNum = 0; if (direction == 1) - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; else - _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnapId = 20 * _vm->_gnapY + 1; + _vm->_gnapId = 20 * _vm->_gnap->_pos.y + 1; gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapX = gnapGridX; + _vm->_gnap->_pos.x = gnapGridX; } void Scene18::putDownGarbageCan(int animationIndex) { @@ -3255,21 +3250,21 @@ void Scene18::putDownGarbageCan(int animationIndex) { while (gameSys.getAnimationStatus(animationIndex) != 2) _vm->gameUpdateTick(); } - if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) - _vm->_s18GarbageCanPos = _vm->_gnapX - 1; + if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) + _vm->_s18GarbageCanPos = _vm->_gnap->_pos.x - 1; else - _vm->_s18GarbageCanPos = _vm->_gnapX + 1; + _vm->_s18GarbageCanPos = _vm->_gnap->_pos.x + 1; _vm->clearFlag(kGFPlatypusDisguised); updateHotspots(); - if (_vm->_gnapIdleFacing != kDirNone && _vm->_gnapIdleFacing != kDirBottomRight && _vm->_gnapIdleFacing != kDirUpRight) { + if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) { gameSys.insertSequence(0x107BA, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7BA; } else { gameSys.insertSequence(0x107B9, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B9; } _vm->_gnapSequenceDatNum = 1; @@ -3508,7 +3503,7 @@ void Scene18::run() { platEndPhoning(true); if (_vm->_grabCursorSpriteIndex >= 0) { if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnapX < _vm->_s18GarbageCanPos ? 1 : -1), + _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, _vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); @@ -3516,15 +3511,15 @@ void Scene18::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnapX < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else if (!_vm->isFlag(kGFTruckFilledWithGas)) _vm->playGnapScratchingHead(2, 4); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnapX < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, -1, -1, 1); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnapY) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); _vm->_gnapActionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 0, -1, 1)) @@ -3579,7 +3574,7 @@ void Scene18::run() { } } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); _vm->_gnapActionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); @@ -3621,7 +3616,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) _vm->_gnapActionStatus = kAS18OpenRightValveWithGarbageCan; else @@ -3800,16 +3795,16 @@ void Scene18::updateAnimations() { gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case kAS18GrabGarbageCanFromStreet: - if (_vm->_gnapIdleFacing != kDirUpRight && _vm->_gnapIdleFacing != kDirBottomRight) { + if (_vm->_gnap->_idleFacing != kDirUpRight && _vm->_gnap->_idleFacing != kDirBottomRight) { gameSys.insertSequence(0x1FC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - 675, 0); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 675, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FC; } else { gameSys.insertSequence(0x1FD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - 525, 0); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 525, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FD; } @@ -3997,7 +3992,7 @@ void Scene18::updateAnimations() { _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); - gameSys.insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); updateHotspots(); _vm->_gnapSequenceDatNum = 1; _vm->_gnapSequenceId = 0x7B5; @@ -4200,7 +4195,7 @@ void Scene19::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); _vm->_gnapActionStatus = kAS19GrabPicture; } break; @@ -4223,7 +4218,7 @@ void Scene19::run() { _vm->playGnapScratchingHead(6, 2); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS19TalkShopAssistant; break; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index eeffa1664e..543b4fe23e 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -370,7 +370,7 @@ void Scene20::run() { _vm->playGnapMoan2(5, 4); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_stonerGuyShowingJoint) _vm->_gnapActionStatus = kAS20GrabJoint; @@ -378,7 +378,7 @@ void Scene20::run() { _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) _vm->_gnapActionStatus = kAS20TalkStonerGuyNoJoint; @@ -404,12 +404,12 @@ void Scene20::run() { break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS20TalkGroceryStoreGuy; break; @@ -424,7 +424,7 @@ void Scene20::run() { case kHS20GroceryStoreHat: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -436,7 +436,7 @@ void Scene20::run() { break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS20GrabGroceryStoreHat; break; @@ -624,7 +624,7 @@ void Scene20::updateAnimations() { _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = -1; break; @@ -824,7 +824,7 @@ void Scene21::run() { _vm->playGnapScratchingHead(2, 5); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); _vm->playGnapPullOutDevice(2, 5); _vm->playGnapUseDevice(0, 0); _vm->_gnapActionStatus = kAS21GrabBanana; @@ -851,14 +851,14 @@ void Scene21::run() { _vm->playGnapScratchingHead(7, 4); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady].x, _vm->_hotspotsWalkPos[kHS21OldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS21TalkOldLady; break; @@ -1163,7 +1163,7 @@ void Scene22::run() { _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS22TalkCashier; @@ -1373,7 +1373,7 @@ void Scene23::run() { if (_vm->isFlag(kGFSceneFlag1)) _vm->playGnapImpossible(0, 0); else { - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); @@ -1637,7 +1637,7 @@ void Scene24::run() { if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS24LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); @@ -1887,7 +1887,7 @@ void Scene25::run() { _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS25TalkTicketVendor; break; @@ -1941,11 +1941,11 @@ void Scene25::run() { case LOOK_CURSOR: _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1); if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; else if (_vm->_sceneClickedHotspot == 8) - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; else - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->playGnapIdle(0, 0); playAnims(8 - _vm->_sceneClickedHotspot + 1); break; @@ -2423,7 +2423,7 @@ void Scene27::run() { case kHS27Janitor: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemPicture) { - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, 0x107BC, 1)) _vm->_gnapActionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2434,7 +2434,7 @@ void Scene27::run() { _vm->playGnapScratchingHead(6, 3); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS27TalkJanitor; break; @@ -2457,8 +2457,8 @@ void Scene27::run() { _vm->playGnapScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); + _vm->_gnap->_idleFacing = kDirUpLeft; + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); _vm->_gnapActionStatus = kAS27GrabBucket; break; case TALK_CURSOR: @@ -2623,7 +2623,7 @@ void Scene27::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS27EnterClownTent: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107B2, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107B2, 1); _vm->_gnapActionStatus = kAS27LeaveScene; break; case kAS27LeaveScene: @@ -2803,11 +2803,11 @@ void Scene28::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); _vm->_gnapActionStatus = kAS28GrabHornSuccess; } } else { - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y, 0, 0x107BB, 1); @@ -2832,13 +2832,13 @@ void Scene28::run() { else _vm->playGnapImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); _vm->_gnapActionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); @@ -2851,7 +2851,7 @@ void Scene28::run() { _vm->playGnapScratchingHead(5, 2); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS28TalkClown; break; @@ -2888,7 +2888,7 @@ void Scene28::run() { _vm->playGnapScratchingHead(8, 6); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); _vm->_gnapActionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: @@ -3000,7 +3000,7 @@ void Scene28::updateAnimations() { _vm->_gnapActionStatus = -1; break; case kAS28GrabHornFailsDone: - gameSys.insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); @@ -3185,7 +3185,7 @@ void Scene29::run() { case kHS29Monkey: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 20f798c84e..adec63a152 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -413,7 +413,7 @@ void Scene31::run() { if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->playGnapPullOutDevice(6, 8); @@ -434,7 +434,7 @@ void Scene31::run() { } else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); _vm->_gnapActionStatus = kAS31UseBeerBarrel; - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; } break; case TALK_CURSOR: @@ -544,15 +544,14 @@ void Scene31::updateAnimations() { case kAS31FillEmptyBucketWithBeer: gameSys.setAnimation(0x102, 59, 0); gameSys.insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapX = 5; - _vm->_gnapY = 7; + _vm->_gnap->_pos = Common::Point(5, 7); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x102; _vm->_gnapId = 59; _vm->_gnapActionStatus = kAS31FillEmptyBucketWithBeerDone; break; case kAS31FillEmptyBucketWithBeerDone: - _vm->_gnapIdleFacing = kDirBottomLeft; + _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); @@ -899,14 +898,14 @@ void Scene33::run() { } else { switch (_vm->_verbCursor) { case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnapActionStatus = kAS33UseChicken; else _vm->_gnapActionStatus = -1; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS33TalkChicken; break; @@ -924,8 +923,8 @@ void Scene33::run() { _vm->_isLeavingScene = true; _vm->_gnapActionStatus = kAS33LeaveScene; _vm->_newSceneNum = 37; - if (_vm->_gnapX > 6) - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); + if (_vm->_gnap->_pos.x > 6) + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); else _vm->gnapWalkTo(6, 7, 0, 0x107B1, 1); } @@ -936,8 +935,8 @@ void Scene33::run() { _vm->_isLeavingScene = true; _vm->_gnapActionStatus = kAS33LeaveScene; _vm->_newSceneNum = 35; - if (_vm->_gnapX > 7) - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AD, 1); + if (_vm->_gnap->_pos.x > 7) + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); else _vm->gnapWalkTo(7, 7, 0, 0x107B1, 1); } @@ -1033,7 +1032,7 @@ void Scene33::updateAnimations() { _vm->_timers[2] = 100; break; case kAS33UseChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _currChickenSequenceId = 0x7E; @@ -1324,9 +1323,8 @@ void Scene38::updateAnimations() { gameSys.insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA0; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_pos = Common::Point(3, 6); + _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->_isLeavingScene) { _vm->_sceneWaiting = false; _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); @@ -1339,9 +1337,8 @@ void Scene38::updateAnimations() { gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9E; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapX = 3; - _vm->_gnapY = 6; - _vm->_gnapIdleFacing = kDirBottomRight; + _vm->_gnap->_pos = Common::Point(3, 6); + _vm->_gnap->_idleFacing = kDirBottomRight; gameSys.setAnimation(0x9E, _vm->_gnapId, 0); _vm->_sceneWaiting = false; updateHotspots(); @@ -1481,7 +1478,7 @@ void Scene39::run() { if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_gnapY, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AB, 1); _vm->_gnapActionStatus = kAS39LeaveScene; _vm->_newSceneNum = 40; } diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index b9119b72ff..008246aa9e 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -265,9 +265,8 @@ void Scene41::run() { if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_gnapSequenceId = 0x120; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapIdleFacing = kDirUpRight; - _vm->_gnapX = 7; - _vm->_gnapY = 7; + _vm->_gnap->_idleFacing = kDirUpRight; + _vm->_gnap->_pos = Common::Point(7, 7); _vm->_gnapId = 140; gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); @@ -412,7 +411,7 @@ void Scene41::run() { _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS41TalkToyVendor; break; @@ -426,7 +425,7 @@ void Scene41::run() { case kHS41Kid: if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(7, 7, 8, 0); @@ -437,11 +436,11 @@ void Scene41::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapActionStatus = kAS41GrabKid; break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(7, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case PLAT_CURSOR: @@ -887,7 +886,7 @@ void Scene42::run() { case kHS42ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, 0, 0x107AE, 1); _vm->_gnapActionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_platX, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, -1, 0x107C7, 1); _vm->_newSceneNum = 40; @@ -895,7 +894,7 @@ void Scene42::run() { case kHS42ExitToyStand: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_hotspotsWalkPos[kHS42ExitToyStand].y, -1, 0x107CF, 1); _vm->_newSceneNum = 41; @@ -903,7 +902,7 @@ void Scene42::run() { case kHS42ExitUfo: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); _vm->_gnapActionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_hotspotsWalkPos[kHS42ExitUfo].y, -1, 0x107CD, 1); _vm->_newSceneNum = 43; @@ -923,7 +922,7 @@ void Scene42::run() { _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = kAS42TalkBBQVendor; break; @@ -1066,7 +1065,7 @@ void Scene42::updateAnimations() { gameSys.insertSequence(0x107B7, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), - 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnapSequenceDatNum = 1; } else { gameSys.insertSequence(sequenceId, _vm->_gnapId, @@ -1353,7 +1352,7 @@ void Scene43::run() { case kHS43ExitBBQ: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_hotspotsWalkPos[kHS43ExitBBQ].y, -1, 0x107CF, 1); _vm->_newSceneNum = 42; @@ -1361,7 +1360,7 @@ void Scene43::run() { case kHS43ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); _vm->_gnapActionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_hotspotsWalkPos[kHS43ExitKissinBooth].y, -1, 0x107CD, 1); _vm->_newSceneNum = 44; @@ -1376,7 +1375,7 @@ void Scene43::run() { _vm->playGnapScratchingHead(7, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = 2; break; @@ -1398,7 +1397,7 @@ void Scene43::run() { _vm->playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(3, 7, 0, 67515, 1); _vm->_gnapActionStatus = 1; break; @@ -1801,7 +1800,7 @@ void Scene44::run() { case kHS44ExitUfo: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_platY, -1, 0x107CF, 1); _vm->_newSceneNum = 43; @@ -1828,14 +1827,14 @@ void Scene44::run() { _vm->playGnapImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = 1; break; case PLAT_CURSOR: _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(6, 7, 1, 0x107D2, 1); - if (_vm->_gnapX == 7 && _vm->_gnapY == 7) + if (_vm->_gnap->_pos == Common::Point(7, 7)) _vm->gnapWalkStep(); _vm->playGnapIdle(5, 7); _vm->_platypusActionStatus = 4; @@ -1882,7 +1881,7 @@ void Scene44::run() { _vm->playGnapScratchingHead(8, 7); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case GRAB_CURSOR: @@ -2203,7 +2202,7 @@ void Scene45::run() { gameSys.setAnimation(0x107BD, _vm->_gnapId, 0); gameSys.insertSequence(0x107BD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->_gnapSequenceId = 0x7BD; @@ -2286,7 +2285,7 @@ void Scene45::run() { case kHS45ExitUfoParty: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y, 0, 0x107AE, 1); _vm->_gnapActionStatus = 0; _vm->_newSceneNum = 40; } @@ -2295,7 +2294,7 @@ void Scene45::run() { case kHS45ExitShoe: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_platY, -1, 0x107CF, 1); _vm->_newSceneNum = 46; @@ -2305,7 +2304,7 @@ void Scene45::run() { case kHS45ExitRight: if (_vm->_gnapActionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); _vm->_gnapActionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_platY, -1, 0x107CD, 1); _vm->_newSceneNum = 41; @@ -2615,7 +2614,7 @@ void Scene46::run() { _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpLeft; + _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = 2; break; @@ -2636,7 +2635,7 @@ void Scene46::run() { _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); break; case TALK_CURSOR: - _vm->_gnapIdleFacing = kDirUpRight; + _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnapActionStatus = 1; break; @@ -2650,14 +2649,14 @@ void Scene46::run() { case kHS46ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnapX, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y, 0, 0x107AE, 1); _vm->_gnapActionStatus = 0; _vm->_newSceneNum = 40; break; case kHS46ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnapY, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_platY, -1, 0x107CF, 1); _vm->_newSceneNum = 44; @@ -2665,7 +2664,7 @@ void Scene46::run() { case kHS46ExitDisco: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnapY, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); _vm->_gnapActionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_platY, -1, 0x107CD, 1); _vm->_newSceneNum = 45; -- cgit v1.2.3 From 45bc40166f3d256312327a7c67e055505649705e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 May 2016 20:03:18 +0200 Subject: GNAP: Use a Character for Platypus (WIP) --- engines/gnap/character.cpp | 2 + engines/gnap/character.h | 4 + engines/gnap/gnap.cpp | 67 ++++++++-------- engines/gnap/gnap.h | 5 +- engines/gnap/grid.cpp | 169 ++++++++++++++++++++--------------------- engines/gnap/scenes/group0.cpp | 102 ++++++++++++------------- engines/gnap/scenes/group1.cpp | 76 +++++++++--------- engines/gnap/scenes/group2.cpp | 44 +++++------ engines/gnap/scenes/group3.cpp | 42 +++++----- engines/gnap/scenes/group4.cpp | 77 +++++++++---------- 10 files changed, 290 insertions(+), 298 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 6e4ade35a5..e0110ee329 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -34,4 +34,6 @@ Character::~Character() {} PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) {} +PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} + } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 5949b7a1eb..8012ab634e 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -53,6 +53,10 @@ public: PlayerGnap(GnapEngine *vm); }; +class PlayerPlat : public Character { +public: + PlayerPlat(GnapEngine *vm); +}; } // End of namespace Gnap #endif // GNAP_CHARACTER_H diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index ff9c79e9cd..76184fc58d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -149,12 +149,14 @@ Common::Error GnapEngine::run() { _soundMan = new SoundMan(this); _debugger = new Debugger(this); _gnap = new PlayerGnap(this); + _plat = new PlayerPlat(this); _menuBackgroundSurface = nullptr; initGlobalSceneVars(); mainLoop(); + delete _plat; delete _gnap; delete _soundMan; delete _gameSys; @@ -373,10 +375,10 @@ void GnapEngine::updateCursorByHotspot() { setCursor(kDisabledCursors[_verbCursor]); } // Update platypus hotspot - _hotspots[0]._x1 = _gridMinX + 75 * _platX - 30; - _hotspots[0]._y1 = _gridMinY + 48 * _platY - 100; - _hotspots[0]._x2 = _gridMinX + 75 * _platX + 30; - _hotspots[0]._y2 = _gridMinY + 48 * _platY; + _hotspots[0]._x1 = _gridMinX + 75 * _plat->_pos.x - 30; + _hotspots[0]._y1 = _gridMinY + 48 * _plat->_pos.y - 100; + _hotspots[0]._x2 = _gridMinX + 75 * _plat->_pos.x + 30; + _hotspots[0]._y2 = _gridMinY + 48 * _plat->_pos.y; } int GnapEngine::getClickedHotspotId() { @@ -1544,7 +1546,7 @@ void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { } void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { - if (_platX == gridX && _platY == gridY) + if (_plat->_pos.x == gridX && _plat->_pos.y == gridY) platypusMakeRoom(); gnapWalkTo(gridX, gridY, -1, -1, 1); playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); @@ -1674,18 +1676,18 @@ void GnapEngine::gnapInitBrainPulseRndValue() { } void GnapEngine::gnapUseDeviceOnPlatypus() { - playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _platX, _platY))); + playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _plat->_pos.x, _plat->_pos.y))); - if (_platypusFacing != kDirNone) { + if (_plat->_idleFacing != kDirNone) { _gameSys->insertSequence(makeRid(1, 0x7D5), _platypusId, makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, - kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqSyncWait, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); _platypusSequenceId = 0x7D5; _platypusSequenceDatNum = 1; } else { _gameSys->insertSequence(makeRid(1, 0x7D4), _platypusId, makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, - kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqSyncWait, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); _platypusSequenceId = 0x7D4; _platypusSequenceDatNum = 1; } @@ -1713,17 +1715,17 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in if (_gnapActionStatus <= -1 && _platypusActionStatus <= -1) { _gnapActionStatus = 100; - if (isPointBlocked(_platX + gridX, _platY + gridY) && (_gnap->_pos != Common::Point(_platX + gridX, _platY + gridY))) + if (isPointBlocked(_plat->_pos.x + gridX, _plat->_pos.y + gridY) && (_gnap->_pos != Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY))) platypusWalkStep(); - if (!isPointBlocked(_platX + gridX, _platY + gridY) && (_gnap->_pos != Common::Point(_platX + gridX, _platY + gridY))) { - gnapWalkTo(_platX + gridX, _platY + gridY, 0, 0x107B9, 1); + if (!isPointBlocked(_plat->_pos.x + gridX, _plat->_pos.y + gridY) && (_gnap->_pos != Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY))) { + gnapWalkTo(_plat->_pos.x + gridX, _plat->_pos.y + gridY, 0, 0x107B9, 1); while (_gameSys->getAnimationStatus(0) != 2) { updateMouseCursor(); doCallback(callback); gameUpdateTick(); } _gameSys->setAnimation(0, 0, 0); - if (_gnap->_pos == Common::Point(_platX + gridX, _platY + gridY)) { + if (_gnap->_pos == Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY)) { _gameSys->setAnimation(platSequenceId, _platypusId, 1); playPlatypusSequence(platSequenceId); while (_gameSys->getAnimationStatus(1) != 2) { @@ -1751,10 +1753,10 @@ void GnapEngine::gnapKissPlatypus(int callback) { _gnapSequenceId = 0x847; _gameSys->insertSequence(0x107CB, _platypusId, makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, - kSeqSyncWait, getSequenceTotalDuration(0x10847), 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqSyncWait, getSequenceTotalDuration(0x10847), 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); _platypusSequenceDatNum = 1; _platypusSequenceId = 0x7CB; - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; playGnapSequence(0x107B5); while (_gameSys->getAnimationStatus(0) != 2) { updateMouseCursor(); @@ -1764,7 +1766,7 @@ void GnapEngine::gnapKissPlatypus(int callback) { _gameSys->setAnimation(0, 0, 0); _gnapActionStatus = -1; } else { - playGnapSequence(getGnapSequenceId(gskScratchingHead, _platX, _platY) | 0x10000); + playGnapSequence(getGnapSequenceId(gskScratchingHead, _plat->_pos.x, _plat->_pos.y) | 0x10000); } } @@ -1781,10 +1783,10 @@ void GnapEngine::gnapUseJointOnPlatypus() { _gnapSequenceId = 0x875; _gameSys->insertSequence(0x10876, _platypusId, _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, - kSeqSyncWait, 0, 15 * (5 * _platX - 25), 48 * (_platY - 7)); + kSeqSyncWait, 0, 15 * (5 * _plat->_pos.x - 25), 48 * (_plat->_pos.y - 7)); _platypusSequenceDatNum = 1; _platypusSequenceId = 0x876; - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; playGnapSequence(0x107B5); gnapWalkStep(); while (_gameSys->getAnimationStatus(0) != 2) { @@ -1794,7 +1796,7 @@ void GnapEngine::gnapUseJointOnPlatypus() { _gameSys->setAnimation(0, 0, 0); _gnapActionStatus = -1; } else { - playGnapSequence(getGnapSequenceId(gskScratchingHead, _platX, _platY) | 0x10000); + playGnapSequence(getGnapSequenceId(gskScratchingHead, _plat->_pos.x, _plat->_pos.y) | 0x10000); } } @@ -1815,9 +1817,9 @@ int GnapEngine::getPlatypusSequenceId() { int sequenceId = 0x7CB; - if (_platypusFacing != kDirNone) { + if (_plat->_idleFacing != kDirNone) { sequenceId = 0x7CC; - _platypusFacing = kDirUnk4; + _plat->_idleFacing = kDirUnk4; } return sequenceId | 0x10000; @@ -1826,7 +1828,7 @@ int GnapEngine::getPlatypusSequenceId() { void GnapEngine::playPlatypusSequence(int sequenceId) { _gameSys->insertSequence(sequenceId, _platypusId, makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, - kSeqScale | kSeqSyncWait, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); _platypusSequenceId = ridToEntryIndex(sequenceId); _platypusSequenceDatNum = ridToDatIndex(sequenceId); } @@ -1837,7 +1839,7 @@ void GnapEngine::updatePlatypusIdleSequence() { if (_timers[1] == 0) { _timers[1] = getRandom(20) + 30; int rnd = getRandom(10); - if (_platypusFacing != kDirNone) { + if (_plat->_idleFacing != kDirNone) { if (rnd != 0 || _platypusSequenceId != 0x7CA) { if (rnd != 1 || _platypusSequenceId != 0x7CA) playPlatypusSequence(0x107CA); @@ -1874,7 +1876,7 @@ void GnapEngine::updatePlatypusIdleSequence2() { if (_timers[0]) { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; - if (_platypusFacing != kDirNone) { + if (_plat->_idleFacing != kDirNone) { if (getRandom(10) >= 2 || _platypusSequenceId != 0x7CA) playPlatypusSequence(0x107CA); else @@ -1900,23 +1902,22 @@ void GnapEngine::updatePlatypusIdleSequence2() { void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { _timers[0] = 50; _timers[1] = 20; - _platX = gridX; - _platY = gridY; + _plat->_pos = Common::Point(gridX, gridY); if (facing == kDirNone) - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; else - _platypusFacing = facing; - if (_platypusFacing == kDirUnk4) { + _plat->_idleFacing = facing; + if (_plat->_idleFacing == kDirUnk4) { _platypusSequenceId = 0x7D1; } else { _platypusSequenceId = 0x7C1; - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; } - _platypusId = 20 * _platY; + _platypusId = 20 * _plat->_pos.y; _platypusSequenceDatNum = 1; - _gameSys->insertSequence(makeRid(1, _platypusSequenceId), 20 * _platY, + _gameSys->insertSequence(makeRid(1, _platypusSequenceId), 20 * _plat->_pos.y, 0, 0, - kSeqScale, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); + kSeqScale, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); } //////////////////////////////////////////////////////////////////////////////// diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index d16ba24f92..ce631a392c 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -242,8 +242,6 @@ enum { 29 0x20000000 Gas taken 30 0x40000000 31 0x80000000 - - */ // 0x7AB Gnap walks to the right 1 @@ -285,6 +283,7 @@ public: Debugger *_debugger; Scene *_scene; PlayerGnap *_gnap; + PlayerPlat *_plat; int _lastUpdateClock; @@ -504,7 +503,6 @@ public: // Platypus walking int _platWalkNodesCount; GridStruct _platWalkNodes[kMaxGridStructs]; - int _platX, _platY; int _platWalkDestX, _platWalkDestY; int _platWalkDeltaX, _platWalkDeltaY, _platWalkDirX, _platWalkDirY, _platWalkDirXIncr, _platWalkDirYIncr; @@ -550,7 +548,6 @@ public: void gnapUseDisguiseOnPlatypus(); // Platypus - Facing _platypusFacing; int _platypusActionStatus; int _platypusSequenceId, _platypusSequenceDatNum, _platypusId; int getPlatypusSequenceId(); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index ec90cf1e8a..31b7934f42 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -73,7 +73,7 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { if (gridX < 0 || gridX >= _gridMaxX || gridY < 0 || gridY >= _gridMaxY) return true; - if ((_gnap->_pos == Common::Point(gridX, gridY)) || (gridX == _platX && gridY == _platY)) + if ((_gnap->_pos == Common::Point(gridX, gridY)) || (gridX == _plat->_pos.x && gridY == _plat->_pos.y)) return true; const int x = _gridMinX + 75 * gridX; @@ -557,7 +557,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapWalkDestX = CLIP(gridX, 0, _gridMaxX - 1); _gnapWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); - if (animationIndex >= 0 && _gnapWalkDestX == _platX && _gnapWalkDestY == _platY) + if (animationIndex >= 0 && _gnapWalkDestX == _plat->_pos.x && _gnapWalkDestY == _plat->_pos.y) platypusMakeRoom(); // TODO: Simplify the cascade of Ifs @@ -1032,160 +1032,160 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { bool done = false; while (!done && gridIncr < _gridMaxX) { - if (!isPointBlocked(_platX + gridIncr, _platY) && gridSub423CC1(_platX + gridIncr, _platY, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX + i; - _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y; _platWalkNodes[i]._deltaX = 1; _platWalkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_platX - gridIncr, _platY) && gridSub423CC1(_platX - gridIncr, _platY, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX - i; - _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y; _platWalkNodes[i]._deltaX = -1; _platWalkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_platX, _platY + gridIncr) && gridSub423CC1(_platX, _platY + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX; - _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x; + _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; _platWalkNodes[i]._deltaX = 0; _platWalkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_platX, _platY - gridIncr) && gridSub423CC1(_platX, _platY - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX; - _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x; + _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; _platWalkNodes[i]._deltaX = 0; _platWalkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_platX + gridIncr, _platY + gridIncr) && gridSub423CC1(_platX + gridIncr, _platY + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX + i; - _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; _platWalkNodes[i]._deltaX = 1; _platWalkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_platX - gridIncr, _platY + gridIncr) && gridSub423CC1(_platX - gridIncr, _platY + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX - i; - _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; _platWalkNodes[i]._deltaX = -1; _platWalkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_platX + gridIncr, _platY - gridIncr) && gridSub423CC1(_platX + gridIncr, _platY - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX + i; - _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; _platWalkNodes[i]._deltaX = 1; _platWalkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_platX - gridIncr, _platY - gridIncr) && gridSub423CC1(_platX - gridIncr, _platY - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX - i; - _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; _platWalkNodes[i]._deltaX = -1; _platWalkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_platX + gridIncr, _platY) && gridSub42419A(_platX + gridIncr, _platY, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX + i; - _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y; _platWalkNodes[i]._deltaX = 1; _platWalkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_platX - gridIncr, _platY) && gridSub42419A(_platX - gridIncr, _platY, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX - i; - _platWalkNodes[i]._gridY1 = _platY; + _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y; _platWalkNodes[i]._deltaX = -1; _platWalkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_platX, _platY + gridIncr) && gridSub42419A(_platX, _platY + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX; - _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x; + _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; _platWalkNodes[i]._deltaX = 0; _platWalkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_platX, _platY - gridIncr) && gridSub42419A(_platX, _platY - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX; - _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x; + _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; _platWalkNodes[i]._deltaX = 0; _platWalkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_platX + gridIncr, _platY + gridIncr) && gridSub42419A(_platX + gridIncr, _platY + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX + i; - _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; _platWalkNodes[i]._deltaX = 1; _platWalkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_platX - gridIncr, _platY + gridIncr) && gridSub42419A(_platX - gridIncr, _platY + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX - i; - _platWalkNodes[i]._gridY1 = _platY + i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; _platWalkNodes[i]._deltaX = -1; _platWalkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_platX + gridIncr, _platY - gridIncr) && gridSub42419A(_platX + gridIncr, _platY - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX + i; - _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; _platWalkNodes[i]._deltaX = 1; _platWalkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_platX - gridIncr, _platY - gridIncr) && gridSub42419A(_platX - gridIncr, _platY - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _platX - i; - _platWalkNodes[i]._gridY1 = _platY - i; + _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; + _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; _platWalkNodes[i]._deltaX = -1; _platWalkNodes[i]._deltaY = -1; } @@ -1217,17 +1217,17 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (animationIndex >= 0 && _gnap->_pos == Common::Point(_platWalkDestX, _platWalkDestY)) gnapWalkStep(); - if (gridSub423CC1(_platX, _platY, 0)) + if (gridSub423CC1(_plat->_pos.x, _plat->_pos.y, 0)) done = true; - if (!done && gridSub42419A(_platX, _platY, 0)) + if (!done && gridSub42419A(_plat->_pos.x, _plat->_pos.y, 0)) done = true; - if (!done && platFindPath3(_platX, _platY)) + if (!done && platFindPath3(_plat->_pos.x, _plat->_pos.y)) done = true; if (!done) - gridSub423750(_platX, _platY); + gridSub423750(_plat->_pos.x, _plat->_pos.y); int platSequenceId = _platypusSequenceId; int platId = _platypusId; @@ -1286,13 +1286,13 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platypusSequenceDatNum = datNum; // CHECKME Not sure if this is correct... if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) - _platypusFacing = kDirUnk4; + _plat->_idleFacing = kDirUnk4; else if (_platWalkNodes[_platWalkNodesCount - 1]._gridX1 % 2) - _platypusFacing = kDirUnk4; + _plat->_idleFacing = kDirUnk4; else - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; if (animationIndex >= 0) _gameSys->setAnimation(makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, animationIndex); } else if (animationIndex >= 0) { @@ -1304,29 +1304,29 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platypusSequenceId = ridToEntryIndex(sequenceId); _platypusSequenceDatNum = ridToDatIndex(sequenceId); if (_platypusSequenceId == 0x7C2) { - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; } else if (_platypusSequenceId == 0x7D2) { - _platypusFacing = kDirUnk4; + _plat->_idleFacing = kDirUnk4; } } else { if (_platWalkNodesCount > 0) { if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) { _platypusSequenceId = 0x7C2; - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; } else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) { _platypusSequenceId = 0x7D2; - _platypusFacing = kDirUnk4; + _plat->_idleFacing = kDirUnk4; } else if (_platWalkNodes[0]._deltaX > 0) { _platypusSequenceId = 0x7C2; - _platypusFacing = kDirNone; + _plat->_idleFacing = kDirNone; } else if (_platWalkNodes[0]._deltaX < 0) { _platypusSequenceId = 0x7D2; - _platypusFacing = kDirUnk4; + _plat->_idleFacing = kDirUnk4; } else { _platypusSequenceId = 0x7D2; - _platypusFacing = kDirUnk4; + _plat->_idleFacing = kDirUnk4; } - } else if (_platypusFacing != kDirNone) { + } else if (_plat->_idleFacing != kDirNone) { _platypusSequenceId = 0x7D2; } else { _platypusSequenceId = 0x7C2; @@ -1351,8 +1351,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se 9, 0, 75 * _platWalkDestX - _platGridX, 48 * _platWalkDestY - _platGridY); } - _platX = _platWalkDestX; - _platY = _platWalkDestY; + _plat->_pos = Common::Point(_platWalkDestX, _platWalkDestY); return done; } @@ -1361,22 +1360,22 @@ void GnapEngine::platypusWalkStep() { bool done = false; for (int i = 1; !done && i < _gridMaxX; ++i) { done = true; - if (!isPointBlocked(_platX + i, _platY)) - platypusWalkTo(_platX + i, _platY, -1, -1, 1); - else if (!isPointBlocked(_platX - i, _platY)) - platypusWalkTo(_platX - i, _platY, -1, -1, 1); - else if (!isPointBlocked(_platX, _platY + 1)) - platypusWalkTo(_platX, _platY + 1, -1, -1, 1); - else if (!isPointBlocked(_platX, _platY - 1)) - platypusWalkTo(_platX, _platY - 1, -1, -1, 1); - else if (!isPointBlocked(_platX + 1, _platY + 1)) - platypusWalkTo(_platX + 1, _platY + 1, -1, -1, 1); - else if (!isPointBlocked(_platX - 1, _platY + 1)) - platypusWalkTo(_platX - 1, _platY + 1, -1, -1, 1); - else if (!isPointBlocked(_platX + 1, _platY - 1)) - platypusWalkTo(_platX + 1, _platY - 1, -1, -1, 1); - else if (!isPointBlocked(_platX - 1, _platY - 1)) - platypusWalkTo(_platX - 1, _platY - 1, -1, -1, 1); + if (!isPointBlocked(_plat->_pos.x + i, _plat->_pos.y)) + platypusWalkTo(_plat->_pos.x + i, _plat->_pos.y, -1, -1, 1); + else if (!isPointBlocked(_plat->_pos.x - i, _plat->_pos.y)) + platypusWalkTo(_plat->_pos.x - i, _plat->_pos.y, -1, -1, 1); + else if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + 1)) + platypusWalkTo(_plat->_pos.x, _plat->_pos.y + 1, -1, -1, 1); + else if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - 1)) + platypusWalkTo(_plat->_pos.x, _plat->_pos.y - 1, -1, -1, 1); + else if (!isPointBlocked(_plat->_pos.x + 1, _plat->_pos.y + 1)) + platypusWalkTo(_plat->_pos.x + 1, _plat->_pos.y + 1, -1, -1, 1); + else if (!isPointBlocked(_plat->_pos.x - 1, _plat->_pos.y + 1)) + platypusWalkTo(_plat->_pos.x - 1, _plat->_pos.y + 1, -1, -1, 1); + else if (!isPointBlocked(_plat->_pos.x + 1, _plat->_pos.y - 1)) + platypusWalkTo(_plat->_pos.x + 1, _plat->_pos.y - 1, -1, -1, 1); + else if (!isPointBlocked(_plat->_pos.x - 1, _plat->_pos.y - 1)) + platypusWalkTo(_plat->_pos.x - 1, _plat->_pos.y - 1, -1, -1, 1); else done = false; } @@ -1387,7 +1386,7 @@ void GnapEngine::platypusMakeRoom() { do { rndGridY = getRandom(_gridMaxY); rndGridX = getRandom(_gridMaxX); - } while (ABS(rndGridX - _platX) > 4 || ABS(rndGridY - _platY) > 3 || + } while (ABS(rndGridX - _plat->_pos.x) > 4 || ABS(rndGridY - _plat->_pos.y) > 3 || isPointBlocked(rndGridX, rndGridY)); platypusWalkTo(rndGridX, rndGridY, -1, -1, 1); } diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 019678d15f..087fb53a5e 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -131,15 +131,15 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -481,15 +481,15 @@ void Scene02::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -946,15 +946,15 @@ void Scene03::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1183,12 +1183,11 @@ void Scene03::updateAnimations() { break; case kAS03FreePlatypusDone: _vm->_gnapActionStatus = -1; - _vm->_platX = 6; - _vm->_platY = 6; - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_pos = Common::Point(6, 6); + _vm->_plat->_idleFacing = kDirUnk4; _vm->_platypusId = 120; gameSys.insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, - kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); gameSys.insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); _vm->_platypusSequenceDatNum = 1; _vm->_platypusSequenceId = 0x7CA; @@ -1382,8 +1381,7 @@ void Scene04::run() { _vm->setGrabCursorSprite(kItemKeys); _vm->_gnap->_pos = Common::Point(4, 7); _vm->_gnapId = 140; - _vm->_platX = 6; - _vm->_platY = 7; + _vm->_plat->_pos = Common::Point(6, 7); _vm->_platypusId = 141; gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); gameSys.insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); @@ -1396,7 +1394,7 @@ void Scene04::run() { _vm->clearFlag(kGFPlatypusDisguised); _vm->_platypusSequenceId = 0x20C; _vm->_platypusSequenceDatNum = 0; - _vm->_platypusFacing = kDirBottomRight; + _vm->_plat->_idleFacing = kDirBottomRight; _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; gameSys.waitForUpdate(); @@ -1452,18 +1450,18 @@ void Scene04::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: if (_vm->_cursorValue == 4) _vm->gnapKissPlatypus(0); else - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1927,15 +1925,15 @@ void Scene05::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1966,11 +1964,11 @@ void Scene05::run() { _vm->gnapUseDeviceOnPlatypus(); if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { _vm->_platypusActionStatus = kAS05PlatSearchHaystack; - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; } if (_vm->_gnap->_pos.x == 4 && (_vm->_gnap->_pos.y == 8 || _vm->_gnap->_pos.y == 7)) _vm->gnapWalkStep(); - _vm->playGnapIdle(_vm->_platX, _vm->_platY); + _vm->playGnapIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } break; } @@ -2205,12 +2203,11 @@ void Scene05::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { if (_vm->_platypusSequenceId == 0x146) { - _vm->_platX = 4; - _vm->_platY = 8; + _vm->_plat->_pos = Common::Point(4, 8); gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; - _vm->_platypusId = 20 * _vm->_platY; + _vm->_platypusId = 20 * _vm->_plat->_pos.y; _vm->invAdd(kItemNeedle); _vm->setFlag(kGFNeedleTaken); _vm->setGrabCursorSprite(kItemNeedle); @@ -2352,15 +2349,15 @@ void Scene06::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -2440,7 +2437,7 @@ void Scene06::run() { _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); - _vm->_platypusFacing = kDirNone; + _vm->_plat->_idleFacing = kDirNone; _vm->_gnapActionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2593,8 +2590,7 @@ void Scene06::updateAnimations() { _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; _vm->setGrabCursorSprite(kItemGas); _vm->_platypusActionStatus = -1; - _vm->_platX = 6; - _vm->_platY = 8; + _vm->_plat->_pos = Common::Point(6, 8); gameSys.insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; @@ -2697,12 +2693,11 @@ void Scene07::run() { gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS07Wait; - _vm->_platX = 3; - _vm->_platY = 8; + _vm->_plat->_pos = Common::Point(3, 8); _vm->_platypusId = 160; _vm->_platypusSequenceId = 0x91; _vm->_platypusSequenceDatNum = 0; - _vm->_platypusFacing = kDirNone; + _vm->_plat->_idleFacing = kDirNone; gameSys.insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); } @@ -2727,13 +2722,13 @@ void Scene07::run() { case kHS07Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -2813,10 +2808,10 @@ void Scene07::run() { _vm->_timers[1] = _vm->getRandom(20) + 30; int gnapRandomValue = _vm->getRandom(20); // TODO Cleanup - if (_vm->_platypusFacing != kDirNone) { + if (_vm->_plat->_idleFacing != kDirNone) { if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7CA) { if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7CA) { - if (_vm->_platY == 9) + if (_vm->_plat->_pos.y == 9) _vm->playPlatypusSequence(0x107CA); } else { _vm->playPlatypusSequence(0x10845); @@ -2826,7 +2821,7 @@ void Scene07::run() { } } else if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7C9) { if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7C9) { - if (_vm->_platY == 9) + if (_vm->_plat->_pos.y == 9) _vm->playPlatypusSequence(0x107C9); } else { _vm->playPlatypusSequence(0x10844); @@ -2995,16 +2990,16 @@ void Scene08::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapActionIdle(0x14D); _vm->gnapKissPlatypus(8); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -3056,7 +3051,7 @@ void Scene08::run() { _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); _vm->_platypusActionStatus = kAS08PlatWithMan; - _vm->_platypusFacing = kDirNone; + _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(6, 6); break; } @@ -3092,7 +3087,7 @@ void Scene08::run() { _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); _vm->_platypusActionStatus = kAS08PlatWithDog; - _vm->_platypusFacing = kDirNone; + _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(3, 7); break; } @@ -3332,11 +3327,10 @@ void Scene08::updateAnimations() { gameSys.insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = 0x134; - _vm->_platX = 1; - _vm->_platY = 8; + _vm->_plat->_pos = Common::Point(1, 8); _vm->_platypusId = 160; _vm->_platypusSequenceId = 0x148; - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; _vm->_platypusSequenceDatNum = 0; if (_vm->_gnap->_pos == Common::Point(1, 8)) _vm->gnapWalkStep(); @@ -3428,13 +3422,13 @@ void Scene09::run() { case kHS09Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -3448,7 +3442,7 @@ void Scene09::run() { _vm->gnapWalkTo(4, 7, 0, 0x107BF, 1); _vm->_gnapActionStatus = kAS09LeaveScene; _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; break; case kHS09ExitHouse: @@ -3457,7 +3451,7 @@ void Scene09::run() { _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); _vm->_gnapActionStatus = kAS09LeaveScene; _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; break; case kHS09Trash: diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 017858b24c..e2d0e9685a 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -112,15 +112,15 @@ void Scene10::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(10); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -242,7 +242,7 @@ void Scene10::run() { _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); _vm->_platypusActionStatus = kAS10PlatWithBox; - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); _vm->playGnapIdle(7, 6); } @@ -368,19 +368,18 @@ void Scene10::updateAnimations() { switch (_nextCookSequenceId) { case 0x109: - _vm->_platX = 4; - _vm->_platY = 8; + _vm->_plat->_pos = Common::Point(4, 8); gameSys.insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x107C9, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), - 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); gameSys.removeSequence(0x107, 100, true); _currCookSequenceId = 0x109; _nextCookSequenceId = 0x843; _vm->_platypusSequenceId = 0x7C9; _vm->_platypusId = 160; - _vm->_platypusFacing = kDirNone; + _vm->_plat->_idleFacing = kDirNone; _vm->_platypusSequenceDatNum = 1; break; case 0x843: @@ -596,13 +595,13 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1015,13 +1014,13 @@ void Scene12::run() { case kHS12Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1073,7 +1072,7 @@ void Scene12::run() { _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); _vm->_platypusActionStatus = kAS12PlatWithToothGuy; - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; _vm->playGnapIdle(2, 7); break; } @@ -1107,7 +1106,7 @@ void Scene12::run() { _vm->_gnapActionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: - _vm->playGnapPullOutDevice(_vm->_platX, _vm->_platY); + _vm->playGnapPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS12PlatWithBarkeeper; break; @@ -1143,7 +1142,7 @@ void Scene12::run() { _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); _vm->_platypusActionStatus = kAS12PlatWithBeardGuy; - _vm->_platypusFacing = kDirNone; + _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(7, 6); break; } @@ -1524,13 +1523,13 @@ void Scene13::run() { case kHS13Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1694,7 +1693,7 @@ void Scene13::run() { if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); - if (_vm->_platY == 5 || _vm->_platY == 6) + if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) _vm->platypusWalkTo(-1, 7, -1, -1, 1); if (_vm->_gnapActionStatus < 0) _vm->updateGnapIdleSequence(); @@ -2423,8 +2422,7 @@ void Scene17::run() { _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { _vm->initGnapPos(3, 9, kDirUpLeft); - _vm->_platX = _vm->_hotspotsWalkPos[2].x; - _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -2459,8 +2457,7 @@ void Scene17::run() { _vm->clearFlag(kGFUnk16); _vm->_sceneWaiting = true; _vm->initGnapPos(3, 9, kDirUpLeft); - _vm->_platX = _vm->_hotspotsWalkPos[2].x; - _vm->_platY = _vm->_hotspotsWalkPos[2].y; + _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); @@ -2498,18 +2495,17 @@ void Scene17::run() { _vm->_gnapSequenceDatNum = 0; _vm->_gnap->_idleFacing = kDirBottomRight; gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platX = -1; - _vm->_platY = 8; + _vm->_plat->_pos = Common::Point(-1, 8); _vm->_platypusId = 160; gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, - kSeqScale | kSeqSyncWait, 0, 75 * _vm->_platX - _vm->_platGridX, 48 * _vm->_platY - _vm->_platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); _vm->endSceneInit(); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; - _vm->_platypusFacing = kDirBottomRight; + _vm->_plat->_idleFacing = kDirBottomRight; _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); } @@ -2544,15 +2540,15 @@ void Scene17::run() { _vm->invRemove(kItemJoint); } } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -2622,7 +2618,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->gnapUseDeviceOnPlatypus(); - _vm->_platypusFacing = kDirUpLeft; + _vm->_plat->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_platypusActionStatus = kAS17PlatUsePhone; @@ -2666,7 +2662,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->gnapUseDeviceOnPlatypus(); - _vm->_platypusFacing = kDirUpLeft; + _vm->_plat->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_platypusActionStatus = kAS17PlatUsePhone; @@ -3186,11 +3182,11 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { else direction = -1; } else { - if (_vm->_gnap->_pos.y == _vm->_platY) { + if (_vm->_gnap->_pos.y == _vm->_plat->_pos.y) { if (nextGridX >= _vm->_gnap->_pos.x) { - if (nextGridX >= _vm->_platX && _vm->_gnap->_pos.x <= _vm->_platX) + if (nextGridX >= _vm->_plat->_pos.x && _vm->_gnap->_pos.x <= _vm->_plat->_pos.x) _vm->platypusMakeRoom(); - } else if (nextGridX <= _vm->_platX && _vm->_gnap->_pos.x >= _vm->_platX) { + } else if (nextGridX <= _vm->_plat->_pos.x && _vm->_gnap->_pos.x >= _vm->_plat->_pos.x) { _vm->platypusMakeRoom(); } } @@ -3442,17 +3438,17 @@ void Scene18::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_platX, _vm->_platY); + _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -4148,17 +4144,17 @@ void Scene19::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 543b4fe23e..23afc55907 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -279,13 +279,13 @@ void Scene20::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(20); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -305,7 +305,7 @@ void Scene20::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y, 0, 0x107AF, 1); _vm->_gnapActionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y + 1, -1, 0x107CF, 1); - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; } break; @@ -344,7 +344,7 @@ void Scene20::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y - 1, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y, -1, 0x107C2, 1); - _vm->_platypusFacing = kDirUnk4; + _vm->_plat->_idleFacing = kDirUnk4; } break; @@ -797,13 +797,13 @@ void Scene21::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1113,13 +1113,13 @@ void Scene22::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1337,13 +1337,13 @@ void Scene23::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1606,13 +1606,13 @@ void Scene24::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -1852,13 +1852,13 @@ void Scene25::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_platX, _vm->_platY); + _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -2169,13 +2169,13 @@ void Scene26::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -2403,13 +2403,13 @@ void Scene27::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -2774,13 +2774,13 @@ void Scene28::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -3165,13 +3165,13 @@ void Scene29::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index adec63a152..0e14ea9e3e 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -94,13 +94,13 @@ void Scene30::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -349,13 +349,13 @@ void Scene31::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: @@ -694,21 +694,21 @@ void Scene32::run() { case kHS32Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -870,21 +870,21 @@ void Scene33::run() { case kHS33Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1147,21 +1147,21 @@ void Scene38::run() { if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1351,7 +1351,7 @@ void Scene38::updateAnimations() { _vm->_gnapSequenceDatNum = 0; gameSys.setAnimation(0x9F, _vm->_gnapId, 0); _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; - if (_vm->_platypusFacing != kDirNone) + if (_vm->_plat->_idleFacing != kDirNone) _vm->playPlatypusSequence(0x107D5); else _vm->playPlatypusSequence(0x107D4); @@ -1453,21 +1453,21 @@ void Scene39::run() { case kHS39Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 008246aa9e..861283af34 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -76,21 +76,21 @@ void Scene40::run() { case kHS40Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -351,21 +351,21 @@ void Scene41::run() { case kHS41Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -863,21 +863,21 @@ void Scene42::run() { case kHS42Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -888,7 +888,7 @@ void Scene42::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, 0, 0x107AE, 1); _vm->_gnapActionStatus = kAS42LeaveScene; - _vm->platypusWalkTo(_vm->_platX, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, -1, 0x107C7, 1); + _vm->platypusWalkTo(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; @@ -912,8 +912,8 @@ void Scene42::run() { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, 0x107BB, 1); _vm->_gnapActionStatus = kAS42UseQuarterWithBBQVendor; - if (_vm->_platY < 9) - _vm->platypusWalkTo(_vm->_platX, 9, -1, -1, 1); + if (_vm->_plat->_pos.y < 9) + _vm->platypusWalkTo(_vm->_plat->_pos.x, 9, -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { @@ -1321,21 +1321,21 @@ void Scene43::run() { case kHS43Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1701,10 +1701,9 @@ void Scene44::run() { } else if (!_vm->isFlag(kGFUnk13)) { _vm->_timers[0] = 50; _vm->_timers[1] = 20; - _vm->_platX = 5; - _vm->_platY = 8; + _vm->_plat->_pos = Common::Point(5, 8); _vm->_platypusSequenceId = 0xFD; - _vm->_platypusFacing = kDirNone; + _vm->_plat->_idleFacing = kDirNone; _vm->_platypusId = 160; _vm->_platypusSequenceDatNum = 0; gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); @@ -1770,21 +1769,21 @@ void Scene44::run() { case kHS44Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1802,7 +1801,7 @@ void Scene44::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_platY, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; @@ -2259,11 +2258,11 @@ void Scene45::run() { case kHS45Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); @@ -2271,11 +2270,11 @@ void Scene45::run() { gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2296,7 +2295,7 @@ void Scene45::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_platY, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 46; } break; @@ -2306,7 +2305,7 @@ void Scene45::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_platY, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); _vm->_newSceneNum = 41; } break; @@ -2584,21 +2583,21 @@ void Scene46::run() { case kHS46Platypus: if (_vm->_gnapActionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_platX, _vm->_platY); + _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->gnapKissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); + _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_platX, _vm->_platY); + _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2658,7 +2657,7 @@ void Scene46::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_platY, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 44; break; @@ -2666,7 +2665,7 @@ void Scene46::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); _vm->_gnapActionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_platY, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); _vm->_newSceneNum = 45; break; -- cgit v1.2.3 From dda4931ee9d78c704ebd768af243d7019e9d0913 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 4 May 2016 21:07:12 +0200 Subject: GNAP: Move _actionStatus to the Character class --- engines/gnap/character.cpp | 1 + engines/gnap/character.h | 1 + engines/gnap/gnap.cpp | 36 +-- engines/gnap/gnap.h | 2 - engines/gnap/scenes/group0.cpp | 442 ++++++++++++++++++------------------ engines/gnap/scenes/group1.cpp | 492 ++++++++++++++++++++--------------------- engines/gnap/scenes/group2.cpp | 390 ++++++++++++++++---------------- engines/gnap/scenes/group3.cpp | 264 +++++++++++----------- engines/gnap/scenes/group4.cpp | 240 ++++++++++---------- engines/gnap/scenes/group5.cpp | 42 ++-- 10 files changed, 955 insertions(+), 955 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index e0110ee329..84274877d9 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -28,6 +28,7 @@ namespace Gnap { Character::Character(GnapEngine *vm) : _vm(vm) { _pos = Common::Point(0, 0); _idleFacing = kDirNone; + _actionStatus = 0; } Character::~Character() {} diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 8012ab634e..4f5282435f 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -43,6 +43,7 @@ public: Common::Point _pos; Facing _idleFacing; + int _actionStatus; protected: GnapEngine *_vm; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 76184fc58d..d02321a8f5 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -412,10 +412,10 @@ void GnapEngine::updateMouseCursor() { setCursor(kDisabledCursors[_verbCursor]); setGrabCursorSprite(-1); } - if (_isWaiting && ((_gnapActionStatus < 0 && _platypusActionStatus < 0) || _sceneWaiting)) { + if (_isWaiting && ((_gnap->_actionStatus < 0 && _plat->_actionStatus < 0) || _sceneWaiting)) { setCursor(kDisabledCursors[_verbCursor]); _isWaiting = false; - } else if (!_isWaiting && (_gnapActionStatus >= 0 || _platypusActionStatus >= 0) && !_sceneWaiting) { + } else if (!_isWaiting && (_gnap->_actionStatus >= 0 || _plat->_actionStatus >= 0) && !_sceneWaiting) { setCursor(WAIT_CURSOR); _isWaiting = true; } @@ -733,8 +733,8 @@ void GnapEngine::initScene() { _isLeavingScene = false; _sceneDone = false; _newSceneNum = 55; - _gnapActionStatus = -1; - _platypusActionStatus = -1; + _gnap->_actionStatus = -1; + _plat->_actionStatus = -1; gnapInitBrainPulseRndValue(); hideCursor(); clearAllKeyStatus1(); @@ -1553,7 +1553,7 @@ void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int g } void GnapEngine::updateGnapIdleSequence() { - if (_gnapActionStatus < 0) { + if (_gnap->_actionStatus < 0) { if (_timers[2] > 0) { if (_timers[3] == 0) { _timers[2] = 60; @@ -1603,7 +1603,7 @@ void GnapEngine::updateGnapIdleSequence() { } void GnapEngine::updateGnapIdleSequence2() { - if (_gnapActionStatus < 0) { + if (_gnap->_actionStatus < 0) { if (_timers[2] > 0) { if (_timers[3] == 0) { _timers[2] = 60; @@ -1637,11 +1637,11 @@ void GnapEngine::updateGnapIdleSequence2() { } bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2) { - if (_mouseClickState._left && someStatus == _gnapActionStatus) { + if (_mouseClickState._left && someStatus == _gnap->_actionStatus) { _isLeavingScene = false; _gameSys->setAnimation(0, 0, animationIndex); - _gnapActionStatus = -1; - _platypusActionStatus = -1; + _gnap->_actionStatus = -1; + _plat->_actionStatus = -1; gnapWalkTo(gridX1, gridY1, -1, -1, 1); platypusWalkTo(gridX2, gridY2, -1, -1, 1); _mouseClickState._left = false; @@ -1713,8 +1713,8 @@ void GnapEngine::doCallback(int callback) { bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) { bool result = false; - if (_gnapActionStatus <= -1 && _platypusActionStatus <= -1) { - _gnapActionStatus = 100; + if (_gnap->_actionStatus <= -1 && _plat->_actionStatus <= -1) { + _gnap->_actionStatus = 100; if (isPointBlocked(_plat->_pos.x + gridX, _plat->_pos.y + gridY) && (_gnap->_pos != Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY))) platypusWalkStep(); if (!isPointBlocked(_plat->_pos.x + gridX, _plat->_pos.y + gridY) && (_gnap->_pos != Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY))) { @@ -1736,14 +1736,14 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in result = true; } } - _gnapActionStatus = -1; + _gnap->_actionStatus = -1; } return result; } void GnapEngine::gnapKissPlatypus(int callback) { if (gnapPlatypusAction(-1, 0, 0x107D1, callback)) { - _gnapActionStatus = 100; + _gnap->_actionStatus = 100; _gameSys->setAnimation(0, 0, 1); _gameSys->setAnimation(0x10847, _gnapId, 0); _gameSys->insertSequence(0x10847, _gnapId, @@ -1764,7 +1764,7 @@ void GnapEngine::gnapKissPlatypus(int callback) { gameUpdateTick(); } _gameSys->setAnimation(0, 0, 0); - _gnapActionStatus = -1; + _gnap->_actionStatus = -1; } else { playGnapSequence(getGnapSequenceId(gskScratchingHead, _plat->_pos.x, _plat->_pos.y) | 0x10000); } @@ -1773,7 +1773,7 @@ void GnapEngine::gnapKissPlatypus(int callback) { void GnapEngine::gnapUseJointOnPlatypus() { setGrabCursorSprite(-1); if (gnapPlatypusAction(1, 0, 0x107C1, 0)) { - _gnapActionStatus = 100; + _gnap->_actionStatus = 100; _gameSys->setAnimation(0, 0, 1); _gameSys->setAnimation(0x10876, _platypusId, 0); _gameSys->insertSequence(0x10875, _gnapId, @@ -1794,7 +1794,7 @@ void GnapEngine::gnapUseJointOnPlatypus() { gameUpdateTick(); } _gameSys->setAnimation(0, 0, 0); - _gnapActionStatus = -1; + _gnap->_actionStatus = -1; } else { playGnapSequence(getGnapSequenceId(gskScratchingHead, _plat->_pos.x, _plat->_pos.y) | 0x10000); } @@ -1834,7 +1834,7 @@ void GnapEngine::playPlatypusSequence(int sequenceId) { } void GnapEngine::updatePlatypusIdleSequence() { - if (_platypusActionStatus < 0 && _gnapActionStatus < 0) { + if (_plat->_actionStatus < 0 && _gnap->_actionStatus < 0) { if (_timers[0] > 0) { if (_timers[1] == 0) { _timers[1] = getRandom(20) + 30; @@ -1872,7 +1872,7 @@ void GnapEngine::updatePlatypusIdleSequence() { } void GnapEngine::updatePlatypusIdleSequence2() { - if (_platypusActionStatus < 0 && _gnapActionStatus < 0) { + if (_plat->_actionStatus < 0 && _gnap->_actionStatus < 0) { if (_timers[0]) { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index ce631a392c..ccaf11f961 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -516,7 +516,6 @@ public: void platypusMakeRoom(); // Gnap - int _gnapActionStatus; int _gnapBrainPulseNum, _gnapBrainPulseRndValue; int _gnapSequenceId, _gnapSequenceDatNum, _gnapId; @@ -548,7 +547,6 @@ public: void gnapUseDisguiseOnPlatypus(); // Platypus - int _platypusActionStatus; int _platypusSequenceId, _platypusSequenceDatNum, _platypusId; int getPlatypusSequenceId(); void playPlatypusSequence(int sequenceId); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 087fb53a5e..5348f18df8 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -115,14 +115,14 @@ void Scene01::run() { switch (_vm->_sceneClickedHotspot) { case kHS01Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS01Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -151,7 +151,7 @@ void Scene01::run() { break; case kHS01Spaceship: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); } else { @@ -159,7 +159,7 @@ void Scene01::run() { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS01LookSpaceship; + _vm->_gnap->_actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: case TALK_CURSOR: @@ -172,7 +172,7 @@ void Scene01::run() { break; case kHS01Mud: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); } else { @@ -182,7 +182,7 @@ void Scene01::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01TakeMud; + _vm->_gnap->_actionStatus = kAS01TakeMud; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -194,7 +194,7 @@ void Scene01::run() { break; case kHS01Pigs: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); } else { @@ -202,17 +202,17 @@ void Scene01::run() { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01LookPigs; + _vm->_gnap->_actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01UsePigs; + _vm->_gnap->_actionStatus = kAS01UsePigs; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); - _vm->_gnapActionStatus = kAS01LookPigs; + _vm->_gnap->_actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -223,10 +223,10 @@ void Scene01::run() { break; case kHS01ExitTruck: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS01LeaveScene; + _vm->_gnap->_actionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); _vm->_newSceneNum = 2; @@ -241,12 +241,12 @@ void Scene01::run() { case kHS01WalkArea6: case kHS01WalkArea7: case kHS01WalkArea8: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -260,9 +260,9 @@ void Scene01::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (_vm->_timers[4] == 0) { // Update bird animation @@ -291,20 +291,20 @@ void Scene01::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS01LookSpaceship: _spaceshipSurface = gameSys.createSurface(47); gameSys.insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); gameSys.setAnimation(133, 256, 0); gameSys.insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = kAS01LookSpaceshipDone; + _vm->_gnap->_actionStatus = kAS01LookSpaceshipDone; break; case kAS01LookSpaceshipDone: gameSys.removeSequence(133, 256, true); gameSys.removeSpriteDrawItem(_spaceshipSurface, 255); _vm->deleteSurface(&_spaceshipSurface); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS01LeaveScene: @@ -316,21 +316,21 @@ void Scene01::updateAnimations() { _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(128, 40, 3); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS01LookPigs: _vm->playSound(0x8A, false); _vm->playSound(0x8B, false); _vm->playSound(0x8C, false); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS01UsePigs: _vm->playGnapPullOutDevice(7, 2); _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -465,14 +465,14 @@ void Scene02::run() { switch (_vm->_sceneClickedHotspot) { case kHS02Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS02Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -501,12 +501,12 @@ void Scene02::run() { break; case kHS02Chicken: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS02UseTwigWithChicken; + _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); } else { @@ -517,14 +517,14 @@ void Scene02::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS02GrabChicken; + _vm->_gnap->_actionStatus = kAS02GrabChicken; else - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS02TalkChicken; + _vm->_gnap->_actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -536,20 +536,20 @@ void Scene02::run() { case kHS02Truck1: case kHS02Truck2: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnapActionStatus = kAS02UseTruckGas; + _vm->_gnap->_actionStatus = kAS02UseTruckGas; else - _vm->_gnapActionStatus = kAS02UseTruckNoGas; + _vm->_gnap->_actionStatus = kAS02UseTruckNoGas; } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS02UseGasWithTruck; + _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); @@ -562,14 +562,14 @@ void Scene02::run() { if (_vm->isFlag(kGFTruckKeysUsed)) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnapActionStatus = kAS02UseTruckGas; + _vm->_gnap->_actionStatus = kAS02UseTruckGas; else - _vm->_gnapActionStatus = kAS02UseTruckNoGas; + _vm->_gnap->_actionStatus = kAS02UseTruckNoGas; } } else { _vm->_gnap->_idleFacing = kDirUnk4; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS02UseTruckNoKeys; + _vm->_gnap->_actionStatus = kAS02UseTruckNoKeys; } break; case TALK_CURSOR: @@ -582,7 +582,7 @@ void Scene02::run() { break; case kHS02TruckGrill: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); } else { @@ -593,7 +593,7 @@ void Scene02::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS02GrabTruckGrill; + _vm->_gnap->_actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -605,10 +605,10 @@ void Scene02::run() { break; case kHS02ExitHouse: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; + _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, -1, 0x107C1, 1); updateHotspots(); @@ -617,10 +617,10 @@ void Scene02::run() { break; case kHS02ExitBarn: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; + _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7].x + 1, _vm->_hotspotsWalkPos[7].y, -1, 0x107C1, 1); updateHotspots(); @@ -629,10 +629,10 @@ void Scene02::run() { break; case kHS02ExitCreek: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; + _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, -1, 0x107CD, 1); _vm->_newSceneNum = 3; @@ -640,10 +640,10 @@ void Scene02::run() { break; case kHS02ExitPigpen: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS02LeaveScene; + _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, -1, 0x107CF, 1); _vm->_newSceneNum = 1; @@ -654,12 +654,12 @@ void Scene02::run() { case kHS02WalkArea2: case kHS02WalkArea3: case kHS02WalkArea4: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -672,9 +672,9 @@ void Scene02::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { // Update bird animation @@ -684,7 +684,7 @@ void Scene02::run() { else gameSys.insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != 7 && _vm->_gnapActionStatus != 8) { + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnap->_actionStatus != 7 && _vm->_gnap->_actionStatus != 8) { if (_vm->getRandom(6) != 0) { _nextChickenSequenceId = 0x14B; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -712,13 +712,13 @@ void Scene02::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS02UseTruckNoKeys: gameSys.insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x14E, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x14E; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS02UseTruckNoKeysDone; + _vm->_gnap->_actionStatus = kAS02UseTruckNoKeysDone; break; case kAS02UseGasWithTruck: gameSys.insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -728,7 +728,7 @@ void Scene02::updateAnimations() { _vm->invRemove(kItemGas); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFTruckFilledWithGas); - _vm->_gnapActionStatus = kAS02UseGasWithTruckDone; + _vm->_gnap->_actionStatus = kAS02UseGasWithTruckDone; break; case kAS02UseTruckGas: _vm->_timers[5] = 9999; @@ -781,7 +781,7 @@ void Scene02::updateAnimations() { gameSys.setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); _vm->_gnapSequenceId = _gnapTruckSequenceId; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS02LeaveScene: _vm->_sceneDone = true; @@ -800,7 +800,7 @@ void Scene02::updateAnimations() { _currChickenSequenceId = 0x14B; gameSys.setAnimation(0x14B, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->_timers[5] = 30; break; case kAS02UseTwigWithChicken: @@ -808,12 +808,12 @@ void Scene02::updateAnimations() { gameSys.insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _currChickenSequenceId = 0x155; _nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS02UseTruckNoKeysDone: case kAS02UseGasWithTruckDone: default: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -825,14 +825,14 @@ void Scene02::updateAnimations() { gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; - _vm->_gnapActionStatus = kAS02GrabChickenDone; + _vm->_gnap->_actionStatus = kAS02GrabChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x14C) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); @@ -937,7 +937,7 @@ void Scene03::run() { switch (_vm->_sceneClickedHotspot) { case kHS03Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -966,7 +966,7 @@ void Scene03::run() { break; case kHS03Grass: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -993,11 +993,11 @@ void Scene03::run() { break; case kHS03ExitTruck: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS03LeaveScene; + _vm->_gnap->_actionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, -1, 0x107C2, 1); _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1009,7 +1009,7 @@ void Scene03::run() { break; case kHS03Creek: - if (_vm->_gnapActionStatus == -1) { + if (_vm->_gnap->_actionStatus == -1) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -1021,7 +1021,7 @@ void Scene03::run() { if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS03GrabCreek; + _vm->_gnap->_actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; break; @@ -1035,7 +1035,7 @@ void Scene03::run() { break; case kHS03TrappedPlatypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1048,13 +1048,13 @@ void Scene03::run() { case GRAB_CURSOR: if (_platypusHypnotized) { _vm->gnapWalkTo(7, 6, 0, 0x107B5, 1); - _vm->_gnapActionStatus = kAS03FreePlatypus; + _vm->_gnap->_actionStatus = kAS03FreePlatypus; } else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) - _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; + _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnapActionStatus = kAS03GrabPlatypus; + _vm->_gnap->_actionStatus = kAS03GrabPlatypus; } break; case TALK_CURSOR: @@ -1064,9 +1064,9 @@ void Scene03::run() { _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) - _vm->_gnapActionStatus = kAS03HypnotizeScaredPlat; + _vm->_gnap->_actionStatus = kAS03HypnotizeScaredPlat; else - _vm->_gnapActionStatus = kAS03HypnotizePlat; + _vm->_gnap->_actionStatus = kAS03HypnotizePlat; } break; case PLAT_CURSOR: @@ -1078,7 +1078,7 @@ void Scene03::run() { break; case kHS03Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1087,26 +1087,26 @@ void Scene03::run() { case kHS03WalkAreas1: case kHS03WalkAreas2: case kHS03WalkAreas3: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHS03PlatypusWalkArea: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); } else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107B5, 1); if (_platypusScared) - _vm->_gnapActionStatus = kAS03GrabScaredPlatypus; + _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnapActionStatus = kAS03GrabPlatypus; + _vm->_gnap->_actionStatus = kAS03GrabPlatypus; } } break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -1120,18 +1120,18 @@ void Scene03::run() { _vm->playSound(0x10925, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[1] && !_platypusScared) { _vm->_timers[1] = _vm->getRandom(40) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) _nextPlatSequenceId = 450; } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextFrogSequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextFrogSequenceId == -1) { if (_vm->getRandom(5) == 1) _nextFrogSequenceId = 0x1C6; else @@ -1141,12 +1141,12 @@ void Scene03::run() { if (!_vm->_timers[4]) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) gameSys.insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 200; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { gameSys.setAnimation(0x1C5, 253, 4); gameSys.insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } @@ -1174,7 +1174,7 @@ void Scene03::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS03LeaveScene: _vm->_sceneDone = true; break; @@ -1182,7 +1182,7 @@ void Scene03::updateAnimations() { _nextPlatSequenceId = 0x1BC; break; case kAS03FreePlatypusDone: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->_plat->_pos = Common::Point(6, 6); _vm->_plat->_idleFacing = kDirUnk4; _vm->_platypusId = 120; @@ -1207,7 +1207,7 @@ void Scene03::updateAnimations() { gameSys.insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; @@ -1227,7 +1227,7 @@ void Scene03::updateAnimations() { gameSys.insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x1BA; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; @@ -1244,10 +1244,10 @@ void Scene03::updateAnimations() { gameSys.setAnimation(0x1B4, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x1B4; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS03GrabCreekDone; + _vm->_gnap->_actionStatus = kAS03GrabCreekDone; break; default: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -1265,7 +1265,7 @@ void Scene03::updateAnimations() { _vm->_platypusSequenceDatNum = 0; gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { _vm->_gnap->_pos = Common::Point(3, 6); gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -1275,7 +1275,7 @@ void Scene03::updateAnimations() { _vm->_gnapSequenceId = 0x1B6; _vm->_gnapSequenceDatNum = 0; _vm->_gnap->_idleFacing = kDirNone; - _vm->_gnapActionStatus = kAS03FreePlatypusDone; + _vm->_gnap->_actionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { gameSys.setAnimation(0, 0, 1); @@ -1434,14 +1434,14 @@ void Scene04::run() { switch (_vm->_sceneClickedHotspot) { case kHS04Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS04Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1473,7 +1473,7 @@ void Scene04::run() { break; case kHS04Twig: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { @@ -1497,7 +1497,7 @@ void Scene04::run() { break; case kHS04Axe: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); } else { @@ -1508,7 +1508,7 @@ void Scene04::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS04GrabAxe; + _vm->_gnap->_actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); break; @@ -1522,7 +1522,7 @@ void Scene04::run() { break; case kHS04Dog: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); } else { @@ -1536,7 +1536,7 @@ void Scene04::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS04GrabDog; + _vm->_gnap->_actionStatus = kAS04GrabDog; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; @@ -1554,7 +1554,7 @@ void Scene04::run() { break; case kHS04Door: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); } else { @@ -1566,13 +1566,13 @@ void Scene04::run() { case GRAB_CURSOR: if (_vm->_cursorValue == 1) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS04OpenDoor; + _vm->_gnap->_actionStatus = kAS04OpenDoor; _vm->_timers[5] = 300; _vm->_gnap->_idleFacing = kDirUpLeft; } else { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS04LeaveScene; + _vm->_gnap->_actionStatus = kAS04LeaveScene; _vm->_newSceneNum = 38; } break; @@ -1585,10 +1585,10 @@ void Scene04::run() { break; case kHS04ExitTruck: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS04LeaveScene; + _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -1599,7 +1599,7 @@ void Scene04::run() { break; case kHS04Window: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); } else if (_vm->isFlag(kGFKeysTaken)) { @@ -1609,9 +1609,9 @@ void Scene04::run() { case LOOK_CURSOR: if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { if (_triedWindow) { - _vm->_gnapActionStatus = kAS04GetKeyAnother; + _vm->_gnap->_actionStatus = kAS04GetKeyAnother; } else { - _vm->_gnapActionStatus = kAS04GetKeyFirst; + _vm->_gnap->_actionStatus = kAS04GetKeyFirst; _triedWindow = true; } } @@ -1629,10 +1629,10 @@ void Scene04::run() { break; case kHS04ExitBarn: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS04LeaveScene; + _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); if (_vm->_cursorValue == 1) @@ -1644,12 +1644,12 @@ void Scene04::run() { case kHS04WalkArea1: case kHS04WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -1663,13 +1663,13 @@ void Scene04::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && _vm->isFlag(kGFPlatypus)) + if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->updatePlatypusIdleSequence2(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(150) + 300; - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) gameSys.insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { @@ -1705,7 +1705,7 @@ void Scene04::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS04LeaveScene: _vm->_sceneDone = true; break; @@ -1719,18 +1719,18 @@ void Scene04::updateAnimations() { gameSys.setAnimation(0x107B5, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _vm->_gnapActionStatus = kAS04OpenDoorDone; + _vm->_gnap->_actionStatus = kAS04OpenDoorDone; break; case kAS04OpenDoorDone: gameSys.insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS04GetKeyFirst: gameSys.insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x204, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x204; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyFirst2; + _vm->_gnap->_actionStatus = kAS04GetKeyFirst2; break; case kAS04GetKeyFirst2: gameSys.insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -1739,7 +1739,7 @@ void Scene04::updateAnimations() { gameSys.setAnimation(0x20B, 256, 0); _vm->_gnapSequenceId = 0x206; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyFirstDone; + _vm->_gnap->_actionStatus = kAS04GetKeyFirstDone; break; case kAS04GetKeyFirstDone: gameSys.requestRemoveSequence(0x1FF, 256); @@ -1750,14 +1750,14 @@ void Scene04::updateAnimations() { _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS04GetKeyAnother: gameSys.insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x202, _vm->_gnapId, 0); _vm->_gnapSequenceId = 0x202; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyAnother2; + _vm->_gnap->_actionStatus = kAS04GetKeyAnother2; break; case kAS04GetKeyAnother2: gameSys.insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -1766,7 +1766,7 @@ void Scene04::updateAnimations() { gameSys.setAnimation(0x20A, 256, 0); _vm->_gnapSequenceId = 0x203; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS04GetKeyAnotherDone; + _vm->_gnap->_actionStatus = kAS04GetKeyAnotherDone; break; case kAS04GetKeyAnotherDone: gameSys.removeSequence(0x1FF, 256, true); @@ -1777,7 +1777,7 @@ void Scene04::updateAnimations() { _vm->_gnapSequenceId = 0x7B5; _vm->_gnapSequenceDatNum = 1; _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS04GrabDog: _nextDogSequenceId = 0x201; @@ -1787,10 +1787,10 @@ void Scene04::updateAnimations() { gameSys.requestRemoveSequence(0x212, 100); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x211; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; default: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -1814,7 +1814,7 @@ void Scene04::updateAnimations() { _currDogSequenceId = 0x201; _vm->_gnapSequenceId = 0x200; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->_timers[6] = _vm->getRandom(20) + 60; _nextDogSequenceId = -1; } else if (_nextDogSequenceId != -1) { @@ -1909,14 +1909,14 @@ void Scene05::run() { switch (_vm->_sceneClickedHotspot) { case kHS05Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS05Platypus: - if (_vm->_gnapActionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1945,7 +1945,7 @@ void Scene05::run() { break; case kHS05Haystack: - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); } else if (_vm->isFlag(kGFNeedleTaken)) { @@ -1963,7 +1963,7 @@ void Scene05::run() { if (_vm->isFlag(kGFPlatypus)) { _vm->gnapUseDeviceOnPlatypus(); if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { - _vm->_platypusActionStatus = kAS05PlatSearchHaystack; + _vm->_plat->_actionStatus = kAS05PlatSearchHaystack; _vm->_plat->_idleFacing = kDirUnk4; } if (_vm->_gnap->_pos.x == 4 && (_vm->_gnap->_pos.y == 8 || _vm->_gnap->_pos.y == 7)) @@ -1977,12 +1977,12 @@ void Scene05::run() { break; case kHS05Chicken: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05UseTwigWithChicken; + _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); } else { @@ -1993,12 +1993,12 @@ void Scene05::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05GrabChicken; + _vm->_gnap->_actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05TalkChicken; + _vm->_gnap->_actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2009,7 +2009,7 @@ void Scene05::run() { break; case kHS05Ladder: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); } else { @@ -2020,7 +2020,7 @@ void Scene05::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05GrabLadder; + _vm->_gnap->_actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -2035,16 +2035,16 @@ void Scene05::run() { if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x - 1, _vm->_hotspotsWalkPos[2].y + 1, 0, -1, 1); - _vm->_gnapActionStatus = kAS05EnterBarn; + _vm->_gnap->_actionStatus = kAS05EnterBarn; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 6; else _vm->_newSceneNum = 36; - } else if (_vm->_gnapActionStatus < 0) { + } else if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS05PickPadlock; + _vm->_gnap->_actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); } else { @@ -2056,7 +2056,7 @@ void Scene05::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS05TryPickPadlock; + _vm->_gnap->_actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -2068,10 +2068,10 @@ void Scene05::run() { break; case kHS05ExitHouse: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS05LeaveScene; + _vm->_gnap->_actionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -2083,7 +2083,7 @@ void Scene05::run() { case kHS05WalkArea1: case kHS05WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -2092,7 +2092,7 @@ void Scene05::run() { break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -2111,7 +2111,7 @@ void Scene05::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { + if (_vm->_gnap->_actionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { if (_vm->getRandom(4) != 0) _nextChickenSequenceId = 0x142; else @@ -2120,7 +2120,7 @@ void Scene05::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(150) + 300; - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) gameSys.insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); @@ -2144,16 +2144,16 @@ void Scene05::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS05LeaveScene: _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS05TryPickPadlock: gameSys.insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x148; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS05PickPadlock: gameSys.setAnimation(0x147, _vm->_gnapId, 0); @@ -2166,11 +2166,11 @@ void Scene05::updateAnimations() { _vm->_newSceneNum = 6; _vm->_timers[2] = 100; _vm->invRemove(kItemNeedle); - _vm->_gnapActionStatus = kAS05LeaveScene; + _vm->_gnap->_actionStatus = kAS05LeaveScene; break; case kAS05TalkChicken: _nextChickenSequenceId = 0x144; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS05GrabChicken: _nextChickenSequenceId = 0x14B; @@ -2184,19 +2184,19 @@ void Scene05::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_timers[2] = 200; _vm->_timers[6] = 300; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS05EnterBarn: gameSys.insertSequence(0x107B1, 1, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); gameSys.setAnimation(0x107B1, 1, 0); - _vm->_gnapActionStatus = kAS05LeaveScene; + _vm->_gnap->_actionStatus = kAS05LeaveScene; break; case kAS05UseTwigWithChicken: _vm->playGnapShowItem(5, 0, 0); _nextChickenSequenceId = 0x14F; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -2213,9 +2213,9 @@ void Scene05::updateAnimations() { _vm->setGrabCursorSprite(kItemNeedle); _vm->showCursor(); _vm->_timers[1] = 30; - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; } - if (_vm->_platypusActionStatus == kAS05PlatSearchHaystack) { + if (_vm->_plat->_actionStatus == kAS05PlatSearchHaystack) { gameSys.setAnimation(0, 0, 1); gameSys.insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); @@ -2237,7 +2237,7 @@ void Scene05::updateAnimations() { _vm->_gnapSequenceId = 0x14C; _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 100, 3); gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -2333,14 +2333,14 @@ void Scene06::run() { switch (_vm->_sceneClickedHotspot) { case kHS06Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS06Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2369,7 +2369,7 @@ void Scene06::run() { break; case kHS06Gas: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); } else { @@ -2384,7 +2384,7 @@ void Scene06::run() { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS06TryToGetGas; + _vm->_gnap->_actionStatus = kAS06TryToGetGas; } else { triedDeviceOnGas = true; _vm->playGnapPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); @@ -2403,7 +2403,7 @@ void Scene06::run() { break; case kHS06Ladder: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); } else { @@ -2416,7 +2416,7 @@ void Scene06::run() { _vm->playGnapImpossible(0, 0); else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS06TryToClimbLadder; + _vm->_gnap->_actionStatus = kAS06TryToClimbLadder; _vm->setFlag(kGFGasTaken); } break; @@ -2430,7 +2430,7 @@ void Scene06::run() { break; case kHS06Horse: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); @@ -2438,7 +2438,7 @@ void Scene06::run() { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirNone; - _vm->_gnapActionStatus = kAS06UseTwigOnHorse; + _vm->_gnap->_actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); @@ -2455,7 +2455,7 @@ void Scene06::run() { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS06TalkToHorse; + _vm->_gnap->_actionStatus = kAS06TalkToHorse; } break; case GRAB_CURSOR: @@ -2468,10 +2468,10 @@ void Scene06::run() { break; case kHS06ExitOutsideBarn: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS06LeaveScene; + _vm->_gnap->_actionStatus = kAS06LeaveScene; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; else @@ -2484,12 +2484,12 @@ void Scene06::run() { case kHS06WalkArea3: case kHS06WalkArea4: case kHS06WalkArea5: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -2500,13 +2500,13 @@ void Scene06::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) + if (_vm->_plat->_actionStatus < 0) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 25; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextHorseSequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHorseSequenceId == -1) { if (_horseTurnedBack) { _nextHorseSequenceId = 0xF5; } else { @@ -2546,16 +2546,16 @@ void Scene06::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS06LeaveScene: _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS06TryToGetGas: gameSys.insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFC; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS06TryToClimbLadder: gameSys.insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); @@ -2563,11 +2563,11 @@ void Scene06::updateAnimations() { gameSys.insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xFD; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS06TryToClimbLadderDone; + _vm->_gnap->_actionStatus = kAS06TryToClimbLadderDone; break; case kAS06TryToClimbLadderDone: _vm->_gnap->_pos = Common::Point(6, 7); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS06TalkToHorse: _nextHorseSequenceId = 0xF6; @@ -2576,7 +2576,7 @@ void Scene06::updateAnimations() { _nextPlatSequenceId = 0xFB; break; default: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -2589,19 +2589,19 @@ void Scene06::updateAnimations() { _vm->setFlag(kGFGasTaken); _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; _vm->setGrabCursorSprite(kItemGas); - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; _vm->_plat->_pos = Common::Point(6, 8); gameSys.insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); _vm->_platypusSequenceId = 0x7C1; _vm->_platypusSequenceDatNum = 1; _vm->setFlag(kGFUnk04); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->showCursor(); } if (_nextPlatSequenceId == 0xFB) { gameSys.setAnimation(0, 0, 1); _nextHorseSequenceId = 0xF2; - _vm->_platypusActionStatus = 6; + _vm->_plat->_actionStatus = 6; } } @@ -2633,7 +2633,7 @@ void Scene06::updateAnimations() { _horseTurnedBack = true; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; default: gameSys.setAnimation(_nextHorseSequenceId, 120, 2); @@ -2692,7 +2692,7 @@ void Scene07::run() { _vm->_gnap->_idleFacing = kDirBottomRight; gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS07Wait; + _vm->_gnap->_actionStatus = kAS07Wait; _vm->_plat->_pos = Common::Point(3, 8); _vm->_platypusId = 160; _vm->_platypusSequenceId = 0x91; @@ -2742,7 +2742,7 @@ void Scene07::run() { _vm->gnapWalkTo(_vm->_gnap->_pos.x, 7, 0, 0x107AD, 1); else _vm->gnapWalkTo(8, 7, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS07LeaveScene; + _vm->_gnap->_actionStatus = kAS07LeaveScene; break; case kHS07Dice: @@ -2774,7 +2774,7 @@ void Scene07::run() { break; case kHS07Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(40) + 50; @@ -2802,7 +2802,7 @@ void Scene07::run() { if (!_vm->_isLeavingScene) { _vm->updateGnapIdleSequence(); - if (_vm->_platypusActionStatus < 0 && _vm->_gnapActionStatus < 0) { + if (_vm->_plat->_actionStatus < 0 && _vm->_gnap->_actionStatus < 0) { if (_vm->_timers[0]) { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; @@ -2859,13 +2859,13 @@ void Scene07::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS07LeaveScene: _vm->_newSceneNum = 8; _vm->_sceneDone = true; break; } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } if (gameSys.getAnimationStatus(2) == 2) { @@ -2975,7 +2975,7 @@ void Scene08::run() { switch (_vm->_sceneClickedHotspot) { case kHS08Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(50) + 75; @@ -3012,7 +3012,7 @@ void Scene08::run() { _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(0, 6, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS08LeaveScene; + _vm->_gnap->_actionStatus = kAS08LeaveScene; _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1); _vm->_newSceneNum = 9; break; @@ -3021,7 +3021,7 @@ void Scene08::run() { _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(3, 9, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS08LeaveScene; + _vm->_gnap->_actionStatus = kAS08LeaveScene; _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1); _vm->_newSceneNum = 7; break; @@ -3034,7 +3034,7 @@ void Scene08::run() { case LOOK_CURSOR: _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS08LookMan; + _vm->_gnap->_actionStatus = kAS08LookMan; _vm->_gnap->_idleFacing = kDirUpRight; break; case GRAB_CURSOR: @@ -3044,13 +3044,13 @@ void Scene08::run() { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS08TalkMan; + _vm->_gnap->_actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x14D); _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kAS08PlatWithMan; + _vm->_plat->_actionStatus = kAS08PlatWithMan; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(6, 6); break; @@ -3062,31 +3062,31 @@ void Scene08::run() { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 7, 5, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS08GrabDog; + _vm->_gnap->_actionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapScratchingHead(6, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS08LookDog; + _vm->_gnap->_actionStatus = kAS08LookDog; break; case GRAB_CURSOR: _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS08GrabDog; + _vm->_gnap->_actionStatus = kAS08GrabDog; _vm->_gnap->_idleFacing = kDirUpRight; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS08TalkDog; + _vm->_gnap->_actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); _vm->gnapActionIdle(0x14D); _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kAS08PlatWithDog; + _vm->_plat->_actionStatus = kAS08PlatWithDog; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(3, 7); break; @@ -3194,7 +3194,7 @@ void Scene08::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 125; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextManSequenceId == -1 && + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextManSequenceId == -1 && (_currDogSequenceId == 0x134 || _currDogSequenceId == 0x135)) { int _gnapRandomValue = _vm->getRandom(4); switch (_gnapRandomValue) { @@ -3235,49 +3235,49 @@ void Scene08::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS08LeaveScene: _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS08TalkMan: _nextManSequenceId = 0x13F; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS08LookMan: _nextManSequenceId = 0x140; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS08LookDog: _nextManSequenceId = 0x137; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS08GrabDog: if (_currDogSequenceId == 0x135) _nextDogSequenceId = 0x133; else _nextDogSequenceId = 0x13C; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS08TalkDog: if (_currDogSequenceId == 0x135) _nextDogSequenceId = 0x133; else _nextDogSequenceId = 0x13C; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { + switch (_vm->_plat->_actionStatus) { case kAS08PlatWithDog: _nextDogSequenceId = 0x147; break; case kAS08PlatWithMan: _nextManSequenceId = 0x140; - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; break; } } @@ -3291,7 +3291,7 @@ void Scene08::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2) { if (_currDogSequenceId == 0x147) - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; if (_currDogSequenceId == 0x149 || _currDogSequenceId == 0x14A || _currDogSequenceId == 0x14B) { if (_vm->getRandom(2) != 0) _nextManSequenceId = 0x13D; @@ -3347,7 +3347,7 @@ void Scene08::updateAnimations() { _vm->_gnapSequenceId = 0x14D; _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } } } @@ -3411,7 +3411,7 @@ void Scene09::run() { switch (_vm->_sceneClickedHotspot) { case kHS09Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(150) + 50; @@ -3440,7 +3440,7 @@ void Scene09::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 10; _vm->gnapWalkTo(4, 7, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kAS09LeaveScene; + _vm->_gnap->_actionStatus = kAS09LeaveScene; _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); _vm->_plat->_idleFacing = kDirUnk4; break; @@ -3449,7 +3449,7 @@ void Scene09::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 8; _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS09LeaveScene; + _vm->_gnap->_actionStatus = kAS09LeaveScene; _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); _vm->_plat->_idleFacing = kDirUnk4; break; @@ -3463,7 +3463,7 @@ void Scene09::run() { _vm->playGnapScratchingHead(8, 3); break; case GRAB_CURSOR: - _vm->_gnapActionStatus = kAS09SearchTrash; + _vm->_gnap->_actionStatus = kAS09SearchTrash; _vm->gnapWalkTo(9, 6, 0, 0x107BC, 1); break; case TALK_CURSOR: @@ -3490,7 +3490,7 @@ void Scene09::run() { updateAnimations(); - if (!_vm->_isLeavingScene && _vm->_gnapActionStatus != 1 && _vm->_gnapActionStatus != 2) { + if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus != 1 && _vm->_gnap->_actionStatus != 2) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { @@ -3522,10 +3522,10 @@ void Scene09::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS09LeaveScene: _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS09SearchTrash: gameSys.setAnimation(0x4C, 120, 0); @@ -3536,13 +3536,13 @@ void Scene09::updateAnimations() { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnapSequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(9, 6); - _vm->_gnapActionStatus = kAS09SearchTrashDone; + _vm->_gnap->_actionStatus = kAS09SearchTrashDone; break; case kAS09SearchTrashDone: gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[2] = 360; _vm->_timers[4] = _vm->getRandom(150) + 100; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index e2d0e9685a..6aca6434ed 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -133,7 +133,7 @@ void Scene10::run() { _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(0, 7, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS10LeaveScene; + _vm->_gnap->_actionStatus = kAS10LeaveScene; _vm->platypusWalkTo(0, 7, -1, 0x107CF, 1); _vm->_newSceneNum = 11; break; @@ -142,7 +142,7 @@ void Scene10::run() { _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(2, 9, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS10LeaveScene; + _vm->_gnap->_actionStatus = kAS10LeaveScene; _vm->platypusWalkTo(3, 9, -1, 0x107C7, 1); _vm->_newSceneNum = 9; break; @@ -151,7 +151,7 @@ void Scene10::run() { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 8, 6, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS10AnnoyCook; + _vm->_gnap->_actionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -165,14 +165,14 @@ void Scene10::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(4, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS10AnnoyCook; + _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x10C); _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(4, 6, -1, -1, 1); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS10AnnoyCook; + _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; } } @@ -195,7 +195,7 @@ void Scene10::run() { else { _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS10AnnoyCook; + _vm->_gnap->_actionStatus = kAS10AnnoyCook; } break; case TALK_CURSOR: @@ -209,7 +209,7 @@ void Scene10::run() { _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, -1, -1, 1); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS10AnnoyCook; + _vm->_gnap->_actionStatus = kAS10AnnoyCook; } break; } @@ -227,7 +227,7 @@ void Scene10::run() { case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS10AnnoyCook; + _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case TALK_CURSOR: _vm->playGnapImpossible(0, 0); @@ -241,7 +241,7 @@ void Scene10::run() { _vm->gnapActionIdle(0x10C); _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); - _vm->_platypusActionStatus = kAS10PlatWithBox; + _vm->_plat->_actionStatus = kAS10PlatWithBox; _vm->_plat->_idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); _vm->playGnapIdle(7, 6); @@ -287,7 +287,7 @@ void Scene10::run() { break; case kHS10Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -345,7 +345,7 @@ void Scene10::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS10LeaveScene: _vm->_sceneDone = true; break; @@ -357,7 +357,7 @@ void Scene10::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { + switch (_vm->_plat->_actionStatus) { case kAS10PlatWithBox: _nextCookSequenceId = 0x109; break; @@ -398,8 +398,8 @@ void Scene10::updateAnimations() { _vm->delayTicksCursor(5); _vm->deleteSurface(&_vm->_largeSprite); _vm->setGrabCursorSprite(kItemTongs); - if (_vm->_platypusActionStatus == kAS10PlatWithBox) - _vm->_platypusActionStatus = -1; + if (_vm->_plat->_actionStatus == kAS10PlatWithBox) + _vm->_plat->_actionStatus = -1; if (_vm->_gnap->_pos == Common::Point(4, 8)) _vm->gnapWalkStep(); break; @@ -413,7 +413,7 @@ void Scene10::updateAnimations() { case 0x106: { // TODO: Refactor into a if + a switch int rnd = _vm->getRandom(7); - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (rnd == 0) _nextCookSequenceId = 0x104; @@ -427,7 +427,7 @@ void Scene10::updateAnimations() { } break; case 0x103: - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x104; @@ -435,7 +435,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; break; case 0x104: - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x103; @@ -445,7 +445,7 @@ void Scene10::updateAnimations() { case 0x105: { // TODO: Refactor into a if + a switch int rnd = _vm->getRandom(7); - if (_vm->_gnapActionStatus >= 0 || _vm->_platypusActionStatus >= 0) + if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (rnd == 0) _nextCookSequenceId = 0x104; @@ -459,8 +459,8 @@ void Scene10::updateAnimations() { _vm->_gnapSequenceId = 0x10C; _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; - _vm->_platypusActionStatus = -1; + _vm->_gnap->_actionStatus = -1; + _vm->_plat->_actionStatus = -1; } break; } @@ -613,7 +613,7 @@ void Scene11::run() { case kHS11ExitKitchen: _vm->_isLeavingScene = true; _vm->gnapWalkTo(6, 5, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kAS11LeaveScene; + _vm->_gnap->_actionStatus = kAS11LeaveScene; _vm->platypusWalkTo(6, 6, -1, -1, 1); _vm->_newSceneNum = 10; break; @@ -621,7 +621,7 @@ void Scene11::run() { case kHS11ExitToilet: _vm->_isLeavingScene = true; _vm->gnapWalkTo(8, 5, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kAS11LeaveScene; + _vm->_gnap->_actionStatus = kAS11LeaveScene; _vm->platypusWalkTo(8, 6, -1, -1, 1); _vm->_newSceneNum = 13; break; @@ -629,16 +629,16 @@ void Scene11::run() { case kHS11ExitLeft: _vm->_isLeavingScene = true; _vm->gnapWalkTo(-1, 8, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS11LeaveScene; + _vm->_gnap->_actionStatus = kAS11LeaveScene; _vm->platypusWalkTo(-1, 9, -1, 0x107CF, 1); _vm->_newSceneNum = 12; break; case kHS11GoggleGuy: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemMagazine) { _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS11ShowMagazineToGoggleGuy; + _vm->_gnap->_actionStatus = kAS11ShowMagazineToGoggleGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(3, 7, 2, 0); @@ -654,7 +654,7 @@ void Scene11::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS11TalkGoggleGuy; + _vm->_gnap->_actionStatus = kAS11TalkGoggleGuy; break; } } @@ -662,11 +662,11 @@ void Scene11::run() { break; case kHS11HookGuy: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_gnap->_idleFacing = kDirUpRight; if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(5, 6, 0, 0x107BC, 9); - _vm->_gnapActionStatus = kAS11ShowItemToHookGuy; + _vm->_gnap->_actionStatus = kAS11ShowItemToHookGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0); } else { switch (_vm->_verbCursor) { @@ -675,12 +675,12 @@ void Scene11::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS11GrabHookGuy; + _vm->_gnap->_actionStatus = kAS11GrabHookGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->gnapWalkTo(5, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS11TalkHookGuy; + _vm->_gnap->_actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -691,7 +691,7 @@ void Scene11::run() { break; case kHS11Billard: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(9, 8); } else { @@ -701,7 +701,7 @@ void Scene11::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(9, 8, 0, 0x107BA, 1); - _vm->_gnapActionStatus = kAS11GrabBillardBall; + _vm->_gnap->_actionStatus = kAS11GrabBillardBall; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -717,19 +717,19 @@ void Scene11::run() { case kHS11WalkArea3: case kHS11WalkArea4: case kHS11WalkArea5: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; case kHS11Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -749,7 +749,7 @@ void Scene11::run() { _vm->updateGnapIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 75; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextGoggleGuySequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextGoggleGuySequenceId == -1) { if (_vm->getRandom(2)) _nextGoggleGuySequenceId = 0x1F6; else @@ -758,7 +758,7 @@ void Scene11::run() { } if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextHookGuySequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHookGuySequenceId == -1) { if (_currHookGuySequenceId == 0x201) { switch (_vm->getRandom(7)) { case 0: @@ -814,9 +814,9 @@ void Scene11::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { - if (_vm->_gnapActionStatus != kAS11GrabBillardBall) + if (_vm->_gnap->_actionStatus != kAS11GrabBillardBall) gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS11LeaveScene: _vm->_sceneDone = true; break; @@ -873,7 +873,7 @@ void Scene11::updateAnimations() { _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; gameSys.setAnimation(0x207, 257, 4); gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } break; } @@ -885,8 +885,8 @@ void Scene11::updateAnimations() { gameSys.setAnimation(_nextGoggleGuySequenceId, 121, 2); _currGoggleGuySequenceId = _nextGoggleGuySequenceId; _nextGoggleGuySequenceId = -1; - if (_vm->_gnapActionStatus >= 1 && _vm->_gnapActionStatus <= 4) - _vm->_gnapActionStatus = -1; + if (_vm->_gnap->_actionStatus >= 1 && _vm->_gnap->_actionStatus <= 4) + _vm->_gnap->_actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2) { @@ -901,16 +901,16 @@ void Scene11::updateAnimations() { _vm->_timers[4] = _vm->getRandom(40) + 20; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnapActionStatus == kAS11GrabHookGuy) - _vm->_gnapActionStatus = -1; + if (_vm->_gnap->_actionStatus == kAS11GrabHookGuy) + _vm->_gnap->_actionStatus = -1; } else if (_nextHookGuySequenceId != -1) { gameSys.insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); _currHookGuySequenceId = _nextHookGuySequenceId; _nextHookGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(40) + 20; - if (_vm->_gnapActionStatus >= 6 && _vm->_gnapActionStatus <= 9) - _vm->_gnapActionStatus = -1; + if (_vm->_gnap->_actionStatus >= 6 && _vm->_gnap->_actionStatus <= 9) + _vm->_gnap->_actionStatus = -1; } } @@ -1005,7 +1005,7 @@ void Scene12::run() { switch (_vm->_sceneClickedHotspot) { case kHS12Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1031,7 +1031,7 @@ void Scene12::run() { case kHS12ExitRight: _vm->_isLeavingScene = true; _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS12LeaveScene; + _vm->_gnap->_actionStatus = kAS12LeaveScene; _vm->platypusWalkTo(10, -1, -1, -1, 1); _vm->_newSceneNum = 11; break; @@ -1041,18 +1041,18 @@ void Scene12::run() { _vm->_largeSprite = gameSys.createSurface(0x141); _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnapActionStatus = kAS12QuarterToToothGuy; + _vm->_gnap->_actionStatus = kAS12QuarterToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnapActionStatus = kAS12QuarterWithHoleToToothGuy; + _vm->_gnap->_actionStatus = kAS12QuarterWithHoleToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnapActionStatus = kAS12ShowItemToToothGuy; + _vm->_gnap->_actionStatus = kAS12ShowItemToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else { switch (_vm->_verbCursor) { @@ -1061,17 +1061,17 @@ void Scene12::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS12GrabToothGuy; + _vm->_gnap->_actionStatus = kAS12GrabToothGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS12TalkToothGuy; + _vm->_gnap->_actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); - _vm->_platypusActionStatus = kAS12PlatWithToothGuy; + _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; _vm->_plat->_idleFacing = kDirUnk4; _vm->playGnapIdle(2, 7); break; @@ -1083,19 +1083,19 @@ void Scene12::run() { if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS12QuarterWithBarkeeper; + _vm->_gnap->_actionStatus = kAS12QuarterWithBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS12ShowItemToBarkeeper; + _vm->_gnap->_actionStatus = kAS12ShowItemToBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS12LookBarkeeper; + _vm->_gnap->_actionStatus = kAS12LookBarkeeper; break; case GRAB_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1103,12 +1103,12 @@ void Scene12::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(6, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS12TalkBarkeeper; + _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: _vm->playGnapPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS12PlatWithBarkeeper; + _vm->_gnap->_actionStatus = kAS12PlatWithBarkeeper; break; } } @@ -1118,30 +1118,30 @@ void Scene12::run() { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->gnapWalkTo(7, 6, 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS12ShowItemToBeardGuy; + _vm->_gnap->_actionStatus = kAS12ShowItemToBeardGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS12LookBeardGuy; + _vm->_gnap->_actionStatus = kAS12LookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS12GrabBeardGuy; + _vm->_gnap->_actionStatus = kAS12GrabBeardGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS12TalkBeardGuy; + _vm->_gnap->_actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kAS12PlatWithBeardGuy; + _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(7, 6); break; @@ -1153,19 +1153,19 @@ void Scene12::run() { _vm->_newSceneNum = 15; _vm->_isLeavingScene = true; _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS12LeaveScene; + _vm->_gnap->_actionStatus = kAS12LeaveScene; break; case kHS12WalkArea1: case kHS12WalkArea2: case kHS12WalkArea3: case kHS12WalkArea4: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -1181,7 +1181,7 @@ void Scene12::run() { if (!_vm->_timers[4]) { _vm->_timers[4] = 15; if (_nextToothGuySequenceId == -1) { - if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextToothGuySequenceId = 0x1EC; else @@ -1193,8 +1193,8 @@ void Scene12::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_nextBarkeeperSequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_nextBarkeeperSequenceId == -1 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextBarkeeperSequenceId = 0x208; else @@ -1206,8 +1206,8 @@ void Scene12::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(30) + 15; - if (_nextBeardGuySequenceId == -1 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && _vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + if (_nextBeardGuySequenceId == -1 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) _nextBeardGuySequenceId = 0x1F2; else _nextBeardGuySequenceId = 0x202; @@ -1251,7 +1251,7 @@ void Scene12::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS12LeaveScene: _vm->_sceneDone = true; break; @@ -1299,7 +1299,7 @@ void Scene12::updateAnimations() { } break; case kAS12QuarterToToothGuyDone: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->showCursor(); gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); @@ -1343,7 +1343,7 @@ void Scene12::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { + switch (_vm->_plat->_actionStatus) { case kAS12PlatWithToothGuy: _nextToothGuySequenceId = 0x1EB; break; @@ -1358,7 +1358,7 @@ void Scene12::updateAnimations() { gameSys.setAnimation(0, 0, 2); _vm->hideCursor(); gameSys.setAnimation(0x10843, 301, 0); - _vm->_gnapActionStatus = kAS12QuarterToToothGuyDone; + _vm->_gnap->_actionStatus = kAS12QuarterToToothGuyDone; gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, @@ -1380,25 +1380,25 @@ void Scene12::updateAnimations() { _vm->_timers[4] = 40; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnapActionStatus == kAS12GrabToothGuy) - _vm->_gnapActionStatus = -1; + if (_vm->_gnap->_actionStatus == kAS12GrabToothGuy) + _vm->_gnap->_actionStatus = -1; } else if (_nextToothGuySequenceId != -1) { gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; _vm->_timers[4] = 50; - if (_vm->_gnapActionStatus >= kAS12TalkToothGuy && _vm->_gnapActionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && + if (_vm->_gnap->_actionStatus >= kAS12TalkToothGuy && _vm->_gnap->_actionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && _currToothGuySequenceId != 0x1EC && _currToothGuySequenceId != 0x200) - _vm->_gnapActionStatus = -1; - if (_vm->_platypusActionStatus == kAS12PlatWithToothGuy) - _vm->_platypusActionStatus = -1; + _vm->_gnap->_actionStatus = -1; + if (_vm->_plat->_actionStatus == kAS12PlatWithToothGuy) + _vm->_plat->_actionStatus = -1; } } if (gameSys.getAnimationStatus(3) == 2) { - if (_vm->_gnapActionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { - _vm->_gnapActionStatus = -1; + if (_vm->_gnap->_actionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { + _vm->_gnap->_actionStatus = -1; _vm->playGnapIdle(7, 6); _vm->_timers[5] = 0; } @@ -1408,9 +1408,9 @@ void Scene12::updateAnimations() { _currBarkeeperSequenceId = _nextBarkeeperSequenceId; _nextBarkeeperSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus >= kAS12TalkBarkeeper && _vm->_gnapActionStatus <= kAS12QuarterWithBarkeeper && _currBarkeeperSequenceId != 0x203 && + if (_vm->_gnap->_actionStatus >= kAS12TalkBarkeeper && _vm->_gnap->_actionStatus <= kAS12QuarterWithBarkeeper && _currBarkeeperSequenceId != 0x203 && _currBarkeeperSequenceId != 0x1FB && _currBarkeeperSequenceId != 0x208) - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } } @@ -1420,10 +1420,10 @@ void Scene12::updateAnimations() { _currBeardGuySequenceId = _nextBeardGuySequenceId; _nextBeardGuySequenceId = -1; _vm->_timers[6] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus >= kAS12TalkBeardGuy && _vm->_gnapActionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) - _vm->_gnapActionStatus = -1; - if (_vm->_platypusActionStatus == kAS12PlatWithBeardGuy) - _vm->_platypusActionStatus = -1; + if (_vm->_gnap->_actionStatus >= kAS12TalkBeardGuy && _vm->_gnap->_actionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) + _vm->_gnap->_actionStatus = -1; + if (_vm->_plat->_actionStatus == kAS12PlatWithBeardGuy) + _vm->_plat->_actionStatus = -1; } } @@ -1512,7 +1512,7 @@ void Scene13::run() { switch (_vm->_sceneClickedHotspot) { case kHS13Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -1540,7 +1540,7 @@ void Scene13::run() { case kHS13ExitBar: _vm->_isLeavingScene = true; _vm->gnapWalkTo(2, 7, 0, 0x107C0, 1); - _vm->_gnapActionStatus = kAS13LeaveScene; + _vm->_gnap->_actionStatus = kAS13LeaveScene; _vm->platypusWalkTo(2, 8, -1, -1, 1); if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { _vm->_newSceneNum = 11; @@ -1564,13 +1564,13 @@ void Scene13::run() { gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqScale | kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kAS13Wait; + _vm->_gnap->_actionStatus = kAS13Wait; _vm->_gnapSequenceId = _backToiletCtr + 0xA3; _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnapSequenceDatNum = 0; } else { _vm->gnapWalkTo(5, 5, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS13BackToilet; + _vm->_gnap->_actionStatus = kAS13BackToilet; _vm->_gnap->_idleFacing = kDirUpRight; } break; @@ -1591,7 +1591,7 @@ void Scene13::run() { case TALK_CURSOR: case PLAT_CURSOR: _vm->gnapWalkTo(6, 7, 0, 0xA9, 5); - _vm->_gnapActionStatus = kAS13FrontToilet; + _vm->_gnap->_actionStatus = kAS13FrontToilet; _vm->_gnap->_idleFacing = kDirBottomRight; break; } @@ -1605,7 +1605,7 @@ void Scene13::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS13LookScribble; + _vm->_gnap->_actionStatus = kAS13LookScribble; _vm->_gnap->_idleFacing = kDirUpRight; break; case GRAB_CURSOR: @@ -1630,11 +1630,11 @@ void Scene13::run() { case LOOK_CURSOR: _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 9, 6)); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); - _vm->_gnapActionStatus = kAS13Wait; + _vm->_gnap->_actionStatus = kAS13Wait; break; case GRAB_CURSOR: _vm->gnapWalkTo(8, 7, 0, -1, 1); - _vm->_gnapActionStatus = kAS13GrabUrinal; + _vm->_gnap->_actionStatus = kAS13GrabUrinal; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -1652,11 +1652,11 @@ void Scene13::run() { case LOOK_CURSOR: _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 5, 9)); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); - _vm->_gnapActionStatus = kAS13Wait; + _vm->_gnap->_actionStatus = kAS13Wait; break; case GRAB_CURSOR: _vm->gnapWalkTo(4, 8, 0, 0x107B9, 1); - _vm->_gnapActionStatus = kAS13GrabSink; + _vm->_gnap->_actionStatus = kAS13GrabSink; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -1695,7 +1695,7 @@ void Scene13::run() { _vm->updatePlatypusIdleSequence(); if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) _vm->platypusWalkTo(-1, 7, -1, -1, 1); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -1763,24 +1763,24 @@ void Scene13::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS13LeaveScene: _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS13BackToilet: _backToiletCtr = MIN(5, _backToiletCtr + 1); gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); _vm->_gnapSequenceId = _backToiletCtr + 0xA3; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS13FrontToilet: _vm->_sceneDone = true; _vm->_newSceneNum = 14; break; case kAS13LookScribble: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; showScribble(); break; case kAS13GrabSink: @@ -1793,14 +1793,14 @@ void Scene13::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(4, 8); _vm->_timers[2] = 360; - _vm->_gnapActionStatus = kAS13GrabSinkDone; + _vm->_gnap->_actionStatus = kAS13GrabSinkDone; break; case kAS13GrabSinkDone: gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS13Wait: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS13GrabUrinal: gameSys.setAnimation(0xA2, 120, 0); @@ -1811,14 +1811,14 @@ void Scene13::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(4, 6); _vm->_timers[2] = 360; - _vm->_gnapActionStatus = kAS13Wait; + _vm->_gnap->_actionStatus = kAS13Wait; break; } } if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; } } @@ -1875,7 +1875,7 @@ void Scene14::run() { switch (_vm->_sceneClickedHotspot) { case kHS14Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -2051,7 +2051,7 @@ void Scene15::run() { switch (_vm->_sceneClickedHotspot) { case kHS15Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -2329,13 +2329,13 @@ void Scene17::update() { void Scene17::platHangUpPhone() { GameSys& gameSys = *_vm->_gameSys; - int savedGnapActionStatus = _vm->_gnapActionStatus; + int savedGnapActionStatus = _vm->_gnap->_actionStatus; - if (_vm->_platypusActionStatus == kAS17PlatPhoningAssistant) { - _vm->_gnapActionStatus = kAS17PlatHangUpPhone; + if (_vm->_plat->_actionStatus == kAS17PlatPhoningAssistant) { + _vm->_gnap->_actionStatus = kAS17PlatHangUpPhone; _vm->updateMouseCursor(); _platPhoneCtr = 0; - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; gameSys.setAnimation(0x257, 254, 4); gameSys.insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (gameSys.getAnimationStatus(4) != 2) @@ -2349,7 +2349,7 @@ void Scene17::platHangUpPhone() { _vm->clearFlag(kGFPlatypusTalkingToAssistant); while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); - _vm->_gnapActionStatus = savedGnapActionStatus; + _vm->_gnap->_actionStatus = savedGnapActionStatus; _vm->updateMouseCursor(); } updateHotspots(); @@ -2431,7 +2431,7 @@ void Scene17::run() { _vm->endSceneInit(); _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); - _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; + _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; platHangUpPhone(); gameSys.setAnimation(0, 0, 4); _vm->clearFlag(kGFPlatypusTalkingToAssistant); @@ -2446,7 +2446,7 @@ void Scene17::run() { gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 601; - _vm->_gnapActionStatus = kAS17GnapHangUpPhone; + _vm->_gnap->_actionStatus = kAS17GnapHangUpPhone; _vm->clearFlag(kGFUnk25); gameSys.insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -2466,7 +2466,7 @@ void Scene17::run() { _vm->_platypusSequenceDatNum = 0; _vm->endSceneInit(); gameSys.setAnimation(_currPhoneSequenceId, 254, 1); - _vm->_platypusActionStatus = kAS17PlatPhoningAssistant; + _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; updateHotspots(); } else if (_vm->_prevSceneNum == 18) { _vm->initGnapPos(6, 6, kDirBottomRight); @@ -2518,14 +2518,14 @@ void Scene17::run() { switch (_vm->_sceneClickedHotspot) { case kHS17Device: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == 3) { + if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == 3) { _vm->runMenu(); updateHotspots(); } break; case kHS17Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { if (_vm->isFlag(kGFGrassTaken)) { _vm->gnapUseJointOnPlatypus(); @@ -2533,8 +2533,8 @@ void Scene17::run() { _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); - _vm->_platypusActionStatus = kAS17GetWrench1; - _vm->_gnapActionStatus = kAS17GetWrench1; + _vm->_plat->_actionStatus = kAS17GetWrench1; + _vm->_gnap->_actionStatus = kAS17GetWrench1; _vm->_timers[5] = _vm->getRandom(30) + 80; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemJoint); @@ -2560,7 +2560,7 @@ void Scene17::run() { break; case kHS17Wrench: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { _vm->playGnapImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2579,8 +2579,8 @@ void Scene17::run() { platHangUpPhone(); _vm->gnapUseDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); - _vm->_platypusActionStatus = kAS17TryGetWrench; - _vm->_gnapActionStatus = kAS17TryGetWrench; + _vm->_plat->_actionStatus = kAS17TryGetWrench; + _vm->_gnap->_actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; } else _vm->playGnapImpossible(0, 0); @@ -2591,10 +2591,10 @@ void Scene17::run() { break; case kHS17Phone1: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS17PutCoinIntoPhone; + _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { @@ -2606,7 +2606,7 @@ void Scene17::run() { if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); - _vm->_gnapActionStatus = kAS17GetCoinFromPhone; + _vm->_gnap->_actionStatus = kAS17GetCoinFromPhone; } else _vm->playGnapImpossible(0, 0); break; @@ -2621,8 +2621,8 @@ void Scene17::run() { _vm->_plat->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); - _vm->_platypusActionStatus = kAS17PlatUsePhone; - _vm->_gnapActionStatus = kAS17PlatUsePhone; + _vm->_plat->_actionStatus = kAS17PlatUsePhone; + _vm->_gnap->_actionStatus = kAS17PlatUsePhone; } else _vm->playGnapImpossible(0, 0); break; @@ -2632,10 +2632,10 @@ void Scene17::run() { break; case kHS17Phone2: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS17PutCoinIntoPhone; + _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { @@ -2649,7 +2649,7 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS17GnapUsePhone; + _vm->_gnap->_actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else _vm->playGnapImpossible(0, 0); @@ -2665,8 +2665,8 @@ void Scene17::run() { _vm->_plat->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); - _vm->_platypusActionStatus = kAS17PlatUsePhone; - _vm->_gnapActionStatus = kAS17PlatUsePhone; + _vm->_plat->_actionStatus = kAS17PlatUsePhone; + _vm->_gnap->_actionStatus = kAS17PlatUsePhone; } else _vm->playGnapImpossible(0, 0); break; @@ -2676,25 +2676,25 @@ void Scene17::run() { break; case kHS17ExitToyStore: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS17LeaveScene; - if (_vm->_platypusActionStatus != kAS17PlatPhoningAssistant) + _vm->_gnap->_actionStatus = kAS17LeaveScene; + if (_vm->_plat->_actionStatus != kAS17PlatPhoningAssistant) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); } break; case kHS17ExitGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS17LeaveScene; + _vm->_gnap->_actionStatus = kAS17LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); } break; @@ -2702,12 +2702,12 @@ void Scene17::run() { case kHS17WalkArea1: case kHS17WalkArea2: case kHS17WalkArea3: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = 0; } @@ -2720,17 +2720,17 @@ void Scene17::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) + if (_vm->_plat->_actionStatus < 0) _vm->updatePlatypusIdleSequence2(); _vm->updateGnapIdleSequence2(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 200; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) gameSys.insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -2744,7 +2744,7 @@ void Scene17::run() { } } } - if (_vm->_platypusActionStatus < 0 && !_vm->_timers[5]) { + if (_vm->_plat->_actionStatus < 0 && !_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 80; if (_vm->isFlag(kGFGrassTaken) && _nextWrenchSequenceId == -1) { _nextWrenchSequenceId = 0x236; @@ -2823,9 +2823,9 @@ void Scene17::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS17GetWrench1: - _vm->_gnapActionStatus = kAS17GetWrenchGnapReady; + _vm->_gnap->_actionStatus = kAS17GetWrenchGnapReady; break; case kAS17GetCoinFromPhone: _vm->playGnapPullOutDevice(1, 3); @@ -2834,11 +2834,11 @@ void Scene17::updateAnimations() { gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemDiceQuarterHole); _vm->clearFlag(kGFUnk18); - _vm->_gnapActionStatus = kAS17GetCoinFromPhoneDone; + _vm->_gnap->_actionStatus = kAS17GetCoinFromPhoneDone; break; case kAS17GetCoinFromPhoneDone: _vm->setGrabCursorSprite(kItemDiceQuarterHole); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS17PutCoinIntoPhone: gameSys.setAnimation(0x24C, _vm->_gnapId, 0); @@ -2848,23 +2848,23 @@ void Scene17::updateAnimations() { _vm->invRemove(kItemDiceQuarterHole); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFUnk18); - _vm->_gnapActionStatus = kAS17PutCoinIntoPhoneDone; + _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhoneDone; break; case kAS17PutCoinIntoPhoneDone: gameSys.insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS17GnapUsePhone: gameSys.setAnimation(0x24D, _vm->_gnapId, 0); gameSys.insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kAS17LeaveScene; + _vm->_gnap->_actionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17GnapHangUpPhone: gameSys.insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x258; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS17LeaveScene: _vm->_sceneDone = true; @@ -2874,9 +2874,9 @@ void Scene17::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { + switch (_vm->_plat->_actionStatus) { case kAS17TryGetWrench: - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; ++_platTryGetWrenchCtr; if (_platTryGetWrenchCtr % 2 != 0) _nextWrenchSequenceId = 0x233; @@ -2891,7 +2891,7 @@ void Scene17::updateAnimations() { _nextCarWindowSequenceId = 0x249; break; case kAS17GetWrenchDone: - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); break; @@ -2900,7 +2900,7 @@ void Scene17::updateAnimations() { gameSys.insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x24E; - _vm->_platypusActionStatus = kAS17LeaveScene; + _vm->_plat->_actionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17PlatPhoningAssistant: @@ -2912,7 +2912,7 @@ void Scene17::updateAnimations() { gameSys.insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceDatNum = 0; _vm->_platypusSequenceId = 0x25B; - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); _vm->_sceneWaiting = false; updateHotspots(); @@ -2935,7 +2935,7 @@ void Scene17::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { switch (_nextWrenchSequenceId) { case 0x233: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; gameSys.insertSequence(0x243, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); @@ -2947,7 +2947,7 @@ void Scene17::updateAnimations() { gameSys.setAnimation(0x243, _vm->_platypusId, 1); break; case 0x234: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; gameSys.insertSequence(0x242, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); @@ -2982,7 +2982,7 @@ void Scene17::updateAnimations() { _nextWrenchSequenceId = -1; break; case 0x230: - if (_vm->_gnapActionStatus == kAS17GetWrenchGnapReady) { + if (_vm->_gnap->_actionStatus == kAS17GetWrenchGnapReady) { gameSys.setAnimation(0, 0, 2); if (_canTryGetWrench) { gameSys.insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -2999,7 +2999,7 @@ void Scene17::updateAnimations() { _vm->_gnapSequenceId = 0x875; _vm->_platypusSequenceId = 0x23F; _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); - _vm->_platypusActionStatus = kAS17GetWrench2; + _vm->_plat->_actionStatus = kAS17GetWrench2; } break; default: @@ -3063,8 +3063,8 @@ void Scene17::updateAnimations() { _currWrenchSequenceId = 0x22D; _nextWrenchSequenceId = -1; _vm->setFlag(kGFGrassTaken); - _vm->_gnapActionStatus = -1; - _vm->_platypusActionStatus = 2; + _vm->_gnap->_actionStatus = -1; + _vm->_plat->_actionStatus = 2; updateHotspots(); _vm->_timers[5] = _vm->getRandom(30) + 80; break; @@ -3277,7 +3277,7 @@ void Scene18::platEndPhoning(bool platFl) { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _platPhoneIter = 0; _platPhoneCtr = 0; - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; if (_currPhoneSequenceId != -1) { gameSys.setAnimation(0x21E, 254, 3); gameSys.insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); @@ -3288,7 +3288,7 @@ void Scene18::platEndPhoning(bool platFl) { gameSys.setAnimation(0, 0, 3); _vm->clearFlag(kGFPlatypusTalkingToAssistant); if (platFl) { - _vm->_platypusActionStatus = kAS18PlatComesHere; + _vm->_plat->_actionStatus = kAS18PlatComesHere; _vm->_timers[6] = 50; _vm->_sceneWaiting = true; } @@ -3299,26 +3299,26 @@ void Scene18::platEndPhoning(bool platFl) { } void Scene18::closeHydrantValve() { - _vm->_gnapActionStatus = kAS18LeaveScene; + _vm->_gnap->_actionStatus = kAS18LeaveScene; _vm->updateMouseCursor(); if (_vm->isFlag(kGFTruckFilledWithGas)) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gnapActionStatus = kAS18CloseRightValveWithGarbageCan; + _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; waitForGnapAction(); } else { - _vm->_gnapActionStatus = kAS18CloseRightValveNoGarbageCan; + _vm->_gnap->_actionStatus = kAS18CloseRightValveNoGarbageCan; waitForGnapAction(); } } else if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BA, 1); - _vm->_gnapActionStatus = kAS18CloseTopValve; + _vm->_gnap->_actionStatus = kAS18CloseTopValve; waitForGnapAction(); } } void Scene18::waitForGnapAction() { - while (_vm->_gnapActionStatus >= 0) { + while (_vm->_gnap->_actionStatus >= 0) { updateAnimations(); _vm->gameUpdateTick(); } @@ -3423,14 +3423,14 @@ void Scene18::run() { switch (_vm->_sceneClickedHotspot) { case kHS18Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS18Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3460,10 +3460,10 @@ void Scene18::run() { break; case kHS18CowboyHat: - if (_vm->_gnapActionStatus == kAS18StandingOnHydrant) { - _vm->_gnapActionStatus = kAS18GrabCowboyHat; + if (_vm->_gnap->_actionStatus == kAS18StandingOnHydrant) { + _vm->_gnap->_actionStatus = kAS18GrabCowboyHat; _vm->_sceneWaiting = false; - } else if (_vm->_gnapActionStatus < 0) { + } else if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3488,7 +3488,7 @@ void Scene18::run() { break; case kHS18GarbageCan: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex >= 0) _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); @@ -3516,10 +3516,10 @@ void Scene18::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, -1, -1, 1); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); - _vm->_gnapActionStatus = kAS18GrabGarbageCanFromStreet; + _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 0, -1, 1)) - _vm->_gnapActionStatus = kAS18GrabGarbageCanFromHydrant; + _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromHydrant; } break; case TALK_CURSOR: @@ -3533,7 +3533,7 @@ void Scene18::run() { break; case kHS18HydrantTopValve: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { // While carrying garbage can if (_vm->_grabCursorSpriteIndex >= 0) { @@ -3550,10 +3550,10 @@ void Scene18::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { gnapCarryGarbageCanTo(2); - _vm->_gnapActionStatus = kAS18PutGarbageCanOnRunningHydrant; + _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnRunningHydrant; } else if (!_vm->isFlag(kGFBarnPadlockOpen)) { gnapCarryGarbageCanTo(2); - _vm->_gnapActionStatus = kAS18PutGarbageCanOnHydrant; + _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnHydrant; } else { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3571,7 +3571,7 @@ void Scene18::run() { } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); - _vm->_gnapActionStatus = kAS18OpenTopValve; + _vm->_gnap->_actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); } else { @@ -3584,7 +3584,7 @@ void Scene18::run() { _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS18CloseTopValve; + _vm->_gnap->_actionStatus = kAS18CloseTopValve; } else _vm->playGnapImpossible(0, 0); break; @@ -3599,7 +3599,7 @@ void Scene18::run() { break; case kHS18HydrantRightValve: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex == -1) { _vm->playGnapImpossible(0, 0); @@ -3614,9 +3614,9 @@ void Scene18::run() { if (_vm->_grabCursorSpriteIndex == kItemWrench) { _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnapActionStatus = kAS18OpenRightValveWithGarbageCan; + _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCan; else - _vm->_gnapActionStatus = kAS18OpenRightValveNoGarbageCan; + _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCan; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } else { @@ -3628,9 +3628,9 @@ void Scene18::run() { if (_vm->isFlag(kGFTruckFilledWithGas)) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnapActionStatus = kAS18CloseRightValveWithGarbageCan; + _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; else - _vm->_gnapActionStatus = kAS18CloseRightValveNoGarbageCan; + _vm->_gnap->_actionStatus = kAS18CloseRightValveNoGarbageCan; } break; case TALK_CURSOR: @@ -3644,7 +3644,7 @@ void Scene18::run() { break; case kHS18ExitToyStore: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3655,7 +3655,7 @@ void Scene18::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 19; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore].x, _vm->_hotspotsWalkPos[kHS18ExitToyStore].y, 0, 0x107C0, 1); - _vm->_gnapActionStatus = kAS18LeaveScene; + _vm->_gnap->_actionStatus = kAS18LeaveScene; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore].x + 1, _vm->_hotspotsWalkPos[kHS18ExitToyStore].y, -1, 0x107C2, 1); } @@ -3663,7 +3663,7 @@ void Scene18::run() { break; case kHS18ExitPhoneBooth: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3672,7 +3672,7 @@ void Scene18::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].x, _vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS18LeaveScene; + _vm->_gnap->_actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else @@ -3681,7 +3681,7 @@ void Scene18::run() { break; case kHS18ExitGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3691,7 +3691,7 @@ void Scene18::run() { _vm->_newSceneNum = 20; _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity].x, _vm->_hotspotsWalkPos[kHS18ExitGrubCity].y, 0, 0x107B2, 1); - _vm->_gnapActionStatus = kAS18LeaveScene; + _vm->_gnap->_actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(false); else @@ -3702,7 +3702,7 @@ void Scene18::run() { case kHS18WalkArea1: case kHS18WalkArea2: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3714,7 +3714,7 @@ void Scene18::run() { break; default: - if (_vm->_gnapActionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { + if (_vm->_gnap->_actionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3732,16 +3732,16 @@ void Scene18::run() { _vm->playSound(0x10940, true); if ((_vm->isFlag(kGFTruckFilledWithGas) || _vm->isFlag(kGFBarnPadlockOpen)) && !_vm->isSoundPlaying(0x22B) && - _vm->_gnapActionStatus != kAS18OpenRightValveNoGarbageCanDone && _vm->_gnapActionStatus != kAS18OpenRightValveNoGarbageCan && - _vm->_gnapActionStatus != kAS18OpenTopValve && _vm->_gnapActionStatus != kAS18OpenTopValveDone && - _vm->_gnapActionStatus != kAS18OpenRightValveWithGarbageCan && _vm->_gnapActionStatus != kAS18OpenRightValveWithGarbageCanDone) + _vm->_gnap->_actionStatus != kAS18OpenRightValveNoGarbageCanDone && _vm->_gnap->_actionStatus != kAS18OpenRightValveNoGarbageCan && + _vm->_gnap->_actionStatus != kAS18OpenTopValve && _vm->_gnap->_actionStatus != kAS18OpenTopValveDone && + _vm->_gnap->_actionStatus != kAS18OpenRightValveWithGarbageCan && _vm->_gnap->_actionStatus != kAS18OpenRightValveWithGarbageCanDone) _vm->playSound(0x22B, true); if (!_vm->_isLeavingScene) { if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - if (_vm->_platypusActionStatus == kAS18PlatComesHere) { + if (_vm->_plat->_actionStatus == kAS18PlatComesHere) { if (!_vm->_timers[6]) { - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; _vm->_sceneWaiting = false; _vm->initPlatypusPos(-1, 10, kDirNone); _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); @@ -3756,7 +3756,7 @@ void Scene18::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->getRandom(2) == 1) gameSys.insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); else @@ -3789,7 +3789,7 @@ void Scene18::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS18GrabGarbageCanFromStreet: if (_vm->_gnap->_idleFacing != kDirUpRight && _vm->_gnap->_idleFacing != kDirBottomRight) { gameSys.insertSequence(0x1FC, _vm->_gnapId, @@ -3807,7 +3807,7 @@ void Scene18::updateAnimations() { gameSys.removeSequence(0x1FA, 19, true); _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18GrabGarbageCanFromHydrant: gameSys.insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -3817,7 +3817,7 @@ void Scene18::updateAnimations() { _vm->clearFlag(kGFTruckKeysUsed); _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18CloseRightValveNoGarbageCan: gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -3831,7 +3831,7 @@ void Scene18::updateAnimations() { _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); updateHotspots(); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18OpenTopValve: _vm->setFlag(kGFBarnPadlockOpen); @@ -3842,7 +3842,7 @@ void Scene18::updateAnimations() { _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BB, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS18OpenTopValveDone; + _vm->_gnap->_actionStatus = kAS18OpenTopValveDone; break; case kAS18OpenTopValveDone: _vm->setGrabCursorSprite(-1); @@ -3859,7 +3859,7 @@ void Scene18::updateAnimations() { _vm->_gnapSequenceId = 0x208; _vm->invRemove(kItemWrench); _vm->setGrabCursorSprite(-1); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18CloseTopValve: gameSys.insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -3873,14 +3873,14 @@ void Scene18::updateAnimations() { _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); updateHotspots(); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18GrabCowboyHat: gameSys.setAnimation(0x200, _vm->_gnapId, 0); gameSys.insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x200; - _vm->_gnapActionStatus = kAS18GrabCowboyHatDone; + _vm->_gnap->_actionStatus = kAS18GrabCowboyHatDone; break; case kAS18GrabCowboyHatDone: _vm->hideCursor(); @@ -3899,11 +3899,11 @@ void Scene18::updateAnimations() { _vm->setFlag(kGFTruckKeysUsed); _vm->setFlag(kGFUnk14); // Useless, already set updateHotspots(); - _vm->_gnapActionStatus = kAS18LeaveScene; + _vm->_gnap->_actionStatus = kAS18LeaveScene; break; case kAS18LeaveScene: _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18PutGarbageCanOnRunningHydrant: _vm->setFlag(kGFTruckKeysUsed); @@ -3915,7 +3915,7 @@ void Scene18::updateAnimations() { gameSys.setAnimation(0x210, _vm->_gnapId, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x210; - _vm->_gnapActionStatus = kAS18PutGarbageCanOnRunningHydrant2; + _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnRunningHydrant2; break; case kAS18PutGarbageCanOnRunningHydrant2: _vm->playSound(0x22B, true); @@ -3924,7 +3924,7 @@ void Scene18::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x1FF; _vm->_sceneWaiting = true; - _vm->_gnapActionStatus = kAS18StandingOnHydrant; + _vm->_gnap->_actionStatus = kAS18StandingOnHydrant; break; case kAS18StandingOnHydrant: gameSys.setAnimation(0x1FF, _vm->_gnapId, 0); @@ -3940,10 +3940,10 @@ void Scene18::updateAnimations() { _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - if (_vm->_gnapActionStatus == kAS18OpenRightValveNoGarbageCan) - _vm->_gnapActionStatus = kAS18OpenRightValveNoGarbageCanDone; + if (_vm->_gnap->_actionStatus == kAS18OpenRightValveNoGarbageCan) + _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCanDone; else - _vm->_gnapActionStatus = kAS18OpenRightValveWithGarbageCanDone; + _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCanDone; break; case kAS18OpenRightValveWithGarbageCanDone: _vm->setGrabCursorSprite(-1); @@ -3960,7 +3960,7 @@ void Scene18::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x207; _vm->invRemove(kItemWrench); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18OpenRightValveNoGarbageCanDone: _vm->setGrabCursorSprite(-1); @@ -3976,7 +3976,7 @@ void Scene18::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x207; _vm->invRemove(kItemWrench); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18CloseRightValveWithGarbageCan: gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -3992,10 +3992,10 @@ void Scene18::updateAnimations() { updateHotspots(); _vm->_gnapSequenceDatNum = 1; _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapActionStatus = kAS18CloseRightValveWithGarbageCanDone; + _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCanDone; break; case kAS18CloseRightValveWithGarbageCanDone: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS18PutGarbageCanOnHydrant: _vm->setFlag(kGFTruckKeysUsed); @@ -4004,12 +4004,12 @@ void Scene18::updateAnimations() { gameSys.setAnimation(0x20F, _vm->_gnapId, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x20F; - _vm->_gnapActionStatus = kAS18PutGarbageCanOnHydrantDone; + _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnHydrantDone; break; case kAS18PutGarbageCanOnHydrantDone: gameSys.insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); updateHotspots(); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -4133,14 +4133,14 @@ void Scene19::run() { switch (_vm->_sceneClickedHotspot) { case kHS19Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS19Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -4166,12 +4166,12 @@ void Scene19::run() { break; case kHS19ExitOutsideToyStore: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS19WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107B2, 1); - _vm->_gnapActionStatus = kAS19LeaveScene; + _vm->_gnap->_actionStatus = kAS19LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else @@ -4181,7 +4181,7 @@ void Scene19::run() { break; case kHS19Picture: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { @@ -4192,7 +4192,7 @@ void Scene19::run() { case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); - _vm->_gnapActionStatus = kAS19GrabPicture; + _vm->_gnap->_actionStatus = kAS19GrabPicture; } break; case TALK_CURSOR: @@ -4205,7 +4205,7 @@ void Scene19::run() { break; case kHS19ShopAssistant: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { @@ -4216,7 +4216,7 @@ void Scene19::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS19TalkShopAssistant; + _vm->_gnap->_actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -4234,7 +4234,7 @@ void Scene19::run() { case kHS19Toy5: case kHS19Toy6: case kHS19Toy7: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); } else { @@ -4245,7 +4245,7 @@ void Scene19::run() { case GRAB_CURSOR: _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); - _vm->_gnapActionStatus = kAS19GrabToy; + _vm->_gnap->_actionStatus = kAS19GrabToy; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -4257,7 +4257,7 @@ void Scene19::run() { break; case kHS19Phone: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); } else { @@ -4268,7 +4268,7 @@ void Scene19::run() { case GRAB_CURSOR: _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); _vm->playGnapIdle(8, 2); - _vm->_gnapActionStatus = kAS19UsePhone; + _vm->_gnap->_actionStatus = kAS19UsePhone; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -4282,7 +4282,7 @@ void Scene19::run() { case kHS19WalkArea1: case kHS19WalkArea2: case kHS19WalkArea3: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -4332,7 +4332,7 @@ void Scene19::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS19UsePhone: _nextShopAssistantSequenceId = 0x67; break; @@ -4361,7 +4361,7 @@ void Scene19::updateAnimations() { _vm->invAdd(kItemPicture); _vm->setFlag(kGFPictureTaken); updateHotspots(); - _vm->_gnapActionStatus = kAS19GrabPictureDone; + _vm->_gnap->_actionStatus = kAS19GrabPictureDone; break; case kAS19GrabPictureDone: _vm->setGrabCursorSprite(-1); @@ -4382,7 +4382,7 @@ void Scene19::updateAnimations() { break; case kAS19TalkShopAssistant: _nextShopAssistantSequenceId = 0x6D; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS19LeaveScene: _vm->_sceneDone = true; @@ -4416,14 +4416,14 @@ void Scene19::updateAnimations() { _vm->gameUpdateTick(); } _vm->playGnapIdle(6, 2); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case 0x67: gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case 0x65: _vm->playGnapIdle(6, 2); @@ -4432,7 +4432,7 @@ void Scene19::updateAnimations() { _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_newSceneNum = 18; - _vm->_gnapActionStatus = kAS19LeaveScene; + _vm->_gnap->_actionStatus = kAS19LeaveScene; break; case 0x6D: gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 23afc55907..229aad4eb6 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -77,7 +77,7 @@ void Scene20::updateAnimationsCb() { _vm->invAdd(kItemJoint); _vm->setFlag(kGFJointTaken); _stonerGuyShowingJoint = false; - _vm->_gnapActionStatus = kAS20GrabJointDone; + _vm->_gnap->_actionStatus = kAS20GrabJointDone; break; case 0x16E: gameSys.setAnimation(0x16E, 21, 2); @@ -92,7 +92,7 @@ void Scene20::updateAnimationsCb() { gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = _nextStonerGuySequenceId; _nextStonerGuySequenceId = -1; - _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gnap->_actionStatus = kAS20ActionDone; break; case 0x16F: gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); @@ -264,14 +264,14 @@ void Scene20::run() { switch (_vm->_sceneClickedHotspot) { case kHS20Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS20Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -297,71 +297,71 @@ void Scene20::run() { break; case kHS20ExitParkingLot: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 21; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y + 1, -1, 0x107CF, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; case kHS20ExitPhone: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x + 1, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, -1, 0x107C2, 1); } break; case kHS20ExitOutsideToyStore: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y + 1, -1, 0x107CD, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; } break; case kHS20ExitInsideGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y - 1, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y, -1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; case kHS20ExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS20LeaveScene; + _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, -1, 0x107C2, 1); } break; case kHS20StonerGuy: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); } else { @@ -373,7 +373,7 @@ void Scene20::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_stonerGuyShowingJoint) - _vm->_gnapActionStatus = kAS20GrabJoint; + _vm->_gnap->_actionStatus = kAS20GrabJoint; else _vm->playGnapImpossible(0, 0); break; @@ -381,9 +381,9 @@ void Scene20::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) - _vm->_gnapActionStatus = kAS20TalkStonerGuyNoJoint; + _vm->_gnap->_actionStatus = kAS20TalkStonerGuyNoJoint; else - _vm->_gnapActionStatus = kAS20TalkStonerGuyHasJoint; + _vm->_gnap->_actionStatus = kAS20TalkStonerGuyHasJoint; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -394,7 +394,7 @@ void Scene20::run() { break; case kHS20GroceryStoreGuy: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); } else { @@ -406,12 +406,12 @@ void Scene20::run() { _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS20GrabGroceryStoreGuy; + _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS20TalkGroceryStoreGuy; + _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -422,11 +422,11 @@ void Scene20::run() { break; case kHS20GroceryStoreHat: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHat; + _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); } else { @@ -438,7 +438,7 @@ void Scene20::run() { _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS20GrabGroceryStoreHat; + _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -469,14 +469,14 @@ void Scene20::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) { + if (_vm->_plat->_actionStatus < 0) { _vm->_hotspots[kHS20WalkArea1]._y2 += 48; _vm->updatePlatypusIdleSequence(); _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; } - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { _vm->_timers[5] = _vm->getRandom(50) + 130; if (_vm->getRandom(4) != 0) _nextGroceryStoreGuySequenceId = 0x17C; @@ -485,7 +485,7 @@ void Scene20::run() { } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -518,7 +518,7 @@ void Scene20::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS20LeaveScene: _vm->_sceneDone = true; break; @@ -552,13 +552,13 @@ void Scene20::updateAnimations() { _vm->_timers[6] = 200; _vm->_timers[4] = 100; _stonerGuyShowingJoint = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS20GrabJoint: _nextStonerGuySequenceId = 0x16A; break; case kAS20ActionDone: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS20TalkGroceryStoreGuy: gameSys.setAnimation(0x170, 21, 2); @@ -609,7 +609,7 @@ void Scene20::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->invRemove(kItemCowboyHat); _vm->invAdd(kItemGroceryStoreHat); - _vm->_gnapActionStatus = kAS20SwitchGroceryStoreHatDone; + _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHatDone; break; case kAS20SwitchGroceryStoreHatDone: gameSys.insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); @@ -626,11 +626,11 @@ void Scene20::updateAnimations() { _vm->setGrabCursorSprite(kItemGroceryStoreHat); _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS20GrabJointDone: _vm->setGrabCursorSprite(kItemJoint); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -652,7 +652,7 @@ void Scene20::updateAnimations() { gameSys.insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x17D; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gnap->_actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; @@ -667,7 +667,7 @@ void Scene20::updateAnimations() { gameSys.insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x17E; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gnap->_actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; @@ -690,7 +690,7 @@ void Scene20::updateAnimations() { gameSys.insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = 0x175; _nextGroceryStoreGuySequenceId = -1; - _vm->_gnapActionStatus = kAS20ActionDone; + _vm->_gnap->_actionStatus = kAS20ActionDone; break; default: if (_nextGroceryStoreGuySequenceId != -1) { @@ -782,14 +782,14 @@ void Scene21::run() { switch (_vm->_sceneClickedHotspot) { case kHS21Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS21Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -815,7 +815,7 @@ void Scene21::run() { break; case kHS21Banana: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 5); } else { @@ -827,7 +827,7 @@ void Scene21::run() { _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); _vm->playGnapPullOutDevice(2, 5); _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kAS21GrabBanana; + _vm->_gnap->_actionStatus = kAS21GrabBanana; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -838,11 +838,11 @@ void Scene21::run() { break; case kHS21OldLady: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; _vm->gnapWalkTo(4, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS21UseHatWithOldLady; + _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 6, 7, 4); } else { @@ -854,13 +854,13 @@ void Scene21::run() { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS21GrabOldLady; + _vm->_gnap->_actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady].x, _vm->_hotspotsWalkPos[kHS21OldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS21TalkOldLady; + _vm->_gnap->_actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -871,11 +871,11 @@ void Scene21::run() { break; case kHS21ExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, 0, 0x107B3, 1); - _vm->_gnapActionStatus = kAS21LeaveScene; + _vm->_gnap->_actionStatus = kAS21LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, -1, 0x107C2, 1); } break; @@ -902,7 +902,7 @@ void Scene21::run() { if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); - if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && _vm->_gnapActionStatus == -1) { + if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && _vm->_gnap->_actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(30) + 50; switch (_vm->getRandom(5)) { case 0: @@ -940,10 +940,10 @@ void Scene21::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS21TalkOldLady: _nextOldLadySequenceId = 0x8B; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS21GrabBanana: gameSys.setAnimation(0x8C, 59, 0); @@ -951,11 +951,11 @@ void Scene21::updateAnimations() { _vm->setFlag(kGFUnk04); _vm->invAdd(kItemBanana); updateHotspots(); - _vm->_gnapActionStatus = kAS21GrabBananaDone; + _vm->_gnap->_actionStatus = kAS21GrabBananaDone; break; case kAS21GrabBananaDone: _vm->setGrabCursorSprite(kItemBanana); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS21GrabOldLady: _vm->_timers[4] = _vm->getRandom(30) + 50; @@ -966,7 +966,7 @@ void Scene21::updateAnimations() { gameSys.insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x8F; - _vm->_gnapActionStatus = kAS21UseHatWithOldLadyDone; + _vm->_gnap->_actionStatus = kAS21UseHatWithOldLadyDone; _vm->invAdd(kItemTickets); _vm->invRemove(kItemGroceryStoreHat); _vm->setGrabCursorSprite(-1); @@ -987,13 +987,13 @@ void Scene21::updateAnimations() { gameSys.insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x86; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else if (_nextOldLadySequenceId == 0x91) { gameSys.setAnimation(0x91, 79, 0); gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kAS21LeaveScene; + _vm->_gnap->_actionStatus = kAS21LeaveScene; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else { @@ -1098,14 +1098,14 @@ void Scene22::run() { switch (_vm->_sceneClickedHotspot) { case kHS22Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS22Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1131,27 +1131,27 @@ void Scene22::run() { break; case kHS22ExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS22LeaveScene; + _vm->_gnap->_actionStatus = kAS22LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); } break; case kHS22ExitBackGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 23; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS22LeaveScene; + _vm->_gnap->_actionStatus = kAS22LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, -1, 0x107C2, 1); } break; case kHS22Cashier: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); } else { @@ -1166,7 +1166,7 @@ void Scene22::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS22TalkCashier; + _vm->_gnap->_actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: _vm->gnapUseDeviceOnPlatypus(); @@ -1239,7 +1239,7 @@ void Scene22::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS22LeaveScene: _vm->_sceneDone = true; break; @@ -1247,7 +1247,7 @@ void Scene22::updateAnimations() { _nextCashierSequenceId = 0x5C; break; } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { @@ -1322,14 +1322,14 @@ void Scene23::run() { switch (_vm->_sceneClickedHotspot) { case kHS23Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS23Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1355,7 +1355,7 @@ void Scene23::run() { break; case kHS23Cereals: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); } else { @@ -1366,7 +1366,7 @@ void Scene23::run() { else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS23LookCereals; + _vm->_gnap->_actionStatus = kAS23LookCereals; } break; case GRAB_CURSOR: @@ -1377,7 +1377,7 @@ void Scene23::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); - _vm->_gnapActionStatus = kAS23GrabCereals; + _vm->_gnap->_actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); } break; @@ -1391,18 +1391,18 @@ void Scene23::run() { break; case kHS23ExitFrontGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS23LeaveScene; + _vm->_gnap->_actionStatus = kAS23LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y - 1, -1, 0x107C2, 1); } break; case kHS23WalkArea1: case kHS23WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -1419,7 +1419,7 @@ void Scene23::run() { if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4] && _vm->_gnapActionStatus == -1) { + if (!_vm->_timers[4] && _vm->_gnap->_actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(100) + 200; switch (_vm->getRandom(4)) { case 0: @@ -1467,10 +1467,10 @@ void Scene23::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS23LookCereals: _vm->showFullScreenSprite(0x48); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS23GrabCereals: gameSys.setAnimation(0xBE, _vm->_gnapId, 0); @@ -1478,11 +1478,11 @@ void Scene23::updateAnimations() { gameSys.requestRemoveSequence(0xBF, 2); _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0xBE; - _vm->_gnapActionStatus = kAS23GrabCerealsDone; + _vm->_gnap->_actionStatus = kAS23GrabCerealsDone; break; case kAS23GrabCerealsDone: _vm->setGrabCursorSprite(kItemCereals); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS23LeaveScene: _vm->_sceneDone = true; @@ -1591,14 +1591,14 @@ void Scene24::run() { switch (_vm->_sceneClickedHotspot) { case kHS24Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS24Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1624,22 +1624,22 @@ void Scene24::run() { break; case kHS24ExitCircusWorld: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS24LeaveScene; + _vm->_gnap->_actionStatus = kAS24LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, -1, 0x107C2, 1); } break; case kHS24ExitOutsideGrubCity: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS24LeaveScene; + _vm->_gnap->_actionStatus = kAS24LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); } break; @@ -1647,7 +1647,7 @@ void Scene24::run() { case kHS24WalkArea1: case kHS24WalkArea2: case kHS24WalkArea3: - if (_vm->_gnapActionStatus == -1) + if (_vm->_gnap->_actionStatus == -1) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -1729,9 +1729,9 @@ void Scene24::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kAS24LeaveScene) + if (_vm->_gnap->_actionStatus == kAS24LeaveScene) _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } } @@ -1837,14 +1837,14 @@ void Scene25::run() { switch (_vm->_sceneClickedHotspot) { case kHS25Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS25Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1870,9 +1870,9 @@ void Scene25::run() { break; case kHS25TicketVendor: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { - _vm->_gnapActionStatus = kAS25ShowTicketToVendor; + _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); _vm->playGnapPullOutDevice(0, 0); @@ -1889,7 +1889,7 @@ void Scene25::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS25TalkTicketVendor; + _vm->_gnap->_actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -1901,29 +1901,29 @@ void Scene25::run() { break; case kHS25ExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, 0, 0x107B4, 1); - _vm->_gnapActionStatus = kAS25LeaveScene; + _vm->_gnap->_actionStatus = kAS25LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, -1, 0x107C2, 1); } break; case kHS25ExitInsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFNeedleTaken)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, 0, 0x107B1, 1); - _vm->_gnapActionStatus = kAS25LeaveScene; + _vm->_gnap->_actionStatus = kAS25LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, -1, 0x107C2, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } else { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(4, 5, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS25EnterCircusWihoutTicket; + _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicket; _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } } @@ -1933,7 +1933,7 @@ void Scene25::run() { case kHS25Posters2: case kHS25Posters3: case kHS25Posters4: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -1961,7 +1961,7 @@ void Scene25::run() { case kHS25WalkArea1: case kHS25WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -1978,7 +1978,7 @@ void Scene25::run() { if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); _vm->updateGnapIdleSequence(); - if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && _vm->_gnapActionStatus == -1) { + if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && _vm->_gnap->_actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(20) + 20; switch (_vm->getRandom(13)) { case 0: @@ -2033,10 +2033,10 @@ void Scene25::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS25TalkTicketVendor: _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS25EnterCircusWihoutTicket: _nextTicketVendorSequenceId = 0x5E; @@ -2050,10 +2050,10 @@ void Scene25::updateAnimations() { _vm->playGnapIdle(0, 0); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS25EnterCircusWihoutTicketDone; + _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicketDone; break; case kAS25EnterCircusWihoutTicketDone: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS25ShowTicketToVendor: _vm->setGrabCursorSprite(-1); @@ -2061,7 +2061,7 @@ void Scene25::updateAnimations() { _vm->setFlag(kGFNeedleTaken); gameSys.setAnimation(0x61, 40, 0); gameSys.insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = kAS25ShowTicketToVendorDone; + _vm->_gnap->_actionStatus = kAS25ShowTicketToVendorDone; break; case kAS25ShowTicketToVendorDone: _nextTicketVendorSequenceId = 0x53; @@ -2077,7 +2077,7 @@ void Scene25::updateAnimations() { gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } else if (_nextTicketVendorSequenceId != -1) { gameSys.setAnimation(_nextTicketVendorSequenceId, 39, 3); gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); @@ -2154,14 +2154,14 @@ void Scene26::run() { switch (_vm->_sceneClickedHotspot) { case kHS26Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS26Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2187,53 +2187,53 @@ void Scene26::run() { break; case kHS26ExitOutsideCircusWorld: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS26LeaveScene; + _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; case kHS26ExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS26LeaveScene; + _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; case kHS26ExitArcade: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS26LeaveScene; + _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; case kHS26ExitElephant: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 30; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS26LeaveScene; + _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; case kHS26ExitBeerStand: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS26LeaveScene; + _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; case kHS26WalkArea1: case kHS26WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -2288,9 +2288,9 @@ void Scene26::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kAS26LeaveScene) + if (_vm->_gnap->_actionStatus == kAS26LeaveScene) _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { @@ -2382,20 +2382,20 @@ void Scene27::run() { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); _vm->_sceneClickedHotspot = -1; - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { case kHS27Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS27Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2421,11 +2421,11 @@ void Scene27::run() { break; case kHS27Janitor: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemPicture) { _vm->_gnap->_idleFacing = kDirUpLeft; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, 0x107BC, 1)) - _vm->_gnapActionStatus = kAS27ShowPictureToJanitor; + _vm->_gnap->_actionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); } else { @@ -2436,7 +2436,7 @@ void Scene27::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS27TalkJanitor; + _vm->_gnap->_actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -2448,7 +2448,7 @@ void Scene27::run() { break; case kHS27Bucket: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 3, 3); } else { @@ -2459,7 +2459,7 @@ void Scene27::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); - _vm->_gnapActionStatus = kAS27GrabBucket; + _vm->_gnap->_actionStatus = kAS27GrabBucket; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -2471,59 +2471,59 @@ void Scene27::run() { break; case kHS27ExitCircus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, -1, 0x107C7, 1); } break; case kHS27ExitArcade: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade].x, _vm->_hotspotsWalkPos[kHS27ExitArcade].y + 1, -1, 0x107CF, 1); } break; case kHS27ExitBeerStand: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand].x, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y + 1, -1, 0x107CD, 1); } break; case kHS27ExitClown: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 28; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, _vm->_hotspotsWalkPos[kHS27ExitClown].y, 0, 0x107AD, 1); - _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x + 1, _vm->_hotspotsWalkPos[kHS27ExitClown].y, -1, 0x107C4, 1); } else { _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7, 0, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= SF_WALKABLE; - _vm->_gnapActionStatus = kAS27TryEnterClownTent; + _vm->_gnap->_actionStatus = kAS27TryEnterClownTent; } } break; case kHS27WalkArea1: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -2538,13 +2538,13 @@ void Scene27::run() { if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (_vm->_debugLevel == 4) _vm->updateIdleTimer(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->getRandom(3) != 0) _nextJanitorSequenceId = 0xCB; else @@ -2553,7 +2553,7 @@ void Scene27::run() { } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) gameSys.insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundB(); @@ -2576,7 +2576,7 @@ void Scene27::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS27TalkJanitor: switch (_vm->getRandom(3)) { case 0: @@ -2598,11 +2598,11 @@ void Scene27::updateAnimations() { _vm->setFlag(kGFUnk13); gameSys.setAnimation(0xD2, 39, 0); gameSys.insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kAS27GrabBucketDone; + _vm->_gnap->_actionStatus = kAS27GrabBucketDone; break; case kAS27GrabBucketDone: _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS27ShowPictureToJanitor: _nextJanitorSequenceId = 0xD0; @@ -2614,17 +2614,17 @@ void Scene27::updateAnimations() { gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; - _vm->_gnapActionStatus = kAS27TryEnterClownTentDone; + _vm->_gnap->_actionStatus = kAS27TryEnterClownTentDone; break; case kAS27TryEnterClownTentDone: _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS27EnterClownTent: _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107B2, 1); - _vm->_gnapActionStatus = kAS27LeaveScene; + _vm->_gnap->_actionStatus = kAS27LeaveScene; break; case kAS27LeaveScene: _vm->_sceneDone = true; @@ -2644,7 +2644,7 @@ void Scene27::updateAnimations() { case 0xCC: case 0xCD: case 0xCE: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); @@ -2657,7 +2657,7 @@ void Scene27::updateAnimations() { _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); - _vm->_gnapActionStatus = kAS27EnterClownTent; + _vm->_gnap->_actionStatus = kAS27EnterClownTent; _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; _vm->setFlag(kGFPlatypus); @@ -2742,12 +2742,12 @@ void Scene28::run() { gameSys.insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _nextClownSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 80; - _vm->_gnapActionStatus = kAS28GnapWaiting; + _vm->_gnap->_actionStatus = kAS28GnapWaiting; while (gameSys.getAnimationStatus(3) != 2) { _vm->gameUpdateTick(); _vm->updateMouseCursor(); } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } while (!_vm->_sceneDone) { @@ -2759,14 +2759,14 @@ void Scene28::run() { switch (_vm->_sceneClickedHotspot) { case kHS28Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS28Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2792,7 +2792,7 @@ void Scene28::run() { break; case kHS28Horn: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(2, 8, 3, 4); } else { @@ -2804,7 +2804,7 @@ void Scene28::run() { if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); - _vm->_gnapActionStatus = kAS28GrabHornSuccess; + _vm->_gnap->_actionStatus = kAS28GrabHornSuccess; } } else { _vm->_gnap->_idleFacing = kDirUpLeft; @@ -2812,7 +2812,7 @@ void Scene28::run() { _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y, 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS28GrabHornFails; + _vm->_gnap->_actionStatus = kAS28GrabHornFails; } break; case TALK_CURSOR: @@ -2825,7 +2825,7 @@ void Scene28::run() { break; case kHS28Clown: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFUnk21)) { if (_vm->_verbCursor == LOOK_CURSOR) _vm->playGnapScratchingHead(5, 2); @@ -2836,13 +2836,13 @@ void Scene28::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kAS28UseBeerBucketWithClown; + _vm->_gnap->_actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); - _vm->_gnapActionStatus = kAS28UsePillBucketWithClown; + _vm->_gnap->_actionStatus = kAS28UsePillBucketWithClown; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); } else { @@ -2853,7 +2853,7 @@ void Scene28::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS28TalkClown; + _vm->_gnap->_actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -2865,19 +2865,19 @@ void Scene28::run() { break; case kHS28ExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, 0, 0x107BF, 1); - _vm->_gnapActionStatus = kAS28LeaveScene; + _vm->_gnap->_actionStatus = kAS28LeaveScene; _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, -1, 0x107C2, 1); } break; case kHS28EmptyBucket: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); } else if (_vm->isFlag(kGFUnk21)) { @@ -2889,7 +2889,7 @@ void Scene28::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); - _vm->_gnapActionStatus = kAS28GrabEmptyBucket; + _vm->_gnap->_actionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -2902,12 +2902,12 @@ void Scene28::run() { case kHS28WalkArea1: case kHS28WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -2924,7 +2924,7 @@ void Scene28::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 80; - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFUnk21)) + if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFUnk21)) _nextClownSequenceId = 0x114; } } @@ -2946,7 +2946,7 @@ void Scene28::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS28UseBeerBucketWithClown: _vm->setFlag(kGFUnk22); _nextClownSequenceId = 0x113; @@ -2968,7 +2968,7 @@ void Scene28::updateAnimations() { _vm->playGnapUseDevice(0, 0); gameSys.setAnimation(0x117, 59, 0); gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kAS28GrabHornSuccessDone; + _vm->_gnap->_actionStatus = kAS28GrabHornSuccessDone; break; case kAS28GrabHornSuccessDone: _vm->hideCursor(); @@ -2983,21 +2983,21 @@ void Scene28::updateAnimations() { _vm->setGrabCursorSprite(kItemHorn); _vm->invAdd(kItemHorn); updateHotspots(); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS28GrabEmptyBucket: _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); gameSys.setAnimation(0x111, 99, 0); gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kAS28GrabEmptyBucketDone; + _vm->_gnap->_actionStatus = kAS28GrabEmptyBucketDone; break; case kAS28GrabEmptyBucketDone: _vm->setGrabCursorSprite(kItemEmptyBucket); _vm->clearFlag(kGFUnk22);; updateHotspots(); _vm->invAdd(kItemEmptyBucket); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS28GrabHornFailsDone: gameSys.insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); @@ -3006,7 +3006,7 @@ void Scene28::updateAnimations() { gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); break; case kAS28TalkClown: @@ -3019,7 +3019,7 @@ void Scene28::updateAnimations() { _nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? break; case kAS28GnapWaiting: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS28LeaveScene: _vm->_sceneDone = true; @@ -3037,7 +3037,7 @@ void Scene28::updateAnimations() { gameSys.insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; - _vm->_gnapActionStatus = kAS28GnapWaiting; + _vm->_gnap->_actionStatus = kAS28GnapWaiting; break; case 0x116: _vm->setGrabCursorSprite(-1); @@ -3048,18 +3048,18 @@ void Scene28::updateAnimations() { gameSys.insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); _currClownSequenceId = _nextClownSequenceId; _nextClownSequenceId = -1; - _vm->_gnapActionStatus = kAS28GnapWaiting; + _vm->_gnap->_actionStatus = kAS28GnapWaiting; break; case 0x11D: case 0x11E: case 0x11F: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case 0x119: gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextClownSequenceId, 39, 0); gameSys.removeSequence(_currClownSequenceId, 39, true); - _vm->_gnapActionStatus = kAS28GrabHornFailsDone; + _vm->_gnap->_actionStatus = kAS28GrabHornFailsDone; _vm->_gnapSequenceId = _nextClownSequenceId; _vm->_gnapSequenceDatNum = 0; _nextClownSequenceId = -1; @@ -3150,14 +3150,14 @@ void Scene29::run() { switch (_vm->_sceneClickedHotspot) { case kHS29Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS29Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -3183,11 +3183,11 @@ void Scene29::run() { break; case kHS29Monkey: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS29UseBananaWithMonkey; + _vm->_gnap->_actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); @@ -3211,34 +3211,34 @@ void Scene29::run() { break; case kHS29ExitCircus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->_gnap->_actionStatus = kAS29LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, -1, -1, 1); } break; case kHS29ExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->_gnap->_actionStatus = kAS29LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y - 1, -1, 0x107CD, 1); } break; case kHS29Aracde: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->setGrabCursorSprite(-1); _vm->_isLeavingScene = true; _vm->_newSceneNum = 52; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); - _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->_gnap->_actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); } else { @@ -3257,7 +3257,7 @@ void Scene29::run() { break; case kHS29WalkArea1: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -3275,14 +3275,14 @@ void Scene29::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->updateGnapIdleSequence(); _vm->updatePlatypusIdleSequence(); } if (!_vm->_timers[4]) { if (_vm->invHas(kItemHorn)) { _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { switch (_vm->getRandom(5)) { case 0: _nextManSequenceId = 0xED; @@ -3323,7 +3323,7 @@ void Scene29::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS29UseBananaWithMonkey: _nextMonkeySequenceId = 0xE5; break; @@ -3349,7 +3349,7 @@ void Scene29::updateAnimations() { gameSys.setAnimation(0, 159, 4); gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = kAS29LeaveScene; + _vm->_gnap->_actionStatus = kAS29LeaveScene; _currMonkeySequenceId = 0xE6; _nextMonkeySequenceId = -1; _vm->_timers[5] = 30; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 0e14ea9e3e..0698abb060 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -79,14 +79,14 @@ void Scene30::run() { switch (_vm->_sceneClickedHotspot) { case kHS30Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS30Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -112,12 +112,12 @@ void Scene30::run() { break; case kHS30PillMachine: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { _vm->_hotspots[kHS30WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 0, 0x107BC, 1); _vm->_hotspots[kHS30WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS30UsePillMachine; + _vm->_gnap->_actionStatus = kAS30UsePillMachine; hasTakenPill = true; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); @@ -125,7 +125,7 @@ void Scene30::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapWalkTo(9, 8, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS30LookPillMachine; + _vm->_gnap->_actionStatus = kAS30LookPillMachine; break; case GRAB_CURSOR: _vm->playGnapScratchingHead(8, 5); @@ -140,20 +140,20 @@ void Scene30::run() { break; case kHS30ExitCircus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; if (hasTakenPill) _vm->_newSceneNum = 47; else _vm->_newSceneNum = 26; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS30LeaveScene; + _vm->_gnap->_actionStatus = kAS30LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, -1, 0x107C2, 1); } break; case kHS30WalkArea1: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -172,11 +172,11 @@ void Scene30::run() { if (!_vm->_isLeavingScene) { _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->getRandom(5) == 1) { gameSys.insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -188,7 +188,7 @@ void Scene30::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (!_vm->isFlag(kGFUnk23) || hasTakenPill) gameSys.insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else @@ -215,7 +215,7 @@ void Scene30::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS30LeaveScene: _vm->_sceneDone = true; break; @@ -225,7 +225,7 @@ void Scene30::updateAnimations() { gameSys.insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x105; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS30UsePillMachine2; + _vm->_gnap->_actionStatus = kAS30UsePillMachine2; break; case kAS30UsePillMachine2: _vm->hideCursor(); @@ -240,7 +240,7 @@ void Scene30::updateAnimations() { gameSys.insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->removeFullScreenSprite(); _vm->showCursor(); - _vm->_gnapActionStatus = kAS30UsePillMachine3; + _vm->_gnap->_actionStatus = kAS30UsePillMachine3; _vm->invAdd(kItemPill); _vm->setFlag(kGFUnk23); break; @@ -249,20 +249,20 @@ void Scene30::updateAnimations() { gameSys.insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x104; _vm->_gnapSequenceDatNum = 0; - _vm->_gnapActionStatus = kAS30UsePillMachine4; + _vm->_gnap->_actionStatus = kAS30UsePillMachine4; _vm->setGrabCursorSprite(kItemDiceQuarterHole); break; case kAS30UsePillMachine4: gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y + 1, -1, 0x107BC, 1); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS30LookPillMachine: if (_vm->isFlag(kGFUnk23)) _vm->showFullScreenSprite(0xE3); else _vm->showFullScreenSprite(0xE2); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -334,14 +334,14 @@ void Scene31::run() { switch (_vm->_sceneClickedHotspot) { case kHS31Device: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { _vm->runMenu(); updateHotspots(); } break; case kHS31Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->gnapUseJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -367,8 +367,8 @@ void Scene31::run() { break; case kHS31MeasuringClown: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { - if (_vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { + if (_vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { if (_vm->_verbCursor == LOOK_CURSOR) _vm->playGnapScratchingHead(2, 2); else @@ -385,7 +385,7 @@ void Scene31::run() { _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 0, 0x107B9, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnapActionStatus = kAS31UseMeasuringClown; + _vm->_gnap->_actionStatus = kAS31UseMeasuringClown; _vm->_timers[4] = 300; break; case TALK_CURSOR: @@ -398,8 +398,8 @@ void Scene31::run() { _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_platypusActionStatus = kAS31PlatMeasuringClown; - _vm->_gnapActionStatus = kAS31PlatMeasuringClown; + _vm->_plat->_actionStatus = kAS31PlatMeasuringClown; + _vm->_gnap->_actionStatus = kAS31PlatMeasuringClown; _vm->_timers[4] = 300; } else _vm->playGnapImpossible(0, 0); @@ -410,7 +410,7 @@ void Scene31::run() { break; case kHS31BeerBarrel: - if (_vm->_gnapActionStatus < 0 || _vm->_gnapActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); _vm->gnapWalkTo(_vm->_gnap->_pos, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); @@ -419,7 +419,7 @@ void Scene31::run() { _vm->playGnapPullOutDevice(6, 8); _vm->playGnapUseDevice(0, 0); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS31FillEmptyBucketWithBeer; + _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeer; _vm->_timers[4] = 300; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); @@ -433,7 +433,7 @@ void Scene31::run() { _vm->playGnapScratchingHead(6, 2); } else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS31UseBeerBarrel; + _vm->_gnap->_actionStatus = kAS31UseBeerBarrel; _vm->_gnap->_idleFacing = kDirUpLeft; } break; @@ -447,27 +447,27 @@ void Scene31::run() { break; case kHS31ExitCircus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS31LeaveScene; + _vm->_gnap->_actionStatus = kAS31LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, -1, -1, 1); } break; case kHS31ExitOutsideClown: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS31LeaveScene; + _vm->_gnap->_actionStatus = kAS31LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y + 1, -1, 0x107CF, 1); } break; case kHS31WalkArea1: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; @@ -485,13 +485,13 @@ void Scene31::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) + if (_vm->_plat->_actionStatus < 0) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnapActionStatus < 0 && _nextClerkSequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _nextClerkSequenceId == -1) { switch (_vm->getRandom(6)){ case 0: _nextClerkSequenceId = 0xFF; @@ -510,7 +510,7 @@ void Scene31::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->getRandom(2) != 0) gameSys.insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); else @@ -537,7 +537,7 @@ void Scene31::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS31UseBeerBarrel: _nextClerkSequenceId = 0xFE; break; @@ -548,14 +548,14 @@ void Scene31::updateAnimations() { _vm->_gnapSequenceDatNum = 0; _vm->_gnapSequenceId = 0x102; _vm->_gnapId = 59; - _vm->_gnapActionStatus = kAS31FillEmptyBucketWithBeerDone; + _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeerDone; break; case kAS31FillEmptyBucketWithBeerDone: _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->invAdd(kItemBucketWithBeer); _vm->invRemove(kItemEmptyBucket); _vm->setGrabCursorSprite(kItemBucketWithBeer); @@ -566,14 +566,14 @@ void Scene31::updateAnimations() { break; case kAS31LeaveScene: _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - if (_vm->_platypusActionStatus == kAS31PlatMeasuringClown) { + if (_vm->_plat->_actionStatus == kAS31PlatMeasuringClown) { _vm->_sceneWaiting = true; _beerGuyDistracted = true; _nextClerkSequenceId = 0xFA; @@ -593,14 +593,14 @@ void Scene31::updateAnimations() { case 0xFC: ++_clerkMeasureCtr; if (_clerkMeasureCtr >= _clerkMeasureMaxCtr) { - if (_vm->_gnapActionStatus != 5) - _vm->_platypusActionStatus = -1; + if (_vm->_gnap->_actionStatus != 5) + _vm->_plat->_actionStatus = -1; _vm->_timers[0] = 40; gameSys.insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = 0xFD; _nextClerkSequenceId = -1; - if (_vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnapActionStatus != kAS31FillEmptyBucketWithBeer) - _vm->_gnapActionStatus = -1; + if (_vm->_gnap->_actionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnap->_actionStatus != kAS31FillEmptyBucketWithBeer) + _vm->_gnap->_actionStatus = -1; _beerGuyDistracted = false; _clerkMeasureMaxCtr = 3; gameSys.setAnimation(0xFD, 39, 3); @@ -617,7 +617,7 @@ void Scene31::updateAnimations() { gameSys.setAnimation(_nextClerkSequenceId, 39, 3); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; default: if (_nextClerkSequenceId != -1) { @@ -685,14 +685,14 @@ void Scene32::run() { switch (_vm->_sceneClickedHotspot) { case kHS32Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS32Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -716,11 +716,11 @@ void Scene32::run() { break; case kHS32ExitTruck: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS32LeaveScene; + _vm->_gnap->_actionStatus = kAS32LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y + 1, -1, 0x107CD, 1); _vm->_newSceneNum = 33; } @@ -734,13 +734,13 @@ void Scene32::run() { case kHS32WalkArea6: case kHS32WalkArea7: case kHS32WalkArea8: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = 0; } @@ -751,9 +751,9 @@ void Scene32::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) + if (_vm->_plat->_actionStatus < 0) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -781,7 +781,7 @@ void Scene32::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kAS32LeaveScene) + if (_vm->_gnap->_actionStatus == kAS32LeaveScene) _vm->_sceneDone = true; } } @@ -861,14 +861,14 @@ void Scene33::run() { switch (_vm->_sceneClickedHotspot) { case kHS33Device: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS33Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -892,7 +892,7 @@ void Scene33::run() { break; case kHS33Chicken: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(7, 9, 9, 8); } else { @@ -900,14 +900,14 @@ void Scene33::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) - _vm->_gnapActionStatus = kAS33UseChicken; + _vm->_gnap->_actionStatus = kAS33UseChicken; else - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS33TalkChicken; + _vm->_gnap->_actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: case PLAT_CURSOR: @@ -919,9 +919,9 @@ void Scene33::run() { break; case kHS33ExitHouse: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 37; if (_vm->_gnap->_pos.x > 6) _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); @@ -931,9 +931,9 @@ void Scene33::run() { break; case kHS33ExitBarn: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 35; if (_vm->_gnap->_pos.x > 7) _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); @@ -943,20 +943,20 @@ void Scene33::run() { break; case kHS33ExitCreek: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, -1, 0x107CD, 1); _vm->_newSceneNum = 34; } break; case kHS33ExitPigpen: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS33LeaveScene; + _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, -1, 0x107CF, 1); _vm->_newSceneNum = 32; } @@ -964,12 +964,12 @@ void Scene33::run() { case kHS33WalkArea1: case kHS33WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -982,9 +982,9 @@ void Scene33::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) + if (_vm->_plat->_actionStatus < 0) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -993,7 +993,7 @@ void Scene33::run() { else gameSys.insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnapActionStatus != kAS33TalkChicken && _vm->_gnapActionStatus != kAS33UseChicken) { + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnap->_actionStatus != kAS33TalkChicken && _vm->_gnap->_actionStatus != kAS33UseChicken) { if (_vm->getRandom(6) != 0) { _nextChickenSequenceId = 0x7E; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -1020,7 +1020,7 @@ void Scene33::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS33LeaveScene: _vm->_sceneDone = true; break; @@ -1038,11 +1038,11 @@ void Scene33::updateAnimations() { _currChickenSequenceId = 0x7E; gameSys.setAnimation(0x7E, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->_timers[5] = 30; break; default: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -1054,14 +1054,14 @@ void Scene33::updateAnimations() { gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; - _vm->_gnapActionStatus = kAS33UseChickenDone; + _vm->_gnap->_actionStatus = kAS33UseChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x7F) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); @@ -1098,21 +1098,21 @@ void Scene38::updateHotspots() { _vm->setHotspot(kHS38WalkArea5, 770, 0, 799, 445); _vm->setHotspot(kHS38WalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); _vm->setDeviceHotspot(kHS38Device, -1, -1, -1, -1); - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38Platypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; - else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_DISABLED; - else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_DISABLED; - else if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) + else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38WalkArea6]._flags = SF_NONE; _vm->_hotspotsCount = 13; } @@ -1144,8 +1144,8 @@ void Scene38::run() { break; case kHS38Platypus: - if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -1168,42 +1168,42 @@ void Scene38::run() { break; case kHS38ExitHouse: - if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; } else { _vm->_isLeavingScene = true; _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS38LeaveScene; + _vm->_gnap->_actionStatus = kAS38LeaveScene; _vm->_newSceneNum = 37; } break; case kHS38ExitCave: - if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { + _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_isLeavingScene = true; - } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { _vm->_sceneWaiting = false; _vm->_isLeavingScene = true; _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); _vm->_newSceneNum = 39; - _vm->_gnapActionStatus = kAS38ExitCave; + _vm->_gnap->_actionStatus = kAS38ExitCave; } break; case kHS38TrapDoorLid1: case kHS38TrapDoorLid2: - if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) { - if (_vm->_verbCursor == PLAT_CURSOR && _vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) - _vm->_gnapActionStatus = kAS38UsePlatypusWithTrapDoor; + if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { + if (_vm->_verbCursor == PLAT_CURSOR && _vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) + _vm->_gnap->_actionStatus = kAS38UsePlatypusWithTrapDoor; else - _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; + _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; } break; case kHS38HuntingTrophy: - if (_vm->_gnapActionStatus != kAS38HoldingHuntingTrophy) { + if (_vm->_gnap->_actionStatus != kAS38HoldingHuntingTrophy) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(3, 6, 2, 0); } else { @@ -1212,12 +1212,12 @@ void Scene38::run() { _vm->playGnapScratchingHead(0, 0); break; case GRAB_CURSOR: - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->playGnapImpossible(0, 0); else { _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); _vm->platypusWalkTo(4, 8, -1, -1, 1); - _vm->_gnapActionStatus = kAS38UseHuntingTrophy; + _vm->_gnap->_actionStatus = kAS38UseHuntingTrophy; } break; case TALK_CURSOR: @@ -1240,17 +1240,17 @@ void Scene38::run() { case kHS38WalkArea4: case kHS38WalkArea5: case kHS38WalkArea6: - if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) - _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; - else if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + else if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - if (_vm->_gnapActionStatus == kAS38HoldingHuntingTrophy) - _vm->_gnapActionStatus = kAS38ReleaseHuntingTrophy; - else if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + else if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -1281,7 +1281,7 @@ void Scene38::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS38LeaveScene: _vm->_sceneDone = true; break; @@ -1291,7 +1291,7 @@ void Scene38::updateAnimations() { _vm->_gnapSequenceId = 0xA3; _vm->_gnapSequenceDatNum = 0; gameSys.setAnimation(0xA3, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS38LeaveScene; + _vm->_gnap->_actionStatus = kAS38LeaveScene; break; case kAS38UseHuntingTrophy: gameSys.removeSequence(0x9B, 0, true); @@ -1299,11 +1299,11 @@ void Scene38::updateAnimations() { _vm->_gnapSequenceId = 0x9C; _vm->_gnapSequenceDatNum = 0; gameSys.setAnimation(0x9C, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; + _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; updateHotspots(); break; case kAS38HoldingHuntingTrophy: - if (_vm->_platypusActionStatus != kAS38PlatypusHoldingTrapDoor) + if (_vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) _vm->_sceneWaiting = true; if (_vm->_gnapSequenceId == 0xA4) { gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -1318,8 +1318,8 @@ void Scene38::updateAnimations() { case kAS38ReleaseHuntingTrophy: if (_vm->_gnapSequenceId == 0x9E) { gameSys.insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapActionStatus = -1; - } else if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + _vm->_gnap->_actionStatus = -1; + } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { gameSys.insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0xA0; _vm->_gnapSequenceDatNum = 0; @@ -1329,9 +1329,9 @@ void Scene38::updateAnimations() { _vm->_sceneWaiting = false; _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); _vm->_newSceneNum = 39; - _vm->_gnapActionStatus = kAS38ExitCave; + _vm->_gnap->_actionStatus = kAS38ExitCave; } else { - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } } else { gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); @@ -1350,7 +1350,7 @@ void Scene38::updateAnimations() { _vm->_gnapSequenceId = 0x9F; _vm->_gnapSequenceDatNum = 0; gameSys.setAnimation(0x9F, _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS38HoldingHuntingTrophy; + _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; if (_vm->_plat->_idleFacing != kDirNone) _vm->playPlatypusSequence(0x107D5); else @@ -1361,7 +1361,7 @@ void Scene38::updateAnimations() { _vm->_platypusSequenceDatNum = 0; _vm->_platypusId = _vm->_gnapId + 1; gameSys.setAnimation(0xA1, _vm->_gnapId + 1, 1); - _vm->_platypusActionStatus = kAS38PlatypusHoldingTrapDoor; + _vm->_plat->_actionStatus = kAS38PlatypusHoldingTrapDoor; updateHotspots(); break; } @@ -1369,7 +1369,7 @@ void Scene38::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - if (_vm->_platypusActionStatus == kAS38PlatypusHoldingTrapDoor) { + if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { gameSys.insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xA2; _vm->_platypusSequenceDatNum = 0; @@ -1451,7 +1451,7 @@ void Scene39::run() { break; case kHS39Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -1475,17 +1475,17 @@ void Scene39::run() { break; case kHS39ExitUfoParty: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_sceneDone = true; _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS39LeaveScene; + _vm->_gnap->_actionStatus = kAS39LeaveScene; _vm->_newSceneNum = 40; } break; case kHS39Sign: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -1506,7 +1506,7 @@ void Scene39::run() { break; case kHS39ExitInsideHouse: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_sceneDone = true; _vm->_isLeavingScene = true; _vm->_newSceneNum = 38; @@ -1515,12 +1515,12 @@ void Scene39::run() { case kHS39WalkArea1: case kHS39WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->gnapWalkTo(-1, -1, -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -1530,9 +1530,9 @@ void Scene39::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) + if (_vm->_plat->_actionStatus < 0) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->updateGnapIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 50; @@ -1571,10 +1571,10 @@ void Scene39::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus == kAS39LeaveScene) + if (_vm->_gnap->_actionStatus == kAS39LeaveScene) _vm->_sceneDone = true; else - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 861283af34..7ecaf23dd2 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -74,7 +74,7 @@ void Scene40::run() { break; case kHS40Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -98,56 +98,56 @@ void Scene40::run() { break; case kHS40ExitCave: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_newSceneNum = 39; _vm->_sceneDone = true; } break; case kHS40ExitToyStand: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_newSceneNum = 41; _vm->_sceneDone = true; } break; case kHS40ExitBBQ: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_newSceneNum = 42; _vm->_sceneDone = true; } break; case kHS40ExitUfo: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_newSceneNum = 43; _vm->_sceneDone = true; } break; case kHS40ExitKissinBooth: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_newSceneNum = 44; _vm->_sceneDone = true; } break; case kHS40ExitDancefloor: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_newSceneNum = 45; _vm->_sceneDone = true; } break; case kHS40ExitShoe: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_newSceneNum = 46; _vm->_sceneDone = true; } break; default: - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) _vm->_mouseClickState._left = false; break; @@ -171,8 +171,8 @@ void Scene40::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnapActionStatus) - _vm->_gnapActionStatus = -1; + if (_vm->_gnap->_actionStatus) + _vm->_gnap->_actionStatus = -1; else _vm->_sceneDone = true; } @@ -228,7 +228,7 @@ void Scene41::run() { if (_vm->_toyUfoY < 0 || _vm->_toyUfoY > 300) _vm->_toyUfoY = 150; if (!_vm->_timers[9]) - _vm->_gnapActionStatus = kAS41GiveBackToyUfo; + _vm->_gnap->_actionStatus = kAS41GiveBackToyUfo; } else { if (!_vm->isFlag(kGFUnk16) && !_vm->isFlag(kGFJointTaken) && !_vm->isFlag(kGFUnk18) && !_vm->isFlag(kGFGroceryStoreHatTaken)) _vm->toyUfoSetStatus(kGFUnk16); @@ -349,7 +349,7 @@ void Scene41::run() { break; case kHS41Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -375,14 +375,14 @@ void Scene41::run() { case kHS41ExitCave: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitCave].x, _vm->_hotspotsWalkPos[kHS41ExitCave].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS41LeaveScene; + _vm->_gnap->_actionStatus = kAS41LeaveScene; _vm->_newSceneNum = 40; break; case kHS41Exit: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS41LeaveScene; + _vm->_gnap->_actionStatus = kAS41LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, -1, 0x107CF, 1); _vm->_newSceneNum = 45; break; @@ -390,14 +390,14 @@ void Scene41::run() { case kHS41ExitBBQ: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS41LeaveScene; + _vm->_gnap->_actionStatus = kAS41LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, -1, 0x107CD, 1); _vm->_newSceneNum = 42; break; case kHS41ToyVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnapActionStatus = kAS41UseQuarterWithToyVendor; + _vm->_gnap->_actionStatus = kAS41UseQuarterWithToyVendor; _vm->gnapWalkTo(4, 7, 0, 0x107BB, 9); _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -413,7 +413,7 @@ void Scene41::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS41TalkToyVendor; + _vm->_gnap->_actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -426,7 +426,7 @@ void Scene41::run() { if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS41UseChickenBucketWithKid; + _vm->_gnap->_actionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(7, 7, 8, 0); } else { @@ -437,7 +437,7 @@ void Scene41::run() { case GRAB_CURSOR: _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapActionStatus = kAS41GrabKid; + _vm->_gnap->_actionStatus = kAS41GrabKid; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -454,20 +454,20 @@ void Scene41::run() { if (_vm->_grabCursorSpriteIndex == kItemGum) { _vm->playGnapPullOutDevice(9, 0); gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - _vm->_gnapActionStatus = kAS41UseGumWithToyUfo; + _vm->_gnap->_actionStatus = kAS41UseGumWithToyUfo; } break; case kHS41WalkArea1: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } if (_vm->isFlag(kGFGnapControlsToyUFO)) { - if (!_vm->_timers[9] && _vm->_gnapActionStatus < 0) { - _vm->_gnapActionStatus = kAS41GiveBackToyUfo; + if (!_vm->_timers[9] && _vm->_gnap->_actionStatus < 0) { + _vm->_gnap->_actionStatus = kAS41GiveBackToyUfo; if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x122) { gameSys.insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x123; @@ -477,7 +477,7 @@ void Scene41::run() { } } - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { int sequenceId; @@ -510,13 +510,13 @@ void Scene41::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0) + if (_vm->_plat->_actionStatus < 0) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { switch (_vm->getRandom(3)) { case 0: _nextToyVendorSequenceId = 0x113; @@ -534,7 +534,7 @@ void Scene41::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { if (_vm->isFlag(kGFGnapControlsToyUFO)) _nextKidSequenceId = 0x11B; else if (_vm->getRandom(3) != 0) @@ -562,26 +562,26 @@ void Scene41::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS41LeaveScene: gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS41UseQuarterWithToyVendor: gameSys.setAnimation(0, 0, 0); _nextToyVendorSequenceId = 0x114; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS41TalkToyVendor: gameSys.setAnimation(0, 0, 0); _nextToyVendorSequenceId = 0x116; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; case kAS41UseGumWithToyUfo: gameSys.setAnimation(0, 0, 0); _vm->playGnapUseDevice(9, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemGum); _vm->_toyUfoActionStatus = kAS41UfoGumAttached; @@ -601,7 +601,7 @@ void Scene41::updateAnimations() { _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = 0x11B; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->setFlag(kGFGnapControlsToyUFO); updateHotspots(); _vm->_timers[9] = 600; @@ -627,7 +627,7 @@ void Scene41::updateAnimations() { _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } break; case kAS41GiveBackToyUfo: @@ -652,7 +652,7 @@ void Scene41::updateAnimations() { _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->clearFlag(kGFGnapControlsToyUFO); updateHotspots(); } @@ -861,7 +861,7 @@ void Scene42::run() { break; case kHS42Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -887,7 +887,7 @@ void Scene42::run() { case kHS42ExitUfoParty: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = kAS42LeaveScene; + _vm->_gnap->_actionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; @@ -895,7 +895,7 @@ void Scene42::run() { case kHS42ExitToyStand: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = kAS42LeaveScene; + _vm->_gnap->_actionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_hotspotsWalkPos[kHS42ExitToyStand].y, -1, 0x107CF, 1); _vm->_newSceneNum = 41; break; @@ -903,7 +903,7 @@ void Scene42::run() { case kHS42ExitUfo: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = kAS42LeaveScene; + _vm->_gnap->_actionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_hotspotsWalkPos[kHS42ExitUfo].y, -1, 0x107CD, 1); _vm->_newSceneNum = 43; break; @@ -911,7 +911,7 @@ void Scene42::run() { case kHS42BBQVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, 0x107BB, 1); - _vm->_gnapActionStatus = kAS42UseQuarterWithBBQVendor; + _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendor; if (_vm->_plat->_pos.y < 9) _vm->platypusWalkTo(_vm->_plat->_pos.x, 9, -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -924,7 +924,7 @@ void Scene42::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = kAS42TalkBBQVendor; + _vm->_gnap->_actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -944,7 +944,7 @@ void Scene42::run() { break; case GRAB_CURSOR: _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, 0, 0x107BC, 1); - _vm->_gnapActionStatus = kAS42GrabChickenLeg; + _vm->_gnap->_actionStatus = kAS42GrabChickenLeg; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -956,14 +956,14 @@ void Scene42::run() { case kHS42WalkArea1: case kHS42WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = kAS42ToyUfoRefresh; @@ -978,13 +978,13 @@ void Scene42::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextBBQVendorSequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextBBQVendorSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: _nextBBQVendorSequenceId = 0x14C; @@ -1026,22 +1026,22 @@ void Scene42::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case kAS42LeaveScene: gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _vm->_sceneDone = true; break; case kAS42TalkBBQVendor: gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; _nextBBQVendorSequenceId = 0x14B; break; case kAS42UseQuarterWithBBQVendor: case kAS42GrabChickenLeg: if (gameSys.getAnimationStatus(2) == 2) { int sequenceId; - if (_vm->_gnapActionStatus == kAS42UseQuarterWithBBQVendor) { + if (_vm->_gnap->_actionStatus == kAS42UseQuarterWithBBQVendor) { _vm->invRemove(kItemDiceQuarterHole); _vm->invAdd(kItemChickenBucket); _vm->setGrabCursorSprite(-1); @@ -1075,10 +1075,10 @@ void Scene42::updateAnimations() { } _vm->_gnapSequenceId = sequenceId; gameSys.setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); - if (_vm->_gnapActionStatus == kAS42UseQuarterWithBBQVendor) - _vm->_gnapActionStatus = kAS42UseQuarterWithBBQVendorDone; + if (_vm->_gnap->_actionStatus == kAS42UseQuarterWithBBQVendor) + _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendorDone; else - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); _currBBQVendorSequenceId = _nextBBQVendorSequenceId; @@ -1094,11 +1094,11 @@ void Scene42::updateAnimations() { case kAS42UseQuarterWithBBQVendorDone: gameSys.setAnimation(0, 0, 0); _vm->setGrabCursorSprite(kItemChickenBucket); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; default: gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -1319,7 +1319,7 @@ void Scene43::run() { break; case kHS43Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -1345,7 +1345,7 @@ void Scene43::run() { case kHS43ExitUfoParty: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS43ExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS43ExitUfoParty].y, -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; @@ -1353,7 +1353,7 @@ void Scene43::run() { case kHS43ExitBBQ: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_hotspotsWalkPos[kHS43ExitBBQ].y, -1, 0x107CF, 1); _vm->_newSceneNum = 42; break; @@ -1361,7 +1361,7 @@ void Scene43::run() { case kHS43ExitKissinBooth: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_hotspotsWalkPos[kHS43ExitKissinBooth].y, -1, 0x107CD, 1); _vm->_newSceneNum = 44; break; @@ -1377,7 +1377,7 @@ void Scene43::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 2; + _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -1399,7 +1399,7 @@ void Scene43::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(3, 7, 0, 67515, 1); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -1411,13 +1411,13 @@ void Scene43::run() { case kHS43WalkArea1: case kHS43WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO) && (_vm->_toyUfoActionStatus == 5 || _vm->_toyUfoActionStatus == -1)) { _vm->_toyUfoActionStatus = 5; @@ -1432,13 +1432,13 @@ void Scene43::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { switch (_vm->getRandom(5)) { case 0: _nextTwoHeadedGuySequenceId = 0x13C; @@ -1482,7 +1482,7 @@ void Scene43::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case 0: gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; @@ -1502,13 +1502,13 @@ void Scene43::updateAnimations() { _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; _nextTwoHeadedGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } break; default: gameSys.setAnimation(0, 0, 0); - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -1560,7 +1560,7 @@ void Scene43::updateAnimations() { gameSys.setAnimation(0x10874, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = 8; _vm->setFlag(kGFJointTaken); - _vm->_gnapActionStatus = 3; + _vm->_gnap->_actionStatus = 3; break; case 8: _nextTwoHeadedGuySequenceId = 0x13A; @@ -1767,7 +1767,7 @@ void Scene44::run() { break; case kHS44Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -1793,14 +1793,14 @@ void Scene44::run() { case kHS44ExitUfoParty: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS44ExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS44ExitUfo: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; @@ -1808,13 +1808,13 @@ void Scene44::run() { case kHS44ExitShow: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitShow].x, _vm->_hotspotsWalkPos[kHS44ExitShow].y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 46; break; case kHS44KissingLady: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnapActionStatus = 2; + _vm->_gnap->_actionStatus = 2; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, -1, 9); _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); } else { @@ -1828,7 +1828,7 @@ void Scene44::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; break; case PLAT_CURSOR: _vm->gnapUseDeviceOnPlatypus(); @@ -1836,7 +1836,7 @@ void Scene44::run() { if (_vm->_gnap->_pos == Common::Point(7, 7)) _vm->gnapWalkStep(); _vm->playGnapIdle(5, 7); - _vm->_platypusActionStatus = 4; + _vm->_plat->_actionStatus = 4; break; } } @@ -1893,14 +1893,14 @@ void Scene44::run() { case kHS44WalkArea1: case kHS44WalkArea2: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 7; @@ -1914,13 +1914,13 @@ void Scene44::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) + if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextKissingLadySequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextKissingLadySequenceId == -1) { switch (_vm->getRandom(20)) { case 0: _nextKissingLadySequenceId = 0xED; @@ -1947,7 +1947,7 @@ void Scene44::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSpringGuySequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSpringGuySequenceId == -1) { if (_vm->getRandom(5) != 0) { if (!_vm->isFlag(kGFSpringTaken)) _nextSpringGuySequenceId = 0xF9; @@ -1979,7 +1979,7 @@ void Scene44::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -1990,12 +1990,12 @@ void Scene44::updateAnimations() { _nextKissingLadySequenceId = 0xF2; break; } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_platypusActionStatus) { + switch (_vm->_plat->_actionStatus) { case 4: if (gameSys.getAnimationStatus(2) == 2) { gameSys.insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); @@ -2003,7 +2003,7 @@ void Scene44::updateAnimations() { _vm->_platypusSequenceDatNum = 0; gameSys.setAnimation(0xFE, _vm->_platypusId, 1); gameSys.removeSequence(_currKissingLadySequenceId, 1, true); - _vm->_platypusActionStatus = 5; + _vm->_plat->_actionStatus = 5; } break; case 5: @@ -2011,7 +2011,7 @@ void Scene44::updateAnimations() { _vm->_newSceneNum = 50; break; default: - _vm->_platypusActionStatus = -1; + _vm->_plat->_actionStatus = -1; break; } } @@ -2145,7 +2145,7 @@ void Scene45::run() { _vm->_gnapSequenceDatNum = 0; _vm->_gnapId = 1; gameSys.setAnimation(0x9E, 1, 0); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; gameSys.insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->initPlatypusPos(4, 8, kDirNone); _vm->endSceneInit(); @@ -2256,7 +2256,7 @@ void Scene45::run() { break; case kHS45Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -2282,29 +2282,29 @@ void Scene45::run() { break; case kHS45ExitUfoParty: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; } break; case kHS45ExitShoe: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 46; } break; case kHS45ExitRight: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); _vm->_newSceneNum = 41; } @@ -2318,10 +2318,10 @@ void Scene45::run() { break; case kHS45DiscoBall: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemSpring) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall].x, _vm->_hotspotsWalkPos[kHS45DiscoBall].y, 0, 0x9F, 5); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemSpring); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2342,13 +2342,13 @@ void Scene45::run() { break; case kHS45WalkArea1: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 3; @@ -2361,7 +2361,7 @@ void Scene45::run() { updateAnimations(); _vm->toyUfoCheckTimer(); - if (!_vm->_isLeavingScene && _vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); _vm->checkGameKeys(); @@ -2383,7 +2383,7 @@ void Scene45::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -2397,7 +2397,7 @@ void Scene45::updateAnimations() { gameSys.setAnimation(0x9E, _vm->_gnapId, 0); break; default: - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; break; } } @@ -2581,7 +2581,7 @@ void Scene46::run() { break; case kHS46Platypus: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -2615,7 +2615,7 @@ void Scene46::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 2; + _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -2636,7 +2636,7 @@ void Scene46::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -2649,14 +2649,14 @@ void Scene46::run() { case kHS46ExitUfoParty: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y, 0, 0x107AE, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS46ExitKissinBooth: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 44; break; @@ -2664,19 +2664,19 @@ void Scene46::run() { case kHS46ExitDisco: _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); _vm->_newSceneNum = 45; break; case kHS46WalkArea1: - if (_vm->_gnapActionStatus < 0) + if (_vm->_gnap->_actionStatus < 0) _vm->gnapWalkTo(-1, -1, -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnapActionStatus < 0) { + if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 4; @@ -2690,13 +2690,13 @@ void Scene46::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updatePlatypusIdleSequence(); - if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextItchyGuySequenceId == -1) { + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextItchyGuySequenceId == -1) { if (_vm->getRandom(2) != 0) _nextItchyGuySequenceId = 0x49; else @@ -2705,7 +2705,7 @@ void Scene46::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSackGuySequenceId == -1) + if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSackGuySequenceId == -1) _nextSackGuySequenceId = 0x4C; } } @@ -2727,7 +2727,7 @@ void Scene46::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnapActionStatus) { + switch (_vm->_gnap->_actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -2738,7 +2738,7 @@ void Scene46::updateAnimations() { _nextSackGuySequenceId = 0x4A; break; } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 3ae20034fd..8cf5087ff6 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -86,13 +86,13 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { _currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; } - _vm->_gnapActionStatus = 6; + _vm->_gnap->_actionStatus = 6; while (gameSys.getAnimationStatus(6) != 2) { // checkGameAppStatus(); _vm->updateMouseCursor(); _vm->gameUpdateTick(); } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; if (buttonNum < 11) phoneNumber = buttonNum % 10 + 10 * phoneNumber; @@ -137,13 +137,13 @@ void Scene53::runRandomCall() { _callsMadeCtr = 0; } - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } void Scene53::runChitChatLine() { @@ -154,13 +154,13 @@ void Scene53::runChitChatLine() { gameSys.setAnimation(0x6E, 1, 6); gameSys.insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -198,7 +198,7 @@ void Scene53::runChitChatLine() { flag = 1; _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 17; break; case 5: @@ -217,31 +217,31 @@ void Scene53::runChitChatLine() { if (flag && sequenceId != -1) { _vm->stopSound(0xA0); pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; gameSys.setAnimation(sequenceId, 1, 6); gameSys.insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; gameSys.setAnimation(0x72, 1, 6); gameSys.insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } } updateHotspots(); - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); @@ -252,7 +252,7 @@ void Scene53::runChitChatLine() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } } @@ -287,7 +287,7 @@ void Scene53::run() { switch (_vm->_sceneClickedHotspot) { case 1: - if (_vm->_gnapActionStatus < 0) { + if (_vm->_gnap->_actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -307,7 +307,7 @@ void Scene53::run() { phoneNumber = pressPhoneNumberButton(phoneNumber, _vm->_sceneClickedHotspot - 1); debugC(kDebugBasic, "phoneNumber: %d", phoneNumber); if (phoneNumberLen == 7) { - _vm->_gnapActionStatus = 1; + _vm->_gnap->_actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -317,7 +317,7 @@ void Scene53::run() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } if (phoneNumber == 7284141) { runChitChatLine(); @@ -348,8 +348,8 @@ void Scene53::run() { pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); break; case 14: - if (_vm->_gnapActionStatus < 0) { - _vm->_gnapActionStatus = 1; + if (_vm->_gnap->_actionStatus < 0) { + _vm->_gnap->_actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -359,11 +359,11 @@ void Scene53::run() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnapActionStatus = -1; + _vm->_gnap->_actionStatus = -1; } _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnapActionStatus = 0; + _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 17; } break; -- cgit v1.2.3 From 579ecdabd19f0a5f6837224eafebf6a8ac74c0ad Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 May 2016 10:12:15 +0200 Subject: GNAP: More refactoring related to characters (WIP) --- engines/gnap/character.cpp | 460 ++++++++++++++++++++++++++++++- engines/gnap/character.h | 14 + engines/gnap/gnap.cpp | 610 ++++++----------------------------------- engines/gnap/gnap.h | 10 - engines/gnap/grid.cpp | 94 +++---- engines/gnap/scenes/arcade.cpp | 9 +- engines/gnap/scenes/group0.cpp | 432 ++++++++++++++--------------- engines/gnap/scenes/group1.cpp | 456 +++++++++++++++--------------- engines/gnap/scenes/group2.cpp | 170 ++++++------ engines/gnap/scenes/group3.cpp | 146 +++++----- engines/gnap/scenes/group4.cpp | 182 ++++++------ 11 files changed, 1297 insertions(+), 1286 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 84274877d9..8b6ea803c0 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -22,6 +22,7 @@ #include "gnap/gnap.h" #include "gnap/character.h" +#include "gnap/gamesys.h" namespace Gnap { @@ -29,12 +30,469 @@ Character::Character(GnapEngine *vm) : _vm(vm) { _pos = Common::Point(0, 0); _idleFacing = kDirNone; _actionStatus = 0; + _sequenceId = 0; + _sequenceDatNum = 0; + _id = 0; } Character::~Character() {} -PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) {} +PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) { + _gnapBrainPulseNum = 0; + _gnapBrainPulseRndValue = 0; +} + +int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { + int sequenceId = 0; + + switch (kind) { + case gskPullOutDevice: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x83F; + _idleFacing = kDirUpLeft; + } else { + sequenceId = 0x83D; + _idleFacing = kDirUpRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x83B; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x839; + _idleFacing = kDirBottomRight; + } + } + } else { + switch (_idleFacing) { + case kDirBottomRight: + sequenceId = 0x839; + break; + case kDirBottomLeft: + sequenceId = 0x83B; + break; + case kDirUpRight: + sequenceId = 0x83D; + break; + default: + sequenceId = 0x83F; + break; + } + } + break; + + case gskPullOutDeviceNonWorking: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x829; + _idleFacing = kDirUpLeft; + } else { + sequenceId = 0x828; + _idleFacing = kDirUpRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x827; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x826; + _idleFacing = kDirBottomRight; + } + } + } else { + switch (_idleFacing) { + case kDirBottomRight: + sequenceId = 0x826; + break; + case kDirBottomLeft: + sequenceId = 0x827; + break; + case kDirUpRight: + sequenceId = 0x828; + break; + default: + sequenceId = 0x829; + break; + } + } + break; + + case gskScratchingHead: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x834; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x885; + _idleFacing = kDirUpRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x834; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x833; + _idleFacing = kDirBottomRight; + } + } + } else { + switch (_idleFacing) { + case kDirBottomRight: + sequenceId = 0x833; + _idleFacing = kDirBottomRight; + break; + case kDirBottomLeft: + sequenceId = 0x834; + _idleFacing = kDirBottomLeft; + break; + case kDirUpRight: + sequenceId = 0x885; + _idleFacing = kDirUpRight; + break; + default: + sequenceId = 0x834; + _idleFacing = kDirBottomLeft; + break; + } + } + break; + + case gskIdle: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x7BC; + _idleFacing = kDirUpLeft; + } else { + sequenceId = 0x7BB; + _idleFacing = kDirUpRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x7BA; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7B9; + _idleFacing = kDirBottomRight; + } + } + } else { + switch (_idleFacing) { + case kDirBottomRight: + sequenceId = 0x7B9; + break; + case kDirBottomLeft: + sequenceId = 0x7BA; + break; + case kDirUpRight: + sequenceId = 0x7BB; + break; + default: + sequenceId = 0x7BC; + break; + } + } + break; + + case gskBrainPulsating: + _gnapBrainPulseNum = (_gnapBrainPulseNum + 1) & 1; + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; + _idleFacing = kDirUpLeft; + } else { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; + _idleFacing = kDirUpRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; + _idleFacing = kDirBottomRight; + } + } + } else { + switch (_idleFacing) { + case kDirBottomRight: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; + break; + case kDirBottomLeft: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; + break; + case kDirUpRight: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; + break; + default: + sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; + break; + } + } + break; + + case gskImpossible: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x831; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7A8; + _idleFacing = kDirBottomRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x831; + _idleFacing = kDirBottomLeft; + } else { + if (_pos.x % 2) + sequenceId = 0x7A8; + else + sequenceId = 0x89A; + _idleFacing = kDirBottomRight; + } + } + } else if (_idleFacing != kDirBottomRight && _idleFacing != kDirUpRight) { + sequenceId = 0x831; + _idleFacing = kDirBottomLeft; + } else { + if (_vm->_currentSceneNum % 2) + sequenceId = 0x7A8; + else + sequenceId = 0x89A; + _idleFacing = kDirBottomRight; + } + break; + + case gskDeflect: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x830; + _idleFacing = kDirUpLeft; + } else { + sequenceId = 0x82F; + _idleFacing = kDirUpRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x82E; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7A7; + _idleFacing = kDirBottomRight; + } + } + } else { + switch (_idleFacing) { + case kDirBottomRight: + sequenceId = 0x7A7; + break; + case kDirBottomLeft: + sequenceId = 0x82E; + break; + case kDirUpLeft: + sequenceId = 0x830; + break; + case kDirUpRight: + sequenceId = 0x82F; + break; + case kDirNone: + case kDirUnk4: + break; + } + } + break; + + case gskUseDevice: + switch (_idleFacing) { + case kDirBottomRight: + sequenceId = 0x83A; + break; + case kDirBottomLeft: + sequenceId = 0x83C; + break; + case kDirUpLeft: + sequenceId = 0x840; + break; + case kDirUpRight: + sequenceId = 0x83E; + break; + case kDirNone: + case kDirUnk4: + break; + } + break; + + case gskMoan1: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x832; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7AA; + _idleFacing = kDirBottomRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x832; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7AA; + _idleFacing = kDirBottomRight; + } + } + } else if (_idleFacing != kDirBottomRight && _idleFacing != kDirUpRight) { + sequenceId = 0x832; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7AA; + _idleFacing = kDirBottomRight; + } + break; + + case gskMoan2: + if (gridX > 0 && gridY > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) { + sequenceId = 0x832; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7AA; + _idleFacing = kDirBottomRight; + } + } else { + if (_pos.x > gridX) { + sequenceId = 0x832; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7AA; + _idleFacing = kDirBottomRight; + } + } + } else if (_idleFacing != kDirBottomRight && _idleFacing != kDirUpRight) { + sequenceId = 0x832; + _idleFacing = kDirBottomLeft; + } else { + sequenceId = 0x7AA; + _idleFacing = kDirBottomRight; + } + break; + } + + return sequenceId | 0x10000; +} + +void PlayerGnap::useJointOnPlatypus() { + _vm->setGrabCursorSprite(-1); + if (_vm->gnapPlatypusAction(1, 0, 0x107C1, 0)) { + _actionStatus = 100; + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0x10876, _vm->_plat->_id, 0); + _vm->_gameSys->insertSequence(0x10875, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncWait, 0, 15 * (5 * _pos.x - 30), 48 * (_pos.y - 7)); + _sequenceDatNum = 1; + _sequenceId = 0x875; + _vm->_gameSys->insertSequence(0x10876, _vm->_plat->_id, + _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, + kSeqSyncWait, 0, 15 * (5 * _vm->_plat->_pos.x - 25), 48 * (_vm->_plat->_pos.y - 7)); + _vm->_plat->_sequenceDatNum = 1; + _vm->_plat->_sequenceId = 0x876; + _vm->_plat->_idleFacing = kDirNone; + _vm->playGnapSequence(0x107B5); + _vm->gnapWalkStep(); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + _vm->updateMouseCursor(); + _vm->gameUpdateTick(); + } + _vm->_gameSys->setAnimation(0, 0, 0); + _actionStatus = -1; + } else { + _vm->playGnapSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + } +} + +void PlayerGnap::kissPlatypus(int callback) { + if (_vm->gnapPlatypusAction(-1, 0, 0x107D1, callback)) { + _actionStatus = 100; + _vm->_gameSys->setAnimation(0, 0, 1); + _vm->_gameSys->setAnimation(0x10847, _id, 0); + _vm->_gameSys->insertSequence(0x10847, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncWait, 0, 15 * (5 * _pos.x - 20) - (21 - _vm->_gridMinX), 48 * (_pos.y - 6) - (146 - _vm->_gridMinY)); + _sequenceDatNum = 1; + _sequenceId = 0x847; + _vm->_gameSys->insertSequence(0x107CB, _vm->_plat->_id, + makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x10847), 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + _vm->_plat->_sequenceDatNum = 1; + _vm->_plat->_sequenceId = 0x7CB; + _vm->_plat->_idleFacing = kDirNone; + _vm->playGnapSequence(0x107B5); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + _vm->updateMouseCursor(); + _vm->doCallback(callback); + _vm->gameUpdateTick(); + } + _vm->_gameSys->setAnimation(0, 0, 0); + _actionStatus = -1; + } else { + _vm->playGnapSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + } +} + +void PlayerGnap::useDeviceOnPlatypus() { + _vm->playGnapSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos.x, _vm->_plat->_pos.y))); + + if (_vm->_plat->_idleFacing != kDirNone) { + _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), _vm->_plat->_id, + makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, + kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + _vm->_plat->_sequenceId = 0x7D5; + _vm->_plat->_sequenceDatNum = 1; + } else { + _vm->_gameSys->insertSequence(makeRid(1, 0x7D4), _vm->_plat->_id, + makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, + kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + _vm->_plat->_sequenceId = 0x7D4; + _vm->_plat->_sequenceDatNum = 1; + } + + int newSequenceId = getSequenceId(gskUseDevice, 0, 0); + _vm->_gameSys->insertSequence(makeRid(1, newSequenceId), _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + _sequenceId = newSequenceId; + _sequenceDatNum = 1; +} + +void PlayerGnap::initBrainPulseRndValue() { + _gnapBrainPulseRndValue = 2 * _vm->getRandom(10); +} + +/************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} +int PlayerPlat::getSequenceId(int kind, int gridX, int gridY) { + // The original had 3 parameters, all always set to 0. + // The code to handle the other values has been removed. + + int sequenceId = 0x7CB; + + if (_idleFacing != kDirNone) { + sequenceId = 0x7CC; + _idleFacing = kDirUnk4; + } + + return sequenceId | 0x10000; +} } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 4f5282435f..1a05548bae 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -41,9 +41,14 @@ public: Character(GnapEngine *vm); ~Character(); + virtual int getSequenceId(int kind, int gridX, int gridY) = 0; + Common::Point _pos; Facing _idleFacing; int _actionStatus; + int _sequenceId; + int _sequenceDatNum; + int _id; protected: GnapEngine *_vm; @@ -52,11 +57,20 @@ protected: class PlayerGnap : public Character { public: PlayerGnap(GnapEngine *vm); + virtual int getSequenceId(int kind, int gridX, int gridY); + + void initBrainPulseRndValue(); + void kissPlatypus(int callback); + void useDeviceOnPlatypus(); + void useJointOnPlatypus(); + + int _gnapBrainPulseNum, _gnapBrainPulseRndValue; }; class PlayerPlat : public Character { public: PlayerPlat(GnapEngine *vm); + virtual int getSequenceId(int kind = 0, int gridX = 0, int gridY = 0); }; } // End of namespace Gnap diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index d02321a8f5..c020d752b6 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -735,7 +735,7 @@ void GnapEngine::initScene() { _newSceneNum = 55; _gnap->_actionStatus = -1; _plat->_actionStatus = -1; - gnapInitBrainPulseRndValue(); + _gnap->initBrainPulseRndValue(); hideCursor(); clearAllKeyStatus1(); _mouseClickState._left = false; @@ -941,354 +941,6 @@ void GnapEngine::deleteSurface(Graphics::Surface **surface) { } } -int GnapEngine::getGnapSequenceId(int kind, int gridX, int gridY) { - int sequenceId = 0; - - switch (kind) { - case gskPullOutDevice: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x83F; - _gnap->_idleFacing = kDirUpLeft; - } else { - sequenceId = 0x83D; - _gnap->_idleFacing = kDirUpRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x83B; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x839; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else { - switch (_gnap->_idleFacing) { - case kDirBottomRight: - sequenceId = 0x839; - break; - case kDirBottomLeft: - sequenceId = 0x83B; - break; - case kDirUpRight: - sequenceId = 0x83D; - break; - default: - sequenceId = 0x83F; - break; - } - } - break; - - case gskPullOutDeviceNonWorking: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x829; - _gnap->_idleFacing = kDirUpLeft; - } else { - sequenceId = 0x828; - _gnap->_idleFacing = kDirUpRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x827; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x826; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else { - switch (_gnap->_idleFacing) { - case kDirBottomRight: - sequenceId = 0x826; - break; - case kDirBottomLeft: - sequenceId = 0x827; - break; - case kDirUpRight: - sequenceId = 0x828; - break; - default: - sequenceId = 0x829; - break; - } - } - break; - - case gskScratchingHead: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x834; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x885; - _gnap->_idleFacing = kDirUpRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x834; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x833; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else { - switch (_gnap->_idleFacing) { - case kDirBottomRight: - sequenceId = 0x833; - _gnap->_idleFacing = kDirBottomRight; - break; - case kDirBottomLeft: - sequenceId = 0x834; - _gnap->_idleFacing = kDirBottomLeft; - break; - case kDirUpRight: - sequenceId = 0x885; - _gnap->_idleFacing = kDirUpRight; - break; - default: - sequenceId = 0x834; - _gnap->_idleFacing = kDirBottomLeft; - break; - } - } - break; - - case gskIdle: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x7BC; - _gnap->_idleFacing = kDirUpLeft; - } else { - sequenceId = 0x7BB; - _gnap->_idleFacing = kDirUpRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x7BA; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7B9; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else { - switch (_gnap->_idleFacing) { - case kDirBottomRight: - sequenceId = 0x7B9; - break; - case kDirBottomLeft: - sequenceId = 0x7BA; - break; - case kDirUpRight: - sequenceId = 0x7BB; - break; - default: - sequenceId = 0x7BC; - break; - } - } - break; - - case gskBrainPulsating: - _gnapBrainPulseNum = (_gnapBrainPulseNum + 1) & 1; - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; - _gnap->_idleFacing = kDirUpLeft; - } else { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; - _gnap->_idleFacing = kDirUpRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else { - switch (_gnap->_idleFacing) { - case kDirBottomRight: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; - break; - case kDirBottomLeft: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; - break; - case kDirUpRight: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; - break; - default: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; - break; - } - } - break; - - case gskImpossible: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x831; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7A8; - _gnap->_idleFacing = kDirBottomRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x831; - _gnap->_idleFacing = kDirBottomLeft; - } else { - if (_gnap->_pos.x % 2) - sequenceId = 0x7A8; - else - sequenceId = 0x89A; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { - sequenceId = 0x831; - _gnap->_idleFacing = kDirBottomLeft; - } else { - if (_currentSceneNum % 2) - sequenceId = 0x7A8; - else - sequenceId = 0x89A; - _gnap->_idleFacing = kDirBottomRight; - } - break; - - case gskDeflect: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x830; - _gnap->_idleFacing = kDirUpLeft; - } else { - sequenceId = 0x82F; - _gnap->_idleFacing = kDirUpRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x82E; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7A7; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else { - switch (_gnap->_idleFacing) { - case kDirBottomRight: - sequenceId = 0x7A7; - break; - case kDirBottomLeft: - sequenceId = 0x82E; - break; - case kDirUpLeft: - sequenceId = 0x830; - break; - case kDirUpRight: - sequenceId = 0x82F; - break; - case kDirNone: - case kDirUnk4: - break; - } - } - break; - - case gskUseDevice: - switch (_gnap->_idleFacing) { - case kDirBottomRight: - sequenceId = 0x83A; - break; - case kDirBottomLeft: - sequenceId = 0x83C; - break; - case kDirUpLeft: - sequenceId = 0x840; - break; - case kDirUpRight: - sequenceId = 0x83E; - break; - case kDirNone: - case kDirUnk4: - break; - } - break; - - case gskMoan1: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x832; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _gnap->_idleFacing = kDirBottomRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x832; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { - sequenceId = 0x832; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _gnap->_idleFacing = kDirBottomRight; - } - break; - - case gskMoan2: - if (gridX > 0 && gridY > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x832; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _gnap->_idleFacing = kDirBottomRight; - } - } else { - if (_gnap->_pos.x > gridX) { - sequenceId = 0x832; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _gnap->_idleFacing = kDirBottomRight; - } - } - } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { - sequenceId = 0x832; - _gnap->_idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _gnap->_idleFacing = kDirBottomRight; - } - break; - } - - return sequenceId | 0x10000; -} - int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { int sequenceId; Facing facing = _gnap->_idleFacing; @@ -1461,36 +1113,36 @@ int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { //Skip 29 default: _gnap->_idleFacing = facing; - sequenceId = getGnapSequenceId(gskImpossible, 0, 0); + sequenceId = _gnap->getSequenceId(gskImpossible, 0, 0); break; } return sequenceId; } void GnapEngine::gnapIdle() { - if (_gnapSequenceId != -1 && _gnapSequenceDatNum == 1 && - (_gnapSequenceId == 0x7A6 || _gnapSequenceId == 0x7AA || - _gnapSequenceId == 0x832 || _gnapSequenceId == 0x841 || - _gnapSequenceId == 0x842 || _gnapSequenceId == 0x8A2 || - _gnapSequenceId == 0x833 || _gnapSequenceId == 0x834 || - _gnapSequenceId == 0x885 || _gnapSequenceId == 0x7A8 || - _gnapSequenceId == 0x831 || _gnapSequenceId == 0x89A)) { - _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + if (_gnap->_sequenceId != -1 && _gnap->_sequenceDatNum == 1 && + (_gnap->_sequenceId == 0x7A6 || _gnap->_sequenceId == 0x7AA || + _gnap->_sequenceId == 0x832 || _gnap->_sequenceId == 0x841 || + _gnap->_sequenceId == 0x842 || _gnap->_sequenceId == 0x8A2 || + _gnap->_sequenceId == 0x833 || _gnap->_sequenceId == 0x834 || + _gnap->_sequenceId == 0x885 || _gnap->_sequenceId == 0x7A8 || + _gnap->_sequenceId == 0x831 || _gnap->_sequenceId == 0x89A)) { + _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); - _gnapSequenceDatNum = 1; + _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0); + _gnap->_sequenceDatNum = 1; } } void GnapEngine::gnapActionIdle(int sequenceId) { - if (_gnapSequenceId != -1 && ridToDatIndex(sequenceId) == _gnapSequenceDatNum && - ridToEntryIndex(sequenceId) == _gnapSequenceId) { - _gameSys->insertSequence(getGnapSequenceId(gskIdle, 0, 0) | 0x10000, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + if (_gnap->_sequenceId != -1 && ridToDatIndex(sequenceId) == _gnap->_sequenceDatNum && + ridToEntryIndex(sequenceId) == _gnap->_sequenceId) { + _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = getGnapSequenceId(gskIdle, 0, 0); - _gnapSequenceDatNum = 1; + _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0); + _gnap->_sequenceDatNum = 1; } } @@ -1498,47 +1150,47 @@ void GnapEngine::playGnapSequence(int sequenceId) { _timers[2] = getRandom(30) + 20; _timers[3] = 300; gnapIdle(); - _gameSys->insertSequence(sequenceId, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->insertSequence(sequenceId, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqScale | kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = ridToEntryIndex(sequenceId); - _gnapSequenceDatNum = ridToDatIndex(sequenceId); + _gnap->_sequenceId = ridToEntryIndex(sequenceId); + _gnap->_sequenceDatNum = ridToDatIndex(sequenceId); } void GnapEngine::playGnapImpossible(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskImpossible, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskImpossible, gridX, gridY) | 0x10000); } void GnapEngine::playGnapScratchingHead(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); } void GnapEngine::playGnapMoan1(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskMoan1, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskMoan1, gridX, gridY) | 0x10000); } void GnapEngine::playGnapMoan2(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskMoan2, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskMoan2, gridX, gridY) | 0x10000); } void GnapEngine::playGnapBrainPulsating(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); } void GnapEngine::playGnapPullOutDevice(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); } void GnapEngine::playGnapPullOutDeviceNonWorking(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); } void GnapEngine::playGnapUseDevice(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskUseDevice, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskUseDevice, gridX, gridY) | 0x10000); } void GnapEngine::playGnapIdle(int gridX, int gridY) { - playGnapSequence(getGnapSequenceId(gskIdle, gridX, gridY) | 0x10000); + playGnapSequence(_gnap->getSequenceId(gskIdle, gridX, gridY) | 0x10000); } void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { @@ -1583,17 +1235,17 @@ void GnapEngine::updateGnapIdleSequence() { } else { _timers[2] = getRandom(30) + 20; if (_gnap->_idleFacing == kDirBottomRight) { - _gameSys->insertSequence(0x107BD, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->insertSequence(0x107BD, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = 0x7BD; - _gnapSequenceDatNum = 1; + _gnap->_sequenceId = 0x7BD; + _gnap->_sequenceDatNum = 1; } else if (_gnap->_idleFacing == kDirBottomLeft) { - _gameSys->insertSequence(0x107BE, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->insertSequence(0x107BE, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = 0x7BE; - _gnapSequenceDatNum = 1; + _gnap->_sequenceId = 0x7BE; + _gnap->_sequenceDatNum = 1; } } } else { @@ -1617,17 +1269,17 @@ void GnapEngine::updateGnapIdleSequence2() { } else { _timers[2] = getRandom(30) + 20; if (_gnap->_idleFacing == kDirBottomRight) { - _gameSys->insertSequence(0x107BD, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->insertSequence(0x107BD, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = 0x7BD; - _gnapSequenceDatNum = 1; + _gnap->_sequenceId = 0x7BD; + _gnap->_sequenceDatNum = 1; } else if (_gnap->_idleFacing == kDirBottomLeft) { - _gameSys->insertSequence(0x107BE, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->insertSequence(0x107BE, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = 0x7BE; - _gnapSequenceDatNum = 1; + _gnap->_sequenceId = 0x7BE; + _gnap->_sequenceDatNum = 1; } } } else { @@ -1659,47 +1311,18 @@ void GnapEngine::initGnapPos(int gridX, int gridY, Facing facing) { else _gnap->_idleFacing = facing; if (_gnap->_idleFacing == kDirBottomLeft) { - _gnapSequenceId = 0x7B8; + _gnap->_sequenceId = 0x7B8; } else { - _gnapSequenceId = 0x7B5; + _gnap->_sequenceId = 0x7B5; _gnap->_idleFacing = kDirBottomRight; } - _gnapId = 20 * _gnap->_pos.y; - _gnapSequenceDatNum = 1; - _gameSys->insertSequence(makeRid(1, _gnapSequenceId), 20 * _gnap->_pos.y, + _gnap->_id = 20 * _gnap->_pos.y; + _gnap->_sequenceDatNum = 1; + _gameSys->insertSequence(makeRid(1, _gnap->_sequenceId), 20 * _gnap->_pos.y, 0, 0, kSeqScale, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); } -void GnapEngine::gnapInitBrainPulseRndValue() { - _gnapBrainPulseRndValue = 2 * getRandom(10); -} - -void GnapEngine::gnapUseDeviceOnPlatypus() { - playGnapSequence(makeRid(1, getGnapSequenceId(gskPullOutDevice, _plat->_pos.x, _plat->_pos.y))); - - if (_plat->_idleFacing != kDirNone) { - _gameSys->insertSequence(makeRid(1, 0x7D5), _platypusId, - makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, - kSeqSyncWait, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); - _platypusSequenceId = 0x7D5; - _platypusSequenceDatNum = 1; - } else { - _gameSys->insertSequence(makeRid(1, 0x7D4), _platypusId, - makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, - kSeqSyncWait, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); - _platypusSequenceId = 0x7D4; - _platypusSequenceDatNum = 1; - } - - int newSequenceId = getGnapSequenceId(gskUseDevice, 0, 0); - _gameSys->insertSequence(makeRid(1, newSequenceId), _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnapSequenceId = newSequenceId; - _gnapSequenceDatNum = 1; -} - void GnapEngine::doCallback(int callback) { switch (callback) { case 8: @@ -1726,7 +1349,7 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in } _gameSys->setAnimation(0, 0, 0); if (_gnap->_pos == Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY)) { - _gameSys->setAnimation(platSequenceId, _platypusId, 1); + _gameSys->setAnimation(platSequenceId, _plat->_id, 1); playPlatypusSequence(platSequenceId); while (_gameSys->getAnimationStatus(1) != 2) { updateMouseCursor(); @@ -1741,67 +1364,8 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in return result; } -void GnapEngine::gnapKissPlatypus(int callback) { - if (gnapPlatypusAction(-1, 0, 0x107D1, callback)) { - _gnap->_actionStatus = 100; - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0x10847, _gnapId, 0); - _gameSys->insertSequence(0x10847, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 20) - (21 - _gridMinX), 48 * (_gnap->_pos.y - 6) - (146 - _gridMinY)); - _gnapSequenceDatNum = 1; - _gnapSequenceId = 0x847; - _gameSys->insertSequence(0x107CB, _platypusId, - makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, - kSeqSyncWait, getSequenceTotalDuration(0x10847), 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); - _platypusSequenceDatNum = 1; - _platypusSequenceId = 0x7CB; - _plat->_idleFacing = kDirNone; - playGnapSequence(0x107B5); - while (_gameSys->getAnimationStatus(0) != 2) { - updateMouseCursor(); - doCallback(callback); - gameUpdateTick(); - } - _gameSys->setAnimation(0, 0, 0); - _gnap->_actionStatus = -1; - } else { - playGnapSequence(getGnapSequenceId(gskScratchingHead, _plat->_pos.x, _plat->_pos.y) | 0x10000); - } -} - -void GnapEngine::gnapUseJointOnPlatypus() { - setGrabCursorSprite(-1); - if (gnapPlatypusAction(1, 0, 0x107C1, 0)) { - _gnap->_actionStatus = 100; - _gameSys->setAnimation(0, 0, 1); - _gameSys->setAnimation(0x10876, _platypusId, 0); - _gameSys->insertSequence(0x10875, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, - kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 30), 48 * (_gnap->_pos.y - 7)); - _gnapSequenceDatNum = 1; - _gnapSequenceId = 0x875; - _gameSys->insertSequence(0x10876, _platypusId, - _platypusSequenceId | (_platypusSequenceDatNum << 16), _platypusId, - kSeqSyncWait, 0, 15 * (5 * _plat->_pos.x - 25), 48 * (_plat->_pos.y - 7)); - _platypusSequenceDatNum = 1; - _platypusSequenceId = 0x876; - _plat->_idleFacing = kDirNone; - playGnapSequence(0x107B5); - gnapWalkStep(); - while (_gameSys->getAnimationStatus(0) != 2) { - updateMouseCursor(); - gameUpdateTick(); - } - _gameSys->setAnimation(0, 0, 0); - _gnap->_actionStatus = -1; - } else { - playGnapSequence(getGnapSequenceId(gskScratchingHead, _plat->_pos.x, _plat->_pos.y) | 0x10000); - } -} - void GnapEngine::gnapUseDisguiseOnPlatypus() { - _gameSys->setAnimation(0x10846, _gnapId, 0); + _gameSys->setAnimation(0x10846, _gnap->_id, 0); playGnapSequence(0x10846); while (_gameSys->getAnimationStatus(0) != 2) gameUpdateTick(); @@ -1811,26 +1375,12 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { setFlag(kGFPlatypusDisguised); } -int GnapEngine::getPlatypusSequenceId() { - // The original had 3 parameters, all always set to 0. - // The code to handle the other values has been removed. - - int sequenceId = 0x7CB; - - if (_plat->_idleFacing != kDirNone) { - sequenceId = 0x7CC; - _plat->_idleFacing = kDirUnk4; - } - - return sequenceId | 0x10000; -} - void GnapEngine::playPlatypusSequence(int sequenceId) { - _gameSys->insertSequence(sequenceId, _platypusId, - makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, + _gameSys->insertSequence(sequenceId, _plat->_id, + makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, kSeqScale | kSeqSyncWait, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); - _platypusSequenceId = ridToEntryIndex(sequenceId); - _platypusSequenceDatNum = ridToDatIndex(sequenceId); + _plat->_sequenceId = ridToEntryIndex(sequenceId); + _plat->_sequenceDatNum = ridToDatIndex(sequenceId); } void GnapEngine::updatePlatypusIdleSequence() { @@ -1840,17 +1390,17 @@ void GnapEngine::updatePlatypusIdleSequence() { _timers[1] = getRandom(20) + 30; int rnd = getRandom(10); if (_plat->_idleFacing != kDirNone) { - if (rnd != 0 || _platypusSequenceId != 0x7CA) { - if (rnd != 1 || _platypusSequenceId != 0x7CA) + if (rnd != 0 || _plat->_sequenceId != 0x7CA) { + if (rnd != 1 || _plat->_sequenceId != 0x7CA) playPlatypusSequence(0x107CA); else playPlatypusSequence(0x10845); } else { playPlatypusSequence(0x107CC); } - } else if (rnd != 0 || _platypusSequenceId != 0x7C9) { - if (rnd != 1 || _platypusSequenceId != 0x7C9) { - if (rnd != 2 || _platypusSequenceId != 0x7C9) + } else if (rnd != 0 || _plat->_sequenceId != 0x7C9) { + if (rnd != 1 || _plat->_sequenceId != 0x7C9) { + if (rnd != 2 || _plat->_sequenceId != 0x7C9) playPlatypusSequence(0x107C9); else playPlatypusSequence(0x108A4); @@ -1877,12 +1427,12 @@ void GnapEngine::updatePlatypusIdleSequence2() { if (!_timers[1]) { _timers[1] = getRandom(20) + 30; if (_plat->_idleFacing != kDirNone) { - if (getRandom(10) >= 2 || _platypusSequenceId != 0x7CA) + if (getRandom(10) >= 2 || _plat->_sequenceId != 0x7CA) playPlatypusSequence(0x107CA); else playPlatypusSequence(0x107CC); } else { - if (getRandom(10) >= 2 || _platypusSequenceId != 0x7C9) { + if (getRandom(10) >= 2 || _plat->_sequenceId != 0x7C9) { playPlatypusSequence(0x107C9); } else { playPlatypusSequence(0x107CB); @@ -1908,14 +1458,14 @@ void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { else _plat->_idleFacing = facing; if (_plat->_idleFacing == kDirUnk4) { - _platypusSequenceId = 0x7D1; + _plat->_sequenceId = 0x7D1; } else { - _platypusSequenceId = 0x7C1; + _plat->_sequenceId = 0x7C1; _plat->_idleFacing = kDirNone; } - _platypusId = 20 * _plat->_pos.y; - _platypusSequenceDatNum = 1; - _gameSys->insertSequence(makeRid(1, _platypusSequenceId), 20 * _plat->_pos.y, + _plat->_id = 20 * _plat->_pos.y; + _plat->_sequenceDatNum = 1; + _gameSys->insertSequence(makeRid(1, _plat->_sequenceId), 20 * _plat->_pos.y, 0, 0, kSeqScale, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); } @@ -1935,12 +1485,12 @@ void GnapEngine::initGlobalSceneVars() { void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3) { setGrabCursorSprite(-1); - _gameSys->setAnimation(sequenceId2, _gnapId, 0); - _gameSys->insertSequence(sequenceId2, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->setAnimation(sequenceId2, _gnap->_id, 0); + _gameSys->insertSequence(sequenceId2, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 25), 48 * (_gnap->_pos.y - 8)); - _gnapSequenceId = sequenceId2; - _gnapSequenceDatNum = 0; + _gnap->_sequenceId = sequenceId2; + _gnap->_sequenceDatNum = 0; while (_gameSys->getAnimationStatus(0) != 2) gameUpdateTick(); hideCursor(); @@ -1949,13 +1499,13 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ _gameSys->insertSequence(sequenceId1, 256, 0, 0, kSeqNone, 0, 0, 0); while (_gameSys->getAnimationStatus(0) != 2) gameUpdateTick(); - _gameSys->setAnimation(sequenceId3, _gnapId, 0); - _gameSys->insertSequence(sequenceId3, _gnapId, - makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->setAnimation(sequenceId3, _gnap->_id, 0); + _gameSys->insertSequence(sequenceId3, _gnap->_id, + makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 25), 48 * (_gnap->_pos.y - 8)); removeFullScreenSprite(); showCursor(); - _gnapSequenceId = sequenceId3; + _gnap->_sequenceId = sequenceId3; } void GnapEngine::toyUfoSetStatus(int flagNum) { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index ccaf11f961..4474a2d564 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -516,10 +516,6 @@ public: void platypusMakeRoom(); // Gnap - int _gnapBrainPulseNum, _gnapBrainPulseRndValue; - int _gnapSequenceId, _gnapSequenceDatNum, _gnapId; - - int getGnapSequenceId(int kind, int gridX, int gridY); int getGnapShowSequenceId(int index, int gridX, int gridY); void gnapIdle(); void gnapActionIdle(int sequenceId); @@ -538,17 +534,11 @@ public: void updateGnapIdleSequence(); void updateGnapIdleSequence2(); void initGnapPos(int gridX, int gridY, Facing facing); - void gnapInitBrainPulseRndValue(); - void gnapUseDeviceOnPlatypus(); void doCallback(int callback); bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); - void gnapKissPlatypus(int callback); - void gnapUseJointOnPlatypus(); void gnapUseDisguiseOnPlatypus(); // Platypus - int _platypusSequenceId, _platypusSequenceDatNum, _platypusId; - int getPlatypusSequenceId(); void playPlatypusSequence(int sequenceId); void updatePlatypusIdleSequence(); void updatePlatypusIdleSequence2(); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 31b7934f42..ec0595f0a6 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -575,9 +575,9 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen gnapIdle(); - int gnapSequenceId = _gnapSequenceId; - int gnapId = _gnapId; - int gnapSequenceDatNum = _gnapSequenceDatNum; + int gnapSequenceId = _gnap->_sequenceId; + int gnapId = _gnap->_id; + int gnapSequenceDatNum = _gnap->_sequenceDatNum; debugC(kDebugBasic, "_gnapWalkNodesCount: %d", _gnapWalkNodesCount); @@ -629,24 +629,24 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen if (flags & 8) { if (_gnapWalkNodesCount > 0) { - _gnapSequenceId = gnapSequenceId; - _gnapId = gnapId; + _gnap->_sequenceId = gnapSequenceId; + _gnap->_id = gnapId; _gnap->_idleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); - _gnapSequenceDatNum = datNum; + _gnap->_sequenceDatNum = datNum; if (animationIndex >= 0) - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); + _gameSys->setAnimation(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, animationIndex); } else if (animationIndex >= 0) { _gameSys->setAnimation(0x107D3, 1, animationIndex); _gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); } } else { if (sequenceId >= 0 && sequenceId != -1) { - _gnapSequenceId = ridToEntryIndex(sequenceId); - _gnapSequenceDatNum = ridToDatIndex(sequenceId); - if (_gnapSequenceId == 0x7B9) { + _gnap->_sequenceId = ridToEntryIndex(sequenceId); + _gnap->_sequenceDatNum = ridToDatIndex(sequenceId); + if (_gnap->_sequenceId == 0x7B9) { _gnap->_idleFacing = kDirBottomRight; } else { - switch (_gnapSequenceId) { + switch (_gnap->_sequenceId) { case 0x7BA: _gnap->_idleFacing = kDirBottomLeft; break; @@ -660,21 +660,21 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } } else { if (_gnapWalkNodesCount > 0) { - _gnapSequenceId = getGnapWalkStopSequenceId(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); + _gnap->_sequenceId = getGnapWalkStopSequenceId(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); _gnap->_idleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); } else if (gridX >= 0 || gridY >= 0) { switch (_gnap->_idleFacing) { case kDirBottomRight: - _gnapSequenceId = 0x7B9; + _gnap->_sequenceId = 0x7B9; break; case kDirBottomLeft: - _gnapSequenceId = 0x7BA; + _gnap->_sequenceId = 0x7BA; break; case kDirUpRight: - _gnapSequenceId = 0x7BB; + _gnap->_sequenceId = 0x7BB; break; default: - _gnapSequenceId = 0x7BC; + _gnap->_sequenceId = 0x7BC; break; } } else { @@ -685,25 +685,25 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen ++v10; if (_leftClickMouseY == _gridMinY + 48 * _gnap->_pos.y) v11 = 1; - _gnapSequenceId = getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); + _gnap->_sequenceId = getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); _gnap->_idleFacing = getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11)); } - _gnapSequenceDatNum = datNum; + _gnap->_sequenceDatNum = datNum; } if (animationIndex < 0) { - _gnapId = 20 * _gnapWalkDestY + 1; + _gnap->_id = 20 * _gnapWalkDestY + 1; } else { - _gnapId = _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY; - _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY, animationIndex); + _gnap->_id = _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY; + _gameSys->setAnimation(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY, animationIndex); } if (flags & 4) { - _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->insertSequence(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, kSeqScale | kSeqSyncWait, 0, 0, 0); } else { - _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, + _gameSys->insertSequence(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkDestX - _gnapGridX, 48 * _gnapWalkDestY - _gnapGridY); } @@ -1229,9 +1229,9 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (!done) gridSub423750(_plat->_pos.x, _plat->_pos.y); - int platSequenceId = _platypusSequenceId; - int platId = _platypusId; - int platSequenceDatNum = _platypusSequenceDatNum; + int platSequenceId = _plat->_sequenceId; + int platId = _plat->_id; + int platSequenceDatNum = _plat->_sequenceDatNum; for (int index = 0; index < _platWalkNodesCount; ++index) { _platWalkNodes[index]._id = index + 20 * _platWalkNodes[index]._gridY1; @@ -1281,9 +1281,9 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (flags & 8) { if (_platWalkNodesCount > 0) { - _platypusSequenceId = platSequenceId; - _platypusId = platId; - _platypusSequenceDatNum = datNum; + _plat->_sequenceId = platSequenceId; + _plat->_id = platId; + _plat->_sequenceDatNum = datNum; // CHECKME Not sure if this is correct... if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) _plat->_idleFacing = kDirNone; @@ -1294,59 +1294,59 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se else _plat->_idleFacing = kDirNone; if (animationIndex >= 0) - _gameSys->setAnimation(makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, animationIndex); + _gameSys->setAnimation(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, animationIndex); } else if (animationIndex >= 0) { _gameSys->setAnimation(0x107D3, 1, animationIndex); _gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); } } else { if (sequenceId >= 0 && sequenceId != -1) { - _platypusSequenceId = ridToEntryIndex(sequenceId); - _platypusSequenceDatNum = ridToDatIndex(sequenceId); - if (_platypusSequenceId == 0x7C2) { + _plat->_sequenceId = ridToEntryIndex(sequenceId); + _plat->_sequenceDatNum = ridToDatIndex(sequenceId); + if (_plat->_sequenceId == 0x7C2) { _plat->_idleFacing = kDirNone; - } else if (_platypusSequenceId == 0x7D2) { + } else if (_plat->_sequenceId == 0x7D2) { _plat->_idleFacing = kDirUnk4; } } else { if (_platWalkNodesCount > 0) { if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) { - _platypusSequenceId = 0x7C2; + _plat->_sequenceId = 0x7C2; _plat->_idleFacing = kDirNone; } else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) { - _platypusSequenceId = 0x7D2; + _plat->_sequenceId = 0x7D2; _plat->_idleFacing = kDirUnk4; } else if (_platWalkNodes[0]._deltaX > 0) { - _platypusSequenceId = 0x7C2; + _plat->_sequenceId = 0x7C2; _plat->_idleFacing = kDirNone; } else if (_platWalkNodes[0]._deltaX < 0) { - _platypusSequenceId = 0x7D2; + _plat->_sequenceId = 0x7D2; _plat->_idleFacing = kDirUnk4; } else { - _platypusSequenceId = 0x7D2; + _plat->_sequenceId = 0x7D2; _plat->_idleFacing = kDirUnk4; } } else if (_plat->_idleFacing != kDirNone) { - _platypusSequenceId = 0x7D2; + _plat->_sequenceId = 0x7D2; } else { - _platypusSequenceId = 0x7C2; + _plat->_sequenceId = 0x7C2; } - _platypusSequenceDatNum = datNum; + _plat->_sequenceDatNum = datNum; } if (animationIndex < 0) { - _platypusId = 20 * _platWalkDestY; + _plat->_id = 20 * _platWalkDestY; } else { - _platypusId = animationIndex + 20 * _platWalkDestY; - _gameSys->setAnimation(makeRid(_platypusSequenceDatNum, _platypusSequenceId), animationIndex + 20 * _platWalkDestY, animationIndex); + _plat->_id = animationIndex + 20 * _platWalkDestY; + _gameSys->setAnimation(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), animationIndex + 20 * _platWalkDestY, animationIndex); } if (flags & 4) - _gameSys->insertSequence(makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, + _gameSys->insertSequence(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 0, 0); else - _gameSys->insertSequence(makeRid(_platypusSequenceDatNum, _platypusSequenceId), _platypusId, + _gameSys->insertSequence(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, makeRid(platSequenceDatNum, platSequenceId), platId, 9, 0, 75 * _platWalkDestX - _platGridX, 48 * _platWalkDestY - _platGridY); } diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 196d99a7f8..a4bde9f1fe 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -1025,7 +1025,6 @@ Scene51::Scene51(GnapEngine *vm) : Scene(vm) { _nextDropItemKind = -1; _itemInsertX = -1; _itemInsertDirection = -1; - _platypusSequenceId = -1; _platypusNextSequenceId = -1; _platypusJumpSequenceId = -1; _itemsCtr = -1; @@ -1233,13 +1232,13 @@ void Scene51::updateItemAnimations() { } int Scene51::checkCollision(int sequenceId) { - bool jumpingLeft = false, jumpingRight = false; - int v8, v4; - int result = 0; - if (!isJumping(sequenceId)) return false; + bool jumpingLeft = false, jumpingRight = false; + int v8 = 0, v4 = 0; + int result = 0; + bool checkFl = false; for (int i = 0; i < 6; i++) checkFl |= _items[i]._isCollision; diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 5348f18df8..419139fc9e 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -136,11 +136,11 @@ void Scene01::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -158,7 +158,7 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: @@ -181,7 +181,7 @@ void Scene01::run() { _vm->playGnapScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 3) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 3) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01TakeMud; break; case TALK_CURSOR: @@ -201,17 +201,17 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01UsePigs; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: @@ -486,11 +486,11 @@ void Scene02::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -505,7 +505,7 @@ void Scene02::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); @@ -516,14 +516,14 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02GrabChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: @@ -538,7 +538,7 @@ void Scene02::run() { case kHS02Truck2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) @@ -548,7 +548,7 @@ void Scene02::run() { } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -560,7 +560,7 @@ void Scene02::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) _vm->_gnap->_actionStatus = kAS02UseTruckGas; else @@ -568,7 +568,7 @@ void Scene02::run() { } } else { _vm->_gnap->_idleFacing = kDirUnk4; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseTruckNoKeys; } break; @@ -592,7 +592,7 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: @@ -714,17 +714,17 @@ void Scene02::updateAnimations() { if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnap->_actionStatus) { case kAS02UseTruckNoKeys: - gameSys.insertSequence(0x14E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x14E, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x14E; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x14E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x14E, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceId = 0x14E; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS02UseTruckNoKeysDone; break; case kAS02UseGasWithTruck: - gameSys.insertSequence(0x151, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x151, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x151; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x151, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x151, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceId = 0x151; + _vm->_gnap->_sequenceDatNum = 0; _vm->invRemove(kItemGas); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFTruckFilledWithGas); @@ -736,11 +736,11 @@ void Scene02::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); if (!_vm->isFlag(kGFTruckKeysUsed)) { - gameSys.insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnapSequenceId = 0x14F; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x14F; + _vm->_gnap->_sequenceDatNum = 0; _vm->invRemove(kItemKeys); _vm->setGrabCursorSprite(-1); } @@ -752,11 +752,11 @@ void Scene02::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->_timers[4] = 250; if (!_vm->isFlag(kGFTruckKeysUsed)) { - gameSys.insertSequence(0x14F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnapSequenceId = 0x14F; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x14F; + _vm->_gnap->_sequenceDatNum = 0; _vm->invRemove(kItemKeys); _vm->setGrabCursorSprite(-1); } @@ -777,10 +777,10 @@ void Scene02::updateAnimations() { break; } _truckGrillCtr = (_truckGrillCtr + 1) % 3; - gameSys.insertSequence(_gnapTruckSequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_gnapTruckSequenceId, _vm->_gnapId, 0); - _vm->_gnapSequenceId = _gnapTruckSequenceId; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(_gnapTruckSequenceId, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_gnapTruckSequenceId, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceId = _gnapTruckSequenceId; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; break; case kAS02LeaveScene: @@ -794,9 +794,9 @@ void Scene02::updateAnimations() { _vm->_timers[2] = 100; break; case kAS02GrabChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + _vm->_gnap->_sequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; _currChickenSequenceId = 0x14B; gameSys.setAnimation(0x14B, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); @@ -821,7 +821,7 @@ void Scene02::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x150) { gameSys.setAnimation(_nextChickenSequenceId, 179, 0); - gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; @@ -911,8 +911,8 @@ void Scene03::run() { _vm->_timers[1] = _vm->getRandom(40) + 20; gameSys.setAnimation(0x1C2, 99, 1); gameSys.insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceId = 0x1C2; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x1C2; + _vm->_plat->_sequenceDatNum = 0; } gameSys.insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -951,11 +951,11 @@ void Scene03::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1020,7 +1020,7 @@ void Scene03::run() { case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1050,7 +1050,7 @@ void Scene03::run() { _vm->gnapWalkTo(7, 6, 0, 0x107B5, 1); _vm->_gnap->_actionStatus = kAS03FreePlatypus; } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else @@ -1062,7 +1062,7 @@ void Scene03::run() { _vm->playGnapBrainPulsating(8, 4); } else { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03HypnotizeScaredPlat; else @@ -1185,12 +1185,12 @@ void Scene03::updateAnimations() { _vm->_gnap->_actionStatus = -1; _vm->_plat->_pos = Common::Point(6, 6); _vm->_plat->_idleFacing = kDirUnk4; - _vm->_platypusId = 120; - gameSys.insertSequence(0x107CA, _vm->_platypusId, 0x1BC, 99, + _vm->_plat->_id = 120; + gameSys.insertSequence(0x107CA, _vm->_plat->_id, 0x1BC, 99, kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); gameSys.insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceDatNum = 1; - _vm->_platypusSequenceId = 0x7CA; + _vm->_plat->_sequenceDatNum = 1; + _vm->_plat->_sequenceId = 0x7CA; _vm->setFlag(kGFPlatypus); _nextPlatSequenceId = -1; updateHotspots(); @@ -1204,16 +1204,16 @@ void Scene03::updateAnimations() { _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); gameSys.setAnimation(0x1BA, 99, 1); - gameSys.insertSequence(0x1BA, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x1BA; + gameSys.insertSequence(0x1BA, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + _vm->_plat->_sequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x1BA; _vm->_gnap->_actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; case kAS03HypnotizeScaredPlat: _vm->playGnapBrainPulsating(0, 0); - gameSys.insertSequence(0x1BF, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x1BF, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); gameSys.setAnimation(0x1BF, 99, 1); while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); @@ -1225,8 +1225,8 @@ void Scene03::updateAnimations() { _vm->removeFullScreenSprite(); gameSys.setAnimation(0x1BA, 99, 1); gameSys.insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x1BA; + _vm->_plat->_sequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x1BA; _vm->_gnap->_actionStatus = -1; _platypusHypnotized = true; updateHotspots(); @@ -1240,10 +1240,10 @@ void Scene03::updateAnimations() { _platypusHypnotized = false; break; case kAS03GrabCreek: - gameSys.insertSequence(0x1B4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x1B4, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x1B4; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x1B4, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1B4, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceId = 0x1B4; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS03GrabCreekDone; break; default: @@ -1256,40 +1256,40 @@ void Scene03::updateAnimations() { if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { gameSys.setAnimation(0, 0, 1); _platypusScared = true; - gameSys.insertSequence(0x1B5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x1B5; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x1B5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x1B5; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_idleFacing = kDirNone; - _vm->_platypusSequenceId = _nextPlatSequenceId; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_sequenceId = _nextPlatSequenceId; + _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; _vm->_gnap->_actionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { _vm->_gnap->_pos = Common::Point(3, 6); - gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x1BC, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1BC, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1BC, 99, 0); - _vm->_gnapId = 20 * _vm->_gnap->_pos.y; - _vm->_gnapSequenceId = 0x1B6; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_id = 20 * _vm->_gnap->_pos.y; + _vm->_gnap->_sequenceId = 0x1B6; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_idleFacing = kDirNone; _vm->_gnap->_actionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { gameSys.setAnimation(0, 0, 1); - gameSys.insertSequence(0x1C2, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0x1C2; - _vm->_platypusSequenceDatNum = 0; + gameSys.insertSequence(0x1C2, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceId = 0x1C2; + _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(0x1C2, 99, 1); _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == -1 && _platypusScared && !_platypusHypnotized) { gameSys.setAnimation(0, 0, 1); gameSys.setAnimation(0x1BE, 99, 1); - gameSys.insertSequence(0x1BE, 99, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0x1BE; - _vm->_platypusSequenceDatNum = 0; + gameSys.insertSequence(0x1BE, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceId = 0x1BE; + _vm->_plat->_sequenceDatNum = 0; _nextPlatSequenceId = -1; } } @@ -1380,9 +1380,9 @@ void Scene04::run() { // TODO setCursor((LPCSTR)IDC_WAIT); _vm->setGrabCursorSprite(kItemKeys); _vm->_gnap->_pos = Common::Point(4, 7); - _vm->_gnapId = 140; + _vm->_gnap->_id = 140; _vm->_plat->_pos = Common::Point(6, 7); - _vm->_platypusId = 141; + _vm->_plat->_id = 141; gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); gameSys.insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); @@ -1392,11 +1392,11 @@ void Scene04::run() { _vm->invAdd(kItemKeys); _vm->setFlag(kGFKeysTaken); _vm->clearFlag(kGFPlatypusDisguised); - _vm->_platypusSequenceId = 0x20C; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x20C; + _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_idleFacing = kDirBottomRight; - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; gameSys.waitForUpdate(); } else { gameSys.insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); @@ -1456,13 +1456,13 @@ void Scene04::run() { break; case GRAB_CURSOR: if (_vm->_cursorValue == 4) - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); else _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1507,7 +1507,7 @@ void Scene04::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); @@ -1535,7 +1535,7 @@ void Scene04::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS04GrabDog; break; case TALK_CURSOR: @@ -1607,7 +1607,7 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->getGnapSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->_gnap->getSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { if (_triedWindow) { _vm->_gnap->_actionStatus = kAS04GetKeyAnother; } else { @@ -1710,15 +1710,15 @@ void Scene04::updateAnimations() { _vm->_sceneDone = true; break; case kAS04OpenDoor: - gameSys.insertSequence(0x205, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_pos = Common::Point(6, 7); - gameSys.insertSequence(0x107B5, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); - gameSys.setAnimation(0x107B5, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; + gameSys.setAnimation(0x107B5, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; _vm->_gnap->_actionStatus = kAS04OpenDoorDone; break; case kAS04OpenDoorDone: @@ -1726,56 +1726,56 @@ void Scene04::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS04GetKeyFirst: - gameSys.insertSequence(0x204, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x204, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x204; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x204, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x204, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceId = 0x204; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS04GetKeyFirst2; break; case kAS04GetKeyFirst2: - gameSys.insertSequence(0x206, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x206, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(0x20B, 256, 0); - _vm->_gnapSequenceId = 0x206; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x206; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS04GetKeyFirstDone; break; case kAS04GetKeyFirstDone: gameSys.requestRemoveSequence(0x1FF, 256); gameSys.requestRemoveSequence(0x20B, 256); - gameSys.insertSequence(0x107B5, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; _vm->_gnap->_actionStatus = -1; break; case kAS04GetKeyAnother: - gameSys.insertSequence(0x202, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x202, _vm->_gnapId, 0); - _vm->_gnapSequenceId = 0x202; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x202, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x202, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceId = 0x202; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS04GetKeyAnother2; break; case kAS04GetKeyAnother2: - gameSys.insertSequence(0x203, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x203, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(0x20A, 256, 0); - _vm->_gnapSequenceId = 0x203; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x203; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS04GetKeyAnotherDone; break; case kAS04GetKeyAnotherDone: gameSys.removeSequence(0x1FF, 256, true); gameSys.removeSequence(0x20A, 256, true); - gameSys.insertSequence(0x107B5, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), 255, + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnap->_actionStatus = -1; break; @@ -1783,10 +1783,10 @@ void Scene04::updateAnimations() { _nextDogSequenceId = 0x201; break; case kAS04GrabAxe: - gameSys.insertSequence(0x211, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x211, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.requestRemoveSequence(0x212, 100); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x211; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x211; _vm->_gnap->_actionStatus = -1; break; default: @@ -1808,12 +1808,12 @@ void Scene04::updateAnimations() { gameSys.insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x200, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _currDogSequenceId = 0x201; - _vm->_gnapSequenceId = 0x200; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x200; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; _vm->_timers[6] = _vm->getRandom(20) + 60; _nextDogSequenceId = -1; @@ -1930,11 +1930,11 @@ void Scene05::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1961,7 +1961,7 @@ void Scene05::run() { break; case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { _vm->_plat->_actionStatus = kAS05PlatSearchHaystack; _vm->_plat->_idleFacing = kDirUnk4; @@ -1981,7 +1981,7 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); @@ -1992,12 +1992,12 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: @@ -2019,7 +2019,7 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: @@ -2043,7 +2043,7 @@ void Scene05::run() { } else if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, - _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) + _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); @@ -2055,7 +2055,7 @@ void Scene05::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: @@ -2150,16 +2150,16 @@ void Scene05::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS05TryPickPadlock: - gameSys.insertSequence(0x148, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x148; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x148, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x148; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; break; case kAS05PickPadlock: - gameSys.setAnimation(0x147, _vm->_gnapId, 0); - gameSys.insertSequence(0x147, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x147; - _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x147, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x147, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x147; + _vm->_gnap->_sequenceDatNum = 0; _vm->setFlag(kGFBarnPadlockOpen); _vm->setFlag(kGFSceneFlag1); _vm->setGrabCursorSprite(-1); @@ -2178,17 +2178,17 @@ void Scene05::updateAnimations() { case kAS05GrabLadder: while (gameSys.isSequenceActive(0x149, 39)) _vm->gameUpdateTick(); - gameSys.insertSequence(0x14E, _vm->_gnapId + 1, 0, 0, kSeqNone, 0, 0, 0); - gameSys.insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x14D; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x14E, _vm->_gnap->_id + 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x14D; + _vm->_gnap->_sequenceDatNum = 0; _vm->_timers[2] = 200; _vm->_timers[6] = 300; _vm->_gnap->_actionStatus = -1; break; case kAS05EnterBarn: gameSys.insertSequence(0x107B1, 1, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); gameSys.setAnimation(0x107B1, 1, 0); _vm->_gnap->_actionStatus = kAS05LeaveScene; @@ -2202,12 +2202,12 @@ void Scene05::updateAnimations() { } if (gameSys.getAnimationStatus(1) == 2) { - if (_vm->_platypusSequenceId == 0x146) { + if (_vm->_plat->_sequenceId == 0x146) { _vm->_plat->_pos = Common::Point(4, 8); gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); - _vm->_platypusSequenceId = 0x7C1; - _vm->_platypusSequenceDatNum = 1; - _vm->_platypusId = 20 * _vm->_plat->_pos.y; + _vm->_plat->_sequenceId = 0x7C1; + _vm->_plat->_sequenceDatNum = 1; + _vm->_plat->_id = 20 * _vm->_plat->_pos.y; _vm->invAdd(kItemNeedle); _vm->setFlag(kGFNeedleTaken); _vm->setGrabCursorSprite(kItemNeedle); @@ -2217,12 +2217,12 @@ void Scene05::updateAnimations() { } if (_vm->_plat->_actionStatus == kAS05PlatSearchHaystack) { gameSys.setAnimation(0, 0, 1); - gameSys.insertSequence(0x145, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x146, 256, 0x145, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x145, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x146, 256, 0x145, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->hideCursor(); _vm->setGrabCursorSprite(-1); - _vm->_platypusSequenceId = 0x146; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x146; + _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(0x146, 256, 1); _vm->_timers[1] = 300; } @@ -2232,9 +2232,9 @@ void Scene05::updateAnimations() { if (_nextChickenSequenceId == 0x14B) { gameSys.setAnimation(_nextChickenSequenceId, 100, 3); gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x14C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x14C; + gameSys.insertSequence(0x14C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x14C; _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; _vm->_gnap->_actionStatus = -1; @@ -2354,11 +2354,11 @@ void Scene06::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2449,11 +2449,11 @@ void Scene06::run() { break; case TALK_CURSOR: if (_horseTurnedBack) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS06TalkToHorse; } @@ -2552,17 +2552,17 @@ void Scene06::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS06TryToGetGas: - gameSys.insertSequence(0xFC, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xFC; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0xFC, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0xFC; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; break; case kAS06TryToClimbLadder: gameSys.insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0xFD, _vm->_gnapId, 0); - gameSys.insertSequence(0xFD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xFD; - _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0xFD, _vm->_gnap->_id, 0); + gameSys.insertSequence(0xFD, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0xFD; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS06TryToClimbLadderDone; break; case kAS06TryToClimbLadderDone: @@ -2583,7 +2583,7 @@ void Scene06::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - if (_vm->_platypusSequenceId == 0xFA) { + if (_vm->_plat->_sequenceId == 0xFA) { gameSys.setAnimation(0, 0, 1); _vm->invAdd(kItemGas); _vm->setFlag(kGFGasTaken); @@ -2591,9 +2591,9 @@ void Scene06::updateAnimations() { _vm->setGrabCursorSprite(kItemGas); _vm->_plat->_actionStatus = -1; _vm->_plat->_pos = Common::Point(6, 8); - gameSys.insertSequence(0x107C1, _vm->_platypusId, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); - _vm->_platypusSequenceId = 0x7C1; - _vm->_platypusSequenceDatNum = 1; + gameSys.insertSequence(0x107C1, _vm->_plat->_id, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); + _vm->_plat->_sequenceId = 0x7C1; + _vm->_plat->_sequenceDatNum = 1; _vm->setFlag(kGFUnk04); _vm->_gnap->_actionStatus = -1; _vm->showCursor(); @@ -2612,16 +2612,16 @@ void Scene06::updateAnimations() { _vm->hideCursor(); gameSys.setAnimation(0xFA, 256, 1); gameSys.insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x100, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x100, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0xFB, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0xFA, 256, 0xFB, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xFA; - _vm->_platypusSequenceDatNum = 0; - gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x100, _vm->_gnapId, + gameSys.insertSequence(0xFB, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFA, 256, 0xFB, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceId = 0xFA; + _vm->_plat->_sequenceDatNum = 0; + gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x100, _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B7; - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceId = 0x7B7; + _vm->_gnap->_sequenceDatNum = 1; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; _nextPlatSequenceId = -1; @@ -2686,17 +2686,17 @@ void Scene07::run() { _vm->endSceneInit(); } else { _vm->_gnap->_pos = Common::Point(6, 7); - _vm->_gnapId = 140; - _vm->_gnapSequenceId = 0x8F; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_id = 140; + _vm->_gnap->_sequenceId = 0x8F; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_idleFacing = kDirBottomRight; gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS07Wait; _vm->_plat->_pos = Common::Point(3, 8); - _vm->_platypusId = 160; - _vm->_platypusSequenceId = 0x91; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_id = 160; + _vm->_plat->_sequenceId = 0x91; + _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_idleFacing = kDirNone; gameSys.insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -2725,11 +2725,11 @@ void Scene07::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -2759,11 +2759,11 @@ void Scene07::run() { _vm->playGnapPullOutDevice(3, 3); gameSys.setAnimation(0x8E, 1, 2); gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(_vm->getGnapSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(_vm->_gnap->getSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = _vm->getGnapSequenceId(gskUseDevice, 0, 0); - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceId = _vm->_gnap->getSequenceId(gskUseDevice, 0, 0); + _vm->_gnap->_sequenceDatNum = 1; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -2809,8 +2809,8 @@ void Scene07::run() { int gnapRandomValue = _vm->getRandom(20); // TODO Cleanup if (_vm->_plat->_idleFacing != kDirNone) { - if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7CA) { - if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7CA) { + if (gnapRandomValue != 0 || _vm->_plat->_sequenceId != 0x7CA) { + if (gnapRandomValue != 1 || _vm->_plat->_sequenceId != 0x7CA) { if (_vm->_plat->_pos.y == 9) _vm->playPlatypusSequence(0x107CA); } else { @@ -2819,8 +2819,8 @@ void Scene07::run() { } else { _vm->playPlatypusSequence(0x107CC); } - } else if (gnapRandomValue != 0 || _vm->_platypusSequenceId != 0x7C9) { - if (gnapRandomValue != 1 || _vm->_platypusSequenceId != 0x7C9) { + } else if (gnapRandomValue != 0 || _vm->_plat->_sequenceId != 0x7C9) { + if (gnapRandomValue != 1 || _vm->_plat->_sequenceId != 0x7C9) { if (_vm->_plat->_pos.y == 9) _vm->playPlatypusSequence(0x107C9); } else { @@ -2829,7 +2829,7 @@ void Scene07::run() { } else { _vm->playPlatypusSequence(0x107CB); } - gameSys.setAnimation(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, 1); } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; @@ -2996,11 +2996,11 @@ void Scene08::run() { break; case GRAB_CURSOR: _vm->gnapActionIdle(0x14D); - _vm->gnapKissPlatypus(8); + _vm->_gnap->kissPlatypus(8); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -3043,12 +3043,12 @@ void Scene08::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(8, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(8, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x14D); - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithMan; _vm->_plat->_idleFacing = kDirNone; @@ -3061,13 +3061,13 @@ void Scene08::run() { case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 7, 5, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapScratchingHead(6, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS08LookDog; break; case GRAB_CURSOR: @@ -3078,13 +3078,13 @@ void Scene08::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(4, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); _vm->gnapActionIdle(0x14D); - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithDog; _vm->_plat->_idleFacing = kDirNone; @@ -3324,14 +3324,14 @@ void Scene08::updateAnimations() { } else if (_nextDogSequenceId == 0x147) { gameSys.setAnimation(_nextDogSequenceId, 100, 3); gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x148, 160, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x148, 160, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = 0x134; _vm->_plat->_pos = Common::Point(1, 8); - _vm->_platypusId = 160; - _vm->_platypusSequenceId = 0x148; + _vm->_plat->_id = 160; + _vm->_plat->_sequenceId = 0x148; _vm->_plat->_idleFacing = kDirUnk4; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_sequenceDatNum = 0; if (_vm->_gnap->_pos == Common::Point(1, 8)) _vm->gnapWalkStep(); } else if (_nextDogSequenceId != -1) { @@ -3343,10 +3343,10 @@ void Scene08::updateAnimations() { if (_currDogSequenceId == 0x133) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x14D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x14D; + gameSys.insertSequence(0x14D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x14D; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; } } @@ -3425,11 +3425,11 @@ void Scene09::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -3529,12 +3529,12 @@ void Scene09::updateAnimations() { break; case kAS09SearchTrash: gameSys.setAnimation(0x4C, 120, 0); - gameSys.insertSequence(0x4C, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x4C, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x4B, 2, true); - _vm->_gnapSequenceId = 0x4C; - _vm->_gnapId = 120; + _vm->_gnap->_sequenceId = 0x4C; + _vm->_gnap->_id = 120; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(9, 6); _vm->_gnap->_actionStatus = kAS09SearchTrashDone; break; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 6aca6434ed..5cad36d393 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -117,11 +117,11 @@ void Scene10::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(10); + _vm->_gnap->kissPlatypus(10); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -150,7 +150,7 @@ void Scene10::run() { case kHS10Cook: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 8, 6, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { @@ -164,12 +164,12 @@ void Scene10::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(4, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(4, 8, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(4, 6, -1, -1, 1); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; @@ -206,7 +206,7 @@ void Scene10::run() { _vm->playGnapMoan2(-1, -1); else { _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, -1, -1, 1); _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; @@ -239,7 +239,7 @@ void Scene10::run() { _vm->invAdd(kItemTongs); _vm->setFlag(kGFMudTaken); _vm->gnapActionIdle(0x10C); - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS10PlatWithBox; _vm->_plat->_idleFacing = kDirUnk4; @@ -257,16 +257,16 @@ void Scene10::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 10, 5) | 0x10000); + _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 10, 5) | 0x10000); break; case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(9, 6, 0, 0x107BB, 1); - gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x10E; - _vm->_gnapId = 120; + gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x10E; + _vm->_gnap->_id = 120; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(9, 6); _vm->_timers[2] = 360; break; @@ -371,16 +371,16 @@ void Scene10::updateAnimations() { _vm->_plat->_pos = Common::Point(4, 8); gameSys.insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x107C9, 160, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); gameSys.removeSequence(0x107, 100, true); _currCookSequenceId = 0x109; _nextCookSequenceId = 0x843; - _vm->_platypusSequenceId = 0x7C9; - _vm->_platypusId = 160; + _vm->_plat->_sequenceId = 0x7C9; + _vm->_plat->_id = 160; _vm->_plat->_idleFacing = kDirNone; - _vm->_platypusSequenceDatNum = 1; + _vm->_plat->_sequenceDatNum = 1; break; case 0x843: _vm->hideCursor(); @@ -455,10 +455,10 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = 300; - gameSys.insertSequence(0x10C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x10C; + gameSys.insertSequence(0x10C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x10C; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; _vm->_plat->_actionStatus = -1; } @@ -598,11 +598,11 @@ void Scene11::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -653,7 +653,7 @@ void Scene11::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(3, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkGoggleGuy; break; } @@ -671,7 +671,7 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 3, 6) | 0x10000); + _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 3, 6) | 0x10000); break; case GRAB_CURSOR: _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); @@ -679,7 +679,7 @@ void Scene11::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->gnapWalkTo(5, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(5, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: @@ -840,10 +840,10 @@ void Scene11::updateAnimations() { gameSys.setAnimation(0, 0, 0); _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x1F4, 255, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x1F4; - _vm->_gnapId = 255; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x1F4, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x1F4; + _vm->_gnap->_id = 255; + _vm->_gnap->_sequenceDatNum = 0; gameSys.removeSequence(0x207, 257, true); gameSys.removeSequence(0x208, 256, true); _nextGoggleGuySequenceId = 0x1F8; @@ -893,11 +893,11 @@ void Scene11::updateAnimations() { if (_nextHookGuySequenceId == 0x204) { gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); gameSys.insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x1F5, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1F5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _currHookGuySequenceId = 0x204; _nextHookGuySequenceId = -1; - _vm->_gnapSequenceId = 0x1F5; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x1F5; + _vm->_gnap->_sequenceDatNum = 0; _vm->_timers[4] = _vm->getRandom(40) + 20; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; @@ -1017,11 +1017,11 @@ void Scene12::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -1065,11 +1065,11 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(3, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(3, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; _vm->_plat->_idleFacing = kDirUnk4; @@ -1102,12 +1102,12 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(6, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(6, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: _vm->playGnapPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS12PlatWithBarkeeper; break; } @@ -1135,11 +1135,11 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(7, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; _vm->_plat->_idleFacing = kDirNone; @@ -1360,11 +1360,11 @@ void Scene12::updateAnimations() { gameSys.setAnimation(0x10843, 301, 0); _vm->_gnap->_actionStatus = kAS12QuarterToToothGuyDone; gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x107B7, _vm->_gnapId, 0x10843, 301, + gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x10843, 301, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B7; - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceId = 0x7B7; + _vm->_gnap->_sequenceDatNum = 1; _vm->setFlag(kGFTwigTaken); _vm->invAdd(kItemQuarterWithHole); _vm->invRemove(kItemQuarter); @@ -1372,11 +1372,11 @@ void Scene12::updateAnimations() { if (_nextToothGuySequenceId == 0x1EF) { gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; - _vm->_gnapSequenceId = 0x205; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x205; + _vm->_gnap->_sequenceDatNum = 0; _vm->_timers[4] = 40; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; @@ -1526,11 +1526,11 @@ void Scene13::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -1560,14 +1560,14 @@ void Scene13::run() { case TALK_CURSOR: if (_vm->_gnap->_pos == Common::Point(5, 5)) { _backToiletCtr = MIN(5, _backToiletCtr + 1); - gameSys.setAnimation(_backToiletCtr + 0xA3, _vm->_gnapId, 0); - gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.setAnimation(_backToiletCtr + 0xA3, _vm->_gnap->_id, 0); + gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqScale | kSeqSyncWait, 0, 0, 0); _vm->_gnap->_actionStatus = kAS13Wait; - _vm->_gnapSequenceId = _backToiletCtr + 0xA3; + _vm->_gnap->_sequenceId = _backToiletCtr + 0xA3; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; } else { _vm->gnapWalkTo(5, 5, 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS13BackToilet; @@ -1613,7 +1613,7 @@ void Scene13::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 7, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0), 1); + _vm->gnapWalkTo(7, 7, -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0), 1); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1628,7 +1628,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 9, 6)); + _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 9, 6)); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; @@ -1650,7 +1650,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->getGnapSequenceId(gskDeflect, 5, 9)); + _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 5, 9)); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; @@ -1770,9 +1770,9 @@ void Scene13::updateAnimations() { break; case kAS13BackToilet: _backToiletCtr = MIN(5, _backToiletCtr + 1); - gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 9, 0, 0, 0); - _vm->_gnapSequenceId = _backToiletCtr + 0xA3; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 9, 0, 0, 0); + _vm->_gnap->_sequenceId = _backToiletCtr + 0xA3; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; break; case kAS13FrontToilet: @@ -1785,12 +1785,12 @@ void Scene13::updateAnimations() { break; case kAS13GrabSink: gameSys.setAnimation(0xAB, 160, 0); - gameSys.insertSequence(0xAB, 160, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xAB, 160, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0xAA, 256, true); - _vm->_gnapSequenceId = 0xAB; - _vm->_gnapId = 160; + _vm->_gnap->_sequenceId = 0xAB; + _vm->_gnap->_id = 160; _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(4, 8); _vm->_timers[2] = 360; _vm->_gnap->_actionStatus = kAS13GrabSinkDone; @@ -1804,11 +1804,11 @@ void Scene13::updateAnimations() { break; case kAS13GrabUrinal: gameSys.setAnimation(0xA2, 120, 0); - gameSys.insertSequence(0xA2, 120, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA2; - _vm->_gnapId = 120; + gameSys.insertSequence(0xA2, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0xA2; + _vm->_gnap->_id = 120; _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(4, 6); _vm->_timers[2] = 360; _vm->_gnap->_actionStatus = kAS13Wait; @@ -1862,7 +1862,7 @@ void Scene14::run() { if (!_vm->isFlag(kGFNeedleTaken)) { gameSys.insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x24; + _vm->_gnap->_sequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -1893,7 +1893,7 @@ void Scene14::run() { _vm->setGrabCursorSprite(-1); _vm->hideCursor(); gameSys.setAnimation(0x26, 10, 0); - gameSys.insertSequence(0x26, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x26, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playSound(0x108E9, false); } else { @@ -1902,9 +1902,9 @@ void Scene14::run() { _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - gameSys.insertSequence(0x25, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x23; + _vm->_gnap->_sequenceId = 0x23; break; case TALK_CURSOR: _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); @@ -1944,8 +1944,8 @@ void Scene14::run() { _vm->checkGameKeys(); if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { - gameSys.insertSequence(0x24, 10, _vm->_gnapSequenceId, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x24; + gameSys.insertSequence(0x24, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -2340,10 +2340,10 @@ void Scene17::platHangUpPhone() { gameSys.insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (gameSys.getAnimationStatus(4) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x25B, _vm->_platypusId, 1); - gameSys.insertSequence(0x25B, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0x25B; - _vm->_platypusSequenceDatNum = 0; + gameSys.setAnimation(0x25B, _vm->_plat->_id, 1); + gameSys.insertSequence(0x25B, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceId = 0x25B; + _vm->_plat->_sequenceDatNum = 0; _currPhoneSequenceId = -1; _nextPhoneSequenceId = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); @@ -2423,11 +2423,11 @@ void Scene17::run() { } else if (_vm->isFlag(kGFUnk27)) { _vm->initGnapPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; - _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceId = 0x25A; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x25A; + _vm->_plat->_sequenceDatNum = 0; _vm->endSceneInit(); _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); @@ -2442,10 +2442,10 @@ void Scene17::run() { _vm->clearFlag(kGFUnk16); _vm->initPlatypusPos(7, 9, kDirNone); _vm->_gnap->_pos = _vm->_hotspotsWalkPos[2]; - _vm->_gnapId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_gnap->_id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 601; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 601; _vm->_gnap->_actionStatus = kAS17GnapHangUpPhone; _vm->clearFlag(kGFUnk25); gameSys.insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -2458,12 +2458,12 @@ void Scene17::run() { _vm->_sceneWaiting = true; _vm->initGnapPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; - _vm->_platypusId = 20 * _vm->_hotspotsWalkPos[2].y; + _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_platypusSequenceId = 0x25A; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x25A; + _vm->_plat->_sequenceDatNum = 0; _vm->endSceneInit(); gameSys.setAnimation(_currPhoneSequenceId, 254, 1); _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; @@ -2490,21 +2490,21 @@ void Scene17::run() { } } else { _vm->_gnap->_pos = Common::Point(3, 6); - _vm->_gnapId = 120; - _vm->_gnapSequenceId = 0x23D; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_id = 120; + _vm->_gnap->_sequenceId = 0x23D; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_idleFacing = kDirBottomRight; - gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); _vm->_plat->_pos = Common::Point(-1, 8); - _vm->_platypusId = 160; + _vm->_plat->_id = 160; gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - gameSys.insertSequence(0x107C1, _vm->_platypusId, 0x241, _vm->_platypusId, + gameSys.insertSequence(0x107C1, _vm->_plat->_id, 0x241, _vm->_plat->_id, kSeqScale | kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); _vm->endSceneInit(); - _vm->_platypusSequenceId = 0x7C1; - _vm->_platypusSequenceDatNum = 1; + _vm->_plat->_sequenceId = 0x7C1; + _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_idleFacing = kDirBottomRight; _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); } @@ -2528,9 +2528,9 @@ void Scene17::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else { - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); _vm->_plat->_actionStatus = kAS17GetWrench1; @@ -2549,7 +2549,7 @@ void Scene17::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2577,7 +2577,7 @@ void Scene17::run() { case PLAT_CURSOR: if (_canTryGetWrench) { platHangUpPhone(); - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS17TryGetWrench; _vm->_gnap->_actionStatus = kAS17TryGetWrench; @@ -2593,7 +2593,7 @@ void Scene17::run() { case kHS17Phone1: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2605,7 +2605,7 @@ void Scene17::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GetCoinFromPhone; } else _vm->playGnapImpossible(0, 0); @@ -2617,7 +2617,7 @@ void Scene17::run() { if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); @@ -2634,7 +2634,7 @@ void Scene17::run() { case kHS17Phone2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2648,7 +2648,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else @@ -2661,7 +2661,7 @@ void Scene17::run() { if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); @@ -2841,10 +2841,10 @@ void Scene17::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS17PutCoinIntoPhone: - gameSys.setAnimation(0x24C, _vm->_gnapId, 0); - gameSys.insertSequence(0x24C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x24C; + gameSys.setAnimation(0x24C, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x24C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x24C; _vm->invRemove(kItemDiceQuarterHole); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFUnk18); @@ -2855,15 +2855,15 @@ void Scene17::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS17GnapUsePhone: - gameSys.setAnimation(0x24D, _vm->_gnapId, 0); - gameSys.insertSequence(0x24D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x24D, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x24D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_actionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17GnapHangUpPhone: - gameSys.insertSequence(0x258, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x258; + gameSys.insertSequence(0x258, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x258; _vm->_gnap->_actionStatus = -1; break; case kAS17LeaveScene: @@ -2896,10 +2896,10 @@ void Scene17::updateAnimations() { _vm->setGrabCursorSprite(kItemWrench); break; case kAS17PlatUsePhone: - gameSys.setAnimation(0x24E, _vm->_platypusId, 1); - gameSys.insertSequence(0x24E, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x24E; + gameSys.setAnimation(0x24E, _vm->_plat->_id, 1); + gameSys.insertSequence(0x24E, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x24E; _vm->_plat->_actionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; @@ -2909,9 +2909,9 @@ void Scene17::updateAnimations() { _platPhoneCtr = 0; _nextPhoneSequenceId = -1; _currPhoneSequenceId = -1; - gameSys.insertSequence(0x25B, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x25B; + gameSys.insertSequence(0x25B, _vm->_plat->_id, 0x25A, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x25B; _vm->_plat->_actionStatus = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); _vm->_sceneWaiting = false; @@ -2920,9 +2920,9 @@ void Scene17::updateAnimations() { _nextPhoneSequenceId = kPlatPhoneSequenceIds[_platPhoneCtr]; gameSys.setAnimation(_nextPhoneSequenceId, 254, 1); gameSys.insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x25A, _vm->_platypusId, 0x25A, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x25A; + gameSys.insertSequence(0x25A, _vm->_plat->_id, 0x25A, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x25A; _currPhoneSequenceId = _nextPhoneSequenceId; } break; @@ -2936,27 +2936,27 @@ void Scene17::updateAnimations() { switch (_nextWrenchSequenceId) { case 0x233: _vm->_gnap->_actionStatus = -1; - gameSys.insertSequence(0x243, _vm->_platypusId, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + gameSys.insertSequence(0x243, _vm->_plat->_id, + _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; - _vm->_platypusSequenceId = 0x243; - _vm->_platypusSequenceDatNum = 0; - gameSys.setAnimation(0x243, _vm->_platypusId, 1); + _vm->_plat->_sequenceId = 0x243; + _vm->_plat->_sequenceDatNum = 0; + gameSys.setAnimation(0x243, _vm->_plat->_id, 1); break; case 0x234: _vm->_gnap->_actionStatus = -1; - gameSys.insertSequence(0x242, _vm->_platypusId, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + gameSys.insertSequence(0x242, _vm->_plat->_id, + _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; - _vm->_platypusSequenceId = 0x242; - _vm->_platypusSequenceDatNum = 0; - gameSys.setAnimation(0x242, _vm->_platypusId, 1); + _vm->_plat->_sequenceId = 0x242; + _vm->_plat->_sequenceDatNum = 0; + gameSys.setAnimation(0x242, _vm->_plat->_id, 1); break; case 0x231: if (_vm->getRandom(2) != 0) @@ -2989,15 +2989,15 @@ void Scene17::updateAnimations() { _currWrenchSequenceId = 0x22E; _canTryGetWrench = false; } - gameSys.setAnimation(0x23F, _vm->_platypusId, 1); - gameSys.insertSequence(0x10875, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x23F, _vm->_platypusId, - _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, + gameSys.setAnimation(0x23F, _vm->_plat->_id, 1); + gameSys.insertSequence(0x10875, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x23F, _vm->_plat->_id, + _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 1; - _vm->_platypusSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x875; - _vm->_platypusSequenceId = 0x23F; + _vm->_gnap->_sequenceDatNum = 1; + _vm->_plat->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x875; + _vm->_plat->_sequenceId = 0x23F; _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); _vm->_plat->_actionStatus = kAS17GetWrench2; } @@ -3037,15 +3037,15 @@ void Scene17::updateAnimations() { break; case 0x249: gameSys.setAnimation(0x230, 40, 2); - gameSys.setAnimation(0x240, _vm->_platypusId, 1); + gameSys.setAnimation(0x240, _vm->_plat->_id, 1); gameSys.insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x240, _vm->_platypusId, _vm->_platypusSequenceId, _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x23E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x23E; - _vm->_gnapSequenceDatNum = 0; - _vm->_platypusSequenceId = 0x240; - _vm->_platypusSequenceDatNum = 0; + gameSys.insertSequence(0x240, _vm->_plat->_id, _vm->_plat->_sequenceId, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x23E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x23E; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_plat->_sequenceId = 0x240; + _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(0x24A, 40, 3); gameSys.insertSequence(0x24A, 40, _nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); while (gameSys.getAnimationStatus(2) != 2) { @@ -3173,9 +3173,9 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { nextGridX = destGridX; if (nextGridX == _vm->_gnap->_pos.x) { - gnapSeqId = _vm->_gnapSequenceId; - gnapId = _vm->_gnapId; - gnapDatNum = _vm->_gnapSequenceDatNum; + gnapSeqId = _vm->_gnap->_sequenceId; + gnapId = _vm->_gnap->_id; + gnapDatNum = _vm->_gnap->_sequenceDatNum; gnapGridX = _vm->_gnap->_pos.x; if (_vm->_gnap->_pos.x <= curGridX) direction = 1; @@ -3190,9 +3190,9 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { _vm->platypusMakeRoom(); } } - gnapSeqId = _vm->_gnapSequenceId; - gnapId = _vm->_gnapId; - gnapDatNum = _vm->_gnapSequenceDatNum; + gnapSeqId = _vm->_gnap->_sequenceId; + gnapId = _vm->_gnap->_id; + gnapDatNum = _vm->_gnap->_sequenceDatNum; gnapGridX = _vm->_gnap->_pos.x; int seqId; if (nextGridX < _vm->_gnap->_pos.x) { @@ -3219,20 +3219,20 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { } if (direction == 1) - _vm->_gnapSequenceId = 0x20A; + _vm->_gnap->_sequenceId = 0x20A; else - _vm->_gnapSequenceId = 0x209; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x209; + _vm->_gnap->_sequenceDatNum = 0; if (direction == 1) _vm->_gnap->_idleFacing = kDirBottomRight; else _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnapId = 20 * _vm->_gnap->_pos.y + 1; + _vm->_gnap->_id = 20 * _vm->_gnap->_pos.y + 1; - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); - gameSys.insertSequence(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); + gameSys.insertSequence(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, gnapSeqId | (gnapDatNum << 16), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); @@ -3253,17 +3253,17 @@ void Scene18::putDownGarbageCan(int animationIndex) { _vm->clearFlag(kGFPlatypusDisguised); updateHotspots(); if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) { - gameSys.insertSequence(0x107BA, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(0x107BA, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7BA; + _vm->_gnap->_sequenceId = 0x7BA; } else { - gameSys.insertSequence(0x107B9, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(0x107B9, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B9; + _vm->_gnap->_sequenceId = 0x7B9; } - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceDatNum = 1; gameSys.insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); gameSys.setAnimation(0x1FA, 19, 4); gameSys.insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); @@ -3436,7 +3436,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -3445,11 +3445,11 @@ void Scene18::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -3476,7 +3476,7 @@ void Scene18::run() { _vm->playGnapScratchingHead(3, 2); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 0, _vm->getGnapSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -3515,7 +3515,7 @@ void Scene18::run() { if (!_vm->isFlag(kGFTruckKeysUsed)) { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, -1, -1, 1); - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 0, -1, 1)) @@ -3570,7 +3570,7 @@ void Scene18::run() { } } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); @@ -3612,7 +3612,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCan; else @@ -3792,17 +3792,17 @@ void Scene18::updateAnimations() { switch (_vm->_gnap->_actionStatus) { case kAS18GrabGarbageCanFromStreet: if (_vm->_gnap->_idleFacing != kDirUpRight && _vm->_gnap->_idleFacing != kDirBottomRight) { - gameSys.insertSequence(0x1FC, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(0x1FC, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 675, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FC; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x1FC; } else { - gameSys.insertSequence(0x1FD, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(0x1FD, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 525, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FD; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x1FD; } gameSys.removeSequence(0x1FA, 19, true); _vm->setFlag(kGFPlatypusDisguised); @@ -3810,23 +3810,23 @@ void Scene18::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS18GrabGarbageCanFromHydrant: - gameSys.insertSequence(0x1FE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1FE, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x1F9, 19, true); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FE; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x1FE; _vm->clearFlag(kGFTruckKeysUsed); _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); _vm->_gnap->_actionStatus = -1; break; case kAS18CloseRightValveNoGarbageCan: - gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20D, 39, true); gameSys.removeSequence(0x212, 39, true); gameSys.removeSequence(0x211, 39, true); _vm->stopSound(0x22B); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x205; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x205; _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); @@ -3846,7 +3846,7 @@ void Scene18::updateAnimations() { break; case kAS18OpenTopValveDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x208, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x208, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.removeSequence(0x20C, 19, true); gameSys.setAnimation(0x217, 39, 5); @@ -3855,20 +3855,20 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x208; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x208; _vm->invRemove(kItemWrench); _vm->setGrabCursorSprite(-1); _vm->_gnap->_actionStatus = -1; break; case kAS18CloseTopValve: - gameSys.insertSequence(0x206, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x206, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20E, 39, true); gameSys.removeSequence(0x216, 39, true); gameSys.removeSequence(0x217, 39, true); _vm->stopSound(0x22B); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x206; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x206; _vm->clearFlag(kGFBarnPadlockOpen); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); @@ -3876,10 +3876,10 @@ void Scene18::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS18GrabCowboyHat: - gameSys.setAnimation(0x200, _vm->_gnapId, 0); - gameSys.insertSequence(0x200, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x200; + gameSys.setAnimation(0x200, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x200, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x200; _vm->_gnap->_actionStatus = kAS18GrabCowboyHatDone; break; case kAS18GrabCowboyHatDone: @@ -3910,25 +3910,25 @@ void Scene18::updateAnimations() { _vm->clearFlag(kGFPlatypusDisguised); gameSys.requestRemoveSequence(0x211, 39); gameSys.requestRemoveSequence(0x212, 39); - gameSys.insertSequence(0x210, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x210, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); - gameSys.setAnimation(0x210, _vm->_gnapId, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x210; + gameSys.setAnimation(0x210, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x210; _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnRunningHydrant2; break; case kAS18PutGarbageCanOnRunningHydrant2: _vm->playSound(0x22B, true); - gameSys.setAnimation(0x1FF, _vm->_gnapId, 0); - gameSys.insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x1FF; + gameSys.setAnimation(0x1FF, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x1FF, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x1FF; _vm->_sceneWaiting = true; _vm->_gnap->_actionStatus = kAS18StandingOnHydrant; break; case kAS18StandingOnHydrant: - gameSys.setAnimation(0x1FF, _vm->_gnapId, 0); - gameSys.insertSequence(0x1FF, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FF, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x1FF, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); break; case kAS18OpenRightValveNoGarbageCan: case kAS18OpenRightValveWithGarbageCan: @@ -3947,7 +3947,7 @@ void Scene18::updateAnimations() { break; case kAS18OpenRightValveWithGarbageCanDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x207, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.requestRemoveSequence(0x1F9, 19); gameSys.removeSequence(0x20B, 19, true); @@ -3957,14 +3957,14 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x207; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x207; _vm->invRemove(kItemWrench); _vm->_gnap->_actionStatus = -1; break; case kAS18OpenRightValveNoGarbageCanDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x207, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x207, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.removeSequence(0x20B, 19, true); gameSys.setAnimation(0x211, 39, 5); @@ -3973,13 +3973,13 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x207; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x207; _vm->invRemove(kItemWrench); _vm->_gnap->_actionStatus = -1; break; case kAS18CloseRightValveWithGarbageCan: - gameSys.insertSequence(0x205, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20D, 39, true); gameSys.insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); @@ -3988,10 +3988,10 @@ void Scene18::updateAnimations() { _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); - gameSys.insertSequence(0x107B5, _vm->_gnapId, 517, _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 517, _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); updateHotspots(); - _vm->_gnapSequenceDatNum = 1; - _vm->_gnapSequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; + _vm->_gnap->_sequenceId = 0x7B5; _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCanDone; break; case kAS18CloseRightValveWithGarbageCanDone: @@ -4000,14 +4000,14 @@ void Scene18::updateAnimations() { case kAS18PutGarbageCanOnHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatypusDisguised); - gameSys.insertSequence(0x20F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x20F, _vm->_gnapId, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x20F; + gameSys.insertSequence(0x20F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x20F, _vm->_gnap->_id, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x20F; _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnHydrantDone; break; case kAS18PutGarbageCanOnHydrantDone: - gameSys.insertSequence(0x1F9, 19, 0x20F, _vm->_gnapId, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F9, 19, 0x20F, _vm->_gnap->_id, kSeqNone, 0, 0, 0); updateHotspots(); _vm->_gnap->_actionStatus = -1; break; @@ -4142,7 +4142,7 @@ void Scene19::run() { case kHS19Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { @@ -4151,11 +4151,11 @@ void Scene19::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -4191,7 +4191,7 @@ void Scene19::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS19GrabPicture; } break; @@ -4215,7 +4215,7 @@ void Scene19::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 229aad4eb6..0a8d6041b6 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -273,7 +273,7 @@ void Scene20::run() { case kHS20Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -282,11 +282,11 @@ void Scene20::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(20); + _vm->_gnap->kissPlatypus(20); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -371,7 +371,7 @@ void Scene20::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_stonerGuyShowingJoint) _vm->_gnap->_actionStatus = kAS20GrabJoint; else @@ -379,7 +379,7 @@ void Scene20::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) _vm->_gnap->_actionStatus = kAS20TalkStonerGuyNoJoint; else @@ -405,12 +405,12 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: @@ -425,7 +425,7 @@ void Scene20::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); @@ -437,7 +437,7 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: @@ -603,10 +603,10 @@ void Scene20::updateAnimations() { break; case kAS20SwitchGroceryStoreHat: _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x180, _vm->_gnapId, 0); - gameSys.insertSequence(0x180, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x180; - _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x180, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x180, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x180; + _vm->_gnap->_sequenceDatNum = 0; _vm->invRemove(kItemCowboyHat); _vm->invAdd(kItemGroceryStoreHat); _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHatDone; @@ -625,7 +625,7 @@ void Scene20::updateAnimations() { _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(3, 8, -1, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(3, 8, -1, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = -1; break; case kAS20GrabJointDone: @@ -647,11 +647,11 @@ void Scene20::updateAnimations() { break; case 0x178: gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - gameSys.setAnimation(0x17D, _vm->_gnapId, 0); + gameSys.setAnimation(0x17D, _vm->_gnap->_id, 0); gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x17D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x17D; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x17D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x17D; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); @@ -664,9 +664,9 @@ void Scene20::updateAnimations() { gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); gameSys.setAnimation(0x16D, 21, 0); gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x17E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x17E; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x17E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x17E; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); @@ -791,7 +791,7 @@ void Scene21::run() { case kHS21Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -800,11 +800,11 @@ void Scene21::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -824,7 +824,7 @@ void Scene21::run() { _vm->playGnapScratchingHead(2, 5); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); _vm->playGnapPullOutDevice(2, 5); _vm->playGnapUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS21GrabBanana; @@ -841,7 +841,7 @@ void Scene21::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; - _vm->gnapWalkTo(4, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(4, 6, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 6, 7, 4); @@ -853,13 +853,13 @@ void Scene21::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(7, 6, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(7, 6, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady].x, _vm->_hotspotsWalkPos[kHS21OldLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady].x, _vm->_hotspotsWalkPos[kHS21OldLady].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: @@ -962,10 +962,10 @@ void Scene21::updateAnimations() { _nextOldLadySequenceId = 0x87; break; case kAS21UseHatWithOldLady: - gameSys.setAnimation(0x8F, _vm->_gnapId, 0); - gameSys.insertSequence(0x8F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x8F; + gameSys.setAnimation(0x8F, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x8F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x8F; _vm->_gnap->_actionStatus = kAS21UseHatWithOldLadyDone; _vm->invAdd(kItemTickets); _vm->invRemove(kItemGroceryStoreHat); @@ -984,9 +984,9 @@ void Scene21::updateAnimations() { if (_nextOldLadySequenceId == 0x87) { gameSys.setAnimation(_nextOldLadySequenceId, 79, 3); gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x86, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x86; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x86, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x86; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; @@ -1107,7 +1107,7 @@ void Scene22::run() { case kHS22Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -1116,11 +1116,11 @@ void Scene22::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1165,11 +1165,11 @@ void Scene22::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, - 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); break; } } @@ -1331,7 +1331,7 @@ void Scene23::run() { case kHS23Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -1340,11 +1340,11 @@ void Scene23::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1365,7 +1365,7 @@ void Scene23::run() { _vm->playGnapMoan2(0, 0); else { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS23LookCereals; } break; @@ -1375,7 +1375,7 @@ void Scene23::run() { else { _vm->_gnap->_idleFacing = kDirBottomRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, - 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); _vm->_gnap->_actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); @@ -1473,11 +1473,11 @@ void Scene23::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS23GrabCereals: - gameSys.setAnimation(0xBE, _vm->_gnapId, 0); - gameSys.insertSequence(0xBE, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xBE, _vm->_gnap->_id, 0); + gameSys.insertSequence(0xBE, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.requestRemoveSequence(0xBF, 2); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0xBE; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0xBE; _vm->_gnap->_actionStatus = kAS23GrabCerealsDone; break; case kAS23GrabCerealsDone: @@ -1600,7 +1600,7 @@ void Scene24::run() { case kHS24Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -1609,11 +1609,11 @@ void Scene24::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1638,7 +1638,7 @@ void Scene24::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); } @@ -1846,7 +1846,7 @@ void Scene25::run() { case kHS25Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -1855,11 +1855,11 @@ void Scene25::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1874,7 +1874,7 @@ void Scene25::run() { if (_vm->_grabCursorSpriteIndex == kItemTickets) { _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, - 0, _vm->getGnapSequenceId(gskIdle, 9, 4) | 0x10000, 1); + 0, _vm->_gnap->getSequenceId(gskIdle, 9, 4) | 0x10000, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1888,7 +1888,7 @@ void Scene25::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: @@ -2163,7 +2163,7 @@ void Scene26::run() { case kHS26Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -2172,11 +2172,11 @@ void Scene26::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2397,7 +2397,7 @@ void Scene27::run() { case kHS27Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -2406,11 +2406,11 @@ void Scene27::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2435,7 +2435,7 @@ void Scene27::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: @@ -2458,7 +2458,7 @@ void Scene27::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS27GrabBucket; break; case TALK_CURSOR: @@ -2768,7 +2768,7 @@ void Scene28::run() { case kHS28Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -2777,11 +2777,11 @@ void Scene28::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2803,7 +2803,7 @@ void Scene28::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28GrabHornSuccess; } } else { @@ -2852,7 +2852,7 @@ void Scene28::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(5, 8, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: @@ -2888,7 +2888,7 @@ void Scene28::run() { _vm->playGnapScratchingHead(8, 6); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: @@ -3000,9 +3000,9 @@ void Scene28::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS28GrabHornFailsDone: - gameSys.insertSequence(0x107B5, _vm->_gnapId, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + _vm->_gnap->_sequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; @@ -3056,12 +3056,12 @@ void Scene28::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case 0x119: - gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextClownSequenceId, 39, 0); gameSys.removeSequence(_currClownSequenceId, 39, true); _vm->_gnap->_actionStatus = kAS28GrabHornFailsDone; - _vm->_gnapSequenceId = _nextClownSequenceId; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = _nextClownSequenceId; + _vm->_gnap->_sequenceDatNum = 0; _nextClownSequenceId = -1; break; } @@ -3159,7 +3159,7 @@ void Scene29::run() { case kHS29Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -3168,11 +3168,11 @@ void Scene29::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -3186,7 +3186,7 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; @@ -3342,9 +3342,9 @@ void Scene29::updateAnimations() { if (gameSys.getAnimationStatus(4) == 2) { if (_nextMonkeySequenceId == 0xE5) { - gameSys.insertSequence(0xF2, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0xF2; + gameSys.insertSequence(0xF2, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0xF2; gameSys.setAnimation(0xE6, 159, 0); gameSys.setAnimation(0, 159, 4); gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 0698abb060..1a22a331f3 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -88,7 +88,7 @@ void Scene30::run() { case kHS30Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -97,11 +97,11 @@ void Scene30::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -221,23 +221,23 @@ void Scene30::updateAnimations() { break; case kAS30UsePillMachine: _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x105, _vm->_gnapId, 0); - gameSys.insertSequence(0x105, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x105; - _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x105, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x105, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x105; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS30UsePillMachine2; break; case kAS30UsePillMachine2: _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0x3F, 255); - gameSys.removeSequence(0x105, _vm->_gnapId, true); + gameSys.removeSequence(0x105, _vm->_gnap->_id, true); gameSys.setAnimation(0x102, 256, 0); gameSys.insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x103, _vm->_gnapId, 0); - gameSys.insertSequence(0x103, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x103, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x103, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->_gnap->_actionStatus = kAS30UsePillMachine3; @@ -245,10 +245,10 @@ void Scene30::updateAnimations() { _vm->setFlag(kGFUnk23); break; case kAS30UsePillMachine3: - gameSys.setAnimation(0x104, _vm->_gnapId, 0); - gameSys.insertSequence(0x104, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, 0x103), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x104; - _vm->_gnapSequenceDatNum = 0; + gameSys.setAnimation(0x104, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x104, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, 0x103), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x104; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = kAS30UsePillMachine4; _vm->setGrabCursorSprite(kItemDiceQuarterHole); break; @@ -343,7 +343,7 @@ void Scene31::run() { case kHS31Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->gnapUseJointOnPlatypus(); + _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapImpossible(0, 0); } else { @@ -352,11 +352,11 @@ void Scene31::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -393,7 +393,7 @@ void Scene31::run() { break; case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 1, 0x107C2, 1); @@ -413,7 +413,7 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_gnap->_pos, -1, _vm->getGnapSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->playGnapPullOutDevice(6, 8); @@ -543,11 +543,11 @@ void Scene31::updateAnimations() { break; case kAS31FillEmptyBucketWithBeer: gameSys.setAnimation(0x102, 59, 0); - gameSys.insertSequence(0x102, 59, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x102, 59, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_pos = Common::Point(5, 7); - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapSequenceId = 0x102; - _vm->_gnapId = 59; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x102; + _vm->_gnap->_id = 59; _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeerDone; break; case kAS31FillEmptyBucketWithBeerDone: @@ -701,11 +701,11 @@ void Scene32::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -877,11 +877,11 @@ void Scene33::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -899,14 +899,14 @@ void Scene33::run() { switch (_vm->_verbCursor) { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS33UseChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: @@ -1032,9 +1032,9 @@ void Scene33::updateAnimations() { _vm->_timers[2] = 100; break; case kAS33UseChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnapId, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceId = 0x7B5; - _vm->_gnapSequenceDatNum = 1; + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + _vm->_gnap->_sequenceId = 0x7B5; + _vm->_gnap->_sequenceDatNum = 1; _currChickenSequenceId = 0x7E; gameSys.setAnimation(0x7E, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); @@ -1050,7 +1050,7 @@ void Scene33::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x81) { gameSys.setAnimation(_nextChickenSequenceId, 179, 0); - gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; @@ -1154,11 +1154,11 @@ void Scene38::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -1286,43 +1286,43 @@ void Scene38::updateAnimations() { _vm->_sceneDone = true; break; case kAS38ExitCave: - gameSys.removeSequence(_vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, true); - gameSys.insertSequence(0xA3, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA3; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0xA3, _vm->_gnapId, 0); + gameSys.removeSequence(_vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, true); + gameSys.insertSequence(0xA3, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0xA3; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0xA3, _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS38LeaveScene; break; case kAS38UseHuntingTrophy: gameSys.removeSequence(0x9B, 0, true); - gameSys.insertSequence(0x9C, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9C; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x9C, _vm->_gnapId, 0); + gameSys.insertSequence(0x9C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x9C; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x9C, _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; updateHotspots(); break; case kAS38HoldingHuntingTrophy: if (_vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) _vm->_sceneWaiting = true; - if (_vm->_gnapSequenceId == 0xA4) { - gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9D; + if (_vm->_gnap->_sequenceId == 0xA4) { + gameSys.insertSequence(0x9D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x9D; } else { - gameSys.insertSequence(0xA4, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA4; + gameSys.insertSequence(0xA4, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0xA4; } - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(_vm->_gnapSequenceId, _vm->_gnapId, 0); + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(_vm->_gnap->_sequenceId, _vm->_gnap->_id, 0); break; case kAS38ReleaseHuntingTrophy: - if (_vm->_gnapSequenceId == 0x9E) { + if (_vm->_gnap->_sequenceId == 0x9E) { gameSys.insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnap->_actionStatus = -1; } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { - gameSys.insertSequence(0xA0, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0xA0; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0xA0, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0xA0; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(3, 6); _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->_isLeavingScene) { @@ -1334,33 +1334,33 @@ void Scene38::updateAnimations() { _vm->_gnap->_actionStatus = -1; } } else { - gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9E; - _vm->_gnapSequenceDatNum = 0; + gameSys.insertSequence(0x9E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x9E; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_pos = Common::Point(3, 6); _vm->_gnap->_idleFacing = kDirBottomRight; - gameSys.setAnimation(0x9E, _vm->_gnapId, 0); + gameSys.setAnimation(0x9E, _vm->_gnap->_id, 0); _vm->_sceneWaiting = false; updateHotspots(); } break; case kAS38UsePlatypusWithTrapDoor: _vm->_sceneWaiting = false; - gameSys.insertSequence(0x9F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9F; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x9F, _vm->_gnapId, 0); + gameSys.insertSequence(0x9F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x9F; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x9F, _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; if (_vm->_plat->_idleFacing != kDirNone) _vm->playPlatypusSequence(0x107D5); else _vm->playPlatypusSequence(0x107D4); _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); - gameSys.insertSequence(0xA1, _vm->_gnapId + 1, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xA1; - _vm->_platypusSequenceDatNum = 0; - _vm->_platypusId = _vm->_gnapId + 1; - gameSys.setAnimation(0xA1, _vm->_gnapId + 1, 1); + gameSys.insertSequence(0xA1, _vm->_gnap->_id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceId = 0xA1; + _vm->_plat->_sequenceDatNum = 0; + _vm->_plat->_id = _vm->_gnap->_id + 1; + gameSys.setAnimation(0xA1, _vm->_gnap->_id + 1, 1); _vm->_plat->_actionStatus = kAS38PlatypusHoldingTrapDoor; updateHotspots(); break; @@ -1370,9 +1370,9 @@ void Scene38::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { - gameSys.insertSequence(0xA2, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xA2; - _vm->_platypusSequenceDatNum = 0; + gameSys.insertSequence(0xA2, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceId = 0xA2; + _vm->_plat->_sequenceDatNum = 0; updateHotspots(); _vm->_sceneWaiting = true; } @@ -1460,11 +1460,11 @@ void Scene39::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 7ecaf23dd2..e4e29d92f6 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -83,11 +83,11 @@ void Scene40::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -263,13 +263,13 @@ void Scene41::run() { gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_gnapSequenceId = 0x120; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x120; + _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_pos = Common::Point(7, 7); - _vm->_gnapId = 140; + _vm->_gnap->_id = 140; gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->initPlatypusPos(8, 10, kDirBottomLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 45) { @@ -358,11 +358,11 @@ void Scene41::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -412,7 +412,7 @@ void Scene41::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(4, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(4, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: @@ -441,7 +441,7 @@ void Scene41::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 7, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(7, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -453,7 +453,7 @@ void Scene41::run() { case kHS41ToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { _vm->playGnapPullOutDevice(9, 0); - gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS41UseGumWithToyUfo; } break; @@ -468,11 +468,11 @@ void Scene41::run() { if (_vm->isFlag(kGFGnapControlsToyUFO)) { if (!_vm->_timers[9] && _vm->_gnap->_actionStatus < 0) { _vm->_gnap->_actionStatus = kAS41GiveBackToyUfo; - if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x122) { - gameSys.insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x123; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x123, _vm->_gnapId, 0); + if (_vm->_gnap->_sequenceId == 0x121 || _vm->_gnap->_sequenceId == 0x122) { + gameSys.insertSequence(0x123, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x123; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x123, _vm->_gnap->_id, 0); } } } @@ -482,24 +482,24 @@ void Scene41::run() { if (_vm->isFlag(kGFGnapControlsToyUFO)) { int sequenceId; if (_vm->_leftClickMouseX >= 400) { - if (_vm->_gnapSequenceId == 0x11F || _vm->_gnapSequenceId == 0x120 || _vm->_gnapSequenceId == 0x123 || _vm->_gnapSequenceId == 0x126) + if (_vm->_gnap->_sequenceId == 0x11F || _vm->_gnap->_sequenceId == 0x120 || _vm->_gnap->_sequenceId == 0x123 || _vm->_gnap->_sequenceId == 0x126) sequenceId = 0x120; else if (_vm->_leftClickMouseX - _vm->_toyUfoX >= 400) sequenceId = 0x126; else sequenceId = 0x123; } else { - if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x125 || _vm->_gnapSequenceId == 0x122) + if (_vm->_gnap->_sequenceId == 0x121 || _vm->_gnap->_sequenceId == 0x125 || _vm->_gnap->_sequenceId == 0x122) sequenceId = 0x122; else if (_vm->_toyUfoX - _vm->_leftClickMouseX >= 400) sequenceId = 0x125; else sequenceId = 0x121; } - gameSys.insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = sequenceId; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(sequenceId, _vm->_gnapId, 0); + gameSys.insertSequence(sequenceId, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = sequenceId; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(sequenceId, _vm->_gnap->_id, 0); _vm->_toyUfoActionStatus = kAS41ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { @@ -591,10 +591,10 @@ void Scene41::updateAnimations() { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x11F; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x11F, _vm->_gnapId, 0); + gameSys.insertSequence(0x11F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x11F; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x11F, _vm->_gnap->_id, 0); _nextKidSequenceId = 0x11A; gameSys.insertSequence(0x11A, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextKidSequenceId, 1, 4); @@ -611,10 +611,10 @@ void Scene41::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x110; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x110, _vm->_gnapId, 0); + gameSys.insertSequence(0x110, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x110; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x110, _vm->_gnap->_id, 0); _nextToyVendorSequenceId = 0x111; gameSys.insertSequence(0x111, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); @@ -634,12 +634,12 @@ void Scene41::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x124, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(0x124, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x124; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x124, _vm->_gnapId, 0); + _vm->_gnap->_sequenceId = 0x124; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x124, _vm->_gnap->_id, 0); _nextToyVendorSequenceId = 0x112; gameSys.insertSequence(0x112, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); @@ -870,11 +870,11 @@ void Scene42::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -923,7 +923,7 @@ void Scene42::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: @@ -1062,19 +1062,19 @@ void Scene42::updateAnimations() { _nextBBQVendorSequenceId = 0x146; } if (sequenceId == 0x7B7) { - gameSys.insertSequence(0x107B7, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(0x107B7, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceDatNum = 1; } else { - gameSys.insertSequence(sequenceId, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.insertSequence(sequenceId, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceDatNum = 0; } - _vm->_gnapSequenceId = sequenceId; - gameSys.setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); + _vm->_gnap->_sequenceId = sequenceId; + gameSys.setAnimation(sequenceId | (_vm->_gnap->_sequenceDatNum << 16), _vm->_gnap->_id, 0); if (_vm->_gnap->_actionStatus == kAS42UseQuarterWithBBQVendor) _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendorDone; else @@ -1328,11 +1328,11 @@ void Scene43::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -1376,7 +1376,7 @@ void Scene43::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(5, 8, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(5, 8, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -1492,10 +1492,10 @@ void Scene43::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x13D; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x13D, _vm->_gnapId, 0); + gameSys.insertSequence(0x13D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x13D; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x13D, _vm->_gnap->_id, 0); _nextTwoHeadedGuySequenceId = 0x13B; gameSys.insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); @@ -1702,10 +1702,10 @@ void Scene44::run() { _vm->_timers[0] = 50; _vm->_timers[1] = 20; _vm->_plat->_pos = Common::Point(5, 8); - _vm->_platypusSequenceId = 0xFD; + _vm->_plat->_sequenceId = 0xFD; _vm->_plat->_idleFacing = kDirNone; - _vm->_platypusId = 160; - _vm->_platypusSequenceDatNum = 0; + _vm->_plat->_id = 160; + _vm->_plat->_sequenceDatNum = 0; gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); } _vm->endSceneInit(); @@ -1776,11 +1776,11 @@ void Scene44::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -1827,11 +1827,11 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case PLAT_CURSOR: - _vm->gnapUseDeviceOnPlatypus(); + _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(6, 7, 1, 0x107D2, 1); if (_vm->_gnap->_pos == Common::Point(7, 7)) _vm->gnapWalkStep(); @@ -1881,7 +1881,7 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, -1, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -1998,10 +1998,10 @@ void Scene44::updateAnimations() { switch (_vm->_plat->_actionStatus) { case 4: if (gameSys.getAnimationStatus(2) == 2) { - gameSys.insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); - _vm->_platypusSequenceId = 0xFE; - _vm->_platypusSequenceDatNum = 0; - gameSys.setAnimation(0xFE, _vm->_platypusId, 1); + gameSys.insertSequence(0xFE, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + _vm->_plat->_sequenceId = 0xFE; + _vm->_plat->_sequenceDatNum = 0; + gameSys.setAnimation(0xFE, _vm->_plat->_id, 1); gameSys.removeSequence(_currKissingLadySequenceId, 1, true); _vm->_plat->_actionStatus = 5; } @@ -2141,12 +2141,12 @@ void Scene45::run() { gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->isFlag(kGFUnk22)) { - _vm->_gnapSequenceId = 0x9E; - _vm->_gnapSequenceDatNum = 0; - _vm->_gnapId = 1; + _vm->_gnap->_sequenceId = 0x9E; + _vm->_gnap->_sequenceDatNum = 0; + _vm->_gnap->_id = 1; gameSys.setAnimation(0x9E, 1, 0); _vm->_gnap->_actionStatus = 1; - gameSys.insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_vm->_gnap->_sequenceId, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); _vm->initPlatypusPos(4, 8, kDirNone); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { @@ -2172,8 +2172,8 @@ void Scene45::run() { if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->setFlag(kGFUnk21); _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x9D, _vm->_gnapId, 0); - gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x9D, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x9D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) { _vm->gameUpdateTick(); if (gameSys.getAnimationStatus(2) == 2) { @@ -2190,26 +2190,26 @@ void Scene45::run() { gameSys.setAnimation(0x99, 1, 4); } } - _vm->_gnapSequenceId = 0x9D; - _vm->_gnapSequenceDatNum = 0; + _vm->_gnap->_sequenceId = 0x9D; + _vm->_gnap->_sequenceDatNum = 0; _vm->hideCursor(); _vm->addFullScreenSprite(0x8A, 255); gameSys.setAnimation(0xA0, 256, 0); gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x107BD, _vm->_gnapId, 0); - gameSys.insertSequence(0x107BD, _vm->_gnapId, - makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, + gameSys.setAnimation(0x107BD, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x107BD, _vm->_gnap->_id, + makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); _vm->removeFullScreenSprite(); _vm->showCursor(); - _vm->_gnapSequenceId = 0x7BD; - _vm->_gnapSequenceDatNum = 1; + _vm->_gnap->_sequenceId = 0x7BD; + _vm->_gnap->_sequenceDatNum = 1; } _vm->playPlatypusSequence(0x9A); - gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094A)) @@ -2265,13 +2265,13 @@ void Scene45::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); _vm->playPlatypusSequence(0x9A); - gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -2391,10 +2391,10 @@ void Scene45::updateAnimations() { _vm->_sceneWaiting = true; _vm->setFlag(kGFUnk22); updateHotspots(); - gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - _vm->_gnapSequenceId = 0x9E; - _vm->_gnapSequenceDatNum = 0; - gameSys.setAnimation(0x9E, _vm->_gnapId, 0); + gameSys.insertSequence(0x9E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + _vm->_gnap->_sequenceId = 0x9E; + _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x9E, _vm->_gnap->_id, 0); break; default: _vm->_gnap->_actionStatus = -1; @@ -2408,7 +2408,7 @@ void Scene45::updateAnimations() { _vm->playPlatypusSequence(0x9B); else _vm->playPlatypusSequence(0x9C); - gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); } if (gameSys.getAnimationStatus(2) == 2) { @@ -2590,11 +2590,11 @@ void Scene46::run() { _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapKissPlatypus(0); + _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->getPlatypusSequenceId()); + _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -2614,7 +2614,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -2635,7 +2635,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 0, _vm->getGnapSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case GRAB_CURSOR: -- cgit v1.2.3 From 00c544f9f815be3121b900ff16572676ee6c4bf5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 May 2016 10:28:58 +0200 Subject: GNAP: More refactoring related to characters (WIP) --- engines/gnap/character.cpp | 234 ++++++++++++++++++++++------------------- engines/gnap/character.h | 5 +- engines/gnap/gnap.cpp | 81 ++++++-------- engines/gnap/gnap.h | 2 - engines/gnap/scenes/group0.cpp | 30 +++--- engines/gnap/scenes/group1.cpp | 22 ++-- engines/gnap/scenes/group2.cpp | 20 ++-- engines/gnap/scenes/group3.cpp | 16 +-- engines/gnap/scenes/group4.cpp | 22 ++-- 9 files changed, 217 insertions(+), 215 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 8b6ea803c0..c8970a41f4 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -38,8 +38,8 @@ Character::Character(GnapEngine *vm) : _vm(vm) { Character::~Character() {} PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) { - _gnapBrainPulseNum = 0; - _gnapBrainPulseRndValue = 0; + _brainPulseNum = 0; + _brainPulseRndValue = 0; } int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { @@ -67,18 +67,18 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { } } else { switch (_idleFacing) { - case kDirBottomRight: - sequenceId = 0x839; - break; - case kDirBottomLeft: - sequenceId = 0x83B; - break; - case kDirUpRight: - sequenceId = 0x83D; - break; - default: - sequenceId = 0x83F; - break; + case kDirBottomRight: + sequenceId = 0x839; + break; + case kDirBottomLeft: + sequenceId = 0x83B; + break; + case kDirUpRight: + sequenceId = 0x83D; + break; + default: + sequenceId = 0x83F; + break; } } break; @@ -104,18 +104,18 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { } } else { switch (_idleFacing) { - case kDirBottomRight: - sequenceId = 0x826; - break; - case kDirBottomLeft: - sequenceId = 0x827; - break; - case kDirUpRight: - sequenceId = 0x828; - break; - default: - sequenceId = 0x829; - break; + case kDirBottomRight: + sequenceId = 0x826; + break; + case kDirBottomLeft: + sequenceId = 0x827; + break; + case kDirUpRight: + sequenceId = 0x828; + break; + default: + sequenceId = 0x829; + break; } } break; @@ -141,22 +141,22 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { } } else { switch (_idleFacing) { - case kDirBottomRight: - sequenceId = 0x833; - _idleFacing = kDirBottomRight; - break; - case kDirBottomLeft: - sequenceId = 0x834; - _idleFacing = kDirBottomLeft; - break; - case kDirUpRight: - sequenceId = 0x885; - _idleFacing = kDirUpRight; - break; - default: - sequenceId = 0x834; - _idleFacing = kDirBottomLeft; - break; + case kDirBottomRight: + sequenceId = 0x833; + _idleFacing = kDirBottomRight; + break; + case kDirBottomLeft: + sequenceId = 0x834; + _idleFacing = kDirBottomLeft; + break; + case kDirUpRight: + sequenceId = 0x885; + _idleFacing = kDirUpRight; + break; + default: + sequenceId = 0x834; + _idleFacing = kDirBottomLeft; + break; } } break; @@ -182,56 +182,56 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { } } else { switch (_idleFacing) { - case kDirBottomRight: - sequenceId = 0x7B9; - break; - case kDirBottomLeft: - sequenceId = 0x7BA; - break; - case kDirUpRight: - sequenceId = 0x7BB; - break; - default: - sequenceId = 0x7BC; - break; + case kDirBottomRight: + sequenceId = 0x7B9; + break; + case kDirBottomLeft: + sequenceId = 0x7BA; + break; + case kDirUpRight: + sequenceId = 0x7BB; + break; + default: + sequenceId = 0x7BC; + break; } } break; case gskBrainPulsating: - _gnapBrainPulseNum = (_gnapBrainPulseNum + 1) & 1; + _brainPulseNum = (_brainPulseNum + 1) & 1; if (gridX > 0 && gridY > 0) { if (_pos.y > gridY) { if (_pos.x > gridX) { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x812; _idleFacing = kDirUpLeft; } else { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x7FE; _idleFacing = kDirUpRight; } } else { if (_pos.x > gridX) { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x7D6; _idleFacing = kDirBottomLeft; } else { - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x7EA; _idleFacing = kDirBottomRight; } } } else { switch (_idleFacing) { - case kDirBottomRight: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7EA; - break; - case kDirBottomLeft: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7D6; - break; - case kDirUpRight: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x7FE; - break; - default: - sequenceId = _gnapBrainPulseRndValue + _gnapBrainPulseNum + 0x812; - break; + case kDirBottomRight: + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x7EA; + break; + case kDirBottomLeft: + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x7D6; + break; + case kDirUpRight: + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x7FE; + break; + default: + sequenceId = _brainPulseRndValue + _brainPulseNum + 0x812; + break; } } break; @@ -291,42 +291,42 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { } } else { switch (_idleFacing) { - case kDirBottomRight: - sequenceId = 0x7A7; - break; - case kDirBottomLeft: - sequenceId = 0x82E; - break; - case kDirUpLeft: - sequenceId = 0x830; - break; - case kDirUpRight: - sequenceId = 0x82F; - break; - case kDirNone: - case kDirUnk4: - break; + case kDirBottomRight: + sequenceId = 0x7A7; + break; + case kDirBottomLeft: + sequenceId = 0x82E; + break; + case kDirUpLeft: + sequenceId = 0x830; + break; + case kDirUpRight: + sequenceId = 0x82F; + break; + case kDirNone: + case kDirUnk4: + break; } } break; case gskUseDevice: switch (_idleFacing) { - case kDirBottomRight: - sequenceId = 0x83A; - break; - case kDirBottomLeft: - sequenceId = 0x83C; - break; - case kDirUpLeft: - sequenceId = 0x840; - break; - case kDirUpRight: - sequenceId = 0x83E; - break; - case kDirNone: - case kDirUnk4: - break; + case kDirBottomRight: + sequenceId = 0x83A; + break; + case kDirBottomLeft: + sequenceId = 0x83C; + break; + case kDirUpLeft: + sequenceId = 0x840; + break; + case kDirUpRight: + sequenceId = 0x83E; + break; + case kDirNone: + case kDirUnk4: + break; } break; @@ -407,7 +407,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_sequenceId = 0x876; _vm->_plat->_idleFacing = kDirNone; - _vm->playGnapSequence(0x107B5); + _vm->_gnap->playSequence(0x107B5); _vm->gnapWalkStep(); while (_vm->_gameSys->getAnimationStatus(0) != 2) { _vm->updateMouseCursor(); @@ -416,7 +416,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - _vm->playGnapSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + _vm->_gnap->playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); } } @@ -436,7 +436,7 @@ void PlayerGnap::kissPlatypus(int callback) { _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_sequenceId = 0x7CB; _vm->_plat->_idleFacing = kDirNone; - _vm->playGnapSequence(0x107B5); + _vm->_gnap->playSequence(0x107B5); while (_vm->_gameSys->getAnimationStatus(0) != 2) { _vm->updateMouseCursor(); _vm->doCallback(callback); @@ -445,12 +445,12 @@ void PlayerGnap::kissPlatypus(int callback) { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - _vm->playGnapSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + _vm->_gnap->playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); } } void PlayerGnap::useDeviceOnPlatypus() { - _vm->playGnapSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos.x, _vm->_plat->_pos.y))); + _vm->_gnap->playSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos.x, _vm->_plat->_pos.y))); if (_vm->_plat->_idleFacing != kDirNone) { _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), _vm->_plat->_id, @@ -475,7 +475,18 @@ void PlayerGnap::useDeviceOnPlatypus() { } void PlayerGnap::initBrainPulseRndValue() { - _gnapBrainPulseRndValue = 2 * _vm->getRandom(10); + _brainPulseRndValue = 2 * _vm->getRandom(10); +} + +void PlayerGnap::playSequence(int sequenceId) { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 300; + _vm->gnapIdle(); + _vm->_gameSys->insertSequence(sequenceId, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + _sequenceId = ridToEntryIndex(sequenceId); + _sequenceDatNum = ridToDatIndex(sequenceId); } /************************************************************************************************/ @@ -495,4 +506,13 @@ int PlayerPlat::getSequenceId(int kind, int gridX, int gridY) { return sequenceId | 0x10000; } + +void PlayerPlat::playSequence(int sequenceId) { + _vm->_gameSys->insertSequence(sequenceId, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _vm->_platGridX, 48 * _pos.y - _vm->_platGridY); + _sequenceId = ridToEntryIndex(sequenceId); + _sequenceDatNum = ridToDatIndex(sequenceId); +} + } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 1a05548bae..faf1d775a2 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -42,6 +42,7 @@ public: ~Character(); virtual int getSequenceId(int kind, int gridX, int gridY) = 0; + virtual void playSequence(int sequenceId) = 0; Common::Point _pos; Facing _idleFacing; @@ -58,19 +59,21 @@ class PlayerGnap : public Character { public: PlayerGnap(GnapEngine *vm); virtual int getSequenceId(int kind, int gridX, int gridY); + virtual void playSequence(int sequenceId); void initBrainPulseRndValue(); void kissPlatypus(int callback); void useDeviceOnPlatypus(); void useJointOnPlatypus(); - int _gnapBrainPulseNum, _gnapBrainPulseRndValue; + int _brainPulseNum, _brainPulseRndValue; }; class PlayerPlat : public Character { public: PlayerPlat(GnapEngine *vm); virtual int getSequenceId(int kind = 0, int gridX = 0, int gridY = 0); + virtual void playSequence(int sequenceId); }; } // End of namespace Gnap diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index c020d752b6..818ac89c4d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1146,55 +1146,44 @@ void GnapEngine::gnapActionIdle(int sequenceId) { } } -void GnapEngine::playGnapSequence(int sequenceId) { - _timers[2] = getRandom(30) + 20; - _timers[3] = 300; - gnapIdle(); - _gameSys->insertSequence(sequenceId, _gnap->_id, - makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqScale | kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnap->_sequenceId = ridToEntryIndex(sequenceId); - _gnap->_sequenceDatNum = ridToDatIndex(sequenceId); -} - void GnapEngine::playGnapImpossible(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskImpossible, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskImpossible, gridX, gridY) | 0x10000); } void GnapEngine::playGnapScratchingHead(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); } void GnapEngine::playGnapMoan1(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskMoan1, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskMoan1, gridX, gridY) | 0x10000); } void GnapEngine::playGnapMoan2(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskMoan2, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskMoan2, gridX, gridY) | 0x10000); } void GnapEngine::playGnapBrainPulsating(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); } void GnapEngine::playGnapPullOutDevice(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); } void GnapEngine::playGnapPullOutDeviceNonWorking(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); } void GnapEngine::playGnapUseDevice(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskUseDevice, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskUseDevice, gridX, gridY) | 0x10000); } void GnapEngine::playGnapIdle(int gridX, int gridY) { - playGnapSequence(_gnap->getSequenceId(gskIdle, gridX, gridY) | 0x10000); + _gnap->playSequence(_gnap->getSequenceId(gskIdle, gridX, gridY) | 0x10000); } void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { - playGnapSequence(getGnapShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); + _gnap->playSequence(getGnapShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); } void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { @@ -1213,23 +1202,23 @@ void GnapEngine::updateGnapIdleSequence() { if (_gnap->_idleFacing == kDirBottomRight) { switch (getRandom(5)) { case 0: - playGnapSequence(0x107A6); + _gnap->playSequence(0x107A6); break; case 1: - playGnapSequence(0x107AA); + _gnap->playSequence(0x107AA); break; case 2: - playGnapSequence(0x10841); + _gnap->playSequence(0x10841); break; default: - playGnapSequence(0x108A2); + _gnap->playSequence(0x108A2); break; } } else if (_gnap->_idleFacing == kDirBottomLeft) { if (getRandom(5) > 2) - playGnapSequence(0x10832); + _gnap->playSequence(0x10832); else - playGnapSequence(0x10842); + _gnap->playSequence(0x10842); } } } else { @@ -1261,9 +1250,9 @@ void GnapEngine::updateGnapIdleSequence2() { _timers[2] = 60; _timers[3] = 300; if (_gnap->_idleFacing == kDirBottomRight) { - playGnapSequence(0x107AA); + _gnap->playSequence(0x107AA); } else if (_gnap->_idleFacing == kDirBottomLeft) { - playGnapSequence(0x10832); + _gnap->playSequence(0x10832); } } } else { @@ -1350,7 +1339,7 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in _gameSys->setAnimation(0, 0, 0); if (_gnap->_pos == Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY)) { _gameSys->setAnimation(platSequenceId, _plat->_id, 1); - playPlatypusSequence(platSequenceId); + _plat->playSequence(platSequenceId); while (_gameSys->getAnimationStatus(1) != 2) { updateMouseCursor(); doCallback(callback); @@ -1366,7 +1355,7 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in void GnapEngine::gnapUseDisguiseOnPlatypus() { _gameSys->setAnimation(0x10846, _gnap->_id, 0); - playGnapSequence(0x10846); + _gnap->playSequence(0x10846); while (_gameSys->getAnimationStatus(0) != 2) gameUpdateTick(); _newSceneNum = 47; @@ -1375,14 +1364,6 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { setFlag(kGFPlatypusDisguised); } -void GnapEngine::playPlatypusSequence(int sequenceId) { - _gameSys->insertSequence(sequenceId, _plat->_id, - makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, - kSeqScale | kSeqSyncWait, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); - _plat->_sequenceId = ridToEntryIndex(sequenceId); - _plat->_sequenceDatNum = ridToDatIndex(sequenceId); -} - void GnapEngine::updatePlatypusIdleSequence() { if (_plat->_actionStatus < 0 && _gnap->_actionStatus < 0) { if (_timers[0] > 0) { @@ -1392,23 +1373,23 @@ void GnapEngine::updatePlatypusIdleSequence() { if (_plat->_idleFacing != kDirNone) { if (rnd != 0 || _plat->_sequenceId != 0x7CA) { if (rnd != 1 || _plat->_sequenceId != 0x7CA) - playPlatypusSequence(0x107CA); + _plat->playSequence(0x107CA); else - playPlatypusSequence(0x10845); + _plat->playSequence(0x10845); } else { - playPlatypusSequence(0x107CC); + _plat->playSequence(0x107CC); } } else if (rnd != 0 || _plat->_sequenceId != 0x7C9) { if (rnd != 1 || _plat->_sequenceId != 0x7C9) { if (rnd != 2 || _plat->_sequenceId != 0x7C9) - playPlatypusSequence(0x107C9); + _plat->playSequence(0x107C9); else - playPlatypusSequence(0x108A4); + _plat->playSequence(0x108A4); } else { - playPlatypusSequence(0x10844); + _plat->playSequence(0x10844); } } else { - playPlatypusSequence(0x107CB); + _plat->playSequence(0x107CB); } } } else { @@ -1428,14 +1409,14 @@ void GnapEngine::updatePlatypusIdleSequence2() { _timers[1] = getRandom(20) + 30; if (_plat->_idleFacing != kDirNone) { if (getRandom(10) >= 2 || _plat->_sequenceId != 0x7CA) - playPlatypusSequence(0x107CA); + _plat->playSequence(0x107CA); else - playPlatypusSequence(0x107CC); + _plat->playSequence(0x107CC); } else { if (getRandom(10) >= 2 || _plat->_sequenceId != 0x7C9) { - playPlatypusSequence(0x107C9); + _plat->playSequence(0x107C9); } else { - playPlatypusSequence(0x107CB); + _plat->playSequence(0x107CB); } } } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 4474a2d564..fdf47a2c40 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -519,7 +519,6 @@ public: int getGnapShowSequenceId(int index, int gridX, int gridY); void gnapIdle(); void gnapActionIdle(int sequenceId); - void playGnapSequence(int sequenceId); void playGnapImpossible(int gridX, int gridY); void playGnapScratchingHead(int gridX, int gridY); void playGnapMoan1(int gridX, int gridY); @@ -539,7 +538,6 @@ public: void gnapUseDisguiseOnPlatypus(); // Platypus - void playPlatypusSequence(int sequenceId); void updatePlatypusIdleSequence(); void updatePlatypusIdleSequence2(); void initPlatypusPos(int gridX, int gridY, Facing facing); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 419139fc9e..9690d6932f 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -140,7 +140,7 @@ void Scene01::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -490,7 +490,7 @@ void Scene02::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -955,7 +955,7 @@ void Scene03::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1462,7 +1462,7 @@ void Scene04::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1934,7 +1934,7 @@ void Scene05::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2358,7 +2358,7 @@ void Scene06::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2729,7 +2729,7 @@ void Scene07::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -2812,22 +2812,22 @@ void Scene07::run() { if (gnapRandomValue != 0 || _vm->_plat->_sequenceId != 0x7CA) { if (gnapRandomValue != 1 || _vm->_plat->_sequenceId != 0x7CA) { if (_vm->_plat->_pos.y == 9) - _vm->playPlatypusSequence(0x107CA); + _vm->_plat->playSequence(0x107CA); } else { - _vm->playPlatypusSequence(0x10845); + _vm->_plat->playSequence(0x10845); } } else { - _vm->playPlatypusSequence(0x107CC); + _vm->_plat->playSequence(0x107CC); } } else if (gnapRandomValue != 0 || _vm->_plat->_sequenceId != 0x7C9) { if (gnapRandomValue != 1 || _vm->_plat->_sequenceId != 0x7C9) { if (_vm->_plat->_pos.y == 9) - _vm->playPlatypusSequence(0x107C9); + _vm->_plat->playSequence(0x107C9); } else { - _vm->playPlatypusSequence(0x10844); + _vm->_plat->playSequence(0x10844); } } else { - _vm->playPlatypusSequence(0x107CB); + _vm->_plat->playSequence(0x107CB); } gameSys.setAnimation(_vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, 1); } @@ -3000,7 +3000,7 @@ void Scene08::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -3429,7 +3429,7 @@ void Scene09::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 5cad36d393..cbc1f704ec 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -121,7 +121,7 @@ void Scene10::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -257,7 +257,7 @@ void Scene10::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 10, 5) | 0x10000); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 10, 5) | 0x10000); break; case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); @@ -602,7 +602,7 @@ void Scene11::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -671,7 +671,7 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 3, 6) | 0x10000); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 3, 6) | 0x10000); break; case GRAB_CURSOR: _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); @@ -1021,7 +1021,7 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -1530,7 +1530,7 @@ void Scene13::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: break; @@ -1628,7 +1628,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 9, 6)); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 9, 6)); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; @@ -1650,7 +1650,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapSequence(_vm->_gnap->getSequenceId(gskDeflect, 5, 9)); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 5, 9)); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; @@ -2549,7 +2549,7 @@ void Scene17::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -3449,7 +3449,7 @@ void Scene18::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -4155,7 +4155,7 @@ void Scene19::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 0a8d6041b6..145d0ee924 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -286,7 +286,7 @@ void Scene20::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -804,7 +804,7 @@ void Scene21::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1120,7 +1120,7 @@ void Scene22::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1344,7 +1344,7 @@ void Scene23::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1613,7 +1613,7 @@ void Scene24::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1859,7 +1859,7 @@ void Scene25::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2176,7 +2176,7 @@ void Scene26::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2410,7 +2410,7 @@ void Scene27::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -2781,7 +2781,7 @@ void Scene28::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -3172,7 +3172,7 @@ void Scene29::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 1a22a331f3..ec17be422e 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -101,7 +101,7 @@ void Scene30::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -356,7 +356,7 @@ void Scene31::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -705,7 +705,7 @@ void Scene32::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -881,7 +881,7 @@ void Scene33::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -1158,7 +1158,7 @@ void Scene38::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -1352,9 +1352,9 @@ void Scene38::updateAnimations() { gameSys.setAnimation(0x9F, _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; if (_vm->_plat->_idleFacing != kDirNone) - _vm->playPlatypusSequence(0x107D5); + _vm->_plat->playSequence(0x107D5); else - _vm->playPlatypusSequence(0x107D4); + _vm->_plat->playSequence(0x107D4); _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); gameSys.insertSequence(0xA1, _vm->_gnap->_id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceId = 0xA1; @@ -1464,7 +1464,7 @@ void Scene39::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index e4e29d92f6..9d731c0b9f 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -87,7 +87,7 @@ void Scene40::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -362,7 +362,7 @@ void Scene41::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -874,7 +874,7 @@ void Scene42::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -1332,7 +1332,7 @@ void Scene43::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -1780,7 +1780,7 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -2208,7 +2208,7 @@ void Scene45::run() { _vm->_gnap->_sequenceDatNum = 1; } - _vm->playPlatypusSequence(0x9A); + _vm->_plat->playSequence(0x9A); gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); while (!_vm->_sceneDone) { @@ -2266,12 +2266,12 @@ void Scene45::run() { break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); - _vm->playPlatypusSequence(0x9A); + _vm->_plat->playSequence(0x9A); gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); @@ -2405,9 +2405,9 @@ void Scene45::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); if (_vm->getRandom(2) != 0) - _vm->playPlatypusSequence(0x9B); + _vm->_plat->playSequence(0x9B); else - _vm->playPlatypusSequence(0x9C); + _vm->_plat->playSequence(0x9C); gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); } @@ -2594,7 +2594,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->playPlatypusSequence(_vm->_plat->getSequenceId()); + _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); -- cgit v1.2.3 From 45f27ea81c4aa3a4fbfa356a51f6b141447158d0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 May 2016 11:58:10 +0200 Subject: GNAP: Even more refactoring related to characters (WIP) --- engines/gnap/character.cpp | 150 +++++++++++++++++++++++++++++++++++++++++ engines/gnap/character.h | 6 ++ engines/gnap/gnap.cpp | 150 ----------------------------------------- engines/gnap/gnap.h | 4 -- engines/gnap/scenes/group0.cpp | 34 +++++----- engines/gnap/scenes/group1.cpp | 28 ++++---- engines/gnap/scenes/group2.cpp | 40 +++++------ engines/gnap/scenes/group3.cpp | 24 +++---- engines/gnap/scenes/group4.cpp | 22 +++--- 9 files changed, 230 insertions(+), 228 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index c8970a41f4..c72f6337fa 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -489,6 +489,90 @@ void PlayerGnap::playSequence(int sequenceId) { _sequenceDatNum = ridToDatIndex(sequenceId); } +void PlayerGnap::updateIdleSequence() { + if (_actionStatus < 0) { + if (_vm->_timers[2] > 0) { + if (_vm->_timers[3] == 0) { + _vm->_timers[2] = 60; + _vm->_timers[3] = 300; + if (_idleFacing == kDirBottomRight) { + switch (_vm->getRandom(5)) { + case 0: + playSequence(0x107A6); + break; + case 1: + playSequence(0x107AA); + break; + case 2: + playSequence(0x10841); + break; + default: + playSequence(0x108A2); + break; + } + } else if (_idleFacing == kDirBottomLeft) { + if (_vm->getRandom(5) > 2) + playSequence(0x10832); + else + playSequence(0x10842); + } + } + } else { + _vm->_timers[2] = _vm->getRandom(30) + 20; + if (_idleFacing == kDirBottomRight) { + _vm->_gameSys->insertSequence(0x107BD, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + _sequenceId = 0x7BD; + _sequenceDatNum = 1; + } else if (_idleFacing == kDirBottomLeft) { + _vm->_gameSys->insertSequence(0x107BE, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + _sequenceId = 0x7BE; + _sequenceDatNum = 1; + } + } + } else { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 300; + } +} + +void PlayerGnap::updateIdleSequence2() { + if (_actionStatus < 0) { + if (_vm->_timers[2] > 0) { + if (_vm->_timers[3] == 0) { + _vm->_timers[2] = 60; + _vm->_timers[3] = 300; + if (_idleFacing == kDirBottomRight) { + playSequence(0x107AA); + } else if (_idleFacing == kDirBottomLeft) { + playSequence(0x10832); + } + } + } else { + _vm->_timers[2] = _vm->getRandom(30) + 20; + if (_idleFacing == kDirBottomRight) { + _vm->_gameSys->insertSequence(0x107BD, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + _sequenceId = 0x7BD; + _sequenceDatNum = 1; + } else if (_idleFacing == kDirBottomLeft) { + _vm->_gameSys->insertSequence(0x107BE, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + _sequenceId = 0x7BE; + _sequenceDatNum = 1; + } + } + } else { + _vm->_timers[2] = _vm->getRandom(30) + 20; + _vm->_timers[3] = 300; + } +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} @@ -515,4 +599,70 @@ void PlayerPlat::playSequence(int sequenceId) { _sequenceDatNum = ridToDatIndex(sequenceId); } +void PlayerPlat::updateIdleSequence() { + if (_actionStatus < 0 && _vm->_gnap->_actionStatus < 0) { + if (_vm->_timers[0] > 0) { + if (_vm->_timers[1] == 0) { + _vm->_timers[1] = _vm->getRandom(20) + 30; + int rnd = _vm->getRandom(10); + if (_idleFacing != kDirNone) { + if (rnd != 0 || _sequenceId != 0x7CA) { + if (rnd != 1 || _sequenceId != 0x7CA) + playSequence(0x107CA); + else + playSequence(0x10845); + } else { + playSequence(0x107CC); + } + } else if (rnd != 0 || _sequenceId != 0x7C9) { + if (rnd != 1 || _sequenceId != 0x7C9) { + if (rnd != 2 || _sequenceId != 0x7C9) + playSequence(0x107C9); + else + playSequence(0x108A4); + } else { + playSequence(0x10844); + } + } else { + playSequence(0x107CB); + } + } + } else { + _vm->_timers[0] = _vm->getRandom(75) + 75; + _vm->platypusMakeRoom(); + } + } else { + _vm->_timers[0] = 100; + _vm->_timers[1] = 35; + } +} + +void PlayerPlat::updateIdleSequence2() { + if (_actionStatus < 0 && _vm->_gnap->_actionStatus < 0) { + if (_vm->_timers[0]) { + if (!_vm->_timers[1]) { + _vm->_timers[1] = _vm->getRandom(20) + 30; + if (_idleFacing != kDirNone) { + if (_vm->getRandom(10) >= 2 || _sequenceId != 0x7CA) + playSequence(0x107CA); + else + playSequence(0x107CC); + } else { + if (_vm->getRandom(10) >= 2 || _sequenceId != 0x7C9) { + playSequence(0x107C9); + } else { + playSequence(0x107CB); + } + } + } + } else { + _vm->_timers[0] = _vm->getRandom(75) + 75; + _vm->platypusMakeRoom(); + } + } else { + _vm->_timers[0] = 100; + _vm->_timers[1] = 35; + } +} + } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index faf1d775a2..5e7d6ee3e5 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -43,6 +43,8 @@ public: virtual int getSequenceId(int kind, int gridX, int gridY) = 0; virtual void playSequence(int sequenceId) = 0; + virtual void updateIdleSequence() = 0; + virtual void updateIdleSequence2() = 0; Common::Point _pos; Facing _idleFacing; @@ -60,6 +62,8 @@ public: PlayerGnap(GnapEngine *vm); virtual int getSequenceId(int kind, int gridX, int gridY); virtual void playSequence(int sequenceId); + virtual void updateIdleSequence(); + virtual void updateIdleSequence2(); void initBrainPulseRndValue(); void kissPlatypus(int callback); @@ -74,6 +78,8 @@ public: PlayerPlat(GnapEngine *vm); virtual int getSequenceId(int kind = 0, int gridX = 0, int gridY = 0); virtual void playSequence(int sequenceId); + virtual void updateIdleSequence(); + virtual void updateIdleSequence2(); }; } // End of namespace Gnap diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 818ac89c4d..f72b7c6af3 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1193,90 +1193,6 @@ void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int g playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); } -void GnapEngine::updateGnapIdleSequence() { - if (_gnap->_actionStatus < 0) { - if (_timers[2] > 0) { - if (_timers[3] == 0) { - _timers[2] = 60; - _timers[3] = 300; - if (_gnap->_idleFacing == kDirBottomRight) { - switch (getRandom(5)) { - case 0: - _gnap->playSequence(0x107A6); - break; - case 1: - _gnap->playSequence(0x107AA); - break; - case 2: - _gnap->playSequence(0x10841); - break; - default: - _gnap->playSequence(0x108A2); - break; - } - } else if (_gnap->_idleFacing == kDirBottomLeft) { - if (getRandom(5) > 2) - _gnap->playSequence(0x10832); - else - _gnap->playSequence(0x10842); - } - } - } else { - _timers[2] = getRandom(30) + 20; - if (_gnap->_idleFacing == kDirBottomRight) { - _gameSys->insertSequence(0x107BD, _gnap->_id, - makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnap->_sequenceId = 0x7BD; - _gnap->_sequenceDatNum = 1; - } else if (_gnap->_idleFacing == kDirBottomLeft) { - _gameSys->insertSequence(0x107BE, _gnap->_id, - makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnap->_sequenceId = 0x7BE; - _gnap->_sequenceDatNum = 1; - } - } - } else { - _timers[2] = getRandom(30) + 20; - _timers[3] = 300; - } -} - -void GnapEngine::updateGnapIdleSequence2() { - if (_gnap->_actionStatus < 0) { - if (_timers[2] > 0) { - if (_timers[3] == 0) { - _timers[2] = 60; - _timers[3] = 300; - if (_gnap->_idleFacing == kDirBottomRight) { - _gnap->playSequence(0x107AA); - } else if (_gnap->_idleFacing == kDirBottomLeft) { - _gnap->playSequence(0x10832); - } - } - } else { - _timers[2] = getRandom(30) + 20; - if (_gnap->_idleFacing == kDirBottomRight) { - _gameSys->insertSequence(0x107BD, _gnap->_id, - makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnap->_sequenceId = 0x7BD; - _gnap->_sequenceDatNum = 1; - } else if (_gnap->_idleFacing == kDirBottomLeft) { - _gameSys->insertSequence(0x107BE, _gnap->_id, - makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncWait, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); - _gnap->_sequenceId = 0x7BE; - _gnap->_sequenceDatNum = 1; - } - } - } else { - _timers[2] = getRandom(30) + 20; - _timers[3] = 300; - } -} - bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2) { if (_mouseClickState._left && someStatus == _gnap->_actionStatus) { _isLeavingScene = false; @@ -1364,72 +1280,6 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { setFlag(kGFPlatypusDisguised); } -void GnapEngine::updatePlatypusIdleSequence() { - if (_plat->_actionStatus < 0 && _gnap->_actionStatus < 0) { - if (_timers[0] > 0) { - if (_timers[1] == 0) { - _timers[1] = getRandom(20) + 30; - int rnd = getRandom(10); - if (_plat->_idleFacing != kDirNone) { - if (rnd != 0 || _plat->_sequenceId != 0x7CA) { - if (rnd != 1 || _plat->_sequenceId != 0x7CA) - _plat->playSequence(0x107CA); - else - _plat->playSequence(0x10845); - } else { - _plat->playSequence(0x107CC); - } - } else if (rnd != 0 || _plat->_sequenceId != 0x7C9) { - if (rnd != 1 || _plat->_sequenceId != 0x7C9) { - if (rnd != 2 || _plat->_sequenceId != 0x7C9) - _plat->playSequence(0x107C9); - else - _plat->playSequence(0x108A4); - } else { - _plat->playSequence(0x10844); - } - } else { - _plat->playSequence(0x107CB); - } - } - } else { - _timers[0] = getRandom(75) + 75; - platypusMakeRoom(); - } - } else { - _timers[0] = 100; - _timers[1] = 35; - } -} - -void GnapEngine::updatePlatypusIdleSequence2() { - if (_plat->_actionStatus < 0 && _gnap->_actionStatus < 0) { - if (_timers[0]) { - if (!_timers[1]) { - _timers[1] = getRandom(20) + 30; - if (_plat->_idleFacing != kDirNone) { - if (getRandom(10) >= 2 || _plat->_sequenceId != 0x7CA) - _plat->playSequence(0x107CA); - else - _plat->playSequence(0x107CC); - } else { - if (getRandom(10) >= 2 || _plat->_sequenceId != 0x7C9) { - _plat->playSequence(0x107C9); - } else { - _plat->playSequence(0x107CB); - } - } - } - } else { - _timers[0] = getRandom(75) + 75; - platypusMakeRoom(); - } - } else { - _timers[0] = 100; - _timers[1] = 35; - } -} - void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { _timers[0] = 50; _timers[1] = 20; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index fdf47a2c40..d37b2de6e6 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -530,16 +530,12 @@ public: void playGnapIdle(int gridX, int gridY); void playGnapShowItem(int itemIndex, int gridLookX, int gridLookY); void playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); - void updateGnapIdleSequence(); - void updateGnapIdleSequence2(); void initGnapPos(int gridX, int gridY, Facing facing); void doCallback(int callback); bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); void gnapUseDisguiseOnPlatypus(); // Platypus - void updatePlatypusIdleSequence(); - void updatePlatypusIdleSequence2(); void initPlatypusPos(int gridX, int gridY, Facing facing); // Scenes diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 9690d6932f..0ae1d2e934 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -261,9 +261,9 @@ void Scene01::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (_vm->_timers[4] == 0) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -673,9 +673,9 @@ void Scene02::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -1121,9 +1121,9 @@ void Scene03::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[1] && !_platypusScared) { _vm->_timers[1] = _vm->getRandom(40) + 20; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) @@ -1664,9 +1664,9 @@ void Scene04::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence2(); + _vm->_plat->updateIdleSequence2(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence2(); + _vm->_gnap->updateIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(150) + 300; if (_vm->_gnap->_actionStatus < 0) @@ -2107,8 +2107,8 @@ void Scene05::run() { if (!_vm->_isLeavingScene) { if (_vm->isFlag(kGFPlatypus)) - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 30; if (_vm->_gnap->_actionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { @@ -2501,9 +2501,9 @@ void Scene06::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 25; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHorseSequenceId == -1) { @@ -2801,7 +2801,7 @@ void Scene07::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (_vm->_plat->_actionStatus < 0 && _vm->_gnap->_actionStatus < 0) { if (_vm->_timers[0]) { if (!_vm->_timers[1]) { @@ -3190,8 +3190,8 @@ void Scene08::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 125; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextManSequenceId == -1 && @@ -3491,8 +3491,8 @@ void Scene09::run() { updateAnimations(); if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus != 1 && _vm->_gnap->_actionStatus != 2) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(150) + 100; if (_vm->_timers[4] & 1) diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index cbc1f704ec..28eecf9846 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -305,8 +305,8 @@ void Scene10::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(80) + 150; _vm->playSound(0x12B, false); @@ -745,8 +745,8 @@ void Scene11::run() { gameSys.setAnimation(0x207, 257, 4); gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } - _vm->updatePlatypusIdleSequence2(); - _vm->updateGnapIdleSequence2(); + _vm->_plat->updateIdleSequence2(); + _vm->_gnap->updateIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 75; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextGoggleGuySequenceId == -1) { @@ -1176,8 +1176,8 @@ void Scene12::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = 15; if (_nextToothGuySequenceId == -1) { @@ -1692,11 +1692,11 @@ void Scene13::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) _vm->platypusWalkTo(-1, 7, -1, -1, 1); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; switch (_vm->getRandom(5)) { @@ -2721,8 +2721,8 @@ void Scene17::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) - _vm->updatePlatypusIdleSequence2(); - _vm->updateGnapIdleSequence2(); + _vm->_plat->updateIdleSequence2(); + _vm->_gnap->updateIdleSequence2(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 200; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) @@ -3750,7 +3750,7 @@ void Scene18::run() { } else { _vm->_hotspots[kHS18WalkArea1]._y2 += 48; _vm->_hotspots[kHS18WalkArea2]._x1 += 75; - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); _vm->_hotspots[kHS18WalkArea2]._x1 -= 75; _vm->_hotspots[kHS18WalkArea1]._y2 -= 48; } @@ -3766,7 +3766,7 @@ void Scene18::run() { _vm->playSoundA(); } if (!_vm->isFlag(kGFPlatypusDisguised)) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); } _vm->checkGameKeys(); @@ -4296,9 +4296,9 @@ void Scene19::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (!_vm->_timers[6] && _nextShopAssistantSequenceId == -1) { _vm->_timers[6] = _vm->getRandom(40) + 50; if (_vm->getRandom(4) != 0) { diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 145d0ee924..820a14e206 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -471,11 +471,11 @@ void Scene20::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) { _vm->_hotspots[kHS20WalkArea1]._y2 += 48; - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; } if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { _vm->_timers[5] = _vm->getRandom(50) + 130; if (_vm->getRandom(4) != 0) @@ -900,8 +900,8 @@ void Scene21::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && _vm->_gnap->_actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(30) + 50; switch (_vm->getRandom(5)) { @@ -1192,8 +1192,8 @@ void Scene22::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[6] && _nextCashierSequenceId == -1) { _vm->_timers[6] = _vm->getRandom(30) + 20; if (_vm->getRandom(8) != 0) { @@ -1417,8 +1417,8 @@ void Scene23::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4] && _vm->_gnap->_actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(100) + 200; switch (_vm->getRandom(4)) { @@ -1665,8 +1665,8 @@ void Scene24::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 50; gameSys.insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); @@ -1976,8 +1976,8 @@ void Scene25::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && _vm->_gnap->_actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(20) + 20; switch (_vm->getRandom(13)) { @@ -2251,8 +2251,8 @@ void Scene26::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[5] && _nextKidSequenceId == -1) { _vm->_timers[5] = _vm->getRandom(20) + 50; if (_vm->getRandom(5) != 0) @@ -2537,9 +2537,9 @@ void Scene27::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (_vm->_debugLevel == 4) _vm->updateIdleTimer(); if (!_vm->_timers[5]) { @@ -2920,8 +2920,8 @@ void Scene28::run() { _vm->playSound(0x1093C, true); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 80; if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFUnk21)) @@ -3276,8 +3276,8 @@ void Scene29::run() { if (!_vm->_isLeavingScene) { if (_vm->_gnap->_actionStatus < 0) { - _vm->updateGnapIdleSequence(); - _vm->updatePlatypusIdleSequence(); + _vm->_gnap->updateIdleSequence(); + _vm->_plat->updateIdleSequence(); } if (!_vm->_timers[4]) { if (_vm->invHas(kItemHorn)) { diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index ec17be422e..b00224ba9c 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -171,9 +171,9 @@ void Scene30::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_gnap->_actionStatus < 0) { @@ -486,9 +486,9 @@ void Scene31::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 60; if (_vm->_gnap->_actionStatus < 0 && _nextClerkSequenceId == -1) { @@ -752,9 +752,9 @@ void Scene32::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) @@ -983,9 +983,9 @@ void Scene33::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) @@ -1260,8 +1260,8 @@ void Scene38::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->updatePlatypusIdleSequence(); - _vm->updateGnapIdleSequence(); + _vm->_plat->updateIdleSequence(); + _vm->_gnap->updateIdleSequence(); } _vm->checkGameKeys(); @@ -1531,9 +1531,9 @@ void Scene39::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 50; switch (_vm->getRandom(4)) { diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 9d731c0b9f..6ec914db59 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -511,9 +511,9 @@ void Scene41::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 100; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { @@ -979,9 +979,9 @@ void Scene42::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 30; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextBBQVendorSequenceId == -1) { @@ -1433,9 +1433,9 @@ void Scene43::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { _vm->_timers[4] = _vm->getRandom(100) + 100; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { @@ -1915,9 +1915,9 @@ void Scene44::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextKissingLadySequenceId == -1) { @@ -2362,7 +2362,7 @@ void Scene45::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); _vm->checkGameKeys(); @@ -2691,9 +2691,9 @@ void Scene46::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updatePlatypusIdleSequence(); + _vm->_plat->updateIdleSequence(); if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->updateGnapIdleSequence(); + _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 80; if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextItchyGuySequenceId == -1) { -- cgit v1.2.3 From 38a83d1770a35b82cdfd7b04c19fcccb174b157f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 May 2016 13:36:35 +0200 Subject: GNAP: More character refactoring (WIP) --- engines/gnap/character.cpp | 76 ++++++++++++++++++++----- engines/gnap/character.h | 8 ++- engines/gnap/gnap.cpp | 46 +-------------- engines/gnap/gnap.h | 6 -- engines/gnap/grid.cpp | 32 +++++------ engines/gnap/scenes/group0.cpp | 94 +++++++++++++++---------------- engines/gnap/scenes/group1.cpp | 124 ++++++++++++++++++++--------------------- engines/gnap/scenes/group2.cpp | 106 +++++++++++++++++------------------ engines/gnap/scenes/group3.cpp | 54 +++++++++--------- engines/gnap/scenes/group4.cpp | 90 +++++++++++++++--------------- 10 files changed, 320 insertions(+), 316 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index c72f6337fa..4356862756 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -33,10 +33,14 @@ Character::Character(GnapEngine *vm) : _vm(vm) { _sequenceId = 0; _sequenceDatNum = 0; _id = 0; + _gridX = 0; + _gridY = 0; } Character::~Character() {} +/************************************************************************************************/ + PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) { _brainPulseNum = 0; _brainPulseRndValue = 0; @@ -407,7 +411,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_sequenceId = 0x876; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playSequence(0x107B5); + playSequence(0x107B5); _vm->gnapWalkStep(); while (_vm->_gameSys->getAnimationStatus(0) != 2) { _vm->updateMouseCursor(); @@ -416,7 +420,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - _vm->_gnap->playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); } } @@ -432,11 +436,11 @@ void PlayerGnap::kissPlatypus(int callback) { _sequenceId = 0x847; _vm->_gameSys->insertSequence(0x107CB, _vm->_plat->_id, makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, - kSeqSyncWait, _vm->getSequenceTotalDuration(0x10847), 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + kSeqSyncWait, _vm->getSequenceTotalDuration(0x10847), 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_sequenceId = 0x7CB; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playSequence(0x107B5); + playSequence(0x107B5); while (_vm->_gameSys->getAnimationStatus(0) != 2) { _vm->updateMouseCursor(); _vm->doCallback(callback); @@ -445,23 +449,23 @@ void PlayerGnap::kissPlatypus(int callback) { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - _vm->_gnap->playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); } } void PlayerGnap::useDeviceOnPlatypus() { - _vm->_gnap->playSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos.x, _vm->_plat->_pos.y))); + playSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos.x, _vm->_plat->_pos.y))); if (_vm->_plat->_idleFacing != kDirNone) { _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), _vm->_plat->_id, makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, - kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); _vm->_plat->_sequenceId = 0x7D5; _vm->_plat->_sequenceDatNum = 1; } else { _vm->_gameSys->insertSequence(makeRid(1, 0x7D4), _vm->_plat->_id, makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, - kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); _vm->_plat->_sequenceId = 0x7D4; _vm->_plat->_sequenceDatNum = 1; } @@ -469,7 +473,7 @@ void PlayerGnap::useDeviceOnPlatypus() { int newSequenceId = getSequenceId(gskUseDevice, 0, 0); _vm->_gameSys->insertSequence(makeRid(1, newSequenceId), _id, makeRid(_sequenceDatNum, _sequenceId), _id, - kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); _sequenceId = newSequenceId; _sequenceDatNum = 1; } @@ -484,7 +488,7 @@ void PlayerGnap::playSequence(int sequenceId) { _vm->gnapIdle(); _vm->_gameSys->insertSequence(sequenceId, _id, makeRid(_sequenceDatNum, _sequenceId), _id, - kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); _sequenceId = ridToEntryIndex(sequenceId); _sequenceDatNum = ridToDatIndex(sequenceId); } @@ -522,13 +526,13 @@ void PlayerGnap::updateIdleSequence() { if (_idleFacing == kDirBottomRight) { _vm->_gameSys->insertSequence(0x107BD, _id, makeRid(_sequenceDatNum, _sequenceId), _id, - kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); _sequenceId = 0x7BD; _sequenceDatNum = 1; } else if (_idleFacing == kDirBottomLeft) { _vm->_gameSys->insertSequence(0x107BE, _id, makeRid(_sequenceDatNum, _sequenceId), _id, - kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); _sequenceId = 0x7BE; _sequenceDatNum = 1; } @@ -556,13 +560,13 @@ void PlayerGnap::updateIdleSequence2() { if (_idleFacing == kDirBottomRight) { _vm->_gameSys->insertSequence(0x107BD, _id, makeRid(_sequenceDatNum, _sequenceId), _id, - kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); _sequenceId = 0x7BD; _sequenceDatNum = 1; } else if (_idleFacing == kDirBottomLeft) { _vm->_gameSys->insertSequence(0x107BE, _id, makeRid(_sequenceDatNum, _sequenceId), _id, - kSeqSyncWait, 0, 75 * _pos.x - _vm->_gnapGridX, 48 * _pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); _sequenceId = 0x7BE; _sequenceDatNum = 1; } @@ -573,6 +577,27 @@ void PlayerGnap::updateIdleSequence2() { } } +void PlayerGnap::initPos(int gridX, int gridY, Facing facing) { + _vm->_timers[2] = 30; + _vm->_timers[3] = 300; + _pos = Common::Point(gridX, gridY); + if (facing == kDirNone) + _idleFacing = kDirBottomRight; + else + _idleFacing = facing; + if (_idleFacing == kDirBottomLeft) { + _sequenceId = 0x7B8; + } else { + _sequenceId = 0x7B5; + _idleFacing = kDirBottomRight; + } + _id = 20 * _pos.y; + _sequenceDatNum = 1; + _vm->_gameSys->insertSequence(makeRid(1, _sequenceId), 20 * _pos.y, + 0, 0, + kSeqScale, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} @@ -594,7 +619,7 @@ int PlayerPlat::getSequenceId(int kind, int gridX, int gridY) { void PlayerPlat::playSequence(int sequenceId) { _vm->_gameSys->insertSequence(sequenceId, _id, makeRid(_sequenceDatNum, _sequenceId), _id, - kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _vm->_platGridX, 48 * _pos.y - _vm->_platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); _sequenceId = ridToEntryIndex(sequenceId); _sequenceDatNum = ridToDatIndex(sequenceId); } @@ -665,4 +690,25 @@ void PlayerPlat::updateIdleSequence2() { } } +void PlayerPlat::initPos(int gridX, int gridY, Facing facing) { + _vm->_timers[0] = 50; + _vm->_timers[1] = 20; + _pos = Common::Point(gridX, gridY); + if (facing == kDirNone) + _idleFacing = kDirNone; + else + _idleFacing = facing; + if (_idleFacing == kDirUnk4) { + _sequenceId = 0x7D1; + } else { + _sequenceId = 0x7C1; + _idleFacing = kDirNone; + } + _id = 20 * _pos.y; + _sequenceDatNum = 1; + _vm->_gameSys->insertSequence(makeRid(1, _sequenceId), 20 * _pos.y, + 0, 0, + kSeqScale, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); +} + } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 5e7d6ee3e5..39643972bb 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -45,6 +45,7 @@ public: virtual void playSequence(int sequenceId) = 0; virtual void updateIdleSequence() = 0; virtual void updateIdleSequence2() = 0; + virtual void initPos(int gridX, int gridY, Facing facing) = 0; Common::Point _pos; Facing _idleFacing; @@ -52,6 +53,8 @@ public: int _sequenceId; int _sequenceDatNum; int _id; + int _gridX; + int _gridY; protected: GnapEngine *_vm; @@ -61,6 +64,7 @@ class PlayerGnap : public Character { public: PlayerGnap(GnapEngine *vm); virtual int getSequenceId(int kind, int gridX, int gridY); + virtual void initPos(int gridX, int gridY, Facing facing); virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); virtual void updateIdleSequence2(); @@ -70,13 +74,15 @@ public: void useDeviceOnPlatypus(); void useJointOnPlatypus(); - int _brainPulseNum, _brainPulseRndValue; + int _brainPulseNum; + int _brainPulseRndValue; }; class PlayerPlat : public Character { public: PlayerPlat(GnapEngine *vm); virtual int getSequenceId(int kind = 0, int gridX = 0, int gridY = 0); + virtual void initPos(int gridX, int gridY, Facing facing); virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); virtual void updateIdleSequence2(); diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index f72b7c6af3..78c7617c73 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1129,7 +1129,7 @@ void GnapEngine::gnapIdle() { _gnap->_sequenceId == 0x831 || _gnap->_sequenceId == 0x89A)) { _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id, makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); + kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnap->_gridX, 48 * _gnap->_pos.y - _gnap->_gridY); _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0); _gnap->_sequenceDatNum = 1; } @@ -1140,7 +1140,7 @@ void GnapEngine::gnapActionIdle(int sequenceId) { ridToEntryIndex(sequenceId) == _gnap->_sequenceId) { _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id, makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); + kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnap->_gridX, 48 * _gnap->_pos.y - _gnap->_gridY); _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0); _gnap->_sequenceDatNum = 1; } @@ -1207,27 +1207,6 @@ bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gr return false; } -void GnapEngine::initGnapPos(int gridX, int gridY, Facing facing) { - _timers[2] = 30; - _timers[3] = 300; - _gnap->_pos = Common::Point(gridX, gridY); - if (facing == kDirNone) - _gnap->_idleFacing = kDirBottomRight; - else - _gnap->_idleFacing = facing; - if (_gnap->_idleFacing == kDirBottomLeft) { - _gnap->_sequenceId = 0x7B8; - } else { - _gnap->_sequenceId = 0x7B5; - _gnap->_idleFacing = kDirBottomRight; - } - _gnap->_id = 20 * _gnap->_pos.y; - _gnap->_sequenceDatNum = 1; - _gameSys->insertSequence(makeRid(1, _gnap->_sequenceId), 20 * _gnap->_pos.y, - 0, 0, - kSeqScale, 0, 75 * _gnap->_pos.x - _gnapGridX, 48 * _gnap->_pos.y - _gnapGridY); -} - void GnapEngine::doCallback(int callback) { switch (callback) { case 8: @@ -1280,27 +1259,6 @@ void GnapEngine::gnapUseDisguiseOnPlatypus() { setFlag(kGFPlatypusDisguised); } -void GnapEngine::initPlatypusPos(int gridX, int gridY, Facing facing) { - _timers[0] = 50; - _timers[1] = 20; - _plat->_pos = Common::Point(gridX, gridY); - if (facing == kDirNone) - _plat->_idleFacing = kDirNone; - else - _plat->_idleFacing = facing; - if (_plat->_idleFacing == kDirUnk4) { - _plat->_sequenceId = 0x7D1; - } else { - _plat->_sequenceId = 0x7C1; - _plat->_idleFacing = kDirNone; - } - _plat->_id = 20 * _plat->_pos.y; - _plat->_sequenceDatNum = 1; - _gameSys->insertSequence(makeRid(1, _plat->_sequenceId), 20 * _plat->_pos.y, - 0, 0, - kSeqScale, 0, 75 * _plat->_pos.x - _platGridX, 48 * _plat->_pos.y - _platGridY); -} - //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index d37b2de6e6..4cab40529e 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -475,8 +475,6 @@ public: void updateMenuStatusQueryQuit(); // Grid common - int _gnapGridX, _gnapGridY; - int _platGridX, _platGridY; int _gridMinX, _gridMinY; int _gridMaxX, _gridMaxY; bool isPointBlocked(int gridX, int gridY); @@ -530,14 +528,10 @@ public: void playGnapIdle(int gridX, int gridY); void playGnapShowItem(int itemIndex, int gridLookX, int gridLookY); void playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); - void initGnapPos(int gridX, int gridY, Facing facing); void doCallback(int callback); bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); void gnapUseDisguiseOnPlatypus(); - // Platypus - void initPlatypusPos(int gridX, int gridY, Facing facing); - // Scenes int _toyUfoNextSequenceId, _toyUfoSequenceId; int _toyUfoId; diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index ec0595f0a6..5c9b3ddee1 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -32,10 +32,10 @@ void GnapEngine::initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gri _gridMinY = gridMinY; _gridMaxX = gridMaxX; _gridMaxY = gridMaxY; - _gnapGridX = 410 - gridMinX; - _gnapGridY = 450 - gridMinY; - _platGridX = 396 - gridMinX; - _platGridY = 347 - gridMinY; + _gnap->_gridX = 410 - gridMinX; + _gnap->_gridY = 450 - gridMinY; + _plat->_gridX = 396 - gridMinX; + _plat->_gridY = 347 - gridMinY; } int GnapEngine::getGnapWalkSequenceId(int deltaX, int deltaY) { @@ -587,13 +587,13 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen if (index % 2) { _gameSys->insertSequence(makeRid(datNum, 0x7AB), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); _gnapWalkNodes[index]._sequenceId = 0x7AB; gnapSequenceId = 0x7AB; } else { _gameSys->insertSequence(makeRid(datNum, 0x7AC), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); _gnapWalkNodes[index]._sequenceId = 0x7AC; gnapSequenceId = 0x7AC; } @@ -601,13 +601,13 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen if (index % 2) { _gameSys->insertSequence(makeRid(datNum, 0x7AF), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); _gnapWalkNodes[index]._sequenceId = 0x7AF; gnapSequenceId = 0x7AF; } else { _gameSys->insertSequence(makeRid(datNum, 0x7B0), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); _gnapWalkNodes[index]._sequenceId = 0x7B0; gnapSequenceId = 0x7B0; } @@ -619,7 +619,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index]._deltaX, _gnapWalkNodes[index]._deltaY); _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnapGridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); _gnapWalkNodes[index]._sequenceId = newSequenceId; gnapSequenceId = newSequenceId; } @@ -705,7 +705,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } else { _gameSys->insertSequence(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkDestX - _gnapGridX, 48 * _gnapWalkDestY - _gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkDestX - _gnap->_gridX, 48 * _gnapWalkDestY - _gnap->_gridY); } } @@ -1239,13 +1239,13 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (index % 2) { _gameSys->insertSequence(makeRid(datNum, 0x7CD), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); _platWalkNodes[index]._sequenceId = 0x7CD; platSequenceId = 0x7CD; } else { _gameSys->insertSequence(makeRid(datNum, 0x7CE), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); _platWalkNodes[index]._sequenceId = 0x7CE; platSequenceId = 0x7CE; } @@ -1253,13 +1253,13 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (index % 2) { _gameSys->insertSequence(makeRid(datNum, 0x7CF), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); _platWalkNodes[index]._sequenceId = 0x7CF; platSequenceId = 0x7CF; } else { _gameSys->insertSequence(makeRid(datNum, 0x7D0), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); _platWalkNodes[index]._sequenceId = 0x7D0; platSequenceId = 0x7D0; } @@ -1271,7 +1271,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se int newSequenceId = getPlatypusWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _platGridX, 48 * _platWalkNodes[index]._gridY1 - _platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); _platWalkNodes[index]._sequenceId = newSequenceId; platSequenceId = newSequenceId; } @@ -1348,7 +1348,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se else _gameSys->insertSequence(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 75 * _platWalkDestX - _platGridX, 48 * _platWalkDestY - _platGridY); + 9, 0, 75 * _platWalkDestX - _plat->_gridX, 48 * _platWalkDestY - _plat->_gridY); } _plat->_pos = Common::Point(_platWalkDestX, _platWalkDestY); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 0ae1d2e934..3ba263dcbe 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -90,17 +90,17 @@ void Scene01::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 2) { - _vm->initGnapPos(11, 6, kDirBottomLeft); + _vm->_gnap->initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); _vm->gnapWalkTo(8, 6, -1, 0x107B9, 1); } else { - _vm->initGnapPos(1, 6, kDirBottomRight); + _vm->_gnap->initPos(1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(1, 7, kDirNone); + _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -412,18 +412,18 @@ void Scene02::run() { switch (_vm->_prevSceneNum) { case 3: - _vm->initGnapPos(11, 6, kDirBottomLeft); + _vm->_gnap->initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); break; case 4: - _vm->initGnapPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); + _vm->_gnap->initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); + _vm->_plat->initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(7, 6, 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) @@ -433,20 +433,20 @@ void Scene02::run() { break; case 47: _vm->clearFlag(kGFUnk25); - _vm->initGnapPos(5, 6, kDirBottomLeft); - _vm->initPlatypusPos(6, 7, kDirUnk4); + _vm->_gnap->initPos(5, 6, kDirBottomLeft); + _vm->_plat->initPos(6, 7, kDirUnk4); _vm->endSceneInit(); break; case 49: - _vm->initGnapPos(5, 6, kDirBottomRight); + _vm->_gnap->initPos(5, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(6, 7, kDirNone); + _vm->_plat->initPos(6, 7, kDirNone); _vm->endSceneInit(); break; default: - _vm->initGnapPos(-1, 6, kDirBottomRight); + _vm->_gnap->initPos(-1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); @@ -794,7 +794,7 @@ void Scene02::updateAnimations() { _vm->_timers[2] = 100; break; case kAS02GrabChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7B5; _vm->_gnap->_sequenceDatNum = 1; _currChickenSequenceId = 0x14B; @@ -893,7 +893,7 @@ void Scene03::run() { gameSys.insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); _platypusHypnotized = false; - _vm->initGnapPos(3, 4, kDirBottomRight); + _vm->_gnap->initPos(3, 4, kDirBottomRight); gameSys.insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -906,7 +906,7 @@ void Scene03::run() { _vm->_timers[5] = _vm->getRandom(100) + 200; if (_vm->isFlag(kGFPlatypus)) { - _vm->initPlatypusPos(5, 4, kDirNone); + _vm->_plat->initPos(5, 4, kDirNone); } else { _vm->_timers[1] = _vm->getRandom(40) + 20; gameSys.setAnimation(0x1C2, 99, 1); @@ -1187,7 +1187,7 @@ void Scene03::updateAnimations() { _vm->_plat->_idleFacing = kDirUnk4; _vm->_plat->_id = 120; gameSys.insertSequence(0x107CA, _vm->_plat->_id, 0x1BC, 99, - kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); gameSys.insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_sequenceId = 0x7CA; @@ -1383,7 +1383,7 @@ void Scene04::run() { _vm->_gnap->_id = 140; _vm->_plat->_pos = Common::Point(6, 7); _vm->_plat->_id = 141; - gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnap->_gridX, 336 - _vm->_gnap->_gridY); gameSys.insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); @@ -1401,21 +1401,21 @@ void Scene04::run() { } else { gameSys.insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 2) { - _vm->initGnapPos(5, 11, kDirUpRight); + _vm->_gnap->initPos(5, 11, kDirUpRight); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(6, 9, -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { - _vm->initGnapPos(5, 7, kDirBottomRight); - _vm->initPlatypusPos(4, 7, kDirNone); + _vm->_gnap->initPos(5, 7, kDirBottomRight); + _vm->_plat->initPos(4, 7, kDirNone); _vm->endSceneInit(); } else { - _vm->initGnapPos(12, 9, kDirBottomRight); + _vm->_gnap->initPos(12, 9, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(12, 8, kDirNone); + _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); @@ -1715,7 +1715,7 @@ void Scene04::updateAnimations() { _vm->_gnap->_pos = Common::Point(6, 7); gameSys.insertSequence(0x107B5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnapGridX, 336 - _vm->_gnapGridY); + kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnap->_gridX, 336 - _vm->_gnap->_gridY); gameSys.setAnimation(0x107B5, _vm->_gnap->_id, 0); _vm->_gnap->_sequenceId = 0x7B5; _vm->_gnap->_sequenceDatNum = 1; @@ -1746,7 +1746,7 @@ void Scene04::updateAnimations() { gameSys.requestRemoveSequence(0x20B, 256); gameSys.insertSequence(0x107B5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnap->_sequenceId = 0x7B5; _vm->_gnap->_sequenceDatNum = 1; @@ -1773,7 +1773,7 @@ void Scene04::updateAnimations() { gameSys.removeSequence(0x20A, 256, true); gameSys.insertSequence(0x107B5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7B5; _vm->_gnap->_sequenceDatNum = 1; _vm->_gnap->_idleFacing = kDirBottomRight; @@ -1884,17 +1884,17 @@ void Scene05::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { - _vm->initGnapPos(-1, 8, kDirBottomRight); + _vm->_gnap->initPos(-1, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(-1, 9, kDirNone); + _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(2, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(2, 9, -1, 0x107B9, 1); } else { - _vm->initGnapPos(6, 8, kDirBottomRight); + _vm->_gnap->initPos(6, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->initPlatypusPos(7, 9, kDirNone); + _vm->_plat->initPos(7, 9, kDirNone); _vm->endSceneInit(); } @@ -2189,7 +2189,7 @@ void Scene05::updateAnimations() { case kAS05EnterBarn: gameSys.insertSequence(0x107B1, 1, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); gameSys.setAnimation(0x107B1, 1, 0); _vm->_gnap->_actionStatus = kAS05LeaveScene; break; @@ -2204,7 +2204,7 @@ void Scene05::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { if (_vm->_plat->_sequenceId == 0x146) { _vm->_plat->_pos = Common::Point(4, 8); - gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_platGridX, 384 - _vm->_platGridY); + gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_plat->_gridX, 384 - _vm->_plat->_gridY); _vm->_plat->_sequenceId = 0x7C1; _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_id = 20 * _vm->_plat->_pos.y; @@ -2315,8 +2315,8 @@ void Scene06::run() { _vm->queueInsertDeviceIcon(); - _vm->initGnapPos(5, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); + _vm->_gnap->initPos(5, 12, kDirBottomRight); + _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -2591,7 +2591,7 @@ void Scene06::updateAnimations() { _vm->setGrabCursorSprite(kItemGas); _vm->_plat->_actionStatus = -1; _vm->_plat->_pos = Common::Point(6, 8); - gameSys.insertSequence(0x107C1, _vm->_plat->_id, 0, 0, kSeqNone, 0, 450 - _vm->_platGridX, 384 - _vm->_platGridY); + gameSys.insertSequence(0x107C1, _vm->_plat->_id, 0, 0, kSeqNone, 0, 450 - _vm->_plat->_gridX, 384 - _vm->_plat->_gridY); _vm->_plat->_sequenceId = 0x7C1; _vm->_plat->_sequenceDatNum = 1; _vm->setFlag(kGFUnk04); @@ -2619,7 +2619,7 @@ void Scene06::updateAnimations() { _vm->_plat->_sequenceId = 0xFA; _vm->_plat->_sequenceDatNum = 0; gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x100, _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7B7; _vm->_gnap->_sequenceDatNum = 1; _currHorseSequenceId = _nextHorseSequenceId; @@ -2681,8 +2681,8 @@ void Scene07::run() { gameSys.insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { - _vm->initGnapPos(7, 7, kDirBottomLeft); - _vm->initPlatypusPos(9, 7, kDirUnk4); + _vm->_gnap->initPos(7, 7, kDirBottomLeft); + _vm->_plat->initPos(9, 7, kDirUnk4); _vm->endSceneInit(); } else { _vm->_gnap->_pos = Common::Point(6, 7); @@ -2761,7 +2761,7 @@ void Scene07::run() { gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_vm->_gnap->getSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = _vm->_gnap->getSequenceId(gskUseDevice, 0, 0); _vm->_gnap->_sequenceDatNum = 1; break; @@ -2951,8 +2951,8 @@ void Scene08::run() { if (!_vm->isFlag(kGFTruckKeysUsed)) gameSys.insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->_gnap->initPos(-1, 8, kDirBottomRight); + _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); @@ -3383,14 +3383,14 @@ void Scene09::run() { gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->_gnap->initPos(11, 8, kDirBottomLeft); + _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { - _vm->initGnapPos(4, 7, kDirBottomRight); - _vm->initPlatypusPos(5, 7, kDirNone); + _vm->_gnap->initPos(4, 7, kDirBottomRight); + _vm->_plat->initPos(5, 7, kDirNone); _vm->endSceneInit(); } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 28eecf9846..3acce7f866 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -72,14 +72,14 @@ void Scene10::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 9) { - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->_gnap->initPos(11, 8, kDirBottomLeft); + _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->_gnap->initPos(-1, 7, kDirBottomRight); + _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(1, 7, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); @@ -373,7 +373,7 @@ void Scene10::updateAnimations() { gameSys.insertSequence(0x107C9, 160, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), - 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); gameSys.removeSequence(0x107, 100, true); _currCookSequenceId = 0x109; _nextCookSequenceId = 0x843; @@ -534,23 +534,23 @@ void Scene11::run() { switch (_vm->_prevSceneNum) { case 13: - _vm->initGnapPos(8, 5, kDirBottomLeft); - _vm->initPlatypusPos(9, 6, kDirUnk4); + _vm->_gnap->initPos(8, 5, kDirBottomLeft); + _vm->_plat->initPos(9, 6, kDirUnk4); break; case 47: - _vm->initGnapPos(8, 5, kDirBottomLeft); - _vm->initPlatypusPos(9, 5, kDirUnk4); + _vm->_gnap->initPos(8, 5, kDirBottomLeft); + _vm->_plat->initPos(9, 5, kDirUnk4); _currGoggleGuySequenceId = 0x1FA; _currHookGuySequenceId = 0x1FF; _vm->_timers[7] = 180; break; case 12: - _vm->initGnapPos(-1, 9, kDirBottomRight); - _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->_gnap->initPos(-1, 9, kDirBottomRight); + _vm->_plat->initPos(-2, 8, kDirNone); break; default: - _vm->initGnapPos(6, 6, kDirBottomLeft); - _vm->initPlatypusPos(6, 5, kDirUnk4); + _vm->_gnap->initPos(6, 6, kDirBottomLeft); + _vm->_plat->initPos(6, 5, kDirUnk4); break; } @@ -982,12 +982,12 @@ void Scene12::run() { _vm->_timers[7] = _vm->getRandom(100) + 100; if (_vm->_prevSceneNum == 15) { - _vm->initGnapPos(5, 6, kDirBottomRight); - _vm->initPlatypusPos(3, 7, kDirNone); + _vm->_gnap->initPos(5, 6, kDirBottomRight); + _vm->_plat->initPos(3, 7, kDirNone); _vm->endSceneInit(); } else { - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 8, kDirUnk4); + _vm->_gnap->initPos(11, 8, kDirBottomLeft); + _vm->_plat->initPos(12, 8, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); @@ -1362,7 +1362,7 @@ void Scene12::updateAnimations() { gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x10843, 301, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7B7; _vm->_gnap->_sequenceDatNum = 1; _vm->setFlag(kGFTwigTaken); @@ -1486,11 +1486,11 @@ void Scene13::run() { gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 14) { - _vm->initGnapPos(6, 6, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirNone); + _vm->_gnap->initPos(6, 6, kDirBottomLeft); + _vm->_plat->initPos(9, 8, kDirNone); } else { - _vm->initGnapPos(3, 7, kDirBottomRight); - _vm->initPlatypusPos(2, 7, kDirNone); + _vm->_gnap->initPos(3, 7, kDirBottomRight); + _vm->_plat->initPos(2, 7, kDirNone); } _vm->endSceneInit(); @@ -1910,7 +1910,7 @@ void Scene14::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); break; } } @@ -1918,7 +1918,7 @@ void Scene14::run() { case kHS14Toilet: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1929,7 +1929,7 @@ void Scene14::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); break; } } @@ -2068,7 +2068,7 @@ void Scene15::run() { } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _nextSlotSequenceId = 0xDB; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2079,7 +2079,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); break; } } @@ -2087,7 +2087,7 @@ void Scene15::run() { case kHS15PlayButton: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2106,7 +2106,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); break; } } @@ -2119,7 +2119,7 @@ void Scene15::run() { case kHS15Button5: case kHS15Button6: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2132,7 +2132,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); break; } } @@ -2145,7 +2145,7 @@ void Scene15::run() { case kHS15ButtonE: case kHS15ButtonF: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2158,7 +2158,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnapGridX, 576 - _vm->_gnapGridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); break; } } @@ -2415,13 +2415,13 @@ void Scene17::run() { if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(4, 6, kDirBottomRight); - _vm->initPlatypusPos(5, 6, kDirNone); + _vm->_gnap->initPos(4, 6, kDirBottomRight); + _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { - _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_gnap->initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); @@ -2440,7 +2440,7 @@ void Scene17::run() { } else if (_vm->isFlag(kGFUnk25)) { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); - _vm->initPlatypusPos(7, 9, kDirNone); + _vm->_plat->initPos(7, 9, kDirNone); _vm->_gnap->_pos = _vm->_hotspotsWalkPos[2]; _vm->_gnap->_id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); @@ -2456,7 +2456,7 @@ void Scene17::run() { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); _vm->_sceneWaiting = true; - _vm->initGnapPos(3, 9, kDirUpLeft); + _vm->_gnap->initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; @@ -2469,19 +2469,19 @@ void Scene17::run() { _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; updateHotspots(); } else if (_vm->_prevSceneNum == 18) { - _vm->initGnapPos(6, 6, kDirBottomRight); - _vm->initPlatypusPos(5, 6, kDirNone); + _vm->_gnap->initPos(6, 6, kDirBottomRight); + _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { - _vm->initGnapPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); - _vm->initPlatypusPos(1, 9, kDirNone); + _vm->_gnap->initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); + _vm->_plat->initPos(1, 9, kDirNone); _vm->endSceneInit(); } else { - _vm->initGnapPos(3, 7, kDirBottomRight); - _vm->initPlatypusPos(1, 7, kDirNone); + _vm->_gnap->initPos(3, 7, kDirBottomRight); + _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); } _vm->clearFlag(kGFSpringTaken); @@ -2499,7 +2499,7 @@ void Scene17::run() { _vm->_plat->_id = 160; gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x107C1, _vm->_plat->_id, 0x241, _vm->_plat->_id, - kSeqScale | kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_platGridX, 48 * _vm->_plat->_pos.y - _vm->_platGridY); + kSeqScale | kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); _vm->endSceneInit(); @@ -3210,7 +3210,7 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { seqId2 += direction; gameSys.insertSequence(seqId, seqId2, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); gnapSeqId = seqId; gnapId = seqId2; gnapDatNum = 0; @@ -3234,7 +3234,7 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); gameSys.insertSequence(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_pos.x = gnapGridX; } @@ -3255,12 +3255,12 @@ void Scene18::putDownGarbageCan(int animationIndex) { if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) { gameSys.insertSequence(0x107BA, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7BA; } else { gameSys.insertSequence(0x107B9, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7B9; } _vm->_gnap->_sequenceDatNum = 1; @@ -3361,9 +3361,9 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { if (_vm->_prevSceneNum == 17) - _vm->initGnapPos(4, 11, kDirBottomRight); + _vm->_gnap->initPos(4, 11, kDirBottomRight); else - _vm->initGnapPos(4, 7, kDirBottomRight); + _vm->_gnap->initPos(4, 7, kDirBottomRight); _platPhoneCtr = _vm->getRandom(5); if (_vm->isFlag(kGFUnk27)) { gameSys.insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -3392,20 +3392,20 @@ void Scene18::run() { _vm->_prevSceneNum = 19; } if (_vm->_prevSceneNum == 17) { - _vm->initGnapPos(4, 11, kDirBottomRight); - _vm->initPlatypusPos(5, 11, kDirNone); + _vm->_gnap->initPos(4, 11, kDirBottomRight); + _vm->_plat->initPos(5, 11, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { - _vm->initGnapPos(7, 7, kDirBottomRight); - _vm->initPlatypusPos(8, 7, kDirNone); + _vm->_gnap->initPos(7, 7, kDirBottomRight); + _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { - _vm->initGnapPos(-1, 10, kDirBottomRight); - _vm->initPlatypusPos(-1, 10, kDirNone); + _vm->_gnap->initPos(-1, 10, kDirBottomRight); + _vm->_plat->initPos(-1, 10, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(3, 7, -1, 0x107B9, 1); _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); @@ -3743,7 +3743,7 @@ void Scene18::run() { if (!_vm->_timers[6]) { _vm->_plat->_actionStatus = -1; _vm->_sceneWaiting = false; - _vm->initPlatypusPos(-1, 10, kDirNone); + _vm->_plat->initPos(-1, 10, kDirNone); _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); _vm->clearFlag(kGFPlatypusTalkingToAssistant); } @@ -3988,7 +3988,7 @@ void Scene18::updateAnimations() { _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 517, _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 517, _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); updateHotspots(); _vm->_gnap->_sequenceDatNum = 1; _vm->_gnap->_sequenceId = 0x7B5; @@ -4099,7 +4099,7 @@ void Scene19::run() { gameSys.insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->initGnapPos(3, 6, kDirBottomRight); + _vm->_gnap->initPos(3, 6, kDirBottomRight); _currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; _nextShopAssistantSequenceId = _currShopAssistantSequenceId; gameSys.setAnimation(_currShopAssistantSequenceId, 20, 4); @@ -4115,8 +4115,8 @@ void Scene19::run() { gameSys.setAnimation(0x6D, 20, 4); gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(40) + 50; - _vm->initGnapPos(3, 6, kDirBottomRight); - _vm->initPlatypusPos(4, 6, kDirNone); + _vm->_gnap->initPos(3, 6, kDirBottomRight); + _vm->_plat->initPos(4, 6, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 820a14e206..237000dfe2 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -206,43 +206,43 @@ void Scene20::run() { // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->_gnap->initPos(11, 8, kDirBottomLeft); + _vm->_plat->initPos(11, 9, kDirUnk4); _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { case 17: - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); + _vm->_gnap->initPos(5, 11, kDirBottomRight); + _vm->_plat->initPos(6, 11, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 18: - _vm->initGnapPos(11, 8, kDirBottomLeft); - _vm->initPlatypusPos(11, 9, kDirUnk4); + _vm->_gnap->initPos(11, 8, kDirBottomLeft); + _vm->_plat->initPos(11, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 21: - _vm->initGnapPos(-1, 8, kDirBottomLeft); - _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->_gnap->initPos(-1, 8, kDirBottomLeft); + _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 22: - _vm->initGnapPos(7, 6, kDirBottomRight); - _vm->initPlatypusPos(8, 6, kDirNone); + _vm->_gnap->initPos(7, 6, kDirBottomRight); + _vm->_plat->initPos(8, 6, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); break; default: - _vm->initGnapPos(8, 6, kDirBottomLeft); - _vm->initPlatypusPos(9, 6, kDirUnk4); + _vm->_gnap->initPos(8, 6, kDirBottomLeft); + _vm->_plat->initPos(9, 6, kDirUnk4); _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); @@ -744,16 +744,16 @@ void Scene21::run() { if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { - _vm->initGnapPos(5, 8, kDirBottomRight); - _vm->initPlatypusPos(6, 8, kDirNone); + _vm->_gnap->initPos(5, 8, kDirBottomRight); + _vm->_plat->initPos(6, 8, kDirNone); gameSys.insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->clearFlag(kGFKeysTaken); } else { - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); + _vm->_gnap->initPos(5, 11, kDirBottomRight); + _vm->_plat->initPos(6, 11, kDirNone); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -761,8 +761,8 @@ void Scene21::run() { _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } } else { - _vm->initGnapPos(5, 11, kDirBottomRight); - _vm->initPlatypusPos(6, 11, kDirNone); + _vm->_gnap->initPos(5, 11, kDirBottomRight); + _vm->_plat->initPos(6, 11, kDirNone); _currOldLadySequenceId = 0x89; gameSys.setAnimation(0x89, 79, 3); gameSys.insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); @@ -1043,12 +1043,12 @@ void Scene22::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(2, 8, kDirBottomRight); - _vm->initPlatypusPos(1, 8, kDirNone); + _vm->_gnap->initPos(2, 8, kDirBottomRight); + _vm->_plat->initPos(1, 8, kDirNone); _vm->endSceneInit(); } else { - _vm->initGnapPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); - _vm->initPlatypusPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); + _vm->_gnap->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); + _vm->_plat->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); @@ -1293,8 +1293,8 @@ void Scene23::run() { _vm->queueInsertDeviceIcon(); - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->_gnap->initPos(-1, 7, kDirBottomRight); + _vm->_plat->initPos(-2, 7, kDirNone); gameSys.insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -1566,14 +1566,14 @@ void Scene24::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 20) { - _vm->initGnapPos(1, 8, kDirBottomRight); - _vm->initPlatypusPos(2, 8, kDirNone); + _vm->_gnap->initPos(1, 8, kDirBottomRight); + _vm->_plat->initPos(2, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(1, 9, -1, 0x107B9, 1); _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); } else { - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(8, 8, kDirUnk4); + _vm->_gnap->initPos(8, 8, kDirBottomLeft); + _vm->_plat->initPos(8, 8, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); @@ -1815,14 +1815,14 @@ void Scene25::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 24) { - _vm->initGnapPos(5, 11, kDirUpLeft); - _vm->initPlatypusPos(6, 11, kDirUnk4); + _vm->_gnap->initPos(5, 11, kDirUpLeft); + _vm->_plat->initPos(6, 11, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(5, 7, -1, 0x107BA, 1); _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); } else { - _vm->initGnapPos(5, 6, kDirBottomRight); - _vm->initPlatypusPos(6, 6, kDirNone); + _vm->_gnap->initPos(5, 6, kDirBottomRight); + _vm->_plat->initPos(6, 6, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -2134,14 +2134,14 @@ void Scene26::run() { gameSys.insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 25) { - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-2, 8, kDirNone); + _vm->_gnap->initPos(-1, 8, kDirBottomRight); + _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } else { - _vm->initGnapPos(2, 8, kDirBottomRight); - _vm->initPlatypusPos(3, 8, kDirNone); + _vm->_gnap->initPos(2, 8, kDirBottomRight); + _vm->_plat->initPos(3, 8, kDirNone); _vm->endSceneInit(); } @@ -2351,29 +2351,29 @@ void Scene27::run() { switch (_vm->_prevSceneNum) { case 26: - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); + _vm->_gnap->initPos(7, 12, kDirBottomRight); + _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); break; case 29: - _vm->initGnapPos(-1, 8, kDirBottomRight); - _vm->initPlatypusPos(-1, 9, kDirNone); + _vm->_gnap->initPos(-1, 8, kDirBottomRight); + _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 31: - _vm->initGnapPos(12, 8, kDirBottomLeft); - _vm->initPlatypusPos(12, 9, kDirUnk4); + _vm->_gnap->initPos(12, 8, kDirBottomLeft); + _vm->_plat->initPos(12, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); break; default: - _vm->initGnapPos(6, 8, kDirBottomRight); - _vm->initPlatypusPos(5, 9, kDirNone); + _vm->_gnap->initPos(6, 8, kDirBottomRight); + _vm->_plat->initPos(5, 9, kDirNone); _vm->endSceneInit(); break; } @@ -2727,13 +2727,13 @@ void Scene28::run() { gameSys.insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(20) + 80; } - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->_gnap->initPos(8, 8, kDirBottomLeft); + _vm->_plat->initPos(9, 8, kDirUnk4); _vm->endSceneInit(); } else { gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->initGnapPos(8, 8, kDirBottomLeft); - _vm->initPlatypusPos(9, 8, kDirUnk4); + _vm->_gnap->initPos(8, 8, kDirBottomLeft); + _vm->_plat->initPos(9, 8, kDirUnk4); _vm->endSceneInit(); _vm->playSequences(0xF7, 0x121, 0x122, 0x123); _currClownSequenceId = 0x115; @@ -3000,7 +3000,7 @@ void Scene28::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS28GrabHornFailsDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7B5; _vm->_gnap->_sequenceDatNum = 1; gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); @@ -3128,14 +3128,14 @@ void Scene29::run() { gameSys.insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 27) { - _vm->initGnapPos(12, 7, kDirBottomRight); - _vm->initPlatypusPos(12, 8, kDirNone); + _vm->_gnap->initPos(12, 7, kDirBottomRight); + _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(8, 7, -1, 0x107B9, 1); _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { - _vm->initGnapPos(-1, 7, kDirBottomRight); - _vm->initPlatypusPos(-2, 7, kDirNone); + _vm->_gnap->initPos(-1, 7, kDirBottomRight); + _vm->_plat->initPos(-2, 7, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index b00224ba9c..c89d954906 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -64,8 +64,8 @@ void Scene30::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; _kidSequenceId = 0x101; - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); + _vm->_gnap->initPos(7, 12, kDirBottomRight); + _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -312,14 +312,14 @@ void Scene31::run() { _vm->_timers[5] = _vm->getRandom(50) + 180; if (_vm->_prevSceneNum == 27) { - _vm->initGnapPos(-1, 8, kDirBottomLeft); - _vm->initPlatypusPos(-1, 9, kDirUnk4); + _vm->_gnap->initPos(-1, 8, kDirBottomLeft); + _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(3, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); } else { - _vm->initGnapPos(7, 12, kDirBottomRight); - _vm->initPlatypusPos(6, 12, kDirNone); + _vm->_gnap->initPos(7, 12, kDirBottomRight); + _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(7, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(6, 8, -1, 0x107D2, 1); @@ -664,14 +664,14 @@ void Scene32::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_prevSceneNum == 33) { - _vm->initGnapPos(11, 6, kDirBottomLeft); - _vm->initPlatypusPos(12, 6, kDirUnk4); + _vm->_gnap->initPos(11, 6, kDirBottomLeft); + _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); } else { - _vm->initGnapPos(1, 6, kDirBottomRight); - _vm->initPlatypusPos(1, 7, kDirNone); + _vm->_gnap->initPos(1, 6, kDirBottomRight); + _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -826,27 +826,27 @@ void Scene33::run() { switch (_vm->_prevSceneNum) { case 34: - _vm->initGnapPos(11, 7, kDirBottomLeft); - _vm->initPlatypusPos(12, 7, kDirUnk4); + _vm->_gnap->initPos(11, 7, kDirBottomLeft); + _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(8, 7, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); break; case 37: - _vm->initGnapPos(7, 7, kDirBottomRight); - _vm->initPlatypusPos(8, 7, kDirNone); + _vm->_gnap->initPos(7, 7, kDirBottomRight); + _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); break; case 32: - _vm->initGnapPos(-1, 6, kDirBottomRight); - _vm->initPlatypusPos(-1, 7, kDirNone); + _vm->_gnap->initPos(-1, 6, kDirBottomRight); + _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); break; default: - _vm->initGnapPos(3, 7, kDirBottomRight); - _vm->initPlatypusPos(2, 7, kDirNone); + _vm->_gnap->initPos(3, 7, kDirBottomRight); + _vm->_plat->initPos(2, 7, kDirNone); _vm->endSceneInit(); break; } @@ -1032,7 +1032,7 @@ void Scene33::updateAnimations() { _vm->_timers[2] = 100; break; case kAS33UseChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceId = 0x7B5; _vm->_gnap->_sequenceDatNum = 1; _currChickenSequenceId = 0x7E; @@ -1122,11 +1122,11 @@ void Scene38::run() { _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 39) { - _vm->initGnapPos(3, 7, kDirBottomLeft); - _vm->initPlatypusPos(4, 7, kDirUnk4); + _vm->_gnap->initPos(3, 7, kDirBottomLeft); + _vm->_plat->initPos(4, 7, kDirUnk4); } else { - _vm->initGnapPos(3, 8, kDirBottomRight); - _vm->initPlatypusPos(4, 8, kDirNone); + _vm->_gnap->initPos(3, 8, kDirBottomRight); + _vm->_plat->initPos(4, 8, kDirNone); } _vm->endSceneInit(); @@ -1420,12 +1420,12 @@ void Scene39::run() { _nextGuySequenceId = -1; if (_vm->_prevSceneNum == 38) { - _vm->initGnapPos(3, 7, kDirUpRight); - _vm->initPlatypusPos(2, 7, kDirUpLeft); + _vm->_gnap->initPos(3, 7, kDirUpRight); + _vm->_plat->initPos(2, 7, kDirUpLeft); _vm->endSceneInit(); } else { - _vm->initGnapPos(4, 7, kDirBottomRight); - _vm->initPlatypusPos(5, 7, kDirNone); + _vm->_gnap->initPos(4, 7, kDirBottomRight); + _vm->_plat->initPos(5, 7, kDirNone); _vm->endSceneInit(); } diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 6ec914db59..e5e56510b3 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -270,23 +270,23 @@ void Scene41::run() { _vm->_gnap->_id = 140; gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->initPlatypusPos(8, 10, kDirBottomLeft); + _vm->_plat->initPos(8, 10, kDirBottomLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 45) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-2, 8, kDirUpLeft); + _vm->_gnap->initPos(-1, 8, kDirUpRight); + _vm->_plat->initPos(-2, 8, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 42) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->_gnap->initPos(11, 8, kDirUpRight); + _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - _vm->initGnapPos(5, 8, kDirBottomRight); - _vm->initPlatypusPos(6, 8, kDirBottomLeft); + _vm->_gnap->initPos(5, 8, kDirBottomRight); + _vm->_plat->initPos(6, 8, kDirBottomLeft); _vm->endSceneInit(); } @@ -785,20 +785,20 @@ void Scene42::run() { if (_vm->_toyUfoSequenceId == 0x872) _vm->setGrabCursorSprite(-1); } else if (_vm->_prevSceneNum == 41) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->_gnap->initPos(-1, 8, kDirUpRight); + _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 43) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->_gnap->initPos(11, 8, kDirUpRight); + _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->_gnap->initPos(5, 11, kDirUpRight); + _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -1065,7 +1065,7 @@ void Scene42::updateAnimations() { gameSys.insertSequence(0x107B7, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), - 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->_gnap->_sequenceDatNum = 1; } else { gameSys.insertSequence(sequenceId, _vm->_gnap->_id, @@ -1227,28 +1227,28 @@ void Scene43::run() { } else { switch (_vm->_prevSceneNum) { case 42: - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->_gnap->initPos(-1, 8, kDirUpRight); + _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 44: - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->_gnap->initPos(11, 8, kDirUpRight); + _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); break; case 54: - _vm->initGnapPos(4, 7, kDirBottomLeft); - _vm->initPlatypusPos(11, 8, kDirUpLeft); + _vm->_gnap->initPos(4, 7, kDirBottomLeft); + _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); break; default: - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->_gnap->initPos(5, 11, kDirUpRight); + _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); @@ -1681,23 +1681,23 @@ void Scene44::run() { } else { switch (_vm->_prevSceneNum) { case 43: - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 7, kDirUpLeft); + _vm->_gnap->initPos(-1, 8, kDirUpRight); + _vm->_plat->initPos(-1, 7, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 46: - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 8, kDirUpLeft); + _vm->_gnap->initPos(11, 8, kDirUpRight); + _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(7, 8, -1, 0x107D2, 1); break; case 50: - _vm->initGnapPos(4, 8, kDirBottomRight); + _vm->_gnap->initPos(4, 8, kDirBottomRight); if (_vm->_sceneSavegameLoaded) { - _vm->initPlatypusPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); + _vm->_plat->initPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); } else if (!_vm->isFlag(kGFUnk13)) { _vm->_timers[0] = 50; _vm->_timers[1] = 20; @@ -1711,8 +1711,8 @@ void Scene44::run() { _vm->endSceneInit(); break; default: - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->_gnap->initPos(5, 11, kDirUpRight); + _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); @@ -2019,7 +2019,7 @@ void Scene44::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextKissingLadySequenceId == 0xF6) { gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->initPlatypusPos(5, 8, kDirNone); + _vm->_plat->initPos(5, 8, kDirNone); _currKissingLadySequenceId = _nextKissingLadySequenceId; _nextKissingLadySequenceId = -1; gameSys.setAnimation(0, 0, 2); @@ -2147,23 +2147,23 @@ void Scene45::run() { gameSys.setAnimation(0x9E, 1, 0); _vm->_gnap->_actionStatus = 1; gameSys.insertSequence(_vm->_gnap->_sequenceId, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); - _vm->initPlatypusPos(4, 8, kDirNone); + _vm->_plat->initPos(4, 8, kDirNone); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 9, kDirUpLeft); + _vm->_gnap->initPos(-1, 8, kDirUpRight); + _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 41) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(11, 9, kDirUpLeft); + _vm->_gnap->initPos(11, 8, kDirUpRight); + _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); _vm->gnapWalkTo(10, 9, -1, 0x107BA, 1); } else { - _vm->initGnapPos(2, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->_gnap->initPos(2, 11, kDirUpRight); + _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); @@ -2201,7 +2201,7 @@ void Scene45::run() { gameSys.setAnimation(0x107BD, _vm->_gnap->_id, 0); gameSys.insertSequence(0x107BD, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnapGridX, 48 * _vm->_gnap->_pos.y - _vm->_gnapGridY); + kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->_gnap->_sequenceId = 0x7BD; @@ -2514,20 +2514,20 @@ void Scene46::run() { gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 44) { - _vm->initGnapPos(-1, 8, kDirUpRight); - _vm->initPlatypusPos(-1, 8, kDirUpLeft); + _vm->_gnap->initPos(-1, 8, kDirUpRight); + _vm->_plat->initPos(-1, 8, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 45) { - _vm->initGnapPos(11, 8, kDirUpRight); - _vm->initPlatypusPos(12, 8, kDirUpLeft); + _vm->_gnap->initPos(11, 8, kDirUpRight); + _vm->_plat->initPos(12, 8, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { - _vm->initGnapPos(5, 11, kDirUpRight); - _vm->initPlatypusPos(6, 11, kDirUpLeft); + _vm->_gnap->initPos(5, 11, kDirUpRight); + _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); -- cgit v1.2.3 From 9d2c537beb5135ecd8e007b227da5139e74a9515 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 10:27:22 +0200 Subject: GNAP: Some more refactoring in Character, some renaming --- engines/gnap/character.cpp | 20 ++++++++ engines/gnap/character.h | 3 ++ engines/gnap/gnap.h | 14 +++--- engines/gnap/grid.cpp | 112 +++++++++++++++++++-------------------------- 4 files changed, 75 insertions(+), 74 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 4356862756..9503bfdd39 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -598,6 +598,16 @@ void PlayerGnap::initPos(int gridX, int gridY, Facing facing) { kSeqScale, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); } +int PlayerGnap::getWalkSequenceId(int deltaX, int deltaY) { + static const int walkSequenceIds[9] = { + 0x7B2, 0x000, 0x7B4, + 0x7AD, 0x000, 0x7AE, + 0x7B1, 0x000, 0x7B3 + }; + // CHECKME This is a little weird + return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} @@ -711,4 +721,14 @@ void PlayerPlat::initPos(int gridX, int gridY, Facing facing) { kSeqScale, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); } +int PlayerPlat::getWalkSequenceId(int deltaX, int deltaY) { + static const int walkSequenceIds[9] = { + 0x7C5, 0x000, 0x7C8, + 0x7C4, 0x000, 0x7C7, + 0x7C3, 0x000, 0x7C6 + }; + // CHECKME This is a little weird + return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 39643972bb..ddfc7190e6 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -46,6 +46,7 @@ public: virtual void updateIdleSequence() = 0; virtual void updateIdleSequence2() = 0; virtual void initPos(int gridX, int gridY, Facing facing) = 0; + virtual int getWalkSequenceId(int deltaX, int deltaY) = 0; Common::Point _pos; Facing _idleFacing; @@ -68,6 +69,7 @@ public: virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); virtual void updateIdleSequence2(); + virtual int getWalkSequenceId(int deltaX, int deltaY); void initBrainPulseRndValue(); void kissPlatypus(int callback); @@ -86,6 +88,7 @@ public: virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); virtual void updateIdleSequence2(); + virtual int getWalkSequenceId(int deltaX, int deltaY); }; } // End of namespace Gnap diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 4cab40529e..d54d4d91f7 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -487,13 +487,12 @@ public: int _gnapWalkDestX, _gnapWalkDestY; int _gnapWalkDeltaX, _gnapWalkDeltaY, _gnapWalkDirX, _gnapWalkDirY, _gnapWalkDirXIncr, _gnapWalkDirYIncr; - int getGnapWalkSequenceId(int deltaX, int deltaY); int getGnapWalkStopSequenceId(int deltaX, int deltaY); Facing getGnapWalkFacing(int deltaX, int deltaY); - bool gridSub41F08B(int gridX, int gridY); - bool gridSub41F5FC(int gridX, int gridY, int index); - bool gridSub41FAD5(int gridX, int gridY, int index); + bool gnapFindPath1(int gridX, int gridY, int index); + bool gnapFindPath2(int gridX, int gridY, int index); bool gnapFindPath3(int gridX, int gridY); + bool gnapFindPath4(int gridX, int gridY); bool gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); bool gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void gnapWalkStep(); @@ -504,11 +503,10 @@ public: int _platWalkDestX, _platWalkDestY; int _platWalkDeltaX, _platWalkDeltaY, _platWalkDirX, _platWalkDirY, _platWalkDirXIncr, _platWalkDirYIncr; - int getPlatypusWalkSequenceId(int deltaX, int deltaY); - bool gridSub423750(int gridX, int gridY); - bool gridSub423CC1(int gridX, int gridY, int index); - bool gridSub42419A(int gridX, int gridY, int index); + bool platFindPath1(int gridX, int gridY, int index); + bool platFindPath2(int gridX, int gridY, int index); bool platFindPath3(int gridX, int gridY); + bool platFindPath4(int gridX, int gridY); bool platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void platypusWalkStep(); void platypusMakeRoom(); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 5c9b3ddee1..271f3494ee 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -38,16 +38,6 @@ void GnapEngine::initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gri _plat->_gridY = 347 - gridMinY; } -int GnapEngine::getGnapWalkSequenceId(int deltaX, int deltaY) { - static const int _gnapWalkSequenceIds[9] = { - 0x7B2, 0x000, 0x7B4, - 0x7AD, 0x000, 0x7AE, - 0x7B1, 0x000, 0x7B3 - }; - // CHECKME This is a little weird - return _gnapWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; -} - int GnapEngine::getGnapWalkStopSequenceId(int deltaX, int deltaY) { static const int _gnapWalkStopSequenceIds[9] = { 0x7BC, 0x7BA, 0x7BA, @@ -90,7 +80,7 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { } -bool GnapEngine::gridSub41F08B(int gridX, int gridY) { +bool GnapEngine::gnapFindPath4(int gridX, int gridY) { bool result = false; _gnapWalkNodesCount = 0; @@ -186,7 +176,7 @@ bool GnapEngine::gridSub41F08B(int gridX, int gridY) { return result; } -bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { +bool GnapEngine::gnapFindPath1(int gridX, int gridY, int index) { _gnapWalkNodesCount = index; _gnapWalkDirXIncr = 0; _gnapWalkDirYIncr = 0; @@ -264,7 +254,7 @@ bool GnapEngine::gridSub41F5FC(int gridX, int gridY, int index) { return true; } -bool GnapEngine::gridSub41FAD5(int gridX, int gridY, int index) { +bool GnapEngine::gnapFindPath2(int gridX, int gridY, int index) { _gnapWalkNodesCount = index; _gnapWalkDirXIncr = 0; _gnapWalkDirYIncr = 0; @@ -371,7 +361,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { bool done = false; while (!done && gridIncr < _gridMaxX) { - if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41F5FC(gridX + gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY) && gnapFindPath1(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -381,7 +371,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41F5FC(gridX - gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY) && gnapFindPath1(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -391,7 +381,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41F5FC(gridX, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY + gridIncr) && gnapFindPath1(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -401,7 +391,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41F5FC(gridX, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY - gridIncr) && gnapFindPath1(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -411,7 +401,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gnapFindPath1(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -421,7 +411,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gnapFindPath1(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -431,7 +421,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gnapFindPath1(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -441,7 +431,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41F5FC(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gnapFindPath1(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -451,7 +441,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY) && gridSub41FAD5(gridX + gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY) && gnapFindPath2(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -461,7 +451,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY) && gridSub41FAD5(gridX - gridIncr, gridY, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY) && gnapFindPath2(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY; @@ -471,7 +461,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY + gridIncr) && gridSub41FAD5(gridX, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY + gridIncr) && gnapFindPath2(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -481,7 +471,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX, gridY - gridIncr) && gridSub41FAD5(gridX, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX, gridY - gridIncr) && gnapFindPath2(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -491,7 +481,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gnapFindPath2(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -501,7 +491,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gnapFindPath2(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY + i; @@ -511,7 +501,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gnapFindPath2(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX + i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -521,7 +511,7 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gridSub41FAD5(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gnapFindPath2(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _gnapWalkNodes[i]._gridX1 = gridX - i; _gnapWalkNodes[i]._gridY1 = gridY - i; @@ -561,16 +551,16 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen platypusMakeRoom(); // TODO: Simplify the cascade of Ifs - if (gridSub41F5FC(_gnap->_pos.x, _gnap->_pos.y, 0)) + if (gnapFindPath1(_gnap->_pos.x, _gnap->_pos.y, 0)) done = true; - if (!done && gridSub41FAD5(_gnap->_pos.x, _gnap->_pos.y, 0)) + if (!done && gnapFindPath2(_gnap->_pos.x, _gnap->_pos.y, 0)) done = true; if (!done && gnapFindPath3(_gnap->_pos.x, _gnap->_pos.y)) done = true; - if (!done && gridSub41F08B(_gnap->_pos.x, _gnap->_pos.y)) + if (!done && gnapFindPath4(_gnap->_pos.x, _gnap->_pos.y)) done = true; gnapIdle(); @@ -616,7 +606,7 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen _gnapWalkNodes[index]._id -= 10; else _gnapWalkNodes[index]._id += 10; - int newSequenceId = getGnapWalkSequenceId(_gnapWalkNodes[index]._deltaX, _gnapWalkNodes[index]._deltaY); + int newSequenceId = _gnap->getWalkSequenceId(_gnapWalkNodes[index]._deltaX, _gnapWalkNodes[index]._deltaY); _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index]._id, makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); @@ -741,17 +731,7 @@ void GnapEngine::gnapWalkStep() { //////////////////////////////////////////////////////////////////////////////// -int GnapEngine::getPlatypusWalkSequenceId(int deltaX, int deltaY) { - static const int _platypusWalkSequenceIds[9] = { - 0x7C5, 0x000, 0x7C8, - 0x7C4, 0x000, 0x7C7, - 0x7C3, 0x000, 0x7C6 - }; - // CHECKME This is a little weird - return _platypusWalkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; -} - -bool GnapEngine::gridSub423750(int gridX, int gridY) { +bool GnapEngine::platFindPath4(int gridX, int gridY) { bool result = false; _platWalkNodesCount = 0; @@ -847,7 +827,7 @@ bool GnapEngine::gridSub423750(int gridX, int gridY) { return result; } -bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { +bool GnapEngine::platFindPath1(int gridX, int gridY, int index) { _platWalkNodesCount = index; _platWalkDirXIncr = 0; _platWalkDirYIncr = 0; @@ -925,7 +905,7 @@ bool GnapEngine::gridSub423CC1(int gridX, int gridY, int index) { return true; } -bool GnapEngine::gridSub42419A(int gridX, int gridY, int index) { +bool GnapEngine::platFindPath2(int gridX, int gridY, int index) { _platWalkNodesCount = index; _platWalkDirXIncr = 0; _platWalkDirYIncr = 0; @@ -1032,7 +1012,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { bool done = false; while (!done && gridIncr < _gridMaxX) { - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1042,7 +1022,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1052,7 +1032,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1062,7 +1042,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1072,7 +1052,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1082,7 +1062,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1092,7 +1072,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1102,7 +1082,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && gridSub423CC1(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1112,7 +1092,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1122,7 +1102,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y; @@ -1132,7 +1112,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1142,7 +1122,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1152,7 +1132,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1162,7 +1142,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; @@ -1172,7 +1152,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1182,7 +1162,7 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && gridSub42419A(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; @@ -1217,17 +1197,17 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (animationIndex >= 0 && _gnap->_pos == Common::Point(_platWalkDestX, _platWalkDestY)) gnapWalkStep(); - if (gridSub423CC1(_plat->_pos.x, _plat->_pos.y, 0)) + if (platFindPath1(_plat->_pos.x, _plat->_pos.y, 0)) done = true; - if (!done && gridSub42419A(_plat->_pos.x, _plat->_pos.y, 0)) + if (!done && platFindPath2(_plat->_pos.x, _plat->_pos.y, 0)) done = true; if (!done && platFindPath3(_plat->_pos.x, _plat->_pos.y)) done = true; if (!done) - gridSub423750(_plat->_pos.x, _plat->_pos.y); + platFindPath4(_plat->_pos.x, _plat->_pos.y); int platSequenceId = _plat->_sequenceId; int platId = _plat->_id; @@ -1268,7 +1248,7 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se _platWalkNodes[index]._id -= 10; else _platWalkNodes[index]._id += 10; - int newSequenceId = getPlatypusWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); + int newSequenceId = _plat->getWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index]._id, makeRid(platSequenceDatNum, platSequenceId), platId, kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); -- cgit v1.2.3 From 3209ce80033e10b1801ce9e8075aaabdace2a071 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 10:31:09 +0200 Subject: GNAP: Fix a small bug in Playtpuss pathfinding --- engines/gnap/grid.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 271f3494ee..d38f53b1e0 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -1206,8 +1206,8 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se if (!done && platFindPath3(_plat->_pos.x, _plat->_pos.y)) done = true; - if (!done) - platFindPath4(_plat->_pos.x, _plat->_pos.y); + if (!done && platFindPath4(_plat->_pos.x, _plat->_pos.y)) + done = true; int platSequenceId = _plat->_sequenceId; int platId = _plat->_id; -- cgit v1.2.3 From 81074f4503fbb09903c62f5dbb857c741c75cfc3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 12:29:18 +0200 Subject: GNAP: use Common::Point for gnapWalkTo --- engines/gnap/gnap.cpp | 16 ++-- engines/gnap/gnap.h | 2 +- engines/gnap/grid.cpp | 80 +++++++++++------ engines/gnap/scenes/group0.cpp | 186 +++++++++++++++++++------------------- engines/gnap/scenes/group1.cpp | 178 ++++++++++++++++++------------------ engines/gnap/scenes/group2.cpp | 198 ++++++++++++++++++++--------------------- engines/gnap/scenes/group3.cpp | 80 ++++++++--------- engines/gnap/scenes/group4.cpp | 126 +++++++++++++------------- 8 files changed, 447 insertions(+), 419 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 78c7617c73..36d288927d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1189,7 +1189,7 @@ void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { if (_plat->_pos.x == gridX && _plat->_pos.y == gridY) platypusMakeRoom(); - gnapWalkTo(gridX, gridY, -1, -1, 1); + gnapWalkTo(Common::Point(gridX, gridY), -1, -1, 1); playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); } @@ -1199,7 +1199,7 @@ bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gr _gameSys->setAnimation(0, 0, animationIndex); _gnap->_actionStatus = -1; _plat->_actionStatus = -1; - gnapWalkTo(gridX1, gridY1, -1, -1, 1); + gnapWalkTo(Common::Point(gridX1, gridY1), -1, -1, 1); platypusWalkTo(gridX2, gridY2, -1, -1, 1); _mouseClickState._left = false; return true; @@ -1222,17 +1222,21 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in if (_gnap->_actionStatus <= -1 && _plat->_actionStatus <= -1) { _gnap->_actionStatus = 100; - if (isPointBlocked(_plat->_pos.x + gridX, _plat->_pos.y + gridY) && (_gnap->_pos != Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY))) + Common::Point checkPt = _plat->_pos + Common::Point(gridX, gridY); + if (isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) { platypusWalkStep(); - if (!isPointBlocked(_plat->_pos.x + gridX, _plat->_pos.y + gridY) && (_gnap->_pos != Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY))) { - gnapWalkTo(_plat->_pos.x + gridX, _plat->_pos.y + gridY, 0, 0x107B9, 1); + checkPt = _plat->_pos + Common::Point(gridX, gridY); + } + + if (!isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) { + gnapWalkTo(checkPt, 0, 0x107B9, 1); while (_gameSys->getAnimationStatus(0) != 2) { updateMouseCursor(); doCallback(callback); gameUpdateTick(); } _gameSys->setAnimation(0, 0, 0); - if (_gnap->_pos == Common::Point(_plat->_pos.x + gridX, _plat->_pos.y + gridY)) { + if (_gnap->_pos == _plat->_pos + Common::Point(gridX, gridY)) { _gameSys->setAnimation(platSequenceId, _plat->_id, 1); _plat->playSequence(platSequenceId); while (_gameSys->getAnimationStatus(1) != 2) { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index d54d4d91f7..619afdd7a8 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -478,6 +478,7 @@ public: int _gridMinX, _gridMinY; int _gridMaxX, _gridMaxY; bool isPointBlocked(int gridX, int gridY); + bool isPointBlocked(Common::Point gridPos); void initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gridMaxY); bool testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2); @@ -494,7 +495,6 @@ public: bool gnapFindPath3(int gridX, int gridY); bool gnapFindPath4(int gridX, int gridY); bool gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); - bool gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); void gnapWalkStep(); // Platypus walking diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index d38f53b1e0..21881a7581 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -58,6 +58,10 @@ Facing GnapEngine::getGnapWalkFacing(int deltaX, int deltaY) { return _gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; } +bool GnapEngine::isPointBlocked(Common::Point gridPos) { + return isPointBlocked(gridPos.x, gridPos.y); +} + bool GnapEngine::isPointBlocked(int gridX, int gridY) { if (gridX < 0 || gridX >= _gridMaxX || gridY < 0 || gridY >= _gridMaxY) @@ -528,19 +532,17 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { } bool GnapEngine::gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { - return gnapWalkTo(gridPos.x, gridPos.y, animationIndex, sequenceId, flags); -} - -bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { int datNum = flags & 3; bool done = false; _timers[2] = 200; _timers[3] = 300; + int gridX = gridPos.x; if (gridX < 0) gridX = (_leftClickMouseX - _gridMinX + 37) / 75; + int gridY = gridPos.y; if (gridY < 0) gridY = (_leftClickMouseY - _gridMinY + 24) / 48; @@ -705,27 +707,54 @@ bool GnapEngine::gnapWalkTo(int gridX, int gridY, int animationIndex, int sequen } void GnapEngine::gnapWalkStep() { - bool done = false; - for (int i = 1; i < _gridMaxX && !done; ++i) { - done = true; - if (!isPointBlocked(_gnap->_pos.x + i, _gnap->_pos.y)) - gnapWalkTo(_gnap->_pos.x + i, _gnap->_pos.y, -1, -1, 1); - else if (!isPointBlocked(_gnap->_pos.x - i, _gnap->_pos.y)) - gnapWalkTo(_gnap->_pos.x - i, _gnap->_pos.y, -1, -1, 1); - else if (!isPointBlocked(_gnap->_pos.x, _gnap->_pos.y + 1)) - gnapWalkTo(_gnap->_pos.x, _gnap->_pos.y + 1, -1, -1, 1); - else if (!isPointBlocked(_gnap->_pos.x, _gnap->_pos.y - 1)) - gnapWalkTo(_gnap->_pos.x, _gnap->_pos.y - 1, -1, -1, 1); - else if (!isPointBlocked(_gnap->_pos.x + 1, _gnap->_pos.y + 1)) - gnapWalkTo(_gnap->_pos.x + 1, _gnap->_pos.y + 1, -1, -1, 1); - else if (!isPointBlocked(_gnap->_pos.x - 1, _gnap->_pos.y + 1)) - gnapWalkTo(_gnap->_pos.x - 1, _gnap->_pos.y + 1, -1, -1, 1); - else if (!isPointBlocked(_gnap->_pos.x + 1, _gnap->_pos.y - 1)) - gnapWalkTo(_gnap->_pos.x + 1, _gnap->_pos.y - 1, -1, -1, 1); - else if (!isPointBlocked(_gnap->_pos.x - 1, _gnap->_pos.y - 1)) - gnapWalkTo(_gnap->_pos.x - 1, _gnap->_pos.y - 1, -1, -1, 1); - else - done = false; + for (int i = 1; i < _gridMaxX; ++i) { + Common::Point checkPt = Common::Point(_gnap->_pos.x + i, _gnap->_pos.y); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_gnap->_pos.x - i, _gnap->_pos.y); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_gnap->_pos.x, _gnap->_pos.y + 1); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_gnap->_pos.x, _gnap->_pos.y - 1); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_gnap->_pos.x + 1, _gnap->_pos.y + 1); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_gnap->_pos.x - 1, _gnap->_pos.y + 1); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_gnap->_pos.x + 1, _gnap->_pos.y - 1); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_gnap->_pos.x - 1, _gnap->_pos.y - 1); + if (!isPointBlocked(checkPt)) { + gnapWalkTo(checkPt, -1, -1, 1); + break; + } } } @@ -1179,7 +1208,6 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { } bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { - int datNum = flags & 3; bool done = false; diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 3ba263dcbe..c47c195071 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -96,7 +96,7 @@ void Scene01::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); - _vm->gnapWalkTo(8, 6, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107B9, 1); } else { _vm->_gnap->initPos(1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) @@ -158,7 +158,7 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: @@ -181,7 +181,7 @@ void Scene01::run() { _vm->playGnapScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 3) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 3) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01TakeMud; break; case TALK_CURSOR: @@ -201,17 +201,17 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01UsePigs; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: @@ -225,7 +225,7 @@ void Scene01::run() { case kHS01ExitTruck: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); @@ -242,12 +242,12 @@ void Scene01::run() { case kHS01WalkArea7: case kHS01WalkArea8: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -418,14 +418,14 @@ void Scene02::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); - _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107BA, 1); break; case 4: _vm->_gnap->initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(7, 6, 0, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(8, 6, 1, 0x107C2, 1); updateHotspots(); @@ -450,7 +450,7 @@ void Scene02::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; } @@ -504,8 +504,8 @@ void Scene02::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, - 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + Common::Point destPos = Common::Point(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1); + _vm->gnapWalkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); @@ -516,14 +516,14 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02GrabChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: @@ -538,7 +538,7 @@ void Scene02::run() { case kHS02Truck2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) @@ -548,7 +548,7 @@ void Scene02::run() { } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -560,7 +560,7 @@ void Scene02::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) _vm->_gnap->_actionStatus = kAS02UseTruckGas; else @@ -568,7 +568,7 @@ void Scene02::run() { } } else { _vm->_gnap->_idleFacing = kDirUnk4; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseTruckNoKeys; } break; @@ -592,7 +592,7 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: @@ -607,7 +607,7 @@ void Scene02::run() { case kHS02ExitHouse: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 0, 0x107AD, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, -1, 0x107C1, 1); @@ -619,7 +619,7 @@ void Scene02::run() { case kHS02ExitBarn: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, 0x107AD, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7].x + 1, _vm->_hotspotsWalkPos[7].y, -1, 0x107C1, 1); @@ -631,7 +631,7 @@ void Scene02::run() { case kHS02ExitCreek: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, -1, 0x107CD, 1); @@ -642,7 +642,7 @@ void Scene02::run() { case kHS02ExitPigpen: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, -1, 0x107CF, 1); @@ -655,12 +655,12 @@ void Scene02::run() { case kHS02WalkArea3: case kHS02WalkArea4: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -926,7 +926,7 @@ void Scene03::run() { if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(4, 7, -1, 0x107C2, 1); - _vm->gnapWalkTo(3, 6, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(3, 6), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -968,7 +968,7 @@ void Scene03::run() { case kHS03Grass: if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { @@ -996,7 +996,7 @@ void Scene03::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107AD, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, -1, 0x107C2, 1); @@ -1020,7 +1020,7 @@ void Scene03::run() { case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1037,7 +1037,7 @@ void Scene03::run() { case kHS03TrappedPlatypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 4); } else { @@ -1047,10 +1047,10 @@ void Scene03::run() { break; case GRAB_CURSOR: if (_platypusHypnotized) { - _vm->gnapWalkTo(7, 6, 0, 0x107B5, 1); + _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107B5, 1); _vm->_gnap->_actionStatus = kAS03FreePlatypus; } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else @@ -1062,7 +1062,7 @@ void Scene03::run() { _vm->playGnapBrainPulsating(8, 4); } else { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03HypnotizeScaredPlat; else @@ -1088,15 +1088,15 @@ void Scene03::run() { case kHS03WalkAreas2: case kHS03WalkAreas3: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS03PlatypusWalkArea: if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107B5, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107B5, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else @@ -1107,7 +1107,7 @@ void Scene03::run() { default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1407,7 +1407,7 @@ void Scene04::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(6, 9, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(6, 9), -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { _vm->_gnap->initPos(5, 7, kDirBottomRight); _vm->_plat->initPos(4, 7, kDirNone); @@ -1419,7 +1419,7 @@ void Scene04::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(9, 9, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(9, 9), -1, 0x107BA, 1); } } @@ -1507,7 +1507,7 @@ void Scene04::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); @@ -1535,7 +1535,7 @@ void Scene04::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS04GrabDog; break; case TALK_CURSOR: @@ -1565,13 +1565,13 @@ void Scene04::run() { break; case GRAB_CURSOR: if (_vm->_cursorValue == 1) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS04OpenDoor; _vm->_timers[5] = 300; _vm->_gnap->_idleFacing = kDirUpLeft; } else { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; _vm->_newSceneNum = 38; } @@ -1587,7 +1587,7 @@ void Scene04::run() { case kHS04ExitTruck: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); @@ -1607,7 +1607,7 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y, 0, _vm->_gnap->getSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7], 0, _vm->_gnap->getSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { if (_triedWindow) { _vm->_gnap->_actionStatus = kAS04GetKeyAnother; } else { @@ -1631,7 +1631,7 @@ void Scene04::run() { case kHS04ExitBarn: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); @@ -1645,12 +1645,12 @@ void Scene04::run() { case kHS04WalkArea1: case kHS04WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1890,7 +1890,7 @@ void Scene05::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(2, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 9, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 9), -1, 0x107B9, 1); } else { _vm->_gnap->initPos(6, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) @@ -1980,24 +1980,24 @@ void Scene05::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, - 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + Common::Point checkPt = _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1); + _vm->gnapWalkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; - } else if (_vm->_grabCursorSpriteIndex >= 0) { + } else if (_vm->_grabCursorSpriteIndex >= 0) _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); - } else { + else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->playGnapMoan2(9, 7); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: @@ -2019,7 +2019,7 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: @@ -2034,7 +2034,8 @@ void Scene05::run() { case kHS05Padlock: if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x - 1, _vm->_hotspotsWalkPos[2].y + 1, 0, -1, 1); + Common::Point destPt = _vm->_hotspotsWalkPos[2] + Common::Point(- 1, 1); + _vm->gnapWalkTo(destPt, 0, -1, 1); _vm->_gnap->_actionStatus = kAS05EnterBarn; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 6; @@ -2042,7 +2043,7 @@ void Scene05::run() { _vm->_newSceneNum = 36; } else if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2054,8 +2055,7 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, - 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: @@ -2070,7 +2070,7 @@ void Scene05::run() { case kHS05ExitHouse: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); @@ -2084,7 +2084,7 @@ void Scene05::run() { case kHS05WalkArea1: case kHS05WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS05WalkArea3: @@ -2093,7 +2093,7 @@ void Scene05::run() { default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2320,7 +2320,7 @@ void Scene06::run() { _vm->endSceneInit(); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -2382,7 +2382,7 @@ void Scene06::run() { _vm->playGnapImpossible(0, 0); } else if (triedDeviceOnGas) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS06TryToGetGas; } else { @@ -2415,7 +2415,7 @@ void Scene06::run() { if (_vm->isFlag(kGFGasTaken)) _vm->playGnapImpossible(0, 0); else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS06TryToClimbLadder; _vm->setFlag(kGFGasTaken); } @@ -2433,7 +2433,7 @@ void Scene06::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_idleFacing = kDirUpLeft; _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); @@ -2449,11 +2449,11 @@ void Scene06::run() { break; case TALK_CURSOR: if (_horseTurnedBack) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS06TalkToHorse; } @@ -2470,7 +2470,7 @@ void Scene06::run() { case kHS06ExitOutsideBarn: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS06LeaveScene; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; @@ -2485,12 +2485,12 @@ void Scene06::run() { case kHS06WalkArea4: case kHS06WalkArea5: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2739,9 +2739,9 @@ void Scene07::run() { case kHS07ExitHouse: _vm->_isLeavingScene = true; if (_vm->_gnap->_pos.x > 8) - _vm->gnapWalkTo(_vm->_gnap->_pos.x, 7, 0, 0x107AD, 1); + _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, 7), 0, 0x107AD, 1); else - _vm->gnapWalkTo(8, 7, 0, 0x107AD, 1); + _vm->gnapWalkTo(Common::Point(8, 7), 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS07LeaveScene; break; @@ -2783,7 +2783,7 @@ void Scene07::run() { case kHS07WalkArea1: case kHS07WalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS07WalkArea3: @@ -2792,7 +2792,7 @@ void Scene07::run() { default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2956,7 +2956,7 @@ void Scene08::run() { _vm->endSceneInit(); - _vm->gnapWalkTo(1, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(1, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); _vm->_timers[5] = _vm->getRandom(40) + 50; @@ -3011,7 +3011,7 @@ void Scene08::run() { case kHS08ExitBackdoor: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(0, 6, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(0, 6), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1); _vm->_newSceneNum = 9; @@ -3020,7 +3020,7 @@ void Scene08::run() { case kHS08ExitCrash: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(3, 9, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(3, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1); _vm->_newSceneNum = 7; @@ -3033,7 +3033,7 @@ void Scene08::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS08LookMan; _vm->_gnap->_idleFacing = kDirUpRight; break; @@ -3043,7 +3043,7 @@ void Scene08::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(8, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: @@ -3071,14 +3071,14 @@ void Scene08::run() { _vm->_gnap->_actionStatus = kAS08LookDog; break; case GRAB_CURSOR: - _vm->gnapWalkTo(4, 7, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(4, 7), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS08GrabDog; _vm->_gnap->_idleFacing = kDirUpRight; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(4, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: @@ -3175,13 +3175,13 @@ void Scene08::run() { case kHS08WalkArea1: case kHS08WalkArea2: _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(-1, 6, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, 6), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3386,7 +3386,7 @@ void Scene09::run() { _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(9, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { _vm->_gnap->initPos(4, 7, kDirBottomRight); @@ -3439,7 +3439,7 @@ void Scene09::run() { case kHS09ExitKitchen: _vm->_isLeavingScene = true; _vm->_newSceneNum = 10; - _vm->gnapWalkTo(4, 7, 0, 0x107BF, 1); + _vm->gnapWalkTo(Common::Point(4, 7), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS09LeaveScene; _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); _vm->_plat->_idleFacing = kDirUnk4; @@ -3448,7 +3448,7 @@ void Scene09::run() { case kHS09ExitHouse: _vm->_isLeavingScene = true; _vm->_newSceneNum = 8; - _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(10, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS09LeaveScene; _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); _vm->_plat->_idleFacing = kDirUnk4; @@ -3464,7 +3464,7 @@ void Scene09::run() { break; case GRAB_CURSOR: _vm->_gnap->_actionStatus = kAS09SearchTrash; - _vm->gnapWalkTo(9, 6, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(9, 6), 0, 0x107BC, 1); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -3477,12 +3477,12 @@ void Scene09::run() { case kHS09WalkArea1: case kHS09WalkArea2: case kHS09WalkArea3: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 3acce7f866..630a6940f8 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -75,13 +75,13 @@ void Scene10::run() { _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(9, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(9, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); } else { _vm->_gnap->initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(1, 7, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(1, 7), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } @@ -132,7 +132,7 @@ void Scene10::run() { case kHS10ExitBar: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(0, 7, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(0, 7), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; _vm->platypusWalkTo(0, 7, -1, 0x107CF, 1); _vm->_newSceneNum = 11; @@ -141,7 +141,7 @@ void Scene10::run() { case kHS10ExitBackdoor: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(2, 9, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(2, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; _vm->platypusWalkTo(3, 9, -1, 0x107C7, 1); _vm->_newSceneNum = 9; @@ -164,14 +164,14 @@ void Scene10::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(4, 8, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(4, 6, -1, -1, 1); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; } @@ -194,7 +194,7 @@ void Scene10::run() { _vm->playGnapMoan2(-1, -1); else { _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } break; @@ -208,7 +208,7 @@ void Scene10::run() { _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(3, 7, -1, -1, 1); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } break; @@ -226,7 +226,7 @@ void Scene10::run() { break; case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(4, 8, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case TALK_CURSOR: @@ -261,7 +261,7 @@ void Scene10::run() { break; case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(9, 6, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(9, 6), 0, 0x107BB, 1); gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_sequenceId = 0x10E; _vm->_gnap->_id = 120; @@ -283,7 +283,7 @@ void Scene10::run() { case kHS10WalkArea3: case kHS10WalkArea4: _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS10Device: @@ -296,7 +296,7 @@ void Scene10::run() { default: if (_vm->_mouseClickState._left) { _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -573,7 +573,7 @@ void Scene11::run() { _vm->endSceneInit(); if (_vm->_prevSceneNum == 12) { - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } @@ -612,7 +612,7 @@ void Scene11::run() { case kHS11ExitKitchen: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(6, 5, 0, 0x107BF, 1); + _vm->gnapWalkTo(Common::Point(6, 5), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; _vm->platypusWalkTo(6, 6, -1, -1, 1); _vm->_newSceneNum = 10; @@ -620,7 +620,7 @@ void Scene11::run() { case kHS11ExitToilet: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(8, 5, 0, 0x107BF, 1); + _vm->gnapWalkTo(Common::Point(8, 5), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; _vm->platypusWalkTo(8, 6, -1, -1, 1); _vm->_newSceneNum = 13; @@ -628,7 +628,7 @@ void Scene11::run() { case kHS11ExitLeft: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(-1, 8, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(-1, 8), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; _vm->platypusWalkTo(-1, 9, -1, 0x107CF, 1); _vm->_newSceneNum = 12; @@ -637,7 +637,7 @@ void Scene11::run() { case kHS11GoggleGuy: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemMagazine) { - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS11ShowMagazineToGoggleGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -653,7 +653,7 @@ void Scene11::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(3, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkGoggleGuy; break; } @@ -665,7 +665,7 @@ void Scene11::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_gnap->_idleFacing = kDirUpRight; if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(5, 6, 0, 0x107BC, 9); + _vm->gnapWalkTo(Common::Point(5, 6), 0, 0x107BC, 9); _vm->_gnap->_actionStatus = kAS11ShowItemToHookGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0); } else { @@ -674,12 +674,12 @@ void Scene11::run() { _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 3, 6) | 0x10000); break; case GRAB_CURSOR: - _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(5, 6), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS11GrabHookGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->gnapWalkTo(5, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(5, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: @@ -700,7 +700,7 @@ void Scene11::run() { _vm->playGnapScratchingHead(9, 8); break; case GRAB_CURSOR: - _vm->gnapWalkTo(9, 8, 0, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(9, 8), 0, 0x107BA, 1); _vm->_gnap->_actionStatus = kAS11GrabBillardBall; break; case TALK_CURSOR: @@ -718,7 +718,7 @@ void Scene11::run() { case kHS11WalkArea4: case kHS11WalkArea5: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS11Device: @@ -730,7 +730,7 @@ void Scene11::run() { default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -989,7 +989,7 @@ void Scene12::run() { _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 8, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } @@ -1030,7 +1030,7 @@ void Scene12::run() { case kHS12ExitRight: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(10, -1, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(10, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS12LeaveScene; _vm->platypusWalkTo(10, -1, -1, -1, 1); _vm->_newSceneNum = 11; @@ -1039,18 +1039,18 @@ void Scene12::run() { case kHS12ToothGuy: if (_vm->_grabCursorSpriteIndex == kItemQuarter) { _vm->_largeSprite = gameSys.createSurface(0x141); - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12QuarterToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12QuarterWithHoleToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 9); + _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12ShowItemToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); @@ -1060,12 +1060,12 @@ void Scene12::run() { _vm->playGnapScratchingHead(1, 2); break; case GRAB_CURSOR: - _vm->gnapWalkTo(3, 7, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS12GrabToothGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(3, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: @@ -1081,19 +1081,19 @@ void Scene12::run() { case kHS12Barkeeper: if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); + _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12QuarterWithBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 9); + _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12ShowItemToBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(6, 6, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12LookBarkeeper; break; @@ -1102,7 +1102,7 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(6, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(6, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: @@ -1116,26 +1116,26 @@ void Scene12::run() { case kHS12BeardGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(7, 6, 0, 0x107BB, 9); + _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12ShowItemToBeardGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12LookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. - _vm->gnapWalkTo(7, 6, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12GrabBeardGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 6, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: @@ -1152,7 +1152,7 @@ void Scene12::run() { case kHS12Jukebox: _vm->_newSceneNum = 15; _vm->_isLeavingScene = true; - _vm->gnapWalkTo(5, 6, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(5, 6), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS12LeaveScene; break; @@ -1161,12 +1161,12 @@ void Scene12::run() { case kHS12WalkArea3: case kHS12WalkArea4: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1539,7 +1539,7 @@ void Scene13::run() { case kHS13ExitBar: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(2, 7, 0, 0x107C0, 1); + _vm->gnapWalkTo(Common::Point(2, 7), 0, 0x107C0, 1); _vm->_gnap->_actionStatus = kAS13LeaveScene; _vm->platypusWalkTo(2, 8, -1, -1, 1); if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { @@ -1569,7 +1569,7 @@ void Scene13::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_sequenceDatNum = 0; } else { - _vm->gnapWalkTo(5, 5, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(5, 5), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS13BackToilet; _vm->_gnap->_idleFacing = kDirUpRight; } @@ -1590,7 +1590,7 @@ void Scene13::run() { case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->gnapWalkTo(6, 7, 0, 0xA9, 5); + _vm->gnapWalkTo(Common::Point(6, 7), 0, 0xA9, 5); _vm->_gnap->_actionStatus = kAS13FrontToilet; _vm->_gnap->_idleFacing = kDirBottomRight; break; @@ -1604,7 +1604,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS13LookScribble; _vm->_gnap->_idleFacing = kDirUpRight; break; @@ -1613,7 +1613,7 @@ void Scene13::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 7, -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0), 1); + _vm->gnapWalkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0), 1); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1633,7 +1633,7 @@ void Scene13::run() { _vm->_gnap->_actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->gnapWalkTo(8, 7, 0, -1, 1); + _vm->gnapWalkTo(Common::Point(8, 7), 0, -1, 1); _vm->_gnap->_actionStatus = kAS13GrabUrinal; break; case TALK_CURSOR: @@ -1655,7 +1655,7 @@ void Scene13::run() { _vm->_gnap->_actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->gnapWalkTo(4, 8, 0, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107B9, 1); _vm->_gnap->_actionStatus = kAS13GrabSink; break; case TALK_CURSOR: @@ -1674,7 +1674,7 @@ void Scene13::run() { case kHS13WalkArea7: case kHS13WalkArea8: case kHS13WalkArea9: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS13WalkArea1: @@ -1683,7 +1683,7 @@ void Scene13::run() { default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2322,7 +2322,7 @@ void Scene17::update() { _vm->updateMouseCursor(); _vm->updateGrabCursorSprite(0, 0); if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } } @@ -2419,7 +2419,7 @@ void Scene17::run() { _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { _vm->_gnap->initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; @@ -2473,7 +2473,7 @@ void Scene17::run() { _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { _vm->_gnap->initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); @@ -2532,7 +2532,7 @@ void Scene17::run() { } else { _vm->_gnap->useDeviceOnPlatypus(); _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 0, 0x107BA, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); _vm->_plat->_actionStatus = kAS17GetWrench1; _vm->_gnap->_actionStatus = kAS17GetWrench1; _vm->_timers[5] = _vm->getRandom(30) + 80; @@ -2593,7 +2593,7 @@ void Scene17::run() { case kHS17Phone1: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2634,7 +2634,7 @@ void Scene17::run() { case kHS17Phone2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2648,7 +2648,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else @@ -2680,7 +2680,7 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, 0, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS17LeaveScene; if (_vm->_plat->_actionStatus != kAS17PlatPhoningAssistant) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); @@ -2693,7 +2693,7 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS17LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); } @@ -2703,12 +2703,12 @@ void Scene17::run() { case kHS17WalkArea2: case kHS17WalkArea3: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } break; @@ -2998,7 +2998,7 @@ void Scene17::updateAnimations() { _vm->_plat->_sequenceDatNum = 0; _vm->_gnap->_sequenceId = 0x875; _vm->_plat->_sequenceId = 0x23F; - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->_actionStatus = kAS17GetWrench2; } break; @@ -3302,7 +3302,7 @@ void Scene18::closeHydrantValve() { _vm->_gnap->_actionStatus = kAS18LeaveScene; _vm->updateMouseCursor(); if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) { _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; waitForGnapAction(); @@ -3311,7 +3311,7 @@ void Scene18::closeHydrantValve() { waitForGnapAction(); } } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BA, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); _vm->_gnap->_actionStatus = kAS18CloseTopValve; waitForGnapAction(); } @@ -3384,7 +3384,7 @@ void Scene18::run() { } else { gameSys.setAnimation(_currPhoneSequenceId, 254, 3); } - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->clearFlag(kGFGnapControlsToyUFO); @@ -3395,19 +3395,19 @@ void Scene18::run() { _vm->_gnap->initPos(4, 11, kDirBottomRight); _vm->_plat->initPos(5, 11, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(4, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { _vm->_gnap->initPos(7, 7, kDirBottomRight); _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { _vm->_gnap->initPos(-1, 10, kDirBottomRight); _vm->_plat->initPos(-1, 10, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(3, 7, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(3, 7), -1, 0x107B9, 1); _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); } } @@ -3476,7 +3476,7 @@ void Scene18::run() { _vm->playGnapScratchingHead(3, 2); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -3513,12 +3513,12 @@ void Scene18::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), -1, -1, 1); _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 0, -1, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromHydrant; } break; @@ -3582,7 +3582,7 @@ void Scene18::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BA, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS18CloseTopValve; } else @@ -3626,7 +3626,7 @@ void Scene18::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; else @@ -3654,7 +3654,7 @@ void Scene18::run() { } else { _vm->_isLeavingScene = true; _vm->_newSceneNum = 19; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore].x, _vm->_hotspotsWalkPos[kHS18ExitToyStore].y, 0, 0x107C0, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); _vm->_gnap->_actionStatus = kAS18LeaveScene; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore].x + 1, _vm->_hotspotsWalkPos[kHS18ExitToyStore].y, -1, 0x107C2, 1); @@ -3671,7 +3671,7 @@ void Scene18::run() { closeHydrantValve(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].x, _vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); @@ -3690,7 +3690,7 @@ void Scene18::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity].x, _vm->_hotspotsWalkPos[kHS18ExitGrubCity].y, 0, 0x107B2, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity], 0, 0x107B2, 1); _vm->_gnap->_actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(false); @@ -3707,7 +3707,7 @@ void Scene18::run() { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } @@ -3719,7 +3719,7 @@ void Scene18::run() { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } @@ -3840,7 +3840,7 @@ void Scene18::updateAnimations() { _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 0, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS18OpenTopValveDone; break; @@ -3938,7 +3938,7 @@ void Scene18::updateAnimations() { _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 0, 0x107BA, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; if (_vm->_gnap->_actionStatus == kAS18OpenRightValveNoGarbageCan) _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCanDone; @@ -4107,7 +4107,7 @@ void Scene19::run() { gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _shopAssistantCtr = 0; _vm->endSceneInit(); - _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(4, 9), -1, 0x107B9, 1); updateHotspots(); } else { _currShopAssistantSequenceId = 0x6D; @@ -4118,7 +4118,7 @@ void Scene19::run() { _vm->_gnap->initPos(3, 6, kDirBottomRight); _vm->_plat->initPos(4, 6, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(4, 9, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(4, 9), -1, 0x107B9, 1); _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); } @@ -4170,7 +4170,7 @@ void Scene19::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS19WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 0, 0x107B2, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, 0x107B2, 1); _vm->_gnap->_actionStatus = kAS19LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); @@ -4215,7 +4215,7 @@ void Scene19::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: @@ -4243,7 +4243,7 @@ void Scene19::run() { _vm->playGnapMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); _vm->_gnap->_actionStatus = kAS19GrabToy; break; @@ -4266,7 +4266,7 @@ void Scene19::run() { _vm->playGnapScratchingHead(9, 1); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 0, -1, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); _vm->playGnapIdle(8, 2); _vm->_gnap->_actionStatus = kAS19UsePhone; break; @@ -4283,12 +4283,12 @@ void Scene19::run() { case kHS19WalkArea2: case kHS19WalkArea3: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } } diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 237000dfe2..8b742eea9d 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -208,7 +208,7 @@ void Scene20::run() { } _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { @@ -216,28 +216,28 @@ void Scene20::run() { _vm->_gnap->initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 18: _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); break; case 21: _vm->_gnap->initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 22: _vm->_gnap->initPos(7, 6, kDirBottomRight); _vm->_plat->initPos(8, 6, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); break; default: @@ -245,7 +245,7 @@ void Scene20::run() { _vm->_plat->initPos(9, 6, kDirUnk4); _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; break; @@ -302,7 +302,7 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 21; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y + 1, -1, 0x107CF, 1); _vm->_plat->_idleFacing = kDirUnk4; @@ -315,7 +315,7 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x + 1, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, -1, 0x107C2, 1); } @@ -328,7 +328,7 @@ void Scene20::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y + 1, -1, 0x107CD, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; @@ -341,7 +341,7 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y - 1, 0, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y, -1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirUnk4; @@ -354,7 +354,7 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, 0, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, -1, 0x107C2, 1); } @@ -371,7 +371,7 @@ void Scene20::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_stonerGuyShowingJoint) _vm->_gnap->_actionStatus = kAS20GrabJoint; else @@ -379,7 +379,7 @@ void Scene20::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) _vm->_gnap->_actionStatus = kAS20TalkStonerGuyNoJoint; else @@ -405,12 +405,12 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: @@ -425,7 +425,7 @@ void Scene20::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); @@ -437,7 +437,7 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: @@ -451,12 +451,12 @@ void Scene20::run() { case kHS20WalkArea1: case kHS20WalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -625,7 +625,7 @@ void Scene20::updateAnimations() { _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(3, 8, -1, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(3, 8), -1, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = -1; break; case kAS20GrabJointDone: @@ -674,7 +674,7 @@ void Scene20::updateAnimations() { _currGroceryStoreGuySequenceId = 377; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = -1; - _vm->gnapWalkTo(4, 8, -1, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107BB, 1); break; case 0x17C: gameSys.setAnimation(0, 0, 3); @@ -757,7 +757,7 @@ void Scene21::run() { if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } } else { @@ -769,7 +769,7 @@ void Scene21::run() { _nextOldLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } @@ -841,7 +841,7 @@ void Scene21::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; - _vm->gnapWalkTo(4, 6, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 6, 7, 4); @@ -853,13 +853,13 @@ void Scene21::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(7, 6, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady].x, _vm->_hotspotsWalkPos[kHS21OldLady].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: @@ -874,7 +874,7 @@ void Scene21::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, 0, 0x107B3, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); _vm->_gnap->_actionStatus = kAS21LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, -1, 0x107C2, 1); } @@ -882,12 +882,12 @@ void Scene21::run() { case kHS21WalkArea1: case kHS21WalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1050,7 +1050,7 @@ void Scene22::run() { _vm->_gnap->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); _vm->_plat->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); } @@ -1134,7 +1134,7 @@ void Scene22::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS22LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); } @@ -1144,7 +1144,7 @@ void Scene22::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 23; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS22LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, -1, 0x107C2, 1); } @@ -1164,8 +1164,7 @@ void Scene22::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, - 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: @@ -1178,12 +1177,12 @@ void Scene22::run() { case kHS22WalkArea1: case kHS22WalkArea2: - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1302,9 +1301,9 @@ void Scene23::run() { _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); if (_vm->isFlag(kGFUnk24)) { - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else { - _vm->gnapWalkTo(2, 7, 0, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 7), 0, 0x107B9, 1); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); @@ -1364,8 +1363,7 @@ void Scene23::run() { if (_vm->isFlag(kGFSceneFlag1)) _vm->playGnapMoan2(0, 0); else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, - 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS23LookCereals; } break; @@ -1374,8 +1372,7 @@ void Scene23::run() { _vm->playGnapImpossible(0, 0); else { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, - 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); _vm->_gnap->_actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); @@ -1394,7 +1391,7 @@ void Scene23::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS23LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y - 1, -1, 0x107C2, 1); } @@ -1403,12 +1400,12 @@ void Scene23::run() { case kHS23WalkArea1: case kHS23WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1569,13 +1566,13 @@ void Scene24::run() { _vm->_gnap->initPos(1, 8, kDirBottomRight); _vm->_plat->initPos(2, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(1, 9, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(1, 9), -1, 0x107B9, 1); _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); } else { _vm->_gnap->initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(8, 8, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); } @@ -1627,7 +1624,7 @@ void Scene24::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, -1, 0x107C2, 1); } @@ -1638,7 +1635,7 @@ void Scene24::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); } @@ -1648,12 +1645,12 @@ void Scene24::run() { case kHS24WalkArea2: case kHS24WalkArea3: if (_vm->_gnap->_actionStatus == -1) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1818,13 +1815,13 @@ void Scene25::run() { _vm->_gnap->initPos(5, 11, kDirUpLeft); _vm->_plat->initPos(6, 11, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(5, 7, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(5, 7), -1, 0x107BA, 1); _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); } else { _vm->_gnap->initPos(5, 6, kDirBottomRight); _vm->_plat->initPos(6, 6, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } @@ -1873,8 +1870,7 @@ void Scene25::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, - 0, _vm->_gnap->getSequenceId(gskIdle, 9, 4) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, 9, 4) | 0x10000, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1888,7 +1884,7 @@ void Scene25::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: @@ -1904,7 +1900,7 @@ void Scene25::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, 0, 0x107B4, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); _vm->_gnap->_actionStatus = kAS25LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, -1, 0x107C2, 1); } @@ -1916,13 +1912,13 @@ void Scene25::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, 0, 0x107B1, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); _vm->_gnap->_actionStatus = kAS25LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, -1, 0x107C2, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } else { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(4, 5, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(4, 5), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicket; _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } @@ -1939,7 +1935,7 @@ void Scene25::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, -1, -1, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], -1, -1, 1); if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) _vm->_gnap->_idleFacing = kDirUpLeft; else if (_vm->_sceneClickedHotspot == 8) @@ -1962,12 +1958,12 @@ void Scene25::run() { case kHS25WalkArea1: case kHS25WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2048,7 +2044,7 @@ void Scene25::updateAnimations() { _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; _vm->playGnapIdle(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, -1, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicketDone; break; @@ -2137,7 +2133,7 @@ void Scene26::run() { _vm->_gnap->initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } else { _vm->_gnap->initPos(2, 8, kDirBottomRight); @@ -2190,7 +2186,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2199,7 +2195,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2208,7 +2204,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2217,7 +2213,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 30; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[4].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitElephant].y), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2226,7 +2222,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2234,12 +2230,12 @@ void Scene26::run() { case kHS26WalkArea1: case kHS26WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2354,21 +2350,21 @@ void Scene27::run() { _vm->_gnap->initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); break; case 29: _vm->_gnap->initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); break; case 31: _vm->_gnap->initPos(12, 8, kDirBottomLeft); _vm->_plat->initPos(12, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); break; default: @@ -2424,7 +2420,7 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemPicture) { _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, 0x107BC, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) _vm->_gnap->_actionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); @@ -2435,7 +2431,7 @@ void Scene27::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: @@ -2474,7 +2470,7 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, -1, 0x107C7, 1); } @@ -2484,7 +2480,7 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade].x, _vm->_hotspotsWalkPos[kHS27ExitArcade].y + 1, -1, 0x107CF, 1); } @@ -2494,7 +2490,7 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand].x, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y + 1, -1, 0x107CD, 1); } @@ -2505,12 +2501,12 @@ void Scene27::run() { if (_vm->isFlag(kGFPlatypus)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 28; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, _vm->_hotspotsWalkPos[kHS27ExitClown].y, 0, 0x107AD, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x + 1, _vm->_hotspotsWalkPos[kHS27ExitClown].y, -1, 0x107C4, 1); } else { _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= SF_WALKABLE; _vm->_gnap->_actionStatus = kAS27TryEnterClownTent; } @@ -2519,12 +2515,12 @@ void Scene27::run() { case kHS27WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2618,7 +2614,7 @@ void Scene27::updateAnimations() { break; case kAS27TryEnterClownTentDone: _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7].x, 9, -1, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[7].x, 9), -1, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = -1; break; @@ -2808,9 +2804,9 @@ void Scene28::run() { } } else { _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(2, 8, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(2, 8), 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y, 0, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Horn], 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS28GrabHornFails; } @@ -2833,13 +2829,13 @@ void Scene28::run() { _vm->playGnapImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS28UsePillBucketWithClown; @@ -2852,7 +2848,7 @@ void Scene28::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(5, 8, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: @@ -2869,7 +2865,7 @@ void Scene28::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, 0, 0x107BF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS28LeaveScene; _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, -1, 0x107C2, 1); @@ -2903,12 +2899,12 @@ void Scene28::run() { case kHS28WalkArea1: case kHS28WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3007,7 +3003,7 @@ void Scene28::updateAnimations() { _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; _vm->_gnap->_actionStatus = -1; - _vm->gnapWalkTo(2, 8, -1, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107BB, 1); break; case kAS28TalkClown: _clownTalkCtr = (_clownTalkCtr + 1) % 2; @@ -3131,13 +3127,13 @@ void Scene29::run() { _vm->_gnap->initPos(12, 7, kDirBottomRight); _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 7, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(8, 7), -1, 0x107B9, 1); _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); } else { _vm->_gnap->initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 7, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); } @@ -3186,7 +3182,7 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; @@ -3214,7 +3210,7 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS29LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, -1, -1, 1); } @@ -3224,7 +3220,7 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS29LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y - 1, -1, 0x107CD, 1); } @@ -3236,7 +3232,7 @@ void Scene29::run() { _vm->setGrabCursorSprite(-1); _vm->_isLeavingScene = true; _vm->_newSceneNum = 52; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 0, -1, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); _vm->_gnap->_actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -3258,12 +3254,12 @@ void Scene29::run() { case kHS29WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index c89d954906..be8b9113fc 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -67,7 +67,7 @@ void Scene30::run() { _vm->_gnap->initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); while (!_vm->_sceneDone) { @@ -115,7 +115,7 @@ void Scene30::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { _vm->_hotspots[kHS30WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine], 0, 0x107BC, 1); _vm->_hotspots[kHS30WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS30UsePillMachine; hasTakenPill = true; @@ -124,7 +124,7 @@ void Scene30::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(9, 8, 0, 0x107BC, 1); + _vm->gnapWalkTo(Common::Point(9, 8), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS30LookPillMachine; break; case GRAB_CURSOR: @@ -146,7 +146,7 @@ void Scene30::run() { _vm->_newSceneNum = 47; else _vm->_newSceneNum = 26; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS30LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, -1, 0x107C2, 1); } @@ -154,12 +154,12 @@ void Scene30::run() { case kHS30WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -254,7 +254,7 @@ void Scene30::updateAnimations() { break; case kAS30UsePillMachine4: gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y + 1, -1, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine] + Common::Point(0, 1), -1, 0x107BC, 1); _vm->_gnap->_actionStatus = -1; break; case kAS30LookPillMachine: @@ -315,13 +315,13 @@ void Scene31::run() { _vm->_gnap->initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(3, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); } else { _vm->_gnap->initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(7, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(6, 8, -1, 0x107D2, 1); } @@ -381,9 +381,9 @@ void Scene31::run() { _vm->playGnapScratchingHead(2, 2); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, -1, -1, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 0, 0x107B9, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 0, 0x107B9, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS31UseMeasuringClown; _vm->_timers[4] = 300; @@ -418,7 +418,7 @@ void Scene31::run() { gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->playGnapPullOutDevice(6, 8); _vm->playGnapUseDevice(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeer; _vm->_timers[4] = 300; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -432,7 +432,7 @@ void Scene31::run() { if (_beerGuyDistracted) { _vm->playGnapScratchingHead(6, 2); } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS31UseBeerBarrel; _vm->_gnap->_idleFacing = kDirUpLeft; } @@ -450,7 +450,7 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS31LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, -1, -1, 1); } @@ -460,7 +460,7 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->gnapWalkTo(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS31LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y + 1, -1, 0x107CF, 1); } @@ -468,12 +468,12 @@ void Scene31::run() { case kHS31WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -668,7 +668,7 @@ void Scene32::run() { _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); - _vm->gnapWalkTo(8, 6, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107BA, 1); } else { _vm->_gnap->initPos(1, 6, kDirBottomRight); _vm->_plat->initPos(1, 7, kDirNone); @@ -719,7 +719,7 @@ void Scene32::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS32LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y + 1, -1, 0x107CD, 1); _vm->_newSceneNum = 33; @@ -735,13 +735,13 @@ void Scene32::run() { case kHS32WalkArea7: case kHS32WalkArea8: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; } if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } @@ -829,7 +829,7 @@ void Scene33::run() { _vm->_gnap->initPos(11, 7, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 7, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 7), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); break; case 37: @@ -842,7 +842,7 @@ void Scene33::run() { _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; default: _vm->_gnap->initPos(3, 7, kDirBottomRight); @@ -899,14 +899,14 @@ void Scene33::run() { switch (_vm->_verbCursor) { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS33UseChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken].x, _vm->_hotspotsWalkPos[kHS33Chicken].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: @@ -926,7 +926,7 @@ void Scene33::run() { if (_vm->_gnap->_pos.x > 6) _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); else - _vm->gnapWalkTo(6, 7, 0, 0x107B1, 1); + _vm->gnapWalkTo(Common::Point(6, 7), 0, 0x107B1, 1); } break; @@ -938,14 +938,14 @@ void Scene33::run() { if (_vm->_gnap->_pos.x > 7) _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); else - _vm->gnapWalkTo(7, 7, 0, 0x107B1, 1); + _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107B1, 1); } break; case kHS33ExitCreek: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, -1, 0x107CD, 1); _vm->_newSceneNum = 34; @@ -955,7 +955,7 @@ void Scene33::run() { case kHS33ExitPigpen: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, 0, 0x107AF, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, -1, 0x107CF, 1); _vm->_newSceneNum = 32; @@ -965,12 +965,12 @@ void Scene33::run() { case kHS33WalkArea1: case kHS33WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1172,7 +1172,7 @@ void Scene38::run() { _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; } else { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(-1, -1, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS38LeaveScene; _vm->_newSceneNum = 37; } @@ -1186,7 +1186,7 @@ void Scene38::run() { } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { _vm->_sceneWaiting = false; _vm->_isLeavingScene = true; - _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; _vm->_gnap->_actionStatus = kAS38ExitCave; } @@ -1215,7 +1215,7 @@ void Scene38::run() { if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->playGnapImpossible(0, 0); else { - _vm->gnapWalkTo(3, 6, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(3, 6), 0, 0x107BB, 1); _vm->platypusWalkTo(4, 8, -1, -1, 1); _vm->_gnap->_actionStatus = kAS38UseHuntingTrophy; } @@ -1243,7 +1243,7 @@ void Scene38::run() { if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; else if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: @@ -1251,7 +1251,7 @@ void Scene38::run() { if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; else if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1327,7 +1327,7 @@ void Scene38::updateAnimations() { _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->_isLeavingScene) { _vm->_sceneWaiting = false; - _vm->gnapWalkTo(5, 7, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; _vm->_gnap->_actionStatus = kAS38ExitCave; } else { @@ -1491,7 +1491,7 @@ void Scene39::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y, 0, -1, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); _vm->showFullScreenSprite(0x1C); break; @@ -1516,12 +1516,12 @@ void Scene39::run() { case kHS39WalkArea1: case kHS39WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index e5e56510b3..f6f41e6be5 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -277,12 +277,12 @@ void Scene41::run() { _vm->_plat->initPos(-2, 8, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 42) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 8, kDirBottomRight); @@ -374,14 +374,14 @@ void Scene41::run() { case kHS41ExitCave: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitCave].x, _vm->_hotspotsWalkPos[kHS41ExitCave].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitCave], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; _vm->_newSceneNum = 40; break; case kHS41Exit: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, -1, 0x107CF, 1); _vm->_newSceneNum = 45; @@ -389,7 +389,7 @@ void Scene41::run() { case kHS41ExitBBQ: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, -1, 0x107CD, 1); _vm->_newSceneNum = 42; @@ -398,7 +398,7 @@ void Scene41::run() { case kHS41ToyVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->_gnap->_actionStatus = kAS41UseQuarterWithToyVendor; - _vm->gnapWalkTo(4, 7, 0, 0x107BB, 9); + _vm->gnapWalkTo(Common::Point(4, 7), 0, 0x107BB, 9); _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 7, 5, 0); @@ -412,7 +412,7 @@ void Scene41::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(4, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: @@ -424,7 +424,7 @@ void Scene41::run() { case kHS41Kid: if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { - _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -435,13 +435,13 @@ void Scene41::run() { _vm->playGnapScratchingHead(9, 0); break; case GRAB_CURSOR: - _vm->gnapWalkTo(7, 7, 0, 0x107BB, 1); + _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS41GrabKid; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(7, 7, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -460,7 +460,7 @@ void Scene41::run() { case kHS41WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -503,7 +503,7 @@ void Scene41::run() { _vm->_toyUfoActionStatus = kAS41ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -788,19 +788,19 @@ void Scene42::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 43) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); } @@ -886,7 +886,7 @@ void Scene42::run() { case kHS42ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, -1, 0x107C7, 1); _vm->_newSceneNum = 40; @@ -894,7 +894,7 @@ void Scene42::run() { case kHS42ExitToyStand: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_hotspotsWalkPos[kHS42ExitToyStand].y, -1, 0x107CF, 1); _vm->_newSceneNum = 41; @@ -902,7 +902,7 @@ void Scene42::run() { case kHS42ExitUfo: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_hotspotsWalkPos[kHS42ExitUfo].y, -1, 0x107CD, 1); _vm->_newSceneNum = 43; @@ -910,7 +910,7 @@ void Scene42::run() { case kHS42BBQVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, 0x107BB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendor; if (_vm->_plat->_pos.y < 9) _vm->platypusWalkTo(_vm->_plat->_pos.x, 9, -1, -1, 1); @@ -923,7 +923,7 @@ void Scene42::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: @@ -943,7 +943,7 @@ void Scene42::run() { _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, 0, 0x107BC, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS42GrabChickenLeg; break; case TALK_CURSOR: @@ -957,7 +957,7 @@ void Scene42::run() { case kHS42WalkArea1: case kHS42WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; } @@ -969,7 +969,7 @@ void Scene42::run() { _vm->_toyUfoActionStatus = kAS42ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1230,14 +1230,14 @@ void Scene43::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 44: _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); break; case 54: @@ -1250,7 +1250,7 @@ void Scene43::run() { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); break; } @@ -1344,7 +1344,7 @@ void Scene43::run() { case kHS43ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS43ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS43ExitUfoParty].y, -1, 0x107C7, 1); _vm->_newSceneNum = 40; @@ -1352,7 +1352,7 @@ void Scene43::run() { case kHS43ExitBBQ: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_hotspotsWalkPos[kHS43ExitBBQ].y, -1, 0x107CF, 1); _vm->_newSceneNum = 42; @@ -1360,7 +1360,7 @@ void Scene43::run() { case kHS43ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_hotspotsWalkPos[kHS43ExitKissinBooth].y, -1, 0x107CD, 1); _vm->_newSceneNum = 44; @@ -1376,7 +1376,7 @@ void Scene43::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(5, 8, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -1398,7 +1398,7 @@ void Scene43::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(3, 7, 0, 67515, 1); + _vm->gnapWalkTo(Common::Point(3, 7), 0, 67515, 1); _vm->_gnap->_actionStatus = 1; break; case TALK_CURSOR: @@ -1412,7 +1412,7 @@ void Scene43::run() { case kHS43WalkArea1: case kHS43WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -1423,7 +1423,7 @@ void Scene43::run() { _vm->_toyUfoActionStatus = 5; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1684,14 +1684,14 @@ void Scene44::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 7, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); break; case 46: _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(6, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(7, 8, -1, 0x107D2, 1); break; case 50: @@ -1715,7 +1715,7 @@ void Scene44::run() { _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(5, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); break; } } @@ -1792,14 +1792,14 @@ void Scene44::run() { case kHS44ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS44ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS44ExitUfo: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 43; @@ -1807,7 +1807,7 @@ void Scene44::run() { case kHS44ExitShow: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitShow].x, _vm->_hotspotsWalkPos[kHS44ExitShow].y, 0, 0x107AB, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitShow], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 46; break; @@ -1815,7 +1815,7 @@ void Scene44::run() { case kHS44KissingLady: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->_actionStatus = 2; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, -1, 9); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); } else { switch (_vm->_verbCursor) { @@ -1827,7 +1827,7 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady].x, _vm->_hotspotsWalkPos[kHS44KissingLady].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case PLAT_CURSOR: @@ -1881,7 +1881,7 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -1894,7 +1894,7 @@ void Scene44::run() { case kHS44WalkArea1: case kHS44WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; } @@ -1906,7 +1906,7 @@ void Scene44::run() { _vm->_toyUfoActionStatus = 7; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -2154,19 +2154,19 @@ void Scene45::run() { _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 41) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); - _vm->gnapWalkTo(10, 9, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(10, 9), -1, 0x107BA, 1); } else { _vm->_gnap->initPos(2, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 7, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); } if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { @@ -2284,7 +2284,7 @@ void Scene45::run() { case kHS45ExitUfoParty: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; } @@ -2293,7 +2293,7 @@ void Scene45::run() { case kHS45ExitShoe: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 46; @@ -2303,7 +2303,7 @@ void Scene45::run() { case kHS45ExitRight: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); _vm->_newSceneNum = 41; @@ -2320,7 +2320,7 @@ void Scene45::run() { case kHS45DiscoBall: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemSpring) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall].x, _vm->_hotspotsWalkPos[kHS45DiscoBall].y, 0, 0x9F, 5); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall], 0, 0x9F, 5); _vm->_gnap->_actionStatus = 1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemSpring); @@ -2343,7 +2343,7 @@ void Scene45::run() { case kHS45WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -2354,7 +2354,7 @@ void Scene45::run() { _vm->_toyUfoActionStatus = 3; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -2518,19 +2518,19 @@ void Scene46::run() { _vm->_plat->initPos(-1, 8, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(2, 8, -1, 0x107B9, 1); + _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 45) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(12, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(8, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); - _vm->gnapWalkTo(6, 8, -1, 0x107BA, 1); + _vm->gnapWalkTo(Common::Point(6, 8), -1, 0x107BA, 1); } _vm->_timers[4] = _vm->getRandom(50) + 80; @@ -2614,7 +2614,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -2635,7 +2635,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case GRAB_CURSOR: @@ -2648,14 +2648,14 @@ void Scene46::run() { case kHS46ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y, 0, 0x107AE, 1); + _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS46ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y, 0, 0x107AF, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); _vm->_newSceneNum = 44; @@ -2663,7 +2663,7 @@ void Scene46::run() { case kHS46ExitDisco: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y, 0, 0x107AB, 1); + _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); _vm->_newSceneNum = 45; @@ -2671,7 +2671,7 @@ void Scene46::run() { case kHS46WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -2682,7 +2682,7 @@ void Scene46::run() { _vm->_toyUfoActionStatus = 4; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->gnapWalkTo(-1, -1, -1, -1, 1); + _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); } } -- cgit v1.2.3 From b3bf17a315092b38c675360dcf360a54c054d791 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 15:52:56 +0200 Subject: GNAP: Use Common::Point with platypusWalkTo --- engines/gnap/gnap.cpp | 2 +- engines/gnap/gnap.h | 2 +- engines/gnap/grid.cpp | 75 ++++++++++++++++++++++++++------------ engines/gnap/scenes/group0.cpp | 56 ++++++++++++++--------------- engines/gnap/scenes/group1.cpp | 70 ++++++++++++++++++------------------ engines/gnap/scenes/group2.cpp | 82 +++++++++++++++++++++--------------------- engines/gnap/scenes/group3.cpp | 32 ++++++++--------- engines/gnap/scenes/group4.cpp | 66 +++++++++++++++++----------------- 8 files changed, 207 insertions(+), 178 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 36d288927d..9f1ae26150 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1200,7 +1200,7 @@ bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gr _gnap->_actionStatus = -1; _plat->_actionStatus = -1; gnapWalkTo(Common::Point(gridX1, gridY1), -1, -1, 1); - platypusWalkTo(gridX2, gridY2, -1, -1, 1); + platypusWalkTo(Common::Point(gridX2, gridY2), -1, -1, 1); _mouseClickState._left = false; return true; } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 619afdd7a8..59326b0511 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -507,7 +507,7 @@ public: bool platFindPath2(int gridX, int gridY, int index); bool platFindPath3(int gridX, int gridY); bool platFindPath4(int gridX, int gridY); - bool platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags); + bool platypusWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); void platypusWalkStep(); void platypusMakeRoom(); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 21881a7581..568fe2520e 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -1207,15 +1207,17 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { return done; } -bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int sequenceId, int flags) { +bool GnapEngine::platypusWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { int datNum = flags & 3; bool done = false; _timers[1] = 60; + int gridX = gridPos.x; if (gridX < 0) gridX = (_leftClickMouseX - _gridMinX + 37) / 75; + int gridY = gridPos.y; if (gridY < 0) gridY = (_leftClickMouseY - _gridMinY + 24) / 48; @@ -1365,27 +1367,54 @@ bool GnapEngine::platypusWalkTo(int gridX, int gridY, int animationIndex, int se } void GnapEngine::platypusWalkStep() { - bool done = false; - for (int i = 1; !done && i < _gridMaxX; ++i) { - done = true; - if (!isPointBlocked(_plat->_pos.x + i, _plat->_pos.y)) - platypusWalkTo(_plat->_pos.x + i, _plat->_pos.y, -1, -1, 1); - else if (!isPointBlocked(_plat->_pos.x - i, _plat->_pos.y)) - platypusWalkTo(_plat->_pos.x - i, _plat->_pos.y, -1, -1, 1); - else if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + 1)) - platypusWalkTo(_plat->_pos.x, _plat->_pos.y + 1, -1, -1, 1); - else if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - 1)) - platypusWalkTo(_plat->_pos.x, _plat->_pos.y - 1, -1, -1, 1); - else if (!isPointBlocked(_plat->_pos.x + 1, _plat->_pos.y + 1)) - platypusWalkTo(_plat->_pos.x + 1, _plat->_pos.y + 1, -1, -1, 1); - else if (!isPointBlocked(_plat->_pos.x - 1, _plat->_pos.y + 1)) - platypusWalkTo(_plat->_pos.x - 1, _plat->_pos.y + 1, -1, -1, 1); - else if (!isPointBlocked(_plat->_pos.x + 1, _plat->_pos.y - 1)) - platypusWalkTo(_plat->_pos.x + 1, _plat->_pos.y - 1, -1, -1, 1); - else if (!isPointBlocked(_plat->_pos.x - 1, _plat->_pos.y - 1)) - platypusWalkTo(_plat->_pos.x - 1, _plat->_pos.y - 1, -1, -1, 1); - else - done = false; + for (int i = 1; i < _gridMaxX; ++i) { + Common::Point checkPt = Common::Point(_plat->_pos.x + i, _plat->_pos.y); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_plat->_pos.x - i, _plat->_pos.y); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_plat->_pos.x, _plat->_pos.y + 1); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_plat->_pos.x, _plat->_pos.y - 1); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_plat->_pos.x + 1, _plat->_pos.y + 1); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_plat->_pos.x - 1, _plat->_pos.y + 1); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_plat->_pos.x + 1, _plat->_pos.y - 1); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_plat->_pos.x - 1, _plat->_pos.y - 1); + if (!isPointBlocked(checkPt)) { + platypusWalkTo(checkPt, -1, -1, 1); + break; + } } } @@ -1396,7 +1425,7 @@ void GnapEngine::platypusMakeRoom() { rndGridX = getRandom(_gridMaxX); } while (ABS(rndGridX - _plat->_pos.x) > 4 || ABS(rndGridY - _plat->_pos.y) > 3 || isPointBlocked(rndGridX, rndGridY)); - platypusWalkTo(rndGridX, rndGridY, -1, -1, 1); + platypusWalkTo(Common::Point(rndGridX, rndGridY), -1, -1, 1); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index c47c195071..8eeb4bf4d4 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -95,7 +95,7 @@ void Scene01::run() { _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(9, 6), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107B9, 1); } else { _vm->_gnap->initPos(1, 6, kDirBottomRight); @@ -228,7 +228,7 @@ void Scene01::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 2; } break; @@ -417,7 +417,7 @@ void Scene02::run() { _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(9, 6, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(9, 6), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107BA, 1); break; case 4: @@ -427,7 +427,7 @@ void Scene02::run() { _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(8, 6, 1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(8, 6), 1, 0x107C2, 1); updateHotspots(); gameSys.waitForUpdate(); break; @@ -449,7 +449,7 @@ void Scene02::run() { _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(2, 7), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; } @@ -610,7 +610,7 @@ void Scene02::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, -1, 0x107C1, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); _vm->_newSceneNum = 4; } @@ -622,7 +622,7 @@ void Scene02::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7].x + 1, _vm->_hotspotsWalkPos[7].y, -1, 0x107C1, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); _vm->_newSceneNum = 5; } @@ -634,7 +634,7 @@ void Scene02::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8], -1, 0x107CD, 1); _vm->_newSceneNum = 3; } break; @@ -645,7 +645,7 @@ void Scene02::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9].x, _vm->_hotspotsWalkPos[9].y, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9], -1, 0x107CF, 1); _vm->_newSceneNum = 1; } break; @@ -925,7 +925,7 @@ void Scene03::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(4, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(4, 7), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(3, 6), -1, 0x107B9, 1); while (!_vm->_sceneDone) { @@ -999,7 +999,7 @@ void Scene03::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2], -1, 0x107C2, 1); _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 2; @@ -1406,7 +1406,7 @@ void Scene04::run() { _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(5, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(6, 9), -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { _vm->_gnap->initPos(5, 7, kDirBottomRight); @@ -1418,7 +1418,7 @@ void Scene04::run() { _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(9, 9), -1, 0x107BA, 1); } } @@ -1590,7 +1590,7 @@ void Scene04::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x, _vm->_hotspotsWalkPos[5].y, -1, 0x107C7, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5], -1, 0x107C7, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 2; else @@ -1634,7 +1634,7 @@ void Scene04::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8].x, _vm->_hotspotsWalkPos[8].y + 1, -1, 0x107C1, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8] + Common::Point(0, 1), -1, 0x107C1, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; else @@ -1889,7 +1889,7 @@ void Scene05::run() { _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(2, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(2, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(2, 9), -1, 0x107B9, 1); } else { _vm->_gnap->initPos(6, 8, kDirBottomRight); @@ -1962,7 +1962,7 @@ void Scene05::run() { case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { _vm->_gnap->useDeviceOnPlatypus(); - if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y, 1, 0x107C2, 1)) { + if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { _vm->_plat->_actionStatus = kAS05PlatSearchHaystack; _vm->_plat->_idleFacing = kDirUnk4; } @@ -2073,7 +2073,7 @@ void Scene05::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y + 1, -1, 0x107C7, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4] + Common::Point(0, 1), -1, 0x107C7, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 4; else @@ -2319,7 +2319,7 @@ void Scene06::run() { _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); while (!_vm->_sceneDone) { @@ -2436,7 +2436,7 @@ void Scene06::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->platypusWalkTo(6, 8, 1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), 1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirNone; _vm->_gnap->_actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); @@ -2957,7 +2957,7 @@ void Scene08::run() { _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(1, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 7), -1, 0x107C2, 1); _vm->_timers[5] = _vm->getRandom(40) + 50; @@ -3013,7 +3013,7 @@ void Scene08::run() { _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(Common::Point(0, 6), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; - _vm->platypusWalkTo(0, 7, 1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(0, 7), 1, 0x107CF, 1); _vm->_newSceneNum = 9; break; @@ -3022,7 +3022,7 @@ void Scene08::run() { _vm->gnapActionIdle(0x14D); _vm->gnapWalkTo(Common::Point(3, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; - _vm->platypusWalkTo(4, 9, 1, 0x107C1, 1); + _vm->platypusWalkTo(Common::Point(4, 9), 1, 0x107C1, 1); _vm->_newSceneNum = 7; break; @@ -3049,7 +3049,7 @@ void Scene08::run() { case PLAT_CURSOR: _vm->gnapActionIdle(0x14D); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(6, 6, 1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithMan; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(6, 6); @@ -3085,7 +3085,7 @@ void Scene08::run() { _vm->setFlag(kGFSceneFlag1); _vm->gnapActionIdle(0x14D); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(3, 7, 1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(3, 7), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithDog; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(3, 7); @@ -3387,7 +3387,7 @@ void Scene09::run() { _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(9, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(4, 7, kDirBottomRight); _vm->_plat->initPos(5, 7, kDirNone); @@ -3441,7 +3441,7 @@ void Scene09::run() { _vm->_newSceneNum = 10; _vm->gnapWalkTo(Common::Point(4, 7), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS09LeaveScene; - _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107D2, 1); _vm->_plat->_idleFacing = kDirUnk4; break; @@ -3450,7 +3450,7 @@ void Scene09::run() { _vm->_newSceneNum = 8; _vm->gnapWalkTo(Common::Point(10, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS09LeaveScene; - _vm->platypusWalkTo(10, -1, -1, 0x107CD, 1); + _vm->platypusWalkTo(Common::Point(10, -1), -1, 0x107CD, 1); _vm->_plat->_idleFacing = kDirUnk4; break; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 630a6940f8..cb74bff32f 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -76,13 +76,13 @@ void Scene10::run() { _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(9, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(1, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); } _vm->_timers[4] = _vm->getRandom(80) + 150; @@ -134,7 +134,7 @@ void Scene10::run() { _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(Common::Point(0, 7), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; - _vm->platypusWalkTo(0, 7, -1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(0, 7), -1, 0x107CF, 1); _vm->_newSceneNum = 11; break; @@ -143,7 +143,7 @@ void Scene10::run() { _vm->gnapActionIdle(0x10C); _vm->gnapWalkTo(Common::Point(2, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; - _vm->platypusWalkTo(3, 9, -1, 0x107C7, 1); + _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C7, 1); _vm->_newSceneNum = 9; break; @@ -170,7 +170,7 @@ void Scene10::run() { case PLAT_CURSOR: _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(4, 6, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(4, 6), -1, -1, 1); _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; @@ -207,7 +207,7 @@ void Scene10::run() { else { _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(3, 7, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(3, 7), -1, -1, 1); _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } @@ -240,7 +240,7 @@ void Scene10::run() { _vm->setFlag(kGFMudTaken); _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(7, 6, 1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(7, 6), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS10PlatWithBox; _vm->_plat->_idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); @@ -574,7 +574,7 @@ void Scene11::run() { if (_vm->_prevSceneNum == 12) { _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); } gameSys.insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); @@ -614,7 +614,7 @@ void Scene11::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(6, 5), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; - _vm->platypusWalkTo(6, 6, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(6, 6), -1, -1, 1); _vm->_newSceneNum = 10; break; @@ -622,7 +622,7 @@ void Scene11::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(8, 5), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; - _vm->platypusWalkTo(8, 6, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(8, 6), -1, -1, 1); _vm->_newSceneNum = 13; break; @@ -630,7 +630,7 @@ void Scene11::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(-1, 8), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; - _vm->platypusWalkTo(-1, 9, -1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(-1, 9), -1, 0x107CF, 1); _vm->_newSceneNum = 12; break; @@ -990,7 +990,7 @@ void Scene12::run() { _vm->_plat->initPos(12, 8, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); } while (!_vm->_sceneDone) { @@ -1032,7 +1032,7 @@ void Scene12::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(10, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS12LeaveScene; - _vm->platypusWalkTo(10, -1, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(10, -1), -1, -1, 1); _vm->_newSceneNum = 11; break; @@ -1070,7 +1070,7 @@ void Scene12::run() { break; case PLAT_CURSOR: _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(3, 7, 1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(3, 7), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; _vm->_plat->_idleFacing = kDirUnk4; _vm->playGnapIdle(2, 7); @@ -1140,7 +1140,7 @@ void Scene12::run() { break; case PLAT_CURSOR: _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(7, 6, 1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(7, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(7, 6); @@ -1541,7 +1541,7 @@ void Scene13::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(2, 7), 0, 0x107C0, 1); _vm->_gnap->_actionStatus = kAS13LeaveScene; - _vm->platypusWalkTo(2, 8, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(2, 8), -1, -1, 1); if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { _vm->_newSceneNum = 11; } else { @@ -1694,7 +1694,7 @@ void Scene13::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) - _vm->platypusWalkTo(-1, 7, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(-1, 7), -1, -1, 1); if (_vm->_gnap->_actionStatus < 0) _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { @@ -2418,7 +2418,7 @@ void Scene17::run() { _vm->_gnap->initPos(4, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { _vm->_gnap->initPos(3, 9, kDirUpLeft); @@ -2472,7 +2472,7 @@ void Scene17::run() { _vm->_gnap->initPos(6, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { @@ -2506,7 +2506,7 @@ void Scene17::run() { _vm->_plat->_sequenceId = 0x7C1; _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_idleFacing = kDirBottomRight; - _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(2, 9), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -2531,7 +2531,7 @@ void Scene17::run() { _vm->_gnap->useJointOnPlatypus(); } else { _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6], 1, 0x107C2, 1); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); _vm->_plat->_actionStatus = kAS17GetWrench1; _vm->_gnap->_actionStatus = kAS17GetWrench1; @@ -2578,7 +2578,7 @@ void Scene17::run() { if (_canTryGetWrench) { platHangUpPhone(); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, 1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS17TryGetWrench; _vm->_gnap->_actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; @@ -2619,7 +2619,7 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; _vm->_gnap->_actionStatus = kAS17PlatUsePhone; @@ -2663,7 +2663,7 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; _vm->_gnap->_actionStatus = kAS17PlatUsePhone; @@ -2683,7 +2683,7 @@ void Scene17::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS17LeaveScene; if (_vm->_plat->_actionStatus != kAS17PlatPhoningAssistant) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5].x - 1, _vm->_hotspotsWalkPos[5].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; @@ -2695,7 +2695,7 @@ void Scene17::run() { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS17LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -3396,19 +3396,19 @@ void Scene18::run() { _vm->_plat->initPos(5, 11, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { _vm->_gnap->initPos(7, 7, kDirBottomRight); _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(-1, 10, kDirBottomRight); _vm->_plat->initPos(-1, 10, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(3, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(3, 8), -1, 0x107C2, 1); } } @@ -3657,7 +3657,7 @@ void Scene18::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); _vm->_gnap->_actionStatus = kAS18LeaveScene; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore].x + 1, _vm->_hotspotsWalkPos[kHS18ExitToyStore].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore] + Common::Point(1, 0), -1, 0x107C2, 1); } } break; @@ -3676,7 +3676,7 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].x + 1, _vm->_hotspotsWalkPos[kHS18ExitPhoneBooth].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -3695,7 +3695,7 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(false); else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity].x, _vm->_hotspotsWalkPos[kHS18ExitGrubCity].y - 1, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity] + Common::Point(0, -1), -1, 0x107CF, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -3744,7 +3744,7 @@ void Scene18::run() { _vm->_plat->_actionStatus = -1; _vm->_sceneWaiting = false; _vm->_plat->initPos(-1, 10, kDirNone); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C2, 1); _vm->clearFlag(kGFPlatypusTalkingToAssistant); } } else { @@ -4119,7 +4119,7 @@ void Scene19::run() { _vm->_plat->initPos(4, 6, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(4, 9), -1, 0x107B9, 1); - _vm->platypusWalkTo(5, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -4175,7 +4175,7 @@ void Scene19::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1].x + 1, _vm->_hotspotsWalkPos[1].y, -1, 0x107C5, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1] + Common::Point(1, 0), -1, 0x107C5, 1); _vm->_hotspots[kHS19WalkArea1]._flags &= ~SF_WALKABLE; } break; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 8b742eea9d..e02b2fa8b5 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -209,7 +209,7 @@ void Scene20::run() { _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 9), -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { case 17: @@ -217,28 +217,28 @@ void Scene20::run() { _vm->_plat->initPos(6, 11, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 18: _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 21: _vm->_gnap->initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 22: _vm->_gnap->initPos(7, 6, kDirBottomRight); _vm->_plat->initPos(8, 6, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(9, 9), -1, 0x107C2, 1); break; default: _vm->_gnap->initPos(8, 6, kDirBottomLeft); @@ -246,7 +246,7 @@ void Scene20::run() { _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(9, 9), -1, 0x107C2, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; break; } @@ -304,7 +304,7 @@ void Scene20::run() { _vm->_newSceneNum = 21; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot].x, _vm->_hotspotsWalkPos[kHS20ExitParkingLot].y + 1, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; @@ -317,7 +317,7 @@ void Scene20::run() { _vm->_newSceneNum = 17; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone].x + 1, _vm->_hotspotsWalkPos[kHS20ExitPhone].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -330,7 +330,7 @@ void Scene20::run() { _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].x, _vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore].y + 1, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -343,7 +343,7 @@ void Scene20::run() { _vm->_newSceneNum = 22; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; @@ -356,7 +356,7 @@ void Scene20::run() { _vm->_newSceneNum = 24; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -758,7 +758,7 @@ void Scene21::run() { gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); } } else { _vm->_gnap->initPos(5, 11, kDirBottomRight); @@ -770,7 +770,7 @@ void Scene21::run() { _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -876,7 +876,7 @@ void Scene21::run() { _vm->_newSceneNum = 20; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); _vm->_gnap->_actionStatus = kAS21LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1051,7 +1051,7 @@ void Scene22::run() { _vm->_plat->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107C2, 1); } if (_vm->isFlag(kGFSceneFlag1)) { @@ -1136,7 +1136,7 @@ void Scene22::run() { _vm->_newSceneNum = 20; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS22LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity].y + 1, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; @@ -1146,7 +1146,7 @@ void Scene22::run() { _vm->_newSceneNum = 23; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS22LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].x, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; @@ -1298,7 +1298,7 @@ void Scene23::run() { gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 7), -1, 0x107C2, 1); if (_vm->isFlag(kGFUnk24)) { _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); @@ -1393,7 +1393,7 @@ void Scene23::run() { _vm->_newSceneNum = 22; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS23LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].x, _vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity].y - 1, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity] + Common::Point(0, -1), -1, 0x107C2, 1); } break; @@ -1567,13 +1567,13 @@ void Scene24::run() { _vm->_plat->initPos(2, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(1, 9), -1, 0x107B9, 1); - _vm->platypusWalkTo(2, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(2, 9), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(8, 8, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(3, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(3, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -1626,7 +1626,7 @@ void Scene24::run() { _vm->_newSceneNum = 25; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS24ExitCircusWorld].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1637,7 +1637,7 @@ void Scene24::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].x + 1, _vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1816,13 +1816,13 @@ void Scene25::run() { _vm->_plat->initPos(6, 11, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 7), -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 7), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(5, 6, kDirBottomRight); _vm->_plat->initPos(6, 6, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -1902,7 +1902,7 @@ void Scene25::run() { _vm->_newSceneNum = 24; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); _vm->_gnap->_actionStatus = kAS25LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1914,7 +1914,7 @@ void Scene25::run() { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); _vm->_gnap->_actionStatus = kAS25LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].x + 1, _vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } else { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; @@ -2134,7 +2134,7 @@ void Scene26::run() { _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(2, 8, kDirBottomRight); _vm->_plat->initPos(3, 8, kDirNone); @@ -2351,21 +2351,21 @@ void Scene27::run() { _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; case 29: _vm->_gnap->initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 31: _vm->_gnap->initPos(12, 8, kDirBottomLeft); _vm->_plat->initPos(12, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(8, 9, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(8, 9), -1, 0x107C2, 1); break; default: _vm->_gnap->initPos(6, 8, kDirBottomRight); @@ -2472,7 +2472,7 @@ void Scene27::run() { _vm->_newSceneNum = 26; _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y, -1, 0x107C7, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus] + Common::Point(1, 0), -1, 0x107C7, 1); } break; @@ -2482,7 +2482,7 @@ void Scene27::run() { _vm->_newSceneNum = 29; _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade].x, _vm->_hotspotsWalkPos[kHS27ExitArcade].y + 1, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade] + Common::Point(0, 1), -1, 0x107CF, 1); } break; @@ -2492,7 +2492,7 @@ void Scene27::run() { _vm->_newSceneNum = 31; _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand].x, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y + 1, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand] + Common::Point(0, 1), -1, 0x107CD, 1); } break; @@ -2503,7 +2503,7 @@ void Scene27::run() { _vm->_newSceneNum = 28; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown].x + 1, _vm->_hotspotsWalkPos[kHS27ExitClown].y, -1, 0x107C4, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown] + Common::Point(1, 0), -1, 0x107C4, 1); } else { _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); @@ -2868,7 +2868,7 @@ void Scene28::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS28LeaveScene; _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown].x - 1, _vm->_hotspotsWalkPos[kHS28ExitOutsideClown].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; @@ -3128,13 +3128,13 @@ void Scene29::run() { _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(8, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 7, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 7), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -3212,7 +3212,7 @@ void Scene29::run() { _vm->_newSceneNum = 26; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS29LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS29ExitCircus].y, -1, -1, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; @@ -3222,7 +3222,7 @@ void Scene29::run() { _vm->_newSceneNum = 27; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS29LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS29ExitOutsideClown].y - 1, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown] + Common::Point(0, -1), -1, 0x107CD, 1); } break; @@ -3351,7 +3351,7 @@ void Scene29::updateAnimations() { _vm->_timers[5] = 30; while (_vm->_timers[5]) _vm->gameUpdateTick(); - _vm->platypusWalkTo(0, 8, 1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(0, 8), 1, 0x107CF, 1); while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); } else if (_nextMonkeySequenceId == -1) { diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index be8b9113fc..8a91123571 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -68,7 +68,7 @@ void Scene30::run() { _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -148,7 +148,7 @@ void Scene30::run() { _vm->_newSceneNum = 26; _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS30LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y, -1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -316,13 +316,13 @@ void Scene31::run() { _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(3, 9, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107D2, 1); } while (!_vm->_sceneDone) { @@ -394,9 +394,9 @@ void Scene31::run() { case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y, 1, 0x107C2, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; _vm->_plat->_actionStatus = kAS31PlatMeasuringClown; _vm->_gnap->_actionStatus = kAS31PlatMeasuringClown; @@ -452,7 +452,7 @@ void Scene31::run() { _vm->_newSceneNum = 26; _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS31LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus].x + 1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y, -1, -1, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; @@ -462,7 +462,7 @@ void Scene31::run() { _vm->_newSceneNum = 27; _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS31LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown].x, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y + 1, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown] + Common::Point(0, 1), -1, 0x107CF, 1); } break; @@ -667,7 +667,7 @@ void Scene32::run() { _vm->_gnap->initPos(11, 6, kDirBottomLeft); _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); - _vm->platypusWalkTo(9, 6, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 6), -1, 0x107D2, 1); _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107BA, 1); } else { _vm->_gnap->initPos(1, 6, kDirBottomRight); @@ -721,7 +721,7 @@ void Scene32::run() { _vm->setGrabCursorSprite(-1); _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS32LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck].x, _vm->_hotspotsWalkPos[kHS32ExitTruck].y + 1, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 33; } break; @@ -830,7 +830,7 @@ void Scene33::run() { _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 7), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 7, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 7), -1, 0x107D2, 1); break; case 37: _vm->_gnap->initPos(7, 7, kDirBottomRight); @@ -841,7 +841,7 @@ void Scene33::run() { _vm->_gnap->initPos(-1, 6, kDirBottomRight); _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(2, 7, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(2, 7), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; default: @@ -947,7 +947,7 @@ void Scene33::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS33LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek].x, _vm->_hotspotsWalkPos[kHS33ExitCreek].y, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], -1, 0x107CD, 1); _vm->_newSceneNum = 34; } break; @@ -957,7 +957,7 @@ void Scene33::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS33LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen].x, _vm->_hotspotsWalkPos[kHS33ExitPigpen].y, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], -1, 0x107CF, 1); _vm->_newSceneNum = 32; } break; @@ -1216,7 +1216,7 @@ void Scene38::run() { _vm->playGnapImpossible(0, 0); else { _vm->gnapWalkTo(Common::Point(3, 6), 0, 0x107BB, 1); - _vm->platypusWalkTo(4, 8, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(4, 8), -1, -1, 1); _vm->_gnap->_actionStatus = kAS38UseHuntingTrophy; } break; @@ -1355,7 +1355,7 @@ void Scene38::updateAnimations() { _vm->_plat->playSequence(0x107D5); else _vm->_plat->playSequence(0x107D4); - _vm->platypusWalkTo(8, 7, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(8, 7), -1, 0x107D2, 1); gameSys.insertSequence(0xA1, _vm->_gnap->_id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceId = 0xA1; _vm->_plat->_sequenceDatNum = 0; diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index f6f41e6be5..b805c1052c 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -276,14 +276,14 @@ void Scene41::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-2, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 42) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 8, kDirBottomRight); _vm->_plat->initPos(6, 8, kDirBottomLeft); @@ -383,7 +383,7 @@ void Scene41::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41Exit].x, -1, -1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), -1, 0x107CF, 1); _vm->_newSceneNum = 45; break; @@ -391,7 +391,7 @@ void Scene41::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1, -1, 0x107CD, 1); + _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), -1, 0x107CD, 1); _vm->_newSceneNum = 42; break; @@ -789,19 +789,19 @@ void Scene42::run() { _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 43) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -888,7 +888,7 @@ void Scene42::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; - _vm->platypusWalkTo(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y, -1, 0x107C7, 1); + _vm->platypusWalkTo(Common::Point(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; @@ -896,7 +896,7 @@ void Scene42::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_hotspotsWalkPos[kHS42ExitToyStand].y, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand], -1, 0x107CF, 1); _vm->_newSceneNum = 41; break; @@ -904,7 +904,7 @@ void Scene42::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_hotspotsWalkPos[kHS42ExitUfo].y, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo], -1, 0x107CD, 1); _vm->_newSceneNum = 43; break; @@ -913,7 +913,7 @@ void Scene42::run() { _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendor; if (_vm->_plat->_pos.y < 9) - _vm->platypusWalkTo(_vm->_plat->_pos.x, 9, -1, -1, 1); + _vm->platypusWalkTo(Common::Point(_vm->_plat->_pos.x, 9), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { @@ -1231,27 +1231,27 @@ void Scene43::run() { _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 44: _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; case 54: _vm->_gnap->initPos(4, 7, kDirBottomLeft); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; default: _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; } } @@ -1346,7 +1346,7 @@ void Scene43::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty].x, _vm->_hotspotsWalkPos[kHS43ExitUfoParty].y, -1, 0x107C7, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; @@ -1354,7 +1354,7 @@ void Scene43::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_hotspotsWalkPos[kHS43ExitBBQ].y, -1, 0x107CF, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ], -1, 0x107CF, 1); _vm->_newSceneNum = 42; break; @@ -1362,7 +1362,7 @@ void Scene43::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_hotspotsWalkPos[kHS43ExitKissinBooth].y, -1, 0x107CD, 1); + _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth], -1, 0x107CD, 1); _vm->_newSceneNum = 44; break; @@ -1685,14 +1685,14 @@ void Scene44::run() { _vm->_plat->initPos(-1, 7, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 46: _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(6, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(7, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(7, 8), -1, 0x107D2, 1); break; case 50: _vm->_gnap->initPos(4, 8, kDirBottomRight); @@ -1714,7 +1714,7 @@ void Scene44::run() { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(6, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); break; } @@ -1801,7 +1801,7 @@ void Scene44::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; @@ -1832,7 +1832,7 @@ void Scene44::run() { break; case PLAT_CURSOR: _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(6, 7, 1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(6, 7), 1, 0x107D2, 1); if (_vm->_gnap->_pos == Common::Point(7, 7)) _vm->gnapWalkStep(); _vm->playGnapIdle(5, 7); @@ -2153,19 +2153,19 @@ void Scene45::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 41) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(4, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107D2, 1); _vm->gnapWalkTo(Common::Point(10, 9), -1, 0x107BA, 1); } else { _vm->_gnap->initPos(2, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(4, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); } @@ -2295,7 +2295,7 @@ void Scene45::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 46; } break; @@ -2305,7 +2305,7 @@ void Scene45::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); + _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 41; } break; @@ -2517,19 +2517,19 @@ void Scene46::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(1, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 45) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(12, 8, kDirUpLeft); _vm->endSceneInit(); _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(9, 8, -1, 0x107D2, 1); + _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(5, 8, -1, 0x107C2, 1); + _vm->platypusWalkTo(Common::Point(5, 8), -1, 0x107C2, 1); _vm->gnapWalkTo(Common::Point(6, 8), -1, 0x107BA, 1); } @@ -2657,7 +2657,7 @@ void Scene46::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y, -1, 0x107CF, 1); + _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 44; break; @@ -2665,7 +2665,7 @@ void Scene46::run() { _vm->_isLeavingScene = true; _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y, -1, 0x107CD, 1); + _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 45; break; -- cgit v1.2.3 From 951fab48530ab6b411ce396f459bf66d120ce05d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 22:09:25 +0200 Subject: GNAP: Move walkTo and walkStep to Character --- engines/gnap/character.cpp | 400 +++++++++- engines/gnap/character.h | 30 + engines/gnap/gnap.cpp | 10 +- engines/gnap/gnap.h | 30 - engines/gnap/grid.cpp | 1561 +++++++++++++++------------------------- engines/gnap/scenes/group0.cpp | 240 +++--- engines/gnap/scenes/group1.cpp | 264 +++---- engines/gnap/scenes/group2.cpp | 286 ++++---- engines/gnap/scenes/group3.cpp | 120 +-- engines/gnap/scenes/group4.cpp | 194 ++--- 10 files changed, 1548 insertions(+), 1587 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 9503bfdd39..a15f4e9cad 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -35,10 +35,76 @@ Character::Character(GnapEngine *vm) : _vm(vm) { _id = 0; _gridX = 0; _gridY = 0; + + _walkNodesCount = 0; + _walkDestX = _walkDestY = 0; + _walkDeltaX = _walkDeltaY = 0; + _walkDirX = _walkDirY = 0; + _walkDirXIncr = _walkDirYIncr = 0; + + for(int i = 0; i < kMaxGridStructs; i++) { + _walkNodes[i]._id = 0; + _walkNodes[i]._sequenceId = 0; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = 0; + _walkNodes[i]._gridY1 = 0; + } } Character::~Character() {} +void Character::walkStep() { + for (int i = 1; i < _vm->_gridMaxX; ++i) { + Common::Point checkPt = Common::Point(_pos.x + i, _pos.y); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_pos.x - i, _pos.y); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_pos.x, _pos.y + 1); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_pos.x, _pos.y - 1); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_pos.x + 1, _pos.y + 1); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_pos.x - 1, _pos.y + 1); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_pos.x + 1, _pos.y - 1); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + + checkPt = Common::Point(_pos.x - 1, _pos.y - 1); + if (!_vm->isPointBlocked(checkPt)) { + walkTo(checkPt, -1, -1, 1); + break; + } + } +} /************************************************************************************************/ PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) { @@ -412,7 +478,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_plat->_sequenceId = 0x876; _vm->_plat->_idleFacing = kDirNone; playSequence(0x107B5); - _vm->gnapWalkStep(); + _vm->_gnap->walkStep(); while (_vm->_gameSys->getAnimationStatus(0) != 2) { _vm->updateMouseCursor(); _vm->gameUpdateTick(); @@ -608,6 +674,180 @@ int PlayerGnap::getWalkSequenceId(int deltaX, int deltaY) { return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; } +bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { + int datNum = flags & 3; + bool done = false; + + _vm->_timers[2] = 200; + _vm->_timers[3] = 300; + + int gridX = gridPos.x; + if (gridX < 0) + gridX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; + + int gridY = gridPos.y; + if (gridY < 0) + gridY = (_vm->_leftClickMouseY - _vm->_gridMinY + 24) / 48; + + _walkDestX = CLIP(gridX, 0, _vm->_gridMaxX - 1); + _walkDestY = CLIP(gridY, 0, _vm->_gridMaxY - 1); + + if (animationIndex >= 0 && _walkDestX == _vm->_plat->_pos.x && _walkDestY == _vm->_plat->_pos.y) + _vm->platypusMakeRoom(); + + if (findPath1(_pos.x, _pos.y, 0)) + done = true; + + if (!done && findPath2(_pos.x, _pos.y, 0)) + done = true; + + if (!done && findPath3(_pos.x, _pos.y)) + done = true; + + if (!done && findPath4(_pos.x, _pos.y)) + done = true; + + _vm->gnapIdle(); + + int gnapSequenceId = _sequenceId; + int gnapId = _id; + int gnapSequenceDatNum = _sequenceDatNum; + + debugC(kDebugBasic, "_gnap->_walkNodesCount: %d", _walkNodesCount); + + for (int index = 0; index < _walkNodesCount; ++index) { + _walkNodes[index]._id = index + 20 * _walkNodes[index]._gridY1; + if (_walkNodes[index]._deltaX == 1 && _walkNodes[index]._deltaY == 0) { + if (index % 2) { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7AB), _walkNodes[index]._id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7AB; + gnapSequenceId = 0x7AB; + } else { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7AC), _walkNodes[index]._id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7AC; + gnapSequenceId = 0x7AC; + } + } else if (_walkNodes[index]._deltaX == -1 && _walkNodes[index]._deltaY == 0) { + if (index % 2) { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7AF), _walkNodes[index]._id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7AF; + gnapSequenceId = 0x7AF; + } else { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7B0), _walkNodes[index]._id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7B0; + gnapSequenceId = 0x7B0; + } + } else { + if (_walkNodes[index]._deltaY == -1) + _walkNodes[index]._id -= 10; + else + _walkNodes[index]._id += 10; + int newSequenceId = getWalkSequenceId(_walkNodes[index]._deltaX, _walkNodes[index]._deltaY); + _vm->_gameSys->insertSequence(makeRid(datNum, newSequenceId), _walkNodes[index]._id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = newSequenceId; + gnapSequenceId = newSequenceId; + } + gnapId = _walkNodes[index]._id; + gnapSequenceDatNum = datNum; + } + + if (flags & 8) { + if (_walkNodesCount > 0) { + _sequenceId = gnapSequenceId; + _id = gnapId; + _idleFacing = _vm->getGnapWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); + _sequenceDatNum = datNum; + if (animationIndex >= 0) + _vm->_gameSys->setAnimation(makeRid(_sequenceDatNum, _sequenceId), _id, animationIndex); + } else if (animationIndex >= 0) { + _vm->_gameSys->setAnimation(0x107D3, 1, animationIndex); + _vm->_gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); + } + } else { + if (sequenceId >= 0 && sequenceId != -1) { + _sequenceId = ridToEntryIndex(sequenceId); + _sequenceDatNum = ridToDatIndex(sequenceId); + if (_sequenceId == 0x7B9) { + _idleFacing = kDirBottomRight; + } else { + switch (_sequenceId) { + case 0x7BA: + _idleFacing = kDirBottomLeft; + break; + case 0x7BB: + _idleFacing = kDirUpRight; + break; + case 0x7BC: + _idleFacing = kDirUpLeft; + break; + } + } + } else { + if (_walkNodesCount > 0) { + _sequenceId = _vm->getGnapWalkStopSequenceId(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); + _idleFacing = _vm->getGnapWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); + } else if (gridX >= 0 || gridY >= 0) { + switch (_idleFacing) { + case kDirBottomRight: + _sequenceId = 0x7B9; + break; + case kDirBottomLeft: + _sequenceId = 0x7BA; + break; + case kDirUpRight: + _sequenceId = 0x7BB; + break; + default: + _sequenceId = 0x7BC; + break; + } + } else { + //TODO: simplify the checks by using v10 and v11 + int v10 = _vm->_leftClickMouseX - (_vm->_gridMinX + 75 * _pos.x); + int v11 = _vm->_leftClickMouseY - (_vm->_gridMinY + 48 * _pos.y); + if (_vm->_leftClickMouseX == _vm->_gridMinX + 75 * _pos.x) + ++v10; + if (_vm->_leftClickMouseY == _vm->_gridMinY + 48 * _pos.y) + v11 = 1; + _sequenceId = _vm->getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); + _idleFacing = _vm->getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11)); + } + _sequenceDatNum = datNum; + } + + if (animationIndex < 0) { + _id = 20 * _walkDestY + 1; + } else { + _id = _walkNodesCount + animationIndex + 20 * _walkDestY; + _vm->_gameSys->setAnimation(makeRid(_sequenceDatNum, _sequenceId), _walkNodesCount + animationIndex + 20 * _walkDestY, animationIndex); + } + + if (flags & 4) { + _vm->_gameSys->insertSequence(makeRid(_sequenceDatNum, _sequenceId), _id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + kSeqScale | kSeqSyncWait, 0, 0, 0); + } else { + _vm->_gameSys->insertSequence(makeRid(_sequenceDatNum, _sequenceId), _id, + makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkDestX - _gridX, 48 * _walkDestY - _gridY); + } + } + + _pos = Common::Point(_walkDestX, _walkDestY); + + return done; +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} @@ -731,4 +971,162 @@ int PlayerPlat::getWalkSequenceId(int deltaX, int deltaY) { return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; } +bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { + int datNum = flags & 3; + bool done = false; + + _vm->_timers[1] = 60; + + int gridX = gridPos.x; + if (gridX < 0) + gridX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; + + int gridY = gridPos.y; + if (gridY < 0) + gridY = (_vm->_leftClickMouseY - _vm->_gridMinY + 24) / 48; + + _walkDestX = CLIP(gridX, 0, _vm->_gridMaxX - 1); + _walkDestY = CLIP(gridY, 0, _vm->_gridMaxY - 1); + + if (animationIndex >= 0 && _vm->_gnap->_pos == Common::Point(_walkDestX, _walkDestY)) + _vm->_gnap->walkStep(); + + if (findPath1(_pos.x, _pos.y, 0)) + done = true; + + if (!done && findPath2(_pos.x, _pos.y, 0)) + done = true; + + if (!done && findPath3(_pos.x, _pos.y)) + done = true; + + if (!done && findPath4(_pos.x, _pos.y)) + done = true; + + int platSequenceId = _sequenceId; + int platId = _id; + int platSequenceDatNum = _sequenceDatNum; + + for (int index = 0; index < _walkNodesCount; ++index) { + _walkNodes[index]._id = index + 20 * _walkNodes[index]._gridY1; + if (_walkNodes[index]._deltaX == 1 && _walkNodes[index]._deltaY == 0) { + if (index % 2) { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7CD), _walkNodes[index]._id, + makeRid(platSequenceDatNum, platSequenceId), platId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7CD; + platSequenceId = 0x7CD; + } else { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7CE), _walkNodes[index]._id, + makeRid(platSequenceDatNum, platSequenceId), platId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7CE; + platSequenceId = 0x7CE; + } + } else if (_walkNodes[index]._deltaX == -1 && _walkNodes[index]._deltaY == 0) { + if (index % 2) { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7CF), _walkNodes[index]._id, + makeRid(platSequenceDatNum, platSequenceId), platId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7CF; + platSequenceId = 0x7CF; + } else { + _vm->_gameSys->insertSequence(makeRid(datNum, 0x7D0), _walkNodes[index]._id, + makeRid(platSequenceDatNum, platSequenceId), platId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = 0x7D0; + platSequenceId = 0x7D0; + } + } else { + if (_walkNodes[index]._deltaY == -1) + _walkNodes[index]._id -= 10; + else + _walkNodes[index]._id += 10; + int newSequenceId = getWalkSequenceId(_walkNodes[index]._deltaX, _walkNodes[index]._deltaY); + _vm->_gameSys->insertSequence(makeRid(datNum, newSequenceId), _walkNodes[index]._id, + makeRid(platSequenceDatNum, platSequenceId), platId, + kSeqScale | kSeqSyncWait, 0, 75 * _walkNodes[index]._gridX1 - _gridX, 48 * _walkNodes[index]._gridY1 - _gridY); + _walkNodes[index]._sequenceId = newSequenceId; + platSequenceId = newSequenceId; + } + platId = _walkNodes[index]._id; + platSequenceDatNum = datNum; + } + + if (flags & 8) { + if (_walkNodesCount > 0) { + _sequenceId = platSequenceId; + _id = platId; + _sequenceDatNum = datNum; + // CHECKME Not sure if this is correct... + if (_walkNodes[_walkNodesCount - 1]._deltaX > 0) + _idleFacing = kDirNone; + else if (_walkNodes[_walkNodesCount - 1]._deltaX < 0) + _idleFacing = kDirUnk4; + else if (_walkNodes[_walkNodesCount - 1]._gridX1 % 2) + _idleFacing = kDirUnk4; + else + _idleFacing = kDirNone; + if (animationIndex >= 0) + _vm->_gameSys->setAnimation(makeRid(_sequenceDatNum, _sequenceId), _id, animationIndex); + } else if (animationIndex >= 0) { + _vm->_gameSys->setAnimation(0x107D3, 1, animationIndex); + _vm->_gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); + } + } else { + if (sequenceId >= 0 && sequenceId != -1) { + _sequenceId = ridToEntryIndex(sequenceId); + _sequenceDatNum = ridToDatIndex(sequenceId); + if (_sequenceId == 0x7C2) { + _idleFacing = kDirNone; + } else if (_sequenceId == 0x7D2) { + _idleFacing = kDirUnk4; + } + } else { + if (_walkNodesCount > 0) { + if (_walkNodes[_walkNodesCount - 1]._deltaX > 0) { + _sequenceId = 0x7C2; + _idleFacing = kDirNone; + } else if (_walkNodes[_walkNodesCount - 1]._deltaX < 0) { + _sequenceId = 0x7D2; + _idleFacing = kDirUnk4; + } else if (_walkNodes[0]._deltaX > 0) { + _sequenceId = 0x7C2; + _idleFacing = kDirNone; + } else if (_walkNodes[0]._deltaX < 0) { + _sequenceId = 0x7D2; + _idleFacing = kDirUnk4; + } else { + _sequenceId = 0x7D2; + _idleFacing = kDirUnk4; + } + } else if (_idleFacing != kDirNone) { + _sequenceId = 0x7D2; + } else { + _sequenceId = 0x7C2; + } + _sequenceDatNum = datNum; + } + + if (animationIndex < 0) { + _id = 20 * _walkDestY; + } else { + _id = animationIndex + 20 * _walkDestY; + _vm->_gameSys->setAnimation(makeRid(_sequenceDatNum, _sequenceId), animationIndex + 20 * _walkDestY, animationIndex); + } + + if (flags & 4) + _vm->_gameSys->insertSequence(makeRid(_sequenceDatNum, _sequenceId), _id, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 0, 0); + else + _vm->_gameSys->insertSequence(makeRid(_sequenceDatNum, _sequenceId), _id, + makeRid(platSequenceDatNum, platSequenceId), platId, + 9, 0, 75 * _walkDestX - _gridX, 48 * _walkDestY - _gridY); + } + + _pos = Common::Point(_walkDestX, _walkDestY); + + return done; +} } // End of namespace Gnap diff --git a/engines/gnap/character.h b/engines/gnap/character.h index ddfc7190e6..c36b0a2295 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -36,17 +36,29 @@ enum Facing { kDirUpRight = 7 }; +struct GridStruct { + int _deltaX, _deltaY; + int _gridX1, _gridY1; + int _sequenceId; + int _id; +}; + +const int kMaxGridStructs = 30; + class Character { public: Character(GnapEngine *vm); ~Character(); + void walkStep(); + virtual int getSequenceId(int kind, int gridX, int gridY) = 0; virtual void playSequence(int sequenceId) = 0; virtual void updateIdleSequence() = 0; virtual void updateIdleSequence2() = 0; virtual void initPos(int gridX, int gridY, Facing facing) = 0; virtual int getWalkSequenceId(int deltaX, int deltaY) = 0; + virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) = 0; Common::Point _pos; Facing _idleFacing; @@ -56,6 +68,10 @@ public: int _id; int _gridX; int _gridY; + int _walkNodesCount; + GridStruct _walkNodes[kMaxGridStructs]; + int _walkDestX, _walkDestY; + int _walkDeltaX, _walkDeltaY, _walkDirX, _walkDirY, _walkDirXIncr, _walkDirYIncr; protected: GnapEngine *_vm; @@ -70,6 +86,7 @@ public: virtual void updateIdleSequence(); virtual void updateIdleSequence2(); virtual int getWalkSequenceId(int deltaX, int deltaY); + virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); void initBrainPulseRndValue(); void kissPlatypus(int callback); @@ -78,6 +95,12 @@ public: int _brainPulseNum; int _brainPulseRndValue; + +private: + bool findPath1(int gridX, int gridY, int index); + bool findPath2(int gridX, int gridY, int index); + bool findPath3(int gridX, int gridY); + bool findPath4(int gridX, int gridY); }; class PlayerPlat : public Character { @@ -89,6 +112,13 @@ public: virtual void updateIdleSequence(); virtual void updateIdleSequence2(); virtual int getWalkSequenceId(int deltaX, int deltaY); + virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); + +private: + bool findPath1(int gridX, int gridY, int index); + bool findPath2(int gridX, int gridY, int index); + bool findPath3(int gridX, int gridY); + bool findPath4(int gridX, int gridY); }; } // End of namespace Gnap diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 9f1ae26150..42d5277dc6 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1189,7 +1189,7 @@ void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { if (_plat->_pos.x == gridX && _plat->_pos.y == gridY) platypusMakeRoom(); - gnapWalkTo(Common::Point(gridX, gridY), -1, -1, 1); + _gnap->walkTo(Common::Point(gridX, gridY), -1, -1, 1); playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); } @@ -1199,8 +1199,8 @@ bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gr _gameSys->setAnimation(0, 0, animationIndex); _gnap->_actionStatus = -1; _plat->_actionStatus = -1; - gnapWalkTo(Common::Point(gridX1, gridY1), -1, -1, 1); - platypusWalkTo(Common::Point(gridX2, gridY2), -1, -1, 1); + _gnap->walkTo(Common::Point(gridX1, gridY1), -1, -1, 1); + _plat->walkTo(Common::Point(gridX2, gridY2), -1, -1, 1); _mouseClickState._left = false; return true; } @@ -1224,12 +1224,12 @@ bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, in _gnap->_actionStatus = 100; Common::Point checkPt = _plat->_pos + Common::Point(gridX, gridY); if (isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) { - platypusWalkStep(); + _plat->walkStep(); checkPt = _plat->_pos + Common::Point(gridX, gridY); } if (!isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) { - gnapWalkTo(checkPt, 0, 0x107B9, 1); + _gnap->walkTo(checkPt, 0, 0x107B9, 1); while (_gameSys->getAnimationStatus(0) != 2) { updateMouseCursor(); doCallback(callback); diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 59326b0511..db9368d98d 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -75,14 +75,6 @@ struct Hotspot { } }; -struct GridStruct { - int _deltaX, _deltaY; - int _gridX1, _gridY1; - int _sequenceId; - int _id; -}; - -const int kMaxGridStructs = 30; const int kMaxTimers = 10; enum GnapDebugChannels { @@ -483,32 +475,10 @@ public: bool testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2); // Gnap walking - int _gnapWalkNodesCount; - GridStruct _gnapWalkNodes[kMaxGridStructs]; - int _gnapWalkDestX, _gnapWalkDestY; - int _gnapWalkDeltaX, _gnapWalkDeltaY, _gnapWalkDirX, _gnapWalkDirY, _gnapWalkDirXIncr, _gnapWalkDirYIncr; - int getGnapWalkStopSequenceId(int deltaX, int deltaY); Facing getGnapWalkFacing(int deltaX, int deltaY); - bool gnapFindPath1(int gridX, int gridY, int index); - bool gnapFindPath2(int gridX, int gridY, int index); - bool gnapFindPath3(int gridX, int gridY); - bool gnapFindPath4(int gridX, int gridY); - bool gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); - void gnapWalkStep(); // Platypus walking - int _platWalkNodesCount; - GridStruct _platWalkNodes[kMaxGridStructs]; - int _platWalkDestX, _platWalkDestY; - int _platWalkDeltaX, _platWalkDeltaY, _platWalkDirX, _platWalkDirY, _platWalkDirXIncr, _platWalkDirYIncr; - - bool platFindPath1(int gridX, int gridY, int index); - bool platFindPath2(int gridX, int gridY, int index); - bool platFindPath3(int gridX, int gridY); - bool platFindPath4(int gridX, int gridY); - bool platypusWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); - void platypusWalkStep(); void platypusMakeRoom(); // Gnap diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 568fe2520e..d4aed8dbc0 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -81,176 +81,81 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { } return false; - } -bool GnapEngine::gnapFindPath4(int gridX, int gridY) { - bool result = false; - - _gnapWalkNodesCount = 0; - _gnapWalkDirXIncr = 0; - _gnapWalkDirYIncr = 0; - _gnapWalkDeltaX = ABS(_gnapWalkDestX - gridX); - _gnapWalkDeltaY = ABS(_gnapWalkDestY - gridY); - - if (_gnapWalkDeltaX) - _gnapWalkDirX = (_gnapWalkDestX - gridX) / _gnapWalkDeltaX; - else - _gnapWalkDirX = 0; - - if (_gnapWalkDeltaY) - _gnapWalkDirY = (_gnapWalkDestY - gridY) / _gnapWalkDeltaY; - else - _gnapWalkDirY = 0; - - while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirXIncr; - ++_gnapWalkDirYIncr; - } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { - if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - } else { - _gnapWalkDeltaX = _gnapWalkDirXIncr; - _gnapWalkDeltaY = _gnapWalkDirYIncr; - --_gnapWalkNodesCount; - } - } else { - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - } else { - _gnapWalkDeltaX = _gnapWalkDirXIncr; - _gnapWalkDeltaY = _gnapWalkDirYIncr; - --_gnapWalkNodesCount; - } - } - ++_gnapWalkNodesCount; - } - - while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = _gnapWalkDestY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDestY)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - ++_gnapWalkNodesCount; - } else { - _gnapWalkDeltaX = _gnapWalkDirXIncr; - } - } - - while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = _gnapWalkDestX; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - ++_gnapWalkNodesCount; - } else { - _gnapWalkDeltaY = _gnapWalkDirYIncr; - } - } - - if (gridX + _gnapWalkDirX * _gnapWalkDirXIncr != _gnapWalkDestX || gridY + _gnapWalkDirY * _gnapWalkDirYIncr != _gnapWalkDestY) { - _gnapWalkDestX = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkDestY = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - result = false; - } else { - result = true; - } +/******************************************************************************/ - return result; -} +bool PlayerGnap::findPath1(int gridX, int gridY, int index) { + _walkNodesCount = index; + _walkDirXIncr = 0; + _walkDirYIncr = 0; + _walkDeltaX = ABS(_walkDestX - gridX); + _walkDeltaY = ABS(_walkDestY - gridY); -bool GnapEngine::gnapFindPath1(int gridX, int gridY, int index) { - _gnapWalkNodesCount = index; - _gnapWalkDirXIncr = 0; - _gnapWalkDirYIncr = 0; - _gnapWalkDeltaX = ABS(_gnapWalkDestX - gridX); - _gnapWalkDeltaY = ABS(_gnapWalkDestY - gridY); - - if (_gnapWalkDeltaX) - _gnapWalkDirX = (_gnapWalkDestX - gridX) / _gnapWalkDeltaX; + if (_walkDeltaX) + _walkDirX = (_walkDestX - gridX) / _walkDeltaX; else - _gnapWalkDirX = 0; + _walkDirX = 0; - if (_gnapWalkDeltaY) - _gnapWalkDirY = (_gnapWalkDestY - gridY) / _gnapWalkDeltaY; + if (_walkDeltaY) + _walkDirY = (_walkDestY - gridY) / _walkDeltaY; else - _gnapWalkDirY = 0; - - while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirXIncr; - ++_gnapWalkDirYIncr; - } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { - if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; + _walkDirY = 0; + + while (_walkDirXIncr < _walkDeltaX && _walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirXIncr; + ++_walkDirYIncr; + } else if (_walkDeltaY - _walkDirYIncr > _walkDeltaX - _walkDirXIncr) { + if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + } else if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; } else return false; } else { - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + } else if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; } else return false; } - ++_gnapWalkNodesCount; + ++_walkNodesCount; } - while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = _gnapWalkDestY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDestY)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - ++_gnapWalkNodesCount; + while (_walkDirXIncr < _walkDeltaX) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = _walkDestY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDestY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else return false; } - while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = _gnapWalkDestX; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - ++_gnapWalkNodesCount; + while (_walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = _walkDestX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDestX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else return false; } @@ -258,101 +163,101 @@ bool GnapEngine::gnapFindPath1(int gridX, int gridY, int index) { return true; } -bool GnapEngine::gnapFindPath2(int gridX, int gridY, int index) { - _gnapWalkNodesCount = index; - _gnapWalkDirXIncr = 0; - _gnapWalkDirYIncr = 0; - _gnapWalkDeltaX = ABS(_gnapWalkDestX - gridX); - _gnapWalkDeltaY = ABS(_gnapWalkDestY - gridY); +bool PlayerGnap::findPath2(int gridX, int gridY, int index) { + _walkNodesCount = index; + _walkDirXIncr = 0; + _walkDirYIncr = 0; + _walkDeltaX = ABS(_walkDestX - gridX); + _walkDeltaY = ABS(_walkDestY - gridY); - if (_gnapWalkDeltaX) - _gnapWalkDirX = (_gnapWalkDestX - gridX) / _gnapWalkDeltaX; + if (_walkDeltaX) + _walkDirX = (_walkDestX - gridX) / _walkDeltaX; else - _gnapWalkDirX = 0; + _walkDirX = 0; - if (_gnapWalkDeltaY) - _gnapWalkDirY = (_gnapWalkDestY - gridY) / _gnapWalkDeltaY; + if (_walkDeltaY) + _walkDirY = (_walkDestY - gridY) / _walkDeltaY; else - _gnapWalkDirY = 0; - - while (_gnapWalkDeltaY < _gnapWalkDeltaX - _gnapWalkDirXIncr) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, gridY)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - ++_gnapWalkNodesCount; + _walkDirY = 0; + + while (_walkDeltaY < _walkDeltaX - _walkDirXIncr) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, gridY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else return false; } - while (_gnapWalkDeltaX < _gnapWalkDeltaY - _gnapWalkDirYIncr) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(gridX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - ++_gnapWalkNodesCount; + while (_walkDeltaX < _walkDeltaY - _walkDirYIncr) { + _walkNodes[_walkNodesCount]._gridX1 = gridX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(gridX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else return false; } - while (_gnapWalkDirXIncr < _gnapWalkDeltaX && _gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirXIncr; - ++_gnapWalkDirYIncr; - } else if (_gnapWalkDeltaY - _gnapWalkDirYIncr > _gnapWalkDeltaX - _gnapWalkDirXIncr) { - if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - } else if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; + while (_walkDirXIncr < _walkDeltaX && _walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirXIncr; + ++_walkDirYIncr; + } else if (_walkDeltaY - _walkDirYIncr > _walkDeltaX - _walkDirXIncr) { + if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + } else if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; } else return false; } else { - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - } else if (!isPointBlocked(_gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + } else if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; } else return false; } - ++_gnapWalkNodesCount; + ++_walkNodesCount; } - while (_gnapWalkDirXIncr < _gnapWalkDeltaX) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = gridX + _gnapWalkDirX * _gnapWalkDirXIncr; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = _gnapWalkDestY; - if (!isPointBlocked(_gnapWalkDirX + _gnapWalkNodes[_gnapWalkNodesCount]._gridX1, _gnapWalkDestY)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = _gnapWalkDirX; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = 0; - ++_gnapWalkDirXIncr; - ++_gnapWalkNodesCount; + while (_walkDirXIncr < _walkDeltaX) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = _walkDestY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDestY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else return false; } - while (_gnapWalkDirYIncr < _gnapWalkDeltaY) { - _gnapWalkNodes[_gnapWalkNodesCount]._gridX1 = _gnapWalkDestX; - _gnapWalkNodes[_gnapWalkNodesCount]._gridY1 = gridY + _gnapWalkDirY * _gnapWalkDirYIncr; - if (!isPointBlocked(_gnapWalkDestX, _gnapWalkDirY + _gnapWalkNodes[_gnapWalkNodesCount]._gridY1)) { - _gnapWalkNodes[_gnapWalkNodesCount]._deltaX = 0; - _gnapWalkNodes[_gnapWalkNodesCount]._deltaY = _gnapWalkDirY; - ++_gnapWalkDirYIncr; - ++_gnapWalkNodesCount; + while (_walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = _walkDestX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDestX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else return false; } @@ -360,167 +265,167 @@ bool GnapEngine::gnapFindPath2(int gridX, int gridY, int index) { return true; } -bool GnapEngine::gnapFindPath3(int gridX, int gridY) { +bool PlayerGnap::findPath3(int gridX, int gridY) { int gridIncr = 1; bool done = false; - while (!done && gridIncr < _gridMaxX) { - if (!isPointBlocked(gridX + gridIncr, gridY) && gnapFindPath1(gridX + gridIncr, gridY, gridIncr)) { + while (!done && gridIncr < _vm->_gridMaxX) { + if (!_vm->isPointBlocked(gridX + gridIncr, gridY) && findPath1(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX + i; - _gnapWalkNodes[i]._gridY1 = gridY; - _gnapWalkNodes[i]._deltaX = 1; - _gnapWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = gridX + i; + _walkNodes[i]._gridY1 = gridY; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY) && gnapFindPath1(gridX - gridIncr, gridY, gridIncr)) { + if (!_vm->isPointBlocked(gridX - gridIncr, gridY) && findPath1(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX - i; - _gnapWalkNodes[i]._gridY1 = gridY; - _gnapWalkNodes[i]._deltaX = -1; - _gnapWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = gridX - i; + _walkNodes[i]._gridY1 = gridY; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(gridX, gridY + gridIncr) && gnapFindPath1(gridX, gridY + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX, gridY + gridIncr) && findPath1(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX; - _gnapWalkNodes[i]._gridY1 = gridY + i; - _gnapWalkNodes[i]._deltaX = 0; - _gnapWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = gridX; + _walkNodes[i]._gridY1 = gridY + i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(gridX, gridY - gridIncr) && gnapFindPath1(gridX, gridY - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX, gridY - gridIncr) && findPath1(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX; - _gnapWalkNodes[i]._gridY1 = gridY - i; - _gnapWalkNodes[i]._deltaX = 0; - _gnapWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = gridX; + _walkNodes[i]._gridY1 = gridY - i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gnapFindPath1(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX + gridIncr, gridY + gridIncr) && findPath1(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX + i; - _gnapWalkNodes[i]._gridY1 = gridY + i; - _gnapWalkNodes[i]._deltaX = 1; - _gnapWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = gridX + i; + _walkNodes[i]._gridY1 = gridY + i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gnapFindPath1(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX - gridIncr, gridY + gridIncr) && findPath1(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX - i; - _gnapWalkNodes[i]._gridY1 = gridY + i; - _gnapWalkNodes[i]._deltaX = -1; - _gnapWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = gridX - i; + _walkNodes[i]._gridY1 = gridY + i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gnapFindPath1(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX + gridIncr, gridY - gridIncr) && findPath1(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX + i; - _gnapWalkNodes[i]._gridY1 = gridY - i; - _gnapWalkNodes[i]._deltaX = 1; - _gnapWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = gridX + i; + _walkNodes[i]._gridY1 = gridY - i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gnapFindPath1(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX - gridIncr, gridY - gridIncr) && findPath1(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX - i; - _gnapWalkNodes[i]._gridY1 = gridY - i; - _gnapWalkNodes[i]._deltaX = -1; - _gnapWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = gridX - i; + _walkNodes[i]._gridY1 = gridY - i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY) && gnapFindPath2(gridX + gridIncr, gridY, gridIncr)) { + if (!_vm->isPointBlocked(gridX + gridIncr, gridY) && findPath2(gridX + gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX + i; - _gnapWalkNodes[i]._gridY1 = gridY; - _gnapWalkNodes[i]._deltaX = 1; - _gnapWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = gridX + i; + _walkNodes[i]._gridY1 = gridY; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY) && gnapFindPath2(gridX - gridIncr, gridY, gridIncr)) { + if (!_vm->isPointBlocked(gridX - gridIncr, gridY) && findPath2(gridX - gridIncr, gridY, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX - i; - _gnapWalkNodes[i]._gridY1 = gridY; - _gnapWalkNodes[i]._deltaX = -1; - _gnapWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = gridX - i; + _walkNodes[i]._gridY1 = gridY; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(gridX, gridY + gridIncr) && gnapFindPath2(gridX, gridY + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX, gridY + gridIncr) && findPath2(gridX, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX; - _gnapWalkNodes[i]._gridY1 = gridY + i; - _gnapWalkNodes[i]._deltaX = 0; - _gnapWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = gridX; + _walkNodes[i]._gridY1 = gridY + i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(gridX, gridY - gridIncr) && gnapFindPath2(gridX, gridY - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX, gridY - gridIncr) && findPath2(gridX, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX; - _gnapWalkNodes[i]._gridY1 = gridY - i; - _gnapWalkNodes[i]._deltaX = 0; - _gnapWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = gridX; + _walkNodes[i]._gridY1 = gridY - i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY + gridIncr) && gnapFindPath2(gridX + gridIncr, gridY + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX + gridIncr, gridY + gridIncr) && findPath2(gridX + gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX + i; - _gnapWalkNodes[i]._gridY1 = gridY + i; - _gnapWalkNodes[i]._deltaX = 1; - _gnapWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = gridX + i; + _walkNodes[i]._gridY1 = gridY + i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY + gridIncr) && gnapFindPath2(gridX - gridIncr, gridY + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX - gridIncr, gridY + gridIncr) && findPath2(gridX - gridIncr, gridY + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX - i; - _gnapWalkNodes[i]._gridY1 = gridY + i; - _gnapWalkNodes[i]._deltaX = -1; - _gnapWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = gridX - i; + _walkNodes[i]._gridY1 = gridY + i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(gridX + gridIncr, gridY - gridIncr) && gnapFindPath2(gridX + gridIncr, gridY - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX + gridIncr, gridY - gridIncr) && findPath2(gridX + gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX + i; - _gnapWalkNodes[i]._gridY1 = gridY - i; - _gnapWalkNodes[i]._deltaX = 1; - _gnapWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = gridX + i; + _walkNodes[i]._gridY1 = gridY - i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(gridX - gridIncr, gridY - gridIncr) && gnapFindPath2(gridX - gridIncr, gridY - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(gridX - gridIncr, gridY - gridIncr) && findPath2(gridX - gridIncr, gridY - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _gnapWalkNodes[i]._gridX1 = gridX - i; - _gnapWalkNodes[i]._gridY1 = gridY - i; - _gnapWalkNodes[i]._deltaX = -1; - _gnapWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = gridX - i; + _walkNodes[i]._gridY1 = gridY - i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = -1; } done = true; break; @@ -531,323 +436,94 @@ bool GnapEngine::gnapFindPath3(int gridX, int gridY) { return done; } -bool GnapEngine::gnapWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { - int datNum = flags & 3; - bool done = false; - - _timers[2] = 200; - _timers[3] = 300; - - int gridX = gridPos.x; - if (gridX < 0) - gridX = (_leftClickMouseX - _gridMinX + 37) / 75; - - int gridY = gridPos.y; - if (gridY < 0) - gridY = (_leftClickMouseY - _gridMinY + 24) / 48; - - _gnapWalkDestX = CLIP(gridX, 0, _gridMaxX - 1); - _gnapWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); - - if (animationIndex >= 0 && _gnapWalkDestX == _plat->_pos.x && _gnapWalkDestY == _plat->_pos.y) - platypusMakeRoom(); - - // TODO: Simplify the cascade of Ifs - if (gnapFindPath1(_gnap->_pos.x, _gnap->_pos.y, 0)) - done = true; - - if (!done && gnapFindPath2(_gnap->_pos.x, _gnap->_pos.y, 0)) - done = true; - - if (!done && gnapFindPath3(_gnap->_pos.x, _gnap->_pos.y)) - done = true; - - if (!done && gnapFindPath4(_gnap->_pos.x, _gnap->_pos.y)) - done = true; - - gnapIdle(); - - int gnapSequenceId = _gnap->_sequenceId; - int gnapId = _gnap->_id; - int gnapSequenceDatNum = _gnap->_sequenceDatNum; - - debugC(kDebugBasic, "_gnapWalkNodesCount: %d", _gnapWalkNodesCount); - - for (int index = 0; index < _gnapWalkNodesCount; ++index) { - _gnapWalkNodes[index]._id = index + 20 * _gnapWalkNodes[index]._gridY1; - if (_gnapWalkNodes[index]._deltaX == 1 && _gnapWalkNodes[index]._deltaY == 0) { - if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7AB), _gnapWalkNodes[index]._id, - makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); - _gnapWalkNodes[index]._sequenceId = 0x7AB; - gnapSequenceId = 0x7AB; - } else { - _gameSys->insertSequence(makeRid(datNum, 0x7AC), _gnapWalkNodes[index]._id, - makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); - _gnapWalkNodes[index]._sequenceId = 0x7AC; - gnapSequenceId = 0x7AC; - } - } else if (_gnapWalkNodes[index]._deltaX == -1 && _gnapWalkNodes[index]._deltaY == 0) { - if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7AF), _gnapWalkNodes[index]._id, - makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); - _gnapWalkNodes[index]._sequenceId = 0x7AF; - gnapSequenceId = 0x7AF; - } else { - _gameSys->insertSequence(makeRid(datNum, 0x7B0), _gnapWalkNodes[index]._id, - makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); - _gnapWalkNodes[index]._sequenceId = 0x7B0; - gnapSequenceId = 0x7B0; - } - } else { - if (_gnapWalkNodes[index]._deltaY == -1) - _gnapWalkNodes[index]._id -= 10; - else - _gnapWalkNodes[index]._id += 10; - int newSequenceId = _gnap->getWalkSequenceId(_gnapWalkNodes[index]._deltaX, _gnapWalkNodes[index]._deltaY); - _gameSys->insertSequence(makeRid(datNum, newSequenceId), _gnapWalkNodes[index]._id, - makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkNodes[index]._gridX1 - _gnap->_gridX, 48 * _gnapWalkNodes[index]._gridY1 - _gnap->_gridY); - _gnapWalkNodes[index]._sequenceId = newSequenceId; - gnapSequenceId = newSequenceId; - } - gnapId = _gnapWalkNodes[index]._id; - gnapSequenceDatNum = datNum; - } - - if (flags & 8) { - if (_gnapWalkNodesCount > 0) { - _gnap->_sequenceId = gnapSequenceId; - _gnap->_id = gnapId; - _gnap->_idleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); - _gnap->_sequenceDatNum = datNum; - if (animationIndex >= 0) - _gameSys->setAnimation(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, animationIndex); - } else if (animationIndex >= 0) { - _gameSys->setAnimation(0x107D3, 1, animationIndex); - _gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); - } - } else { - if (sequenceId >= 0 && sequenceId != -1) { - _gnap->_sequenceId = ridToEntryIndex(sequenceId); - _gnap->_sequenceDatNum = ridToDatIndex(sequenceId); - if (_gnap->_sequenceId == 0x7B9) { - _gnap->_idleFacing = kDirBottomRight; - } else { - switch (_gnap->_sequenceId) { - case 0x7BA: - _gnap->_idleFacing = kDirBottomLeft; - break; - case 0x7BB: - _gnap->_idleFacing = kDirUpRight; - break; - case 0x7BC: - _gnap->_idleFacing = kDirUpLeft; - break; - } - } - } else { - if (_gnapWalkNodesCount > 0) { - _gnap->_sequenceId = getGnapWalkStopSequenceId(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); - _gnap->_idleFacing = getGnapWalkFacing(_gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaX, _gnapWalkNodes[_gnapWalkNodesCount - 1]._deltaY); - } else if (gridX >= 0 || gridY >= 0) { - switch (_gnap->_idleFacing) { - case kDirBottomRight: - _gnap->_sequenceId = 0x7B9; - break; - case kDirBottomLeft: - _gnap->_sequenceId = 0x7BA; - break; - case kDirUpRight: - _gnap->_sequenceId = 0x7BB; - break; - default: - _gnap->_sequenceId = 0x7BC; - break; - } - } else { - //TODO: simplify the checks by using v10 and v11 - int v10 = _leftClickMouseX - (_gridMinX + 75 * _gnap->_pos.x); - int v11 = _leftClickMouseY - (_gridMinY + 48 * _gnap->_pos.y); - if (_leftClickMouseX == _gridMinX + 75 * _gnap->_pos.x) - ++v10; - if (_leftClickMouseY == _gridMinY + 48 * _gnap->_pos.y) - v11 = 1; - _gnap->_sequenceId = getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); - _gnap->_idleFacing = getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11)); - } - _gnap->_sequenceDatNum = datNum; - } - - if (animationIndex < 0) { - _gnap->_id = 20 * _gnapWalkDestY + 1; - } else { - _gnap->_id = _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY; - _gameSys->setAnimation(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnapWalkNodesCount + animationIndex + 20 * _gnapWalkDestY, animationIndex); - } - - if (flags & 4) { - _gameSys->insertSequence(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 0, 0); - } else { - _gameSys->insertSequence(makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - makeRid(gnapSequenceDatNum, gnapSequenceId), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * _gnapWalkDestX - _gnap->_gridX, 48 * _gnapWalkDestY - _gnap->_gridY); - } - } - - _gnap->_pos = Common::Point(_gnapWalkDestX, _gnapWalkDestY); - - return done; -} - -void GnapEngine::gnapWalkStep() { - for (int i = 1; i < _gridMaxX; ++i) { - Common::Point checkPt = Common::Point(_gnap->_pos.x + i, _gnap->_pos.y); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_gnap->_pos.x - i, _gnap->_pos.y); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_gnap->_pos.x, _gnap->_pos.y + 1); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_gnap->_pos.x, _gnap->_pos.y - 1); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_gnap->_pos.x + 1, _gnap->_pos.y + 1); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_gnap->_pos.x - 1, _gnap->_pos.y + 1); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_gnap->_pos.x + 1, _gnap->_pos.y - 1); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_gnap->_pos.x - 1, _gnap->_pos.y - 1); - if (!isPointBlocked(checkPt)) { - gnapWalkTo(checkPt, -1, -1, 1); - break; - } - } -} - -//////////////////////////////////////////////////////////////////////////////// - -bool GnapEngine::platFindPath4(int gridX, int gridY) { +bool PlayerGnap::findPath4(int gridX, int gridY) { bool result = false; - _platWalkNodesCount = 0; - _platWalkDirXIncr = 0; - _platWalkDirYIncr = 0; - _platWalkDeltaX = ABS(_platWalkDestX - gridX); - _platWalkDeltaY = ABS(_platWalkDestY - gridY); + _walkNodesCount = 0; + _walkDirXIncr = 0; + _walkDirYIncr = 0; + _walkDeltaX = ABS(_walkDestX - gridX); + _walkDeltaY = ABS(_walkDestY - gridY); - if (_platWalkDeltaX) - _platWalkDirX = (_platWalkDestX - gridX) / _platWalkDeltaX; + if (_walkDeltaX) + _walkDirX = (_walkDestX - gridX) / _walkDeltaX; else - _platWalkDirX = 0; + _walkDirX = 0; - if (_platWalkDeltaY) - _platWalkDirY = (_platWalkDestY - gridY) / _platWalkDeltaY; + if (_walkDeltaY) + _walkDirY = (_walkDestY - gridY) / _walkDeltaY; else - _platWalkDirY = 0; - - while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirXIncr; - ++_platWalkDirYIncr; - } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { - if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; - } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; + _walkDirY = 0; + + while (_walkDirXIncr < _walkDeltaX && _walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirXIncr; + ++_walkDirYIncr; + } else if (_walkDeltaY - _walkDirYIncr > _walkDeltaX - _walkDirXIncr) { + if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + } else if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; } else { - _platWalkDeltaX = _platWalkDirXIncr; - _platWalkDeltaY = _platWalkDirYIncr; - --_platWalkNodesCount; + _walkDeltaX = _walkDirXIncr; + _walkDeltaY = _walkDirYIncr; + --_walkNodesCount; } } else { - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; - } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + } else if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; } else { - _platWalkDeltaX = _platWalkDirXIncr; - _platWalkDeltaY = _platWalkDirYIncr; - --_platWalkNodesCount; + _walkDeltaX = _walkDirXIncr; + _walkDeltaY = _walkDirYIncr; + --_walkNodesCount; } } - ++_platWalkNodesCount; + ++_walkNodesCount; } - while (_platWalkDirXIncr < _platWalkDeltaX) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount]._gridY1 = _platWalkDestY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDestY)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; - ++_platWalkNodesCount; + while (_walkDirXIncr < _walkDeltaX) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = _walkDestY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDestY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else { - _platWalkDeltaX = _platWalkDirXIncr; + _walkDeltaX = _walkDirXIncr; } } - while (_platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = _platWalkDestX; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; - ++_platWalkNodesCount; + while (_walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = _walkDestX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDestX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else { - _platWalkDeltaY = _platWalkDirYIncr; + _walkDeltaY = _walkDirYIncr; } } - if (gridX + _platWalkDirX * _platWalkDirXIncr != _platWalkDestX || gridY + _platWalkDirY * _platWalkDirYIncr != _platWalkDestY) { - _platWalkDestX = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkDestY = gridY + _platWalkDirY * _platWalkDirYIncr; + if (gridX + _walkDirX * _walkDirXIncr != _walkDestX || gridY + _walkDirY * _walkDirYIncr != _walkDestY) { + _walkDestX = gridX + _walkDirX * _walkDirXIncr; + _walkDestY = gridY + _walkDirY * _walkDirYIncr; result = false; } else { result = true; @@ -856,77 +532,79 @@ bool GnapEngine::platFindPath4(int gridX, int gridY) { return result; } -bool GnapEngine::platFindPath1(int gridX, int gridY, int index) { - _platWalkNodesCount = index; - _platWalkDirXIncr = 0; - _platWalkDirYIncr = 0; - _platWalkDeltaX = ABS(_platWalkDestX - gridX); - _platWalkDeltaY = ABS(_platWalkDestY - gridY); +/******************************************************************************/ - if (_platWalkDeltaX) - _platWalkDirX = (_platWalkDestX - gridX) / _platWalkDeltaX; +bool PlayerPlat::findPath1(int gridX, int gridY, int index) { + _walkNodesCount = index; + _walkDirXIncr = 0; + _walkDirYIncr = 0; + _walkDeltaX = ABS(_walkDestX - gridX); + _walkDeltaY = ABS(_walkDestY - gridY); + + if (_walkDeltaX) + _walkDirX = (_walkDestX - gridX) / _walkDeltaX; else - _platWalkDirX = 0; + _walkDirX = 0; - if (_platWalkDeltaY) - _platWalkDirY = (_platWalkDestY - gridY) / _platWalkDeltaY; + if (_walkDeltaY) + _walkDirY = (_walkDestY - gridY) / _walkDeltaY; else - _platWalkDirY = 0; - - while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirXIncr; - ++_platWalkDirYIncr; - } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { - if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; - } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; + _walkDirY = 0; + + while (_walkDirXIncr < _walkDeltaX && _walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirXIncr; + ++_walkDirYIncr; + } else if (_walkDeltaY - _walkDirYIncr > _walkDeltaX - _walkDirXIncr) { + if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + } else if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; } else return false; } else { - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; - } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + } else if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; } else return false; } - ++_platWalkNodesCount; + ++_walkNodesCount; } - while (_platWalkDirXIncr < _platWalkDeltaX) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount]._gridY1 = _platWalkDestY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDestY)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; - ++_platWalkNodesCount; + while (_walkDirXIncr < _walkDeltaX) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = _walkDestY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDestY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else return false; } - while (_platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = _platWalkDestX; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; - ++_platWalkNodesCount; + while (_walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = _walkDestX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDestX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else return false; } @@ -934,101 +612,101 @@ bool GnapEngine::platFindPath1(int gridX, int gridY, int index) { return true; } -bool GnapEngine::platFindPath2(int gridX, int gridY, int index) { - _platWalkNodesCount = index; - _platWalkDirXIncr = 0; - _platWalkDirYIncr = 0; - _platWalkDeltaX = ABS(_platWalkDestX - gridX); - _platWalkDeltaY = ABS(_platWalkDestY - gridY); +bool PlayerPlat::findPath2(int gridX, int gridY, int index) { + _walkNodesCount = index; + _walkDirXIncr = 0; + _walkDirYIncr = 0; + _walkDeltaX = ABS(_walkDestX - gridX); + _walkDeltaY = ABS(_walkDestY - gridY); - if (_platWalkDeltaX) - _platWalkDirX = (_platWalkDestX - gridX) / _platWalkDeltaX; + if (_walkDeltaX) + _walkDirX = (_walkDestX - gridX) / _walkDeltaX; else - _platWalkDirX = 0; + _walkDirX = 0; - if (_platWalkDeltaY) - _platWalkDirY = (_platWalkDestY - gridY) / _platWalkDeltaY; + if (_walkDeltaY) + _walkDirY = (_walkDestY - gridY) / _walkDeltaY; else - _platWalkDirY = 0; - - while (_platWalkDeltaY < _platWalkDeltaX - _platWalkDirXIncr) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, gridY)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; - ++_platWalkNodesCount; + _walkDirY = 0; + + while (_walkDeltaY < _walkDeltaX - _walkDirXIncr) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, gridY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else return false; } - while (_platWalkDeltaX < _platWalkDeltaY - _platWalkDirYIncr) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(gridX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; - ++_platWalkNodesCount; + while (_walkDeltaX < _walkDeltaY - _walkDirYIncr) { + _walkNodes[_walkNodesCount]._gridX1 = gridX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(gridX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else return false; } - while (_platWalkDirXIncr < _platWalkDeltaX && _platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirXIncr; - ++_platWalkDirYIncr; - } else if (_platWalkDeltaY - _platWalkDirYIncr > _platWalkDeltaX - _platWalkDirXIncr) { - if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; - } else if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; + while (_walkDirXIncr < _walkDeltaX && _walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirXIncr; + ++_walkDirYIncr; + } else if (_walkDeltaY - _walkDirYIncr > _walkDeltaX - _walkDirXIncr) { + if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + } else if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; } else return false; } else { - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; - } else if (!isPointBlocked(_platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + } else if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; } else return false; } - ++_platWalkNodesCount; + ++_walkNodesCount; } - while (_platWalkDirXIncr < _platWalkDeltaX) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = gridX + _platWalkDirX * _platWalkDirXIncr; - _platWalkNodes[_platWalkNodesCount]._gridY1 = _platWalkDestY; - if (!isPointBlocked(_platWalkDirX + _platWalkNodes[_platWalkNodesCount]._gridX1, _platWalkDestY)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = _platWalkDirX; - _platWalkNodes[_platWalkNodesCount]._deltaY = 0; - ++_platWalkDirXIncr; - ++_platWalkNodesCount; + while (_walkDirXIncr < _walkDeltaX) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = _walkDestY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDestY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else return false; } - while (_platWalkDirYIncr < _platWalkDeltaY) { - _platWalkNodes[_platWalkNodesCount]._gridX1 = _platWalkDestX; - _platWalkNodes[_platWalkNodesCount]._gridY1 = gridY + _platWalkDirY * _platWalkDirYIncr; - if (!isPointBlocked(_platWalkDestX, _platWalkDirY + _platWalkNodes[_platWalkNodesCount]._gridY1)) { - _platWalkNodes[_platWalkNodesCount]._deltaX = 0; - _platWalkNodes[_platWalkNodesCount]._deltaY = _platWalkDirY; - ++_platWalkDirYIncr; - ++_platWalkNodesCount; + while (_walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = _walkDestX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDestX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else return false; } @@ -1036,167 +714,167 @@ bool GnapEngine::platFindPath2(int gridX, int gridY, int index) { return true; } -bool GnapEngine::platFindPath3(int gridX, int gridY) { +bool PlayerPlat::findPath3(int gridX, int gridY) { int gridIncr = 1; bool done = false; - while (!done && gridIncr < _gridMaxX) { - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { + while (!done && gridIncr < _vm->_gridMaxX) { + if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y) && findPath1(_pos.x + gridIncr, _pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y; - _platWalkNodes[i]._deltaX = 1; - _platWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = _pos.x + i; + _walkNodes[i]._gridY1 = _pos.y; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y) && findPath1(_pos.x - gridIncr, _pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y; - _platWalkNodes[i]._deltaX = -1; - _platWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = _pos.x - i; + _walkNodes[i]._gridY1 = _pos.y; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x, _pos.y + gridIncr) && findPath1(_pos.x, _pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x; - _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; - _platWalkNodes[i]._deltaX = 0; - _platWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = _pos.x; + _walkNodes[i]._gridY1 = _pos.y + i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x, _pos.y - gridIncr) && findPath1(_pos.x, _pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x; - _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; - _platWalkNodes[i]._deltaX = 0; - _platWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = _pos.x; + _walkNodes[i]._gridY1 = _pos.y - i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y + gridIncr) && findPath1(_pos.x + gridIncr, _pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; - _platWalkNodes[i]._deltaX = 1; - _platWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = _pos.x + i; + _walkNodes[i]._gridY1 = _pos.y + i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y + gridIncr) && findPath1(_pos.x - gridIncr, _pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; - _platWalkNodes[i]._deltaX = -1; - _platWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = _pos.x - i; + _walkNodes[i]._gridY1 = _pos.y + i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y - gridIncr) && findPath1(_pos.x + gridIncr, _pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; - _platWalkNodes[i]._deltaX = 1; - _platWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = _pos.x + i; + _walkNodes[i]._gridY1 = _pos.y - i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && platFindPath1(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y - gridIncr) && findPath1(_pos.x - gridIncr, _pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; - _platWalkNodes[i]._deltaX = -1; - _platWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = _pos.x - i; + _walkNodes[i]._gridY1 = _pos.y - i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y) && findPath2(_pos.x + gridIncr, _pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y; - _platWalkNodes[i]._deltaX = 1; - _platWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = _pos.x + i; + _walkNodes[i]._gridY1 = _pos.y; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y) && findPath2(_pos.x - gridIncr, _pos.y, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y; - _platWalkNodes[i]._deltaX = -1; - _platWalkNodes[i]._deltaY = 0; + _walkNodes[i]._gridX1 = _pos.x - i; + _walkNodes[i]._gridY1 = _pos.y; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 0; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x, _plat->_pos.y + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x, _pos.y + gridIncr) && findPath2(_pos.x, _pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x; - _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; - _platWalkNodes[i]._deltaX = 0; - _platWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = _pos.x; + _walkNodes[i]._gridY1 = _pos.y + i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x, _plat->_pos.y - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x, _pos.y - gridIncr) && findPath2(_pos.x, _pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x; - _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; - _platWalkNodes[i]._deltaX = 0; - _platWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = _pos.x; + _walkNodes[i]._gridY1 = _pos.y - i; + _walkNodes[i]._deltaX = 0; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y + gridIncr) && findPath2(_pos.x + gridIncr, _pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; - _platWalkNodes[i]._deltaX = 1; - _platWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = _pos.x + i; + _walkNodes[i]._gridY1 = _pos.y + i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y + gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y + gridIncr) && findPath2(_pos.x - gridIncr, _pos.y + gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y + i; - _platWalkNodes[i]._deltaX = -1; - _platWalkNodes[i]._deltaY = 1; + _walkNodes[i]._gridX1 = _pos.x - i; + _walkNodes[i]._gridY1 = _pos.y + i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = 1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x + gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y - gridIncr) && findPath2(_pos.x + gridIncr, _pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x + i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; - _platWalkNodes[i]._deltaX = 1; - _platWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = _pos.x + i; + _walkNodes[i]._gridY1 = _pos.y - i; + _walkNodes[i]._deltaX = 1; + _walkNodes[i]._deltaY = -1; } done = true; break; } - if (!isPointBlocked(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr) && platFindPath2(_plat->_pos.x - gridIncr, _plat->_pos.y - gridIncr, gridIncr)) { + if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y - gridIncr) && findPath2(_pos.x - gridIncr, _pos.y - gridIncr, gridIncr)) { for (int i = 0; i < gridIncr; ++i) { - _platWalkNodes[i]._gridX1 = _plat->_pos.x - i; - _platWalkNodes[i]._gridY1 = _plat->_pos.y - i; - _platWalkNodes[i]._deltaX = -1; - _platWalkNodes[i]._deltaY = -1; + _walkNodes[i]._gridX1 = _pos.x - i; + _walkNodes[i]._gridY1 = _pos.y - i; + _walkNodes[i]._deltaX = -1; + _walkNodes[i]._deltaY = -1; } done = true; break; @@ -1207,215 +885,100 @@ bool GnapEngine::platFindPath3(int gridX, int gridY) { return done; } -bool GnapEngine::platypusWalkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { - int datNum = flags & 3; - bool done = false; - - _timers[1] = 60; - - int gridX = gridPos.x; - if (gridX < 0) - gridX = (_leftClickMouseX - _gridMinX + 37) / 75; - - int gridY = gridPos.y; - if (gridY < 0) - gridY = (_leftClickMouseY - _gridMinY + 24) / 48; - - _platWalkDestX = CLIP(gridX, 0, _gridMaxX - 1); - _platWalkDestY = CLIP(gridY, 0, _gridMaxY - 1); - - if (animationIndex >= 0 && _gnap->_pos == Common::Point(_platWalkDestX, _platWalkDestY)) - gnapWalkStep(); - - if (platFindPath1(_plat->_pos.x, _plat->_pos.y, 0)) - done = true; - - if (!done && platFindPath2(_plat->_pos.x, _plat->_pos.y, 0)) - done = true; - - if (!done && platFindPath3(_plat->_pos.x, _plat->_pos.y)) - done = true; +bool PlayerPlat::findPath4(int gridX, int gridY) { + bool result = false; - if (!done && platFindPath4(_plat->_pos.x, _plat->_pos.y)) - done = true; + _walkNodesCount = 0; + _walkDirXIncr = 0; + _walkDirYIncr = 0; + _walkDeltaX = ABS(_walkDestX - gridX); + _walkDeltaY = ABS(_walkDestY - gridY); - int platSequenceId = _plat->_sequenceId; - int platId = _plat->_id; - int platSequenceDatNum = _plat->_sequenceDatNum; + if (_walkDeltaX) + _walkDirX = (_walkDestX - gridX) / _walkDeltaX; + else + _walkDirX = 0; - for (int index = 0; index < _platWalkNodesCount; ++index) { - _platWalkNodes[index]._id = index + 20 * _platWalkNodes[index]._gridY1; - if (_platWalkNodes[index]._deltaX == 1 && _platWalkNodes[index]._deltaY == 0) { - if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7CD), _platWalkNodes[index]._id, - makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); - _platWalkNodes[index]._sequenceId = 0x7CD; - platSequenceId = 0x7CD; + if (_walkDeltaY) + _walkDirY = (_walkDestY - gridY) / _walkDeltaY; + else + _walkDirY = 0; + + while (_walkDirXIncr < _walkDeltaX && _walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirXIncr; + ++_walkDirYIncr; + } else if (_walkDeltaY - _walkDirYIncr > _walkDeltaX - _walkDirXIncr) { + if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + } else if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; } else { - _gameSys->insertSequence(makeRid(datNum, 0x7CE), _platWalkNodes[index]._id, - makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); - _platWalkNodes[index]._sequenceId = 0x7CE; - platSequenceId = 0x7CE; + _walkDeltaX = _walkDirXIncr; + _walkDeltaY = _walkDirYIncr; + --_walkNodesCount; } - } else if (_platWalkNodes[index]._deltaX == -1 && _platWalkNodes[index]._deltaY == 0) { - if (index % 2) { - _gameSys->insertSequence(makeRid(datNum, 0x7CF), _platWalkNodes[index]._id, - makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); - _platWalkNodes[index]._sequenceId = 0x7CF; - platSequenceId = 0x7CF; + } else { + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + } else if (!_vm->isPointBlocked(_walkNodes[_walkNodesCount]._gridX1, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; } else { - _gameSys->insertSequence(makeRid(datNum, 0x7D0), _platWalkNodes[index]._id, - makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); - _platWalkNodes[index]._sequenceId = 0x7D0; - platSequenceId = 0x7D0; + _walkDeltaX = _walkDirXIncr; + _walkDeltaY = _walkDirYIncr; + --_walkNodesCount; } - } else { - if (_platWalkNodes[index]._deltaY == -1) - _platWalkNodes[index]._id -= 10; - else - _platWalkNodes[index]._id += 10; - int newSequenceId = _plat->getWalkSequenceId(_platWalkNodes[index]._deltaX, _platWalkNodes[index]._deltaY); - _gameSys->insertSequence(makeRid(datNum, newSequenceId), _platWalkNodes[index]._id, - makeRid(platSequenceDatNum, platSequenceId), platId, - kSeqScale | kSeqSyncWait, 0, 75 * _platWalkNodes[index]._gridX1 - _plat->_gridX, 48 * _platWalkNodes[index]._gridY1 - _plat->_gridY); - _platWalkNodes[index]._sequenceId = newSequenceId; - platSequenceId = newSequenceId; } - platId = _platWalkNodes[index]._id; - platSequenceDatNum = datNum; + ++_walkNodesCount; } - if (flags & 8) { - if (_platWalkNodesCount > 0) { - _plat->_sequenceId = platSequenceId; - _plat->_id = platId; - _plat->_sequenceDatNum = datNum; - // CHECKME Not sure if this is correct... - if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) - _plat->_idleFacing = kDirNone; - else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) - _plat->_idleFacing = kDirUnk4; - else if (_platWalkNodes[_platWalkNodesCount - 1]._gridX1 % 2) - _plat->_idleFacing = kDirUnk4; - else - _plat->_idleFacing = kDirNone; - if (animationIndex >= 0) - _gameSys->setAnimation(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, animationIndex); - } else if (animationIndex >= 0) { - _gameSys->setAnimation(0x107D3, 1, animationIndex); - _gameSys->insertSequence(0x107D3, 1, 0, 0, kSeqNone, 0, 0, 0); - } - } else { - if (sequenceId >= 0 && sequenceId != -1) { - _plat->_sequenceId = ridToEntryIndex(sequenceId); - _plat->_sequenceDatNum = ridToDatIndex(sequenceId); - if (_plat->_sequenceId == 0x7C2) { - _plat->_idleFacing = kDirNone; - } else if (_plat->_sequenceId == 0x7D2) { - _plat->_idleFacing = kDirUnk4; - } + while (_walkDirXIncr < _walkDeltaX) { + _walkNodes[_walkNodesCount]._gridX1 = gridX + _walkDirX * _walkDirXIncr; + _walkNodes[_walkNodesCount]._gridY1 = _walkDestY; + if (!_vm->isPointBlocked(_walkDirX + _walkNodes[_walkNodesCount]._gridX1, _walkDestY)) { + _walkNodes[_walkNodesCount]._deltaX = _walkDirX; + _walkNodes[_walkNodesCount]._deltaY = 0; + ++_walkDirXIncr; + ++_walkNodesCount; } else { - if (_platWalkNodesCount > 0) { - if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX > 0) { - _plat->_sequenceId = 0x7C2; - _plat->_idleFacing = kDirNone; - } else if (_platWalkNodes[_platWalkNodesCount - 1]._deltaX < 0) { - _plat->_sequenceId = 0x7D2; - _plat->_idleFacing = kDirUnk4; - } else if (_platWalkNodes[0]._deltaX > 0) { - _plat->_sequenceId = 0x7C2; - _plat->_idleFacing = kDirNone; - } else if (_platWalkNodes[0]._deltaX < 0) { - _plat->_sequenceId = 0x7D2; - _plat->_idleFacing = kDirUnk4; - } else { - _plat->_sequenceId = 0x7D2; - _plat->_idleFacing = kDirUnk4; - } - } else if (_plat->_idleFacing != kDirNone) { - _plat->_sequenceId = 0x7D2; - } else { - _plat->_sequenceId = 0x7C2; - } - _plat->_sequenceDatNum = datNum; + _walkDeltaX = _walkDirXIncr; } + } - if (animationIndex < 0) { - _plat->_id = 20 * _platWalkDestY; + while (_walkDirYIncr < _walkDeltaY) { + _walkNodes[_walkNodesCount]._gridX1 = _walkDestX; + _walkNodes[_walkNodesCount]._gridY1 = gridY + _walkDirY * _walkDirYIncr; + if (!_vm->isPointBlocked(_walkDestX, _walkDirY + _walkNodes[_walkNodesCount]._gridY1)) { + _walkNodes[_walkNodesCount]._deltaX = 0; + _walkNodes[_walkNodesCount]._deltaY = _walkDirY; + ++_walkDirYIncr; + ++_walkNodesCount; } else { - _plat->_id = animationIndex + 20 * _platWalkDestY; - _gameSys->setAnimation(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), animationIndex + 20 * _platWalkDestY, animationIndex); + _walkDeltaY = _walkDirYIncr; } - - if (flags & 4) - _gameSys->insertSequence(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, - makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 0, 0); - else - _gameSys->insertSequence(makeRid(_plat->_sequenceDatNum, _plat->_sequenceId), _plat->_id, - makeRid(platSequenceDatNum, platSequenceId), platId, - 9, 0, 75 * _platWalkDestX - _plat->_gridX, 48 * _platWalkDestY - _plat->_gridY); } - _plat->_pos = Common::Point(_platWalkDestX, _platWalkDestY); - - return done; -} - -void GnapEngine::platypusWalkStep() { - for (int i = 1; i < _gridMaxX; ++i) { - Common::Point checkPt = Common::Point(_plat->_pos.x + i, _plat->_pos.y); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_plat->_pos.x - i, _plat->_pos.y); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_plat->_pos.x, _plat->_pos.y + 1); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_plat->_pos.x, _plat->_pos.y - 1); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_plat->_pos.x + 1, _plat->_pos.y + 1); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_plat->_pos.x - 1, _plat->_pos.y + 1); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_plat->_pos.x + 1, _plat->_pos.y - 1); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } - - checkPt = Common::Point(_plat->_pos.x - 1, _plat->_pos.y - 1); - if (!isPointBlocked(checkPt)) { - platypusWalkTo(checkPt, -1, -1, 1); - break; - } + if (gridX + _walkDirX * _walkDirXIncr != _walkDestX || gridY + _walkDirY * _walkDirYIncr != _walkDestY) { + _walkDestX = gridX + _walkDirX * _walkDirXIncr; + _walkDestY = gridY + _walkDirY * _walkDirYIncr; + result = false; + } else { + result = true; } + + return result; } void GnapEngine::platypusMakeRoom() { @@ -1425,7 +988,7 @@ void GnapEngine::platypusMakeRoom() { rndGridX = getRandom(_gridMaxX); } while (ABS(rndGridX - _plat->_pos.x) > 4 || ABS(rndGridY - _plat->_pos.y) > 3 || isPointBlocked(rndGridX, rndGridY)); - platypusWalkTo(Common::Point(rndGridX, rndGridY), -1, -1, 1); + _plat->walkTo(Common::Point(rndGridX, rndGridY), -1, -1, 1); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 8eeb4bf4d4..c16a1e7f45 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -95,8 +95,8 @@ void Scene01::run() { _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(9, 6), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107B9, 1); } else { _vm->_gnap->initPos(1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) @@ -158,7 +158,7 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: @@ -181,7 +181,7 @@ void Scene01::run() { _vm->playGnapScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 3) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 3) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01TakeMud; break; case TALK_CURSOR: @@ -201,17 +201,17 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01UsePigs; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: @@ -225,10 +225,10 @@ void Scene01::run() { case kHS01ExitTruck: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 2; } break; @@ -242,12 +242,12 @@ void Scene01::run() { case kHS01WalkArea7: case kHS01WalkArea8: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -417,17 +417,17 @@ void Scene02::run() { _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(9, 6), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107BA, 1); break; case 4: _vm->_gnap->initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107B9, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(8, 6), 1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(8, 6), 1, 0x107C2, 1); updateHotspots(); gameSys.waitForUpdate(); break; @@ -449,8 +449,8 @@ void Scene02::run() { _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(2, 7), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; } @@ -505,7 +505,7 @@ void Scene02::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; Common::Point destPos = Common::Point(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1); - _vm->gnapWalkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); @@ -516,14 +516,14 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02GrabChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: @@ -538,7 +538,7 @@ void Scene02::run() { case kHS02Truck2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) @@ -548,7 +548,7 @@ void Scene02::run() { } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -560,7 +560,7 @@ void Scene02::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) _vm->_gnap->_actionStatus = kAS02UseTruckGas; else @@ -568,7 +568,7 @@ void Scene02::run() { } } else { _vm->_gnap->_idleFacing = kDirUnk4; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseTruckNoKeys; } break; @@ -592,7 +592,7 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: @@ -607,10 +607,10 @@ void Scene02::run() { case kHS02ExitHouse: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), -1, 0x107C1, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); _vm->_newSceneNum = 4; } @@ -619,10 +619,10 @@ void Scene02::run() { case kHS02ExitBarn: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[7] + Common::Point(1, 0), -1, 0x107C1, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[7] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); _vm->_newSceneNum = 5; } @@ -631,10 +631,10 @@ void Scene02::run() { case kHS02ExitCreek: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8], -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8], -1, 0x107CD, 1); _vm->_newSceneNum = 3; } break; @@ -642,10 +642,10 @@ void Scene02::run() { case kHS02ExitPigpen: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[9], -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[9], -1, 0x107CF, 1); _vm->_newSceneNum = 1; } break; @@ -655,12 +655,12 @@ void Scene02::run() { case kHS02WalkArea3: case kHS02WalkArea4: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -925,8 +925,8 @@ void Scene03::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(4, 7), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(3, 6), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(4, 7), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(3, 6), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -968,7 +968,7 @@ void Scene03::run() { case kHS03Grass: if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { @@ -996,10 +996,10 @@ void Scene03::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2], -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], -1, 0x107C2, 1); _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 2; @@ -1020,7 +1020,7 @@ void Scene03::run() { case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1037,7 +1037,7 @@ void Scene03::run() { case kHS03TrappedPlatypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 4); } else { @@ -1047,10 +1047,10 @@ void Scene03::run() { break; case GRAB_CURSOR: if (_platypusHypnotized) { - _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107B5, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107B5, 1); _vm->_gnap->_actionStatus = kAS03FreePlatypus; } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else @@ -1062,7 +1062,7 @@ void Scene03::run() { _vm->playGnapBrainPulsating(8, 4); } else { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03HypnotizeScaredPlat; else @@ -1088,15 +1088,15 @@ void Scene03::run() { case kHS03WalkAreas2: case kHS03WalkAreas3: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS03PlatypusWalkArea: if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107B5, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107B5, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else @@ -1107,7 +1107,7 @@ void Scene03::run() { default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1406,8 +1406,8 @@ void Scene04::run() { _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(5, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(6, 9), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(6, 9), -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { _vm->_gnap->initPos(5, 7, kDirBottomRight); _vm->_plat->initPos(4, 7, kDirNone); @@ -1418,8 +1418,8 @@ void Scene04::run() { _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(9, 9), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(9, 9), -1, 0x107BA, 1); } } @@ -1507,7 +1507,7 @@ void Scene04::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); @@ -1528,19 +1528,19 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1)) { + if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20F; } break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS04GrabDog; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1)) { + if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20E; } @@ -1565,13 +1565,13 @@ void Scene04::run() { break; case GRAB_CURSOR: if (_vm->_cursorValue == 1) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS04OpenDoor; _vm->_timers[5] = 300; _vm->_gnap->_idleFacing = kDirUpLeft; } else { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; _vm->_newSceneNum = 38; } @@ -1587,10 +1587,10 @@ void Scene04::run() { case kHS04ExitTruck: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5], -1, 0x107C7, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5], -1, 0x107C7, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 2; else @@ -1607,7 +1607,7 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[7], 0, _vm->_gnap->getSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, _vm->_gnap->getSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { if (_triedWindow) { _vm->_gnap->_actionStatus = kAS04GetKeyAnother; } else { @@ -1631,10 +1631,10 @@ void Scene04::run() { case kHS04ExitBarn: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[8] + Common::Point(0, 1), -1, 0x107C1, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8] + Common::Point(0, 1), -1, 0x107C1, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; else @@ -1645,12 +1645,12 @@ void Scene04::run() { case kHS04WalkArea1: case kHS04WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1889,8 +1889,8 @@ void Scene05::run() { _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(Common::Point(2, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(2, 9), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(2, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 9), -1, 0x107B9, 1); } else { _vm->_gnap->initPos(6, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) @@ -1962,12 +1962,12 @@ void Scene05::run() { case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { _vm->_gnap->useDeviceOnPlatypus(); - if (_vm->platypusWalkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { + if (_vm->_plat->walkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { _vm->_plat->_actionStatus = kAS05PlatSearchHaystack; _vm->_plat->_idleFacing = kDirUnk4; } if (_vm->_gnap->_pos.x == 4 && (_vm->_gnap->_pos.y == 8 || _vm->_gnap->_pos.y == 7)) - _vm->gnapWalkStep(); + _vm->_gnap->walkStep(); _vm->playGnapIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } break; @@ -1981,7 +1981,7 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; Common::Point checkPt = _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1); - _vm->gnapWalkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); @@ -1992,12 +1992,12 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: @@ -2019,7 +2019,7 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: @@ -2035,7 +2035,7 @@ void Scene05::run() { if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_isLeavingScene = true; Common::Point destPt = _vm->_hotspotsWalkPos[2] + Common::Point(- 1, 1); - _vm->gnapWalkTo(destPt, 0, -1, 1); + _vm->_gnap->walkTo(destPt, 0, -1, 1); _vm->_gnap->_actionStatus = kAS05EnterBarn; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 6; @@ -2043,7 +2043,7 @@ void Scene05::run() { _vm->_newSceneNum = 36; } else if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2055,7 +2055,7 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: @@ -2070,10 +2070,10 @@ void Scene05::run() { case kHS05ExitHouse: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[4] + Common::Point(0, 1), -1, 0x107C7, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[4] + Common::Point(0, 1), -1, 0x107C7, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 4; else @@ -2084,7 +2084,7 @@ void Scene05::run() { case kHS05WalkArea1: case kHS05WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS05WalkArea3: @@ -2093,7 +2093,7 @@ void Scene05::run() { default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2319,8 +2319,8 @@ void Scene06::run() { _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -2382,7 +2382,7 @@ void Scene06::run() { _vm->playGnapImpossible(0, 0); } else if (triedDeviceOnGas) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS06TryToGetGas; } else { @@ -2415,7 +2415,7 @@ void Scene06::run() { if (_vm->isFlag(kGFGasTaken)) _vm->playGnapImpossible(0, 0); else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS06TryToClimbLadder; _vm->setFlag(kGFGasTaken); } @@ -2433,10 +2433,10 @@ void Scene06::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->platypusWalkTo(Common::Point(6, 8), 1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(6, 8), 1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirNone; _vm->_gnap->_actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); @@ -2449,11 +2449,11 @@ void Scene06::run() { break; case TALK_CURSOR: if (_horseTurnedBack) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); } else { _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS06TalkToHorse; } @@ -2470,7 +2470,7 @@ void Scene06::run() { case kHS06ExitOutsideBarn: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS06LeaveScene; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; @@ -2485,12 +2485,12 @@ void Scene06::run() { case kHS06WalkArea4: case kHS06WalkArea5: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2739,9 +2739,9 @@ void Scene07::run() { case kHS07ExitHouse: _vm->_isLeavingScene = true; if (_vm->_gnap->_pos.x > 8) - _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, 7), 0, 0x107AD, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, 7), 0, 0x107AD, 1); else - _vm->gnapWalkTo(Common::Point(8, 7), 0, 0x107AD, 1); + _vm->_gnap->walkTo(Common::Point(8, 7), 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS07LeaveScene; break; @@ -2783,7 +2783,7 @@ void Scene07::run() { case kHS07WalkArea1: case kHS07WalkArea2: - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS07WalkArea3: @@ -2792,7 +2792,7 @@ void Scene07::run() { default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2956,8 +2956,8 @@ void Scene08::run() { _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(1, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 7), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(1, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); _vm->_timers[5] = _vm->getRandom(40) + 50; @@ -3011,18 +3011,18 @@ void Scene08::run() { case kHS08ExitBackdoor: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(Common::Point(0, 6), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(0, 6), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; - _vm->platypusWalkTo(Common::Point(0, 7), 1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(0, 7), 1, 0x107CF, 1); _vm->_newSceneNum = 9; break; case kHS08ExitCrash: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(Common::Point(3, 9), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(3, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; - _vm->platypusWalkTo(Common::Point(4, 9), 1, 0x107C1, 1); + _vm->_plat->walkTo(Common::Point(4, 9), 1, 0x107C1, 1); _vm->_newSceneNum = 7; break; @@ -3033,7 +3033,7 @@ void Scene08::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS08LookMan; _vm->_gnap->_idleFacing = kDirUpRight; break; @@ -3043,13 +3043,13 @@ void Scene08::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x14D); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(6, 6), 1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(6, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithMan; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(6, 6); @@ -3071,21 +3071,21 @@ void Scene08::run() { _vm->_gnap->_actionStatus = kAS08LookDog; break; case GRAB_CURSOR: - _vm->gnapWalkTo(Common::Point(4, 7), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS08GrabDog; _vm->_gnap->_idleFacing = kDirUpRight; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); _vm->gnapActionIdle(0x14D); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(3, 7), 1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithDog; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(3, 7); @@ -3175,13 +3175,13 @@ void Scene08::run() { case kHS08WalkArea1: case kHS08WalkArea2: _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(Common::Point(-1, 6), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, 6), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { _vm->gnapActionIdle(0x14D); - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3333,7 +3333,7 @@ void Scene08::updateAnimations() { _vm->_plat->_idleFacing = kDirUnk4; _vm->_plat->_sequenceDatNum = 0; if (_vm->_gnap->_pos == Common::Point(1, 8)) - _vm->gnapWalkStep(); + _vm->_gnap->walkStep(); } else if (_nextDogSequenceId != -1) { gameSys.setAnimation(_nextDogSequenceId, 100, 3); gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -3386,8 +3386,8 @@ void Scene09::run() { _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(9, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 7), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(9, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(4, 7, kDirBottomRight); _vm->_plat->initPos(5, 7, kDirNone); @@ -3439,18 +3439,18 @@ void Scene09::run() { case kHS09ExitKitchen: _vm->_isLeavingScene = true; _vm->_newSceneNum = 10; - _vm->gnapWalkTo(Common::Point(4, 7), 0, 0x107BF, 1); + _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS09LeaveScene; - _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107D2, 1); + _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); _vm->_plat->_idleFacing = kDirUnk4; break; case kHS09ExitHouse: _vm->_isLeavingScene = true; _vm->_newSceneNum = 8; - _vm->gnapWalkTo(Common::Point(10, -1), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(10, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS09LeaveScene; - _vm->platypusWalkTo(Common::Point(10, -1), -1, 0x107CD, 1); + _vm->_plat->walkTo(Common::Point(10, -1), -1, 0x107CD, 1); _vm->_plat->_idleFacing = kDirUnk4; break; @@ -3464,7 +3464,7 @@ void Scene09::run() { break; case GRAB_CURSOR: _vm->_gnap->_actionStatus = kAS09SearchTrash; - _vm->gnapWalkTo(Common::Point(9, 6), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BC, 1); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -3477,12 +3477,12 @@ void Scene09::run() { case kHS09WalkArea1: case kHS09WalkArea2: case kHS09WalkArea3: - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index cb74bff32f..9033763c7e 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -75,14 +75,14 @@ void Scene10::run() { _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(9, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 7), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(9, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(1, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(1, 7), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } _vm->_timers[4] = _vm->getRandom(80) + 150; @@ -132,18 +132,18 @@ void Scene10::run() { case kHS10ExitBar: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(0, 7), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(0, 7), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; - _vm->platypusWalkTo(Common::Point(0, 7), -1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(0, 7), -1, 0x107CF, 1); _vm->_newSceneNum = 11; break; case kHS10ExitBackdoor: _vm->_isLeavingScene = true; _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(2, 9), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(2, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; - _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C7, 1); + _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C7, 1); _vm->_newSceneNum = 9; break; @@ -164,14 +164,14 @@ void Scene10::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(4, 6), -1, -1, 1); - _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); + _vm->_plat->walkTo(Common::Point(4, 6), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; } @@ -194,7 +194,7 @@ void Scene10::run() { _vm->playGnapMoan2(-1, -1); else { _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } break; @@ -207,8 +207,8 @@ void Scene10::run() { else { _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(3, 7), -1, -1, 1); - _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); + _vm->_plat->walkTo(Common::Point(3, 7), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } break; @@ -226,7 +226,7 @@ void Scene10::run() { break; case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case TALK_CURSOR: @@ -240,7 +240,7 @@ void Scene10::run() { _vm->setFlag(kGFMudTaken); _vm->gnapActionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(7, 6), 1, 0x107D2, 1); + _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS10PlatWithBox; _vm->_plat->_idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); @@ -261,7 +261,7 @@ void Scene10::run() { break; case GRAB_CURSOR: _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(9, 6), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BB, 1); gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_sequenceId = 0x10E; _vm->_gnap->_id = 120; @@ -283,7 +283,7 @@ void Scene10::run() { case kHS10WalkArea3: case kHS10WalkArea4: _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS10Device: @@ -296,7 +296,7 @@ void Scene10::run() { default: if (_vm->_mouseClickState._left) { _vm->gnapActionIdle(0x10C); - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -401,7 +401,7 @@ void Scene10::updateAnimations() { if (_vm->_plat->_actionStatus == kAS10PlatWithBox) _vm->_plat->_actionStatus = -1; if (_vm->_gnap->_pos == Common::Point(4, 8)) - _vm->gnapWalkStep(); + _vm->_gnap->walkStep(); break; default: gameSys.insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -573,8 +573,8 @@ void Scene11::run() { _vm->endSceneInit(); if (_vm->_prevSceneNum == 12) { - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } gameSys.insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); @@ -612,32 +612,32 @@ void Scene11::run() { case kHS11ExitKitchen: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(6, 5), 0, 0x107BF, 1); + _vm->_gnap->walkTo(Common::Point(6, 5), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; - _vm->platypusWalkTo(Common::Point(6, 6), -1, -1, 1); + _vm->_plat->walkTo(Common::Point(6, 6), -1, -1, 1); _vm->_newSceneNum = 10; break; case kHS11ExitToilet: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(8, 5), 0, 0x107BF, 1); + _vm->_gnap->walkTo(Common::Point(8, 5), 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; - _vm->platypusWalkTo(Common::Point(8, 6), -1, -1, 1); + _vm->_plat->walkTo(Common::Point(8, 6), -1, -1, 1); _vm->_newSceneNum = 13; break; case kHS11ExitLeft: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(-1, 8), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(-1, 8), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS11LeaveScene; - _vm->platypusWalkTo(Common::Point(-1, 9), -1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(-1, 9), -1, 0x107CF, 1); _vm->_newSceneNum = 12; break; case kHS11GoggleGuy: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemMagazine) { - _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS11ShowMagazineToGoggleGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -653,7 +653,7 @@ void Scene11::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkGoggleGuy; break; } @@ -665,7 +665,7 @@ void Scene11::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_gnap->_idleFacing = kDirUpRight; if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(Common::Point(5, 6), 0, 0x107BC, 9); + _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 9); _vm->_gnap->_actionStatus = kAS11ShowItemToHookGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0); } else { @@ -674,12 +674,12 @@ void Scene11::run() { _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 3, 6) | 0x10000); break; case GRAB_CURSOR: - _vm->gnapWalkTo(Common::Point(5, 6), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS11GrabHookGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->gnapWalkTo(Common::Point(5, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(5, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: @@ -700,7 +700,7 @@ void Scene11::run() { _vm->playGnapScratchingHead(9, 8); break; case GRAB_CURSOR: - _vm->gnapWalkTo(Common::Point(9, 8), 0, 0x107BA, 1); + _vm->_gnap->walkTo(Common::Point(9, 8), 0, 0x107BA, 1); _vm->_gnap->_actionStatus = kAS11GrabBillardBall; break; case TALK_CURSOR: @@ -718,7 +718,7 @@ void Scene11::run() { case kHS11WalkArea4: case kHS11WalkArea5: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS11Device: @@ -730,7 +730,7 @@ void Scene11::run() { default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -989,8 +989,8 @@ void Scene12::run() { _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 8, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } while (!_vm->_sceneDone) { @@ -1030,27 +1030,27 @@ void Scene12::run() { case kHS12ExitRight: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(10, -1), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(10, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS12LeaveScene; - _vm->platypusWalkTo(Common::Point(10, -1), -1, -1, 1); + _vm->_plat->walkTo(Common::Point(10, -1), -1, -1, 1); _vm->_newSceneNum = 11; break; case kHS12ToothGuy: if (_vm->_grabCursorSpriteIndex == kItemQuarter) { _vm->_largeSprite = gameSys.createSurface(0x141); - _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 9); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12QuarterToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 9); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12QuarterWithHoleToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 9); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12ShowItemToToothGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); @@ -1060,17 +1060,17 @@ void Scene12::run() { _vm->playGnapScratchingHead(1, 2); break; case GRAB_CURSOR: - _vm->gnapWalkTo(Common::Point(3, 7), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS12GrabToothGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(3, 7), 1, 0x107D2, 1); + _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; _vm->_plat->_idleFacing = kDirUnk4; _vm->playGnapIdle(2, 7); @@ -1081,19 +1081,19 @@ void Scene12::run() { case kHS12Barkeeper: if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 9); + _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12QuarterWithBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 9); + _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12ShowItemToBarkeeper; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(Common::Point(6, 6), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12LookBarkeeper; break; @@ -1102,7 +1102,7 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(Common::Point(6, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(6, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: @@ -1116,31 +1116,31 @@ void Scene12::run() { case kHS12BeardGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107BB, 9); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12ShowItemToBeardGuy; _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12LookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. - _vm->gnapWalkTo(Common::Point(7, 6), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12GrabBeardGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(7, 6), 1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; _vm->_plat->_idleFacing = kDirNone; _vm->playGnapIdle(7, 6); @@ -1152,7 +1152,7 @@ void Scene12::run() { case kHS12Jukebox: _vm->_newSceneNum = 15; _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(5, 6), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS12LeaveScene; break; @@ -1161,12 +1161,12 @@ void Scene12::run() { case kHS12WalkArea3: case kHS12WalkArea4: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1539,9 +1539,9 @@ void Scene13::run() { case kHS13ExitBar: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(2, 7), 0, 0x107C0, 1); + _vm->_gnap->walkTo(Common::Point(2, 7), 0, 0x107C0, 1); _vm->_gnap->_actionStatus = kAS13LeaveScene; - _vm->platypusWalkTo(Common::Point(2, 8), -1, -1, 1); + _vm->_plat->walkTo(Common::Point(2, 8), -1, -1, 1); if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { _vm->_newSceneNum = 11; } else { @@ -1569,7 +1569,7 @@ void Scene13::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_sequenceDatNum = 0; } else { - _vm->gnapWalkTo(Common::Point(5, 5), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(5, 5), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS13BackToilet; _vm->_gnap->_idleFacing = kDirUpRight; } @@ -1590,7 +1590,7 @@ void Scene13::run() { case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->gnapWalkTo(Common::Point(6, 7), 0, 0xA9, 5); + _vm->_gnap->walkTo(Common::Point(6, 7), 0, 0xA9, 5); _vm->_gnap->_actionStatus = kAS13FrontToilet; _vm->_gnap->_idleFacing = kDirBottomRight; break; @@ -1604,7 +1604,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS13LookScribble; _vm->_gnap->_idleFacing = kDirUpRight; break; @@ -1613,7 +1613,7 @@ void Scene13::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0), 1); + _vm->_gnap->walkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0), 1); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -1629,11 +1629,11 @@ void Scene13::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 9, 6)); - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->gnapWalkTo(Common::Point(8, 7), 0, -1, 1); + _vm->_gnap->walkTo(Common::Point(8, 7), 0, -1, 1); _vm->_gnap->_actionStatus = kAS13GrabUrinal; break; case TALK_CURSOR: @@ -1651,11 +1651,11 @@ void Scene13::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 5, 9)); - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, -1, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->gnapWalkTo(Common::Point(4, 8), 0, 0x107B9, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107B9, 1); _vm->_gnap->_actionStatus = kAS13GrabSink; break; case TALK_CURSOR: @@ -1674,7 +1674,7 @@ void Scene13::run() { case kHS13WalkArea7: case kHS13WalkArea8: case kHS13WalkArea9: - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS13WalkArea1: @@ -1683,7 +1683,7 @@ void Scene13::run() { default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1694,7 +1694,7 @@ void Scene13::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) - _vm->platypusWalkTo(Common::Point(-1, 7), -1, -1, 1); + _vm->_plat->walkTo(Common::Point(-1, 7), -1, -1, 1); if (_vm->_gnap->_actionStatus < 0) _vm->_gnap->updateIdleSequence(); if (!_vm->_timers[4]) { @@ -2322,7 +2322,7 @@ void Scene17::update() { _vm->updateMouseCursor(); _vm->updateGrabCursorSprite(0, 0); if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } } @@ -2418,8 +2418,8 @@ void Scene17::run() { _vm->_gnap->initPos(4, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { _vm->_gnap->initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; @@ -2472,8 +2472,8 @@ void Scene17::run() { _vm->_gnap->initPos(6, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { _vm->_gnap->initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); @@ -2506,7 +2506,7 @@ void Scene17::run() { _vm->_plat->_sequenceId = 0x7C1; _vm->_plat->_sequenceDatNum = 1; _vm->_plat->_idleFacing = kDirBottomRight; - _vm->platypusWalkTo(Common::Point(2, 9), -1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(2, 9), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -2531,8 +2531,8 @@ void Scene17::run() { _vm->_gnap->useJointOnPlatypus(); } else { _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6], 1, 0x107C2, 1); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6], 1, 0x107C2, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); _vm->_plat->_actionStatus = kAS17GetWrench1; _vm->_gnap->_actionStatus = kAS17GetWrench1; _vm->_timers[5] = _vm->getRandom(30) + 80; @@ -2578,7 +2578,7 @@ void Scene17::run() { if (_canTryGetWrench) { platHangUpPhone(); _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS17TryGetWrench; _vm->_gnap->_actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; @@ -2593,7 +2593,7 @@ void Scene17::run() { case kHS17Phone1: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2605,7 +2605,7 @@ void Scene17::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GetCoinFromPhone; } else _vm->playGnapImpossible(0, 0); @@ -2619,7 +2619,7 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; _vm->_gnap->_actionStatus = kAS17PlatUsePhone; @@ -2634,7 +2634,7 @@ void Scene17::run() { case kHS17Phone2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2648,7 +2648,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else @@ -2663,7 +2663,7 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; _vm->_gnap->_actionStatus = kAS17PlatUsePhone; @@ -2680,10 +2680,10 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS17LeaveScene; if (_vm->_plat->_actionStatus != kAS17PlatPhoningAssistant) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[5] + Common::Point(-1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; @@ -2693,9 +2693,9 @@ void Scene17::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS17LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[3] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[3] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -2703,12 +2703,12 @@ void Scene17::run() { case kHS17WalkArea2: case kHS17WalkArea3: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } break; @@ -2998,7 +2998,7 @@ void Scene17::updateAnimations() { _vm->_plat->_sequenceDatNum = 0; _vm->_gnap->_sequenceId = 0x875; _vm->_plat->_sequenceId = 0x23F; - _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); + _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->_actionStatus = kAS17GetWrench2; } break; @@ -3302,7 +3302,7 @@ void Scene18::closeHydrantValve() { _vm->_gnap->_actionStatus = kAS18LeaveScene; _vm->updateMouseCursor(); if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) { _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; waitForGnapAction(); @@ -3311,7 +3311,7 @@ void Scene18::closeHydrantValve() { waitForGnapAction(); } } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); _vm->_gnap->_actionStatus = kAS18CloseTopValve; waitForGnapAction(); } @@ -3384,7 +3384,7 @@ void Scene18::run() { } else { gameSys.setAnimation(_currPhoneSequenceId, 254, 3); } - _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->clearFlag(kGFGnapControlsToyUFO); @@ -3395,20 +3395,20 @@ void Scene18::run() { _vm->_gnap->initPos(4, 11, kDirBottomRight); _vm->_plat->initPos(5, 11, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { _vm->_gnap->initPos(7, 7, kDirBottomRight); _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(8, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(-1, 10, kDirBottomRight); _vm->_plat->initPos(-1, 10, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(3, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(3, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } } @@ -3476,7 +3476,7 @@ void Scene18::run() { _vm->playGnapScratchingHead(3, 2); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -3513,12 +3513,12 @@ void Scene18::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), -1, -1, 1); - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromHydrant; } break; @@ -3570,7 +3570,7 @@ void Scene18::run() { } } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); @@ -3582,7 +3582,7 @@ void Scene18::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS18CloseTopValve; } else @@ -3612,7 +3612,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCan; else @@ -3626,7 +3626,7 @@ void Scene18::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; else @@ -3654,10 +3654,10 @@ void Scene18::run() { } else { _vm->_isLeavingScene = true; _vm->_newSceneNum = 19; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); _vm->_gnap->_actionStatus = kAS18LeaveScene; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore] + Common::Point(1, 0), -1, 0x107C2, 1); } } break; @@ -3671,12 +3671,12 @@ void Scene18::run() { closeHydrantValve(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -3690,12 +3690,12 @@ void Scene18::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity], 0, 0x107B2, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity], 0, 0x107B2, 1); _vm->_gnap->_actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(false); else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity] + Common::Point(0, -1), -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity] + Common::Point(0, -1), -1, 0x107CF, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -3707,7 +3707,7 @@ void Scene18::run() { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } @@ -3719,7 +3719,7 @@ void Scene18::run() { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } @@ -3744,7 +3744,7 @@ void Scene18::run() { _vm->_plat->_actionStatus = -1; _vm->_sceneWaiting = false; _vm->_plat->initPos(-1, 10, kDirNone); - _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); _vm->clearFlag(kGFPlatypusTalkingToAssistant); } } else { @@ -3840,7 +3840,7 @@ void Scene18::updateAnimations() { _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS18OpenTopValveDone; break; @@ -3938,7 +3938,7 @@ void Scene18::updateAnimations() { _vm->playGnapUseDevice(0, 0); gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; if (_vm->_gnap->_actionStatus == kAS18OpenRightValveNoGarbageCan) _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCanDone; @@ -4107,7 +4107,7 @@ void Scene19::run() { gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _shopAssistantCtr = 0; _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(4, 9), -1, 0x107B9, 1); + _vm->_gnap->walkTo(Common::Point(4, 9), -1, 0x107B9, 1); updateHotspots(); } else { _currShopAssistantSequenceId = 0x6D; @@ -4118,8 +4118,8 @@ void Scene19::run() { _vm->_gnap->initPos(3, 6, kDirBottomRight); _vm->_plat->initPos(4, 6, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(4, 9), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(5, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(4, 9), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -4170,12 +4170,12 @@ void Scene19::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS19WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[1], 0, 0x107B2, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107B2, 1); _vm->_gnap->_actionStatus = kAS19LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[1] + Common::Point(1, 0), -1, 0x107C5, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(1, 0), -1, 0x107C5, 1); _vm->_hotspots[kHS19WalkArea1]._flags &= ~SF_WALKABLE; } break; @@ -4191,7 +4191,7 @@ void Scene19::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS19GrabPicture; } break; @@ -4215,7 +4215,7 @@ void Scene19::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: @@ -4243,7 +4243,7 @@ void Scene19::run() { _vm->playGnapMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); _vm->_gnap->_actionStatus = kAS19GrabToy; break; @@ -4266,7 +4266,7 @@ void Scene19::run() { _vm->playGnapScratchingHead(9, 1); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); _vm->playGnapIdle(8, 2); _vm->_gnap->_actionStatus = kAS19UsePhone; break; @@ -4283,12 +4283,12 @@ void Scene19::run() { case kHS19WalkArea2: case kHS19WalkArea3: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } } diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index e02b2fa8b5..582aa5bae1 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -208,45 +208,45 @@ void Scene20::run() { } _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(6, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { case 17: _vm->_gnap->initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(6, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 18: _vm->_gnap->initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(6, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 21: _vm->_gnap->initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 22: _vm->_gnap->initPos(7, 6, kDirBottomRight); _vm->_plat->initPos(8, 6, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(9, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); break; default: _vm->_gnap->initPos(8, 6, kDirBottomLeft); _vm->_plat->initPos(9, 6, kDirUnk4); _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; break; } @@ -302,9 +302,9 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 21; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; @@ -315,9 +315,9 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -328,9 +328,9 @@ void Scene20::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore] + Common::Point(0, 1), -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -341,9 +341,9 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; @@ -354,9 +354,9 @@ void Scene20::run() { _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS20LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -371,7 +371,7 @@ void Scene20::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); if (_stonerGuyShowingJoint) _vm->_gnap->_actionStatus = kAS20GrabJoint; else @@ -379,7 +379,7 @@ void Scene20::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) _vm->_gnap->_actionStatus = kAS20TalkStonerGuyNoJoint; else @@ -405,12 +405,12 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: @@ -425,7 +425,7 @@ void Scene20::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); @@ -437,7 +437,7 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: @@ -451,12 +451,12 @@ void Scene20::run() { case kHS20WalkArea1: case kHS20WalkArea2: - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -625,7 +625,7 @@ void Scene20::updateAnimations() { _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(Common::Point(3, 8), -1, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(3, 8), -1, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = -1; break; case kAS20GrabJointDone: @@ -674,7 +674,7 @@ void Scene20::updateAnimations() { _currGroceryStoreGuySequenceId = 377; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = -1; - _vm->gnapWalkTo(Common::Point(4, 8), -1, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107BB, 1); break; case 0x17C: gameSys.setAnimation(0, 0, 3); @@ -757,8 +757,8 @@ void Scene21::run() { if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } } else { _vm->_gnap->initPos(5, 11, kDirBottomRight); @@ -769,8 +769,8 @@ void Scene21::run() { _nextOldLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -824,7 +824,7 @@ void Scene21::run() { _vm->playGnapScratchingHead(2, 5); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); _vm->playGnapPullOutDevice(2, 5); _vm->playGnapUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS21GrabBanana; @@ -841,7 +841,7 @@ void Scene21::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; - _vm->gnapWalkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 6, 7, 4); @@ -853,13 +853,13 @@ void Scene21::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: @@ -874,20 +874,20 @@ void Scene21::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); _vm->_gnap->_actionStatus = kAS21LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS21WalkArea1: case kHS21WalkArea2: - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1050,8 +1050,8 @@ void Scene22::run() { _vm->_gnap->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); _vm->_plat->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); } if (_vm->isFlag(kGFSceneFlag1)) { @@ -1134,9 +1134,9 @@ void Scene22::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS22LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; @@ -1144,9 +1144,9 @@ void Scene22::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 23; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS22LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; @@ -1164,7 +1164,7 @@ void Scene22::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: @@ -1177,12 +1177,12 @@ void Scene22::run() { case kHS22WalkArea1: case kHS22WalkArea2: - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1298,12 +1298,12 @@ void Scene23::run() { gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(1, 7), -1, 0x107C2, 1); + _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); if (_vm->isFlag(kGFUnk24)) { - _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); + _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else { - _vm->gnapWalkTo(Common::Point(2, 7), 0, 0x107B9, 1); + _vm->_gnap->walkTo(Common::Point(2, 7), 0, 0x107B9, 1); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); @@ -1363,7 +1363,7 @@ void Scene23::run() { if (_vm->isFlag(kGFSceneFlag1)) _vm->playGnapMoan2(0, 0); else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS23LookCereals; } break; @@ -1372,7 +1372,7 @@ void Scene23::run() { _vm->playGnapImpossible(0, 0); else { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); _vm->_gnap->_actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); @@ -1391,21 +1391,21 @@ void Scene23::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS23LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity] + Common::Point(0, -1), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity] + Common::Point(0, -1), -1, 0x107C2, 1); } break; case kHS23WalkArea1: case kHS23WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1566,14 +1566,14 @@ void Scene24::run() { _vm->_gnap->initPos(1, 8, kDirBottomRight); _vm->_plat->initPos(2, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(1, 9), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(2, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(1, 9), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(2, 9), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(8, 8, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(3, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -1624,9 +1624,9 @@ void Scene24::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1635,9 +1635,9 @@ void Scene24::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1645,12 +1645,12 @@ void Scene24::run() { case kHS24WalkArea2: case kHS24WalkArea3: if (_vm->_gnap->_actionStatus == -1) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1815,14 +1815,14 @@ void Scene25::run() { _vm->_gnap->initPos(5, 11, kDirUpLeft); _vm->_plat->initPos(6, 11, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 7), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(6, 7), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 7), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(6, 7), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(5, 6, kDirBottomRight); _vm->_plat->initPos(6, 6, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -1870,7 +1870,7 @@ void Scene25::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, 9, 4) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, 9, 4) | 0x10000, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1884,7 +1884,7 @@ void Scene25::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: @@ -1900,9 +1900,9 @@ void Scene25::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); _vm->_gnap->_actionStatus = kAS25LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1912,13 +1912,13 @@ void Scene25::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); _vm->_gnap->_actionStatus = kAS25LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } else { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(Common::Point(4, 5), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(4, 5), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicket; _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } @@ -1935,7 +1935,7 @@ void Scene25::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], -1, -1, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], -1, -1, 1); if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) _vm->_gnap->_idleFacing = kDirUpLeft; else if (_vm->_sceneClickedHotspot == 8) @@ -1958,12 +1958,12 @@ void Scene25::run() { case kHS25WalkArea1: case kHS25WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2044,7 +2044,7 @@ void Scene25::updateAnimations() { _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; _vm->playGnapIdle(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicketDone; break; @@ -2133,8 +2133,8 @@ void Scene26::run() { _vm->_gnap->initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(2, 8, kDirBottomRight); _vm->_plat->initPos(3, 8, kDirNone); @@ -2186,7 +2186,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2195,7 +2195,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2204,7 +2204,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2213,7 +2213,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 30; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitElephant].y), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitElephant].y), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2222,7 +2222,7 @@ void Scene26::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS26LeaveScene; } break; @@ -2230,12 +2230,12 @@ void Scene26::run() { case kHS26WalkArea1: case kHS26WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2350,22 +2350,22 @@ void Scene27::run() { _vm->_gnap->initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; case 29: _vm->_gnap->initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 31: _vm->_gnap->initPos(12, 8, kDirBottomLeft); _vm->_plat->initPos(12, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(8, 9), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(8, 9), -1, 0x107C2, 1); break; default: _vm->_gnap->initPos(6, 8, kDirBottomRight); @@ -2420,7 +2420,7 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemPicture) { _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) _vm->_gnap->_actionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); @@ -2431,7 +2431,7 @@ void Scene27::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: @@ -2454,7 +2454,7 @@ void Scene27::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS27GrabBucket; break; case TALK_CURSOR: @@ -2470,9 +2470,9 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus] + Common::Point(1, 0), -1, 0x107C7, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus] + Common::Point(1, 0), -1, 0x107C7, 1); } break; @@ -2480,9 +2480,9 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade] + Common::Point(0, 1), -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade] + Common::Point(0, 1), -1, 0x107CF, 1); } break; @@ -2490,9 +2490,9 @@ void Scene27::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand] + Common::Point(0, 1), -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand] + Common::Point(0, 1), -1, 0x107CD, 1); } break; @@ -2501,12 +2501,12 @@ void Scene27::run() { if (_vm->isFlag(kGFPlatypus)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 28; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS27ExitClown] + Common::Point(1, 0), -1, 0x107C4, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown] + Common::Point(1, 0), -1, 0x107C4, 1); } else { _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= SF_WALKABLE; _vm->_gnap->_actionStatus = kAS27TryEnterClownTent; } @@ -2515,12 +2515,12 @@ void Scene27::run() { case kHS27WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2614,12 +2614,12 @@ void Scene27::updateAnimations() { break; case kAS27TryEnterClownTentDone: _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[7].x, 9), -1, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[7].x, 9), -1, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = -1; break; case kAS27EnterClownTent: - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107B2, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107B2, 1); _vm->_gnap->_actionStatus = kAS27LeaveScene; break; case kAS27LeaveScene: @@ -2799,14 +2799,14 @@ void Scene28::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28GrabHornSuccess; } } else { _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(Common::Point(2, 8), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Horn], 0, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Horn], 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS28GrabHornFails; } @@ -2829,13 +2829,13 @@ void Scene28::run() { _vm->playGnapImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); _vm->playGnapPullOutDevice(0, 0); _vm->playGnapUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS28UsePillBucketWithClown; @@ -2848,7 +2848,7 @@ void Scene28::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: @@ -2865,10 +2865,10 @@ void Scene28::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); _vm->_gnap->_actionStatus = kAS28LeaveScene; _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown] + Common::Point(-1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; @@ -2884,7 +2884,7 @@ void Scene28::run() { _vm->playGnapScratchingHead(8, 6); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: @@ -2899,12 +2899,12 @@ void Scene28::run() { case kHS28WalkArea1: case kHS28WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3003,7 +3003,7 @@ void Scene28::updateAnimations() { _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; _vm->_gnap->_actionStatus = -1; - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107BB, 1); break; case kAS28TalkClown: _clownTalkCtr = (_clownTalkCtr + 1) % 2; @@ -3127,14 +3127,14 @@ void Scene29::run() { _vm->_gnap->initPos(12, 7, kDirBottomRight); _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(8, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(8, 7), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { _vm->_gnap->initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 7, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 7), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -3182,7 +3182,7 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; @@ -3210,9 +3210,9 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS29LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus] + Common::Point(1, 0), -1, -1, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; @@ -3220,9 +3220,9 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS29LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown] + Common::Point(0, -1), -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown] + Common::Point(0, -1), -1, 0x107CD, 1); } break; @@ -3232,7 +3232,7 @@ void Scene29::run() { _vm->setGrabCursorSprite(-1); _vm->_isLeavingScene = true; _vm->_newSceneNum = 52; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); _vm->_gnap->_actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -3254,12 +3254,12 @@ void Scene29::run() { case kHS29WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3351,7 +3351,7 @@ void Scene29::updateAnimations() { _vm->_timers[5] = 30; while (_vm->_timers[5]) _vm->gameUpdateTick(); - _vm->platypusWalkTo(Common::Point(0, 8), 1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(0, 8), 1, 0x107CF, 1); while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); } else if (_nextMonkeySequenceId == -1) { diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 8a91123571..99cd34be69 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -67,8 +67,8 @@ void Scene30::run() { _vm->_gnap->initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -115,7 +115,7 @@ void Scene30::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { _vm->_hotspots[kHS30WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine], 0, 0x107BC, 1); _vm->_hotspots[kHS30WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS30UsePillMachine; hasTakenPill = true; @@ -124,7 +124,7 @@ void Scene30::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(Common::Point(9, 8), 0, 0x107BC, 1); + _vm->_gnap->walkTo(Common::Point(9, 8), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS30LookPillMachine; break; case GRAB_CURSOR: @@ -146,20 +146,20 @@ void Scene30::run() { _vm->_newSceneNum = 47; else _vm->_newSceneNum = 26; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS30LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus] + Common::Point(1, 0), -1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS30WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -254,7 +254,7 @@ void Scene30::updateAnimations() { break; case kAS30UsePillMachine4: gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS30PillMachine] + Common::Point(0, 1), -1, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine] + Common::Point(0, 1), -1, 0x107BC, 1); _vm->_gnap->_actionStatus = -1; break; case kAS30LookPillMachine: @@ -315,14 +315,14 @@ void Scene31::run() { _vm->_gnap->initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(3, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(3, 9), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(7, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107D2, 1); } while (!_vm->_sceneDone) { @@ -381,9 +381,9 @@ void Scene31::run() { _vm->playGnapScratchingHead(2, 2); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 0, 0x107B9, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 0, 0x107B9, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS31UseMeasuringClown; _vm->_timers[4] = 300; @@ -394,9 +394,9 @@ void Scene31::run() { case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 1, 0x107C2, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; _vm->_plat->_actionStatus = kAS31PlatMeasuringClown; _vm->_gnap->_actionStatus = kAS31PlatMeasuringClown; @@ -413,12 +413,12 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->playGnapPullOutDevice(6, 8); _vm->playGnapUseDevice(0, 0); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeer; _vm->_timers[4] = 300; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -432,7 +432,7 @@ void Scene31::run() { if (_beerGuyDistracted) { _vm->playGnapScratchingHead(6, 2); } else { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS31UseBeerBarrel; _vm->_gnap->_idleFacing = kDirUpLeft; } @@ -450,9 +450,9 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS31LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus] + Common::Point(1, 0), -1, -1, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; @@ -460,20 +460,20 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->gnapWalkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS31LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown] + Common::Point(0, 1), -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown] + Common::Point(0, 1), -1, 0x107CF, 1); } break; case kHS31WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -667,8 +667,8 @@ void Scene32::run() { _vm->_gnap->initPos(11, 6, kDirBottomLeft); _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(9, 6), -1, 0x107D2, 1); - _vm->gnapWalkTo(Common::Point(8, 6), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107BA, 1); } else { _vm->_gnap->initPos(1, 6, kDirBottomRight); _vm->_plat->initPos(1, 7, kDirNone); @@ -719,9 +719,9 @@ void Scene32::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS32LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck] + Common::Point(0, 1), -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 33; } break; @@ -735,13 +735,13 @@ void Scene32::run() { case kHS32WalkArea7: case kHS32WalkArea8: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; } if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } @@ -829,8 +829,8 @@ void Scene33::run() { _vm->_gnap->initPos(11, 7, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 7), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 7), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(8, 7), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); break; case 37: _vm->_gnap->initPos(7, 7, kDirBottomRight); @@ -841,8 +841,8 @@ void Scene33::run() { _vm->_gnap->initPos(-1, 6, kDirBottomRight); _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(2, 7), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; default: _vm->_gnap->initPos(3, 7, kDirBottomRight); @@ -899,14 +899,14 @@ void Scene33::run() { switch (_vm->_verbCursor) { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS33UseChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: @@ -924,9 +924,9 @@ void Scene33::run() { _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 37; if (_vm->_gnap->_pos.x > 6) - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); else - _vm->gnapWalkTo(Common::Point(6, 7), 0, 0x107B1, 1); + _vm->_gnap->walkTo(Common::Point(6, 7), 0, 0x107B1, 1); } break; @@ -936,18 +936,18 @@ void Scene33::run() { _vm->_gnap->_actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 35; if (_vm->_gnap->_pos.x > 7) - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); else - _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107B1, 1); + _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107B1, 1); } break; case kHS33ExitCreek: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS33LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], -1, 0x107CD, 1); _vm->_newSceneNum = 34; } break; @@ -955,9 +955,9 @@ void Scene33::run() { case kHS33ExitPigpen: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS33LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], -1, 0x107CF, 1); _vm->_newSceneNum = 32; } break; @@ -965,12 +965,12 @@ void Scene33::run() { case kHS33WalkArea1: case kHS33WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1172,7 +1172,7 @@ void Scene38::run() { _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; } else { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(-1, -1), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS38LeaveScene; _vm->_newSceneNum = 37; } @@ -1186,7 +1186,7 @@ void Scene38::run() { } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { _vm->_sceneWaiting = false; _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(5, 7), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; _vm->_gnap->_actionStatus = kAS38ExitCave; } @@ -1215,8 +1215,8 @@ void Scene38::run() { if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->playGnapImpossible(0, 0); else { - _vm->gnapWalkTo(Common::Point(3, 6), 0, 0x107BB, 1); - _vm->platypusWalkTo(Common::Point(4, 8), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(3, 6), 0, 0x107BB, 1); + _vm->_plat->walkTo(Common::Point(4, 8), -1, -1, 1); _vm->_gnap->_actionStatus = kAS38UseHuntingTrophy; } break; @@ -1243,7 +1243,7 @@ void Scene38::run() { if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; else if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: @@ -1251,7 +1251,7 @@ void Scene38::run() { if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; else if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1327,7 +1327,7 @@ void Scene38::updateAnimations() { _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->_isLeavingScene) { _vm->_sceneWaiting = false; - _vm->gnapWalkTo(Common::Point(5, 7), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; _vm->_gnap->_actionStatus = kAS38ExitCave; } else { @@ -1355,7 +1355,7 @@ void Scene38::updateAnimations() { _vm->_plat->playSequence(0x107D5); else _vm->_plat->playSequence(0x107D4); - _vm->platypusWalkTo(Common::Point(8, 7), -1, 0x107D2, 1); + _vm->_plat->walkTo(Common::Point(8, 7), -1, 0x107D2, 1); gameSys.insertSequence(0xA1, _vm->_gnap->_id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceId = 0xA1; _vm->_plat->_sequenceDatNum = 0; @@ -1478,7 +1478,7 @@ void Scene39::run() { if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->gnapWalkTo(_vm->_gnap->_pos, 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS39LeaveScene; _vm->_newSceneNum = 40; } @@ -1491,7 +1491,7 @@ void Scene39::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); _vm->showFullScreenSprite(0x1C); break; @@ -1516,12 +1516,12 @@ void Scene39::run() { case kHS39WalkArea1: case kHS39WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index b805c1052c..7d7be662dc 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -276,14 +276,14 @@ void Scene41::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-2, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 42) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 8, kDirBottomRight); _vm->_plat->initPos(6, 8, kDirBottomLeft); @@ -374,31 +374,31 @@ void Scene41::run() { case kHS41ExitCave: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS41ExitCave], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS41ExitCave], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; _vm->_newSceneNum = 40; break; case kHS41Exit: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; - _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), -1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), -1, 0x107CF, 1); _vm->_newSceneNum = 45; break; case kHS41ExitBBQ: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS41LeaveScene; - _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), -1, 0x107CD, 1); + _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), -1, 0x107CD, 1); _vm->_newSceneNum = 42; break; case kHS41ToyVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->_gnap->_actionStatus = kAS41UseQuarterWithToyVendor; - _vm->gnapWalkTo(Common::Point(4, 7), 0, 0x107BB, 9); + _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BB, 9); _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(4, 7, 5, 0); @@ -412,7 +412,7 @@ void Scene41::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: @@ -424,7 +424,7 @@ void Scene41::run() { case kHS41Kid: if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { - _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -435,13 +435,13 @@ void Scene41::run() { _vm->playGnapScratchingHead(9, 0); break; case GRAB_CURSOR: - _vm->gnapWalkTo(Common::Point(7, 7), 0, 0x107BB, 1); + _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS41GrabKid; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case PLAT_CURSOR: _vm->playGnapImpossible(0, 0); @@ -460,7 +460,7 @@ void Scene41::run() { case kHS41WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -503,7 +503,7 @@ void Scene41::run() { _vm->_toyUfoActionStatus = kAS41ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -788,20 +788,20 @@ void Scene42::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 43) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -886,34 +886,34 @@ void Scene42::run() { case kHS42ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; - _vm->platypusWalkTo(Common::Point(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), -1, 0x107C7, 1); + _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; case kHS42ExitToyStand: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand], -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand], -1, 0x107CF, 1); _vm->_newSceneNum = 41; break; case kHS42ExitUfo: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = kAS42LeaveScene; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo], -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo], -1, 0x107CD, 1); _vm->_newSceneNum = 43; break; case kHS42BBQVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendor; if (_vm->_plat->_pos.y < 9) - _vm->platypusWalkTo(Common::Point(_vm->_plat->_pos.x, 9), -1, -1, 1); + _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, 9), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { @@ -923,7 +923,7 @@ void Scene42::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: @@ -943,7 +943,7 @@ void Scene42::run() { _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); break; case GRAB_CURSOR: - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS42GrabChickenLeg; break; case TALK_CURSOR: @@ -957,7 +957,7 @@ void Scene42::run() { case kHS42WalkArea1: case kHS42WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; } @@ -969,7 +969,7 @@ void Scene42::run() { _vm->_toyUfoActionStatus = kAS42ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1230,28 +1230,28 @@ void Scene43::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 44: _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; case 54: _vm->_gnap->initPos(4, 7, kDirBottomLeft); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; default: _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; } } @@ -1344,25 +1344,25 @@ void Scene43::run() { case kHS43ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], -1, 0x107C7, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; case kHS43ExitBBQ: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ], -1, 0x107CF, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ], -1, 0x107CF, 1); _vm->_newSceneNum = 42; break; case kHS43ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth], -1, 0x107CD, 1); + _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth], -1, 0x107CD, 1); _vm->_newSceneNum = 44; break; @@ -1376,7 +1376,7 @@ void Scene43::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -1398,7 +1398,7 @@ void Scene43::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(Common::Point(3, 7), 0, 67515, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, 67515, 1); _vm->_gnap->_actionStatus = 1; break; case TALK_CURSOR: @@ -1412,7 +1412,7 @@ void Scene43::run() { case kHS43WalkArea1: case kHS43WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -1423,7 +1423,7 @@ void Scene43::run() { _vm->_toyUfoActionStatus = 5; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1684,15 +1684,15 @@ void Scene44::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 7, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 46: _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(6, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(7, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(6, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(7, 8), -1, 0x107D2, 1); break; case 50: _vm->_gnap->initPos(4, 8, kDirBottomRight); @@ -1714,8 +1714,8 @@ void Scene44::run() { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(6, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(5, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); break; } } @@ -1792,22 +1792,22 @@ void Scene44::run() { case kHS44ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty], 0, 0x107AE, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty], 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS44ExitUfo: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; case kHS44ExitShow: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44ExitShow], 0, 0x107AB, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44ExitShow], 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 46; break; @@ -1815,7 +1815,7 @@ void Scene44::run() { case kHS44KissingLady: if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->_actionStatus = 2; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); } else { switch (_vm->_verbCursor) { @@ -1827,14 +1827,14 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case PLAT_CURSOR: _vm->_gnap->useDeviceOnPlatypus(); - _vm->platypusWalkTo(Common::Point(6, 7), 1, 0x107D2, 1); + _vm->_plat->walkTo(Common::Point(6, 7), 1, 0x107D2, 1); if (_vm->_gnap->_pos == Common::Point(7, 7)) - _vm->gnapWalkStep(); + _vm->_gnap->walkStep(); _vm->playGnapIdle(5, 7); _vm->_plat->_actionStatus = 4; break; @@ -1881,7 +1881,7 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -1894,7 +1894,7 @@ void Scene44::run() { case kHS44WalkArea1: case kHS44WalkArea2: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; } @@ -1906,7 +1906,7 @@ void Scene44::run() { _vm->_toyUfoActionStatus = 7; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -2153,20 +2153,20 @@ void Scene45::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 41) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107D2, 1); - _vm->gnapWalkTo(Common::Point(10, 9), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(10, 9), -1, 0x107BA, 1); } else { _vm->_gnap->initPos(2, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(4, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(2, 7), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { @@ -2284,7 +2284,7 @@ void Scene45::run() { case kHS45ExitUfoParty: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; } @@ -2293,9 +2293,9 @@ void Scene45::run() { case kHS45ExitShoe: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 46; } break; @@ -2303,9 +2303,9 @@ void Scene45::run() { case kHS45ExitRight: if (_vm->_gnap->_actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); + _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 41; } break; @@ -2320,7 +2320,7 @@ void Scene45::run() { case kHS45DiscoBall: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemSpring) { - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall], 0, 0x9F, 5); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall], 0, 0x9F, 5); _vm->_gnap->_actionStatus = 1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemSpring); @@ -2343,7 +2343,7 @@ void Scene45::run() { case kHS45WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -2354,7 +2354,7 @@ void Scene45::run() { _vm->_toyUfoActionStatus = 3; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -2517,20 +2517,20 @@ void Scene46::run() { _vm->_gnap->initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(1, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(2, 8), -1, 0x107B9, 1); + _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 45) { _vm->_gnap->initPos(11, 8, kDirUpRight); _vm->_plat->initPos(12, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->gnapWalkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->platypusWalkTo(Common::Point(9, 8), -1, 0x107D2, 1); + _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { _vm->_gnap->initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->platypusWalkTo(Common::Point(5, 8), -1, 0x107C2, 1); - _vm->gnapWalkTo(Common::Point(6, 8), -1, 0x107BA, 1); + _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); + _vm->_gnap->walkTo(Common::Point(6, 8), -1, 0x107BA, 1); } _vm->_timers[4] = _vm->getRandom(50) + 80; @@ -2614,7 +2614,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -2635,7 +2635,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapWalkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case GRAB_CURSOR: @@ -2648,30 +2648,30 @@ void Scene46::run() { case kHS46ExitUfoParty: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y), 0, 0x107AE, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS46ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); + _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 44; break; case kHS46ExitDisco: _vm->_isLeavingScene = true; - _vm->gnapWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); + _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); _vm->_gnap->_actionStatus = 0; - _vm->platypusWalkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); + _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 45; break; case kHS46WalkArea1: if (_vm->_gnap->_actionStatus < 0) - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } @@ -2682,7 +2682,7 @@ void Scene46::run() { _vm->_toyUfoActionStatus = 4; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->gnapWalkTo(Common::Point(-1, -1), -1, -1, 1); + _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } } -- cgit v1.2.3 From 8a725082a512d080ff394ee38370c96c6f13ec0b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 22:59:59 +0200 Subject: GNAP: Move more functions to PlayerGnap --- engines/gnap/character.cpp | 225 +++++++++++++++++++++++++++++++++++++++-- engines/gnap/character.h | 7 ++ engines/gnap/gnap.cpp | 209 +------------------------------------- engines/gnap/gnap.h | 10 -- engines/gnap/grid.cpp | 24 ++--- engines/gnap/scenes/group0.cpp | 28 ++--- engines/gnap/scenes/group1.cpp | 26 ++--- 7 files changed, 263 insertions(+), 266 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index a15f4e9cad..6ae731671d 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -551,7 +551,7 @@ void PlayerGnap::initBrainPulseRndValue() { void PlayerGnap::playSequence(int sequenceId) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = 300; - _vm->gnapIdle(); + idle(); _vm->_gameSys->insertSequence(sequenceId, _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqScale | kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); @@ -693,7 +693,7 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI _walkDestY = CLIP(gridY, 0, _vm->_gridMaxY - 1); if (animationIndex >= 0 && _walkDestX == _vm->_plat->_pos.x && _walkDestY == _vm->_plat->_pos.y) - _vm->platypusMakeRoom(); + _vm->_plat->makeRoom(); if (findPath1(_pos.x, _pos.y, 0)) done = true; @@ -707,7 +707,7 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI if (!done && findPath4(_pos.x, _pos.y)) done = true; - _vm->gnapIdle(); + idle(); int gnapSequenceId = _sequenceId; int gnapId = _id; @@ -765,7 +765,7 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI if (_walkNodesCount > 0) { _sequenceId = gnapSequenceId; _id = gnapId; - _idleFacing = _vm->getGnapWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); + _idleFacing = getWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); _sequenceDatNum = datNum; if (animationIndex >= 0) _vm->_gameSys->setAnimation(makeRid(_sequenceDatNum, _sequenceId), _id, animationIndex); @@ -794,8 +794,8 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI } } else { if (_walkNodesCount > 0) { - _sequenceId = _vm->getGnapWalkStopSequenceId(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); - _idleFacing = _vm->getGnapWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); + _sequenceId = getWalkStopSequenceId(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); + _idleFacing = getWalkFacing(_walkNodes[_walkNodesCount - 1]._deltaX, _walkNodes[_walkNodesCount - 1]._deltaY); } else if (gridX >= 0 || gridY >= 0) { switch (_idleFacing) { case kDirBottomRight: @@ -819,8 +819,8 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI ++v10; if (_vm->_leftClickMouseY == _vm->_gridMinY + 48 * _pos.y) v11 = 1; - _sequenceId = _vm->getGnapWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); - _idleFacing = _vm->getGnapWalkFacing(v10 / abs(v10), v11 / abs(v11)); + _sequenceId = getWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); + _idleFacing = getWalkFacing(v10 / abs(v10), v11 / abs(v11)); } _sequenceDatNum = datNum; } @@ -848,6 +848,211 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI return done; } +int PlayerGnap::getShowSequenceId(int index, int gridX, int gridY) { + int sequenceId; + Facing facing = _idleFacing; + + if (gridY > 0 && gridX > 0) { + if (_pos.y > gridY) { + if (_pos.x > gridX) + _idleFacing = kDirUpLeft; + else + _idleFacing = kDirUpRight; + } else { + if (_pos.x > gridX) + _idleFacing = kDirUpLeft; + else + _idleFacing = kDirUpRight; + } + } else if (_idleFacing != kDirBottomRight && _idleFacing != kDirUpRight) { + _idleFacing = kDirUpLeft; + } else { + _idleFacing = kDirUpRight; + } + + switch (index) { + case 0: + if (_idleFacing == kDirUpRight) + sequenceId = 0x8A0; + else + sequenceId = 0x8A1; + break; + case 1: + if (_idleFacing == kDirUpRight) + sequenceId = 0x880; + else + sequenceId = 0x895; + break; + case 2: + if (_idleFacing == kDirUpRight) + sequenceId = 0x884; + else + sequenceId = 0x899; + break; + //Skip 3 + case 4: + if (_idleFacing == kDirUpRight) + sequenceId = 0x881; + else + sequenceId = 0x896; + break; + case 5: + if (_idleFacing == kDirUpRight) + sequenceId = 0x883; + else + sequenceId = 0x898; + break; + case 6: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87E; + else + sequenceId = 0x893; + break; + case 7: + if (_idleFacing == kDirUpRight) + sequenceId = 0x848; + else + sequenceId = 0x890; + break; + case 8: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87D; + else + sequenceId = 0x892; + break; + case 9: + if (_idleFacing == kDirUpRight) + sequenceId = 0x882; + else + sequenceId = 0x897; + break; + case 10: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87C; + else + sequenceId = 0x891; + break; + case 11: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87C; + else + sequenceId = 0x891; + break; + case 12: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87D; + else + sequenceId = 0x892; + break; + case 13: + if (_idleFacing == kDirUpRight) + sequenceId = 0x888; + else + sequenceId = 0x89D; + break; + case 14: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87F; + else + sequenceId = 0x894; + break; + case 15: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87B; + else + sequenceId = 0x8A3; + break; + case 16: + if (_idleFacing == kDirUpRight) + sequenceId = 0x877; + else + sequenceId = 0x88C; + break; + //Skip 17 + case 18: + sequenceId = 0x887; + break; + case 19: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87A; + else + sequenceId = 0x88F; + break; + case 20: + if (_idleFacing == kDirUpRight) + sequenceId = 0x878; + else + sequenceId = 0x88D; + break; + case 21: + if (_idleFacing == kDirUpRight) + sequenceId = 0x879; + else + sequenceId = 0x88E; + break; + case 22: + if (_idleFacing == kDirUpRight) + sequenceId = 0x88A; + else + sequenceId = 0x89F; + break; + case 23: + if (_idleFacing == kDirUpRight) + sequenceId = 0x889; + else + sequenceId = 0x89E; + break; + case 24: + if (_idleFacing == kDirUpRight) + sequenceId = 0x886; + else + sequenceId = 0x89B; + break; + case 25: + if (_idleFacing == kDirUpRight) + sequenceId = 0x87A; + else + sequenceId = 0x88F; + break; + //Skip 26 + //Skip 27 + //Skip 28 + //Skip 29 + default: + _idleFacing = facing; + sequenceId = getSequenceId(gskImpossible, 0, 0); + break; + } + + return sequenceId; +} + +void PlayerGnap::idle() { + if (_sequenceDatNum == 1 && + (_sequenceId == 0x7A6 || _sequenceId == 0x7AA || + _sequenceId == 0x832 || _sequenceId == 0x841 || + _sequenceId == 0x842 || _sequenceId == 0x8A2 || + _sequenceId == 0x833 || _sequenceId == 0x834 || + _sequenceId == 0x885 || _sequenceId == 0x7A8 || + _sequenceId == 0x831 || _sequenceId == 0x89A)) { + _vm->_gameSys->insertSequence(getSequenceId(gskIdle, 0, 0) | 0x10000, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); + _sequenceId = getSequenceId(gskIdle, 0, 0); + _sequenceDatNum = 1; + } +} + +void PlayerGnap::actionIdle(int sequenceId) { + if (_sequenceId != -1 && ridToDatIndex(sequenceId) == _sequenceDatNum && ridToEntryIndex(sequenceId) == _sequenceId) { + _vm->_gameSys->insertSequence(getSequenceId(gskIdle, 0, 0) | 0x10000, _id, + makeRid(_sequenceDatNum, _sequenceId), _id, + kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); + _sequenceId = getSequenceId(gskIdle, 0, 0); + _sequenceDatNum = 1; + } +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} @@ -904,7 +1109,7 @@ void PlayerPlat::updateIdleSequence() { } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; - _vm->platypusMakeRoom(); + _vm->_plat->makeRoom(); } } else { _vm->_timers[0] = 100; @@ -932,7 +1137,7 @@ void PlayerPlat::updateIdleSequence2() { } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; - _vm->platypusMakeRoom(); + _vm->_plat->makeRoom(); } } else { _vm->_timers[0] = 100; diff --git a/engines/gnap/character.h b/engines/gnap/character.h index c36b0a2295..114b3a3290 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -88,6 +88,11 @@ public: virtual int getWalkSequenceId(int deltaX, int deltaY); virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); + void actionIdle(int sequenceId); + int getShowSequenceId(int index, int gridX, int gridY); + Facing getWalkFacing(int deltaX, int deltaY); + int getWalkStopSequenceId(int deltaX, int deltaY); + void idle(); void initBrainPulseRndValue(); void kissPlatypus(int callback); void useDeviceOnPlatypus(); @@ -114,6 +119,8 @@ public: virtual int getWalkSequenceId(int deltaX, int deltaY); virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); + void makeRoom(); + private: bool findPath1(int gridX, int gridY, int index); bool findPath2(int gridX, int gridY, int index); diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 42d5277dc6..e40d50e621 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -941,211 +941,6 @@ void GnapEngine::deleteSurface(Graphics::Surface **surface) { } } -int GnapEngine::getGnapShowSequenceId(int index, int gridX, int gridY) { - int sequenceId; - Facing facing = _gnap->_idleFacing; - - if (gridY > 0 && gridX > 0) { - if (_gnap->_pos.y > gridY) { - if (_gnap->_pos.x > gridX) - _gnap->_idleFacing = kDirUpLeft; - else - _gnap->_idleFacing = kDirUpRight; - } else { - if (_gnap->_pos.x > gridX) - _gnap->_idleFacing = kDirUpLeft; - else - _gnap->_idleFacing = kDirUpRight; - } - } else if (_gnap->_idleFacing != kDirBottomRight && _gnap->_idleFacing != kDirUpRight) { - _gnap->_idleFacing = kDirUpLeft; - } else { - _gnap->_idleFacing = kDirUpRight; - } - - switch (index) { - case 0: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x8A0; - else - sequenceId = 0x8A1; - break; - case 1: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x880; - else - sequenceId = 0x895; - break; - case 2: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x884; - else - sequenceId = 0x899; - break; - //Skip 3 - case 4: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x881; - else - sequenceId = 0x896; - break; - case 5: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x883; - else - sequenceId = 0x898; - break; - case 6: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87E; - else - sequenceId = 0x893; - break; - case 7: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x848; - else - sequenceId = 0x890; - break; - case 8: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87D; - else - sequenceId = 0x892; - break; - case 9: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x882; - else - sequenceId = 0x897; - break; - case 10: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87C; - else - sequenceId = 0x891; - break; - case 11: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87C; - else - sequenceId = 0x891; - break; - case 12: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87D; - else - sequenceId = 0x892; - break; - case 13: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x888; - else - sequenceId = 0x89D; - break; - case 14: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87F; - else - sequenceId = 0x894; - break; - case 15: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87B; - else - sequenceId = 0x8A3; - break; - case 16: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x877; - else - sequenceId = 0x88C; - break; - //Skip 17 - case 18: - sequenceId = 0x887; - break; - case 19: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87A; - else - sequenceId = 0x88F; - break; - case 20: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x878; - else - sequenceId = 0x88D; - break; - case 21: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x879; - else - sequenceId = 0x88E; - break; - case 22: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x88A; - else - sequenceId = 0x89F; - break; - case 23: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x889; - else - sequenceId = 0x89E; - break; - case 24: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x886; - else - sequenceId = 0x89B; - break; - case 25: - if (_gnap->_idleFacing == kDirUpRight) - sequenceId = 0x87A; - else - sequenceId = 0x88F; - break; - //Skip 26 - //Skip 27 - //Skip 28 - //Skip 29 - default: - _gnap->_idleFacing = facing; - sequenceId = _gnap->getSequenceId(gskImpossible, 0, 0); - break; - } - return sequenceId; -} - -void GnapEngine::gnapIdle() { - if (_gnap->_sequenceId != -1 && _gnap->_sequenceDatNum == 1 && - (_gnap->_sequenceId == 0x7A6 || _gnap->_sequenceId == 0x7AA || - _gnap->_sequenceId == 0x832 || _gnap->_sequenceId == 0x841 || - _gnap->_sequenceId == 0x842 || _gnap->_sequenceId == 0x8A2 || - _gnap->_sequenceId == 0x833 || _gnap->_sequenceId == 0x834 || - _gnap->_sequenceId == 0x885 || _gnap->_sequenceId == 0x7A8 || - _gnap->_sequenceId == 0x831 || _gnap->_sequenceId == 0x89A)) { - _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id, - makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnap->_gridX, 48 * _gnap->_pos.y - _gnap->_gridY); - _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0); - _gnap->_sequenceDatNum = 1; - } -} - -void GnapEngine::gnapActionIdle(int sequenceId) { - if (_gnap->_sequenceId != -1 && ridToDatIndex(sequenceId) == _gnap->_sequenceDatNum && - ridToEntryIndex(sequenceId) == _gnap->_sequenceId) { - _gameSys->insertSequence(_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, _gnap->_id, - makeRid(_gnap->_sequenceDatNum, _gnap->_sequenceId), _gnap->_id, - kSeqSyncExists, 0, 75 * _gnap->_pos.x - _gnap->_gridX, 48 * _gnap->_pos.y - _gnap->_gridY); - _gnap->_sequenceId = _gnap->getSequenceId(gskIdle, 0, 0); - _gnap->_sequenceDatNum = 1; - } -} - void GnapEngine::playGnapImpossible(int gridX, int gridY) { _gnap->playSequence(_gnap->getSequenceId(gskImpossible, gridX, gridY) | 0x10000); } @@ -1183,12 +978,12 @@ void GnapEngine::playGnapIdle(int gridX, int gridY) { } void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { - _gnap->playSequence(getGnapShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); + _gnap->playSequence(_gnap->getShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); } void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { if (_plat->_pos.x == gridX && _plat->_pos.y == gridY) - platypusMakeRoom(); + _plat->makeRoom(); _gnap->walkTo(Common::Point(gridX, gridY), -1, -1, 1); playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index db9368d98d..15e1753fda 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -474,17 +474,7 @@ public: void initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gridMaxY); bool testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2); - // Gnap walking - int getGnapWalkStopSequenceId(int deltaX, int deltaY); - Facing getGnapWalkFacing(int deltaX, int deltaY); - - // Platypus walking - void platypusMakeRoom(); - // Gnap - int getGnapShowSequenceId(int index, int gridX, int gridY); - void gnapIdle(); - void gnapActionIdle(int sequenceId); void playGnapImpossible(int gridX, int gridY); void playGnapScratchingHead(int gridX, int gridY); void playGnapMoan1(int gridX, int gridY); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index d4aed8dbc0..b817b65102 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -38,24 +38,24 @@ void GnapEngine::initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gri _plat->_gridY = 347 - gridMinY; } -int GnapEngine::getGnapWalkStopSequenceId(int deltaX, int deltaY) { - static const int _gnapWalkStopSequenceIds[9] = { +int PlayerGnap::getWalkStopSequenceId(int deltaX, int deltaY) { + static const int gnapWalkStopSequenceIds[9] = { 0x7BC, 0x7BA, 0x7BA, 0x7BC, 0x000, 0x7BA, 0x7BB, 0x7B9, 0x7B9 }; // CHECKME This is a little weird - return _gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY]; + return gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY]; } -Facing GnapEngine::getGnapWalkFacing(int deltaX, int deltaY) { - static const Facing _gnapWalkFacings[9] = { +Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) { + static const Facing gnapWalkFacings[9] = { kDirUpLeft, kDirBottomLeft, kDirBottomLeft, kDirUpLeft, kDirNone, kDirBottomLeft, kDirUpRight, kDirBottomRight, kDirBottomRight }; // CHECKME This is a little weird - return _gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; + return gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; } bool GnapEngine::isPointBlocked(Common::Point gridPos) { @@ -981,14 +981,14 @@ bool PlayerPlat::findPath4(int gridX, int gridY) { return result; } -void GnapEngine::platypusMakeRoom() { +void PlayerPlat::makeRoom() { int rndGridX, rndGridY; do { - rndGridY = getRandom(_gridMaxY); - rndGridX = getRandom(_gridMaxX); - } while (ABS(rndGridX - _plat->_pos.x) > 4 || ABS(rndGridY - _plat->_pos.y) > 3 || - isPointBlocked(rndGridX, rndGridY)); - _plat->walkTo(Common::Point(rndGridX, rndGridY), -1, -1, 1); + rndGridY = _vm->getRandom(_vm->_gridMaxY); + rndGridX = _vm->getRandom(_vm->_gridMaxX); + } while (ABS(rndGridX - _pos.x) > 4 || ABS(rndGridY - _pos.y) > 3 || + _vm->isPointBlocked(rndGridX, rndGridY)); + walkTo(Common::Point(rndGridX, rndGridY), -1, -1, 1); } } // End of namespace Gnap diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index c16a1e7f45..d65558474c 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -2833,7 +2833,7 @@ void Scene07::run() { } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; - _vm->platypusMakeRoom(); + _vm->_plat->makeRoom(); } } else { _vm->_timers[0] = 100; @@ -2995,7 +2995,7 @@ void Scene08::run() { _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->kissPlatypus(8); break; case TALK_CURSOR: @@ -3010,7 +3010,7 @@ void Scene08::run() { case kHS08ExitBackdoor: _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->walkTo(Common::Point(0, 6), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; _vm->_plat->walkTo(Common::Point(0, 7), 1, 0x107CF, 1); @@ -3019,7 +3019,7 @@ void Scene08::run() { case kHS08ExitCrash: _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->walkTo(Common::Point(3, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS08LeaveScene; _vm->_plat->walkTo(Common::Point(4, 9), 1, 0x107C1, 1); @@ -3032,7 +3032,7 @@ void Scene08::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS08LookMan; _vm->_gnap->_idleFacing = kDirUpRight; @@ -3042,12 +3042,12 @@ void Scene08::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->walkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(6, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithMan; @@ -3077,13 +3077,13 @@ void Scene08::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithDog; @@ -3106,7 +3106,7 @@ void Scene08::run() { if (_currDogSequenceId == 0x135) { _vm->playGnapScratchingHead(6, 7); } else { - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->playGnapPullOutDevice(6, 7); _vm->playGnapUseDevice(0, 0); _nextDogSequenceId = 0x149; @@ -3132,7 +3132,7 @@ void Scene08::run() { if (_currDogSequenceId == 0x135) { _vm->playGnapScratchingHead(3, 6); } else { - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->playGnapPullOutDevice(3, 6); _vm->playGnapUseDevice(0, 0); _nextDogSequenceId = 0x14A; @@ -3158,7 +3158,7 @@ void Scene08::run() { if (_currDogSequenceId == 0x135) { _vm->playGnapScratchingHead(7, 6); } else { - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->playGnapPullOutDevice(7, 6); _vm->playGnapUseDevice(0, 0); _nextDogSequenceId = 0x14B; @@ -3174,13 +3174,13 @@ void Scene08::run() { case kHS08WalkArea1: case kHS08WalkArea2: - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->walkTo(Common::Point(-1, 6), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->gnapActionIdle(0x14D); + _vm->_gnap->actionIdle(0x14D); _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 9033763c7e..8a6bff0fcf 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -131,7 +131,7 @@ void Scene10::run() { case kHS10ExitBar: _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(0, 7), 0, 0x107AF, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; _vm->_plat->walkTo(Common::Point(0, 7), -1, 0x107CF, 1); @@ -140,7 +140,7 @@ void Scene10::run() { case kHS10ExitBackdoor: _vm->_isLeavingScene = true; - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(2, 9), 0, 0x107AE, 1); _vm->_gnap->_actionStatus = kAS10LeaveScene; _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C7, 1); @@ -163,12 +163,12 @@ void Scene10::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(4, 6), -1, -1, 1); _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); @@ -193,7 +193,7 @@ void Scene10::run() { if (_vm->isFlag(kGFMudTaken)) _vm->playGnapMoan2(-1, -1); else { - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } @@ -205,7 +205,7 @@ void Scene10::run() { if (_vm->isFlag(kGFMudTaken)) _vm->playGnapMoan2(-1, -1); else { - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), -1, -1, 1); _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); @@ -225,7 +225,7 @@ void Scene10::run() { _vm->playGnapScratchingHead(7, 3); break; case GRAB_CURSOR: - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; @@ -238,7 +238,7 @@ void Scene10::run() { else { _vm->invAdd(kItemTongs); _vm->setFlag(kGFMudTaken); - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS10PlatWithBox; @@ -260,7 +260,7 @@ void Scene10::run() { _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 10, 5) | 0x10000); break; case GRAB_CURSOR: - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BB, 1); gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_sequenceId = 0x10E; @@ -282,7 +282,7 @@ void Scene10::run() { case kHS10WalkArea2: case kHS10WalkArea3: case kHS10WalkArea4: - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); break; @@ -295,7 +295,7 @@ void Scene10::run() { default: if (_vm->_mouseClickState._left) { - _vm->gnapActionIdle(0x10C); + _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } @@ -3185,9 +3185,9 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { if (_vm->_gnap->_pos.y == _vm->_plat->_pos.y) { if (nextGridX >= _vm->_gnap->_pos.x) { if (nextGridX >= _vm->_plat->_pos.x && _vm->_gnap->_pos.x <= _vm->_plat->_pos.x) - _vm->platypusMakeRoom(); + _vm->_plat->makeRoom(); } else if (nextGridX <= _vm->_plat->_pos.x && _vm->_gnap->_pos.x >= _vm->_plat->_pos.x) { - _vm->platypusMakeRoom(); + _vm->_plat->makeRoom(); } } gnapSeqId = _vm->_gnap->_sequenceId; -- cgit v1.2.3 From a508936349cd29ef2d89735699fac0b933ff9b7d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 23:18:36 +0200 Subject: GNAP: Move Gnap action functions to PlayerGnap --- engines/gnap/character.cpp | 47 +++++++ engines/gnap/character.h | 11 ++ engines/gnap/gnap.cpp | 47 ------- engines/gnap/gnap.h | 11 -- engines/gnap/scenes/group0.cpp | 302 ++++++++++++++++++++--------------------- engines/gnap/scenes/group1.cpp | 266 ++++++++++++++++++------------------ engines/gnap/scenes/group2.cpp | 226 +++++++++++++++--------------- engines/gnap/scenes/group3.cpp | 102 +++++++------- engines/gnap/scenes/group4.cpp | 146 ++++++++++---------- 9 files changed, 579 insertions(+), 579 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 6ae731671d..ee8196138a 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -1053,6 +1053,53 @@ void PlayerGnap::actionIdle(int sequenceId) { } } +void PlayerGnap::playImpossible(int gridX, int gridY) { + playSequence(getSequenceId(gskImpossible, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playScratchingHead(int gridX, int gridY) { + playSequence(getSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playMoan1(int gridX, int gridY) { + playSequence(getSequenceId(gskMoan1, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playMoan2(int gridX, int gridY) { + playSequence(getSequenceId(gskMoan2, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playBrainPulsating(int gridX, int gridY) { + playSequence(getSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playPullOutDevice(int gridX, int gridY) { + playSequence(getSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playPullOutDeviceNonWorking(int gridX, int gridY) { + playSequence(getSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playUseDevice(int gridX, int gridY) { + playSequence(getSequenceId(gskUseDevice, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playIdle(int gridX, int gridY) { + playSequence(getSequenceId(gskIdle, gridX, gridY) | 0x10000); +} + +void PlayerGnap::playShowItem(int itemIndex, int gridLookX, int gridLookY) { + playSequence(getShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); +} + +void PlayerGnap::playShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { + if (_vm->_plat->_pos.x == gridX && _vm->_plat->_pos.y == gridY) + _vm->_plat->makeRoom(); + walkTo(Common::Point(gridX, gridY), -1, -1, 1); + playShowItem(_vm->_grabCursorSpriteIndex, gridLookX, gridLookY); +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 114b3a3290..d04c59462c 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -95,6 +95,17 @@ public: void idle(); void initBrainPulseRndValue(); void kissPlatypus(int callback); + void playBrainPulsating(int gridX, int gridY); + void playIdle(int gridX, int gridY); + void playImpossible(int gridX, int gridY); + void playMoan1(int gridX, int gridY); + void playMoan2(int gridX, int gridY); + void playPullOutDevice(int gridX, int gridY); + void playPullOutDeviceNonWorking(int gridX, int gridY); + void playScratchingHead(int gridX, int gridY); + void playShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); + void playShowItem(int itemIndex, int gridLookX, int gridLookY); + void playUseDevice(int gridX, int gridY); void useDeviceOnPlatypus(); void useJointOnPlatypus(); diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index e40d50e621..3b6f84af37 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -941,53 +941,6 @@ void GnapEngine::deleteSurface(Graphics::Surface **surface) { } } -void GnapEngine::playGnapImpossible(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskImpossible, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapScratchingHead(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapMoan1(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskMoan1, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapMoan2(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskMoan2, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapBrainPulsating(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapPullOutDevice(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapPullOutDeviceNonWorking(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapUseDevice(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskUseDevice, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapIdle(int gridX, int gridY) { - _gnap->playSequence(_gnap->getSequenceId(gskIdle, gridX, gridY) | 0x10000); -} - -void GnapEngine::playGnapShowItem(int itemIndex, int gridLookX, int gridLookY) { - _gnap->playSequence(_gnap->getShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); -} - -void GnapEngine::playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { - if (_plat->_pos.x == gridX && _plat->_pos.y == gridY) - _plat->makeRoom(); - _gnap->walkTo(Common::Point(gridX, gridY), -1, -1, 1); - playGnapShowItem(_grabCursorSpriteIndex, gridLookX, gridLookY); -} - bool GnapEngine::testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2) { if (_mouseClickState._left && someStatus == _gnap->_actionStatus) { _isLeavingScene = false; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 15e1753fda..8446454ba5 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -475,17 +475,6 @@ public: bool testWalk(int animationIndex, int someStatus, int gridX1, int gridY1, int gridX2, int gridY2); // Gnap - void playGnapImpossible(int gridX, int gridY); - void playGnapScratchingHead(int gridX, int gridY); - void playGnapMoan1(int gridX, int gridY); - void playGnapMoan2(int gridX, int gridY); - void playGnapBrainPulsating(int gridX, int gridY); - void playGnapPullOutDevice(int gridX, int gridY); - void playGnapPullOutDeviceNonWorking(int gridX, int gridY); - void playGnapUseDevice(int gridX, int gridY); - void playGnapIdle(int gridX, int gridY); - void playGnapShowItem(int itemIndex, int gridLookX, int gridLookY); - void playGnapShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); void doCallback(int callback); bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); void gnapUseDisguiseOnPlatypus(); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index d65558474c..780c4d2616 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -126,24 +126,24 @@ void Scene01::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -153,7 +153,7 @@ void Scene01::run() { case kHS01Spaceship: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -164,7 +164,7 @@ void Scene01::run() { case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -174,11 +174,11 @@ void Scene01::run() { case kHS01Mud: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 3); + _vm->_gnap->playScratchingHead(3, 3); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 3) | 0x10000, 1); @@ -186,7 +186,7 @@ void Scene01::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -196,7 +196,7 @@ void Scene01::run() { case kHS01Pigs: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -215,7 +215,7 @@ void Scene01::run() { _vm->_gnap->_actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -312,8 +312,8 @@ void Scene01::updateAnimations() { break; case kAS01TakeMud: - _vm->playGnapPullOutDevice(2, 3); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(2, 3); + _vm->_gnap->playUseDevice(0, 0); gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(128, 40, 3); _vm->_gnap->_actionStatus = -1; @@ -327,8 +327,8 @@ void Scene01::updateAnimations() { break; case kAS01UsePigs: - _vm->playGnapPullOutDevice(7, 2); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(7, 2); + _vm->_gnap->playUseDevice(0, 0); gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); _vm->_gnap->_actionStatus = -1; break; @@ -476,24 +476,24 @@ void Scene02::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -508,11 +508,11 @@ void Scene02::run() { _vm->_gnap->walkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(9, 8); + _vm->_gnap->playMoan2(9, 8); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; @@ -527,7 +527,7 @@ void Scene02::run() { _vm->_gnap->_actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -552,11 +552,11 @@ void Scene02::run() { _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 2); + _vm->_gnap->playScratchingHead(2, 2); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { @@ -574,7 +574,7 @@ void Scene02::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -584,11 +584,11 @@ void Scene02::run() { case kHS02TruckGrill: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(2, 4); + _vm->_gnap->playMoan2(2, 4); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -597,7 +597,7 @@ void Scene02::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -804,7 +804,7 @@ void Scene02::updateAnimations() { _vm->_timers[5] = 30; break; case kAS02UseTwigWithChicken: - _vm->playGnapShowItem(5, 0, 0); + _vm->_gnap->playShowItem(5, 0, 0); gameSys.insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _currChickenSequenceId = 0x155; _nextChickenSequenceId = -1; @@ -941,24 +941,24 @@ void Scene03::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -970,22 +970,22 @@ void Scene03::run() { if (_vm->isFlag(kGFGrassTaken)) { _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 6); + _vm->_gnap->playScratchingHead(9, 6); break; case GRAB_CURSOR: - _vm->playGnapPullOutDevice(9, 6); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(9, 6); + _vm->_gnap->playUseDevice(0, 0); gameSys.insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1B3, 253, 5); _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1011,11 +1011,11 @@ void Scene03::run() { case kHS03Creek: if (_vm->_gnap->_actionStatus == -1) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(2, 8); + _vm->_gnap->playMoan2(2, 8); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) @@ -1027,7 +1027,7 @@ void Scene03::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1039,11 +1039,11 @@ void Scene03::run() { if (_vm->isFlag(kGFPlatypus)) { _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 4); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 4); + _vm->_gnap->playScratchingHead(8, 4); break; case GRAB_CURSOR: if (_platypusHypnotized) { @@ -1059,7 +1059,7 @@ void Scene03::run() { break; case TALK_CURSOR: if (_platypusHypnotized) { - _vm->playGnapBrainPulsating(8, 4); + _vm->_gnap->playBrainPulsating(8, 4); } else { _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); @@ -1070,7 +1070,7 @@ void Scene03::run() { } break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1196,7 +1196,7 @@ void Scene03::updateAnimations() { updateHotspots(); break; case kAS03HypnotizePlat: - _vm->playGnapBrainPulsating(0, 0); + _vm->_gnap->playBrainPulsating(0, 0); _vm->addFullScreenSprite(0x106, 255); gameSys.setAnimation(0x1C9, 256, 1); gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); @@ -1212,7 +1212,7 @@ void Scene03::updateAnimations() { updateHotspots(); break; case kAS03HypnotizeScaredPlat: - _vm->playGnapBrainPulsating(0, 0); + _vm->_gnap->playBrainPulsating(0, 0); gameSys.insertSequence(0x1BF, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); gameSys.setAnimation(0x1BF, 99, 1); while (gameSys.getAnimationStatus(1) != 2) @@ -1445,27 +1445,27 @@ void Scene04::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: if (_vm->_cursorValue == 4) _vm->_gnap->kissPlatypus(0); else - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1475,21 +1475,21 @@ void Scene04::run() { case kHS04Twig: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); break; case GRAB_CURSOR: - _vm->playGnapPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - _vm->playGnapUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->_gnap->playPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->_gnap->playUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); gameSys.insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1FD, 100, 2); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1499,11 +1499,11 @@ void Scene04::run() { case kHS04Axe: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); + _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -1514,7 +1514,7 @@ void Scene04::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1524,12 +1524,12 @@ void Scene04::run() { case kHS04Dog: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { - _vm->playGnapMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20F; } break; @@ -1541,12 +1541,12 @@ void Scene04::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { - _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + _vm->_gnap->playBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20E; } break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1556,12 +1556,12 @@ void Scene04::run() { case kHS04Door: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case PLAT_CURSOR: - _vm->playGnapScratchingHead(4, 3); + _vm->_gnap->playScratchingHead(4, 3); break; case GRAB_CURSOR: if (_vm->_cursorValue == 1) { @@ -1577,7 +1577,7 @@ void Scene04::run() { } break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1601,9 +1601,9 @@ void Scene04::run() { case kHS04Window: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); } else if (_vm->isFlag(kGFKeysTaken)) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1617,11 +1617,11 @@ void Scene04::run() { } break; case GRAB_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); + _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1920,24 +1920,24 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1947,17 +1947,17 @@ void Scene05::run() { case kHS05Haystack: if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); } else if (_vm->isFlag(kGFNeedleTaken)) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); + _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); break; case GRAB_CURSOR: case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { @@ -1968,7 +1968,7 @@ void Scene05::run() { } if (_vm->_gnap->_pos.x == 4 && (_vm->_gnap->_pos.y == 8 || _vm->_gnap->_pos.y == 7)) _vm->_gnap->walkStep(); - _vm->playGnapIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } break; } @@ -1984,11 +1984,11 @@ void Scene05::run() { _vm->_gnap->walkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(9, 7); + _vm->_gnap->playMoan2(9, 7); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; @@ -2001,7 +2001,7 @@ void Scene05::run() { _vm->_gnap->_actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2011,11 +2011,11 @@ void Scene05::run() { case kHS05Ladder: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(2, 4); + _vm->_gnap->playMoan2(2, 4); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; @@ -2024,7 +2024,7 @@ void Scene05::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2047,11 +2047,11 @@ void Scene05::run() { _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 4); + _vm->_gnap->playScratchingHead(7, 4); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -2060,7 +2060,7 @@ void Scene05::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2194,7 +2194,7 @@ void Scene05::updateAnimations() { _vm->_gnap->_actionStatus = kAS05LeaveScene; break; case kAS05UseTwigWithChicken: - _vm->playGnapShowItem(5, 0, 0); + _vm->_gnap->playShowItem(5, 0, 0); _nextChickenSequenceId = 0x14F; _vm->_gnap->_actionStatus = -1; break; @@ -2344,24 +2344,24 @@ void Scene06::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { _vm->gnapUseDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2371,15 +2371,15 @@ void Scene06::run() { case kHS06Gas: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 0); + _vm->_gnap->playScratchingHead(5, 0); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk04)) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else if (triedDeviceOnGas) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); @@ -2387,15 +2387,15 @@ void Scene06::run() { _vm->_gnap->_actionStatus = kAS06TryToGetGas; } else { triedDeviceOnGas = true; - _vm->playGnapPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + _vm->_gnap->playPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); } break; case TALK_CURSOR: case PLAT_CURSOR: if (_vm->isFlag(kGFUnk04)) - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); else - _vm->playGnapScratchingHead(5, 0); + _vm->_gnap->playScratchingHead(5, 0); break; } } @@ -2405,15 +2405,15 @@ void Scene06::run() { case kHS06Ladder: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 4); + _vm->_gnap->playScratchingHead(8, 4); break; case GRAB_CURSOR: if (_vm->isFlag(kGFGasTaken)) - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); else { _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); _vm->_gnap->_actionStatus = kAS06TryToClimbLadder; @@ -2422,7 +2422,7 @@ void Scene06::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2441,11 +2441,11 @@ void Scene06::run() { _vm->_gnap->_actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 2); + _vm->_gnap->playScratchingHead(3, 2); break; case TALK_CURSOR: if (_horseTurnedBack) { @@ -2460,7 +2460,7 @@ void Scene06::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2722,13 +2722,13 @@ void Scene07::run() { case kHS07Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -2747,7 +2747,7 @@ void Scene07::run() { case kHS07Dice: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 8, 3, 3); + _vm->_gnap->playShowCurrItem(4, 8, 3, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2756,7 +2756,7 @@ void Scene07::run() { _vm->setFlag(kGFPlatypus); _vm->invAdd(kItemDice); updateHotspots(); - _vm->playGnapPullOutDevice(3, 3); + _vm->_gnap->playPullOutDevice(3, 3); gameSys.setAnimation(0x8E, 1, 2); gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_vm->_gnap->getSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnap->_id, @@ -2767,7 +2767,7 @@ void Scene07::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2985,21 +2985,21 @@ void Scene08::run() { case kH08SPlatypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->actionIdle(0x14D); _vm->_gnap->kissPlatypus(8); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -3028,7 +3028,7 @@ void Scene08::run() { case kHS08Man: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 6, 7, 0); + _vm->_gnap->playShowCurrItem(6, 6, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -3038,7 +3038,7 @@ void Scene08::run() { _vm->_gnap->_idleFacing = kDirUpRight; break; case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -3052,7 +3052,7 @@ void Scene08::run() { _vm->_plat->walkTo(Common::Point(6, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithMan; _vm->_plat->_idleFacing = kDirNone; - _vm->playGnapIdle(6, 6); + _vm->_gnap->playIdle(6, 6); break; } } @@ -3060,13 +3060,13 @@ void Scene08::run() { case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 7, 5, 0); + _vm->_gnap->playShowCurrItem(4, 7, 5, 0); gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 0); + _vm->_gnap->playScratchingHead(6, 0); gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS08LookDog; break; @@ -3088,7 +3088,7 @@ void Scene08::run() { _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithDog; _vm->_plat->_idleFacing = kDirNone; - _vm->playGnapIdle(3, 7); + _vm->_gnap->playIdle(3, 7); break; } } @@ -3096,25 +3096,25 @@ void Scene08::run() { case kHS08Meat: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 8, 5, 6); + _vm->_gnap->playShowCurrItem(6, 8, 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 7); + _vm->_gnap->playScratchingHead(6, 7); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->playGnapScratchingHead(6, 7); + _vm->_gnap->playScratchingHead(6, 7); } else { _vm->_gnap->actionIdle(0x14D); - _vm->playGnapPullOutDevice(6, 7); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(6, 7); + _vm->_gnap->playUseDevice(0, 0); _nextDogSequenceId = 0x149; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3122,25 +3122,25 @@ void Scene08::run() { case kHS08Bone: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(2, 7, 3, 6); + _vm->_gnap->playShowCurrItem(2, 7, 3, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 6); + _vm->_gnap->playScratchingHead(3, 6); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->playGnapScratchingHead(3, 6); + _vm->_gnap->playScratchingHead(3, 6); } else { _vm->_gnap->actionIdle(0x14D); - _vm->playGnapPullOutDevice(3, 6); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(3, 6); + _vm->_gnap->playUseDevice(0, 0); _nextDogSequenceId = 0x14A; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3148,25 +3148,25 @@ void Scene08::run() { case kHS08Toy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(8, 7, 7, 6); + _vm->_gnap->playShowCurrItem(8, 7, 7, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 6); + _vm->_gnap->playScratchingHead(7, 6); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->playGnapScratchingHead(7, 6); + _vm->_gnap->playScratchingHead(7, 6); } else { _vm->_gnap->actionIdle(0x14D); - _vm->playGnapPullOutDevice(7, 6); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(7, 6); + _vm->_gnap->playUseDevice(0, 0); _nextDogSequenceId = 0x14B; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3422,13 +3422,13 @@ void Scene09::run() { case kHS09Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -3456,11 +3456,11 @@ void Scene09::run() { case kHS09Trash: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(9, 6, 8, 0); + _vm->_gnap->playShowCurrItem(9, 6, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 3); + _vm->_gnap->playScratchingHead(8, 3); break; case GRAB_CURSOR: _vm->_gnap->_actionStatus = kAS09SearchTrash; @@ -3468,7 +3468,7 @@ void Scene09::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 8a6bff0fcf..18bb95553b 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -107,20 +107,20 @@ void Scene10::run() { switch (_vm->_sceneClickedHotspot) { case kHS10Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(10); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -149,16 +149,16 @@ void Scene10::run() { case kHS10Cook: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 8, 6, 0); + _vm->_gnap->playShowCurrItem(4, 8, 6, 0); gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 0); + _vm->_gnap->playScratchingHead(6, 0); break; case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); _vm->_gnap->_idleFacing = kDirBottomRight; break; case TALK_CURSOR: @@ -180,18 +180,18 @@ void Scene10::run() { case kHS10Tongs: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 7, 4, 0); + _vm->_gnap->playShowCurrItem(3, 7, 4, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); + _vm->_gnap->playMoan2(-1, -1); else - _vm->playGnapScratchingHead(4, 3); + _vm->_gnap->playScratchingHead(4, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); + _vm->_gnap->playMoan2(-1, -1); else { _vm->_gnap->actionIdle(0x10C); _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); @@ -199,11 +199,11 @@ void Scene10::run() { } break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); + _vm->_gnap->playMoan2(-1, -1); else { _vm->_gnap->actionIdle(0x10C); _vm->_gnap->useDeviceOnPlatypus(); @@ -218,11 +218,11 @@ void Scene10::run() { case kHS10Box: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 6, 6, 0); + _vm->_gnap->playShowCurrItem(7, 6, 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 3); + _vm->_gnap->playScratchingHead(7, 3); break; case GRAB_CURSOR: _vm->_gnap->actionIdle(0x10C); @@ -230,11 +230,11 @@ void Scene10::run() { _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->playGnapMoan2(-1, -1); + _vm->_gnap->playMoan2(-1, -1); else { _vm->invAdd(kItemTongs); _vm->setFlag(kGFMudTaken); @@ -244,7 +244,7 @@ void Scene10::run() { _vm->_plat->_actionStatus = kAS10PlatWithBox; _vm->_plat->_idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); - _vm->playGnapIdle(7, 6); + _vm->_gnap->playIdle(7, 6); } break; } @@ -253,7 +253,7 @@ void Scene10::run() { case kHS10Oven: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(9, 6, 10, 0); + _vm->_gnap->playShowCurrItem(9, 6, 10, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -272,7 +272,7 @@ void Scene10::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -591,17 +591,17 @@ void Scene11::run() { switch (_vm->_sceneClickedHotspot) { case kHS11Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -639,17 +639,17 @@ void Scene11::run() { if (_vm->_grabCursorSpriteIndex == kItemMagazine) { _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS11ShowMagazineToGoggleGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 7, 2, 0); + _vm->_gnap->playShowCurrItem(3, 7, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 6); + _vm->_gnap->playScratchingHead(1, 6); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -667,7 +667,7 @@ void Scene11::run() { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 9); _vm->_gnap->_actionStatus = kAS11ShowItemToHookGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 4, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 4, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -683,7 +683,7 @@ void Scene11::run() { _vm->_gnap->_actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -693,11 +693,11 @@ void Scene11::run() { case kHS11Billard: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(9, 8); + _vm->_gnap->playImpossible(9, 8); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 8); + _vm->_gnap->playScratchingHead(9, 8); break; case GRAB_CURSOR: _vm->_gnap->walkTo(Common::Point(9, 8), 0, 0x107BA, 1); @@ -705,7 +705,7 @@ void Scene11::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(9, 8); + _vm->_gnap->playImpossible(9, 8); break; } } @@ -1014,13 +1014,13 @@ void Scene12::run() { case kHS12Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -1042,22 +1042,22 @@ void Scene12::run() { _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12QuarterToToothGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12QuarterWithHoleToToothGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->_actionStatus = kAS12ShowItemToToothGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 2); + _vm->_gnap->playScratchingHead(1, 2); break; case GRAB_CURSOR: _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); @@ -1073,7 +1073,7 @@ void Scene12::run() { _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; _vm->_plat->_idleFacing = kDirUnk4; - _vm->playGnapIdle(2, 7); + _vm->_gnap->playIdle(2, 7); break; } } @@ -1084,12 +1084,12 @@ void Scene12::run() { _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12QuarterWithBarkeeper; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12ShowItemToBarkeeper; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1098,7 +1098,7 @@ void Scene12::run() { _vm->_gnap->_actionStatus = kAS12LookBarkeeper; break; case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -1106,7 +1106,7 @@ void Scene12::run() { _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: - _vm->playGnapPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS12PlatWithBarkeeper; break; @@ -1119,7 +1119,7 @@ void Scene12::run() { _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 9); _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS12ShowItemToBeardGuy; - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1143,7 +1143,7 @@ void Scene12::run() { _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; _vm->_plat->_idleFacing = kDirNone; - _vm->playGnapIdle(7, 6); + _vm->_gnap->playIdle(7, 6); break; } } @@ -1399,7 +1399,7 @@ void Scene12::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2) { if (_vm->_gnap->_actionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { _vm->_gnap->_actionStatus = -1; - _vm->playGnapIdle(7, 6); + _vm->_gnap->playIdle(7, 6); _vm->_timers[5] = 0; } if (_nextBarkeeperSequenceId != -1) { @@ -1523,13 +1523,13 @@ void Scene13::run() { case kHS13Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -1552,7 +1552,7 @@ void Scene13::run() { case kHS13BackToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(5, 5, 6, 0); + _vm->_gnap->playShowCurrItem(5, 5, 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1575,7 +1575,7 @@ void Scene13::run() { } break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1583,7 +1583,7 @@ void Scene13::run() { case kHS13FrontToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 7, 7, 0); + _vm->_gnap->playShowCurrItem(6, 7, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1600,7 +1600,7 @@ void Scene13::run() { case kHS13Scribble: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 7, 8, 0); + _vm->_gnap->playShowCurrItem(7, 7, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1609,14 +1609,14 @@ void Scene13::run() { _vm->_gnap->_idleFacing = kDirUpRight; break; case GRAB_CURSOR: - _vm->playGnapScratchingHead(0, 0); + _vm->_gnap->playScratchingHead(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->walkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0), 1); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1624,7 +1624,7 @@ void Scene13::run() { case kHS13Urinal: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(8, 7, 9, 0); + _vm->_gnap->playShowCurrItem(8, 7, 9, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1638,7 +1638,7 @@ void Scene13::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1646,7 +1646,7 @@ void Scene13::run() { case kHS13Sink: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1660,7 +1660,7 @@ void Scene13::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2540,19 +2540,19 @@ void Scene17::run() { _vm->invRemove(kItemJoint); } } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2562,17 +2562,17 @@ void Scene17::run() { case kHS17Wrench: if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - _vm->playGnapScratchingHead(8, 7); + _vm->_gnap->playScratchingHead(8, 7); break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: if (_canTryGetWrench) { @@ -2583,7 +2583,7 @@ void Scene17::run() { _vm->_gnap->_actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; } else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2596,11 +2596,11 @@ void Scene17::run() { _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 3); + _vm->_gnap->playScratchingHead(1, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2608,10 +2608,10 @@ void Scene17::run() { _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GetCoinFromPhone; } else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2624,7 +2624,7 @@ void Scene17::run() { _vm->_plat->_actionStatus = kAS17PlatUsePhone; _vm->_gnap->_actionStatus = kAS17PlatUsePhone; } else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2637,11 +2637,11 @@ void Scene17::run() { _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 3); + _vm->_gnap->playScratchingHead(1, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2652,10 +2652,10 @@ void Scene17::run() { _vm->_gnap->_actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2668,7 +2668,7 @@ void Scene17::run() { _vm->_plat->_actionStatus = kAS17PlatUsePhone; _vm->_gnap->_actionStatus = kAS17PlatUsePhone; } else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2828,8 +2828,8 @@ void Scene17::updateAnimations() { _vm->_gnap->_actionStatus = kAS17GetWrenchGnapReady; break; case kAS17GetCoinFromPhone: - _vm->playGnapPullOutDevice(1, 3); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(1, 3); + _vm->_gnap->playUseDevice(0, 0); gameSys.setAnimation(0x250, 100, 0); gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemDiceQuarterHole); @@ -3438,21 +3438,21 @@ void Scene18::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3469,18 +3469,18 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 2); + _vm->_gnap->playScratchingHead(3, 2); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3491,25 +3491,25 @@ void Scene18::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex >= 0) - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(true); if (_vm->_grabCursorSpriteIndex >= 0) { if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, _vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else if (!_vm->isFlag(kGFTruckFilledWithGas)) - _vm->playGnapScratchingHead(2, 4); + _vm->_gnap->playScratchingHead(2, 4); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) { @@ -3524,7 +3524,7 @@ void Scene18::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3539,13 +3539,13 @@ void Scene18::run() { if (_vm->_grabCursorSpriteIndex >= 0) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 0, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->playGnapScratchingHead(0, 0); + _vm->_gnap->playScratchingHead(0, 0); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { @@ -3557,14 +3557,14 @@ void Scene18::run() { } else { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } break; case TALK_CURSOR: case PLAT_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3573,11 +3573,11 @@ void Scene18::run() { _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 5); + _vm->_gnap->playScratchingHead(1, 5); break; case GRAB_CURSOR: if (_vm->isFlag(kGFBarnPadlockOpen)) { @@ -3586,11 +3586,11 @@ void Scene18::run() { _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS18CloseTopValve; } else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3602,9 +3602,9 @@ void Scene18::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex == -1) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } } else { if (_vm->isFlag(kGFPlatypusDisguised)) { @@ -3618,11 +3618,11 @@ void Scene18::run() { else _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCan; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 5); + _vm->_gnap->playScratchingHead(1, 5); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { @@ -3635,7 +3635,7 @@ void Scene18::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3650,7 +3650,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->isFlag(kGFPictureTaken)) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { _vm->_isLeavingScene = true; _vm->_newSceneNum = 19; @@ -3836,8 +3836,8 @@ void Scene18::updateAnimations() { case kAS18OpenTopValve: _vm->setFlag(kGFBarnPadlockOpen); updateHotspots(); - _vm->playGnapPullOutDevice(2, 7); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(2, 7); + _vm->_gnap->playUseDevice(0, 0); gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); @@ -3934,8 +3934,8 @@ void Scene18::updateAnimations() { case kAS18OpenRightValveWithGarbageCan: _vm->setFlag(kGFTruckFilledWithGas); updateHotspots(); - _vm->playGnapPullOutDevice(2, 7); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(2, 7); + _vm->_gnap->playUseDevice(0, 0); gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); @@ -4144,21 +4144,21 @@ void Scene19::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -4183,11 +4183,11 @@ void Scene19::run() { case kHS19Picture: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 2); + _vm->_gnap->playScratchingHead(6, 2); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { @@ -4197,7 +4197,7 @@ void Scene19::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -4207,11 +4207,11 @@ void Scene19::run() { case kHS19ShopAssistant: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 2); + _vm->_gnap->playScratchingHead(6, 2); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -4220,7 +4220,7 @@ void Scene19::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -4236,20 +4236,20 @@ void Scene19::run() { case kHS19Toy7: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + _vm->_gnap->playImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); _vm->_gnap->_actionStatus = kAS19GrabToy; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -4259,20 +4259,20 @@ void Scene19::run() { case kHS19Phone: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 1); + _vm->_gnap->playScratchingHead(9, 1); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - _vm->playGnapIdle(8, 2); + _vm->_gnap->playIdle(8, 2); _vm->_gnap->_actionStatus = kAS19UsePhone; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -4354,8 +4354,8 @@ void Scene19::updateAnimations() { } break; case kAS19GrabPicture: - _vm->playGnapPullOutDevice(6, 2); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(6, 2); + _vm->_gnap->playUseDevice(0, 0); gameSys.setAnimation(0x68, 19, 0); gameSys.insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemPicture); @@ -4415,7 +4415,7 @@ void Scene19::updateAnimations() { while (_vm->_timers[5]) { _vm->gameUpdateTick(); } - _vm->playGnapIdle(6, 2); + _vm->_gnap->playIdle(6, 2); _vm->_gnap->_actionStatus = -1; break; case 0x67: @@ -4426,7 +4426,7 @@ void Scene19::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case 0x65: - _vm->playGnapIdle(6, 2); + _vm->_gnap->playIdle(6, 2); gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 0); gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 582aa5bae1..6599a4b15a 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -68,8 +68,8 @@ void Scene20::updateAnimationsCb() { break; case 0x16A: // Grab joint - _vm->playGnapPullOutDevice(4, 4); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(4, 4); + _vm->_gnap->playUseDevice(0, 0); gameSys.setAnimation(0x16A, 21, 0); gameSys.insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16A; @@ -275,21 +275,21 @@ void Scene20::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(20); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -363,11 +363,11 @@ void Scene20::run() { case kHS20StonerGuy: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(5, 4); + _vm->_gnap->playMoan2(5, 4); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -375,7 +375,7 @@ void Scene20::run() { if (_stonerGuyShowingJoint) _vm->_gnap->_actionStatus = kAS20GrabJoint; else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -386,7 +386,7 @@ void Scene20::run() { _vm->_gnap->_actionStatus = kAS20TalkStonerGuyHasJoint; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -396,11 +396,11 @@ void Scene20::run() { case kHS20GroceryStoreGuy: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 3); + _vm->_gnap->playScratchingHead(2, 3); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; @@ -414,7 +414,7 @@ void Scene20::run() { _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -428,11 +428,11 @@ void Scene20::run() { _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(1, 6); + _vm->_gnap->playScratchingHead(1, 6); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; @@ -442,7 +442,7 @@ void Scene20::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -793,21 +793,21 @@ void Scene21::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -817,16 +817,16 @@ void Scene21::run() { case kHS21Banana: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 2, 5); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 5); + _vm->_gnap->playScratchingHead(2, 5); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); - _vm->playGnapPullOutDevice(2, 5); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(2, 5); + _vm->_gnap->playUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS21GrabBanana; break; case TALK_CURSOR: @@ -844,11 +844,11 @@ void Scene21::run() { _vm->_gnap->walkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 6, 7, 4); + _vm->_gnap->playShowCurrItem(4, 6, 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 4); + _vm->_gnap->playScratchingHead(7, 4); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -863,7 +863,7 @@ void Scene21::run() { _vm->_gnap->_actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1109,21 +1109,21 @@ void Scene22::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1153,14 +1153,14 @@ void Scene22::run() { case kHS22Cashier: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 4); + _vm->_gnap->playScratchingHead(8, 4); break; case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -1332,21 +1332,21 @@ void Scene23::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1356,12 +1356,12 @@ void Scene23::run() { case kHS23Cereals: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapMoan2(0, 0); + _vm->_gnap->playMoan2(0, 0); else { _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS23LookCereals; @@ -1369,7 +1369,7 @@ void Scene23::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); else { _vm->_gnap->_idleFacing = kDirBottomRight; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); @@ -1380,7 +1380,7 @@ void Scene23::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1599,21 +1599,21 @@ void Scene24::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1845,21 +1845,21 @@ void Scene25::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1871,15 +1871,15 @@ void Scene25::run() { if (_vm->_grabCursorSpriteIndex == kItemTickets) { _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, 9, 4) | 0x10000, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); _nextTicketVendorSequenceId = 0x5B; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 1); + _vm->_gnap->playScratchingHead(6, 1); _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; break; case TALK_CURSOR: @@ -1889,7 +1889,7 @@ void Scene25::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1931,7 +1931,7 @@ void Scene25::run() { case kHS25Posters4: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1942,13 +1942,13 @@ void Scene25::run() { _vm->_gnap->_idleFacing = kDirBottomRight; else _vm->_gnap->_idleFacing = kDirUpRight; - _vm->playGnapIdle(0, 0); + _vm->_gnap->playIdle(0, 0); playAnims(8 - _vm->_sceneClickedHotspot + 1); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapMoan2(0, 0); + _vm->_gnap->playMoan2(0, 0); break; } } @@ -2043,7 +2043,7 @@ void Scene25::updateAnimations() { _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->playGnapIdle(0, 0); + _vm->_gnap->playIdle(0, 0); _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicketDone; @@ -2161,21 +2161,21 @@ void Scene26::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2395,21 +2395,21 @@ void Scene27::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2423,11 +2423,11 @@ void Scene27::run() { if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) _vm->_gnap->_actionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 3); + _vm->_gnap->playScratchingHead(6, 3); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -2436,7 +2436,7 @@ void Scene27::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2446,11 +2446,11 @@ void Scene27::run() { case kHS27Bucket: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 3, 3); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 3, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(3, 3); + _vm->_gnap->playScratchingHead(3, 3); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -2459,7 +2459,7 @@ void Scene27::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2587,8 +2587,8 @@ void Scene27::updateAnimations() { } break; case kAS27GrabBucket: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; _vm->invAdd(kItemEmptyBucket); _vm->setFlag(kGFUnk13); @@ -2649,8 +2649,8 @@ void Scene27::updateAnimations() { break; case 0xD0: // Show picture to janitor - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _vm->_gnap->_actionStatus = kAS27EnterClownTent; @@ -2766,21 +2766,21 @@ void Scene28::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2790,11 +2790,11 @@ void Scene28::run() { case kHS28Horn: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(2, 8, 3, 4); + _vm->_gnap->playShowCurrItem(2, 8, 3, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 4); + _vm->_gnap->playScratchingHead(2, 4); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { @@ -2813,7 +2813,7 @@ void Scene28::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2824,27 +2824,27 @@ void Scene28::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->isFlag(kGFUnk21)) { if (_vm->_verbCursor == LOOK_CURSOR) - _vm->playGnapScratchingHead(5, 2); + _vm->_gnap->playScratchingHead(5, 2); else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS28UsePillBucketWithClown; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 2); + _vm->_gnap->playScratchingHead(5, 2); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -2853,7 +2853,7 @@ void Scene28::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2875,13 +2875,13 @@ void Scene28::run() { case kHS28EmptyBucket: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 8, 6); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 6); } else if (_vm->isFlag(kGFUnk21)) { - _vm->playGnapImpossible(8, 6); + _vm->_gnap->playImpossible(8, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 6); + _vm->_gnap->playScratchingHead(8, 6); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); @@ -2889,7 +2889,7 @@ void Scene28::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2960,8 +2960,8 @@ void Scene28::updateAnimations() { _nextClownSequenceId = 0x119; break; case kAS28GrabHornSuccess: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); gameSys.setAnimation(0x117, 59, 0); gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_actionStatus = kAS28GrabHornSuccessDone; @@ -2982,8 +2982,8 @@ void Scene28::updateAnimations() { _vm->_gnap->_actionStatus = -1; break; case kAS28GrabEmptyBucket: - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); gameSys.setAnimation(0x111, 99, 0); gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_actionStatus = kAS28GrabEmptyBucketDone; @@ -3157,21 +3157,21 @@ void Scene29::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3188,18 +3188,18 @@ void Scene29::run() { _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 6); + _vm->_gnap->playScratchingHead(5, 6); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); + _vm->_gnap->playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -3233,19 +3233,19 @@ void Scene29::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 52; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); + _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); _vm->_gnap->_actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan2(0, 0); + _vm->_gnap->playMoan2(0, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 99cd34be69..ecc1238003 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -90,21 +90,21 @@ void Scene30::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -120,7 +120,7 @@ void Scene30::run() { _vm->_gnap->_actionStatus = kAS30UsePillMachine; hasTakenPill = true; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -128,11 +128,11 @@ void Scene30::run() { _vm->_gnap->_actionStatus = kAS30LookPillMachine; break; case GRAB_CURSOR: - _vm->playGnapScratchingHead(8, 5); + _vm->_gnap->playScratchingHead(8, 5); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(8, 5); + _vm->_gnap->playImpossible(8, 5); break; } } @@ -345,21 +345,21 @@ void Scene31::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { _vm->_gnap->useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -370,15 +370,15 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { if (_vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { if (_vm->_verbCursor == LOOK_CURSOR) - _vm->playGnapScratchingHead(2, 2); + _vm->_gnap->playScratchingHead(2, 2); else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(2, 2); + _vm->_gnap->playScratchingHead(2, 2); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); @@ -389,7 +389,7 @@ void Scene31::run() { _vm->_timers[4] = 300; break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { @@ -402,7 +402,7 @@ void Scene31::run() { _vm->_gnap->_actionStatus = kAS31PlatMeasuringClown; _vm->_timers[4] = 300; } else - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -416,21 +416,21 @@ void Scene31::run() { _vm->_gnap->walkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->playGnapPullOutDevice(6, 8); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(6, 8); + _vm->_gnap->playUseDevice(0, 0); _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeer; _vm->_timers[4] = 300; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(6, 2); + _vm->_gnap->playScratchingHead(6, 2); break; case GRAB_CURSOR: if (_beerGuyDistracted) { - _vm->playGnapScratchingHead(6, 2); + _vm->_gnap->playScratchingHead(6, 2); } else { _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); _vm->_gnap->_actionStatus = kAS31UseBeerBarrel; @@ -439,7 +439,7 @@ void Scene31::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -552,8 +552,8 @@ void Scene31::updateAnimations() { break; case kAS31FillEmptyBucketWithBeerDone: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->playGnapPullOutDevice(0, 0); - _vm->playGnapUseDevice(0, 0); + _vm->_gnap->playPullOutDevice(0, 0); + _vm->_gnap->playUseDevice(0, 0); gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); _vm->_gnap->_actionStatus = -1; _vm->invAdd(kItemBucketWithBeer); @@ -694,21 +694,21 @@ void Scene32::run() { case kHS32Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -870,21 +870,21 @@ void Scene33::run() { case kHS33Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -894,7 +894,7 @@ void Scene33::run() { case kHS33Chicken: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 9, 9, 8); + _vm->_gnap->playShowCurrItem(7, 9, 9, 8); } else { switch (_vm->_verbCursor) { case GRAB_CURSOR: @@ -911,7 +911,7 @@ void Scene33::run() { break; case LOOK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1147,21 +1147,21 @@ void Scene38::run() { if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1205,15 +1205,15 @@ void Scene38::run() { case kHS38HuntingTrophy: if (_vm->_gnap->_actionStatus != kAS38HoldingHuntingTrophy) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 6, 2, 0); + _vm->_gnap->playShowCurrItem(3, 6, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(0, 0); + _vm->_gnap->playScratchingHead(0, 0); break; case GRAB_CURSOR: if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); else { _vm->_gnap->walkTo(Common::Point(3, 6), 0, 0x107BB, 1); _vm->_plat->walkTo(Common::Point(4, 8), -1, -1, 1); @@ -1221,10 +1221,10 @@ void Scene38::run() { } break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(2, 0); + _vm->_gnap->playBrainPulsating(2, 0); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1453,21 +1453,21 @@ void Scene39::run() { case kHS39Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1487,18 +1487,18 @@ void Scene39::run() { case kHS39Sign: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); - _vm->playGnapIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); + _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); _vm->showFullScreenSprite(0x1C); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 7d7be662dc..2a3458c039 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -76,21 +76,21 @@ void Scene40::run() { case kHS40Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -351,21 +351,21 @@ void Scene41::run() { case kHS41Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -399,16 +399,16 @@ void Scene41::run() { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->_gnap->_actionStatus = kAS41UseQuarterWithToyVendor; _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BB, 9); - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(4, 7, 5, 0); + _vm->_gnap->playShowCurrItem(4, 7, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(5, 0); + _vm->_gnap->playMoan1(5, 0); break; case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -416,7 +416,7 @@ void Scene41::run() { _vm->_gnap->_actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -428,11 +428,11 @@ void Scene41::run() { _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->_actionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(7, 7, 8, 0); + _vm->_gnap->playShowCurrItem(7, 7, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(9, 0); + _vm->_gnap->playScratchingHead(9, 0); break; case GRAB_CURSOR: _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); @@ -444,7 +444,7 @@ void Scene41::run() { _vm->_gnap->walkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -452,7 +452,7 @@ void Scene41::run() { case kHS41ToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { - _vm->playGnapPullOutDevice(9, 0); + _vm->_gnap->playPullOutDevice(9, 0); gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); _vm->_gnap->_actionStatus = kAS41UseGumWithToyUfo; } @@ -580,7 +580,7 @@ void Scene41::updateAnimations() { break; case kAS41UseGumWithToyUfo: gameSys.setAnimation(0, 0, 0); - _vm->playGnapUseDevice(9, 0); + _vm->_gnap->playUseDevice(9, 0); _vm->_gnap->_actionStatus = -1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemGum); @@ -863,21 +863,21 @@ void Scene42::run() { case kHS42Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -915,11 +915,11 @@ void Scene42::run() { if (_vm->_plat->_pos.y < 9) _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, 9), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); + _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -928,7 +928,7 @@ void Scene42::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -936,11 +936,11 @@ void Scene42::run() { case kHS42ChickenLeg: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); break; case GRAB_CURSOR: _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); @@ -948,7 +948,7 @@ void Scene42::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1321,21 +1321,21 @@ void Scene43::run() { case kHS43Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1368,11 +1368,11 @@ void Scene43::run() { case kHS43TwoHeadedGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(6, 8, 7, 0); + _vm->_gnap->playShowCurrItem(6, 8, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(7, 0); + _vm->_gnap->playScratchingHead(7, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -1381,7 +1381,7 @@ void Scene43::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1390,11 +1390,11 @@ void Scene43::run() { case kHS43Key: case kHS43Ufo: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(3, 7, 2, 0); + _vm->_gnap->playShowCurrItem(3, 7, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(0, 0); + _vm->_gnap->playScratchingHead(0, 0); break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -1403,7 +1403,7 @@ void Scene43::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1769,21 +1769,21 @@ void Scene44::run() { case kHS44Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1816,14 +1816,14 @@ void Scene44::run() { if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->_actionStatus = 2; _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(4, 3); + _vm->_gnap->playScratchingHead(4, 3); break; case GRAB_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -1835,7 +1835,7 @@ void Scene44::run() { _vm->_plat->walkTo(Common::Point(6, 7), 1, 0x107D2, 1); if (_vm->_gnap->_pos == Common::Point(7, 7)) _vm->_gnap->walkStep(); - _vm->playGnapIdle(5, 7); + _vm->_gnap->playIdle(5, 7); _vm->_plat->_actionStatus = 4; break; } @@ -1844,25 +1844,25 @@ void Scene44::run() { case kHS44Spring: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(8, 7); + _vm->_gnap->playScratchingHead(8, 7); break; case GRAB_CURSOR: - _vm->playGnapPullOutDevice(8, 0); - _vm->playGnapUseDevice(8, 0); + _vm->_gnap->playPullOutDevice(8, 0); + _vm->_gnap->playUseDevice(8, 0); _nextSpringGuySequenceId = 0xFB; _vm->invAdd(kItemSpring); _vm->setFlag(kGFSpringTaken); updateHotspots(); break; case TALK_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -1870,14 +1870,14 @@ void Scene44::run() { case kHS44SpringGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSpringTaken)) - _vm->playGnapMoan1(8, 7); + _vm->_gnap->playMoan1(8, 7); else - _vm->playGnapScratchingHead(8, 7); + _vm->_gnap->playScratchingHead(8, 7); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -1885,7 +1885,7 @@ void Scene44::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2258,11 +2258,11 @@ void Scene45::run() { case kHS45Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); @@ -2270,11 +2270,11 @@ void Scene45::run() { gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2325,16 +2325,16 @@ void Scene45::run() { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemSpring); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapScratchingHead(5, 0); + _vm->_gnap->playScratchingHead(5, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2583,21 +2583,21 @@ void Scene46::run() { case kHS46Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: _vm->_gnap->kissPlatypus(0); break; case TALK_CURSOR: - _vm->playGnapBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->playGnapImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2606,11 +2606,11 @@ void Scene46::run() { case kHS46SackGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); + _vm->_gnap->playMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; @@ -2619,7 +2619,7 @@ void Scene46::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } @@ -2627,11 +2627,11 @@ void Scene46::run() { case kHS46ItchyGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->playGnapShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); + _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->playGnapMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); + _vm->_gnap->playMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; @@ -2640,7 +2640,7 @@ void Scene46::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->playGnapImpossible(0, 0); + _vm->_gnap->playImpossible(0, 0); break; } } -- cgit v1.2.3 From 33ca09ae12a09df7d1367122eb8461f7b7a74572 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 May 2016 23:59:08 +0200 Subject: GNAP: Remove useless redirections, move two more functions --- engines/gnap/character.cpp | 56 ++++++++++++++++++++++++++++++++++++++---- engines/gnap/character.h | 2 ++ engines/gnap/gnap.cpp | 46 ---------------------------------- engines/gnap/gnap.h | 2 -- engines/gnap/scenes/group0.cpp | 12 ++++----- 5 files changed, 59 insertions(+), 59 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index ee8196138a..1ff76988f0 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -462,7 +462,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { void PlayerGnap::useJointOnPlatypus() { _vm->setGrabCursorSprite(-1); - if (_vm->gnapPlatypusAction(1, 0, 0x107C1, 0)) { + if (doPlatypusAction(1, 0, 0x107C1, 0)) { _actionStatus = 100; _vm->_gameSys->setAnimation(0, 0, 1); _vm->_gameSys->setAnimation(0x10876, _vm->_plat->_id, 0); @@ -478,7 +478,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_plat->_sequenceId = 0x876; _vm->_plat->_idleFacing = kDirNone; playSequence(0x107B5); - _vm->_gnap->walkStep(); + walkStep(); while (_vm->_gameSys->getAnimationStatus(0) != 2) { _vm->updateMouseCursor(); _vm->gameUpdateTick(); @@ -491,7 +491,7 @@ void PlayerGnap::useJointOnPlatypus() { } void PlayerGnap::kissPlatypus(int callback) { - if (_vm->gnapPlatypusAction(-1, 0, 0x107D1, callback)) { + if (doPlatypusAction(-1, 0, 0x107D1, callback)) { _actionStatus = 100; _vm->_gameSys->setAnimation(0, 0, 1); _vm->_gameSys->setAnimation(0x10847, _id, 0); @@ -1100,6 +1100,52 @@ void PlayerGnap::playShowCurrItem(int gridX, int gridY, int gridLookX, int gridL playShowItem(_vm->_grabCursorSpriteIndex, gridLookX, gridLookY); } +bool PlayerGnap::doPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) { + bool result = false; + + if (_actionStatus <= -1 && _vm->_plat->_actionStatus <= -1) { + _actionStatus = 100; + Common::Point checkPt = _vm->_plat->_pos + Common::Point(gridX, gridY); + if (_vm->isPointBlocked(checkPt) && (_pos != checkPt)) { + _vm->_plat->walkStep(); + checkPt = _vm->_plat->_pos + Common::Point(gridX, gridY); + } + + if (!_vm->isPointBlocked(checkPt) && (_pos != checkPt)) { + walkTo(checkPt, 0, 0x107B9, 1); + while (_vm->_gameSys->getAnimationStatus(0) != 2) { + _vm->updateMouseCursor(); + _vm->doCallback(callback); + _vm->gameUpdateTick(); + } + _vm->_gameSys->setAnimation(0, 0, 0); + if (_pos == _vm->_plat->_pos + Common::Point(gridX, gridY)) { + _vm->_gameSys->setAnimation(platSequenceId, _vm->_plat->_id, 1); + _vm->_plat->playSequence(platSequenceId); + while (_vm->_gameSys->getAnimationStatus(1) != 2) { + _vm->updateMouseCursor(); + _vm->doCallback(callback); + _vm->gameUpdateTick(); + } + result = true; + } + } + _actionStatus = -1; + } + return result; +} + +void PlayerGnap::useDisguiseOnPlatypus() { + _vm->_gameSys->setAnimation(0x10846, _id, 0); + playSequence(0x10846); + while (_vm->_gameSys->getAnimationStatus(0) != 2) + _vm->gameUpdateTick(); + _vm->_newSceneNum = 47; + _vm->_isLeavingScene = true; + _vm->_sceneDone = true; + _vm->setFlag(kGFPlatypusDisguised); +} + /************************************************************************************************/ PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} @@ -1156,7 +1202,7 @@ void PlayerPlat::updateIdleSequence() { } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; - _vm->_plat->makeRoom(); + makeRoom(); } } else { _vm->_timers[0] = 100; @@ -1184,7 +1230,7 @@ void PlayerPlat::updateIdleSequence2() { } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; - _vm->_plat->makeRoom(); + makeRoom(); } } else { _vm->_timers[0] = 100; diff --git a/engines/gnap/character.h b/engines/gnap/character.h index d04c59462c..c7f97b72b2 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -89,6 +89,7 @@ public: virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags); void actionIdle(int sequenceId); + bool doPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); int getShowSequenceId(int index, int gridX, int gridY); Facing getWalkFacing(int deltaX, int deltaY); int getWalkStopSequenceId(int deltaX, int deltaY); @@ -107,6 +108,7 @@ public: void playShowItem(int itemIndex, int gridLookX, int gridLookY); void playUseDevice(int gridX, int gridY); void useDeviceOnPlatypus(); + void useDisguiseOnPlatypus(); void useJointOnPlatypus(); int _brainPulseNum; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 3b6f84af37..518dda26d2 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -965,52 +965,6 @@ void GnapEngine::doCallback(int callback) { } } -bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) { - bool result = false; - - if (_gnap->_actionStatus <= -1 && _plat->_actionStatus <= -1) { - _gnap->_actionStatus = 100; - Common::Point checkPt = _plat->_pos + Common::Point(gridX, gridY); - if (isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) { - _plat->walkStep(); - checkPt = _plat->_pos + Common::Point(gridX, gridY); - } - - if (!isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) { - _gnap->walkTo(checkPt, 0, 0x107B9, 1); - while (_gameSys->getAnimationStatus(0) != 2) { - updateMouseCursor(); - doCallback(callback); - gameUpdateTick(); - } - _gameSys->setAnimation(0, 0, 0); - if (_gnap->_pos == _plat->_pos + Common::Point(gridX, gridY)) { - _gameSys->setAnimation(platSequenceId, _plat->_id, 1); - _plat->playSequence(platSequenceId); - while (_gameSys->getAnimationStatus(1) != 2) { - updateMouseCursor(); - doCallback(callback); - gameUpdateTick(); - } - result = true; - } - } - _gnap->_actionStatus = -1; - } - return result; -} - -void GnapEngine::gnapUseDisguiseOnPlatypus() { - _gameSys->setAnimation(0x10846, _gnap->_id, 0); - _gnap->playSequence(0x10846); - while (_gameSys->getAnimationStatus(0) != 2) - gameUpdateTick(); - _newSceneNum = 47; - _isLeavingScene = true; - _sceneDone = true; - setFlag(kGFPlatypusDisguised); -} - //////////////////////////////////////////////////////////////////////////////// void GnapEngine::initGlobalSceneVars() { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 8446454ba5..0bda4b4706 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -476,8 +476,6 @@ public: // Gnap void doCallback(int callback); - bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback); - void gnapUseDisguiseOnPlatypus(); // Scenes int _toyUfoNextSequenceId, _toyUfoSequenceId; diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 780c4d2616..b693d3bda8 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -124,7 +124,7 @@ void Scene01::run() { case kHS01Platypus: if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); + _vm->_gnap->useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playImpossible(0, 0); } else { @@ -474,7 +474,7 @@ void Scene02::run() { case kHS02Platypus: if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); + _vm->_gnap->useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playImpossible(0, 0); } else { @@ -939,7 +939,7 @@ void Scene03::run() { case kHS03Platypus: if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); + _vm->_gnap->useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playImpossible(0, 0); } else { @@ -1443,7 +1443,7 @@ void Scene04::run() { case kHS04Platypus: if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); + _vm->_gnap->useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playImpossible(0, 0); } else { @@ -1918,7 +1918,7 @@ void Scene05::run() { case kHS05Platypus: if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); + _vm->_gnap->useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playImpossible(0, 0); } else { @@ -2342,7 +2342,7 @@ void Scene06::run() { case kHS06Platypus: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->gnapUseDisguiseOnPlatypus(); + _vm->_gnap->useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playImpossible(0, 0); } else { -- cgit v1.2.3 From 81c5f8651d7b78986a5487c0b6b67a3ea1bea19c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 00:36:43 +0200 Subject: GNAP: USe Common::Point for getSequenceId --- engines/gnap/character.cpp | 112 ++++++++++++++++++++--------------------- engines/gnap/character.h | 6 +-- engines/gnap/scenes/group0.cpp | 62 +++++++++++------------ engines/gnap/scenes/group1.cpp | 42 ++++++++-------- engines/gnap/scenes/group2.cpp | 46 ++++++++--------- engines/gnap/scenes/group3.cpp | 6 +-- engines/gnap/scenes/group4.cpp | 16 +++--- 7 files changed, 145 insertions(+), 145 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 1ff76988f0..aa920fa0f8 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -112,14 +112,14 @@ PlayerGnap::PlayerGnap(GnapEngine * vm) : Character(vm) { _brainPulseRndValue = 0; } -int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { +int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { int sequenceId = 0; switch (kind) { case gskPullOutDevice: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x83F; _idleFacing = kDirUpLeft; } else { @@ -127,7 +127,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirUpRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x83B; _idleFacing = kDirBottomLeft; } else { @@ -154,9 +154,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { break; case gskPullOutDeviceNonWorking: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x829; _idleFacing = kDirUpLeft; } else { @@ -164,7 +164,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirUpRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x827; _idleFacing = kDirBottomLeft; } else { @@ -191,9 +191,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { break; case gskScratchingHead: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x834; _idleFacing = kDirBottomLeft; } else { @@ -201,7 +201,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirUpRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x834; _idleFacing = kDirBottomLeft; } else { @@ -232,9 +232,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { break; case gskIdle: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x7BC; _idleFacing = kDirUpLeft; } else { @@ -242,7 +242,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirUpRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x7BA; _idleFacing = kDirBottomLeft; } else { @@ -270,9 +270,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { case gskBrainPulsating: _brainPulseNum = (_brainPulseNum + 1) & 1; - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = _brainPulseRndValue + _brainPulseNum + 0x812; _idleFacing = kDirUpLeft; } else { @@ -280,7 +280,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirUpRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = _brainPulseRndValue + _brainPulseNum + 0x7D6; _idleFacing = kDirBottomLeft; } else { @@ -307,9 +307,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { break; case gskImpossible: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x831; _idleFacing = kDirBottomLeft; } else { @@ -317,7 +317,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirBottomRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x831; _idleFacing = kDirBottomLeft; } else { @@ -341,9 +341,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { break; case gskDeflect: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x830; _idleFacing = kDirUpLeft; } else { @@ -351,7 +351,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirUpRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x82E; _idleFacing = kDirBottomLeft; } else { @@ -401,9 +401,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { break; case gskMoan1: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x832; _idleFacing = kDirBottomLeft; } else { @@ -411,7 +411,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirBottomRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x832; _idleFacing = kDirBottomLeft; } else { @@ -429,9 +429,9 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { break; case gskMoan2: - if (gridX > 0 && gridY > 0) { - if (_pos.y > gridY) { - if (_pos.x > gridX) { + if (gridPos.x > 0 && gridPos.y > 0) { + if (_pos.y > gridPos.y) { + if (_pos.x > gridPos.x) { sequenceId = 0x832; _idleFacing = kDirBottomLeft; } else { @@ -439,7 +439,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) { _idleFacing = kDirBottomRight; } } else { - if (_pos.x > gridX) { + if (_pos.x > gridPos.x) { sequenceId = 0x832; _idleFacing = kDirBottomLeft; } else { @@ -486,7 +486,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos) | 0x10000); } } @@ -515,12 +515,12 @@ void PlayerGnap::kissPlatypus(int callback) { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos.x, _vm->_plat->_pos.y) | 0x10000); + playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos) | 0x10000); } } void PlayerGnap::useDeviceOnPlatypus() { - playSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos.x, _vm->_plat->_pos.y))); + playSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos))); if (_vm->_plat->_idleFacing != kDirNone) { _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), _vm->_plat->_id, @@ -536,7 +536,7 @@ void PlayerGnap::useDeviceOnPlatypus() { _vm->_plat->_sequenceDatNum = 1; } - int newSequenceId = getSequenceId(gskUseDevice, 0, 0); + int newSequenceId = getSequenceId(gskUseDevice, Common::Point(0, 0)); _vm->_gameSys->insertSequence(makeRid(1, newSequenceId), _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); @@ -1020,7 +1020,7 @@ int PlayerGnap::getShowSequenceId(int index, int gridX, int gridY) { //Skip 29 default: _idleFacing = facing; - sequenceId = getSequenceId(gskImpossible, 0, 0); + sequenceId = getSequenceId(gskImpossible, Common::Point(0, 0)); break; } @@ -1035,58 +1035,58 @@ void PlayerGnap::idle() { _sequenceId == 0x833 || _sequenceId == 0x834 || _sequenceId == 0x885 || _sequenceId == 0x7A8 || _sequenceId == 0x831 || _sequenceId == 0x89A)) { - _vm->_gameSys->insertSequence(getSequenceId(gskIdle, 0, 0) | 0x10000, _id, + _vm->_gameSys->insertSequence(getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); - _sequenceId = getSequenceId(gskIdle, 0, 0); + _sequenceId = getSequenceId(gskIdle, Common::Point(0, 0)); _sequenceDatNum = 1; } } void PlayerGnap::actionIdle(int sequenceId) { if (_sequenceId != -1 && ridToDatIndex(sequenceId) == _sequenceDatNum && ridToEntryIndex(sequenceId) == _sequenceId) { - _vm->_gameSys->insertSequence(getSequenceId(gskIdle, 0, 0) | 0x10000, _id, + _vm->_gameSys->insertSequence(getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); - _sequenceId = getSequenceId(gskIdle, 0, 0); + _sequenceId = getSequenceId(gskIdle, Common::Point(0, 0)); _sequenceDatNum = 1; } } void PlayerGnap::playImpossible(int gridX, int gridY) { - playSequence(getSequenceId(gskImpossible, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskImpossible, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playScratchingHead(int gridX, int gridY) { - playSequence(getSequenceId(gskScratchingHead, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskScratchingHead, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playMoan1(int gridX, int gridY) { - playSequence(getSequenceId(gskMoan1, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskMoan1, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playMoan2(int gridX, int gridY) { - playSequence(getSequenceId(gskMoan2, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskMoan2, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playBrainPulsating(int gridX, int gridY) { - playSequence(getSequenceId(gskBrainPulsating, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskBrainPulsating, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playPullOutDevice(int gridX, int gridY) { - playSequence(getSequenceId(gskPullOutDevice, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskPullOutDevice, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playPullOutDeviceNonWorking(int gridX, int gridY) { - playSequence(getSequenceId(gskPullOutDeviceNonWorking, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskPullOutDeviceNonWorking, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playUseDevice(int gridX, int gridY) { - playSequence(getSequenceId(gskUseDevice, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskUseDevice, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playIdle(int gridX, int gridY) { - playSequence(getSequenceId(gskIdle, gridX, gridY) | 0x10000); + playSequence(getSequenceId(gskIdle, Common::Point(gridX, gridY)) | 0x10000); } void PlayerGnap::playShowItem(int itemIndex, int gridLookX, int gridLookY) { @@ -1150,7 +1150,7 @@ void PlayerGnap::useDisguiseOnPlatypus() { PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {} -int PlayerPlat::getSequenceId(int kind, int gridX, int gridY) { +int PlayerPlat::getSequenceId(int kind, Common::Point gridPos) { // The original had 3 parameters, all always set to 0. // The code to handle the other values has been removed. diff --git a/engines/gnap/character.h b/engines/gnap/character.h index c7f97b72b2..f1fc0ec3db 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -52,7 +52,7 @@ public: void walkStep(); - virtual int getSequenceId(int kind, int gridX, int gridY) = 0; + virtual int getSequenceId(int kind, Common::Point gridPos) = 0; virtual void playSequence(int sequenceId) = 0; virtual void updateIdleSequence() = 0; virtual void updateIdleSequence2() = 0; @@ -80,7 +80,7 @@ protected: class PlayerGnap : public Character { public: PlayerGnap(GnapEngine *vm); - virtual int getSequenceId(int kind, int gridX, int gridY); + virtual int getSequenceId(int kind, Common::Point gridPos); virtual void initPos(int gridX, int gridY, Facing facing); virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); @@ -124,7 +124,7 @@ private: class PlayerPlat : public Character { public: PlayerPlat(GnapEngine *vm); - virtual int getSequenceId(int kind = 0, int gridX = 0, int gridY = 0); + virtual int getSequenceId(int kind = 0, Common::Point gridPos = Common::Point(0, 0)); virtual void initPos(int gridX, int gridY, Facing facing); virtual void playSequence(int sequenceId); virtual void updateIdleSequence(); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index b693d3bda8..982cfcaff0 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -158,7 +158,7 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: @@ -181,7 +181,7 @@ void Scene01::run() { _vm->_gnap->playScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 3) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 3)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01TakeMud; break; case TALK_CURSOR: @@ -201,17 +201,17 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 7, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01UsePigs; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 7, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(7, 2)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: @@ -505,7 +505,7 @@ void Scene02::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; Common::Point destPos = Common::Point(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1); - _vm->_gnap->walkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); @@ -516,14 +516,14 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02GrabChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: @@ -538,7 +538,7 @@ void Scene02::run() { case kHS02Truck2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) @@ -548,7 +548,7 @@ void Scene02::run() { } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -560,7 +560,7 @@ void Scene02::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) { + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) _vm->_gnap->_actionStatus = kAS02UseTruckGas; else @@ -568,7 +568,7 @@ void Scene02::run() { } } else { _vm->_gnap->_idleFacing = kDirUnk4; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 2, 2) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS02UseTruckNoKeys; } break; @@ -592,7 +592,7 @@ void Scene02::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: @@ -1020,7 +1020,7 @@ void Scene03::run() { case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3].x + 1, _vm->_hotspotsWalkPos[3].y + 1) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3] + Common::Point(1, 1)) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1050,7 +1050,7 @@ void Scene03::run() { _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107B5, 1); _vm->_gnap->_actionStatus = kAS03FreePlatypus; } else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; else @@ -1062,7 +1062,7 @@ void Scene03::run() { _vm->_gnap->playBrainPulsating(8, 4); } else { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) _vm->_gnap->_actionStatus = kAS03HypnotizeScaredPlat; else @@ -1507,7 +1507,7 @@ void Scene04::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); @@ -1535,7 +1535,7 @@ void Scene04::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS04GrabDog; break; case TALK_CURSOR: @@ -1607,7 +1607,7 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, _vm->_gnap->getSequenceId(gskIdle, 10, 2) | 0x10000, 1)) { + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(10, 2)) | 0x10000, 1)) { if (_triedWindow) { _vm->_gnap->_actionStatus = kAS04GetKeyAnother; } else { @@ -1981,7 +1981,7 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { _vm->_gnap->_idleFacing = kDirUpRight; Common::Point checkPt = _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1); - _vm->_gnap->walkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); @@ -1992,12 +1992,12 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: @@ -2019,7 +2019,7 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: @@ -2044,7 +2044,7 @@ void Scene05::run() { } else if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, - _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1)) + _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); @@ -2055,7 +2055,7 @@ void Scene05::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: @@ -2449,11 +2449,11 @@ void Scene06::run() { break; case TALK_CURSOR: if (_horseTurnedBack) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 3, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(3, 2)) | 0x10000, 1); } else { _vm->_gnap->_idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; _vm->_gnap->_actionStatus = kAS06TalkToHorse; } @@ -2759,10 +2759,10 @@ void Scene07::run() { _vm->_gnap->playPullOutDevice(3, 3); gameSys.setAnimation(0x8E, 1, 2); gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(_vm->_gnap->getSequenceId(gskUseDevice, 0, 0) | 0x10000, _vm->_gnap->_id, + gameSys.insertSequence(_vm->_gnap->getSequenceId(gskUseDevice, Common::Point(0, 0)) | 0x10000, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = _vm->_gnap->getSequenceId(gskUseDevice, 0, 0); + _vm->_gnap->_sequenceId = _vm->_gnap->getSequenceId(gskUseDevice, Common::Point(0, 0)); _vm->_gnap->_sequenceDatNum = 1; break; case TALK_CURSOR: @@ -3043,7 +3043,7 @@ void Scene08::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: @@ -3078,7 +3078,7 @@ void Scene08::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 18bb95553b..0122a08109 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -164,7 +164,7 @@ void Scene10::run() { case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: @@ -257,7 +257,7 @@ void Scene10::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 10, 5) | 0x10000); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(10, 5)) | 0x10000); break; case GRAB_CURSOR: _vm->_gnap->actionIdle(0x10C); @@ -653,7 +653,7 @@ void Scene11::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkGoggleGuy; break; } @@ -671,7 +671,7 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 3, 6) | 0x10000); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(3, 6)) | 0x10000); break; case GRAB_CURSOR: _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 1); @@ -679,7 +679,7 @@ void Scene11::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->walkTo(Common::Point(5, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(5, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: @@ -1065,7 +1065,7 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: @@ -1102,7 +1102,7 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(6, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(6, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: @@ -1135,7 +1135,7 @@ void Scene12::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: @@ -1613,7 +1613,7 @@ void Scene13::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0), 1); + _vm->_gnap->walkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)), 1); break; case PLAT_CURSOR: _vm->_gnap->playImpossible(0, 0); @@ -1628,7 +1628,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 9, 6)); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(9, 6))); _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; @@ -1650,7 +1650,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, 5, 9)); + _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(5, 9))); _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); _vm->_gnap->_actionStatus = kAS13Wait; break; @@ -2593,7 +2593,7 @@ void Scene17::run() { case kHS17Phone1: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2605,7 +2605,7 @@ void Scene17::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GetCoinFromPhone; } else _vm->_gnap->playImpossible(0, 0); @@ -2634,7 +2634,7 @@ void Scene17::run() { case kHS17Phone2: if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); @@ -2648,7 +2648,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else @@ -3476,7 +3476,7 @@ void Scene18::run() { _vm->_gnap->playScratchingHead(3, 2); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, 3, 2) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -3515,7 +3515,7 @@ void Scene18::run() { if (!_vm->isFlag(kGFTruckKeysUsed)) { _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), -1, -1, 1); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_s18GarbageCanPos, _vm->_gnap->_pos.y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(_vm->_s18GarbageCanPos, _vm->_gnap->_pos.y)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) @@ -3570,7 +3570,7 @@ void Scene18::run() { } } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); @@ -3612,7 +3612,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, 2, 8) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCan; else @@ -4191,7 +4191,7 @@ void Scene19::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS19GrabPicture; } break; @@ -4215,7 +4215,7 @@ void Scene19::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 6599a4b15a..8c49bf606b 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -371,7 +371,7 @@ void Scene20::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_stonerGuyShowingJoint) _vm->_gnap->_actionStatus = kAS20GrabJoint; else @@ -379,7 +379,7 @@ void Scene20::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) _vm->_gnap->_actionStatus = kAS20TalkStonerGuyNoJoint; else @@ -405,12 +405,12 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: @@ -425,7 +425,7 @@ void Scene20::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); @@ -437,7 +437,7 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: @@ -625,7 +625,7 @@ void Scene20::updateAnimations() { _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(Common::Point(3, 8), -1, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(3, 8), -1, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = -1; break; case kAS20GrabJointDone: @@ -824,7 +824,7 @@ void Scene21::run() { _vm->_gnap->playScratchingHead(2, 5); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana].x, _vm->_hotspotsWalkPos[kHS21Banana].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); _vm->_gnap->playPullOutDevice(2, 5); _vm->_gnap->playUseDevice(0, 0); _vm->_gnap->_actionStatus = kAS21GrabBanana; @@ -841,7 +841,7 @@ void Scene21::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; - _vm->_gnap->walkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->_gnap->playShowCurrItem(4, 6, 7, 4); @@ -853,13 +853,13 @@ void Scene21::run() { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: @@ -1164,7 +1164,7 @@ void Scene22::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: @@ -1363,7 +1363,7 @@ void Scene23::run() { if (_vm->isFlag(kGFSceneFlag1)) _vm->_gnap->playMoan2(0, 0); else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS23LookCereals; } break; @@ -1372,7 +1372,7 @@ void Scene23::run() { _vm->_gnap->playImpossible(0, 0); else { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); _vm->_gnap->_actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); @@ -1635,7 +1635,7 @@ void Scene24::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS24LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } @@ -1870,7 +1870,7 @@ void Scene25::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, 9, 4) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); _vm->_gnap->playPullOutDevice(0, 0); _vm->_gnap->playUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1884,7 +1884,7 @@ void Scene25::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: @@ -2431,7 +2431,7 @@ void Scene27::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: @@ -2454,7 +2454,7 @@ void Scene27::run() { break; case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket].x, _vm->_hotspotsWalkPos[kHS27Bucket].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket]) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS27GrabBucket; break; case TALK_CURSOR: @@ -2799,7 +2799,7 @@ void Scene28::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn].x, _vm->_hotspotsWalkPos[kHS28Horn].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn]) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28GrabHornSuccess; } } else { @@ -2848,7 +2848,7 @@ void Scene28::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: @@ -2884,7 +2884,7 @@ void Scene28::run() { _vm->_gnap->playScratchingHead(8, 6); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket].x, _vm->_hotspotsWalkPos[kHS28EmptyBucket].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: @@ -3182,7 +3182,7 @@ void Scene29::run() { if (_vm->_gnap->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index ecc1238003..871177b3d3 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -413,7 +413,7 @@ void Scene31::run() { if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); - _vm->_gnap->walkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->_gnap->playPullOutDevice(6, 8); @@ -899,14 +899,14 @@ void Scene33::run() { switch (_vm->_verbCursor) { case GRAB_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskIdle, 0, 0) | 0x10000, 1)) + if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) _vm->_gnap->_actionStatus = kAS33UseChicken; else _vm->_gnap->_actionStatus = -1; break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 2a3458c039..44a99f9f90 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -412,7 +412,7 @@ void Scene41::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: @@ -441,7 +441,7 @@ void Scene41::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case PLAT_CURSOR: _vm->_gnap->playImpossible(0, 0); @@ -923,7 +923,7 @@ void Scene42::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: @@ -1376,7 +1376,7 @@ void Scene43::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -1827,7 +1827,7 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case PLAT_CURSOR: @@ -1881,7 +1881,7 @@ void Scene44::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -2614,7 +2614,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = 2; break; case GRAB_CURSOR: @@ -2635,7 +2635,7 @@ void Scene46::run() { break; case TALK_CURSOR: _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, 0, 0) | 0x10000, 1); + _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_gnap->_actionStatus = 1; break; case GRAB_CURSOR: -- cgit v1.2.3 From 1f7eeb24a0622a44a4b4582b51950fae4a80fcb7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 01:19:40 +0200 Subject: GNAP: Simplify some checks --- engines/gnap/character.cpp | 49 ++++++++++++++++++-------------------- engines/gnap/scenes/group1.cpp | 53 ++++++++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 49 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index aa920fa0f8..114c2f4adf 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -676,7 +676,6 @@ int PlayerGnap::getWalkSequenceId(int deltaX, int deltaY) { bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { int datNum = flags & 3; - bool done = false; _vm->_timers[2] = 200; _vm->_timers[3] = 300; @@ -695,17 +694,16 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI if (animationIndex >= 0 && _walkDestX == _vm->_plat->_pos.x && _walkDestY == _vm->_plat->_pos.y) _vm->_plat->makeRoom(); - if (findPath1(_pos.x, _pos.y, 0)) - done = true; + bool done = findPath1(_pos.x, _pos.y, 0); - if (!done && findPath2(_pos.x, _pos.y, 0)) - done = true; + if (!done) + done = findPath2(_pos.x, _pos.y, 0); - if (!done && findPath3(_pos.x, _pos.y)) - done = true; + if (!done) + done = findPath3(_pos.x, _pos.y); - if (!done && findPath4(_pos.x, _pos.y)) - done = true; + if (!done) + done = findPath4(_pos.x, _pos.y); idle(); @@ -812,15 +810,14 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI break; } } else { - //TODO: simplify the checks by using v10 and v11 - int v10 = _vm->_leftClickMouseX - (_vm->_gridMinX + 75 * _pos.x); - int v11 = _vm->_leftClickMouseY - (_vm->_gridMinY + 48 * _pos.y); - if (_vm->_leftClickMouseX == _vm->_gridMinX + 75 * _pos.x) - ++v10; - if (_vm->_leftClickMouseY == _vm->_gridMinY + 48 * _pos.y) - v11 = 1; - _sequenceId = getWalkStopSequenceId(v10 / abs(v10), v11 / abs(v11)); - _idleFacing = getWalkFacing(v10 / abs(v10), v11 / abs(v11)); + int dirX = _vm->_leftClickMouseX - (_vm->_gridMinX + 75 * _pos.x); + int dirY = _vm->_leftClickMouseY - (_vm->_gridMinY + 48 * _pos.y); + if (dirX == 0) + dirX = 1; + if (dirY == 0) + dirY = 1; + _sequenceId = getWalkStopSequenceId(dirX / abs(dirX), dirY / abs(dirY)); + _idleFacing = getWalkFacing(dirX / abs(dirX), dirY / abs(dirY)); } _sequenceDatNum = datNum; } @@ -1271,7 +1268,6 @@ int PlayerPlat::getWalkSequenceId(int deltaX, int deltaY) { bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { int datNum = flags & 3; - bool done = false; _vm->_timers[1] = 60; @@ -1289,17 +1285,16 @@ bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceI if (animationIndex >= 0 && _vm->_gnap->_pos == Common::Point(_walkDestX, _walkDestY)) _vm->_gnap->walkStep(); - if (findPath1(_pos.x, _pos.y, 0)) - done = true; + bool done = findPath1(_pos.x, _pos.y, 0); - if (!done && findPath2(_pos.x, _pos.y, 0)) - done = true; + if (!done) + done = findPath2(_pos.x, _pos.y, 0); - if (!done && findPath3(_pos.x, _pos.y)) - done = true; + if (!done) + done = findPath3(_pos.x, _pos.y); - if (!done && findPath4(_pos.x, _pos.y)) - done = true; + if (!done) + done = findPath4(_pos.x, _pos.y); int platSequenceId = _sequenceId; int platId = _id; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 0122a08109..aa55e1dcf5 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -410,20 +410,25 @@ void Scene10::updateAnimations() { } switch (_currCookSequenceId) { - case 0x106: { - // TODO: Refactor into a if + a switch - int rnd = _vm->getRandom(7); + case 0x106: if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; - else if (rnd == 0) - _nextCookSequenceId = 0x104; - else if (rnd == 1) - _nextCookSequenceId = 0x103; - else if (rnd == 2) { - _nextCookSequenceId = 0x106; - gameSys.insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); - } else - _nextCookSequenceId = 0x106; + else { + int rnd = _vm->getRandom(7); + switch (rnd) { + case 0: + _nextCookSequenceId = 0x104; + break; + case 1: + _nextCookSequenceId = 0x103; + break; + case 2: + _nextCookSequenceId = 0x106; + gameSys.insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0); + break; + default: + _nextCookSequenceId = 0x106; + } } break; case 0x103: @@ -442,17 +447,22 @@ void Scene10::updateAnimations() { else _nextCookSequenceId = 0x106; break; - case 0x105: { - // TODO: Refactor into a if + a switch - int rnd = _vm->getRandom(7); + case 0x105: if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; - else if (rnd == 0) - _nextCookSequenceId = 0x104; - else if (rnd == 1) - _nextCookSequenceId = 0x103; - else - _nextCookSequenceId = 0x106; + else { + int rnd = _vm->getRandom(7); + switch (rnd) { + case 0: + _nextCookSequenceId = 0x104; + break; + case 1: + _nextCookSequenceId = 0x103; + break; + default: + _nextCookSequenceId = 0x106; + } + } _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = 300; gameSys.insertSequence(0x10C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); @@ -461,7 +471,6 @@ void Scene10::updateAnimations() { _vm->_gnap->_sequenceDatNum = 0; _vm->_gnap->_actionStatus = -1; _vm->_plat->_actionStatus = -1; - } break; } if (_currCookSequenceId == 0x843) -- cgit v1.2.3 From fdabbcc16ab90b47a14eda8c168ab206a92780f1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 10:14:46 +0200 Subject: GNAP: Reduce dereferencing of _gnap --- engines/gnap/character.cpp | 9 +- engines/gnap/scenes/group0.cpp | 1356 +++++++++++++++++++------------------ engines/gnap/scenes/group1.cpp | 1455 ++++++++++++++++++++-------------------- engines/gnap/scenes/group2.cpp | 1063 +++++++++++++++-------------- engines/gnap/scenes/group3.cpp | 603 +++++++++-------- engines/gnap/scenes/group4.cpp | 727 ++++++++++---------- engines/gnap/scenes/group5.cpp | 50 +- 7 files changed, 2683 insertions(+), 2580 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 114c2f4adf..3d74d1e300 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -1208,7 +1208,9 @@ void PlayerPlat::updateIdleSequence() { } void PlayerPlat::updateIdleSequence2() { - if (_actionStatus < 0 && _vm->_gnap->_actionStatus < 0) { + PlayerGnap& gnap = *_vm->_gnap; + + if (_actionStatus < 0 && gnap._actionStatus < 0) { if (_vm->_timers[0]) { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; @@ -1268,6 +1270,7 @@ int PlayerPlat::getWalkSequenceId(int deltaX, int deltaY) { bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { int datNum = flags & 3; + PlayerGnap& gnap = *_vm->_gnap; _vm->_timers[1] = 60; @@ -1282,8 +1285,8 @@ bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceI _walkDestX = CLIP(gridX, 0, _vm->_gridMaxX - 1); _walkDestY = CLIP(gridY, 0, _vm->_gridMaxY - 1); - if (animationIndex >= 0 && _vm->_gnap->_pos == Common::Point(_walkDestX, _walkDestY)) - _vm->_gnap->walkStep(); + if (animationIndex >= 0 && gnap._pos == Common::Point(_walkDestX, _walkDestY)) + gnap.walkStep(); bool done = findPath1(_pos.x, _pos.y, 0); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 982cfcaff0..f5e8307def 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -72,6 +72,7 @@ void Scene01::run() { // NOTE Removed _s01_dword_474380 which was set when the mud was taken // which is also set in the global game flags. GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); @@ -90,15 +91,15 @@ void Scene01::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 2) { - _vm->_gnap->initPos(11, 6, kDirBottomLeft); + gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 6), -1, 0x107B9, 1); } else { - _vm->_gnap->initPos(1, 6, kDirBottomRight); + gnap.initPos(1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); @@ -115,35 +116,35 @@ void Scene01::run() { switch (_vm->_sceneClickedHotspot) { case kHS01Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS01Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -151,20 +152,20 @@ void Scene01::run() { break; case kHS01Spaceship: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS01LookSpaceship; + gnap._idleFacing = kDirUpLeft; + if (gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -172,21 +173,21 @@ void Scene01::run() { break; case kHS01Mud: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 3); + gnap.playScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 3)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01TakeMud; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 3)) | 0x10000, 1); + gnap._actionStatus = kAS01TakeMud; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -194,28 +195,28 @@ void Scene01::run() { break; case kHS01Pigs: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01LookPigs; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); + gnap._actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01UsePigs; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); + gnap._actionStatus = kAS01UsePigs; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(7, 2)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS01LookPigs; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(7, 2)) | 0x10000, 1); + gnap._actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -223,10 +224,10 @@ void Scene01::run() { break; case kHS01ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS01LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); + gnap._actionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 2; @@ -241,13 +242,13 @@ void Scene01::run() { case kHS01WalkArea6: case kHS01WalkArea7: case kHS01WalkArea8: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -262,8 +263,8 @@ void Scene01::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (_vm->_timers[4] == 0) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -288,23 +289,24 @@ void Scene01::run() { void Scene01::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS01LookSpaceship: _spaceshipSurface = gameSys.createSurface(47); gameSys.insertSpriteDrawItem(_spaceshipSurface, 0, 0, 255); gameSys.setAnimation(133, 256, 0); gameSys.insertSequence(133, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS01LookSpaceshipDone; + gnap._actionStatus = kAS01LookSpaceshipDone; break; case kAS01LookSpaceshipDone: gameSys.removeSequence(133, 256, true); gameSys.removeSpriteDrawItem(_spaceshipSurface, 255); _vm->deleteSurface(&_spaceshipSurface); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS01LeaveScene: @@ -312,25 +314,25 @@ void Scene01::updateAnimations() { break; case kAS01TakeMud: - _vm->_gnap->playPullOutDevice(2, 3); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(2, 3); + gnap.playUseDevice(0, 0); gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(128, 40, 3); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS01LookPigs: _vm->playSound(0x8A, false); _vm->playSound(0x8B, false); _vm->playSound(0x8C, false); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS01UsePigs: - _vm->_gnap->playPullOutDevice(7, 2); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(7, 2); + gnap.playUseDevice(0, 0); gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -396,6 +398,7 @@ void Scene02::updateHotspots() { void Scene02::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); @@ -412,20 +415,20 @@ void Scene02::run() { switch (_vm->_prevSceneNum) { case 3: - _vm->_gnap->initPos(11, 6, kDirBottomLeft); + gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 6), -1, 0x107BA, 1); break; case 4: - _vm->_gnap->initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); + gnap.initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 6), 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(8, 6), 1, 0x107C2, 1); updateHotspots(); @@ -433,24 +436,24 @@ void Scene02::run() { break; case 47: _vm->clearFlag(kGFUnk25); - _vm->_gnap->initPos(5, 6, kDirBottomLeft); + gnap.initPos(5, 6, kDirBottomLeft); _vm->_plat->initPos(6, 7, kDirUnk4); _vm->endSceneInit(); break; case 49: - _vm->_gnap->initPos(5, 6, kDirBottomRight); + gnap.initPos(5, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(6, 7, kDirNone); _vm->endSceneInit(); break; default: - _vm->_gnap->initPos(-1, 6, kDirBottomRight); + gnap.initPos(-1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; } @@ -465,35 +468,35 @@ void Scene02::run() { switch (_vm->_sceneClickedHotspot) { case kHS02Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS02Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -501,33 +504,33 @@ void Scene02::run() { break; case kHS02Chicken: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnap->_idleFacing = kDirUpRight; + gnap._idleFacing = kDirUpRight; Common::Point destPos = Common::Point(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1); - _vm->_gnap->walkTo(destPos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS02UseTwigWithChicken; + gnap.walkTo(destPos, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(9, 8); + gnap.playMoan2(9, 8); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS02GrabChicken; + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS02GrabChicken; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS02TalkChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -536,45 +539,45 @@ void Scene02::run() { case kHS02Truck1: case kHS02Truck2: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnap->_actionStatus = kAS02UseTruckGas; + gnap._actionStatus = kAS02UseTruckGas; else - _vm->_gnap->_actionStatus = kAS02UseTruckNoGas; + gnap._actionStatus = kAS02UseTruckNoGas; } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS02UseGasWithTruck; + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) + gnap._actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 2); + gnap.playScratchingHead(2, 2); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnap->_actionStatus = kAS02UseTruckGas; + gnap._actionStatus = kAS02UseTruckGas; else - _vm->_gnap->_actionStatus = kAS02UseTruckNoGas; + gnap._actionStatus = kAS02UseTruckNoGas; } } else { - _vm->_gnap->_idleFacing = kDirUnk4; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS02UseTruckNoKeys; + gnap._idleFacing = kDirUnk4; + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) + gnap._actionStatus = kAS02UseTruckNoKeys; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -582,22 +585,22 @@ void Scene02::run() { break; case kHS02TruckGrill: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(2, 4); + gnap.playMoan2(2, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS02GrabTruckGrill; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -605,10 +608,10 @@ void Scene02::run() { break; case kHS02ExitHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); @@ -617,10 +620,10 @@ void Scene02::run() { break; case kHS02ExitBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[7] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); @@ -629,10 +632,10 @@ void Scene02::run() { break; case kHS02ExitCreek: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8], -1, 0x107CD, 1); _vm->_newSceneNum = 3; @@ -640,10 +643,10 @@ void Scene02::run() { break; case kHS02ExitPigpen: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS02LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); + gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[9], -1, 0x107CF, 1); _vm->_newSceneNum = 1; @@ -654,13 +657,13 @@ void Scene02::run() { case kHS02WalkArea2: case kHS02WalkArea3: case kHS02WalkArea4: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -674,8 +677,8 @@ void Scene02::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; @@ -684,7 +687,7 @@ void Scene02::run() { else gameSys.insertSequence(0x154, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnap->_actionStatus != 7 && _vm->_gnap->_actionStatus != 8) { + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && gnap._actionStatus != 7 && gnap._actionStatus != 8) { if (_vm->getRandom(6) != 0) { _nextChickenSequenceId = 0x14B; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -710,25 +713,26 @@ void Scene02::run() { void Scene02::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS02UseTruckNoKeys: - gameSys.insertSequence(0x14E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x14E, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x14E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS02UseTruckNoKeysDone; + gameSys.insertSequence(0x14E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x14E, gnap._id, 0); + gnap._sequenceId = 0x14E; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS02UseTruckNoKeysDone; break; case kAS02UseGasWithTruck: - gameSys.insertSequence(0x151, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x151, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x151; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x151, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x151, gnap._id, 0); + gnap._sequenceId = 0x151; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemGas); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFTruckFilledWithGas); - _vm->_gnap->_actionStatus = kAS02UseGasWithTruckDone; + gnap._actionStatus = kAS02UseGasWithTruckDone; break; case kAS02UseTruckGas: _vm->_timers[5] = 9999; @@ -736,11 +740,11 @@ void Scene02::updateAnimations() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); if (!_vm->isFlag(kGFTruckKeysUsed)) { - gameSys.insertSequence(0x14F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnap->_sequenceId = 0x14F; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x14F; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemKeys); _vm->setGrabCursorSprite(-1); } @@ -752,11 +756,11 @@ void Scene02::updateAnimations() { _vm->setGrabCursorSprite(-1); _vm->_timers[4] = 250; if (!_vm->isFlag(kGFTruckKeysUsed)) { - gameSys.insertSequence(0x14F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x14F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.waitForUpdate(); _vm->setFlag(kGFTruckKeysUsed); - _vm->_gnap->_sequenceId = 0x14F; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x14F; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemKeys); _vm->setGrabCursorSprite(-1); } @@ -777,11 +781,11 @@ void Scene02::updateAnimations() { break; } _truckGrillCtr = (_truckGrillCtr + 1) % 3; - gameSys.insertSequence(_gnapTruckSequenceId, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(_gnapTruckSequenceId, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = _gnapTruckSequenceId; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(_gnapTruckSequenceId, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_gnapTruckSequenceId, gnap._id, 0); + gnap._sequenceId = _gnapTruckSequenceId; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS02LeaveScene: _vm->_sceneDone = true; @@ -794,26 +798,26 @@ void Scene02::updateAnimations() { _vm->_timers[2] = 100; break; case kAS02GrabChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x150, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B5, gnap._id, 0x150, 179, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; _currChickenSequenceId = 0x14B; gameSys.setAnimation(0x14B, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_timers[5] = 30; break; case kAS02UseTwigWithChicken: - _vm->_gnap->playShowItem(5, 0, 0); + gnap.playShowItem(5, 0, 0); gameSys.insertSequence(0x155, 179, _currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _currChickenSequenceId = 0x155; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS02UseTruckNoKeysDone: case kAS02UseGasWithTruckDone: default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -821,18 +825,18 @@ void Scene02::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x150) { gameSys.setAnimation(_nextChickenSequenceId, 179, 0); - gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; - _vm->_gnap->_actionStatus = kAS02GrabChickenDone; + gnap._actionStatus = kAS02GrabChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x14C) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); @@ -885,6 +889,7 @@ void Scene03::updateHotspots() { void Scene03::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10925, true); _vm->startSoundTimerC(7); @@ -893,7 +898,7 @@ void Scene03::run() { gameSys.insertSequence(0x1CB, 251, 0, 0, kSeqLoop, 0, 0, 0); _platypusHypnotized = false; - _vm->_gnap->initPos(3, 4, kDirBottomRight); + gnap.initPos(3, 4, kDirBottomRight); gameSys.insertSequence(0x1C6, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -926,7 +931,7 @@ void Scene03::run() { if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(4, 7), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(3, 6), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 6), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -937,28 +942,28 @@ void Scene03::run() { switch (_vm->_sceneClickedHotspot) { case kHS03Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -966,26 +971,26 @@ void Scene03::run() { break; case kHS03Grass: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 6); + gnap.playScratchingHead(9, 6); break; case GRAB_CURSOR: - _vm->_gnap->playPullOutDevice(9, 6); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(9, 6); + gnap.playUseDevice(0, 0); gameSys.insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1B3, 253, 5); _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -993,11 +998,11 @@ void Scene03::run() { break; case kHS03ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS03LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); + gnap._actionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], -1, 0x107C2, 1); _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1009,25 +1014,25 @@ void Scene03::run() { break; case kHS03Creek: - if (_vm->_gnap->_actionStatus == -1) { + if (gnap._actionStatus == -1) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(2, 8); + gnap.playMoan2(2, 8); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3] + Common::Point(1, 1)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS03GrabCreek; + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3] + Common::Point(1, 1)) | 0x10000, 1)) + gnap._actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1035,42 +1040,42 @@ void Scene03::run() { break; case kHS03TrappedPlatypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 4); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 4); + gnap.playScratchingHead(8, 4); break; case GRAB_CURSOR: if (_platypusHypnotized) { - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107B5, 1); - _vm->_gnap->_actionStatus = kAS03FreePlatypus; + gnap.walkTo(Common::Point(7, 6), 0, 0x107B5, 1); + gnap._actionStatus = kAS03FreePlatypus; } else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) - _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; + gnap._actionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnap->_actionStatus = kAS03GrabPlatypus; + gnap._actionStatus = kAS03GrabPlatypus; } break; case TALK_CURSOR: if (_platypusHypnotized) { - _vm->_gnap->playBrainPulsating(8, 4); + gnap.playBrainPulsating(8, 4); } else { - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) - _vm->_gnap->_actionStatus = kAS03HypnotizeScaredPlat; + gnap._actionStatus = kAS03HypnotizeScaredPlat; else - _vm->_gnap->_actionStatus = kAS03HypnotizePlat; + gnap._actionStatus = kAS03HypnotizePlat; } break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1078,7 +1083,7 @@ void Scene03::run() { break; case kHS03Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1087,27 +1092,27 @@ void Scene03::run() { case kHS03WalkAreas1: case kHS03WalkAreas2: case kHS03WalkAreas3: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS03PlatypusWalkArea: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypus) || _platypusHypnotized) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107B5, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107B5, 1); if (_platypusScared) - _vm->_gnap->_actionStatus = kAS03GrabScaredPlatypus; + gnap._actionStatus = kAS03GrabScaredPlatypus; else - _vm->_gnap->_actionStatus = kAS03GrabPlatypus; + gnap._actionStatus = kAS03GrabPlatypus; } } break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1122,16 +1127,16 @@ void Scene03::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[1] && !_platypusScared) { _vm->_timers[1] = _vm->getRandom(40) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) _nextPlatSequenceId = 450; } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 30; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextFrogSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextFrogSequenceId == -1) { if (_vm->getRandom(5) == 1) _nextFrogSequenceId = 0x1C6; else @@ -1141,12 +1146,12 @@ void Scene03::run() { if (!_vm->_timers[4]) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) gameSys.insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 200; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { gameSys.setAnimation(0x1C5, 253, 4); gameSys.insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } @@ -1171,10 +1176,11 @@ void Scene03::run() { void Scene03::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS03LeaveScene: _vm->_sceneDone = true; break; @@ -1182,7 +1188,7 @@ void Scene03::updateAnimations() { _nextPlatSequenceId = 0x1BC; break; case kAS03FreePlatypusDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_plat->_pos = Common::Point(6, 6); _vm->_plat->_idleFacing = kDirUnk4; _vm->_plat->_id = 120; @@ -1196,7 +1202,7 @@ void Scene03::updateAnimations() { updateHotspots(); break; case kAS03HypnotizePlat: - _vm->_gnap->playBrainPulsating(0, 0); + gnap.playBrainPulsating(0, 0); _vm->addFullScreenSprite(0x106, 255); gameSys.setAnimation(0x1C9, 256, 1); gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); @@ -1207,12 +1213,12 @@ void Scene03::updateAnimations() { gameSys.insertSequence(0x1BA, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_sequenceId = 0x1BA; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; case kAS03HypnotizeScaredPlat: - _vm->_gnap->playBrainPulsating(0, 0); + gnap.playBrainPulsating(0, 0); gameSys.insertSequence(0x1BF, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); gameSys.setAnimation(0x1BF, 99, 1); while (gameSys.getAnimationStatus(1) != 2) @@ -1227,7 +1233,7 @@ void Scene03::updateAnimations() { gameSys.insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_sequenceId = 0x1BA; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; @@ -1240,14 +1246,14 @@ void Scene03::updateAnimations() { _platypusHypnotized = false; break; case kAS03GrabCreek: - gameSys.insertSequence(0x1B4, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x1B4, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x1B4; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS03GrabCreekDone; + gameSys.insertSequence(0x1B4, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1B4, gnap._id, 0); + gnap._sequenceId = 0x1B4; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS03GrabCreekDone; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1256,26 +1262,26 @@ void Scene03::updateAnimations() { if (_nextPlatSequenceId == 0x1BD || _nextPlatSequenceId == 0x1C0) { gameSys.setAnimation(0, 0, 1); _platypusScared = true; - gameSys.insertSequence(0x1B5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1B5, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x1B5; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirNone; + gnap._sequenceId = 0x1B5; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirNone; _vm->_plat->_sequenceId = _nextPlatSequenceId; _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { - _vm->_gnap->_pos = Common::Point(3, 6); - gameSys.insertSequence(0x1B6, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gnap._pos = Common::Point(3, 6); + gameSys.insertSequence(0x1B6, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x1BC, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1BC, 99, 0); - _vm->_gnap->_id = 20 * _vm->_gnap->_pos.y; - _vm->_gnap->_sequenceId = 0x1B6; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirNone; - _vm->_gnap->_actionStatus = kAS03FreePlatypusDone; + gnap._id = 20 * gnap._pos.y; + gnap._sequenceId = 0x1B6; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirNone; + gnap._actionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { gameSys.setAnimation(0, 0, 1); @@ -1351,6 +1357,7 @@ void Scene04::updateHotspots() { void Scene04::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(4); @@ -1379,11 +1386,11 @@ void Scene04::run() { _vm->_timers[3] = 300; // TODO setCursor((LPCSTR)IDC_WAIT); _vm->setGrabCursorSprite(kItemKeys); - _vm->_gnap->_pos = Common::Point(4, 7); - _vm->_gnap->_id = 140; + gnap._pos = Common::Point(4, 7); + gnap._id = 140; _vm->_plat->_pos = Common::Point(6, 7); _vm->_plat->_id = 141; - gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - _vm->_gnap->_gridX, 336 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - gnap._gridX, 336 - gnap._gridY); gameSys.insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x209, 121, 0x208, 121, kSeqSyncWait, 0, 0, 0); @@ -1395,31 +1402,31 @@ void Scene04::run() { _vm->_plat->_sequenceId = 0x20C; _vm->_plat->_sequenceDatNum = 0; _vm->_plat->_idleFacing = kDirBottomRight; - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; gameSys.waitForUpdate(); } else { gameSys.insertSequence(0x209, 121, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 2) { - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(6, 9), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(6, 9), -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { - _vm->_gnap->initPos(5, 7, kDirBottomRight); + gnap.initPos(5, 7, kDirBottomRight); _vm->_plat->initPos(4, 7, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(12, 9, kDirBottomRight); + gnap.initPos(12, 9, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(9, 9), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(9, 9), -1, 0x107BA, 1); } } @@ -1434,38 +1441,38 @@ void Scene04::run() { switch (_vm->_sceneClickedHotspot) { case kHS04Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS04Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: if (_vm->_cursorValue == 4) - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); else - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1473,23 +1480,23 @@ void Scene04::run() { break; case kHS04Twig: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 9, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); break; case GRAB_CURSOR: - _vm->_gnap->playPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); - _vm->_gnap->playUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); gameSys.insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1FD, 100, 2); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1497,24 +1504,24 @@ void Scene04::run() { break; case kHS04Axe: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); + gnap.playMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS04GrabAxe; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1522,31 +1529,31 @@ void Scene04::run() { break; case kHS04Dog: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { - _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + if (gnap.walkTo(gnap._pos, 0, -1, 1)) { + gnap.playMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20F; } break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS04GrabDog; + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS04GrabDog; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1)) { - _vm->_gnap->playBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(gnap._pos, 0, -1, 1)) { + gnap.playBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); _nextDogSequenceId = 0x20E; } break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1554,30 +1561,30 @@ void Scene04::run() { break; case kHS04Door: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playScratchingHead(4, 3); + gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: if (_vm->_cursorValue == 1) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS04OpenDoor; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); + gnap._actionStatus = kAS04OpenDoor; _vm->_timers[5] = 300; - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; } else { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS04LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107BC, 1); + gnap._actionStatus = kAS04LeaveScene; _vm->_newSceneNum = 38; } break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1585,10 +1592,10 @@ void Scene04::run() { break; case kHS04ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS04LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); + gnap._actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5], -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -1599,29 +1606,29 @@ void Scene04::run() { break; case kHS04Window: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); } else if (_vm->isFlag(kGFKeysTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[7], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(10, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[7], 0, gnap.getSequenceId(gskIdle, Common::Point(10, 2)) | 0x10000, 1)) { if (_triedWindow) { - _vm->_gnap->_actionStatus = kAS04GetKeyAnother; + gnap._actionStatus = kAS04GetKeyAnother; } else { - _vm->_gnap->_actionStatus = kAS04GetKeyFirst; + gnap._actionStatus = kAS04GetKeyFirst; _triedWindow = true; } } break; case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1629,10 +1636,10 @@ void Scene04::run() { break; case kHS04ExitBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS04LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); + gnap._actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8] + Common::Point(0, 1), -1, 0x107C1, 1); if (_vm->_cursorValue == 1) @@ -1644,13 +1651,13 @@ void Scene04::run() { case kHS04WalkArea1: case kHS04WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1665,11 +1672,11 @@ void Scene04::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence2(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence2(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(150) + 300; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) gameSys.insertSequence(0x20D, 79, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { @@ -1702,95 +1709,96 @@ void Scene04::run() { void Scene04::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS04LeaveScene: _vm->_sceneDone = true; break; case kAS04OpenDoor: - gameSys.insertSequence(0x205, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x207, 121, 521, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_pos = Common::Point(6, 7); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - _vm->_gnap->_gridX, 336 - _vm->_gnap->_gridY); - gameSys.setAnimation(0x107B5, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_actionStatus = kAS04OpenDoorDone; + gnap._pos = Common::Point(6, 7); + gameSys.insertSequence(0x107B5, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x205) - 1, 450 - gnap._gridX, 336 - gnap._gridY); + gameSys.setAnimation(0x107B5, gnap._id, 0); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; + gnap._actionStatus = kAS04OpenDoorDone; break; case kAS04OpenDoorDone: gameSys.insertSequence(0x209, 121, 0x207, 121, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS04GetKeyFirst: - gameSys.insertSequence(0x204, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x204, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x204; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyFirst2; + gameSys.insertSequence(0x204, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x204, gnap._id, 0); + gnap._sequenceId = 0x204; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyFirst2; break; case kAS04GetKeyFirst2: - gameSys.insertSequence(0x206, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x206, 255, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x20B, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(0x20B, 256, 0); - _vm->_gnap->_sequenceId = 0x206; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyFirstDone; + gnap._sequenceId = 0x206; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyFirstDone; break; case kAS04GetKeyFirstDone: gameSys.requestRemoveSequence(0x1FF, 256); gameSys.requestRemoveSequence(0x20B, 256); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x107B5, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), 255, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._idleFacing = kDirBottomRight; + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; + gnap._actionStatus = -1; break; case kAS04GetKeyAnother: - gameSys.insertSequence(0x202, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x202, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceId = 0x202; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyAnother2; + gameSys.insertSequence(0x202, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x202, gnap._id, 0); + gnap._sequenceId = 0x202; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyAnother2; break; case kAS04GetKeyAnother2: - gameSys.insertSequence(0x203, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x203, 255, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x1FF, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x20A, 256, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(0x20A, 256, 0); - _vm->_gnap->_sequenceId = 0x203; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS04GetKeyAnotherDone; + gnap._sequenceId = 0x203; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS04GetKeyAnotherDone; break; case kAS04GetKeyAnotherDone: gameSys.removeSequence(0x1FF, 256, true); gameSys.removeSequence(0x20A, 256, true); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), 255, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x107B5, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), 255, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; + gnap._idleFacing = kDirBottomRight; + gnap._actionStatus = -1; break; case kAS04GrabDog: _nextDogSequenceId = 0x201; break; case kAS04GrabAxe: - gameSys.insertSequence(0x211, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x211, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.requestRemoveSequence(0x212, 100); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x211; - _vm->_gnap->_actionStatus = -1; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x211; + gnap._actionStatus = -1; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1808,13 +1816,13 @@ void Scene04::updateAnimations() { gameSys.insertSequence(_nextDogSequenceId, 139 - _dogIdCtr, _currDogSequenceId, 139 - (_dogIdCtr + 1) % 2, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x200, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x200, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextDogSequenceId, 139 - _dogIdCtr, 3); _dogIdCtr = (_dogIdCtr + 1) % 2; _currDogSequenceId = 0x201; - _vm->_gnap->_sequenceId = 0x200; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gnap._sequenceId = 0x200; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; _vm->_timers[6] = _vm->getRandom(20) + 60; _nextDogSequenceId = -1; } else if (_nextDogSequenceId != -1) { @@ -1865,6 +1873,7 @@ void Scene05::updateHotspots() { void Scene05::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(7); @@ -1884,15 +1893,15 @@ void Scene05::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(Common::Point(2, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 9), -1, 0x107B9, 1); } else { - _vm->_gnap->initPos(6, 8, kDirBottomRight); + gnap.initPos(6, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) _vm->_plat->initPos(7, 9, kDirNone); _vm->endSceneInit(); @@ -1909,35 +1918,35 @@ void Scene05::run() { switch (_vm->_sceneClickedHotspot) { case kHS05Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS05Platypus: - if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { + if (gnap._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1945,30 +1954,30 @@ void Scene05::run() { break; case kHS05Haystack: - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); } else if (_vm->isFlag(kGFNeedleTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); break; case GRAB_CURSOR: case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); if (_vm->_plat->walkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { _vm->_plat->_actionStatus = kAS05PlatSearchHaystack; _vm->_plat->_idleFacing = kDirUnk4; } - if (_vm->_gnap->_pos.x == 4 && (_vm->_gnap->_pos.y == 8 || _vm->_gnap->_pos.y == 7)) - _vm->_gnap->walkStep(); - _vm->_gnap->playIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + if (gnap._pos.x == 4 && (gnap._pos.y == 8 || gnap._pos.y == 7)) + gnap.walkStep(); + gnap.playIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } break; } @@ -1977,31 +1986,31 @@ void Scene05::run() { break; case kHS05Chicken: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { - _vm->_gnap->_idleFacing = kDirUpRight; + gnap._idleFacing = kDirUpRight; Common::Point checkPt = _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1); - _vm->_gnap->walkTo(checkPt, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05UseTwigWithChicken; + gnap.walkTo(checkPt, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(9, 7); + gnap.playMoan2(9, 7); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05GrabChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05TalkChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2009,22 +2018,22 @@ void Scene05::run() { break; case kHS05Ladder: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(2, 4); + gnap.playMoan2(2, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05GrabLadder; + gnap._idleFacing = kDirBottomLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2035,32 +2044,32 @@ void Scene05::run() { if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_isLeavingScene = true; Common::Point destPt = _vm->_hotspotsWalkPos[2] + Common::Point(- 1, 1); - _vm->_gnap->walkTo(destPt, 0, -1, 1); - _vm->_gnap->_actionStatus = kAS05EnterBarn; + gnap.walkTo(destPt, 0, -1, 1); + gnap._actionStatus = kAS05EnterBarn; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 6; else _vm->_newSceneNum = 36; - } else if (_vm->_gnap->_actionStatus < 0) { + } else if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, - _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS05PickPadlock; + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, + gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) + gnap._actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 4); + gnap.playScratchingHead(7, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS05TryPickPadlock; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2068,10 +2077,10 @@ void Scene05::run() { break; case kHS05ExitHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS05LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); + gnap._actionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[4] + Common::Point(0, 1), -1, 0x107C7, 1); if (_vm->_cursorValue == 1) @@ -2083,8 +2092,8 @@ void Scene05::run() { case kHS05WalkArea1: case kHS05WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS05WalkArea3: @@ -2092,8 +2101,8 @@ void Scene05::run() { break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2108,10 +2117,10 @@ void Scene05::run() { if (!_vm->_isLeavingScene) { if (_vm->isFlag(kGFPlatypus)) _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 30; - if (_vm->_gnap->_actionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { + if (gnap._actionStatus != kAS05TalkChicken && _nextChickenSequenceId == -1) { if (_vm->getRandom(4) != 0) _nextChickenSequenceId = 0x142; else @@ -2120,7 +2129,7 @@ void Scene05::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(150) + 300; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) gameSys.insertSequence(0x149, 39, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundC(); @@ -2141,36 +2150,37 @@ void Scene05::run() { void Scene05::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS05LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS05TryPickPadlock: - gameSys.insertSequence(0x148, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x148; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x148, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x148; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS05PickPadlock: - gameSys.setAnimation(0x147, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x147, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x147; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x147, gnap._id, 0); + gameSys.insertSequence(0x147, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x147; + gnap._sequenceDatNum = 0; _vm->setFlag(kGFBarnPadlockOpen); _vm->setFlag(kGFSceneFlag1); _vm->setGrabCursorSprite(-1); _vm->_newSceneNum = 6; _vm->_timers[2] = 100; _vm->invRemove(kItemNeedle); - _vm->_gnap->_actionStatus = kAS05LeaveScene; + gnap._actionStatus = kAS05LeaveScene; break; case kAS05TalkChicken: _nextChickenSequenceId = 0x144; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS05GrabChicken: _nextChickenSequenceId = 0x14B; @@ -2178,25 +2188,25 @@ void Scene05::updateAnimations() { case kAS05GrabLadder: while (gameSys.isSequenceActive(0x149, 39)) _vm->gameUpdateTick(); - gameSys.insertSequence(0x14E, _vm->_gnap->_id + 1, 0, 0, kSeqNone, 0, 0, 0); - gameSys.insertSequence(0x14D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x14D; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x14E, gnap._id + 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x14D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x14D; + gnap._sequenceDatNum = 0; _vm->_timers[2] = 200; _vm->_timers[6] = 300; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS05EnterBarn: gameSys.insertSequence(0x107B1, 1, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); gameSys.setAnimation(0x107B1, 1, 0); - _vm->_gnap->_actionStatus = kAS05LeaveScene; + gnap._actionStatus = kAS05LeaveScene; break; case kAS05UseTwigWithChicken: - _vm->_gnap->playShowItem(5, 0, 0); + gnap.playShowItem(5, 0, 0); _nextChickenSequenceId = 0x14F; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -2232,12 +2242,12 @@ void Scene05::updateAnimations() { if (_nextChickenSequenceId == 0x14B) { gameSys.setAnimation(_nextChickenSequenceId, 100, 3); gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x14C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x14C; + gameSys.insertSequence(0x14C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x14C; _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 100, 3); gameSys.insertSequence(_nextChickenSequenceId, 100, _currChickenSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -2292,6 +2302,7 @@ void Scene06::updateHotspots() { void Scene06::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; bool triedDeviceOnGas = false; _vm->startSoundTimerC(7); @@ -2315,12 +2326,12 @@ void Scene06::run() { _vm->queueInsertDeviceIcon(); - _vm->_gnap->initPos(5, 12, kDirBottomRight); + gnap.initPos(5, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -2333,35 +2344,35 @@ void Scene06::run() { switch (_vm->_sceneClickedHotspot) { case kHS06Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS06Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { - _vm->_gnap->useDisguiseOnPlatypus(); + gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2369,33 +2380,33 @@ void Scene06::run() { break; case kHS06Gas: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 0); + gnap.playScratchingHead(5, 0); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk04)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (triedDeviceOnGas) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS06TryToGetGas; + gnap._actionStatus = kAS06TryToGetGas; } else { triedDeviceOnGas = true; - _vm->_gnap->playPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); } break; case TALK_CURSOR: case PLAT_CURSOR: if (_vm->isFlag(kGFUnk04)) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else - _vm->_gnap->playScratchingHead(5, 0); + gnap.playScratchingHead(5, 0); break; } } @@ -2403,26 +2414,26 @@ void Scene06::run() { break; case kHS06Ladder: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 4); + gnap.playScratchingHead(8, 4); break; case GRAB_CURSOR: if (_vm->isFlag(kGFGasTaken)) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS06TryToClimbLadder; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); + gnap._actionStatus = kAS06TryToClimbLadder; _vm->setFlag(kGFGasTaken); } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2430,37 +2441,37 @@ void Scene06::run() { break; case kHS06Horse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig && _horseTurnedBack) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; _vm->_plat->walkTo(Common::Point(6, 8), 1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->_actionStatus = kAS06UseTwigOnHorse; + gnap._actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 2); + gnap.playScratchingHead(3, 2); break; case TALK_CURSOR: if (_horseTurnedBack) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(3, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(3, 2)) | 0x10000, 1); } else { - _vm->_gnap->_idleFacing = kDirBottomLeft; + gnap._idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS06TalkToHorse; + gnap._actionStatus = kAS06TalkToHorse; } break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2468,10 +2479,10 @@ void Scene06::run() { break; case kHS06ExitOutsideBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS06LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AE, 1); + gnap._actionStatus = kAS06LeaveScene; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; else @@ -2484,13 +2495,13 @@ void Scene06::run() { case kHS06WalkArea3: case kHS06WalkArea4: case kHS06WalkArea5: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2502,11 +2513,11 @@ void Scene06::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 25; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHorseSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHorseSequenceId == -1) { if (_horseTurnedBack) { _nextHorseSequenceId = 0xF5; } else { @@ -2543,31 +2554,32 @@ void Scene06::run() { void Scene06::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS06LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS06TryToGetGas: - gameSys.insertSequence(0xFC, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xFC; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0xFC, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xFC; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS06TryToClimbLadder: gameSys.insertSequence(0xFF, 20, 0xFE, 20, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0xFD, _vm->_gnap->_id, 0); - gameSys.insertSequence(0xFD, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xFD; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS06TryToClimbLadderDone; + gameSys.setAnimation(0xFD, gnap._id, 0); + gameSys.insertSequence(0xFD, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xFD; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS06TryToClimbLadderDone; break; case kAS06TryToClimbLadderDone: - _vm->_gnap->_pos = Common::Point(6, 7); - _vm->_gnap->_actionStatus = -1; + gnap._pos = Common::Point(6, 7); + gnap._actionStatus = -1; break; case kAS06TalkToHorse: _nextHorseSequenceId = 0xF6; @@ -2576,7 +2588,7 @@ void Scene06::updateAnimations() { _nextPlatSequenceId = 0xFB; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -2595,7 +2607,7 @@ void Scene06::updateAnimations() { _vm->_plat->_sequenceId = 0x7C1; _vm->_plat->_sequenceDatNum = 1; _vm->setFlag(kGFUnk04); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->showCursor(); } if (_nextPlatSequenceId == 0xFB) { @@ -2612,16 +2624,16 @@ void Scene06::updateAnimations() { _vm->hideCursor(); gameSys.setAnimation(0xFA, 256, 1); gameSys.insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x100, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x100, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xFB, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xFA, 256, 0xFB, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceId = 0xFA; _vm->_plat->_sequenceDatNum = 0; - gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x100, _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B7; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B7, gnap._id, 0x100, gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B7; + gnap._sequenceDatNum = 1; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; _nextPlatSequenceId = -1; @@ -2633,7 +2645,7 @@ void Scene06::updateAnimations() { _horseTurnedBack = true; _currHorseSequenceId = _nextHorseSequenceId; _nextHorseSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; default: gameSys.setAnimation(_nextHorseSequenceId, 120, 2); @@ -2669,6 +2681,7 @@ void Scene07::updateHotspots() { void Scene07::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); @@ -2681,18 +2694,18 @@ void Scene07::run() { gameSys.insertSequence(0x8D, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { - _vm->_gnap->initPos(7, 7, kDirBottomLeft); + gnap.initPos(7, 7, kDirBottomLeft); _vm->_plat->initPos(9, 7, kDirUnk4); _vm->endSceneInit(); } else { - _vm->_gnap->_pos = Common::Point(6, 7); - _vm->_gnap->_id = 140; - _vm->_gnap->_sequenceId = 0x8F; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap._pos = Common::Point(6, 7); + gnap._id = 140; + gnap._sequenceId = 0x8F; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirBottomRight; gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS07Wait; + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS07Wait; _vm->_plat->_pos = Common::Point(3, 8); _vm->_plat->_id = 160; _vm->_plat->_sequenceId = 0x91; @@ -2722,13 +2735,13 @@ void Scene07::run() { case kHS07Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -2738,16 +2751,16 @@ void Scene07::run() { case kHS07ExitHouse: _vm->_isLeavingScene = true; - if (_vm->_gnap->_pos.x > 8) - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, 7), 0, 0x107AD, 1); + if (gnap._pos.x > 8) + gnap.walkTo(Common::Point(gnap._pos.x, 7), 0, 0x107AD, 1); else - _vm->_gnap->walkTo(Common::Point(8, 7), 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS07LeaveScene; + gnap.walkTo(Common::Point(8, 7), 0, 0x107AD, 1); + gnap._actionStatus = kAS07LeaveScene; break; case kHS07Dice: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 8, 3, 3); + gnap.playShowCurrItem(4, 8, 3, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2756,25 +2769,25 @@ void Scene07::run() { _vm->setFlag(kGFPlatypus); _vm->invAdd(kItemDice); updateHotspots(); - _vm->_gnap->playPullOutDevice(3, 3); + gnap.playPullOutDevice(3, 3); gameSys.setAnimation(0x8E, 1, 2); gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(_vm->_gnap->getSequenceId(gskUseDevice, Common::Point(0, 0)) | 0x10000, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = _vm->_gnap->getSequenceId(gskUseDevice, Common::Point(0, 0)); - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(gnap.getSequenceId(gskUseDevice, Common::Point(0, 0)) | 0x10000, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = gnap.getSequenceId(gskUseDevice, Common::Point(0, 0)); + gnap._sequenceDatNum = 1; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } break; case kHS07Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(40) + 50; @@ -2783,7 +2796,7 @@ void Scene07::run() { case kHS07WalkArea1: case kHS07WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS07WalkArea3: @@ -2792,7 +2805,7 @@ void Scene07::run() { default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2801,8 +2814,8 @@ void Scene07::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_gnap->updateIdleSequence(); - if (_vm->_plat->_actionStatus < 0 && _vm->_gnap->_actionStatus < 0) { + gnap.updateIdleSequence(); + if (_vm->_plat->_actionStatus < 0 && gnap._actionStatus < 0) { if (_vm->_timers[0]) { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; @@ -2856,16 +2869,17 @@ void Scene07::run() { void Scene07::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS07LeaveScene: _vm->_newSceneNum = 8; _vm->_sceneDone = true; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(2) == 2) { @@ -2922,6 +2936,7 @@ void Scene08::updateAnimationsCb() { void Scene08::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -2951,12 +2966,12 @@ void Scene08::run() { if (!_vm->isFlag(kGFTruckKeysUsed)) gameSys.insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(1, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(1, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); _vm->_timers[5] = _vm->getRandom(40) + 50; @@ -2975,7 +2990,7 @@ void Scene08::run() { switch (_vm->_sceneClickedHotspot) { case kHS08Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(50) + 75; @@ -2985,21 +3000,21 @@ void Scene08::run() { case kH08SPlatypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->kissPlatypus(8); + gnap.actionIdle(0x14D); + gnap.kissPlatypus(8); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -3010,49 +3025,49 @@ void Scene08::run() { case kHS08ExitBackdoor: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(0, 6), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS08LeaveScene; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(0, 6), 0, 0x107AF, 1); + gnap._actionStatus = kAS08LeaveScene; _vm->_plat->walkTo(Common::Point(0, 7), 1, 0x107CF, 1); _vm->_newSceneNum = 9; break; case kHS08ExitCrash: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(3, 9), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS08LeaveScene; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(3, 9), 0, 0x107AE, 1); + gnap._actionStatus = kAS08LeaveScene; _vm->_plat->walkTo(Common::Point(4, 9), 1, 0x107C1, 1); _vm->_newSceneNum = 7; break; case kHS08Man: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 6, 7, 0); + gnap.playShowCurrItem(6, 6, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS08LookMan; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 1); + gnap._actionStatus = kAS08LookMan; + gnap._idleFacing = kDirUpRight; break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(8, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS08TalkMan; + gnap._idleFacing = kDirUpLeft; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(8, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x14D); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(6, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithMan; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playIdle(6, 6); + gnap.playIdle(6, 6); break; } } @@ -3060,35 +3075,35 @@ void Scene08::run() { case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 7, 5, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS08GrabDog; + gnap.playShowCurrItem(4, 7, 5, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS08LookDog; + gnap.playScratchingHead(6, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS08LookDog; break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS08GrabDog; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(4, 7), 0, 0x107BB, 1); + gnap._actionStatus = kAS08GrabDog; + gnap._idleFacing = kDirUpRight; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS08TalkDog; + gnap._idleFacing = kDirUpRight; + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: _vm->setFlag(kGFSceneFlag1); - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x14D); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS08PlatWithDog; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playIdle(3, 7); + gnap.playIdle(3, 7); break; } } @@ -3096,25 +3111,25 @@ void Scene08::run() { case kHS08Meat: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 8, 5, 6); + gnap.playShowCurrItem(6, 8, 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 7); + gnap.playScratchingHead(6, 7); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->_gnap->playScratchingHead(6, 7); + gnap.playScratchingHead(6, 7); } else { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->playPullOutDevice(6, 7); - _vm->_gnap->playUseDevice(0, 0); + gnap.actionIdle(0x14D); + gnap.playPullOutDevice(6, 7); + gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x149; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3122,25 +3137,25 @@ void Scene08::run() { case kHS08Bone: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(2, 7, 3, 6); + gnap.playShowCurrItem(2, 7, 3, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 6); + gnap.playScratchingHead(3, 6); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->_gnap->playScratchingHead(3, 6); + gnap.playScratchingHead(3, 6); } else { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->playPullOutDevice(3, 6); - _vm->_gnap->playUseDevice(0, 0); + gnap.actionIdle(0x14D); + gnap.playPullOutDevice(3, 6); + gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x14A; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3148,25 +3163,25 @@ void Scene08::run() { case kHS08Toy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(8, 7, 7, 6); + gnap.playShowCurrItem(8, 7, 7, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 6); + gnap.playScratchingHead(7, 6); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - _vm->_gnap->playScratchingHead(7, 6); + gnap.playScratchingHead(7, 6); } else { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->playPullOutDevice(7, 6); - _vm->_gnap->playUseDevice(0, 0); + gnap.actionIdle(0x14D); + gnap.playPullOutDevice(7, 6); + gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x14B; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3174,14 +3189,14 @@ void Scene08::run() { case kHS08WalkArea1: case kHS08WalkArea2: - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(-1, 6), -1, -1, 1); + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(-1, 6), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->actionIdle(0x14D); - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.actionIdle(0x14D); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3191,10 +3206,10 @@ void Scene08::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 125; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextManSequenceId == -1 && + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextManSequenceId == -1 && (_currDogSequenceId == 0x134 || _currDogSequenceId == 0x135)) { int _gnapRandomValue = _vm->getRandom(4); switch (_gnapRandomValue) { @@ -3232,39 +3247,40 @@ void Scene08::run() { void Scene08::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS08LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08TalkMan: _nextManSequenceId = 0x13F; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08LookMan: _nextManSequenceId = 0x140; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08LookDog: _nextManSequenceId = 0x137; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08GrabDog: if (_currDogSequenceId == 0x135) _nextDogSequenceId = 0x133; else _nextDogSequenceId = 0x13C; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS08TalkDog: if (_currDogSequenceId == 0x135) _nextDogSequenceId = 0x133; else _nextDogSequenceId = 0x13C; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -3332,8 +3348,8 @@ void Scene08::updateAnimations() { _vm->_plat->_sequenceId = 0x148; _vm->_plat->_idleFacing = kDirUnk4; _vm->_plat->_sequenceDatNum = 0; - if (_vm->_gnap->_pos == Common::Point(1, 8)) - _vm->_gnap->walkStep(); + if (gnap._pos == Common::Point(1, 8)) + gnap.walkStep(); } else if (_nextDogSequenceId != -1) { gameSys.setAnimation(_nextDogSequenceId, 100, 3); gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -3343,11 +3359,11 @@ void Scene08::updateAnimations() { if (_currDogSequenceId == 0x133) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x14D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x14D; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x14D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x14D; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; } } } @@ -3376,6 +3392,7 @@ void Scene09::updateHotspots() { void Scene09::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -3383,13 +3400,13 @@ void Scene09::run() { gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 8) { - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(9, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(4, 7, kDirBottomRight); + gnap.initPos(4, 7, kDirBottomRight); _vm->_plat->initPos(5, 7, kDirNone); _vm->endSceneInit(); } @@ -3411,7 +3428,7 @@ void Scene09::run() { switch (_vm->_sceneClickedHotspot) { case kHS09Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(150) + 50; @@ -3422,13 +3439,13 @@ void Scene09::run() { case kHS09Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -3439,8 +3456,8 @@ void Scene09::run() { case kHS09ExitKitchen: _vm->_isLeavingScene = true; _vm->_newSceneNum = 10; - _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS09LeaveScene; + gnap.walkTo(Common::Point(4, 7), 0, 0x107BF, 1); + gnap._actionStatus = kAS09LeaveScene; _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); _vm->_plat->_idleFacing = kDirUnk4; break; @@ -3448,27 +3465,27 @@ void Scene09::run() { case kHS09ExitHouse: _vm->_isLeavingScene = true; _vm->_newSceneNum = 8; - _vm->_gnap->walkTo(Common::Point(10, -1), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS09LeaveScene; + gnap.walkTo(Common::Point(10, -1), 0, 0x107AB, 1); + gnap._actionStatus = kAS09LeaveScene; _vm->_plat->walkTo(Common::Point(10, -1), -1, 0x107CD, 1); _vm->_plat->_idleFacing = kDirUnk4; break; case kHS09Trash: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(9, 6, 8, 0); + gnap.playShowCurrItem(9, 6, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 3); + gnap.playScratchingHead(8, 3); break; case GRAB_CURSOR: - _vm->_gnap->_actionStatus = kAS09SearchTrash; - _vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BC, 1); + gnap._actionStatus = kAS09SearchTrash; + gnap.walkTo(Common::Point(9, 6), 0, 0x107BC, 1); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3477,12 +3494,12 @@ void Scene09::run() { case kHS09WalkArea1: case kHS09WalkArea2: case kHS09WalkArea3: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3490,9 +3507,9 @@ void Scene09::run() { updateAnimations(); - if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus != 1 && _vm->_gnap->_actionStatus != 2) { + if (!_vm->_isLeavingScene && gnap._actionStatus != 1 && gnap._actionStatus != 2) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(150) + 100; if (_vm->_timers[4] & 1) @@ -3519,30 +3536,31 @@ void Scene09::run() { void Scene09::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS09LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS09SearchTrash: gameSys.setAnimation(0x4C, 120, 0); - gameSys.insertSequence(0x4C, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x4C, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x4B, 2, true); - _vm->_gnap->_sequenceId = 0x4C; - _vm->_gnap->_id = 120; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(9, 6); - _vm->_gnap->_actionStatus = kAS09SearchTrashDone; + gnap._sequenceId = 0x4C; + gnap._id = 120; + gnap._idleFacing = kDirUpLeft; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(9, 6); + gnap._actionStatus = kAS09SearchTrashDone; break; case kAS09SearchTrashDone: gameSys.insertSequence(0x4B, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[2] = 360; _vm->_timers[4] = _vm->getRandom(150) + 100; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index aa55e1dcf5..d8b2a3ce28 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -59,6 +59,7 @@ void Scene10::updateHotspots() { void Scene10::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _currCookSequenceId = 0x103; @@ -72,16 +73,16 @@ void Scene10::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 9) { - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(9, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(-1, 7, kDirBottomRight); + gnap.initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(1, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(1, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } @@ -107,20 +108,20 @@ void Scene10::run() { switch (_vm->_sceneClickedHotspot) { case kHS10Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); else - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(10); + gnap.kissPlatypus(10); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -131,48 +132,48 @@ void Scene10::run() { case kHS10ExitBar: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(0, 7), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS10LeaveScene; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(0, 7), 0, 0x107AF, 1); + gnap._actionStatus = kAS10LeaveScene; _vm->_plat->walkTo(Common::Point(0, 7), -1, 0x107CF, 1); _vm->_newSceneNum = 11; break; case kHS10ExitBackdoor: _vm->_isLeavingScene = true; - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(2, 9), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS10LeaveScene; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(2, 9), 0, 0x107AE, 1); + gnap._actionStatus = kAS10LeaveScene; _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C7, 1); _vm->_newSceneNum = 9; break; case kHS10Cook: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 8, 6, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.playShowCurrItem(4, 8, 6, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 0); + gnap.playScratchingHead(6, 0); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap.playImpossible(0, 0); + gnap._idleFacing = kDirBottomRight; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap._idleFacing = kDirUpRight; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(4, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x10C); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(4, 6), -1, -1, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; break; } } @@ -180,36 +181,36 @@ void Scene10::run() { case kHS10Tongs: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 7, 4, 0); + gnap.playShowCurrItem(3, 7, 4, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else - _vm->_gnap->playScratchingHead(4, 3); + gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else { - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; } break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else { - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x10C); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), -1, -1, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; } break; } @@ -218,33 +219,33 @@ void Scene10::run() { case kHS10Box: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 6, 6, 0); + gnap.playShowCurrItem(7, 6, 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 3); + gnap.playScratchingHead(7, 3); break; case GRAB_CURSOR: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS10AnnoyCook; + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); + gnap._actionStatus = kAS10AnnoyCook; break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - _vm->_gnap->playMoan2(-1, -1); + gnap.playMoan2(-1, -1); else { _vm->invAdd(kItemTongs); _vm->setFlag(kGFMudTaken); - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.actionIdle(0x10C); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS10PlatWithBox; _vm->_plat->_idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); - _vm->_gnap->playIdle(7, 6); + gnap.playIdle(7, 6); } break; } @@ -253,26 +254,26 @@ void Scene10::run() { case kHS10Oven: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(9, 6, 10, 0); + gnap.playShowCurrItem(9, 6, 10, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(10, 5)) | 0x10000); + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(10, 5)) | 0x10000); break; case GRAB_CURSOR: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(9, 6), 0, 0x107BB, 1); - gameSys.insertSequence(0x10E, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x10E; - _vm->_gnap->_id = 120; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(9, 6); + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(9, 6), 0, 0x107BB, 1); + gameSys.insertSequence(0x10E, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x10E; + gnap._id = 120; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(9, 6); _vm->_timers[2] = 360; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -282,12 +283,12 @@ void Scene10::run() { case kHS10WalkArea2: case kHS10WalkArea3: case kHS10WalkArea4: - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS10Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -295,8 +296,8 @@ void Scene10::run() { default: if (_vm->_mouseClickState._left) { - _vm->_gnap->actionIdle(0x10C); - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.actionIdle(0x10C); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -306,7 +307,7 @@ void Scene10::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(80) + 150; _vm->playSound(0x12B, false); @@ -342,10 +343,11 @@ void Scene10::run() { void Scene10::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS10LeaveScene: _vm->_sceneDone = true; break; @@ -400,8 +402,8 @@ void Scene10::updateAnimations() { _vm->setGrabCursorSprite(kItemTongs); if (_vm->_plat->_actionStatus == kAS10PlatWithBox) _vm->_plat->_actionStatus = -1; - if (_vm->_gnap->_pos == Common::Point(4, 8)) - _vm->_gnap->walkStep(); + if (gnap._pos == Common::Point(4, 8)) + gnap.walkStep(); break; default: gameSys.insertSequence(_nextCookSequenceId, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); @@ -411,7 +413,7 @@ void Scene10::updateAnimations() { switch (_currCookSequenceId) { case 0x106: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else { int rnd = _vm->getRandom(7); @@ -432,7 +434,7 @@ void Scene10::updateAnimations() { } break; case 0x103: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x104; @@ -440,7 +442,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; break; case 0x104: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x103; @@ -448,7 +450,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; break; case 0x105: - if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) _nextCookSequenceId = 0x106; else { int rnd = _vm->getRandom(7); @@ -465,11 +467,11 @@ void Scene10::updateAnimations() { } _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = 300; - gameSys.insertSequence(0x10C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x10C; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x10C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x10C; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; _vm->_plat->_actionStatus = -1; break; } @@ -533,6 +535,8 @@ void Scene11::updateHotspots() { void Scene11::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + bool flag = true; _vm->_timers[7] = 50; @@ -543,22 +547,22 @@ void Scene11::run() { switch (_vm->_prevSceneNum) { case 13: - _vm->_gnap->initPos(8, 5, kDirBottomLeft); + gnap.initPos(8, 5, kDirBottomLeft); _vm->_plat->initPos(9, 6, kDirUnk4); break; case 47: - _vm->_gnap->initPos(8, 5, kDirBottomLeft); + gnap.initPos(8, 5, kDirBottomLeft); _vm->_plat->initPos(9, 5, kDirUnk4); _currGoggleGuySequenceId = 0x1FA; _currHookGuySequenceId = 0x1FF; _vm->_timers[7] = 180; break; case 12: - _vm->_gnap->initPos(-1, 9, kDirBottomRight); + gnap.initPos(-1, 9, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); break; default: - _vm->_gnap->initPos(6, 6, kDirBottomLeft); + gnap.initPos(6, 6, kDirBottomLeft); _vm->_plat->initPos(6, 5, kDirUnk4); break; } @@ -582,7 +586,7 @@ void Scene11::run() { _vm->endSceneInit(); if (_vm->_prevSceneNum == 12) { - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } @@ -600,17 +604,17 @@ void Scene11::run() { switch (_vm->_sceneClickedHotspot) { case kHS11Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -621,49 +625,49 @@ void Scene11::run() { case kHS11ExitKitchen: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(6, 5), 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS11LeaveScene; + gnap.walkTo(Common::Point(6, 5), 0, 0x107BF, 1); + gnap._actionStatus = kAS11LeaveScene; _vm->_plat->walkTo(Common::Point(6, 6), -1, -1, 1); _vm->_newSceneNum = 10; break; case kHS11ExitToilet: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(8, 5), 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS11LeaveScene; + gnap.walkTo(Common::Point(8, 5), 0, 0x107BF, 1); + gnap._actionStatus = kAS11LeaveScene; _vm->_plat->walkTo(Common::Point(8, 6), -1, -1, 1); _vm->_newSceneNum = 13; break; case kHS11ExitLeft: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(-1, 8), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS11LeaveScene; + gnap.walkTo(Common::Point(-1, 8), 0, 0x107AF, 1); + gnap._actionStatus = kAS11LeaveScene; _vm->_plat->walkTo(Common::Point(-1, 9), -1, 0x107CF, 1); _vm->_newSceneNum = 12; break; case kHS11GoggleGuy: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemMagazine) { - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS11ShowMagazineToGoggleGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 1); + gnap._actionStatus = kAS11ShowMagazineToGoggleGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 7, 2, 0); + gnap.playShowCurrItem(3, 7, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 6); + gnap.playScratchingHead(1, 6); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS11TalkGoggleGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS11TalkGoggleGuy; break; } } @@ -671,28 +675,28 @@ void Scene11::run() { break; case kHS11HookGuy: - if (_vm->_gnap->_actionStatus < 0) { - _vm->_gnap->_idleFacing = kDirUpRight; + if (gnap._actionStatus < 0) { + gnap._idleFacing = kDirUpRight; if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 9); - _vm->_gnap->_actionStatus = kAS11ShowItemToHookGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 4, 0); + gnap.walkTo(Common::Point(5, 6), 0, 0x107BC, 9); + gnap._actionStatus = kAS11ShowItemToHookGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 4, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(3, 6)) | 0x10000); + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(3, 6)) | 0x10000); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS11GrabHookGuy; + gnap.walkTo(Common::Point(5, 6), 0, 0x107BC, 1); + gnap._actionStatus = kAS11GrabHookGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->walkTo(Common::Point(5, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS11TalkHookGuy; + gnap._idleFacing = kDirBottomLeft; + gnap.walkTo(Common::Point(5, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -700,21 +704,21 @@ void Scene11::run() { break; case kHS11Billard: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(9, 8); + gnap.playImpossible(9, 8); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 8); + gnap.playScratchingHead(9, 8); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(9, 8), 0, 0x107BA, 1); - _vm->_gnap->_actionStatus = kAS11GrabBillardBall; + gnap.walkTo(Common::Point(9, 8), 0, 0x107BA, 1); + gnap._actionStatus = kAS11GrabBillardBall; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(9, 8); + gnap.playImpossible(9, 8); break; } } @@ -726,20 +730,20 @@ void Scene11::run() { case kHS11WalkArea3: case kHS11WalkArea4: case kHS11WalkArea5: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS11Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -755,10 +759,10 @@ void Scene11::run() { gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } _vm->_plat->updateIdleSequence2(); - _vm->_gnap->updateIdleSequence2(); + gnap.updateIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 75; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextGoggleGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextGoggleGuySequenceId == -1) { if (_vm->getRandom(2)) _nextGoggleGuySequenceId = 0x1F6; else @@ -767,7 +771,7 @@ void Scene11::run() { } if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHookGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHookGuySequenceId == -1) { if (_currHookGuySequenceId == 0x201) { switch (_vm->getRandom(7)) { case 0: @@ -821,11 +825,12 @@ void Scene11::run() { void Scene11::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - if (_vm->_gnap->_actionStatus != kAS11GrabBillardBall) + if (gnap._actionStatus != kAS11GrabBillardBall) gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS11LeaveScene: _vm->_sceneDone = true; break; @@ -849,10 +854,10 @@ void Scene11::updateAnimations() { gameSys.setAnimation(0, 0, 0); _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x1F4, 255, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x1F4; - _vm->_gnap->_id = 255; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x1F4, 255, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x1F4; + gnap._id = 255; + gnap._sequenceDatNum = 0; gameSys.removeSequence(0x207, 257, true); gameSys.removeSequence(0x208, 256, true); _nextGoggleGuySequenceId = 0x1F8; @@ -882,7 +887,7 @@ void Scene11::updateAnimations() { _vm->_hotspots[kHS11Billard]._flags |= SF_DISABLED; gameSys.setAnimation(0x207, 257, 4); gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(0x1FE), 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } break; } @@ -894,32 +899,32 @@ void Scene11::updateAnimations() { gameSys.setAnimation(_nextGoggleGuySequenceId, 121, 2); _currGoggleGuySequenceId = _nextGoggleGuySequenceId; _nextGoggleGuySequenceId = -1; - if (_vm->_gnap->_actionStatus >= 1 && _vm->_gnap->_actionStatus <= 4) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus >= 1 && gnap._actionStatus <= 4) + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2) { if (_nextHookGuySequenceId == 0x204) { gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); gameSys.insertSequence(0x204, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x1F5, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1F5, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); _currHookGuySequenceId = 0x204; _nextHookGuySequenceId = -1; - _vm->_gnap->_sequenceId = 0x1F5; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x1F5; + gnap._sequenceDatNum = 0; _vm->_timers[4] = _vm->getRandom(40) + 20; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnap->_actionStatus == kAS11GrabHookGuy) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus == kAS11GrabHookGuy) + gnap._actionStatus = -1; } else if (_nextHookGuySequenceId != -1) { gameSys.insertSequence(_nextHookGuySequenceId, 120, _currHookGuySequenceId, 120, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextHookGuySequenceId, 120, 3); _currHookGuySequenceId = _nextHookGuySequenceId; _nextHookGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(40) + 20; - if (_vm->_gnap->_actionStatus >= 6 && _vm->_gnap->_actionStatus <= 9) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus >= 6 && gnap._actionStatus <= 9) + gnap._actionStatus = -1; } } @@ -961,6 +966,7 @@ void Scene12::updateHotspots() { void Scene12::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; int v18 = 1; _vm->queueInsertDeviceIcon(); @@ -991,14 +997,14 @@ void Scene12::run() { _vm->_timers[7] = _vm->getRandom(100) + 100; if (_vm->_prevSceneNum == 15) { - _vm->_gnap->initPos(5, 6, kDirBottomRight); + gnap.initPos(5, 6, kDirBottomRight); _vm->_plat->initPos(3, 7, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(12, 8, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } @@ -1014,7 +1020,7 @@ void Scene12::run() { switch (_vm->_sceneClickedHotspot) { case kHS12Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1023,13 +1029,13 @@ void Scene12::run() { case kHS12Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -1039,8 +1045,8 @@ void Scene12::run() { case kHS12ExitRight: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(10, -1), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS12LeaveScene; + gnap.walkTo(Common::Point(10, -1), 0, 0x107AB, 1); + gnap._actionStatus = kAS12LeaveScene; _vm->_plat->walkTo(Common::Point(10, -1), -1, -1, 1); _vm->_newSceneNum = 11; break; @@ -1048,41 +1054,41 @@ void Scene12::run() { case kHS12ToothGuy: if (_vm->_grabCursorSpriteIndex == kItemQuarter) { _vm->_largeSprite = gameSys.createSurface(0x141); - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_actionStatus = kAS12QuarterToToothGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 9); + gnap._idleFacing = kDirUpLeft; + gnap._actionStatus = kAS12QuarterToToothGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_actionStatus = kAS12QuarterWithHoleToToothGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 9); + gnap._idleFacing = kDirUpLeft; + gnap._actionStatus = kAS12QuarterWithHoleToToothGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 9); - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->_actionStatus = kAS12ShowItemToToothGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 9); + gnap._idleFacing = kDirUpLeft; + gnap._actionStatus = kAS12ShowItemToToothGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 2); + gnap.playScratchingHead(1, 2); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS12GrabToothGuy; + gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 1); + gnap._actionStatus = kAS12GrabToothGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS12TalkToothGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107D2, 1); _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; _vm->_plat->_idleFacing = kDirUnk4; - _vm->_gnap->playIdle(2, 7); + gnap.playIdle(2, 7); break; } } @@ -1090,34 +1096,34 @@ void Scene12::run() { case kHS12Barkeeper: if (_vm->_grabCursorSpriteIndex == kItemQuarter || _vm->_grabCursorSpriteIndex == kItemQuarterWithHole) { - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12QuarterWithBarkeeper; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 9); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12QuarterWithBarkeeper; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 9); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12ShowItemToBarkeeper; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 9); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12ShowItemToBarkeeper; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(6, 6), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12LookBarkeeper; + gnap.walkTo(Common::Point(6, 6), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12LookBarkeeper; break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(6, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS12TalkBarkeeper; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(6, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: - _vm->_gnap->playPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS12PlatWithBarkeeper; + gnap.playPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS12PlatWithBarkeeper; break; } } @@ -1125,34 +1131,34 @@ void Scene12::run() { case kHS12BeardGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 9); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12ShowItemToBeardGuy; - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 0); + gnap.walkTo(Common::Point(7, 6), 0, 0x107BB, 9); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12ShowItemToBeardGuy; + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12LookBeardGuy; + gnap.walkTo(Common::Point(7, 6), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12LookBeardGuy; break; case GRAB_CURSOR: // NOTE Bug in the original. It has 9 as flags which seems wrong here. - _vm->_gnap->walkTo(Common::Point(7, 6), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS12GrabBeardGuy; + gnap.walkTo(Common::Point(7, 6), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS12GrabBeardGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS12TalkBeardGuy; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; _vm->_plat->_idleFacing = kDirNone; - _vm->_gnap->playIdle(7, 6); + gnap.playIdle(7, 6); break; } } @@ -1161,21 +1167,21 @@ void Scene12::run() { case kHS12Jukebox: _vm->_newSceneNum = 15; _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(5, 6), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS12LeaveScene; + gnap.walkTo(Common::Point(5, 6), 0, 0x107BC, 1); + gnap._actionStatus = kAS12LeaveScene; break; case kHS12WalkArea1: case kHS12WalkArea2: case kHS12WalkArea3: case kHS12WalkArea4: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1186,11 +1192,11 @@ void Scene12::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = 15; if (_nextToothGuySequenceId == -1) { - if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextToothGuySequenceId = 0x1EC; else @@ -1202,8 +1208,8 @@ void Scene12::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_nextBarkeeperSequenceId == -1 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (_nextBarkeeperSequenceId == -1 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextBarkeeperSequenceId = 0x208; else @@ -1215,8 +1221,8 @@ void Scene12::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(30) + 15; - if (_nextBeardGuySequenceId == -1 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && _vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (_nextBeardGuySequenceId == -1 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) _nextBeardGuySequenceId = 0x1F2; else _nextBeardGuySequenceId = 0x202; @@ -1257,10 +1263,11 @@ void Scene12::run() { void Scene12::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS12LeaveScene: _vm->_sceneDone = true; break; @@ -1308,7 +1315,7 @@ void Scene12::updateAnimations() { } break; case kAS12QuarterToToothGuyDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->showCursor(); gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); @@ -1367,13 +1374,13 @@ void Scene12::updateAnimations() { gameSys.setAnimation(0, 0, 2); _vm->hideCursor(); gameSys.setAnimation(0x10843, 301, 0); - _vm->_gnap->_actionStatus = kAS12QuarterToToothGuyDone; + gnap._actionStatus = kAS12QuarterToToothGuyDone; gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); - gameSys.insertSequence(0x10843, 301, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x107B7, _vm->_gnap->_id, 0x10843, 301, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B7; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x10843, 301, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x107B7, gnap._id, 0x10843, 301, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B7; + gnap._sequenceDatNum = 1; _vm->setFlag(kGFTwigTaken); _vm->invAdd(kItemQuarterWithHole); _vm->invRemove(kItemQuarter); @@ -1381,34 +1388,34 @@ void Scene12::updateAnimations() { if (_nextToothGuySequenceId == 0x1EF) { gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; - _vm->_gnap->_sequenceId = 0x205; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x205; + gnap._sequenceDatNum = 0; _vm->_timers[4] = 40; _vm->_timers[2] = _vm->getRandom(20) + 70; _vm->_timers[3] = _vm->getRandom(50) + 200; - if (_vm->_gnap->_actionStatus == kAS12GrabToothGuy) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus == kAS12GrabToothGuy) + gnap._actionStatus = -1; } else if (_nextToothGuySequenceId != -1) { gameSys.insertSequence(_nextToothGuySequenceId, 50, _currToothGuySequenceId, 50, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToothGuySequenceId, 50, 2); _currToothGuySequenceId = _nextToothGuySequenceId; _nextToothGuySequenceId = -1; _vm->_timers[4] = 50; - if (_vm->_gnap->_actionStatus >= kAS12TalkToothGuy && _vm->_gnap->_actionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && + if (gnap._actionStatus >= kAS12TalkToothGuy && gnap._actionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && _currToothGuySequenceId != 0x1EC && _currToothGuySequenceId != 0x200) - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; if (_vm->_plat->_actionStatus == kAS12PlatWithToothGuy) _vm->_plat->_actionStatus = -1; } } if (gameSys.getAnimationStatus(3) == 2) { - if (_vm->_gnap->_actionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { - _vm->_gnap->_actionStatus = -1; - _vm->_gnap->playIdle(7, 6); + if (gnap._actionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { + gnap._actionStatus = -1; + gnap.playIdle(7, 6); _vm->_timers[5] = 0; } if (_nextBarkeeperSequenceId != -1) { @@ -1417,9 +1424,9 @@ void Scene12::updateAnimations() { _currBarkeeperSequenceId = _nextBarkeeperSequenceId; _nextBarkeeperSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnap->_actionStatus >= kAS12TalkBarkeeper && _vm->_gnap->_actionStatus <= kAS12QuarterWithBarkeeper && _currBarkeeperSequenceId != 0x203 && + if (gnap._actionStatus >= kAS12TalkBarkeeper && gnap._actionStatus <= kAS12QuarterWithBarkeeper && _currBarkeeperSequenceId != 0x203 && _currBarkeeperSequenceId != 0x1FB && _currBarkeeperSequenceId != 0x208) - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } @@ -1429,8 +1436,8 @@ void Scene12::updateAnimations() { _currBeardGuySequenceId = _nextBeardGuySequenceId; _nextBeardGuySequenceId = -1; _vm->_timers[6] = _vm->getRandom(30) + 20; - if (_vm->_gnap->_actionStatus >= kAS12TalkBeardGuy && _vm->_gnap->_actionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus >= kAS12TalkBeardGuy && gnap._actionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) + gnap._actionStatus = -1; if (_vm->_plat->_actionStatus == kAS12PlatWithBeardGuy) _vm->_plat->_actionStatus = -1; } @@ -1488,17 +1495,18 @@ void Scene13::showScribble() { void Scene13::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + int currSoundId = 0; _vm->queueInsertDeviceIcon(); - gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 14) { - _vm->_gnap->initPos(6, 6, kDirBottomLeft); + gnap.initPos(6, 6, kDirBottomLeft); _vm->_plat->initPos(9, 8, kDirNone); } else { - _vm->_gnap->initPos(3, 7, kDirBottomRight); + gnap.initPos(3, 7, kDirBottomRight); _vm->_plat->initPos(2, 7, kDirNone); } @@ -1521,7 +1529,7 @@ void Scene13::run() { switch (_vm->_sceneClickedHotspot) { case kHS13Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -1532,13 +1540,13 @@ void Scene13::run() { case kHS13Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: @@ -1548,8 +1556,8 @@ void Scene13::run() { case kHS13ExitBar: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(2, 7), 0, 0x107C0, 1); - _vm->_gnap->_actionStatus = kAS13LeaveScene; + gnap.walkTo(Common::Point(2, 7), 0, 0x107C0, 1); + gnap._actionStatus = kAS13LeaveScene; _vm->_plat->walkTo(Common::Point(2, 8), -1, -1, 1); if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { _vm->_newSceneNum = 11; @@ -1561,30 +1569,30 @@ void Scene13::run() { case kHS13BackToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(5, 5, 6, 0); + gnap.playShowCurrItem(5, 5, 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: case TALK_CURSOR: - if (_vm->_gnap->_pos == Common::Point(5, 5)) { + if (gnap._pos == Common::Point(5, 5)) { _backToiletCtr = MIN(5, _backToiletCtr + 1); - gameSys.setAnimation(_backToiletCtr + 0xA3, _vm->_gnap->_id, 0); - gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.setAnimation(_backToiletCtr + 0xA3, gnap._id, 0); + gameSys.insertSequence(_backToiletCtr + 0xA3, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqScale | kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS13Wait; - _vm->_gnap->_sequenceId = _backToiletCtr + 0xA3; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_sequenceDatNum = 0; + gnap._actionStatus = kAS13Wait; + gnap._sequenceId = _backToiletCtr + 0xA3; + gnap._idleFacing = kDirUpRight; + gnap._sequenceDatNum = 0; } else { - _vm->_gnap->walkTo(Common::Point(5, 5), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS13BackToilet; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(5, 5), 0, 0x107BB, 1); + gnap._actionStatus = kAS13BackToilet; + gnap._idleFacing = kDirUpRight; } break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1592,16 +1600,16 @@ void Scene13::run() { case kHS13FrontToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 7, 7, 0); + gnap.playShowCurrItem(6, 7, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->walkTo(Common::Point(6, 7), 0, 0xA9, 5); - _vm->_gnap->_actionStatus = kAS13FrontToilet; - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap.walkTo(Common::Point(6, 7), 0, 0xA9, 5); + gnap._actionStatus = kAS13FrontToilet; + gnap._idleFacing = kDirBottomRight; break; } } @@ -1609,23 +1617,23 @@ void Scene13::run() { case kHS13Scribble: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 7, 8, 0); + gnap.playShowCurrItem(7, 7, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS13LookScribble; - _vm->_gnap->_idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 7), 0, 0x107BB, 1); + gnap._actionStatus = kAS13LookScribble; + gnap._idleFacing = kDirUpRight; break; case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 7), -1, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)), 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 7), -1, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)), 1); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1633,21 +1641,21 @@ void Scene13::run() { case kHS13Urinal: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(8, 7, 9, 0); + gnap.playShowCurrItem(8, 7, 9, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(9, 6))); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); - _vm->_gnap->_actionStatus = kAS13Wait; + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(9, 6))); + gnap.walkTo(gnap._pos, 0, -1, 1); + gnap._actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(8, 7), 0, -1, 1); - _vm->_gnap->_actionStatus = kAS13GrabUrinal; + gnap.walkTo(Common::Point(8, 7), 0, -1, 1); + gnap._actionStatus = kAS13GrabUrinal; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1655,21 +1663,21 @@ void Scene13::run() { case kHS13Sink: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playSequence(_vm->_gnap->getSequenceId(gskDeflect, Common::Point(5, 9))); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, -1, 1); - _vm->_gnap->_actionStatus = kAS13Wait; + gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(5, 9))); + gnap.walkTo(gnap._pos, 0, -1, 1); + gnap._actionStatus = kAS13Wait; break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(4, 8), 0, 0x107B9, 1); - _vm->_gnap->_actionStatus = kAS13GrabSink; + gnap.walkTo(Common::Point(4, 8), 0, 0x107B9, 1); + gnap._actionStatus = kAS13GrabSink; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1683,7 +1691,7 @@ void Scene13::run() { case kHS13WalkArea7: case kHS13WalkArea8: case kHS13WalkArea9: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; case kHS13WalkArea1: @@ -1692,7 +1700,7 @@ void Scene13::run() { default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1704,8 +1712,8 @@ void Scene13::run() { _vm->_plat->updateIdleSequence(); if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) _vm->_plat->walkTo(Common::Point(-1, 7), -1, -1, 1); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; switch (_vm->getRandom(5)) { @@ -1769,58 +1777,59 @@ void Scene13::run() { void Scene13::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS13LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS13BackToilet: _backToiletCtr = MIN(5, _backToiletCtr + 1); - gameSys.insertSequence(_backToiletCtr + 0xA3, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 9, 0, 0, 0); - _vm->_gnap->_sequenceId = _backToiletCtr + 0xA3; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(_backToiletCtr + 0xA3, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 9, 0, 0, 0); + gnap._sequenceId = _backToiletCtr + 0xA3; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; break; case kAS13FrontToilet: _vm->_sceneDone = true; _vm->_newSceneNum = 14; break; case kAS13LookScribble: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; showScribble(); break; case kAS13GrabSink: gameSys.setAnimation(0xAB, 160, 0); - gameSys.insertSequence(0xAB, 160, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xAB, 160, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0xAA, 256, true); - _vm->_gnap->_sequenceId = 0xAB; - _vm->_gnap->_id = 160; - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(4, 8); + gnap._sequenceId = 0xAB; + gnap._id = 160; + gnap._idleFacing = kDirBottomRight; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(4, 8); _vm->_timers[2] = 360; - _vm->_gnap->_actionStatus = kAS13GrabSinkDone; + gnap._actionStatus = kAS13GrabSinkDone; break; case kAS13GrabSinkDone: gameSys.insertSequence(0xAA, 256, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS13Wait: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS13GrabUrinal: gameSys.setAnimation(0xA2, 120, 0); - gameSys.insertSequence(0xA2, 120, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA2; - _vm->_gnap->_id = 120; - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(4, 6); + gameSys.insertSequence(0xA2, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA2; + gnap._id = 120; + gnap._idleFacing = kDirBottomLeft; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(4, 6); _vm->_timers[2] = 360; - _vm->_gnap->_actionStatus = kAS13Wait; + gnap._actionStatus = kAS13Wait; break; } } @@ -1857,6 +1866,7 @@ void Scene14::updateHotspots() { void Scene14::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->_largeSprite = nullptr; _vm->queueInsertDeviceIcon(); @@ -1871,7 +1881,7 @@ void Scene14::run() { if (!_vm->isFlag(kGFNeedleTaken)) { gameSys.insertSequence(0x24, 10, 0x23, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x24; + gnap._sequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -1884,7 +1894,7 @@ void Scene14::run() { switch (_vm->_sceneClickedHotspot) { case kHS14Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -1902,7 +1912,7 @@ void Scene14::run() { _vm->setGrabCursorSprite(-1); _vm->hideCursor(); gameSys.setAnimation(0x26, 10, 0); - gameSys.insertSequence(0x26, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x26, 10, gnap._sequenceId, 10, kSeqSyncWait, 0, 0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { _vm->playSound(0x108E9, false); } else { @@ -1911,15 +1921,15 @@ void Scene14::run() { _vm->playSound(0x108E9, false); break; case GRAB_CURSOR: - gameSys.insertSequence(0x25, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x25, 10, gnap._sequenceId, 10, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x23, 10, 0x25, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x23; + gnap._sequenceId = 0x23; break; case TALK_CURSOR: _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -1927,7 +1937,7 @@ void Scene14::run() { case kHS14Toilet: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1938,7 +1948,7 @@ void Scene14::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -1953,8 +1963,8 @@ void Scene14::run() { _vm->checkGameKeys(); if (!_vm->isFlag(kGFNeedleTaken) && !_vm->_timers[2]) { - gameSys.insertSequence(0x24, 10, _vm->_gnap->_sequenceId, 10, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x24; + gameSys.insertSequence(0x24, 10, gnap._sequenceId, 10, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x24; _vm->_timers[2] = _vm->getRandom(40) + 50; } @@ -2029,6 +2039,7 @@ void Scene15::updateHotspots() { void Scene15::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _currSlotSequenceId = -1; _currUpperButtonSequenceId = -1; @@ -2060,7 +2071,7 @@ void Scene15::run() { switch (_vm->_sceneClickedHotspot) { case kHS15Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -2077,7 +2088,7 @@ void Scene15::run() { } else if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _nextSlotSequenceId = 0xDB; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2088,7 +2099,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2096,7 +2107,7 @@ void Scene15::run() { case kHS15PlayButton: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2115,7 +2126,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2128,7 +2139,7 @@ void Scene15::run() { case kHS15Button5: case kHS15Button6: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2141,7 +2152,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2154,7 +2165,7 @@ void Scene15::run() { case kHS15ButtonE: case kHS15ButtonF: if (_vm->_grabCursorSpriteIndex >= 0) { - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2167,7 +2178,7 @@ void Scene15::run() { _vm->playSound((_vm->getRandom(5) + 0x8D5) | 0x10000, false); break; case PLAT_CURSOR: - gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - _vm->_gnap->_gridX, 576 - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107A8, 1, 0, 0, kSeqNone, 0, 900 - gnap._gridX, 576 - gnap._gridY); break; } } @@ -2338,10 +2349,12 @@ void Scene17::update() { void Scene17::platHangUpPhone() { GameSys& gameSys = *_vm->_gameSys; - int savedGnapActionStatus = _vm->_gnap->_actionStatus; + PlayerGnap& gnap = *_vm->_gnap; + + int savedGnapActionStatus = gnap._actionStatus; if (_vm->_plat->_actionStatus == kAS17PlatPhoningAssistant) { - _vm->_gnap->_actionStatus = kAS17PlatHangUpPhone; + gnap._actionStatus = kAS17PlatHangUpPhone; _vm->updateMouseCursor(); _platPhoneCtr = 0; _vm->_plat->_actionStatus = -1; @@ -2358,7 +2371,7 @@ void Scene17::platHangUpPhone() { _vm->clearFlag(kGFPlatypusTalkingToAssistant); while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); - _vm->_gnap->_actionStatus = savedGnapActionStatus; + gnap._actionStatus = savedGnapActionStatus; _vm->updateMouseCursor(); } updateHotspots(); @@ -2366,6 +2379,7 @@ void Scene17::platHangUpPhone() { void Scene17::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -2424,13 +2438,13 @@ void Scene17::run() { if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { if (_vm->_prevSceneNum == 20) { - _vm->_gnap->initPos(4, 6, kDirBottomRight); + gnap.initPos(4, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { - _vm->_gnap->initPos(3, 9, kDirUpLeft); + gnap.initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); @@ -2450,12 +2464,12 @@ void Scene17::run() { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); _vm->_plat->initPos(7, 9, kDirNone); - _vm->_gnap->_pos = _vm->_hotspotsWalkPos[2]; - _vm->_gnap->_id = 20 * _vm->_hotspotsWalkPos[2].y; + gnap._pos = _vm->_hotspotsWalkPos[2]; + gnap._id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 601; - _vm->_gnap->_actionStatus = kAS17GnapHangUpPhone; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 601; + gnap._actionStatus = kAS17GnapHangUpPhone; _vm->clearFlag(kGFUnk25); gameSys.insertSequence(0x251, 254, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -2465,7 +2479,7 @@ void Scene17::run() { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); _vm->_sceneWaiting = true; - _vm->_gnap->initPos(3, 9, kDirUpLeft); + gnap.initPos(3, 9, kDirUpLeft); _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; @@ -2478,18 +2492,18 @@ void Scene17::run() { _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; updateHotspots(); } else if (_vm->_prevSceneNum == 18) { - _vm->_gnap->initPos(6, 6, kDirBottomRight); + gnap.initPos(6, 6, kDirBottomRight); _vm->_plat->initPos(5, 6, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { - _vm->_gnap->initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); + gnap.initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); _vm->_plat->initPos(1, 9, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(3, 7, kDirBottomRight); + gnap.initPos(3, 7, kDirBottomRight); _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -2498,12 +2512,12 @@ void Scene17::run() { _vm->endSceneInit(); } } else { - _vm->_gnap->_pos = Common::Point(3, 6); - _vm->_gnap->_id = 120; - _vm->_gnap->_sequenceId = 0x23D; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirBottomRight; - gameSys.insertSequence(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gnap._pos = Common::Point(3, 6); + gnap._id = 120; + gnap._sequenceId = 0x23D; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirBottomRight; + gameSys.insertSequence(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0, 0, kSeqNone, 0, 0, 0); _vm->_plat->_pos = Common::Point(-1, 8); _vm->_plat->_id = 160; gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); @@ -2527,41 +2541,41 @@ void Scene17::run() { switch (_vm->_sceneClickedHotspot) { case kHS17Device: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == 3) { + if (gnap._actionStatus < 0 || gnap._actionStatus == 3) { _vm->runMenu(); updateHotspots(); } break; case kHS17Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else { - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6], 1, 0x107C2, 1); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); _vm->_plat->_actionStatus = kAS17GetWrench1; - _vm->_gnap->_actionStatus = kAS17GetWrench1; + gnap._actionStatus = kAS17GetWrench1; _vm->_timers[5] = _vm->getRandom(30) + 80; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemJoint); } } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2569,30 +2583,30 @@ void Scene17::run() { break; case kHS17Wrench: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(8, 7); + gnap.playScratchingHead(8, 7); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_canTryGetWrench) { platHangUpPhone(); - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 1, 0x107C2, 1); _vm->_plat->_actionStatus = kAS17TryGetWrench; - _vm->_gnap->_actionStatus = kAS17TryGetWrench; + gnap._actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2600,40 +2614,40 @@ void Scene17::run() { break; case kHS17Phone1: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 3); + gnap.playScratchingHead(1, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17GetCoinFromPhone; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); + gnap._actionStatus = kAS17GetCoinFromPhone; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; - _vm->_gnap->_actionStatus = kAS17PlatUsePhone; + gnap._actionStatus = kAS17PlatUsePhone; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2641,43 +2655,43 @@ void Scene17::run() { break; case kHS17Phone2: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhone; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 3); + gnap.playScratchingHead(1, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[2], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS17GnapUsePhone; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); _vm->_isLeavingScene = true; - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->_idleFacing = kDirUpLeft; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); _vm->_plat->_actionStatus = kAS17PlatUsePhone; - _vm->_gnap->_actionStatus = kAS17PlatUsePhone; + gnap._actionStatus = kAS17PlatUsePhone; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2685,25 +2699,25 @@ void Scene17::run() { break; case kHS17ExitToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS17LeaveScene; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); + gnap._actionStatus = kAS17LeaveScene; if (_vm->_plat->_actionStatus != kAS17PlatPhoningAssistant) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; case kHS17ExitGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { platHangUpPhone(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS17LeaveScene; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); + gnap._actionStatus = kAS17LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[3] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -2711,13 +2725,13 @@ void Scene17::run() { case kHS17WalkArea1: case kHS17WalkArea2: case kHS17WalkArea3: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } break; @@ -2731,15 +2745,15 @@ void Scene17::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence2(); - _vm->_gnap->updateIdleSequence2(); + gnap.updateIdleSequence2(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 200; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) gameSys.insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -2829,51 +2843,52 @@ void Scene17::updateAnimations() { }; GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS17GetWrench1: - _vm->_gnap->_actionStatus = kAS17GetWrenchGnapReady; + gnap._actionStatus = kAS17GetWrenchGnapReady; break; case kAS17GetCoinFromPhone: - _vm->_gnap->playPullOutDevice(1, 3); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(1, 3); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x250, 100, 0); gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemDiceQuarterHole); _vm->clearFlag(kGFUnk18); - _vm->_gnap->_actionStatus = kAS17GetCoinFromPhoneDone; + gnap._actionStatus = kAS17GetCoinFromPhoneDone; break; case kAS17GetCoinFromPhoneDone: _vm->setGrabCursorSprite(kItemDiceQuarterHole); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS17PutCoinIntoPhone: - gameSys.setAnimation(0x24C, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x24C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x24C; + gameSys.setAnimation(0x24C, gnap._id, 0); + gameSys.insertSequence(0x24C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x24C; _vm->invRemove(kItemDiceQuarterHole); _vm->setGrabCursorSprite(-1); _vm->setFlag(kGFUnk18); - _vm->_gnap->_actionStatus = kAS17PutCoinIntoPhoneDone; + gnap._actionStatus = kAS17PutCoinIntoPhoneDone; break; case kAS17PutCoinIntoPhoneDone: gameSys.insertSequence(0x24F, 100, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS17GnapUsePhone: - gameSys.setAnimation(0x24D, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x24D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS17LeaveScene; + gameSys.setAnimation(0x24D, gnap._id, 0); + gameSys.insertSequence(0x24D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._actionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17GnapHangUpPhone: - gameSys.insertSequence(0x258, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x258; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x258, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x258; + gnap._actionStatus = -1; break; case kAS17LeaveScene: _vm->_sceneDone = true; @@ -2944,7 +2959,7 @@ void Scene17::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { switch (_nextWrenchSequenceId) { case 0x233: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(0x243, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); @@ -2956,7 +2971,7 @@ void Scene17::updateAnimations() { gameSys.setAnimation(0x243, _vm->_plat->_id, 1); break; case 0x234: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(0x242, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); @@ -2991,7 +3006,7 @@ void Scene17::updateAnimations() { _nextWrenchSequenceId = -1; break; case 0x230: - if (_vm->_gnap->_actionStatus == kAS17GetWrenchGnapReady) { + if (gnap._actionStatus == kAS17GetWrenchGnapReady) { gameSys.setAnimation(0, 0, 2); if (_canTryGetWrench) { gameSys.insertSequence(0x22E, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -2999,15 +3014,15 @@ void Scene17::updateAnimations() { _canTryGetWrench = false; } gameSys.setAnimation(0x23F, _vm->_plat->_id, 1); - gameSys.insertSequence(0x10875, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10875, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x23F, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceDatNum = 1; _vm->_plat->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x875; + gnap._sequenceId = 0x875; _vm->_plat->_sequenceId = 0x23F; - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->_actionStatus = kAS17GetWrench2; } break; @@ -3050,9 +3065,9 @@ void Scene17::updateAnimations() { gameSys.insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x240, _vm->_plat->_id, _vm->_plat->_sequenceId, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x23E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x23E; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.insertSequence(0x23E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x23E; + gnap._sequenceDatNum = 0; _vm->_plat->_sequenceId = 0x240; _vm->_plat->_sequenceDatNum = 0; gameSys.setAnimation(0x24A, 40, 3); @@ -3072,7 +3087,7 @@ void Scene17::updateAnimations() { _currWrenchSequenceId = 0x22D; _nextWrenchSequenceId = -1; _vm->setFlag(kGFGrassTaken); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_plat->_actionStatus = 2; updateHotspots(); _vm->_timers[5] = _vm->getRandom(30) + 80; @@ -3160,13 +3175,14 @@ void Scene18::updateHotspots() { void Scene18::gnapCarryGarbageCanTo(int gridX) { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; int gnapSeqId, gnapId, gnapDatNum, gnapGridX; int destGridX, direction; int curGridX = (_vm->_leftClickMouseX - _vm->_gridMinX + 37) / 75; - if (curGridX >= _vm->_gnap->_pos.x) + if (curGridX >= gnap._pos.x) destGridX = curGridX - 1; else destGridX = curGridX + 1; @@ -3181,30 +3197,30 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { if (nextGridX >= destGridX) nextGridX = destGridX; - if (nextGridX == _vm->_gnap->_pos.x) { - gnapSeqId = _vm->_gnap->_sequenceId; - gnapId = _vm->_gnap->_id; - gnapDatNum = _vm->_gnap->_sequenceDatNum; - gnapGridX = _vm->_gnap->_pos.x; - if (_vm->_gnap->_pos.x <= curGridX) + if (nextGridX == gnap._pos.x) { + gnapSeqId = gnap._sequenceId; + gnapId = gnap._id; + gnapDatNum = gnap._sequenceDatNum; + gnapGridX = gnap._pos.x; + if (gnap._pos.x <= curGridX) direction = 1; else direction = -1; } else { - if (_vm->_gnap->_pos.y == _vm->_plat->_pos.y) { - if (nextGridX >= _vm->_gnap->_pos.x) { - if (nextGridX >= _vm->_plat->_pos.x && _vm->_gnap->_pos.x <= _vm->_plat->_pos.x) + if (gnap._pos.y == _vm->_plat->_pos.y) { + if (nextGridX >= gnap._pos.x) { + if (nextGridX >= _vm->_plat->_pos.x && gnap._pos.x <= _vm->_plat->_pos.x) _vm->_plat->makeRoom(); - } else if (nextGridX <= _vm->_plat->_pos.x && _vm->_gnap->_pos.x >= _vm->_plat->_pos.x) { + } else if (nextGridX <= _vm->_plat->_pos.x && gnap._pos.x >= _vm->_plat->_pos.x) { _vm->_plat->makeRoom(); } } - gnapSeqId = _vm->_gnap->_sequenceId; - gnapId = _vm->_gnap->_id; - gnapDatNum = _vm->_gnap->_sequenceDatNum; - gnapGridX = _vm->_gnap->_pos.x; + gnapSeqId = gnap._sequenceId; + gnapId = gnap._id; + gnapDatNum = gnap._sequenceDatNum; + gnapGridX = gnap._pos.x; int seqId; - if (nextGridX < _vm->_gnap->_pos.x) { + if (nextGridX < gnap._pos.x) { direction = -1; seqId = 0x204; } else { @@ -3212,14 +3228,14 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { seqId = 0x203; } - int seqId2 = 20 * _vm->_gnap->_pos.y + 1; + int seqId2 = 20 * gnap._pos.y + 1; do { - if (_vm->isPointBlocked(gnapGridX + direction, _vm->_gnap->_pos.y)) + if (_vm->isPointBlocked(gnapGridX + direction, gnap._pos.y)) break; seqId2 += direction; gameSys.insertSequence(seqId, seqId2, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + kSeqSyncWait, 0, 75 * gnapGridX - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); gnapSeqId = seqId; gnapId = seqId2; gnapDatNum = 0; @@ -3228,51 +3244,52 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { } if (direction == 1) - _vm->_gnap->_sequenceId = 0x20A; + gnap._sequenceId = 0x20A; else - _vm->_gnap->_sequenceId = 0x209; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x209; + gnap._sequenceDatNum = 0; if (direction == 1) - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap._idleFacing = kDirBottomRight; else - _vm->_gnap->_idleFacing = kDirBottomLeft; + gnap._idleFacing = kDirBottomLeft; - _vm->_gnap->_id = 20 * _vm->_gnap->_pos.y + 1; + gnap._id = 20 * gnap._pos.y + 1; - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - gameSys.insertSequence(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gameSys.insertSequence(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, gnapSeqId | (gnapDatNum << 16), gnapId, - kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + kSeqScale | kSeqSyncWait, 0, 75 * gnapGridX - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); - _vm->_gnap->_pos.x = gnapGridX; + gnap._pos.x = gnapGridX; } void Scene18::putDownGarbageCan(int animationIndex) { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (animationIndex >= 0) { while (gameSys.getAnimationStatus(animationIndex) != 2) _vm->gameUpdateTick(); } - if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) - _vm->_s18GarbageCanPos = _vm->_gnap->_pos.x - 1; + if (gnap._idleFacing != kDirNone && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) + _vm->_s18GarbageCanPos = gnap._pos.x - 1; else - _vm->_s18GarbageCanPos = _vm->_gnap->_pos.x + 1; + _vm->_s18GarbageCanPos = gnap._pos.x + 1; _vm->clearFlag(kGFPlatypusDisguised); updateHotspots(); - if (_vm->_gnap->_idleFacing != kDirNone && _vm->_gnap->_idleFacing != kDirBottomRight && _vm->_gnap->_idleFacing != kDirUpRight) { - gameSys.insertSequence(0x107BA, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7BA; + if (gnap._idleFacing != kDirNone && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) { + gameSys.insertSequence(0x107BA, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7BA; } else { - gameSys.insertSequence(0x107B9, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B9; + gameSys.insertSequence(0x107B9, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B9; } - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceDatNum = 1; gameSys.insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); gameSys.setAnimation(0x1FA, 19, 4); gameSys.insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); @@ -3308,26 +3325,30 @@ void Scene18::platEndPhoning(bool platFl) { } void Scene18::closeHydrantValve() { - _vm->_gnap->_actionStatus = kAS18LeaveScene; + PlayerGnap& gnap = *_vm->_gnap; + + gnap._actionStatus = kAS18LeaveScene; _vm->updateMouseCursor(); if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; + gnap._actionStatus = kAS18CloseRightValveWithGarbageCan; waitForGnapAction(); } else { - _vm->_gnap->_actionStatus = kAS18CloseRightValveNoGarbageCan; + gnap._actionStatus = kAS18CloseRightValveNoGarbageCan; waitForGnapAction(); } } else if (_vm->isFlag(kGFBarnPadlockOpen)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); - _vm->_gnap->_actionStatus = kAS18CloseTopValve; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); + gnap._actionStatus = kAS18CloseTopValve; waitForGnapAction(); } } void Scene18::waitForGnapAction() { - while (_vm->_gnap->_actionStatus >= 0) { + PlayerGnap& gnap = *_vm->_gnap; + + while (gnap._actionStatus >= 0) { updateAnimations(); _vm->gameUpdateTick(); } @@ -3335,6 +3356,7 @@ void Scene18::waitForGnapAction() { void Scene18::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _cowboyHatSurface = nullptr; @@ -3370,9 +3392,9 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { if (_vm->_prevSceneNum == 17) - _vm->_gnap->initPos(4, 11, kDirBottomRight); + gnap.initPos(4, 11, kDirBottomRight); else - _vm->_gnap->initPos(4, 7, kDirBottomRight); + gnap.initPos(4, 7, kDirBottomRight); _platPhoneCtr = _vm->getRandom(5); if (_vm->isFlag(kGFUnk27)) { gameSys.insertSequence(0x21E, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -3393,7 +3415,7 @@ void Scene18::run() { } else { gameSys.setAnimation(_currPhoneSequenceId, 254, 3); } - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->clearFlag(kGFGnapControlsToyUFO); @@ -3401,22 +3423,22 @@ void Scene18::run() { _vm->_prevSceneNum = 19; } if (_vm->_prevSceneNum == 17) { - _vm->_gnap->initPos(4, 11, kDirBottomRight); + gnap.initPos(4, 11, kDirBottomRight); _vm->_plat->initPos(5, 11, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { - _vm->_gnap->initPos(7, 7, kDirBottomRight); + gnap.initPos(7, 7, kDirBottomRight); _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(-1, 10, kDirBottomRight); + gnap.initPos(-1, 10, kDirBottomRight); _vm->_plat->initPos(-1, 10, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } } @@ -3432,36 +3454,36 @@ void Scene18::run() { switch (_vm->_sceneClickedHotspot) { case kHS18Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS18Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3469,27 +3491,27 @@ void Scene18::run() { break; case kHS18CowboyHat: - if (_vm->_gnap->_actionStatus == kAS18StandingOnHydrant) { - _vm->_gnap->_actionStatus = kAS18GrabCowboyHat; + if (gnap._actionStatus == kAS18StandingOnHydrant) { + gnap._actionStatus = kAS18GrabCowboyHat; _vm->_sceneWaiting = false; - } else if (_vm->_gnap->_actionStatus < 0) { + } else if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 2); + gnap.playScratchingHead(3, 2); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, _vm->_gnap->getSequenceId(gskPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, gnap.getSequenceId(gskPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3497,43 +3519,43 @@ void Scene18::run() { break; case kHS18GarbageCan: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex >= 0) - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(true); if (_vm->_grabCursorSpriteIndex >= 0) { if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y, _vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); else if (!_vm->isFlag(kGFTruckFilledWithGas)) - _vm->_gnap->playScratchingHead(2, 4); + gnap.playScratchingHead(2, 4); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((_vm->_gnap->_pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), -1, -1, 1); - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(_vm->_s18GarbageCanPos, _vm->_gnap->_pos.y)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromStreet; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(_vm->_s18GarbageCanPos, gnap._pos.y)) | 0x10000, 1); + gnap._actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) - _vm->_gnap->_actionStatus = kAS18GrabGarbageCanFromHydrant; + if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) + gnap._actionStatus = kAS18GrabGarbageCanFromHydrant; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3542,64 +3564,64 @@ void Scene18::run() { break; case kHS18HydrantTopValve: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { // While carrying garbage can if (_vm->_grabCursorSpriteIndex >= 0) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 0, 0); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { gnapCarryGarbageCanTo(2); - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnRunningHydrant; + gnap._actionStatus = kAS18PutGarbageCanOnRunningHydrant; } else if (!_vm->isFlag(kGFBarnPadlockOpen)) { gnapCarryGarbageCanTo(2); - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnHydrant; + gnap._actionStatus = kAS18PutGarbageCanOnHydrant; } else { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } break; case TALK_CURSOR: case PLAT_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS18OpenTopValve; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); + gnap._actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 5); + gnap.playScratchingHead(1, 5); break; case GRAB_CURSOR: if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS18CloseTopValve; + gnap._actionStatus = kAS18CloseTopValve; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3608,12 +3630,12 @@ void Scene18::run() { break; case kHS18HydrantRightValve: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex == -1) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } } else { if (_vm->isFlag(kGFPlatypusDisguised)) { @@ -3621,30 +3643,30 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCan; + gnap._actionStatus = kAS18OpenRightValveWithGarbageCan; else - _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCan; + gnap._actionStatus = kAS18OpenRightValveNoGarbageCan; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 5); + gnap.playScratchingHead(1, 5); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); if (_vm->isFlag(kGFTruckKeysUsed)) - _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCan; + gnap._actionStatus = kAS18CloseRightValveWithGarbageCan; else - _vm->_gnap->_actionStatus = kAS18CloseRightValveNoGarbageCan; + gnap._actionStatus = kAS18CloseRightValveNoGarbageCan; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3653,18 +3675,18 @@ void Scene18::run() { break; case kHS18ExitToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } if (_vm->isFlag(kGFPictureTaken)) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { _vm->_isLeavingScene = true; _vm->_newSceneNum = 19; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); + gnap._actionStatus = kAS18LeaveScene; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore] + Common::Point(1, 0), -1, 0x107C2, 1); } @@ -3672,7 +3694,7 @@ void Scene18::run() { break; case kHS18ExitPhoneBooth: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3680,8 +3702,8 @@ void Scene18::run() { closeHydrantValve(); _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth], 0, 0x107AE, 1); + gnap._actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else @@ -3690,7 +3712,7 @@ void Scene18::run() { break; case kHS18ExitGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); @@ -3699,8 +3721,8 @@ void Scene18::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity], 0, 0x107B2, 1); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity], 0, 0x107B2, 1); + gnap._actionStatus = kAS18LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(false); else @@ -3711,24 +3733,24 @@ void Scene18::run() { case kHS18WalkArea1: case kHS18WalkArea2: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } break; default: - if (_vm->_gnap->_actionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { + if (gnap._actionStatus != kAS18StandingOnHydrant && _vm->_mouseClickState._left) { if (_vm->isFlag(kGFPlatypusDisguised)) { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } _vm->_mouseClickState._left = false; } @@ -3741,9 +3763,9 @@ void Scene18::run() { _vm->playSound(0x10940, true); if ((_vm->isFlag(kGFTruckFilledWithGas) || _vm->isFlag(kGFBarnPadlockOpen)) && !_vm->isSoundPlaying(0x22B) && - _vm->_gnap->_actionStatus != kAS18OpenRightValveNoGarbageCanDone && _vm->_gnap->_actionStatus != kAS18OpenRightValveNoGarbageCan && - _vm->_gnap->_actionStatus != kAS18OpenTopValve && _vm->_gnap->_actionStatus != kAS18OpenTopValveDone && - _vm->_gnap->_actionStatus != kAS18OpenRightValveWithGarbageCan && _vm->_gnap->_actionStatus != kAS18OpenRightValveWithGarbageCanDone) + gnap._actionStatus != kAS18OpenRightValveNoGarbageCanDone && gnap._actionStatus != kAS18OpenRightValveNoGarbageCan && + gnap._actionStatus != kAS18OpenTopValve && gnap._actionStatus != kAS18OpenTopValveDone && + gnap._actionStatus != kAS18OpenRightValveWithGarbageCan && gnap._actionStatus != kAS18OpenRightValveWithGarbageCanDone) _vm->playSound(0x22B, true); if (!_vm->_isLeavingScene) { @@ -3765,7 +3787,7 @@ void Scene18::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(2) == 1) gameSys.insertSequence(0x220, 255, 0, 0, kSeqNone, 0, 0, 0); else @@ -3775,7 +3797,7 @@ void Scene18::run() { _vm->playSoundA(); } if (!_vm->isFlag(kGFPlatypusDisguised)) - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); } _vm->checkGameKeys(); @@ -3795,67 +3817,68 @@ void Scene18::run() { void Scene18::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS18GrabGarbageCanFromStreet: - if (_vm->_gnap->_idleFacing != kDirUpRight && _vm->_gnap->_idleFacing != kDirBottomRight) { - gameSys.insertSequence(0x1FC, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 675, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FC; + if (gnap._idleFacing != kDirUpRight && gnap._idleFacing != kDirBottomRight) { + gameSys.insertSequence(0x1FC, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - 675, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FC; } else { - gameSys.insertSequence(0x1FD, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - 525, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FD; + gameSys.insertSequence(0x1FD, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - 525, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FD; } gameSys.removeSequence(0x1FA, 19, true); _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18GrabGarbageCanFromHydrant: - gameSys.insertSequence(0x1FE, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1FE, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x1F9, 19, true); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FE; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FE; _vm->clearFlag(kGFTruckKeysUsed); _vm->setFlag(kGFPlatypusDisguised); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18CloseRightValveNoGarbageCan: - gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20D, 39, true); gameSys.removeSequence(0x212, 39, true); gameSys.removeSequence(0x211, 39, true); _vm->stopSound(0x22B); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x205; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x205; _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18OpenTopValve: _vm->setFlag(kGFBarnPadlockOpen); updateHotspots(); - _vm->_gnap->playPullOutDevice(2, 7); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(2, 7); + gnap.playUseDevice(0, 0); gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS18OpenTopValveDone; + gnap._actionStatus = kAS18OpenTopValveDone; break; case kAS18OpenTopValveDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x208, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x208, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.removeSequence(0x20C, 19, true); gameSys.setAnimation(0x217, 39, 5); @@ -3864,32 +3887,32 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x208; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x208; _vm->invRemove(kItemWrench); _vm->setGrabCursorSprite(-1); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18CloseTopValve: - gameSys.insertSequence(0x206, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x206, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20E, 39, true); gameSys.removeSequence(0x216, 39, true); gameSys.removeSequence(0x217, 39, true); _vm->stopSound(0x22B); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x206; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x206; _vm->clearFlag(kGFBarnPadlockOpen); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18GrabCowboyHat: - gameSys.setAnimation(0x200, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x200, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x200; - _vm->_gnap->_actionStatus = kAS18GrabCowboyHatDone; + gameSys.setAnimation(0x200, gnap._id, 0); + gameSys.insertSequence(0x200, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x200; + gnap._actionStatus = kAS18GrabCowboyHatDone; break; case kAS18GrabCowboyHatDone: _vm->hideCursor(); @@ -3908,55 +3931,55 @@ void Scene18::updateAnimations() { _vm->setFlag(kGFTruckKeysUsed); _vm->setFlag(kGFUnk14); // Useless, already set updateHotspots(); - _vm->_gnap->_actionStatus = kAS18LeaveScene; + gnap._actionStatus = kAS18LeaveScene; break; case kAS18LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18PutGarbageCanOnRunningHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatypusDisguised); gameSys.requestRemoveSequence(0x211, 39); gameSys.requestRemoveSequence(0x212, 39); - gameSys.insertSequence(0x210, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x210, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); - gameSys.setAnimation(0x210, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x210; - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnRunningHydrant2; + gameSys.setAnimation(0x210, gnap._id, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x210; + gnap._actionStatus = kAS18PutGarbageCanOnRunningHydrant2; break; case kAS18PutGarbageCanOnRunningHydrant2: _vm->playSound(0x22B, true); - gameSys.setAnimation(0x1FF, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x1FF, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x1FF; + gameSys.setAnimation(0x1FF, gnap._id, 0); + gameSys.insertSequence(0x1FF, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x1FF; _vm->_sceneWaiting = true; - _vm->_gnap->_actionStatus = kAS18StandingOnHydrant; + gnap._actionStatus = kAS18StandingOnHydrant; break; case kAS18StandingOnHydrant: - gameSys.setAnimation(0x1FF, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x1FF, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x1FF, gnap._id, 0); + gameSys.insertSequence(0x1FF, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); break; case kAS18OpenRightValveNoGarbageCan: case kAS18OpenRightValveWithGarbageCan: _vm->setFlag(kGFTruckFilledWithGas); updateHotspots(); - _vm->_gnap->playPullOutDevice(2, 7); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(2, 7); + gnap.playUseDevice(0, 0); gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; - if (_vm->_gnap->_actionStatus == kAS18OpenRightValveNoGarbageCan) - _vm->_gnap->_actionStatus = kAS18OpenRightValveNoGarbageCanDone; + if (gnap._actionStatus == kAS18OpenRightValveNoGarbageCan) + gnap._actionStatus = kAS18OpenRightValveNoGarbageCanDone; else - _vm->_gnap->_actionStatus = kAS18OpenRightValveWithGarbageCanDone; + gnap._actionStatus = kAS18OpenRightValveWithGarbageCanDone; break; case kAS18OpenRightValveWithGarbageCanDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x207, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x207, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x213, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.requestRemoveSequence(0x1F9, 19); gameSys.removeSequence(0x20B, 19, true); @@ -3966,14 +3989,14 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x207; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x207; _vm->invRemove(kItemWrench); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18OpenRightValveNoGarbageCanDone: _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x207, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x207, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); gameSys.removeSequence(0x20B, 19, true); gameSys.setAnimation(0x211, 39, 5); @@ -3982,13 +4005,13 @@ void Scene18::updateAnimations() { _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x207; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x207; _vm->invRemove(kItemWrench); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18CloseRightValveWithGarbageCan: - gameSys.insertSequence(0x205, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x205, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(0x20D, 39, true); gameSys.insertSequence(0x215, 39, 0x214, 39, kSeqSyncWait, 0, 0, 0); _vm->stopSound(0x22B); @@ -3997,28 +4020,28 @@ void Scene18::updateAnimations() { _vm->clearFlag(kGFTruckFilledWithGas); _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 517, _vm->_gnap->_id, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + gameSys.insertSequence(0x107B5, gnap._id, 517, gnap._id, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); updateHotspots(); - _vm->_gnap->_sequenceDatNum = 1; - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_actionStatus = kAS18CloseRightValveWithGarbageCanDone; + gnap._sequenceDatNum = 1; + gnap._sequenceId = 0x7B5; + gnap._actionStatus = kAS18CloseRightValveWithGarbageCanDone; break; case kAS18CloseRightValveWithGarbageCanDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS18PutGarbageCanOnHydrant: _vm->setFlag(kGFTruckKeysUsed); _vm->clearFlag(kGFPlatypusDisguised); - gameSys.insertSequence(0x20F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - gameSys.setAnimation(0x20F, _vm->_gnap->_id, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x20F; - _vm->_gnap->_actionStatus = kAS18PutGarbageCanOnHydrantDone; + gameSys.insertSequence(0x20F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x20F, gnap._id, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x20F; + gnap._actionStatus = kAS18PutGarbageCanOnHydrantDone; break; case kAS18PutGarbageCanOnHydrantDone: - gameSys.insertSequence(0x1F9, 19, 0x20F, _vm->_gnap->_id, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1F9, 19, 0x20F, gnap._id, kSeqNone, 0, 0, 0); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -4096,6 +4119,7 @@ void Scene19::updateHotspots() { void Scene19::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); _toyGrabCtr = 0; @@ -4108,7 +4132,7 @@ void Scene19::run() { gameSys.insertSequence(0x69, 19, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->_gnap->initPos(3, 6, kDirBottomRight); + gnap.initPos(3, 6, kDirBottomRight); _currShopAssistantSequenceId = kS19ShopAssistantSequenceIds[_vm->getRandom(5)]; _nextShopAssistantSequenceId = _currShopAssistantSequenceId; gameSys.setAnimation(_currShopAssistantSequenceId, 20, 4); @@ -4116,7 +4140,7 @@ void Scene19::run() { gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _shopAssistantCtr = 0; _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(4, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 9), -1, 0x107B9, 1); updateHotspots(); } else { _currShopAssistantSequenceId = 0x6D; @@ -4124,10 +4148,10 @@ void Scene19::run() { gameSys.setAnimation(0x6D, 20, 4); gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(40) + 50; - _vm->_gnap->initPos(3, 6, kDirBottomRight); + gnap.initPos(3, 6, kDirBottomRight); _vm->_plat->initPos(4, 6, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(4, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(4, 9), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } @@ -4142,32 +4166,32 @@ void Scene19::run() { switch (_vm->_sceneClickedHotspot) { case kHS19Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS19Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4175,12 +4199,12 @@ void Scene19::run() { break; case kHS19ExitOutsideToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS19WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107B2, 1); - _vm->_gnap->_actionStatus = kAS19LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107B2, 1); + gnap._actionStatus = kAS19LeaveScene; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else @@ -4190,23 +4214,23 @@ void Scene19::run() { break; case kHS19Picture: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS19GrabPicture; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]) | 0x10000, 1); + gnap._actionStatus = kAS19GrabPicture; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4214,22 +4238,22 @@ void Scene19::run() { break; case kHS19ShopAssistant: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS19TalkShopAssistant; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4243,22 +4267,22 @@ void Scene19::run() { case kHS19Toy5: case kHS19Toy6: case kHS19Toy7: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap.playImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap.playMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); - _vm->_gnap->_actionStatus = kAS19GrabToy; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); + gnap.playIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap._actionStatus = kAS19GrabToy; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4266,22 +4290,22 @@ void Scene19::run() { break; case kHS19Phone: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 1); + gnap.playScratchingHead(9, 1); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - _vm->_gnap->playIdle(8, 2); - _vm->_gnap->_actionStatus = kAS19UsePhone; + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); + gnap.playIdle(8, 2); + gnap._actionStatus = kAS19UsePhone; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -4291,13 +4315,13 @@ void Scene19::run() { case kHS19WalkArea1: case kHS19WalkArea2: case kHS19WalkArea3: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } } @@ -4305,7 +4329,7 @@ void Scene19::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _vm->_plat->updateIdleSequence(); if (!_vm->_timers[6] && _nextShopAssistantSequenceId == -1) { @@ -4338,10 +4362,11 @@ void Scene19::run() { void Scene19::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS19UsePhone: _nextShopAssistantSequenceId = 0x67; break; @@ -4363,14 +4388,14 @@ void Scene19::updateAnimations() { } break; case kAS19GrabPicture: - _vm->_gnap->playPullOutDevice(6, 2); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(6, 2); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x68, 19, 0); gameSys.insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemPicture); _vm->setFlag(kGFPictureTaken); updateHotspots(); - _vm->_gnap->_actionStatus = kAS19GrabPictureDone; + gnap._actionStatus = kAS19GrabPictureDone; break; case kAS19GrabPictureDone: _vm->setGrabCursorSprite(-1); @@ -4391,7 +4416,7 @@ void Scene19::updateAnimations() { break; case kAS19TalkShopAssistant: _nextShopAssistantSequenceId = 0x6D; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS19LeaveScene: _vm->_sceneDone = true; @@ -4424,24 +4449,24 @@ void Scene19::updateAnimations() { while (_vm->_timers[5]) { _vm->gameUpdateTick(); } - _vm->_gnap->playIdle(6, 2); - _vm->_gnap->_actionStatus = -1; + gnap.playIdle(6, 2); + gnap._actionStatus = -1; break; case 0x67: gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case 0x65: - _vm->_gnap->playIdle(6, 2); + gnap.playIdle(6, 2); gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 0); gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_newSceneNum = 18; - _vm->_gnap->_actionStatus = kAS19LeaveScene; + gnap._actionStatus = kAS19LeaveScene; break; case 0x6D: gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 4); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 8c49bf606b..c4f578de93 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -55,6 +55,7 @@ void Scene20::updateHotspots() { void Scene20::updateAnimationsCb() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(2) == 2) { switch (_nextStonerGuySequenceId) { @@ -68,8 +69,8 @@ void Scene20::updateAnimationsCb() { break; case 0x16A: // Grab joint - _vm->_gnap->playPullOutDevice(4, 4); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(4, 4); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x16A, 21, 0); gameSys.insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16A; @@ -77,7 +78,7 @@ void Scene20::updateAnimationsCb() { _vm->invAdd(kItemJoint); _vm->setFlag(kGFJointTaken); _stonerGuyShowingJoint = false; - _vm->_gnap->_actionStatus = kAS20GrabJointDone; + gnap._actionStatus = kAS20GrabJointDone; break; case 0x16E: gameSys.setAnimation(0x16E, 21, 2); @@ -92,7 +93,7 @@ void Scene20::updateAnimationsCb() { gameSys.insertSequence(_nextStonerGuySequenceId, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = _nextStonerGuySequenceId; _nextStonerGuySequenceId = -1; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gnap._actionStatus = kAS20ActionDone; break; case 0x16F: gameSys.setAnimation(_nextStonerGuySequenceId, 21, 2); @@ -158,6 +159,7 @@ void Scene20::stopSounds() { void Scene20::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -206,46 +208,46 @@ void Scene20::run() { // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { case 17: - _vm->_gnap->initPos(5, 11, kDirBottomRight); + gnap.initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 18: - _vm->_gnap->initPos(11, 8, kDirBottomLeft); + gnap.initPos(11, 8, kDirBottomLeft); _vm->_plat->initPos(11, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 21: - _vm->_gnap->initPos(-1, 8, kDirBottomLeft); + gnap.initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 22: - _vm->_gnap->initPos(7, 6, kDirBottomRight); + gnap.initPos(7, 6, kDirBottomRight); _vm->_plat->initPos(8, 6, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); break; default: - _vm->_gnap->initPos(8, 6, kDirBottomLeft); + gnap.initPos(8, 6, kDirBottomLeft); _vm->_plat->initPos(9, 6, kDirUnk4); _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; break; @@ -264,32 +266,32 @@ void Scene20::run() { switch (_vm->_sceneClickedHotspot) { case kHS20Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS20Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(20); + gnap.kissPlatypus(20); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -297,96 +299,96 @@ void Scene20::run() { break; case kHS20ExitParkingLot: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 21; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; case kHS20ExitPhone: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 17; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS20ExitOutsideToyStore: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 18; _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; } break; case kHS20ExitInsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_plat->_idleFacing = kDirUnk4; } break; case kHS20ExitOutsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_stonerGuyShowingJoint) _vm->_timers[4] = 0; _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS20LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); + gnap._actionStatus = kAS20LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS20StonerGuy: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(5, 4); + gnap.playMoan2(5, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); if (_stonerGuyShowingJoint) - _vm->_gnap->_actionStatus = kAS20GrabJoint; + gnap._actionStatus = kAS20GrabJoint; else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) - _vm->_gnap->_actionStatus = kAS20TalkStonerGuyNoJoint; + gnap._actionStatus = kAS20TalkStonerGuyNoJoint; else - _vm->_gnap->_actionStatus = kAS20TalkStonerGuyHasJoint; + gnap._actionStatus = kAS20TalkStonerGuyHasJoint; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -394,27 +396,27 @@ void Scene20::run() { break; case kHS20GroceryStoreGuy: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 3); + gnap.playScratchingHead(2, 3); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20TalkGroceryStoreGuy; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -422,27 +424,27 @@ void Scene20::run() { break; case kHS20GroceryStoreHat: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHat; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(1, 6); + gnap.playScratchingHead(1, 6); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS20GrabGroceryStoreHat; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -451,12 +453,12 @@ void Scene20::run() { case kHS20WalkArea1: case kHS20WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -474,9 +476,9 @@ void Scene20::run() { _vm->_plat->updateIdleSequence(); _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; } - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->_timers[5] && _nextGroceryStoreGuySequenceId == -1) { _vm->_timers[5] = _vm->getRandom(50) + 130; if (_vm->getRandom(4) != 0) _nextGroceryStoreGuySequenceId = 0x17C; @@ -485,7 +487,7 @@ void Scene20::run() { } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -515,10 +517,11 @@ void Scene20::run() { void Scene20::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS20LeaveScene: _vm->_sceneDone = true; break; @@ -552,13 +555,13 @@ void Scene20::updateAnimations() { _vm->_timers[6] = 200; _vm->_timers[4] = 100; _stonerGuyShowingJoint = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS20GrabJoint: _nextStonerGuySequenceId = 0x16A; break; case kAS20ActionDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS20TalkGroceryStoreGuy: gameSys.setAnimation(0x170, 21, 2); @@ -603,13 +606,13 @@ void Scene20::updateAnimations() { break; case kAS20SwitchGroceryStoreHat: _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x180, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x180, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x180; - _vm->_gnap->_sequenceDatNum = 0; + gameSys.setAnimation(0x180, gnap._id, 0); + gameSys.insertSequence(0x180, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x180; + gnap._sequenceDatNum = 0; _vm->invRemove(kItemCowboyHat); _vm->invAdd(kItemGroceryStoreHat); - _vm->_gnap->_actionStatus = kAS20SwitchGroceryStoreHatDone; + gnap._actionStatus = kAS20SwitchGroceryStoreHatDone; break; case kAS20SwitchGroceryStoreHatDone: gameSys.insertSequence(0x17F, 20, 372, 20, kSeqSyncWait, 0, 0, 0); @@ -624,13 +627,13 @@ void Scene20::updateAnimations() { _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(Common::Point(3, 8), -1, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = -1; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(Common::Point(3, 8), -1, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = -1; break; case kAS20GrabJointDone: _vm->setGrabCursorSprite(kItemJoint); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -647,12 +650,12 @@ void Scene20::updateAnimations() { break; case 0x178: gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); - gameSys.setAnimation(0x17D, _vm->_gnap->_id, 0); + gameSys.setAnimation(0x17D, gnap._id, 0); gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x17D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x17D; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gameSys.insertSequence(0x17D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x17D; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; @@ -664,17 +667,17 @@ void Scene20::updateAnimations() { gameSys.setAnimation(_nextGroceryStoreGuySequenceId, 20, 3); gameSys.setAnimation(0x16D, 21, 0); gameSys.insertSequence(_nextGroceryStoreGuySequenceId, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x17E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x17E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gameSys.insertSequence(0x17E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x17E; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS20ActionDone; gameSys.setAnimation(0x16D, 21, 2); gameSys.insertSequence(0x16D, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16D; _currGroceryStoreGuySequenceId = 377; _nextGroceryStoreGuySequenceId = -1; _nextStonerGuySequenceId = -1; - _vm->_gnap->walkTo(Common::Point(4, 8), -1, 0x107BB, 1); + gnap.walkTo(Common::Point(4, 8), -1, 0x107BB, 1); break; case 0x17C: gameSys.setAnimation(0, 0, 3); @@ -690,7 +693,7 @@ void Scene20::updateAnimations() { gameSys.insertSequence(0x175, 20, _currGroceryStoreGuySequenceId, 20, kSeqSyncWait, 0, 0, 0); _currGroceryStoreGuySequenceId = 0x175; _nextGroceryStoreGuySequenceId = -1; - _vm->_gnap->_actionStatus = kAS20ActionDone; + gnap._actionStatus = kAS20ActionDone; break; default: if (_nextGroceryStoreGuySequenceId != -1) { @@ -736,6 +739,7 @@ void Scene21::updateHotspots() { void Scene21::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(6); @@ -744,7 +748,7 @@ void Scene21::run() { if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { - _vm->_gnap->initPos(5, 8, kDirBottomRight); + gnap.initPos(5, 8, kDirBottomRight); _vm->_plat->initPos(6, 8, kDirNone); gameSys.insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk04)) @@ -752,16 +756,16 @@ void Scene21::run() { _vm->endSceneInit(); _vm->clearFlag(kGFKeysTaken); } else { - _vm->_gnap->initPos(5, 11, kDirBottomRight); + gnap.initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } } else { - _vm->_gnap->initPos(5, 11, kDirBottomRight); + gnap.initPos(5, 11, kDirBottomRight); _vm->_plat->initPos(6, 11, kDirNone); _currOldLadySequenceId = 0x89; gameSys.setAnimation(0x89, 79, 3); @@ -769,7 +773,7 @@ void Scene21::run() { _nextOldLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } @@ -782,32 +786,32 @@ void Scene21::run() { switch (_vm->_sceneClickedHotspot) { case kHS21Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS21Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -815,19 +819,19 @@ void Scene21::run() { break; case kHS21Banana: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 2, 5); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 5); + gnap.playScratchingHead(2, 5); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); - _vm->_gnap->playPullOutDevice(2, 5); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->_actionStatus = kAS21GrabBanana; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); + gnap.playPullOutDevice(2, 5); + gnap.playUseDevice(0, 0); + gnap._actionStatus = kAS21GrabBanana; break; case TALK_CURSOR: case PLAT_CURSOR: @@ -838,32 +842,32 @@ void Scene21::run() { break; case kHS21OldLady: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; - _vm->_gnap->walkTo(Common::Point(4, 6), 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS21UseHatWithOldLady; + gnap.walkTo(Common::Point(4, 6), 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 6, 7, 4); + gnap.playShowCurrItem(4, 6, 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 4); + gnap.playScratchingHead(7, 4); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(7, 6), 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS21GrabOldLady; + gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS21TalkOldLady; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -871,23 +875,23 @@ void Scene21::run() { break; case kHS21ExitOutsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); - _vm->_gnap->_actionStatus = kAS21LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); + gnap._actionStatus = kAS21LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS21WalkArea1: case kHS21WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -901,8 +905,8 @@ void Scene21::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); - if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && _vm->_gnap->_actionStatus == -1) { + gnap.updateIdleSequence(); + if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(30) + 50; switch (_vm->getRandom(5)) { case 0: @@ -937,13 +941,14 @@ void Scene21::run() { void Scene21::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS21TalkOldLady: _nextOldLadySequenceId = 0x8B; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS21GrabBanana: gameSys.setAnimation(0x8C, 59, 0); @@ -951,22 +956,22 @@ void Scene21::updateAnimations() { _vm->setFlag(kGFUnk04); _vm->invAdd(kItemBanana); updateHotspots(); - _vm->_gnap->_actionStatus = kAS21GrabBananaDone; + gnap._actionStatus = kAS21GrabBananaDone; break; case kAS21GrabBananaDone: _vm->setGrabCursorSprite(kItemBanana); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS21GrabOldLady: _vm->_timers[4] = _vm->getRandom(30) + 50; _nextOldLadySequenceId = 0x87; break; case kAS21UseHatWithOldLady: - gameSys.setAnimation(0x8F, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x8F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x8F; - _vm->_gnap->_actionStatus = kAS21UseHatWithOldLadyDone; + gameSys.setAnimation(0x8F, gnap._id, 0); + gameSys.insertSequence(0x8F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x8F; + gnap._actionStatus = kAS21UseHatWithOldLadyDone; _vm->invAdd(kItemTickets); _vm->invRemove(kItemGroceryStoreHat); _vm->setGrabCursorSprite(-1); @@ -984,16 +989,16 @@ void Scene21::updateAnimations() { if (_nextOldLadySequenceId == 0x87) { gameSys.setAnimation(_nextOldLadySequenceId, 79, 3); gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x86, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x86; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = -1; + gameSys.insertSequence(0x86, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x86; + gnap._sequenceDatNum = 0; + gnap._actionStatus = -1; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else if (_nextOldLadySequenceId == 0x91) { gameSys.setAnimation(0x91, 79, 0); gameSys.insertSequence(_nextOldLadySequenceId, 79, _currOldLadySequenceId, 79, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS21LeaveScene; + gnap._actionStatus = kAS21LeaveScene; _currOldLadySequenceId = _nextOldLadySequenceId; _nextOldLadySequenceId = -1; } else { @@ -1029,6 +1034,7 @@ void Scene22::updateHotspots() { void Scene22::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; gameSys.insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -1043,14 +1049,14 @@ void Scene22::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 20) { - _vm->_gnap->initPos(2, 8, kDirBottomRight); + gnap.initPos(2, 8, kDirBottomRight); _vm->_plat->initPos(1, 8, kDirNone); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); + gnap.initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); _vm->_plat->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); } @@ -1098,32 +1104,32 @@ void Scene22::run() { switch (_vm->_sceneClickedHotspot) { case kHS22Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS22Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1131,44 +1137,44 @@ void Scene22::run() { break; case kHS22ExitOutsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS22LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); + gnap._actionStatus = kAS22LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; case kHS22ExitBackGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 23; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS22LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); + gnap._actionStatus = kAS22LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; case kHS22Cashier: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 4); + gnap.playScratchingHead(8, 4); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS22TalkCashier; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); break; } } @@ -1177,12 +1183,12 @@ void Scene22::run() { case kHS22WalkArea1: case kHS22WalkArea2: - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1192,7 +1198,7 @@ void Scene22::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[6] && _nextCashierSequenceId == -1) { _vm->_timers[6] = _vm->getRandom(30) + 20; if (_vm->getRandom(8) != 0) { @@ -1235,10 +1241,11 @@ void Scene22::run() { void Scene22::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS22LeaveScene: _vm->_sceneDone = true; break; @@ -1246,7 +1253,7 @@ void Scene22::updateAnimations() { _nextCashierSequenceId = 0x5C; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextCashierSequenceId != -1) { @@ -1280,6 +1287,7 @@ void Scene23::updateHotspots() { void Scene23::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->_timers[4] = _vm->getRandom(100) + 200; _vm->_timers[5] = _vm->getRandom(100) + 200; @@ -1292,7 +1300,7 @@ void Scene23::run() { _vm->queueInsertDeviceIcon(); - _vm->_gnap->initPos(-1, 7, kDirBottomRight); + gnap.initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 7, kDirNone); gameSys.insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); @@ -1301,9 +1309,9 @@ void Scene23::run() { _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); if (_vm->isFlag(kGFUnk24)) { - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else { - _vm->_gnap->walkTo(Common::Point(2, 7), 0, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), 0, 0x107B9, 1); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); @@ -1321,32 +1329,32 @@ void Scene23::run() { switch (_vm->_sceneClickedHotspot) { case kHS23Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS23Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1354,33 +1362,33 @@ void Scene23::run() { break; case kHS23Cereals: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->_gnap->playMoan2(0, 0); + gnap.playMoan2(0, 0); else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS23LookCereals; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS23LookCereals; } break; case GRAB_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else { - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); - _vm->_gnap->_actionStatus = kAS23GrabCereals; + gnap._actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1388,24 +1396,24 @@ void Scene23::run() { break; case kHS23ExitFrontGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 22; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS23LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); + gnap._actionStatus = kAS23LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity] + Common::Point(0, -1), -1, 0x107C2, 1); } break; case kHS23WalkArea1: case kHS23WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1415,8 +1423,8 @@ void Scene23::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); - if (!_vm->_timers[4] && _vm->_gnap->_actionStatus == -1) { + gnap.updateIdleSequence(); + if (!_vm->_timers[4] && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(100) + 200; switch (_vm->getRandom(4)) { case 0: @@ -1461,25 +1469,26 @@ void Scene23::run() { void Scene23::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS23LookCereals: _vm->showFullScreenSprite(0x48); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS23GrabCereals: - gameSys.setAnimation(0xBE, _vm->_gnap->_id, 0); - gameSys.insertSequence(0xBE, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0xBE, gnap._id, 0); + gameSys.insertSequence(0xBE, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.requestRemoveSequence(0xBF, 2); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0xBE; - _vm->_gnap->_actionStatus = kAS23GrabCerealsDone; + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0xBE; + gnap._actionStatus = kAS23GrabCerealsDone; break; case kAS23GrabCerealsDone: _vm->setGrabCursorSprite(kItemCereals); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS23LeaveScene: _vm->_sceneDone = true; @@ -1536,6 +1545,7 @@ void Scene24::updateHotspots() { void Scene24::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; int counter = 0; _vm->playSound(0x10940, true); @@ -1563,16 +1573,16 @@ void Scene24::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 20) { - _vm->_gnap->initPos(1, 8, kDirBottomRight); + gnap.initPos(1, 8, kDirBottomRight); _vm->_plat->initPos(2, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(1, 9), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(1, 9), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(2, 9), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(8, 8, kDirBottomLeft); + gnap.initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(8, 8, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } @@ -1588,32 +1598,32 @@ void Scene24::run() { switch (_vm->_sceneClickedHotspot) { case kHS24Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS24Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1621,22 +1631,22 @@ void Scene24::run() { break; case kHS24ExitCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS24LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); + gnap._actionStatus = kAS24LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS24ExitOutsideGrubCity: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS24LeaveScene; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS24LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1644,13 +1654,13 @@ void Scene24::run() { case kHS24WalkArea1: case kHS24WalkArea2: case kHS24WalkArea3: - if (_vm->_gnap->_actionStatus == -1) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus == -1) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1663,7 +1673,7 @@ void Scene24::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 50; gameSys.insertSequence(0x37, 20, _girlSequenceId, 20, kSeqSyncWait, 0, 0, 0); @@ -1723,12 +1733,13 @@ void Scene24::run() { void Scene24::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus == kAS24LeaveScene) + if (gnap._actionStatus == kAS24LeaveScene) _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } @@ -1798,6 +1809,7 @@ void Scene25::playAnims(int index) { void Scene25::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x10940, true); _vm->startSoundTimerA(5); @@ -1812,16 +1824,16 @@ void Scene25::run() { _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 24) { - _vm->_gnap->initPos(5, 11, kDirUpLeft); + gnap.initPos(5, 11, kDirUpLeft); _vm->_plat->initPos(6, 11, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 7), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 7), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 7), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(5, 6, kDirBottomRight); + gnap.initPos(5, 6, kDirBottomRight); _vm->_plat->initPos(6, 6, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } @@ -1834,32 +1846,32 @@ void Scene25::run() { switch (_vm->_sceneClickedHotspot) { case kHS25Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS25Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1867,29 +1879,29 @@ void Scene25::run() { break; case kHS25TicketVendor: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { - _vm->_gnap->_actionStatus = kAS25ShowTicketToVendor; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap._actionStatus = kAS25ShowTicketToVendor; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); _nextTicketVendorSequenceId = 0x5B; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 1); + gnap.playScratchingHead(6, 1); _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS25TalkTicketVendor; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1897,29 +1909,29 @@ void Scene25::run() { break; case kHS25ExitOutsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 24; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); - _vm->_gnap->_actionStatus = kAS25LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); + gnap._actionStatus = kAS25LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS25ExitInsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFNeedleTaken)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); - _vm->_gnap->_actionStatus = kAS25LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); + gnap._actionStatus = kAS25LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } else { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(4, 5), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicket; + gnap.walkTo(Common::Point(4, 5), 0, 0x107BB, 1); + gnap._actionStatus = kAS25EnterCircusWihoutTicket; _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } } @@ -1929,26 +1941,26 @@ void Scene25::run() { case kHS25Posters2: case kHS25Posters3: case kHS25Posters4: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], -1, -1, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], -1, -1, 1); if (_vm->_sceneClickedHotspot == 5 || _vm->_sceneClickedHotspot == 6) - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap._idleFacing = kDirUpLeft; else if (_vm->_sceneClickedHotspot == 8) - _vm->_gnap->_idleFacing = kDirBottomRight; + gnap._idleFacing = kDirBottomRight; else - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->playIdle(0, 0); + gnap._idleFacing = kDirUpRight; + gnap.playIdle(0, 0); playAnims(8 - _vm->_sceneClickedHotspot + 1); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playMoan2(0, 0); + gnap.playMoan2(0, 0); break; } } @@ -1957,13 +1969,13 @@ void Scene25::run() { case kHS25WalkArea1: case kHS25WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1973,8 +1985,8 @@ void Scene25::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); - if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && _vm->_gnap->_actionStatus == -1) { + gnap.updateIdleSequence(); + if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(20) + 20; switch (_vm->getRandom(13)) { case 0: @@ -2026,13 +2038,14 @@ void Scene25::run() { void Scene25::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS25TalkTicketVendor: _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x57 : 0x5F; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS25EnterCircusWihoutTicket: _nextTicketVendorSequenceId = 0x5E; @@ -2043,13 +2056,13 @@ void Scene25::updateAnimations() { _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->playIdle(0, 0); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); + gnap.playIdle(0, 0); + gnap.walkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS25EnterCircusWihoutTicketDone; + gnap._actionStatus = kAS25EnterCircusWihoutTicketDone; break; case kAS25EnterCircusWihoutTicketDone: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS25ShowTicketToVendor: _vm->setGrabCursorSprite(-1); @@ -2057,7 +2070,7 @@ void Scene25::updateAnimations() { _vm->setFlag(kGFNeedleTaken); gameSys.setAnimation(0x61, 40, 0); gameSys.insertSequence(0x61, 40, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS25ShowTicketToVendorDone; + gnap._actionStatus = kAS25ShowTicketToVendorDone; break; case kAS25ShowTicketToVendorDone: _nextTicketVendorSequenceId = 0x53; @@ -2073,7 +2086,7 @@ void Scene25::updateAnimations() { gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextTicketVendorSequenceId != -1) { gameSys.setAnimation(_nextTicketVendorSequenceId, 39, 3); gameSys.insertSequence(_nextTicketVendorSequenceId, 39, _currTicketVendorSequenceId, 39, kSeqSyncWait, 0, 0, 0); @@ -2109,6 +2122,7 @@ void Scene26::updateHotspots() { void Scene26::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->startSoundTimerB(7); _vm->playSound(0x1093B, true); @@ -2130,13 +2144,13 @@ void Scene26::run() { gameSys.insertSequence(0x5E, 40, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 25) { - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-2, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(2, 8, kDirBottomRight); + gnap.initPos(2, 8, kDirBottomRight); _vm->_plat->initPos(3, 8, kDirNone); _vm->endSceneInit(); } @@ -2150,32 +2164,32 @@ void Scene26::run() { switch (_vm->_sceneClickedHotspot) { case kHS26Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS26Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2183,59 +2197,59 @@ void Scene26::run() { break; case kHS26ExitOutsideCircusWorld: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 25; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideCircusWorld].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitOutsideClown].y), 0, 0x107BC, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitArcade: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitArcade].y), 0, 0x107BC, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitElephant: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 30; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitElephant].y), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitElephant].y), 0, 0x107BC, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26ExitBeerStand: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y), 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS26LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS26ExitBeerStand].y), 0, 0x107BB, 1); + gnap._actionStatus = kAS26LeaveScene; } break; case kHS26WalkArea1: case kHS26WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2248,7 +2262,7 @@ void Scene26::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[5] && _nextKidSequenceId == -1) { _vm->_timers[5] = _vm->getRandom(20) + 50; if (_vm->getRandom(5) != 0) @@ -2281,12 +2295,13 @@ void Scene26::run() { void Scene26::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus == kAS26LeaveScene) + if (gnap._actionStatus == kAS26LeaveScene) _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextKidSequenceId != -1) { @@ -2325,6 +2340,7 @@ void Scene27::updateHotspots() { void Scene27::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(4); @@ -2347,28 +2363,28 @@ void Scene27::run() { switch (_vm->_prevSceneNum) { case 26: - _vm->_gnap->initPos(7, 12, kDirBottomRight); + gnap.initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; case 29: - _vm->_gnap->initPos(-1, 8, kDirBottomRight); + gnap.initPos(-1, 8, kDirBottomRight); _vm->_plat->initPos(-1, 9, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 31: - _vm->_gnap->initPos(12, 8, kDirBottomLeft); + gnap.initPos(12, 8, kDirBottomLeft); _vm->_plat->initPos(12, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(8, 9), -1, 0x107C2, 1); break; default: - _vm->_gnap->initPos(6, 8, kDirBottomRight); + gnap.initPos(6, 8, kDirBottomRight); _vm->_plat->initPos(5, 9, kDirNone); _vm->endSceneInit(); break; @@ -2378,38 +2394,38 @@ void Scene27::run() { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); _vm->_sceneClickedHotspot = -1; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { case kHS27Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS27Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2417,26 +2433,26 @@ void Scene27::run() { break; case kHS27Janitor: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemPicture) { - _vm->_gnap->_idleFacing = kDirUpLeft; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) - _vm->_gnap->_actionStatus = kAS27ShowPictureToJanitor; + gnap._idleFacing = kDirUpLeft; + if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) + gnap._actionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 3); + gnap.playScratchingHead(6, 3); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS27TalkJanitor; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2444,22 +2460,22 @@ void Scene27::run() { break; case kHS27Bucket: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 3, 3); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 3, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(3, 3); + gnap.playScratchingHead(3, 3); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS27GrabBucket; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket]) | 0x10000, 1); + gnap._actionStatus = kAS27GrabBucket; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2467,60 +2483,60 @@ void Scene27::run() { break; case kHS27ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus] + Common::Point(1, 0), -1, 0x107C7, 1); } break; case kHS27ExitArcade: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 29; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade] + Common::Point(0, 1), -1, 0x107CF, 1); } break; case kHS27ExitBeerStand: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 31; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand] + Common::Point(0, 1), -1, 0x107CD, 1); } break; case kHS27ExitClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFPlatypus)) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 28; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); + gnap._actionStatus = kAS27LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown] + Common::Point(1, 0), -1, 0x107C4, 1); } else { _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS27TryEnterClownTent; + gnap._actionStatus = kAS27TryEnterClownTent; } } break; case kHS27WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2534,13 +2550,13 @@ void Scene27::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (_vm->_debugLevel == 4) _vm->updateIdleTimer(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 60; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(3) != 0) _nextJanitorSequenceId = 0xCB; else @@ -2549,7 +2565,7 @@ void Scene27::run() { } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 300; - if (_vm->_gnap->_actionStatus < 0) + if (gnap._actionStatus < 0) gameSys.insertSequence(0xD4, 120, 0, 0, kSeqNone, 0, 0, 0); } _vm->playSoundB(); @@ -2569,10 +2585,11 @@ void Scene27::run() { void Scene27::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS27TalkJanitor: switch (_vm->getRandom(3)) { case 0: @@ -2587,18 +2604,18 @@ void Scene27::updateAnimations() { } break; case kAS27GrabBucket: - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; _vm->invAdd(kItemEmptyBucket); _vm->setFlag(kGFUnk13); gameSys.setAnimation(0xD2, 39, 0); gameSys.insertSequence(0xD2, 39, 211, 39, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS27GrabBucketDone; + gnap._actionStatus = kAS27GrabBucketDone; break; case kAS27GrabBucketDone: _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS27ShowPictureToJanitor: _nextJanitorSequenceId = 0xD0; @@ -2610,17 +2627,17 @@ void Scene27::updateAnimations() { gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; - _vm->_gnap->_actionStatus = kAS27TryEnterClownTentDone; + gnap._actionStatus = kAS27TryEnterClownTentDone; break; case kAS27TryEnterClownTentDone: _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[7].x, 9), -1, 0x107BC, 1); + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[7].x, 9), -1, 0x107BC, 1); _vm->_hotspots[kHS27WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS27EnterClownTent: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107B2, 1); - _vm->_gnap->_actionStatus = kAS27LeaveScene; + gnap.walkTo(gnap._pos, 0, 0x107B2, 1); + gnap._actionStatus = kAS27LeaveScene; break; case kAS27LeaveScene: _vm->_sceneDone = true; @@ -2640,7 +2657,7 @@ void Scene27::updateAnimations() { case 0xCC: case 0xCD: case 0xCE: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 3); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); @@ -2649,11 +2666,11 @@ void Scene27::updateAnimations() { break; case 0xD0: // Show picture to janitor - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); - _vm->_gnap->_actionStatus = kAS27EnterClownTent; + gnap._actionStatus = kAS27EnterClownTent; _currJanitorSequenceId = _nextJanitorSequenceId; _nextJanitorSequenceId = -1; _vm->setFlag(kGFPlatypus); @@ -2701,6 +2718,7 @@ void Scene28::updateHotspots() { void Scene28::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093C, true); _nextClownSequenceId = -1; @@ -2723,12 +2741,12 @@ void Scene28::run() { gameSys.insertSequence(_currClownSequenceId, 39, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[4] = _vm->getRandom(20) + 80; } - _vm->_gnap->initPos(8, 8, kDirBottomLeft); + gnap.initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(9, 8, kDirUnk4); _vm->endSceneInit(); } else { gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->initPos(8, 8, kDirBottomLeft); + gnap.initPos(8, 8, kDirBottomLeft); _vm->_plat->initPos(9, 8, kDirUnk4); _vm->endSceneInit(); _vm->playSequences(0xF7, 0x121, 0x122, 0x123); @@ -2738,12 +2756,12 @@ void Scene28::run() { gameSys.insertSequence(_currClownSequenceId, 39, 0x11B, 39, kSeqSyncWait, 0, 0, 0); _nextClownSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 80; - _vm->_gnap->_actionStatus = kAS28GnapWaiting; + gnap._actionStatus = kAS28GnapWaiting; while (gameSys.getAnimationStatus(3) != 2) { _vm->gameUpdateTick(); _vm->updateMouseCursor(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } while (!_vm->_sceneDone) { @@ -2755,32 +2773,32 @@ void Scene28::run() { switch (_vm->_sceneClickedHotspot) { case kHS28Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS28Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2788,32 +2806,32 @@ void Scene28::run() { break; case kHS28Horn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(2, 8, 3, 4); + gnap.playShowCurrItem(2, 8, 3, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 4); + gnap.playScratchingHead(2, 4); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS28GrabHornSuccess; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn]) | 0x10000, 1); + gnap._actionStatus = kAS28GrabHornSuccess; } } else { - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(2, 8), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(2, 8), 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Horn], 0, 0x107BB, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Horn], 0, 0x107BB, 1); _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS28GrabHornFails; + gnap._actionStatus = kAS28GrabHornFails; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2821,39 +2839,39 @@ void Scene28::run() { break; case kHS28Clown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk21)) { if (_vm->_verbCursor == LOOK_CURSOR) - _vm->_gnap->playScratchingHead(5, 2); + gnap.playScratchingHead(5, 2); else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->_actionStatus = kAS28UseBeerBucketWithClown; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); + gnap._actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->_actionStatus = kAS28UsePillBucketWithClown; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); + gnap._actionStatus = kAS28UsePillBucketWithClown; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 2); + gnap.playScratchingHead(5, 2); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS28TalkClown; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2861,35 +2879,35 @@ void Scene28::run() { break; case kHS28ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; _vm->_hotspots[kHS28WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); - _vm->_gnap->_actionStatus = kAS28LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); + gnap._actionStatus = kAS28LeaveScene; _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; case kHS28EmptyBucket: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 8, 6); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 8, 6); } else if (_vm->isFlag(kGFUnk21)) { - _vm->_gnap->playImpossible(8, 6); + gnap.playImpossible(8, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 6); + gnap.playScratchingHead(8, 6); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS28GrabEmptyBucket; + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); + gnap._actionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2898,13 +2916,13 @@ void Scene28::run() { case kHS28WalkArea1: case kHS28WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -2917,10 +2935,10 @@ void Scene28::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 80; - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFUnk21)) + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFUnk21)) _nextClownSequenceId = 0x114; } } @@ -2939,10 +2957,11 @@ void Scene28::run() { void Scene28::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS28UseBeerBucketWithClown: _vm->setFlag(kGFUnk22); _nextClownSequenceId = 0x113; @@ -2960,11 +2979,11 @@ void Scene28::updateAnimations() { _nextClownSequenceId = 0x119; break; case kAS28GrabHornSuccess: - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x117, 59, 0); gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS28GrabHornSuccessDone; + gnap._actionStatus = kAS28GrabHornSuccessDone; break; case kAS28GrabHornSuccessDone: _vm->hideCursor(); @@ -2979,31 +2998,31 @@ void Scene28::updateAnimations() { _vm->setGrabCursorSprite(kItemHorn); _vm->invAdd(kItemHorn); updateHotspots(); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS28GrabEmptyBucket: - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.setAnimation(0x111, 99, 0); gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS28GrabEmptyBucketDone; + gnap._actionStatus = kAS28GrabEmptyBucketDone; break; case kAS28GrabEmptyBucketDone: _vm->setGrabCursorSprite(kItemEmptyBucket); _vm->clearFlag(kGFUnk22);; updateHotspots(); _vm->invAdd(kItemEmptyBucket); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS28GrabHornFailsDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 281, 39, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B5, gnap._id, 281, 39, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; - _vm->_gnap->_actionStatus = -1; - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107BB, 1); + gnap._actionStatus = -1; + gnap.walkTo(Common::Point(2, 8), -1, 0x107BB, 1); break; case kAS28TalkClown: _clownTalkCtr = (_clownTalkCtr + 1) % 2; @@ -3015,7 +3034,7 @@ void Scene28::updateAnimations() { _nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? break; case kAS28GnapWaiting: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS28LeaveScene: _vm->_sceneDone = true; @@ -3033,7 +3052,7 @@ void Scene28::updateAnimations() { gameSys.insertSequence(0x11B, 39, _nextClownSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClownSequenceId = 0x11B; _nextClownSequenceId = -1; - _vm->_gnap->_actionStatus = kAS28GnapWaiting; + gnap._actionStatus = kAS28GnapWaiting; break; case 0x116: _vm->setGrabCursorSprite(-1); @@ -3044,20 +3063,20 @@ void Scene28::updateAnimations() { gameSys.insertSequence(0x118, 59, 0, 0, kSeqNone, _vm->getSequenceTotalDuration(_nextClownSequenceId), 0, 0); _currClownSequenceId = _nextClownSequenceId; _nextClownSequenceId = -1; - _vm->_gnap->_actionStatus = kAS28GnapWaiting; + gnap._actionStatus = kAS28GnapWaiting; break; case 0x11D: case 0x11E: case 0x11F: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case 0x119: - gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextClownSequenceId, 39, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextClownSequenceId, 39, 0); gameSys.removeSequence(_currClownSequenceId, 39, true); - _vm->_gnap->_actionStatus = kAS28GrabHornFailsDone; - _vm->_gnap->_sequenceId = _nextClownSequenceId; - _vm->_gnap->_sequenceDatNum = 0; + gnap._actionStatus = kAS28GrabHornFailsDone; + gnap._sequenceId = _nextClownSequenceId; + gnap._sequenceDatNum = 0; _nextClownSequenceId = -1; break; } @@ -3098,6 +3117,7 @@ void Scene29::updateHotspots() { void Scene29::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); @@ -3124,16 +3144,16 @@ void Scene29::run() { gameSys.insertSequence(0xF5, 38, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->_prevSceneNum == 27) { - _vm->_gnap->initPos(12, 7, kDirBottomRight); + gnap.initPos(12, 7, kDirBottomRight); _vm->_plat->initPos(12, 8, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(8, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { - _vm->_gnap->initPos(-1, 7, kDirBottomRight); + gnap.initPos(-1, 7, kDirBottomRight); _vm->_plat->initPos(-2, 7, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); } @@ -3146,32 +3166,32 @@ void Scene29::run() { switch (_vm->_sceneClickedHotspot) { case kHS29Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS29Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3179,27 +3199,27 @@ void Scene29::run() { break; case kHS29Monkey: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS29UseBananaWithMonkey; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 6); + gnap.playScratchingHead(5, 6); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); + gnap.playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3207,45 +3227,45 @@ void Scene29::run() { break; case kHS29ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS29LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); + gnap._actionStatus = kAS29LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; case kHS29ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS29LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); + gnap._actionStatus = kAS29LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown] + Common::Point(0, -1), -1, 0x107CD, 1); } break; case kHS29Aracde: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->setGrabCursorSprite(-1); _vm->_isLeavingScene = true; _vm->_newSceneNum = 52; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); - _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); - _vm->_gnap->_actionStatus = kAS29LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); + gnap.playIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); + gnap._actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan2(0, 0); + gnap.playMoan2(0, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -3253,13 +3273,13 @@ void Scene29::run() { break; case kHS29WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -3271,14 +3291,14 @@ void Scene29::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - if (_vm->_gnap->_actionStatus < 0) { - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) { + gnap.updateIdleSequence(); _vm->_plat->updateIdleSequence(); } if (!_vm->_timers[4]) { if (_vm->invHas(kItemHorn)) { _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { switch (_vm->getRandom(5)) { case 0: _nextManSequenceId = 0xED; @@ -3316,10 +3336,11 @@ void Scene29::run() { void Scene29::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS29UseBananaWithMonkey: _nextMonkeySequenceId = 0xE5; break; @@ -3338,14 +3359,14 @@ void Scene29::updateAnimations() { if (gameSys.getAnimationStatus(4) == 2) { if (_nextMonkeySequenceId == 0xE5) { - gameSys.insertSequence(0xF2, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0xF2; + gameSys.insertSequence(0xF2, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0xF2; gameSys.setAnimation(0xE6, 159, 0); gameSys.setAnimation(0, 159, 4); gameSys.insertSequence(_nextMonkeySequenceId, 159, _currMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xE6, 159, _nextMonkeySequenceId, 159, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = kAS29LeaveScene; + gnap._actionStatus = kAS29LeaveScene; _currMonkeySequenceId = 0xE6; _nextMonkeySequenceId = -1; _vm->_timers[5] = 30; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 871177b3d3..c0050c1567 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -46,6 +46,8 @@ void Scene30::updateHotspots() { void Scene30::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + bool hasTakenPill = false; _vm->playSound(0x1093B, true); @@ -64,10 +66,10 @@ void Scene30::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; _kidSequenceId = 0x101; - _vm->_gnap->initPos(7, 12, kDirBottomRight); + gnap.initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); while (!_vm->_sceneDone) { @@ -79,32 +81,32 @@ void Scene30::run() { switch (_vm->_sceneClickedHotspot) { case kHS30Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS30Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -112,27 +114,27 @@ void Scene30::run() { break; case kHS30PillMachine: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole && !_vm->isFlag(kGFUnk23)) { _vm->_hotspots[kHS30WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine], 0, 0x107BC, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine], 0, 0x107BC, 1); _vm->_hotspots[kHS30WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS30UsePillMachine; + gnap._actionStatus = kAS30UsePillMachine; hasTakenPill = true; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(Common::Point(9, 8), 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS30LookPillMachine; + gnap.walkTo(Common::Point(9, 8), 0, 0x107BC, 1); + gnap._actionStatus = kAS30LookPillMachine; break; case GRAB_CURSOR: - _vm->_gnap->playScratchingHead(8, 5); + gnap.playScratchingHead(8, 5); break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(8, 5); + gnap.playImpossible(8, 5); break; } } @@ -140,26 +142,26 @@ void Scene30::run() { break; case kHS30ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; if (hasTakenPill) _vm->_newSceneNum = 47; else _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS30LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS30LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus] + Common::Point(1, 0), -1, 0x107C2, 1); } break; case kHS30WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -172,11 +174,11 @@ void Scene30::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(5) == 1) { gameSys.insertSequence(0xFF, 40, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x100, 40, _kidSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -188,7 +190,7 @@ void Scene30::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (!_vm->isFlag(kGFUnk23) || hasTakenPill) gameSys.insertSequence(0x109, 20, 0, 0, kSeqNone, 0, 0, 0); else @@ -212,57 +214,58 @@ void Scene30::run() { void Scene30::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS30LeaveScene: _vm->_sceneDone = true; break; case kAS30UsePillMachine: _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x105, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x105, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x105; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS30UsePillMachine2; + gameSys.setAnimation(0x105, gnap._id, 0); + gameSys.insertSequence(0x105, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x105; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS30UsePillMachine2; break; case kAS30UsePillMachine2: _vm->hideCursor(); _vm->setGrabCursorSprite(-1); _vm->addFullScreenSprite(0x3F, 255); - gameSys.removeSequence(0x105, _vm->_gnap->_id, true); + gameSys.removeSequence(0x105, gnap._id, true); gameSys.setAnimation(0x102, 256, 0); gameSys.insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x103, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x103, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x103, gnap._id, 0); + gameSys.insertSequence(0x103, gnap._id, 0, 0, kSeqNone, 0, 0, 0); _vm->removeFullScreenSprite(); _vm->showCursor(); - _vm->_gnap->_actionStatus = kAS30UsePillMachine3; + gnap._actionStatus = kAS30UsePillMachine3; _vm->invAdd(kItemPill); _vm->setFlag(kGFUnk23); break; case kAS30UsePillMachine3: - gameSys.setAnimation(0x104, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x104, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, 0x103), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x104; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_actionStatus = kAS30UsePillMachine4; + gameSys.setAnimation(0x104, gnap._id, 0); + gameSys.insertSequence(0x104, gnap._id, makeRid(gnap._sequenceDatNum, 0x103), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x104; + gnap._sequenceDatNum = 0; + gnap._actionStatus = kAS30UsePillMachine4; _vm->setGrabCursorSprite(kItemDiceQuarterHole); break; case kAS30UsePillMachine4: gameSys.insertSequence(0x106, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine] + Common::Point(0, 1), -1, 0x107BC, 1); - _vm->_gnap->_actionStatus = -1; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS30PillMachine] + Common::Point(0, 1), -1, 0x107BC, 1); + gnap._actionStatus = -1; break; case kAS30LookPillMachine: if (_vm->isFlag(kGFUnk23)) _vm->showFullScreenSprite(0xE3); else _vm->showFullScreenSprite(0xE2); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -295,6 +298,7 @@ void Scene31::updateHotspots() { void Scene31::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); @@ -312,16 +316,16 @@ void Scene31::run() { _vm->_timers[5] = _vm->getRandom(50) + 180; if (_vm->_prevSceneNum == 27) { - _vm->_gnap->initPos(-1, 8, kDirBottomLeft); + gnap.initPos(-1, 8, kDirBottomLeft); _vm->_plat->initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(3, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(3, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(7, 12, kDirBottomRight); + gnap.initPos(7, 12, kDirBottomRight); _vm->_plat->initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(7, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(7, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107D2, 1); } @@ -334,32 +338,32 @@ void Scene31::run() { switch (_vm->_sceneClickedHotspot) { case kHS31Device: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { _vm->runMenu(); updateHotspots(); } break; case kHS31Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemJoint) { - _vm->_gnap->useJointOnPlatypus(); + gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -367,42 +371,42 @@ void Scene31::run() { break; case kHS31MeasuringClown: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { - if (_vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus == kAS31PlatMeasuringClown) { if (_vm->_verbCursor == LOOK_CURSOR) - _vm->_gnap->playScratchingHead(2, 2); + gnap.playScratchingHead(2, 2); else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(2, 2); + gnap.playScratchingHead(2, 2); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 0, 0x107B9, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 0, 0x107B9, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_gnap->_actionStatus = kAS31UseMeasuringClown; + gnap._actionStatus = kAS31UseMeasuringClown; _vm->_timers[4] = 300; break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; _vm->_plat->_actionStatus = kAS31PlatMeasuringClown; - _vm->_gnap->_actionStatus = kAS31PlatMeasuringClown; + gnap._actionStatus = kAS31PlatMeasuringClown; _vm->_timers[4] = 300; } else - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -410,36 +414,36 @@ void Scene31::run() { break; case kHS31BeerBarrel: - if (_vm->_gnap->_actionStatus < 0 || _vm->_gnap->_actionStatus == kAS31PlatMeasuringClown) { + if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); - _vm->_gnap->walkTo(_vm->_gnap->_pos, -1, _vm->_gnap->getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); + gnap.walkTo(gnap._pos, -1, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->playPullOutDevice(6, 8); - _vm->_gnap->playUseDevice(0, 0); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeer; + gnap.playPullOutDevice(6, 8); + gnap.playUseDevice(0, 0); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); + gnap._actionStatus = kAS31FillEmptyBucketWithBeer; _vm->_timers[4] = 300; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); break; case GRAB_CURSOR: if (_beerGuyDistracted) { - _vm->_gnap->playScratchingHead(6, 2); + gnap.playScratchingHead(6, 2); } else { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS31UseBeerBarrel; - _vm->_gnap->_idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); + gnap._actionStatus = kAS31UseBeerBarrel; + gnap._idleFacing = kDirUpLeft; } break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -447,33 +451,33 @@ void Scene31::run() { break; case kHS31ExitCircus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 26; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS31LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS31LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; case kHS31ExitOutsideClown: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_newSceneNum = 27; - _vm->_gnap->walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS31LeaveScene; + gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); + gnap._actionStatus = kAS31LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown] + Common::Point(0, 1), -1, 0x107CF, 1); } break; case kHS31WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -487,11 +491,11 @@ void Scene31::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 60; - if (_vm->_gnap->_actionStatus < 0 && _nextClerkSequenceId == -1) { + if (gnap._actionStatus < 0 && _nextClerkSequenceId == -1) { switch (_vm->getRandom(6)){ case 0: _nextClerkSequenceId = 0xFF; @@ -510,7 +514,7 @@ void Scene31::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 180; - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->getRandom(2) != 0) gameSys.insertSequence(0x104, 20, 0, 0, kSeqNone, 0, 0, 0); else @@ -534,28 +538,29 @@ void Scene31::run() { void Scene31::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS31UseBeerBarrel: _nextClerkSequenceId = 0xFE; break; case kAS31FillEmptyBucketWithBeer: gameSys.setAnimation(0x102, 59, 0); - gameSys.insertSequence(0x102, 59, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_pos = Common::Point(5, 7); - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_sequenceId = 0x102; - _vm->_gnap->_id = 59; - _vm->_gnap->_actionStatus = kAS31FillEmptyBucketWithBeerDone; + gameSys.insertSequence(0x102, 59, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._pos = Common::Point(5, 7); + gnap._sequenceDatNum = 0; + gnap._sequenceId = 0x102; + gnap._id = 59; + gnap._actionStatus = kAS31FillEmptyBucketWithBeerDone; break; case kAS31FillEmptyBucketWithBeerDone: - _vm->_gnap->_idleFacing = kDirBottomLeft; - _vm->_gnap->playPullOutDevice(0, 0); - _vm->_gnap->playUseDevice(0, 0); + gnap._idleFacing = kDirBottomLeft; + gnap.playPullOutDevice(0, 0); + gnap.playUseDevice(0, 0); gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->invAdd(kItemBucketWithBeer); _vm->invRemove(kItemEmptyBucket); _vm->setGrabCursorSprite(kItemBucketWithBeer); @@ -566,7 +571,7 @@ void Scene31::updateAnimations() { break; case kAS31LeaveScene: _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -593,14 +598,14 @@ void Scene31::updateAnimations() { case 0xFC: ++_clerkMeasureCtr; if (_clerkMeasureCtr >= _clerkMeasureMaxCtr) { - if (_vm->_gnap->_actionStatus != 5) + if (gnap._actionStatus != 5) _vm->_plat->_actionStatus = -1; _vm->_timers[0] = 40; gameSys.insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = 0xFD; _nextClerkSequenceId = -1; - if (_vm->_gnap->_actionStatus != kAS31FillEmptyBucketWithBeerDone && _vm->_gnap->_actionStatus != kAS31FillEmptyBucketWithBeer) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus != kAS31FillEmptyBucketWithBeerDone && gnap._actionStatus != kAS31FillEmptyBucketWithBeer) + gnap._actionStatus = -1; _beerGuyDistracted = false; _clerkMeasureMaxCtr = 3; gameSys.setAnimation(0xFD, 39, 3); @@ -617,7 +622,7 @@ void Scene31::updateAnimations() { gameSys.setAnimation(_nextClerkSequenceId, 39, 3); _currClerkSequenceId = _nextClerkSequenceId; _nextClerkSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; default: if (_nextClerkSequenceId != -1) { @@ -657,6 +662,7 @@ void Scene32::updateHotspots() { void Scene32::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); @@ -664,13 +670,13 @@ void Scene32::run() { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->_prevSceneNum == 33) { - _vm->_gnap->initPos(11, 6, kDirBottomLeft); + gnap.initPos(11, 6, kDirBottomLeft); _vm->_plat->initPos(12, 6, kDirUnk4); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107D2, 1); - _vm->_gnap->walkTo(Common::Point(8, 6), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 6), -1, 0x107BA, 1); } else { - _vm->_gnap->initPos(1, 6, kDirBottomRight); + gnap.initPos(1, 6, kDirBottomRight); _vm->_plat->initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -685,30 +691,30 @@ void Scene32::run() { switch (_vm->_sceneClickedHotspot) { case kHS32Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS32Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -716,11 +722,11 @@ void Scene32::run() { break; case kHS32ExitTruck: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS32LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); + gnap._actionStatus = kAS32LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 33; } @@ -734,14 +740,14 @@ void Scene32::run() { case kHS32WalkArea6: case kHS32WalkArea7: case kHS32WalkArea8: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = 0; } @@ -753,8 +759,8 @@ void Scene32::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) @@ -812,6 +818,7 @@ void Scene33::updateHotspots() { void Scene33::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); @@ -826,26 +833,26 @@ void Scene33::run() { switch (_vm->_prevSceneNum) { case 34: - _vm->_gnap->initPos(11, 7, kDirBottomLeft); + gnap.initPos(11, 7, kDirBottomLeft); _vm->_plat->initPos(12, 7, kDirUnk4); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 7), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 7), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); break; case 37: - _vm->_gnap->initPos(7, 7, kDirBottomRight); + gnap.initPos(7, 7, kDirBottomRight); _vm->_plat->initPos(8, 7, kDirNone); _vm->endSceneInit(); break; case 32: - _vm->_gnap->initPos(-1, 6, kDirBottomRight); + gnap.initPos(-1, 6, kDirBottomRight); _vm->_plat->initPos(-1, 7, kDirNone); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; default: - _vm->_gnap->initPos(3, 7, kDirBottomRight); + gnap.initPos(3, 7, kDirBottomRight); _vm->_plat->initPos(2, 7, kDirNone); _vm->endSceneInit(); break; @@ -861,30 +868,30 @@ void Scene33::run() { switch (_vm->_sceneClickedHotspot) { case kHS33Device: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; case kHS33Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -892,26 +899,26 @@ void Scene33::run() { break; case kHS33Chicken: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 9, 9, 8); + gnap.playShowCurrItem(7, 9, 9, 8); } else { switch (_vm->_verbCursor) { case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - if (_vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) - _vm->_gnap->_actionStatus = kAS33UseChicken; + gnap._idleFacing = kDirBottomRight; + if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + gnap._actionStatus = kAS33UseChicken; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirBottomRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS33TalkChicken; + gnap._idleFacing = kDirBottomRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -919,44 +926,44 @@ void Scene33::run() { break; case kHS33ExitHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap._actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 37; - if (_vm->_gnap->_pos.x > 6) - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); + if (gnap._pos.x > 6) + gnap.walkTo(gnap._pos, 0, 0x107AD, 1); else - _vm->_gnap->walkTo(Common::Point(6, 7), 0, 0x107B1, 1); + gnap.walkTo(Common::Point(6, 7), 0, 0x107B1, 1); } break; case kHS33ExitBarn: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap._actionStatus = kAS33LeaveScene; _vm->_newSceneNum = 35; - if (_vm->_gnap->_pos.x > 7) - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AD, 1); + if (gnap._pos.x > 7) + gnap.walkTo(gnap._pos, 0, 0x107AD, 1); else - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107B1, 1); + gnap.walkTo(Common::Point(7, 7), 0, 0x107B1, 1); } break; case kHS33ExitCreek: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); + gnap._actionStatus = kAS33LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], -1, 0x107CD, 1); _vm->_newSceneNum = 34; } break; case kHS33ExitPigpen: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS33LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); + gnap._actionStatus = kAS33LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], -1, 0x107CF, 1); _vm->_newSceneNum = 32; } @@ -964,13 +971,13 @@ void Scene33::run() { case kHS33WalkArea1: case kHS33WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -984,8 +991,8 @@ void Scene33::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 300; if (_vm->getRandom(2) != 0) @@ -993,7 +1000,7 @@ void Scene33::run() { else gameSys.insertSequence(0x82, 256, 0, 0, kSeqNone, 0, 0, 0); } - if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && _vm->_gnap->_actionStatus != kAS33TalkChicken && _vm->_gnap->_actionStatus != kAS33UseChicken) { + if (!_vm->_timers[5] && _nextChickenSequenceId == -1 && gnap._actionStatus != kAS33TalkChicken && gnap._actionStatus != kAS33UseChicken) { if (_vm->getRandom(6) != 0) { _nextChickenSequenceId = 0x7E; _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -1018,9 +1025,10 @@ void Scene33::run() { void Scene33::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS33LeaveScene: _vm->_sceneDone = true; break; @@ -1032,17 +1040,17 @@ void Scene33::updateAnimations() { _vm->_timers[2] = 100; break; case kAS33UseChickenDone: - gameSys.insertSequence(0x107B5, _vm->_gnap->_id, 0x81, 179, kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceId = 0x7B5; - _vm->_gnap->_sequenceDatNum = 1; + gameSys.insertSequence(0x107B5, gnap._id, 0x81, 179, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceId = 0x7B5; + gnap._sequenceDatNum = 1; _currChickenSequenceId = 0x7E; gameSys.setAnimation(0x7E, 179, 2); gameSys.insertSequence(_currChickenSequenceId, 179, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_timers[5] = 30; break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1050,18 +1058,18 @@ void Scene33::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextChickenSequenceId == 0x81) { gameSys.setAnimation(_nextChickenSequenceId, 179, 0); - gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextChickenSequenceId, 179, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.removeSequence(_currChickenSequenceId, 179, true); _nextChickenSequenceId = -1; _currChickenSequenceId = -1; - _vm->_gnap->_actionStatus = kAS33UseChickenDone; + gnap._actionStatus = kAS33UseChickenDone; _vm->_timers[5] = 500; } else if (_nextChickenSequenceId == 0x7F) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); _currChickenSequenceId = _nextChickenSequenceId; _nextChickenSequenceId = -1; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_nextChickenSequenceId != -1) { gameSys.setAnimation(_nextChickenSequenceId, 179, 2); gameSys.insertSequence(_nextChickenSequenceId, 179, _currChickenSequenceId, 179, kSeqSyncWait, 0, 0, 0); @@ -1085,6 +1093,8 @@ int Scene38::init() { } void Scene38::updateHotspots() { + PlayerGnap& gnap = *_vm->_gnap; + _vm->setHotspot(kHS38Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); _vm->setHotspot(kHS38ExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); _vm->setHotspot(kHS38ExitCave, 430, 440, 655, 470, SF_WALKABLE, 0, 8); @@ -1102,15 +1112,15 @@ void Scene38::updateHotspots() { _vm->_hotspots[kHS38Platypus]._flags = SF_WALKABLE | SF_DISABLED; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; - else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_DISABLED; - else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_DISABLED; - else if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) + else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38WalkArea6]._flags = SF_NONE; @@ -1118,14 +1128,16 @@ void Scene38::updateHotspots() { } void Scene38::run() { + PlayerGnap& gnap = *_vm->_gnap; + _vm->queueInsertDeviceIcon(); _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 39) { - _vm->_gnap->initPos(3, 7, kDirBottomLeft); + gnap.initPos(3, 7, kDirBottomLeft); _vm->_plat->initPos(4, 7, kDirUnk4); } else { - _vm->_gnap->initPos(3, 8, kDirBottomRight); + gnap.initPos(3, 8, kDirBottomRight); _vm->_plat->initPos(4, 8, kDirNone); } _vm->endSceneInit(); @@ -1144,87 +1156,87 @@ void Scene38::run() { break; case kHS38Platypus: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { + gnap._actionStatus = kAS38ReleaseHuntingTrophy; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } break; case kHS38ExitHouse: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { + gnap._actionStatus = kAS38ReleaseHuntingTrophy; } else { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(-1, -1), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS38LeaveScene; + gnap.walkTo(Common::Point(-1, -1), 0, 0x107AE, 1); + gnap._actionStatus = kAS38LeaveScene; _vm->_newSceneNum = 37; } break; case kHS38ExitCave: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { + gnap._actionStatus = kAS38ReleaseHuntingTrophy; if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_isLeavingScene = true; } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { _vm->_sceneWaiting = false; _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(5, 7), 0, 0x107BB, 1); + gnap.walkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; - _vm->_gnap->_actionStatus = kAS38ExitCave; + gnap._actionStatus = kAS38ExitCave; } break; case kHS38TrapDoorLid1: case kHS38TrapDoorLid2: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) { + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { if (_vm->_verbCursor == PLAT_CURSOR && _vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) - _vm->_gnap->_actionStatus = kAS38UsePlatypusWithTrapDoor; + gnap._actionStatus = kAS38UsePlatypusWithTrapDoor; else - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; + gnap._actionStatus = kAS38ReleaseHuntingTrophy; } break; case kHS38HuntingTrophy: - if (_vm->_gnap->_actionStatus != kAS38HoldingHuntingTrophy) { + if (gnap._actionStatus != kAS38HoldingHuntingTrophy) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 6, 2, 0); + gnap.playShowCurrItem(3, 6, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case GRAB_CURSOR: if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); else { - _vm->_gnap->walkTo(Common::Point(3, 6), 0, 0x107BB, 1); + gnap.walkTo(Common::Point(3, 6), 0, 0x107BB, 1); _vm->_plat->walkTo(Common::Point(4, 8), -1, -1, 1); - _vm->_gnap->_actionStatus = kAS38UseHuntingTrophy; + gnap._actionStatus = kAS38UseHuntingTrophy; } break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(2, 0); + gnap.playBrainPulsating(2, 0); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1240,18 +1252,18 @@ void Scene38::run() { case kHS38WalkArea4: case kHS38WalkArea5: case kHS38WalkArea6: - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; - else if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) + gnap._actionStatus = kAS38ReleaseHuntingTrophy; + else if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: if (_vm->_mouseClickState._left) { - if (_vm->_gnap->_actionStatus == kAS38HoldingHuntingTrophy) - _vm->_gnap->_actionStatus = kAS38ReleaseHuntingTrophy; - else if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus == kAS38HoldingHuntingTrophy) + gnap._actionStatus = kAS38ReleaseHuntingTrophy; + else if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1261,7 +1273,7 @@ void Scene38::run() { if (!_vm->_isLeavingScene) { _vm->_plat->updateIdleSequence(); - _vm->_gnap->updateIdleSequence(); + gnap.updateIdleSequence(); } _vm->checkGameKeys(); @@ -1278,89 +1290,90 @@ void Scene38::run() { void Scene38::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS38LeaveScene: _vm->_sceneDone = true; break; case kAS38ExitCave: gameSys.removeSequence(_vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, true); - gameSys.insertSequence(0xA3, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA3; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0xA3, _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS38LeaveScene; + gameSys.insertSequence(0xA3, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA3; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0xA3, gnap._id, 0); + gnap._actionStatus = kAS38LeaveScene; break; case kAS38UseHuntingTrophy: gameSys.removeSequence(0x9B, 0, true); - gameSys.insertSequence(0x9C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9C; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x9C, _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; + gameSys.insertSequence(0x9C, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9C; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x9C, gnap._id, 0); + gnap._actionStatus = kAS38HoldingHuntingTrophy; updateHotspots(); break; case kAS38HoldingHuntingTrophy: if (_vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) _vm->_sceneWaiting = true; - if (_vm->_gnap->_sequenceId == 0xA4) { - gameSys.insertSequence(0x9D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9D; + if (gnap._sequenceId == 0xA4) { + gameSys.insertSequence(0x9D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9D; } else { - gameSys.insertSequence(0xA4, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA4; + gameSys.insertSequence(0xA4, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA4; } - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(_vm->_gnap->_sequenceId, _vm->_gnap->_id, 0); + gnap._sequenceDatNum = 0; + gameSys.setAnimation(gnap._sequenceId, gnap._id, 0); break; case kAS38ReleaseHuntingTrophy: - if (_vm->_gnap->_sequenceId == 0x9E) { + if (gnap._sequenceId == 0x9E) { gameSys.insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { - gameSys.insertSequence(0xA0, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0xA0; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(3, 6); - _vm->_gnap->_idleFacing = kDirBottomRight; + gameSys.insertSequence(0xA0, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0xA0; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(3, 6); + gnap._idleFacing = kDirBottomRight; if (_vm->_isLeavingScene) { _vm->_sceneWaiting = false; - _vm->_gnap->walkTo(Common::Point(5, 7), 0, 0x107BB, 1); + gnap.walkTo(Common::Point(5, 7), 0, 0x107BB, 1); _vm->_newSceneNum = 39; - _vm->_gnap->_actionStatus = kAS38ExitCave; + gnap._actionStatus = kAS38ExitCave; } else { - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } else { - gameSys.insertSequence(0x9E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_pos = Common::Point(3, 6); - _vm->_gnap->_idleFacing = kDirBottomRight; - gameSys.setAnimation(0x9E, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x9E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9E; + gnap._sequenceDatNum = 0; + gnap._pos = Common::Point(3, 6); + gnap._idleFacing = kDirBottomRight; + gameSys.setAnimation(0x9E, gnap._id, 0); _vm->_sceneWaiting = false; updateHotspots(); } break; case kAS38UsePlatypusWithTrapDoor: _vm->_sceneWaiting = false; - gameSys.insertSequence(0x9F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9F; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x9F, _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS38HoldingHuntingTrophy; + gameSys.insertSequence(0x9F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9F; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x9F, gnap._id, 0); + gnap._actionStatus = kAS38HoldingHuntingTrophy; if (_vm->_plat->_idleFacing != kDirNone) _vm->_plat->playSequence(0x107D5); else _vm->_plat->playSequence(0x107D4); _vm->_plat->walkTo(Common::Point(8, 7), -1, 0x107D2, 1); - gameSys.insertSequence(0xA1, _vm->_gnap->_id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xA1, gnap._id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); _vm->_plat->_sequenceId = 0xA1; _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_id = _vm->_gnap->_id + 1; - gameSys.setAnimation(0xA1, _vm->_gnap->_id + 1, 1); + _vm->_plat->_id = gnap._id + 1; + gameSys.setAnimation(0xA1, gnap._id + 1, 1); _vm->_plat->_actionStatus = kAS38PlatypusHoldingTrapDoor; updateHotspots(); break; @@ -1407,6 +1420,7 @@ void Scene39::updateHotspots() { void Scene39::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; // Bug in the original? Timer was never initialized. _vm->_timers[5] = 0; @@ -1420,11 +1434,11 @@ void Scene39::run() { _nextGuySequenceId = -1; if (_vm->_prevSceneNum == 38) { - _vm->_gnap->initPos(3, 7, kDirUpRight); + gnap.initPos(3, 7, kDirUpRight); _vm->_plat->initPos(2, 7, kDirUpLeft); _vm->endSceneInit(); } else { - _vm->_gnap->initPos(4, 7, kDirBottomRight); + gnap.initPos(4, 7, kDirBottomRight); _vm->_plat->initPos(5, 7, kDirNone); _vm->endSceneInit(); } @@ -1451,23 +1465,23 @@ void Scene39::run() { break; case kHS39Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1475,30 +1489,30 @@ void Scene39::run() { break; case kHS39ExitUfoParty: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnap->walkTo(_vm->_gnap->_pos, 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS39LeaveScene; + gnap.walkTo(gnap._pos, 0, 0x107AB, 1); + gnap._actionStatus = kAS39LeaveScene; _vm->_newSceneNum = 40; } break; case kHS39Sign: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); - _vm->_gnap->playIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); + gnap.playIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); _vm->showFullScreenSprite(0x1C); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1506,7 +1520,7 @@ void Scene39::run() { break; case kHS39ExitInsideHouse: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_sceneDone = true; _vm->_isLeavingScene = true; _vm->_newSceneNum = 38; @@ -1515,13 +1529,13 @@ void Scene39::run() { case kHS39WalkArea1: case kHS39WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); _vm->_mouseClickState._left = false; } break; @@ -1532,8 +1546,8 @@ void Scene39::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0) + gnap.updateIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 50; switch (_vm->getRandom(4)) { @@ -1568,13 +1582,14 @@ void Scene39::run() { void Scene39::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus == kAS39LeaveScene) + if (gnap._actionStatus == kAS39LeaveScene) _vm->_sceneDone = true; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextGuySequenceId != -1) { diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 44a99f9f90..154f837ea1 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -52,6 +52,8 @@ void Scene40::updateHotspots() { } void Scene40::run() { + PlayerGnap& gnap = *_vm->_gnap; + _vm->queueInsertDeviceIcon(); _vm->endSceneInit(); @@ -74,23 +76,23 @@ void Scene40::run() { break; case kHS40Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -98,56 +100,56 @@ void Scene40::run() { break; case kHS40ExitCave: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 39; _vm->_sceneDone = true; } break; case kHS40ExitToyStand: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 41; _vm->_sceneDone = true; } break; case kHS40ExitBBQ: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 42; _vm->_sceneDone = true; } break; case kHS40ExitUfo: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 43; _vm->_sceneDone = true; } break; case kHS40ExitKissinBooth: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 44; _vm->_sceneDone = true; } break; case kHS40ExitDancefloor: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 45; _vm->_sceneDone = true; } break; case kHS40ExitShoe: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_newSceneNum = 46; _vm->_sceneDone = true; } break; default: - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) _vm->_mouseClickState._left = false; break; @@ -168,11 +170,12 @@ void Scene40::run() { void Scene40::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - if (_vm->_gnap->_actionStatus) - _vm->_gnap->_actionStatus = -1; + if (gnap._actionStatus) + gnap._actionStatus = -1; else _vm->_sceneDone = true; } @@ -220,6 +223,7 @@ void Scene41::updateHotspots() { void Scene41::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -228,7 +232,7 @@ void Scene41::run() { if (_vm->_toyUfoY < 0 || _vm->_toyUfoY > 300) _vm->_toyUfoY = 150; if (!_vm->_timers[9]) - _vm->_gnap->_actionStatus = kAS41GiveBackToyUfo; + gnap._actionStatus = kAS41GiveBackToyUfo; } else { if (!_vm->isFlag(kGFUnk16) && !_vm->isFlag(kGFJointTaken) && !_vm->isFlag(kGFUnk18) && !_vm->isFlag(kGFGroceryStoreHatTaken)) _vm->toyUfoSetStatus(kGFUnk16); @@ -263,29 +267,29 @@ void Scene41::run() { gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_gnap->_sequenceId = 0x120; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_pos = Common::Point(7, 7); - _vm->_gnap->_id = 140; + gnap._sequenceId = 0x120; + gnap._sequenceDatNum = 0; + gnap._idleFacing = kDirUpRight; + gnap._pos = Common::Point(7, 7); + gnap._id = 140; gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); _vm->_plat->initPos(8, 10, kDirBottomLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 45) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-2, 8, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 42) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(5, 8, kDirBottomRight); + gnap.initPos(5, 8, kDirBottomRight); _vm->_plat->initPos(6, 8, kDirBottomLeft); _vm->endSceneInit(); } @@ -349,23 +353,23 @@ void Scene41::run() { break; case kHS41Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -374,49 +378,49 @@ void Scene41::run() { case kHS41ExitCave: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS41ExitCave], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS41LeaveScene; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS41ExitCave], 0, 0x107AE, 1); + gnap._actionStatus = kAS41LeaveScene; _vm->_newSceneNum = 40; break; case kHS41Exit: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS41LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); + gnap._actionStatus = kAS41LeaveScene; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), -1, 0x107CF, 1); _vm->_newSceneNum = 45; break; case kHS41ExitBBQ: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS41LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); + gnap._actionStatus = kAS41LeaveScene; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), -1, 0x107CD, 1); _vm->_newSceneNum = 42; break; case kHS41ToyVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->_actionStatus = kAS41UseQuarterWithToyVendor; - _vm->_gnap->walkTo(Common::Point(4, 7), 0, 0x107BB, 9); - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + gnap._actionStatus = kAS41UseQuarterWithToyVendor; + gnap.walkTo(Common::Point(4, 7), 0, 0x107BB, 9); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(4, 7, 5, 0); + gnap.playShowCurrItem(4, 7, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(5, 0); + gnap.playMoan1(5, 0); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(4, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS41TalkToyVendor; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -424,27 +428,27 @@ void Scene41::run() { case kHS41Kid: if (_vm->_grabCursorSpriteIndex == kItemChickenBucket) { - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS41UseChickenBucketWithKid; + gnap.walkTo(Common::Point(7, 7), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(7, 7, 8, 0); + gnap.playShowCurrItem(7, 7, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(9, 0); + gnap.playScratchingHead(9, 0); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(Common::Point(7, 7), 0, 0x107BB, 1); - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->_actionStatus = kAS41GrabKid; + gnap.walkTo(Common::Point(7, 7), 0, 0x107BB, 1); + gnap._idleFacing = kDirUpRight; + gnap._actionStatus = kAS41GrabKid; break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(7, 7), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(7, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -452,58 +456,58 @@ void Scene41::run() { case kHS41ToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { - _vm->_gnap->playPullOutDevice(9, 0); - gameSys.setAnimation(makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, 0); - _vm->_gnap->_actionStatus = kAS41UseGumWithToyUfo; + gnap.playPullOutDevice(9, 0); + gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); + gnap._actionStatus = kAS41UseGumWithToyUfo; } break; case kHS41WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } if (_vm->isFlag(kGFGnapControlsToyUFO)) { - if (!_vm->_timers[9] && _vm->_gnap->_actionStatus < 0) { - _vm->_gnap->_actionStatus = kAS41GiveBackToyUfo; - if (_vm->_gnap->_sequenceId == 0x121 || _vm->_gnap->_sequenceId == 0x122) { - gameSys.insertSequence(0x123, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x123; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x123, _vm->_gnap->_id, 0); + if (!_vm->_timers[9] && gnap._actionStatus < 0) { + gnap._actionStatus = kAS41GiveBackToyUfo; + if (gnap._sequenceId == 0x121 || gnap._sequenceId == 0x122) { + gameSys.insertSequence(0x123, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x123; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x123, gnap._id, 0); } } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { int sequenceId; if (_vm->_leftClickMouseX >= 400) { - if (_vm->_gnap->_sequenceId == 0x11F || _vm->_gnap->_sequenceId == 0x120 || _vm->_gnap->_sequenceId == 0x123 || _vm->_gnap->_sequenceId == 0x126) + if (gnap._sequenceId == 0x11F || gnap._sequenceId == 0x120 || gnap._sequenceId == 0x123 || gnap._sequenceId == 0x126) sequenceId = 0x120; else if (_vm->_leftClickMouseX - _vm->_toyUfoX >= 400) sequenceId = 0x126; else sequenceId = 0x123; } else { - if (_vm->_gnap->_sequenceId == 0x121 || _vm->_gnap->_sequenceId == 0x125 || _vm->_gnap->_sequenceId == 0x122) + if (gnap._sequenceId == 0x121 || gnap._sequenceId == 0x125 || gnap._sequenceId == 0x122) sequenceId = 0x122; else if (_vm->_toyUfoX - _vm->_leftClickMouseX >= 400) sequenceId = 0x125; else sequenceId = 0x121; } - gameSys.insertSequence(sequenceId, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = sequenceId; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(sequenceId, _vm->_gnap->_id, 0); + gameSys.insertSequence(sequenceId, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = sequenceId; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(sequenceId, gnap._id, 0); _vm->_toyUfoActionStatus = kAS41ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -512,11 +516,11 @@ void Scene41::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { switch (_vm->getRandom(3)) { case 0: _nextToyVendorSequenceId = 0x113; @@ -534,7 +538,7 @@ void Scene41::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { if (_vm->isFlag(kGFGnapControlsToyUFO)) _nextKidSequenceId = 0x11B; else if (_vm->getRandom(3) != 0) @@ -560,28 +564,29 @@ void Scene41::run() { void Scene41::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS41LeaveScene: gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS41UseQuarterWithToyVendor: gameSys.setAnimation(0, 0, 0); _nextToyVendorSequenceId = 0x114; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS41TalkToyVendor: gameSys.setAnimation(0, 0, 0); _nextToyVendorSequenceId = 0x116; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; case kAS41UseGumWithToyUfo: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->playUseDevice(9, 0); - _vm->_gnap->_actionStatus = -1; + gnap.playUseDevice(9, 0); + gnap._actionStatus = -1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemGum); _vm->_toyUfoActionStatus = kAS41UfoGumAttached; @@ -591,17 +596,17 @@ void Scene41::updateAnimations() { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; _vm->setGrabCursorSprite(-1); - gameSys.insertSequence(0x11F, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x11F; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x11F, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x11F, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x11F; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x11F, gnap._id, 0); _nextKidSequenceId = 0x11A; gameSys.insertSequence(0x11A, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextKidSequenceId, 1, 4); _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = 0x11B; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->setFlag(kGFGnapControlsToyUFO); updateHotspots(); _vm->_timers[9] = 600; @@ -611,10 +616,10 @@ void Scene41::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x110, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x110; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x110, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x110, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x110; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x110, gnap._id, 0); _nextToyVendorSequenceId = 0x111; gameSys.insertSequence(0x111, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); @@ -627,19 +632,19 @@ void Scene41::updateAnimations() { _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } break; case kAS41GiveBackToyUfo: if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x124, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.insertSequence(0x124, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x124; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x124, _vm->_gnap->_id, 0); + gnap._sequenceId = 0x124; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x124, gnap._id, 0); _nextToyVendorSequenceId = 0x112; gameSys.insertSequence(0x112, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); @@ -652,7 +657,7 @@ void Scene41::updateAnimations() { _currKidSequenceId = _nextKidSequenceId; _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->clearFlag(kGFGnapControlsToyUFO); updateHotspots(); } @@ -750,6 +755,7 @@ void Scene42::updateHotspots() { void Scene42::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -785,22 +791,22 @@ void Scene42::run() { if (_vm->_toyUfoSequenceId == 0x872) _vm->setGrabCursorSprite(-1); } else if (_vm->_prevSceneNum == 41) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 43) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } @@ -861,23 +867,23 @@ void Scene42::run() { break; case kHS42Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -886,49 +892,49 @@ void Scene42::run() { case kHS42ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = kAS42LeaveScene; + gnap.walkTo(Common::Point(gnap._pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); + gnap._actionStatus = kAS42LeaveScene; _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; case kHS42ExitToyStand: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = kAS42LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = kAS42LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand], -1, 0x107CF, 1); _vm->_newSceneNum = 41; break; case kHS42ExitUfo: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = kAS42LeaveScene; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = kAS42LeaveScene; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo], -1, 0x107CD, 1); _vm->_newSceneNum = 43; break; case kHS42BBQVendor: if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); - _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendor; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); + gnap._actionStatus = kAS42UseQuarterWithBBQVendor; if (_vm->_plat->_pos.y < 9) _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, 9), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = kAS42TalkBBQVendor; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -936,19 +942,19 @@ void Scene42::run() { case kHS42ChickenLeg: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); break; case GRAB_CURSOR: - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); - _vm->_gnap->_actionStatus = kAS42GrabChickenLeg; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); + gnap._actionStatus = kAS42GrabChickenLeg; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -956,20 +962,20 @@ void Scene42::run() { case kHS42WalkArea1: case kHS42WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = kAS42ToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -980,11 +986,11 @@ void Scene42::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 30; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextBBQVendorSequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextBBQVendorSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: _nextBBQVendorSequenceId = 0x14C; @@ -1024,24 +1030,25 @@ void Scene42::run() { void Scene42::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case kAS42LeaveScene: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _vm->_sceneDone = true; break; case kAS42TalkBBQVendor: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; _nextBBQVendorSequenceId = 0x14B; break; case kAS42UseQuarterWithBBQVendor: case kAS42GrabChickenLeg: if (gameSys.getAnimationStatus(2) == 2) { int sequenceId; - if (_vm->_gnap->_actionStatus == kAS42UseQuarterWithBBQVendor) { + if (gnap._actionStatus == kAS42UseQuarterWithBBQVendor) { _vm->invRemove(kItemDiceQuarterHole); _vm->invAdd(kItemChickenBucket); _vm->setGrabCursorSprite(-1); @@ -1062,23 +1069,23 @@ void Scene42::updateAnimations() { _nextBBQVendorSequenceId = 0x146; } if (sequenceId == 0x7B7) { - gameSys.insertSequence(0x107B7, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.insertSequence(0x107B7, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), - 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); - _vm->_gnap->_sequenceDatNum = 1; + 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); + gnap._sequenceDatNum = 1; } else { - gameSys.insertSequence(sequenceId, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, + gameSys.insertSequence(sequenceId, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceDatNum = 0; } - _vm->_gnap->_sequenceId = sequenceId; - gameSys.setAnimation(sequenceId | (_vm->_gnap->_sequenceDatNum << 16), _vm->_gnap->_id, 0); - if (_vm->_gnap->_actionStatus == kAS42UseQuarterWithBBQVendor) - _vm->_gnap->_actionStatus = kAS42UseQuarterWithBBQVendorDone; + gnap._sequenceId = sequenceId; + gameSys.setAnimation(sequenceId | (gnap._sequenceDatNum << 16), gnap._id, 0); + if (gnap._actionStatus == kAS42UseQuarterWithBBQVendor) + gnap._actionStatus = kAS42UseQuarterWithBBQVendorDone; else - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); _currBBQVendorSequenceId = _nextBBQVendorSequenceId; @@ -1094,11 +1101,11 @@ void Scene42::updateAnimations() { case kAS42UseQuarterWithBBQVendorDone: gameSys.setAnimation(0, 0, 0); _vm->setGrabCursorSprite(kItemChickenBucket); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; default: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1200,6 +1207,7 @@ void Scene43::updateHotspots() { void Scene43::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -1227,30 +1235,30 @@ void Scene43::run() { } else { switch (_vm->_prevSceneNum) { case 42: - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 44: - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; case 54: - _vm->_gnap->initPos(4, 7, kDirBottomLeft); + gnap.initPos(4, 7, kDirBottomLeft); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; default: - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; } @@ -1319,23 +1327,23 @@ void Scene43::run() { break; case kHS43Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1344,44 +1352,44 @@ void Scene43::run() { case kHS43ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; case kHS43ExitBBQ: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ], -1, 0x107CF, 1); _vm->_newSceneNum = 42; break; case kHS43ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth], -1, 0x107CD, 1); _vm->_newSceneNum = 44; break; case kHS43TwoHeadedGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(6, 8, 7, 0); + gnap.playShowCurrItem(6, 8, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(7, 0); + gnap.playScratchingHead(7, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(5, 8), 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 2; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1390,20 +1398,20 @@ void Scene43::run() { case kHS43Key: case kHS43Ufo: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(3, 7, 2, 0); + gnap.playShowCurrItem(3, 7, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(0, 0); + gnap.playScratchingHead(0, 0); break; case GRAB_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(Common::Point(3, 7), 0, 67515, 1); - _vm->_gnap->_actionStatus = 1; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(Common::Point(3, 7), 0, 67515, 1); + gnap._actionStatus = 1; break; case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1411,19 +1419,19 @@ void Scene43::run() { case kHS43WalkArea1: case kHS43WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO) && (_vm->_toyUfoActionStatus == 5 || _vm->_toyUfoActionStatus == -1)) { _vm->_toyUfoActionStatus = 5; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1434,11 +1442,11 @@ void Scene43::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { switch (_vm->getRandom(5)) { case 0: _nextTwoHeadedGuySequenceId = 0x13C; @@ -1480,9 +1488,10 @@ void Scene43::run() { void Scene43::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; @@ -1492,23 +1501,23 @@ void Scene43::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - gameSys.insertSequence(0x13D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x13D; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x13D, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x13D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x13D; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x13D, gnap._id, 0); _nextTwoHeadedGuySequenceId = 0x13B; gameSys.insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; _nextTwoHeadedGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } break; default: gameSys.setAnimation(0, 0, 0); - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -1560,7 +1569,7 @@ void Scene43::updateAnimations() { gameSys.setAnimation(0x10874, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = 8; _vm->setFlag(kGFJointTaken); - _vm->_gnap->_actionStatus = 3; + gnap._actionStatus = 3; break; case 8: _nextTwoHeadedGuySequenceId = 0x13A; @@ -1633,6 +1642,7 @@ void Scene44::updateHotspots() { void Scene44::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); @@ -1681,21 +1691,21 @@ void Scene44::run() { } else { switch (_vm->_prevSceneNum) { case 43: - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 7, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 46: - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(6, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(6, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(7, 8), -1, 0x107D2, 1); break; case 50: - _vm->_gnap->initPos(4, 8, kDirBottomRight); + gnap.initPos(4, 8, kDirBottomRight); if (_vm->_sceneSavegameLoaded) { _vm->_plat->initPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); } else if (!_vm->isFlag(kGFUnk13)) { @@ -1711,11 +1721,11 @@ void Scene44::run() { _vm->endSceneInit(); break; default: - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(5, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); break; } } @@ -1767,23 +1777,23 @@ void Scene44::run() { break; case kHS44Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -1792,50 +1802,50 @@ void Scene44::run() { case kHS44ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty], 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44ExitUfoParty], 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS44ExitUfo: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; case kHS44ExitShow: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44ExitShow], 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44ExitShow], 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 46; break; case kHS44KissingLady: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->_actionStatus = 2; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); + gnap._actionStatus = 2; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, -1, 9); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, _vm->_hotspotsWalkPos[kHS44KissingLady].x - 1, _vm->_hotspotsWalkPos[kHS44KissingLady].y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(4, 3); + gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 1; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 1; break; case PLAT_CURSOR: - _vm->_gnap->useDeviceOnPlatypus(); + gnap.useDeviceOnPlatypus(); _vm->_plat->walkTo(Common::Point(6, 7), 1, 0x107D2, 1); - if (_vm->_gnap->_pos == Common::Point(7, 7)) - _vm->_gnap->walkStep(); - _vm->_gnap->playIdle(5, 7); + if (gnap._pos == Common::Point(7, 7)) + gnap.walkStep(); + gnap.playIdle(5, 7); _vm->_plat->_actionStatus = 4; break; } @@ -1844,25 +1854,25 @@ void Scene44::run() { case kHS44Spring: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(8, 7); + gnap.playScratchingHead(8, 7); break; case GRAB_CURSOR: - _vm->_gnap->playPullOutDevice(8, 0); - _vm->_gnap->playUseDevice(8, 0); + gnap.playPullOutDevice(8, 0); + gnap.playUseDevice(8, 0); _nextSpringGuySequenceId = 0xFB; _vm->invAdd(kItemSpring); _vm->setFlag(kGFSpringTaken); updateHotspots(); break; case TALK_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1870,22 +1880,22 @@ void Scene44::run() { case kHS44SpringGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSpringTaken)) - _vm->_gnap->playMoan1(8, 7); + gnap.playMoan1(8, 7); else - _vm->_gnap->playScratchingHead(8, 7); + gnap.playScratchingHead(8, 7); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -1893,20 +1903,20 @@ void Scene44::run() { case kHS44WalkArea1: case kHS44WalkArea2: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 7; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 3); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -1916,11 +1926,11 @@ void Scene44::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextKissingLadySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextKissingLadySequenceId == -1) { switch (_vm->getRandom(20)) { case 0: _nextKissingLadySequenceId = 0xED; @@ -1947,7 +1957,7 @@ void Scene44::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 20; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSpringGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSpringGuySequenceId == -1) { if (_vm->getRandom(5) != 0) { if (!_vm->isFlag(kGFSpringTaken)) _nextSpringGuySequenceId = 0xF9; @@ -1976,10 +1986,11 @@ void Scene44::run() { void Scene44::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -1990,7 +2001,7 @@ void Scene44::updateAnimations() { _nextKissingLadySequenceId = 0xF2; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(1) == 2) { @@ -2114,6 +2125,7 @@ void Scene45::updateHotspots() { void Scene45::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); @@ -2141,39 +2153,39 @@ void Scene45::run() { gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->isFlag(kGFUnk22)) { - _vm->_gnap->_sequenceId = 0x9E; - _vm->_gnap->_sequenceDatNum = 0; - _vm->_gnap->_id = 1; + gnap._sequenceId = 0x9E; + gnap._sequenceDatNum = 0; + gnap._id = 1; gameSys.setAnimation(0x9E, 1, 0); - _vm->_gnap->_actionStatus = 1; - gameSys.insertSequence(_vm->_gnap->_sequenceId, _vm->_gnap->_id, 0, 0, kSeqNone, 0, 0, 0); + gnap._actionStatus = 1; + gameSys.insertSequence(gnap._sequenceId, gnap._id, 0, 0, kSeqNone, 0, 0, 0); _vm->_plat->initPos(4, 8, kDirNone); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 41) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); - _vm->_gnap->walkTo(Common::Point(10, 9), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(10, 9), -1, 0x107BA, 1); } else { - _vm->_gnap->initPos(2, 11, kDirUpRight); + gnap.initPos(2, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 7), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->setFlag(kGFUnk21); _vm->setGrabCursorSprite(-1); - gameSys.setAnimation(0x9D, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x9D, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x9D, gnap._id, 0); + gameSys.insertSequence(0x9D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) { _vm->gameUpdateTick(); if (gameSys.getAnimationStatus(2) == 2) { @@ -2190,22 +2202,22 @@ void Scene45::run() { gameSys.setAnimation(0x99, 1, 4); } } - _vm->_gnap->_sequenceId = 0x9D; - _vm->_gnap->_sequenceDatNum = 0; + gnap._sequenceId = 0x9D; + gnap._sequenceDatNum = 0; _vm->hideCursor(); _vm->addFullScreenSprite(0x8A, 255); gameSys.setAnimation(0xA0, 256, 0); gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x107BD, _vm->_gnap->_id, 0); - gameSys.insertSequence(0x107BD, _vm->_gnap->_id, - makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, - kSeqSyncWait, 0, 75 * _vm->_gnap->_pos.x - _vm->_gnap->_gridX, 48 * _vm->_gnap->_pos.y - _vm->_gnap->_gridY); + gameSys.setAnimation(0x107BD, gnap._id, 0); + gameSys.insertSequence(0x107BD, gnap._id, + makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, + kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); _vm->removeFullScreenSprite(); _vm->showCursor(); - _vm->_gnap->_sequenceId = 0x7BD; - _vm->_gnap->_sequenceDatNum = 1; + gnap._sequenceId = 0x7BD; + gnap._sequenceDatNum = 1; } _vm->_plat->playSequence(0x9A); @@ -2256,25 +2268,25 @@ void Scene45::run() { break; case kHS45Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); _vm->_plat->playSequence(0x9A); gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2282,29 +2294,29 @@ void Scene45::run() { break; case kHS45ExitUfoParty: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(gnap._pos.x, _vm->_hotspotsWalkPos[kHS45ExitUfoParty].y), 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 40; } break; case kHS45ExitShoe: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 46; } break; case kHS45ExitRight: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 41; } @@ -2318,23 +2330,23 @@ void Scene45::run() { break; case kHS45DiscoBall: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemSpring) { - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall], 0, 0x9F, 5); - _vm->_gnap->_actionStatus = 1; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS45DiscoBall], 0, 0x9F, 5); + gnap._actionStatus = 1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemSpring); } else if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playScratchingHead(5, 0); + gnap.playScratchingHead(5, 0); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2342,27 +2354,27 @@ void Scene45::run() { break; case kHS45WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 3; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 5); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } updateAnimations(); _vm->toyUfoCheckTimer(); - if (!_vm->_isLeavingScene && _vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (!_vm->_isLeavingScene && gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); _vm->checkGameKeys(); @@ -2380,10 +2392,11 @@ void Scene45::run() { void Scene45::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -2391,13 +2404,13 @@ void Scene45::updateAnimations() { _vm->_sceneWaiting = true; _vm->setFlag(kGFUnk22); updateHotspots(); - gameSys.insertSequence(0x9E, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0); - _vm->_gnap->_sequenceId = 0x9E; - _vm->_gnap->_sequenceDatNum = 0; - gameSys.setAnimation(0x9E, _vm->_gnap->_id, 0); + gameSys.insertSequence(0x9E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); + gnap._sequenceId = 0x9E; + gnap._sequenceDatNum = 0; + gameSys.setAnimation(0x9E, gnap._id, 0); break; default: - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; break; } } @@ -2487,6 +2500,7 @@ void Scene46::updateHotspots() { void Scene46::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); @@ -2514,23 +2528,23 @@ void Scene46::run() { gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 44) { - _vm->_gnap->initPos(-1, 8, kDirUpRight); + gnap.initPos(-1, 8, kDirUpRight); _vm->_plat->initPos(-1, 8, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(2, 8), -1, 0x107B9, 1); + gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 45) { - _vm->_gnap->initPos(11, 8, kDirUpRight); + gnap.initPos(11, 8, kDirUpRight); _vm->_plat->initPos(12, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->_gnap->walkTo(Common::Point(8, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { - _vm->_gnap->initPos(5, 11, kDirUpRight); + gnap.initPos(5, 11, kDirUpRight); _vm->_plat->initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); - _vm->_gnap->walkTo(Common::Point(6, 8), -1, 0x107BA, 1); + gnap.walkTo(Common::Point(6, 8), -1, 0x107BA, 1); } _vm->_timers[4] = _vm->getRandom(50) + 80; @@ -2581,23 +2595,23 @@ void Scene46::run() { break; case kHS46Platypus: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; case GRAB_CURSOR: - _vm->_gnap->kissPlatypus(0); + gnap.kissPlatypus(0); break; case TALK_CURSOR: - _vm->_gnap->playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); _vm->_plat->playSequence(_vm->_plat->getSequenceId()); break; case PLAT_CURSOR: - _vm->_gnap->playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); break; } } @@ -2606,20 +2620,20 @@ void Scene46::run() { case kHS46SackGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); + gnap.playMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpLeft; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 2; + gnap._idleFacing = kDirUpLeft; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 2; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2627,20 +2641,20 @@ void Scene46::run() { case kHS46ItchyGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - _vm->_gnap->playShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - _vm->_gnap->playMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); + gnap.playMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); break; case TALK_CURSOR: - _vm->_gnap->_idleFacing = kDirUpRight; - _vm->_gnap->walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, _vm->_gnap->getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); - _vm->_gnap->_actionStatus = 1; + gnap._idleFacing = kDirUpRight; + gnap.walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap._actionStatus = 1; break; case GRAB_CURSOR: case PLAT_CURSOR: - _vm->_gnap->playImpossible(0, 0); + gnap.playImpossible(0, 0); break; } } @@ -2648,41 +2662,41 @@ void Scene46::run() { case kHS46ExitUfoParty: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_gnap->_pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y), 0, 0x107AE, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(gnap._pos.x, _vm->_hotspotsWalkPos[kHS46ExitUfoParty].y), 0, 0x107AE, 1); + gnap._actionStatus = 0; _vm->_newSceneNum = 40; break; case kHS46ExitKissinBooth: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_gnap->_pos.y), 0, 0x107AF, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, gnap._pos.y), 0, 0x107AF, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 44; break; case kHS46ExitDisco: _vm->_isLeavingScene = true; - _vm->_gnap->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_gnap->_pos.y), 0, 0x107AB, 1); - _vm->_gnap->_actionStatus = 0; + gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, gnap._pos.y), 0, 0x107AB, 1); + gnap._actionStatus = 0; _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 45; break; case kHS46WalkArea1: - if (_vm->_gnap->_actionStatus < 0) - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + if (gnap._actionStatus < 0) + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); break; } } - if (_vm->_mouseClickState._left && _vm->_gnap->_actionStatus < 0) { + if (_vm->_mouseClickState._left && gnap._actionStatus < 0) { _vm->_mouseClickState._left = false; if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoActionStatus = 4; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { - _vm->_gnap->walkTo(Common::Point(-1, -1), -1, -1, 1); + gnap.walkTo(Common::Point(-1, -1), -1, -1, 1); } } @@ -2692,11 +2706,11 @@ void Scene46::run() { if (!_vm->_isLeavingScene) { if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->_plat->updateIdleSequence(); - if (_vm->_gnap->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_gnap->updateIdleSequence(); + if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 80; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextItchyGuySequenceId == -1) { + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextItchyGuySequenceId == -1) { if (_vm->getRandom(2) != 0) _nextItchyGuySequenceId = 0x49; else @@ -2705,7 +2719,7 @@ void Scene46::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 80; - if (_vm->_gnap->_actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSackGuySequenceId == -1) + if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSackGuySequenceId == -1) _nextSackGuySequenceId = 0x4C; } } @@ -2724,10 +2738,11 @@ void Scene46::run() { void Scene46::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); - switch (_vm->_gnap->_actionStatus) { + switch (gnap._actionStatus) { case 0: _vm->_sceneDone = true; break; @@ -2738,7 +2753,7 @@ void Scene46::updateAnimations() { _nextSackGuySequenceId = 0x4A; break; } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 8cf5087ff6..3f21752e2a 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -76,6 +76,8 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { }; GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + if (_isGnapPhoning) { gameSys.setAnimation(kGnapHandSequenceIds[buttonNum], 40, 6); gameSys.insertSequence(kGnapHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -86,13 +88,13 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { _currHandSequenceId = kPlatypusHandSequenceIds[buttonNum]; } - _vm->_gnap->_actionStatus = 6; + gnap._actionStatus = 6; while (gameSys.getAnimationStatus(6) != 2) { // checkGameAppStatus(); _vm->updateMouseCursor(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; if (buttonNum < 11) phoneNumber = buttonNum % 10 + 10 * phoneNumber; @@ -121,8 +123,9 @@ void Scene53::runRandomCall() { }; GameSys& gameSys = *_vm->_gameSys; - ++_callsMadeCtr; + PlayerGnap& gnap = *_vm->_gnap; + ++_callsMadeCtr; if (_callsMadeCtr <= 10) { int index; @@ -137,30 +140,31 @@ void Scene53::runRandomCall() { _callsMadeCtr = 0; } - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } void Scene53::runChitChatLine() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; bool flag = false; int sequenceId = -1; gameSys.setAnimation(0x6E, 1, 6); gameSys.insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -198,7 +202,7 @@ void Scene53::runChitChatLine() { flag = 1; _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = 0; + gnap._actionStatus = 0; _vm->_newSceneNum = 17; break; case 5: @@ -217,31 +221,31 @@ void Scene53::runChitChatLine() { if (flag && sequenceId != -1) { _vm->stopSound(0xA0); pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; gameSys.setAnimation(sequenceId, 1, 6); gameSys.insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; gameSys.setAnimation(0x72, 1, 6); gameSys.insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; while (gameSys.getAnimationStatus(6) != 2) { _vm->updateMouseCursor(); // checkGameAppStatus(); _vm->gameUpdateTick(); } - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } updateHotspots(); - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); @@ -252,12 +256,14 @@ void Scene53::runChitChatLine() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } } void Scene53::run() { GameSys& gameSys = *_vm->_gameSys; + PlayerGnap& gnap = *_vm->_gnap; + int phoneNumber = 0; int phoneNumberLen = 0; @@ -287,7 +293,7 @@ void Scene53::run() { switch (_vm->_sceneClickedHotspot) { case 1: - if (_vm->_gnap->_actionStatus < 0) { + if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } @@ -307,7 +313,7 @@ void Scene53::run() { phoneNumber = pressPhoneNumberButton(phoneNumber, _vm->_sceneClickedHotspot - 1); debugC(kDebugBasic, "phoneNumber: %d", phoneNumber); if (phoneNumberLen == 7) { - _vm->_gnap->_actionStatus = 1; + gnap._actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -317,7 +323,7 @@ void Scene53::run() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } if (phoneNumber == 7284141) { runChitChatLine(); @@ -348,8 +354,8 @@ void Scene53::run() { pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); break; case 14: - if (_vm->_gnap->_actionStatus < 0) { - _vm->_gnap->_actionStatus = 1; + if (gnap._actionStatus < 0) { + gnap._actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); @@ -359,11 +365,11 @@ void Scene53::run() { _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; - _vm->_gnap->_actionStatus = -1; + gnap._actionStatus = -1; } _vm->_isLeavingScene = true; _vm->_sceneDone = true; - _vm->_gnap->_actionStatus = 0; + gnap._actionStatus = 0; _vm->_newSceneNum = 17; } break; -- cgit v1.2.3 From 6e9243d125153cac1a342d716b0c18f06c88323e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 11:01:21 +0200 Subject: GNAP: Reduce dereferencing of _plat --- engines/gnap/character.cpp | 88 +++++---- engines/gnap/scenes/group0.cpp | 402 ++++++++++++++++++++------------------- engines/gnap/scenes/group1.cpp | 416 +++++++++++++++++++++-------------------- engines/gnap/scenes/group2.cpp | 231 ++++++++++++----------- engines/gnap/scenes/group3.cpp | 193 ++++++++++--------- engines/gnap/scenes/group4.cpp | 269 +++++++++++++------------- 6 files changed, 833 insertions(+), 766 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 3d74d1e300..094691300f 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -461,22 +461,24 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } void PlayerGnap::useJointOnPlatypus() { + PlayerPlat& plat = *_vm->_plat; + _vm->setGrabCursorSprite(-1); if (doPlatypusAction(1, 0, 0x107C1, 0)) { _actionStatus = 100; _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0x10876, _vm->_plat->_id, 0); + _vm->_gameSys->setAnimation(0x10876, plat._id, 0); _vm->_gameSys->insertSequence(0x10875, _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqSyncWait, 0, 15 * (5 * _pos.x - 30), 48 * (_pos.y - 7)); _sequenceDatNum = 1; _sequenceId = 0x875; - _vm->_gameSys->insertSequence(0x10876, _vm->_plat->_id, - _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, - kSeqSyncWait, 0, 15 * (5 * _vm->_plat->_pos.x - 25), 48 * (_vm->_plat->_pos.y - 7)); - _vm->_plat->_sequenceDatNum = 1; - _vm->_plat->_sequenceId = 0x876; - _vm->_plat->_idleFacing = kDirNone; + _vm->_gameSys->insertSequence(0x10876, plat._id, + plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, + kSeqSyncWait, 0, 15 * (5 * plat._pos.x - 25), 48 * (plat._pos.y - 7)); + plat._sequenceDatNum = 1; + plat._sequenceId = 0x876; + plat._idleFacing = kDirNone; playSequence(0x107B5); walkStep(); while (_vm->_gameSys->getAnimationStatus(0) != 2) { @@ -486,11 +488,13 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos) | 0x10000); + playSequence(getSequenceId(gskScratchingHead, plat._pos) | 0x10000); } } void PlayerGnap::kissPlatypus(int callback) { + PlayerPlat& plat = *_vm->_plat; + if (doPlatypusAction(-1, 0, 0x107D1, callback)) { _actionStatus = 100; _vm->_gameSys->setAnimation(0, 0, 1); @@ -500,12 +504,12 @@ void PlayerGnap::kissPlatypus(int callback) { kSeqSyncWait, 0, 15 * (5 * _pos.x - 20) - (21 - _vm->_gridMinX), 48 * (_pos.y - 6) - (146 - _vm->_gridMinY)); _sequenceDatNum = 1; _sequenceId = 0x847; - _vm->_gameSys->insertSequence(0x107CB, _vm->_plat->_id, - makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, - kSeqSyncWait, _vm->getSequenceTotalDuration(0x10847), 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); - _vm->_plat->_sequenceDatNum = 1; - _vm->_plat->_sequenceId = 0x7CB; - _vm->_plat->_idleFacing = kDirNone; + _vm->_gameSys->insertSequence(0x107CB, plat._id, + makeRid(plat._sequenceDatNum, plat._sequenceId), plat._id, + kSeqSyncWait, _vm->getSequenceTotalDuration(0x10847), 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); + plat._sequenceDatNum = 1; + plat._sequenceId = 0x7CB; + plat._idleFacing = kDirNone; playSequence(0x107B5); while (_vm->_gameSys->getAnimationStatus(0) != 2) { _vm->updateMouseCursor(); @@ -515,25 +519,27 @@ void PlayerGnap::kissPlatypus(int callback) { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - playSequence(getSequenceId(gskScratchingHead, _vm->_plat->_pos) | 0x10000); + playSequence(getSequenceId(gskScratchingHead, plat._pos) | 0x10000); } } void PlayerGnap::useDeviceOnPlatypus() { - playSequence(makeRid(1, getSequenceId(gskPullOutDevice, _vm->_plat->_pos))); - - if (_vm->_plat->_idleFacing != kDirNone) { - _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), _vm->_plat->_id, - makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, - kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); - _vm->_plat->_sequenceId = 0x7D5; - _vm->_plat->_sequenceDatNum = 1; + PlayerPlat& plat = *_vm->_plat; + + playSequence(makeRid(1, getSequenceId(gskPullOutDevice, plat._pos))); + + if (plat._idleFacing != kDirNone) { + _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), plat._id, + makeRid(plat._sequenceDatNum, plat._sequenceId), plat._id, + kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); + plat._sequenceId = 0x7D5; + plat._sequenceDatNum = 1; } else { - _vm->_gameSys->insertSequence(makeRid(1, 0x7D4), _vm->_plat->_id, - makeRid(_vm->_plat->_sequenceDatNum, _vm->_plat->_sequenceId), _vm->_plat->_id, - kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); - _vm->_plat->_sequenceId = 0x7D4; - _vm->_plat->_sequenceDatNum = 1; + _vm->_gameSys->insertSequence(makeRid(1, 0x7D4), plat._id, + makeRid(plat._sequenceDatNum, plat._sequenceId), plat._id, + kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); + plat._sequenceId = 0x7D4; + plat._sequenceDatNum = 1; } int newSequenceId = getSequenceId(gskUseDevice, Common::Point(0, 0)); @@ -675,6 +681,7 @@ int PlayerGnap::getWalkSequenceId(int deltaX, int deltaY) { } bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { + PlayerPlat& plat = *_vm->_plat; int datNum = flags & 3; _vm->_timers[2] = 200; @@ -691,8 +698,8 @@ bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceI _walkDestX = CLIP(gridX, 0, _vm->_gridMaxX - 1); _walkDestY = CLIP(gridY, 0, _vm->_gridMaxY - 1); - if (animationIndex >= 0 && _walkDestX == _vm->_plat->_pos.x && _walkDestY == _vm->_plat->_pos.y) - _vm->_plat->makeRoom(); + if (animationIndex >= 0 && _walkDestX == plat._pos.x && _walkDestY == plat._pos.y) + plat.makeRoom(); bool done = findPath1(_pos.x, _pos.y, 0); @@ -1091,21 +1098,24 @@ void PlayerGnap::playShowItem(int itemIndex, int gridLookX, int gridLookY) { } void PlayerGnap::playShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { - if (_vm->_plat->_pos.x == gridX && _vm->_plat->_pos.y == gridY) - _vm->_plat->makeRoom(); + PlayerPlat& plat = *_vm->_plat; + + if (plat._pos.x == gridX && plat._pos.y == gridY) + plat.makeRoom(); walkTo(Common::Point(gridX, gridY), -1, -1, 1); playShowItem(_vm->_grabCursorSpriteIndex, gridLookX, gridLookY); } bool PlayerGnap::doPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) { + PlayerPlat& plat = *_vm->_plat; bool result = false; - if (_actionStatus <= -1 && _vm->_plat->_actionStatus <= -1) { + if (_actionStatus <= -1 && plat._actionStatus <= -1) { _actionStatus = 100; - Common::Point checkPt = _vm->_plat->_pos + Common::Point(gridX, gridY); + Common::Point checkPt = plat._pos + Common::Point(gridX, gridY); if (_vm->isPointBlocked(checkPt) && (_pos != checkPt)) { - _vm->_plat->walkStep(); - checkPt = _vm->_plat->_pos + Common::Point(gridX, gridY); + plat.walkStep(); + checkPt = plat._pos + Common::Point(gridX, gridY); } if (!_vm->isPointBlocked(checkPt) && (_pos != checkPt)) { @@ -1116,9 +1126,9 @@ bool PlayerGnap::doPlatypusAction(int gridX, int gridY, int platSequenceId, int _vm->gameUpdateTick(); } _vm->_gameSys->setAnimation(0, 0, 0); - if (_pos == _vm->_plat->_pos + Common::Point(gridX, gridY)) { - _vm->_gameSys->setAnimation(platSequenceId, _vm->_plat->_id, 1); - _vm->_plat->playSequence(platSequenceId); + if (_pos == plat._pos + Common::Point(gridX, gridY)) { + _vm->_gameSys->setAnimation(platSequenceId, plat._id, 1); + plat.playSequence(platSequenceId); while (_vm->_gameSys->getAnimationStatus(1) != 2) { _vm->updateMouseCursor(); _vm->doCallback(callback); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index f5e8307def..972bbfa907 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -73,6 +73,7 @@ void Scene01::run() { // which is also set in the global game flags. GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); @@ -93,15 +94,15 @@ void Scene01::run() { if (_vm->_prevSceneNum == 2) { gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(12, 6, kDirUnk4); + plat.initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); + plat.walkTo(Common::Point(9, 6), -1, 0x107C2, 1); gnap.walkTo(Common::Point(8, 6), -1, 0x107B9, 1); } else { gnap.initPos(1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(1, 7, kDirNone); + plat.initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -132,16 +133,16 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -229,7 +230,7 @@ void Scene01::run() { gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107AB, 1); gnap._actionStatus = kAS01LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 2; } break; @@ -261,8 +262,8 @@ void Scene01::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (_vm->_timers[4] == 0) { @@ -399,6 +400,7 @@ void Scene02::updateHotspots() { void Scene02::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); @@ -417,42 +419,42 @@ void Scene02::run() { case 3: gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(12, 6, kDirUnk4); + plat.initPos(12, 6, kDirUnk4); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107C2, 1); + plat.walkTo(Common::Point(9, 6), -1, 0x107C2, 1); gnap.walkTo(Common::Point(8, 6), -1, 0x107BA, 1); break; case 4: gnap.initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); + plat.initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 6), 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(8, 6), 1, 0x107C2, 1); + plat.walkTo(Common::Point(8, 6), 1, 0x107C2, 1); updateHotspots(); gameSys.waitForUpdate(); break; case 47: _vm->clearFlag(kGFUnk25); gnap.initPos(5, 6, kDirBottomLeft); - _vm->_plat->initPos(6, 7, kDirUnk4); + plat.initPos(6, 7, kDirUnk4); _vm->endSceneInit(); break; case 49: gnap.initPos(5, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(6, 7, kDirNone); + plat.initPos(6, 7, kDirNone); _vm->endSceneInit(); break; default: gnap.initPos(-1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(-1, 7, kDirNone); + plat.initPos(-1, 7, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); + plat.walkTo(Common::Point(2, 7), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; } @@ -484,16 +486,16 @@ void Scene02::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -613,7 +615,7 @@ void Scene02::run() { gnap.walkTo(_vm->_hotspotsWalkPos[6], 0, 0x107AD, 1); gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), -1, 0x107C1, 1); + plat.walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); _vm->_newSceneNum = 4; } @@ -625,7 +627,7 @@ void Scene02::run() { gnap.walkTo(_vm->_hotspotsWalkPos[7], 0, 0x107AD, 1); gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[7] + Common::Point(1, 0), -1, 0x107C1, 1); + plat.walkTo(_vm->_hotspotsWalkPos[7] + Common::Point(1, 0), -1, 0x107C1, 1); updateHotspots(); _vm->_newSceneNum = 5; } @@ -637,7 +639,7 @@ void Scene02::run() { gnap.walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8], -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[8], -1, 0x107CD, 1); _vm->_newSceneNum = 3; } break; @@ -648,7 +650,7 @@ void Scene02::run() { gnap.walkTo(_vm->_hotspotsWalkPos[9], 0, 0x107AF, 1); gnap._actionStatus = kAS02LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[9], -1, 0x107CF, 1); + plat.walkTo(_vm->_hotspotsWalkPos[9], -1, 0x107CF, 1); _vm->_newSceneNum = 1; } break; @@ -675,8 +677,8 @@ void Scene02::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { @@ -890,6 +892,7 @@ void Scene03::updateHotspots() { void Scene03::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x10925, true); _vm->startSoundTimerC(7); @@ -911,13 +914,13 @@ void Scene03::run() { _vm->_timers[5] = _vm->getRandom(100) + 200; if (_vm->isFlag(kGFPlatypus)) { - _vm->_plat->initPos(5, 4, kDirNone); + plat.initPos(5, 4, kDirNone); } else { _vm->_timers[1] = _vm->getRandom(40) + 20; gameSys.setAnimation(0x1C2, 99, 1); gameSys.insertSequence(0x1C2, 99, 0, 0, kSeqNone, 0, 0, 0); - _vm->_plat->_sequenceId = 0x1C2; - _vm->_plat->_sequenceDatNum = 0; + plat._sequenceId = 0x1C2; + plat._sequenceDatNum = 0; } gameSys.insertSequence(0x1C4, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -930,7 +933,7 @@ void Scene03::run() { _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(4, 7), -1, 0x107C2, 1); + plat.walkTo(Common::Point(4, 7), -1, 0x107C2, 1); gnap.walkTo(Common::Point(3, 6), -1, 0x107B9, 1); while (!_vm->_sceneDone) { @@ -951,16 +954,16 @@ void Scene03::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -1004,7 +1007,7 @@ void Scene03::run() { gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107AD, 1); gnap._actionStatus = kAS03LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[2], -1, 0x107C2, 1); _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; if (_vm->_cursorValue == 1) _vm->_newSceneNum = 2; @@ -1125,18 +1128,18 @@ void Scene03::run() { _vm->playSound(0x10925, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[1] && !_platypusScared) { _vm->_timers[1] = _vm->getRandom(40) + 20; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && !_vm->isFlag(kGFPlatypus) && !_platypusHypnotized) _nextPlatSequenceId = 450; } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(20) + 30; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextFrogSequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextFrogSequenceId == -1) { if (_vm->getRandom(5) == 1) _nextFrogSequenceId = 0x1C6; else @@ -1146,12 +1149,12 @@ void Scene03::run() { if (!_vm->_timers[4]) { // Update bird animation _vm->_timers[4] = _vm->getRandom(100) + 300; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (gnap._actionStatus < 0 && plat._actionStatus < 0) gameSys.insertSequence(_vm->getRandom(2) != 0 ? 0x1C8 : 0x1C3, 253, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 200; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0) { gameSys.setAnimation(0x1C5, 253, 4); gameSys.insertSequence(0x1C5, 253, 0, 0, kSeqNone, 0, 0, 0); } @@ -1177,6 +1180,7 @@ void Scene03::run() { void Scene03::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -1189,14 +1193,14 @@ void Scene03::updateAnimations() { break; case kAS03FreePlatypusDone: gnap._actionStatus = -1; - _vm->_plat->_pos = Common::Point(6, 6); - _vm->_plat->_idleFacing = kDirUnk4; - _vm->_plat->_id = 120; - gameSys.insertSequence(0x107CA, _vm->_plat->_id, 0x1BC, 99, - kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); + plat._pos = Common::Point(6, 6); + plat._idleFacing = kDirUnk4; + plat._id = 120; + gameSys.insertSequence(0x107CA, plat._id, 0x1BC, 99, + kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); gameSys.insertSequence(0x1B7, 99, 0, 0, kSeqNone, 0, 0, 0); - _vm->_plat->_sequenceDatNum = 1; - _vm->_plat->_sequenceId = 0x7CA; + plat._sequenceDatNum = 1; + plat._sequenceId = 0x7CA; _vm->setFlag(kGFPlatypus); _nextPlatSequenceId = -1; updateHotspots(); @@ -1210,16 +1214,16 @@ void Scene03::updateAnimations() { _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); gameSys.setAnimation(0x1BA, 99, 1); - gameSys.insertSequence(0x1BA, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_sequenceId = 0x1BA; + gameSys.insertSequence(0x1BA, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + plat._sequenceDatNum = 0; + plat._sequenceId = 0x1BA; gnap._actionStatus = -1; _platypusHypnotized = true; updateHotspots(); break; case kAS03HypnotizeScaredPlat: gnap.playBrainPulsating(0, 0); - gameSys.insertSequence(0x1BF, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); + gameSys.insertSequence(0x1BF, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); gameSys.setAnimation(0x1BF, 99, 1); while (gameSys.getAnimationStatus(1) != 2) _vm->gameUpdateTick(); @@ -1231,8 +1235,8 @@ void Scene03::updateAnimations() { _vm->removeFullScreenSprite(); gameSys.setAnimation(0x1BA, 99, 1); gameSys.insertSequence(0x1BA, 99, 447, 99, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_sequenceId = 0x1BA; + plat._sequenceDatNum = 0; + plat._sequenceId = 0x1BA; gnap._actionStatus = -1; _platypusHypnotized = true; updateHotspots(); @@ -1263,19 +1267,19 @@ void Scene03::updateAnimations() { gameSys.setAnimation(0, 0, 1); _platypusScared = true; gameSys.insertSequence(0x1B5, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(_nextPlatSequenceId, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(_nextPlatSequenceId, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); gnap._sequenceId = 0x1B5; gnap._sequenceDatNum = 0; gnap._idleFacing = kDirNone; - _vm->_plat->_sequenceId = _nextPlatSequenceId; - _vm->_plat->_sequenceDatNum = 0; + plat._sequenceId = _nextPlatSequenceId; + plat._sequenceDatNum = 0; gameSys.setAnimation(_nextPlatSequenceId, 99, 1); _nextPlatSequenceId = -1; gnap._actionStatus = -1; } else if (_nextPlatSequenceId == 0x1BC) { gnap._pos = Common::Point(3, 6); gameSys.insertSequence(0x1B6, 120, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x1BC, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x1BC, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1BC, 99, 0); gnap._id = 20 * gnap._pos.y; gnap._sequenceId = 0x1B6; @@ -1285,17 +1289,17 @@ void Scene03::updateAnimations() { _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { gameSys.setAnimation(0, 0, 1); - gameSys.insertSequence(0x1C2, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceId = 0x1C2; - _vm->_plat->_sequenceDatNum = 0; + gameSys.insertSequence(0x1C2, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + plat._sequenceId = 0x1C2; + plat._sequenceDatNum = 0; gameSys.setAnimation(0x1C2, 99, 1); _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == -1 && _platypusScared && !_platypusHypnotized) { gameSys.setAnimation(0, 0, 1); gameSys.setAnimation(0x1BE, 99, 1); - gameSys.insertSequence(0x1BE, 99, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceId = 0x1BE; - _vm->_plat->_sequenceDatNum = 0; + gameSys.insertSequence(0x1BE, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); + plat._sequenceId = 0x1BE; + plat._sequenceDatNum = 0; _nextPlatSequenceId = -1; } } @@ -1358,6 +1362,7 @@ void Scene04::updateHotspots() { void Scene04::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(4); @@ -1388,8 +1393,8 @@ void Scene04::run() { _vm->setGrabCursorSprite(kItemKeys); gnap._pos = Common::Point(4, 7); gnap._id = 140; - _vm->_plat->_pos = Common::Point(6, 7); - _vm->_plat->_id = 141; + plat._pos = Common::Point(6, 7); + plat._id = 141; gameSys.insertSequence(0x107B5, 140, 0, 0, kSeqNone, 0, 300 - gnap._gridX, 336 - gnap._gridY); gameSys.insertSequence(0x20C, 141, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x208, 121, 0, 0, kSeqNone, 0, 0, 0); @@ -1399,9 +1404,9 @@ void Scene04::run() { _vm->invAdd(kItemKeys); _vm->setFlag(kGFKeysTaken); _vm->clearFlag(kGFPlatypusDisguised); - _vm->_plat->_sequenceId = 0x20C; - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_idleFacing = kDirBottomRight; + plat._sequenceId = 0x20C; + plat._sequenceDatNum = 0; + plat._idleFacing = kDirBottomRight; gnap._sequenceId = 0x7B5; gnap._sequenceDatNum = 1; gameSys.waitForUpdate(); @@ -1410,22 +1415,22 @@ void Scene04::run() { if (_vm->_prevSceneNum == 2) { gnap.initPos(5, 11, kDirUpRight); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(6, 11, kDirUpLeft); + plat.initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(5, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(6, 9), -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { gnap.initPos(5, 7, kDirBottomRight); - _vm->_plat->initPos(4, 7, kDirNone); + plat.initPos(4, 7, kDirNone); _vm->endSceneInit(); } else { gnap.initPos(12, 9, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(12, 8, kDirNone); + plat.initPos(12, 8, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(9, 9), -1, 0x107BA, 1); } } @@ -1457,19 +1462,19 @@ void Scene04::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: if (_vm->_cursorValue == 4) gnap.kissPlatypus(0); else - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -1597,7 +1602,7 @@ void Scene04::run() { gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107AE, 1); gnap._actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5], -1, 0x107C7, 1); + plat.walkTo(_vm->_hotspotsWalkPos[5], -1, 0x107C7, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 2; else @@ -1641,7 +1646,7 @@ void Scene04::run() { gnap.walkTo(_vm->_hotspotsWalkPos[8], 0, 0x107AB, 1); gnap._actionStatus = kAS04LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[8] + Common::Point(0, 1), -1, 0x107C1, 1); + plat.walkTo(_vm->_hotspotsWalkPos[8] + Common::Point(0, 1), -1, 0x107C1, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 5; else @@ -1670,8 +1675,8 @@ void Scene04::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) - _vm->_plat->updateIdleSequence2(); + if (plat._actionStatus < 0 && _vm->isFlag(kGFPlatypus)) + plat.updateIdleSequence2(); if (gnap._actionStatus < 0) gnap.updateIdleSequence2(); if (!_vm->_timers[5]) { @@ -1874,6 +1879,7 @@ void Scene05::updateHotspots() { void Scene05::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(7); @@ -1895,15 +1901,15 @@ void Scene05::run() { if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { gnap.initPos(-1, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(-1, 9, kDirNone); + plat.initPos(-1, 9, kDirNone); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(Common::Point(2, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(2, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 9), -1, 0x107B9, 1); } else { gnap.initPos(6, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->initPos(7, 9, kDirNone); + plat.initPos(7, 9, kDirNone); _vm->endSceneInit(); } @@ -1934,16 +1940,16 @@ void Scene05::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -1954,7 +1960,7 @@ void Scene05::run() { break; case kHS05Haystack: - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); } else if (_vm->isFlag(kGFNeedleTaken)) { @@ -1971,13 +1977,13 @@ void Scene05::run() { case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { gnap.useDeviceOnPlatypus(); - if (_vm->_plat->walkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { - _vm->_plat->_actionStatus = kAS05PlatSearchHaystack; - _vm->_plat->_idleFacing = kDirUnk4; + if (plat.walkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { + plat._actionStatus = kAS05PlatSearchHaystack; + plat._idleFacing = kDirUnk4; } if (gnap._pos.x == 4 && (gnap._pos.y == 8 || gnap._pos.y == 7)) gnap.walkStep(); - gnap.playIdle(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playIdle(plat._pos.x, plat._pos.y); } break; } @@ -2082,7 +2088,7 @@ void Scene05::run() { gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, 0x107AF, 1); gnap._actionStatus = kAS05LeaveScene; if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[4] + Common::Point(0, 1), -1, 0x107C7, 1); + plat.walkTo(_vm->_hotspotsWalkPos[4] + Common::Point(0, 1), -1, 0x107C7, 1); if (_vm->_cursorValue == 1) _vm->_newSceneNum = 4; else @@ -2116,7 +2122,7 @@ void Scene05::run() { if (!_vm->_isLeavingScene) { if (_vm->isFlag(kGFPlatypus)) - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -2212,27 +2218,28 @@ void Scene05::updateAnimations() { } if (gameSys.getAnimationStatus(1) == 2) { - if (_vm->_plat->_sequenceId == 0x146) { - _vm->_plat->_pos = Common::Point(4, 8); - gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - _vm->_plat->_gridX, 384 - _vm->_plat->_gridY); - _vm->_plat->_sequenceId = 0x7C1; - _vm->_plat->_sequenceDatNum = 1; - _vm->_plat->_id = 20 * _vm->_plat->_pos.y; + PlayerPlat& plat = *_vm->_plat; + if (plat._sequenceId == 0x146) { + plat._pos = Common::Point(4, 8); + gameSys.insertSequence(0x107C1, 160, 0x146, 256, kSeqSyncWait, 0, 300 - plat._gridX, 384 - plat._gridY); + plat._sequenceId = 0x7C1; + plat._sequenceDatNum = 1; + plat._id = 20 * plat._pos.y; _vm->invAdd(kItemNeedle); _vm->setFlag(kGFNeedleTaken); _vm->setGrabCursorSprite(kItemNeedle); _vm->showCursor(); _vm->_timers[1] = 30; - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; } - if (_vm->_plat->_actionStatus == kAS05PlatSearchHaystack) { + if (plat._actionStatus == kAS05PlatSearchHaystack) { gameSys.setAnimation(0, 0, 1); - gameSys.insertSequence(0x145, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x146, 256, 0x145, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x145, plat._id, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x146, 256, 0x145, plat._id, kSeqSyncWait, 0, 0, 0); _vm->hideCursor(); _vm->setGrabCursorSprite(-1); - _vm->_plat->_sequenceId = 0x146; - _vm->_plat->_sequenceDatNum = 0; + plat._sequenceId = 0x146; + plat._sequenceDatNum = 0; gameSys.setAnimation(0x146, 256, 1); _vm->_timers[1] = 300; } @@ -2303,6 +2310,8 @@ void Scene06::updateHotspots() { void Scene06::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; + bool triedDeviceOnGas = false; _vm->startSoundTimerC(7); @@ -2327,10 +2336,10 @@ void Scene06::run() { _vm->queueInsertDeviceIcon(); gnap.initPos(5, 12, kDirBottomRight); - _vm->_plat->initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirNone); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); while (!_vm->_sceneDone) { @@ -2360,16 +2369,16 @@ void Scene06::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -2447,8 +2456,8 @@ void Scene06::run() { gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; gnap._idleFacing = kDirUpLeft; - _vm->_plat->walkTo(Common::Point(6, 8), 1, 0x107C2, 1); - _vm->_plat->_idleFacing = kDirNone; + plat.walkTo(Common::Point(6, 8), 1, 0x107C2, 1); + plat._idleFacing = kDirNone; gnap._actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2511,13 +2520,13 @@ void Scene06::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 25; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHorseSequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextHorseSequenceId == -1) { if (_horseTurnedBack) { _nextHorseSequenceId = 0xF5; } else { @@ -2555,6 +2564,7 @@ void Scene06::run() { void Scene06::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -2595,17 +2605,17 @@ void Scene06::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - if (_vm->_plat->_sequenceId == 0xFA) { + if (plat._sequenceId == 0xFA) { gameSys.setAnimation(0, 0, 1); _vm->invAdd(kItemGas); _vm->setFlag(kGFGasTaken); _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; _vm->setGrabCursorSprite(kItemGas); - _vm->_plat->_actionStatus = -1; - _vm->_plat->_pos = Common::Point(6, 8); - gameSys.insertSequence(0x107C1, _vm->_plat->_id, 0, 0, kSeqNone, 0, 450 - _vm->_plat->_gridX, 384 - _vm->_plat->_gridY); - _vm->_plat->_sequenceId = 0x7C1; - _vm->_plat->_sequenceDatNum = 1; + plat._actionStatus = -1; + plat._pos = Common::Point(6, 8); + gameSys.insertSequence(0x107C1, plat._id, 0, 0, kSeqNone, 0, 450 - plat._gridX, 384 - plat._gridY); + plat._sequenceId = 0x7C1; + plat._sequenceDatNum = 1; _vm->setFlag(kGFUnk04); gnap._actionStatus = -1; _vm->showCursor(); @@ -2613,7 +2623,7 @@ void Scene06::updateAnimations() { if (_nextPlatSequenceId == 0xFB) { gameSys.setAnimation(0, 0, 1); _nextHorseSequenceId = 0xF2; - _vm->_plat->_actionStatus = 6; + plat._actionStatus = 6; } } @@ -2626,10 +2636,10 @@ void Scene06::updateAnimations() { gameSys.insertSequence(0xF2, 120, _currHorseSequenceId, 120, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x100, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0xF7, 20, 0xF8, 20, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0xFB, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0xFA, 256, 0xFB, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceId = 0xFA; - _vm->_plat->_sequenceDatNum = 0; + gameSys.insertSequence(0xFB, plat._id, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0xFA, 256, 0xFB, plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceId = 0xFA; + plat._sequenceDatNum = 0; gameSys.insertSequence(0x107B7, gnap._id, 0x100, gnap._id, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); gnap._sequenceId = 0x7B7; @@ -2682,6 +2692,7 @@ void Scene07::updateHotspots() { void Scene07::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x8C, 1, 0, 0, kSeqLoop, 0, 0, 0); @@ -2695,7 +2706,7 @@ void Scene07::run() { if (_vm->_prevSceneNum == 8) { gnap.initPos(7, 7, kDirBottomLeft); - _vm->_plat->initPos(9, 7, kDirUnk4); + plat.initPos(9, 7, kDirUnk4); _vm->endSceneInit(); } else { gnap._pos = Common::Point(6, 7); @@ -2706,11 +2717,11 @@ void Scene07::run() { gameSys.insertSequence(0x8F, 140, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); gnap._actionStatus = kAS07Wait; - _vm->_plat->_pos = Common::Point(3, 8); - _vm->_plat->_id = 160; - _vm->_plat->_sequenceId = 0x91; - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_idleFacing = kDirNone; + plat._pos = Common::Point(3, 8); + plat._id = 160; + plat._sequenceId = 0x91; + plat._sequenceDatNum = 0; + plat._idleFacing = kDirNone; gameSys.insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); } @@ -2735,14 +2746,14 @@ void Scene07::run() { case kHS07Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: break; @@ -2815,38 +2826,38 @@ void Scene07::run() { if (!_vm->_isLeavingScene) { gnap.updateIdleSequence(); - if (_vm->_plat->_actionStatus < 0 && gnap._actionStatus < 0) { + if (plat._actionStatus < 0 && gnap._actionStatus < 0) { if (_vm->_timers[0]) { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; int gnapRandomValue = _vm->getRandom(20); // TODO Cleanup - if (_vm->_plat->_idleFacing != kDirNone) { - if (gnapRandomValue != 0 || _vm->_plat->_sequenceId != 0x7CA) { - if (gnapRandomValue != 1 || _vm->_plat->_sequenceId != 0x7CA) { - if (_vm->_plat->_pos.y == 9) - _vm->_plat->playSequence(0x107CA); + if (plat._idleFacing != kDirNone) { + if (gnapRandomValue != 0 || plat._sequenceId != 0x7CA) { + if (gnapRandomValue != 1 || plat._sequenceId != 0x7CA) { + if (plat._pos.y == 9) + plat.playSequence(0x107CA); } else { - _vm->_plat->playSequence(0x10845); + plat.playSequence(0x10845); } } else { - _vm->_plat->playSequence(0x107CC); + plat.playSequence(0x107CC); } - } else if (gnapRandomValue != 0 || _vm->_plat->_sequenceId != 0x7C9) { - if (gnapRandomValue != 1 || _vm->_plat->_sequenceId != 0x7C9) { - if (_vm->_plat->_pos.y == 9) - _vm->_plat->playSequence(0x107C9); + } else if (gnapRandomValue != 0 || plat._sequenceId != 0x7C9) { + if (gnapRandomValue != 1 || plat._sequenceId != 0x7C9) { + if (plat._pos.y == 9) + plat.playSequence(0x107C9); } else { - _vm->_plat->playSequence(0x10844); + plat.playSequence(0x10844); } } else { - _vm->_plat->playSequence(0x107CB); + plat.playSequence(0x107CB); } - gameSys.setAnimation(_vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, 1); + gameSys.setAnimation(plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, 1); } } else { _vm->_timers[0] = _vm->getRandom(75) + 75; - _vm->_plat->makeRoom(); + plat.makeRoom(); } } else { _vm->_timers[0] = 100; @@ -2937,6 +2948,7 @@ void Scene08::updateAnimationsCb() { void Scene08::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); @@ -2967,12 +2979,12 @@ void Scene08::run() { gameSys.insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); gnap.initPos(-1, 8, kDirBottomRight); - _vm->_plat->initPos(-1, 7, kDirNone); + plat.initPos(-1, 7, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(1, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 7), -1, 0x107C2, 1); _vm->_timers[5] = _vm->getRandom(40) + 50; @@ -3005,17 +3017,17 @@ void Scene08::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.actionIdle(0x14D); gnap.kissPlatypus(8); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: break; @@ -3028,7 +3040,7 @@ void Scene08::run() { gnap.actionIdle(0x14D); gnap.walkTo(Common::Point(0, 6), 0, 0x107AF, 1); gnap._actionStatus = kAS08LeaveScene; - _vm->_plat->walkTo(Common::Point(0, 7), 1, 0x107CF, 1); + plat.walkTo(Common::Point(0, 7), 1, 0x107CF, 1); _vm->_newSceneNum = 9; break; @@ -3037,7 +3049,7 @@ void Scene08::run() { gnap.actionIdle(0x14D); gnap.walkTo(Common::Point(3, 9), 0, 0x107AE, 1); gnap._actionStatus = kAS08LeaveScene; - _vm->_plat->walkTo(Common::Point(4, 9), 1, 0x107C1, 1); + plat.walkTo(Common::Point(4, 9), 1, 0x107C1, 1); _vm->_newSceneNum = 7; break; @@ -3064,9 +3076,9 @@ void Scene08::run() { case PLAT_CURSOR: gnap.actionIdle(0x14D); gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(6, 6), 1, 0x107C2, 1); - _vm->_plat->_actionStatus = kAS08PlatWithMan; - _vm->_plat->_idleFacing = kDirNone; + plat.walkTo(Common::Point(6, 6), 1, 0x107C2, 1); + plat._actionStatus = kAS08PlatWithMan; + plat._idleFacing = kDirNone; gnap.playIdle(6, 6); break; } @@ -3100,9 +3112,9 @@ void Scene08::run() { _vm->setFlag(kGFSceneFlag1); gnap.actionIdle(0x14D); gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107C2, 1); - _vm->_plat->_actionStatus = kAS08PlatWithDog; - _vm->_plat->_idleFacing = kDirNone; + plat.walkTo(Common::Point(3, 7), 1, 0x107C2, 1); + plat._actionStatus = kAS08PlatWithDog; + plat._idleFacing = kDirNone; gnap.playIdle(3, 7); break; } @@ -3205,11 +3217,11 @@ void Scene08::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 125; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextManSequenceId == -1 && + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextManSequenceId == -1 && (_currDogSequenceId == 0x134 || _currDogSequenceId == 0x135)) { int _gnapRandomValue = _vm->getRandom(4); switch (_gnapRandomValue) { @@ -3248,6 +3260,7 @@ void Scene08::run() { void Scene08::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -3287,13 +3300,13 @@ void Scene08::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_plat->_actionStatus) { + switch (plat._actionStatus) { case kAS08PlatWithDog: _nextDogSequenceId = 0x147; break; case kAS08PlatWithMan: _nextManSequenceId = 0x140; - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; break; } } @@ -3307,7 +3320,7 @@ void Scene08::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2) { if (_currDogSequenceId == 0x147) - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; if (_currDogSequenceId == 0x149 || _currDogSequenceId == 0x14A || _currDogSequenceId == 0x14B) { if (_vm->getRandom(2) != 0) _nextManSequenceId = 0x13D; @@ -3340,14 +3353,14 @@ void Scene08::updateAnimations() { } else if (_nextDogSequenceId == 0x147) { gameSys.setAnimation(_nextDogSequenceId, 100, 3); gameSys.insertSequence(_nextDogSequenceId, 100, _currDogSequenceId, 100, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x148, 160, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x148, 160, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); _currDogSequenceId = _nextDogSequenceId; _nextDogSequenceId = 0x134; - _vm->_plat->_pos = Common::Point(1, 8); - _vm->_plat->_id = 160; - _vm->_plat->_sequenceId = 0x148; - _vm->_plat->_idleFacing = kDirUnk4; - _vm->_plat->_sequenceDatNum = 0; + plat._pos = Common::Point(1, 8); + plat._id = 160; + plat._sequenceId = 0x148; + plat._idleFacing = kDirUnk4; + plat._sequenceDatNum = 0; if (gnap._pos == Common::Point(1, 8)) gnap.walkStep(); } else if (_nextDogSequenceId != -1) { @@ -3393,6 +3406,7 @@ void Scene09::updateHotspots() { void Scene09::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); @@ -3401,13 +3415,13 @@ void Scene09::run() { if (_vm->_prevSceneNum == 8) { gnap.initPos(11, 8, kDirBottomLeft); - _vm->_plat->initPos(12, 7, kDirUnk4); + plat.initPos(12, 7, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { gnap.initPos(4, 7, kDirBottomRight); - _vm->_plat->initPos(5, 7, kDirNone); + plat.initPos(5, 7, kDirNone); _vm->endSceneInit(); } @@ -3439,14 +3453,14 @@ void Scene09::run() { case kHS09Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: break; @@ -3458,8 +3472,8 @@ void Scene09::run() { _vm->_newSceneNum = 10; gnap.walkTo(Common::Point(4, 7), 0, 0x107BF, 1); gnap._actionStatus = kAS09LeaveScene; - _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); - _vm->_plat->_idleFacing = kDirUnk4; + plat.walkTo(Common::Point(4, 8), -1, 0x107D2, 1); + plat._idleFacing = kDirUnk4; break; case kHS09ExitHouse: @@ -3467,8 +3481,8 @@ void Scene09::run() { _vm->_newSceneNum = 8; gnap.walkTo(Common::Point(10, -1), 0, 0x107AB, 1); gnap._actionStatus = kAS09LeaveScene; - _vm->_plat->walkTo(Common::Point(10, -1), -1, 0x107CD, 1); - _vm->_plat->_idleFacing = kDirUnk4; + plat.walkTo(Common::Point(10, -1), -1, 0x107CD, 1); + plat._idleFacing = kDirUnk4; break; case kHS09Trash: @@ -3508,7 +3522,7 @@ void Scene09::run() { updateAnimations(); if (!_vm->_isLeavingScene && gnap._actionStatus != 1 && gnap._actionStatus != 2) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(150) + 100; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index d8b2a3ce28..a4e4e9f49c 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -60,6 +60,7 @@ void Scene10::updateHotspots() { void Scene10::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _currCookSequenceId = 0x103; @@ -74,16 +75,16 @@ void Scene10::run() { if (_vm->_prevSceneNum == 9) { gnap.initPos(11, 8, kDirBottomLeft); - _vm->_plat->initPos(12, 7, kDirUnk4); + plat.initPos(12, 7, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { gnap.initPos(-1, 7, kDirBottomRight); - _vm->_plat->initPos(-2, 8, kDirNone); + plat.initPos(-2, 8, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(1, 7), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } _vm->_timers[4] = _vm->getRandom(80) + 150; @@ -113,16 +114,16 @@ void Scene10::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); else - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(10); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: break; @@ -135,7 +136,7 @@ void Scene10::run() { gnap.actionIdle(0x10C); gnap.walkTo(Common::Point(0, 7), 0, 0x107AF, 1); gnap._actionStatus = kAS10LeaveScene; - _vm->_plat->walkTo(Common::Point(0, 7), -1, 0x107CF, 1); + plat.walkTo(Common::Point(0, 7), -1, 0x107CF, 1); _vm->_newSceneNum = 11; break; @@ -144,7 +145,7 @@ void Scene10::run() { gnap.actionIdle(0x10C); gnap.walkTo(Common::Point(2, 9), 0, 0x107AE, 1); gnap._actionStatus = kAS10LeaveScene; - _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C7, 1); + plat.walkTo(Common::Point(3, 9), -1, 0x107C7, 1); _vm->_newSceneNum = 9; break; @@ -171,7 +172,7 @@ void Scene10::run() { case PLAT_CURSOR: gnap.actionIdle(0x10C); gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(4, 6), -1, -1, 1); + plat.walkTo(Common::Point(4, 6), -1, -1, 1); gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); gnap._actionStatus = kAS10AnnoyCook; break; @@ -208,7 +209,7 @@ void Scene10::run() { else { gnap.actionIdle(0x10C); gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(3, 7), -1, -1, 1); + plat.walkTo(Common::Point(3, 7), -1, -1, 1); gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); gnap._actionStatus = kAS10AnnoyCook; } @@ -241,9 +242,9 @@ void Scene10::run() { _vm->setFlag(kGFMudTaken); gnap.actionIdle(0x10C); gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107D2, 1); - _vm->_plat->_actionStatus = kAS10PlatWithBox; - _vm->_plat->_idleFacing = kDirUnk4; + plat.walkTo(Common::Point(7, 6), 1, 0x107D2, 1); + plat._actionStatus = kAS10PlatWithBox; + plat._idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); gnap.playIdle(7, 6); } @@ -306,7 +307,7 @@ void Scene10::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(80) + 150; @@ -344,6 +345,7 @@ void Scene10::run() { void Scene10::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -359,7 +361,7 @@ void Scene10::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_plat->_actionStatus) { + switch (plat._actionStatus) { case kAS10PlatWithBox: _nextCookSequenceId = 0x109; break; @@ -370,19 +372,19 @@ void Scene10::updateAnimations() { switch (_nextCookSequenceId) { case 0x109: - _vm->_plat->_pos = Common::Point(4, 8); + plat._pos = Common::Point(4, 8); gameSys.insertSequence(0x109, 100, _currCookSequenceId, 100, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x107C9, 160, - _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, + plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, _vm->getSequenceTotalDuration(0x109) + _vm->getSequenceTotalDuration(0x10A) + _vm->getSequenceTotalDuration(0x10843), - 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); + 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); gameSys.removeSequence(0x107, 100, true); _currCookSequenceId = 0x109; _nextCookSequenceId = 0x843; - _vm->_plat->_sequenceId = 0x7C9; - _vm->_plat->_id = 160; - _vm->_plat->_idleFacing = kDirNone; - _vm->_plat->_sequenceDatNum = 1; + plat._sequenceId = 0x7C9; + plat._id = 160; + plat._idleFacing = kDirNone; + plat._sequenceDatNum = 1; break; case 0x843: _vm->hideCursor(); @@ -400,8 +402,8 @@ void Scene10::updateAnimations() { _vm->delayTicksCursor(5); _vm->deleteSurface(&_vm->_largeSprite); _vm->setGrabCursorSprite(kItemTongs); - if (_vm->_plat->_actionStatus == kAS10PlatWithBox) - _vm->_plat->_actionStatus = -1; + if (plat._actionStatus == kAS10PlatWithBox) + plat._actionStatus = -1; if (gnap._pos == Common::Point(4, 8)) gnap.walkStep(); break; @@ -413,7 +415,7 @@ void Scene10::updateAnimations() { switch (_currCookSequenceId) { case 0x106: - if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || plat._actionStatus >= 0) _nextCookSequenceId = 0x106; else { int rnd = _vm->getRandom(7); @@ -434,7 +436,7 @@ void Scene10::updateAnimations() { } break; case 0x103: - if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || plat._actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x104; @@ -442,7 +444,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; break; case 0x104: - if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || plat._actionStatus >= 0) _nextCookSequenceId = 0x106; else if (_vm->getRandom(7) == 0) _nextCookSequenceId = 0x103; @@ -450,7 +452,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x106; break; case 0x105: - if (gnap._actionStatus >= 0 || _vm->_plat->_actionStatus >= 0) + if (gnap._actionStatus >= 0 || plat._actionStatus >= 0) _nextCookSequenceId = 0x106; else { int rnd = _vm->getRandom(7); @@ -472,7 +474,7 @@ void Scene10::updateAnimations() { gnap._idleFacing = kDirUpRight; gnap._sequenceDatNum = 0; gnap._actionStatus = -1; - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; break; } if (_currCookSequenceId == 0x843) @@ -536,6 +538,7 @@ void Scene11::updateHotspots() { void Scene11::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; bool flag = true; @@ -548,22 +551,22 @@ void Scene11::run() { switch (_vm->_prevSceneNum) { case 13: gnap.initPos(8, 5, kDirBottomLeft); - _vm->_plat->initPos(9, 6, kDirUnk4); + plat.initPos(9, 6, kDirUnk4); break; case 47: gnap.initPos(8, 5, kDirBottomLeft); - _vm->_plat->initPos(9, 5, kDirUnk4); + plat.initPos(9, 5, kDirUnk4); _currGoggleGuySequenceId = 0x1FA; _currHookGuySequenceId = 0x1FF; _vm->_timers[7] = 180; break; case 12: gnap.initPos(-1, 9, kDirBottomRight); - _vm->_plat->initPos(-2, 8, kDirNone); + plat.initPos(-2, 8, kDirNone); break; default: gnap.initPos(6, 6, kDirBottomLeft); - _vm->_plat->initPos(6, 5, kDirUnk4); + plat.initPos(6, 5, kDirUnk4); break; } @@ -587,7 +590,7 @@ void Scene11::run() { if (_vm->_prevSceneNum == 12) { gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } gameSys.insertSequence(0x208, 256, 0, 0, kSeqNone, 40, 0, 0); @@ -608,14 +611,14 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: break; @@ -627,7 +630,7 @@ void Scene11::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(6, 5), 0, 0x107BF, 1); gnap._actionStatus = kAS11LeaveScene; - _vm->_plat->walkTo(Common::Point(6, 6), -1, -1, 1); + plat.walkTo(Common::Point(6, 6), -1, -1, 1); _vm->_newSceneNum = 10; break; @@ -635,7 +638,7 @@ void Scene11::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(8, 5), 0, 0x107BF, 1); gnap._actionStatus = kAS11LeaveScene; - _vm->_plat->walkTo(Common::Point(8, 6), -1, -1, 1); + plat.walkTo(Common::Point(8, 6), -1, -1, 1); _vm->_newSceneNum = 13; break; @@ -643,7 +646,7 @@ void Scene11::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(-1, 8), 0, 0x107AF, 1); gnap._actionStatus = kAS11LeaveScene; - _vm->_plat->walkTo(Common::Point(-1, 9), -1, 0x107CF, 1); + plat.walkTo(Common::Point(-1, 9), -1, 0x107CF, 1); _vm->_newSceneNum = 12; break; @@ -758,11 +761,11 @@ void Scene11::run() { gameSys.setAnimation(0x207, 257, 4); gameSys.insertSequence(0x207, 257, 0, 0, kSeqNone, 0, 0, 0); } - _vm->_plat->updateIdleSequence2(); + plat.updateIdleSequence2(); gnap.updateIdleSequence2(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 75; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextGoggleGuySequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextGoggleGuySequenceId == -1) { if (_vm->getRandom(2)) _nextGoggleGuySequenceId = 0x1F6; else @@ -771,7 +774,7 @@ void Scene11::run() { } if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(40) + 20; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextHookGuySequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextHookGuySequenceId == -1) { if (_currHookGuySequenceId == 0x201) { switch (_vm->getRandom(7)) { case 0: @@ -967,6 +970,8 @@ void Scene12::updateHotspots() { void Scene12::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; + int v18 = 1; _vm->queueInsertDeviceIcon(); @@ -998,14 +1003,14 @@ void Scene12::run() { if (_vm->_prevSceneNum == 15) { gnap.initPos(5, 6, kDirBottomRight); - _vm->_plat->initPos(3, 7, kDirNone); + plat.initPos(3, 7, kDirNone); _vm->endSceneInit(); } else { gnap.initPos(11, 8, kDirBottomLeft); - _vm->_plat->initPos(12, 8, kDirUnk4); + plat.initPos(12, 8, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } while (!_vm->_sceneDone) { @@ -1029,14 +1034,14 @@ void Scene12::run() { case kHS12Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: break; @@ -1047,7 +1052,7 @@ void Scene12::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(10, -1), 0, 0x107AB, 1); gnap._actionStatus = kAS12LeaveScene; - _vm->_plat->walkTo(Common::Point(10, -1), -1, -1, 1); + plat.walkTo(Common::Point(10, -1), -1, -1, 1); _vm->_newSceneNum = 11; break; @@ -1085,9 +1090,9 @@ void Scene12::run() { break; case PLAT_CURSOR: gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(3, 7), 1, 0x107D2, 1); - _vm->_plat->_actionStatus = kAS12PlatWithToothGuy; - _vm->_plat->_idleFacing = kDirUnk4; + plat.walkTo(Common::Point(3, 7), 1, 0x107D2, 1); + plat._actionStatus = kAS12PlatWithToothGuy; + plat._idleFacing = kDirUnk4; gnap.playIdle(2, 7); break; } @@ -1121,7 +1126,7 @@ void Scene12::run() { gnap._actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: - gnap.playPullOutDevice(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playPullOutDevice(plat._pos.x, plat._pos.y); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); gnap._actionStatus = kAS12PlatWithBarkeeper; break; @@ -1155,9 +1160,9 @@ void Scene12::run() { break; case PLAT_CURSOR: gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(7, 6), 1, 0x107C2, 1); - _vm->_plat->_actionStatus = kAS12PlatWithBeardGuy; - _vm->_plat->_idleFacing = kDirNone; + plat.walkTo(Common::Point(7, 6), 1, 0x107C2, 1); + plat._actionStatus = kAS12PlatWithBeardGuy; + plat._idleFacing = kDirNone; gnap.playIdle(7, 6); break; } @@ -1191,12 +1196,12 @@ void Scene12::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = 15; if (_nextToothGuySequenceId == -1) { - if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (v18 == 0 && _currBeardGuySequenceId == 0x202 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && plat._actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextToothGuySequenceId = 0x1EC; else @@ -1208,8 +1213,8 @@ void Scene12::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_nextBarkeeperSequenceId == -1 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (_nextBarkeeperSequenceId == -1 && gnap._actionStatus < 0 && plat._actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBeardGuySequenceId == 0x202 && gnap._actionStatus < 0 && plat._actionStatus < 0) { if (_vm->getRandom(2) != 0) _nextBarkeeperSequenceId = 0x208; else @@ -1221,8 +1226,8 @@ void Scene12::run() { } if (!_vm->_timers[6]) { _vm->_timers[6] = _vm->getRandom(30) + 15; - if (_nextBeardGuySequenceId == -1 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { - if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (_nextBeardGuySequenceId == -1 && gnap._actionStatus < 0 && plat._actionStatus < 0) { + if (v18 == 0 && _currToothGuySequenceId == 0x200 && _currBarkeeperSequenceId == 0x203 && gnap._actionStatus < 0 && plat._actionStatus < 0) _nextBeardGuySequenceId = 0x1F2; else _nextBeardGuySequenceId = 0x202; @@ -1264,6 +1269,7 @@ void Scene12::run() { void Scene12::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -1359,7 +1365,7 @@ void Scene12::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_plat->_actionStatus) { + switch (plat._actionStatus) { case kAS12PlatWithToothGuy: _nextToothGuySequenceId = 0x1EB; break; @@ -1407,8 +1413,8 @@ void Scene12::updateAnimations() { if (gnap._actionStatus >= kAS12TalkToothGuy && gnap._actionStatus <= kAS12QuarterToToothGuy && _currToothGuySequenceId != 0x1E9 && _currToothGuySequenceId != 0x1EC && _currToothGuySequenceId != 0x200) gnap._actionStatus = -1; - if (_vm->_plat->_actionStatus == kAS12PlatWithToothGuy) - _vm->_plat->_actionStatus = -1; + if (plat._actionStatus == kAS12PlatWithToothGuy) + plat._actionStatus = -1; } } @@ -1438,8 +1444,8 @@ void Scene12::updateAnimations() { _vm->_timers[6] = _vm->getRandom(30) + 20; if (gnap._actionStatus >= kAS12TalkBeardGuy && gnap._actionStatus <= kAS12ShowItemToBeardGuy && _currBeardGuySequenceId != 0x202 && _currBeardGuySequenceId != 0x1F2) gnap._actionStatus = -1; - if (_vm->_plat->_actionStatus == kAS12PlatWithBeardGuy) - _vm->_plat->_actionStatus = -1; + if (plat._actionStatus == kAS12PlatWithBeardGuy) + plat._actionStatus = -1; } } @@ -1496,6 +1502,7 @@ void Scene13::showScribble() { void Scene13::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; int currSoundId = 0; @@ -1504,10 +1511,10 @@ void Scene13::run() { if (_vm->_prevSceneNum == 14) { gnap.initPos(6, 6, kDirBottomLeft); - _vm->_plat->initPos(9, 8, kDirNone); + plat.initPos(9, 8, kDirNone); } else { gnap.initPos(3, 7, kDirBottomRight); - _vm->_plat->initPos(2, 7, kDirNone); + plat.initPos(2, 7, kDirNone); } _vm->endSceneInit(); @@ -1540,14 +1547,14 @@ void Scene13::run() { case kHS13Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: break; @@ -1558,7 +1565,7 @@ void Scene13::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(2, 7), 0, 0x107C0, 1); gnap._actionStatus = kAS13LeaveScene; - _vm->_plat->walkTo(Common::Point(2, 8), -1, -1, 1); + plat.walkTo(Common::Point(2, 8), -1, -1, 1); if (_vm->isFlag(kGFUnk14) || _vm->isFlag(kGFSpringTaken)) { _vm->_newSceneNum = 11; } else { @@ -1709,9 +1716,9 @@ void Scene13::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); - if (_vm->_plat->_pos.y == 5 || _vm->_plat->_pos.y == 6) - _vm->_plat->walkTo(Common::Point(-1, 7), -1, -1, 1); + plat.updateIdleSequence(); + if (plat._pos.y == 5 || plat._pos.y == 6) + plat.walkTo(Common::Point(-1, 7), -1, -1, 1); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { @@ -2350,22 +2357,23 @@ void Scene17::update() { void Scene17::platHangUpPhone() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; int savedGnapActionStatus = gnap._actionStatus; - if (_vm->_plat->_actionStatus == kAS17PlatPhoningAssistant) { + if (plat._actionStatus == kAS17PlatPhoningAssistant) { gnap._actionStatus = kAS17PlatHangUpPhone; _vm->updateMouseCursor(); _platPhoneCtr = 0; - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; gameSys.setAnimation(0x257, 254, 4); gameSys.insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (gameSys.getAnimationStatus(4) != 2) _vm->gameUpdateTick(); - gameSys.setAnimation(0x25B, _vm->_plat->_id, 1); - gameSys.insertSequence(0x25B, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceId = 0x25B; - _vm->_plat->_sequenceDatNum = 0; + gameSys.setAnimation(0x25B, plat._id, 1); + gameSys.insertSequence(0x25B, plat._id, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceId = 0x25B; + plat._sequenceDatNum = 0; _currPhoneSequenceId = -1; _nextPhoneSequenceId = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); @@ -2380,6 +2388,7 @@ void Scene17::platHangUpPhone() { void Scene17::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -2439,22 +2448,22 @@ void Scene17::run() { if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { if (_vm->_prevSceneNum == 20) { gnap.initPos(4, 6, kDirBottomRight); - _vm->_plat->initPos(5, 6, kDirNone); + plat.initPos(5, 6, kDirNone); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else if (_vm->isFlag(kGFUnk27)) { gnap.initPos(3, 9, kDirUpLeft); - _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; - _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; + plat._pos = _vm->_hotspotsWalkPos[2]; + plat._id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x257, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_plat->_sequenceId = 0x25A; - _vm->_plat->_sequenceDatNum = 0; + plat._sequenceId = 0x25A; + plat._sequenceDatNum = 0; _vm->endSceneInit(); _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); - _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; + plat._actionStatus = kAS17PlatPhoningAssistant; platHangUpPhone(); gameSys.setAnimation(0, 0, 4); _vm->clearFlag(kGFPlatypusTalkingToAssistant); @@ -2463,7 +2472,7 @@ void Scene17::run() { } else if (_vm->isFlag(kGFUnk25)) { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); - _vm->_plat->initPos(7, 9, kDirNone); + plat.initPos(7, 9, kDirNone); gnap._pos = _vm->_hotspotsWalkPos[2]; gnap._id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); @@ -2480,31 +2489,31 @@ void Scene17::run() { _vm->clearFlag(kGFUnk16); _vm->_sceneWaiting = true; gnap.initPos(3, 9, kDirUpLeft); - _vm->_plat->_pos = _vm->_hotspotsWalkPos[2]; - _vm->_plat->_id = 20 * _vm->_hotspotsWalkPos[2].y; + plat._pos = _vm->_hotspotsWalkPos[2]; + plat._id = 20 * _vm->_hotspotsWalkPos[2].y; _currPhoneSequenceId = 0x251; gameSys.insertSequence(0x25A, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(_currPhoneSequenceId, 254, 0, 0, kSeqNone, 0, 0, 0); - _vm->_plat->_sequenceId = 0x25A; - _vm->_plat->_sequenceDatNum = 0; + plat._sequenceId = 0x25A; + plat._sequenceDatNum = 0; _vm->endSceneInit(); gameSys.setAnimation(_currPhoneSequenceId, 254, 1); - _vm->_plat->_actionStatus = kAS17PlatPhoningAssistant; + plat._actionStatus = kAS17PlatPhoningAssistant; updateHotspots(); } else if (_vm->_prevSceneNum == 18) { gnap.initPos(6, 6, kDirBottomRight); - _vm->_plat->initPos(5, 6, kDirNone); + plat.initPos(5, 6, kDirNone); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { gnap.initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); - _vm->_plat->initPos(1, 9, kDirNone); + plat.initPos(1, 9, kDirNone); _vm->endSceneInit(); } else { gnap.initPos(3, 7, kDirBottomRight); - _vm->_plat->initPos(1, 7, kDirNone); + plat.initPos(1, 7, kDirNone); _vm->endSceneInit(); } _vm->clearFlag(kGFSpringTaken); @@ -2518,18 +2527,18 @@ void Scene17::run() { gnap._sequenceDatNum = 0; gnap._idleFacing = kDirBottomRight; gameSys.insertSequence(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0, 0, kSeqNone, 0, 0, 0); - _vm->_plat->_pos = Common::Point(-1, 8); - _vm->_plat->_id = 160; + plat._pos = Common::Point(-1, 8); + plat._id = 160; gameSys.insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); - gameSys.insertSequence(0x107C1, _vm->_plat->_id, 0x241, _vm->_plat->_id, - kSeqScale | kSeqSyncWait, 0, 75 * _vm->_plat->_pos.x - _vm->_plat->_gridX, 48 * _vm->_plat->_pos.y - _vm->_plat->_gridY); + gameSys.insertSequence(0x107C1, plat._id, 0x241, plat._id, + kSeqScale | kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); // TODO delayTicksA(2, 9); _vm->endSceneInit(); - _vm->_plat->_sequenceId = 0x7C1; - _vm->_plat->_sequenceDatNum = 1; - _vm->_plat->_idleFacing = kDirBottomRight; - _vm->_plat->walkTo(Common::Point(2, 9), -1, 0x107C2, 1); + plat._sequenceId = 0x7C1; + plat._sequenceDatNum = 1; + plat._idleFacing = kDirBottomRight; + plat.walkTo(Common::Point(2, 9), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -2554,25 +2563,25 @@ void Scene17::run() { gnap.useJointOnPlatypus(); } else { gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6], 1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[6], 1, 0x107C2, 1); gnap.walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 0, 0x107BA, 1); - _vm->_plat->_actionStatus = kAS17GetWrench1; + plat._actionStatus = kAS17GetWrench1; gnap._actionStatus = kAS17GetWrench1; _vm->_timers[5] = _vm->getRandom(30) + 80; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemJoint); } } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -2601,8 +2610,8 @@ void Scene17::run() { if (_canTryGetWrench) { platHangUpPhone(); gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 1, 0x107C2, 1); - _vm->_plat->_actionStatus = kAS17TryGetWrench; + plat.walkTo(_vm->_hotspotsWalkPos[6] + Common::Point(1, 0), 1, 0x107C2, 1); + plat._actionStatus = kAS17TryGetWrench; gnap._actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; } else @@ -2641,10 +2650,10 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; gnap.useDeviceOnPlatypus(); - _vm->_plat->_idleFacing = kDirUpLeft; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); + plat._idleFacing = kDirUpLeft; + plat.walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); - _vm->_plat->_actionStatus = kAS17PlatUsePhone; + plat._actionStatus = kAS17PlatUsePhone; gnap._actionStatus = kAS17PlatUsePhone; } else gnap.playImpossible(0, 0); @@ -2685,10 +2694,10 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; gnap.useDeviceOnPlatypus(); - _vm->_plat->_idleFacing = kDirUpLeft; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); + plat._idleFacing = kDirUpLeft; + plat.walkTo(_vm->_hotspotsWalkPos[2], 1, 0x107C2, 1); _vm->setFlag(kGFUnk16); - _vm->_plat->_actionStatus = kAS17PlatUsePhone; + plat._actionStatus = kAS17PlatUsePhone; gnap._actionStatus = kAS17PlatUsePhone; } else gnap.playImpossible(0, 0); @@ -2705,8 +2714,8 @@ void Scene17::run() { gnap._idleFacing = kDirUpRight; gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, 0x107BB, 1); gnap._actionStatus = kAS17LeaveScene; - if (_vm->_plat->_actionStatus != kAS17PlatPhoningAssistant) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[5] + Common::Point(-1, 0), -1, 0x107C2, 1); + if (plat._actionStatus != kAS17PlatPhoningAssistant) + plat.walkTo(_vm->_hotspotsWalkPos[5] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; @@ -2718,7 +2727,7 @@ void Scene17::run() { gnap._idleFacing = kDirUpLeft; gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, 0x107BC, 1); gnap._actionStatus = kAS17LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[3] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[3] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -2743,17 +2752,17 @@ void Scene17::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) - _vm->_plat->updateIdleSequence2(); + if (plat._actionStatus < 0) + plat.updateIdleSequence2(); gnap.updateIdleSequence2(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 200; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) + if (gnap._actionStatus < 0 && plat._actionStatus < 0) gameSys.insertSequence(0x22B, 21, 0, 0, kSeqNone, 0, 0, 0); } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x25C, 255, 0, 0, kSeqNone, 0, 0, 0); @@ -2767,7 +2776,7 @@ void Scene17::run() { } } } - if (_vm->_plat->_actionStatus < 0 && !_vm->_timers[5]) { + if (plat._actionStatus < 0 && !_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 80; if (_vm->isFlag(kGFGrassTaken) && _nextWrenchSequenceId == -1) { _nextWrenchSequenceId = 0x236; @@ -2844,6 +2853,7 @@ void Scene17::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -2898,9 +2908,9 @@ void Scene17::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_plat->_actionStatus) { + switch (plat._actionStatus) { case kAS17TryGetWrench: - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; ++_platTryGetWrenchCtr; if (_platTryGetWrenchCtr % 2 != 0) _nextWrenchSequenceId = 0x233; @@ -2915,16 +2925,16 @@ void Scene17::updateAnimations() { _nextCarWindowSequenceId = 0x249; break; case kAS17GetWrenchDone: - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; _vm->invAdd(kItemWrench); _vm->setGrabCursorSprite(kItemWrench); break; case kAS17PlatUsePhone: - gameSys.setAnimation(0x24E, _vm->_plat->_id, 1); - gameSys.insertSequence(0x24E, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_sequenceId = 0x24E; - _vm->_plat->_actionStatus = kAS17LeaveScene; + gameSys.setAnimation(0x24E, plat._id, 1); + gameSys.insertSequence(0x24E, plat._id, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceDatNum = 0; + plat._sequenceId = 0x24E; + plat._actionStatus = kAS17LeaveScene; _vm->_newSceneNum = 53; break; case kAS17PlatPhoningAssistant: @@ -2933,10 +2943,10 @@ void Scene17::updateAnimations() { _platPhoneCtr = 0; _nextPhoneSequenceId = -1; _currPhoneSequenceId = -1; - gameSys.insertSequence(0x25B, _vm->_plat->_id, 0x25A, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_sequenceId = 0x25B; - _vm->_plat->_actionStatus = -1; + gameSys.insertSequence(0x25B, plat._id, 0x25A, plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceDatNum = 0; + plat._sequenceId = 0x25B; + plat._actionStatus = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); _vm->_sceneWaiting = false; updateHotspots(); @@ -2944,9 +2954,9 @@ void Scene17::updateAnimations() { _nextPhoneSequenceId = kPlatPhoneSequenceIds[_platPhoneCtr]; gameSys.setAnimation(_nextPhoneSequenceId, 254, 1); gameSys.insertSequence(_nextPhoneSequenceId, 254, _currPhoneSequenceId, 254, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x25A, _vm->_plat->_id, 0x25A, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_sequenceId = 0x25A; + gameSys.insertSequence(0x25A, plat._id, 0x25A, plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceDatNum = 0; + plat._sequenceId = 0x25A; _currPhoneSequenceId = _nextPhoneSequenceId; } break; @@ -2960,27 +2970,27 @@ void Scene17::updateAnimations() { switch (_nextWrenchSequenceId) { case 0x233: gnap._actionStatus = -1; - gameSys.insertSequence(0x243, _vm->_plat->_id, - _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, + gameSys.insertSequence(0x243, plat._id, + plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; - _vm->_plat->_sequenceId = 0x243; - _vm->_plat->_sequenceDatNum = 0; - gameSys.setAnimation(0x243, _vm->_plat->_id, 1); + plat._sequenceId = 0x243; + plat._sequenceDatNum = 0; + gameSys.setAnimation(0x243, plat._id, 1); break; case 0x234: gnap._actionStatus = -1; - gameSys.insertSequence(0x242, _vm->_plat->_id, - _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, + gameSys.insertSequence(0x242, plat._id, + plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextWrenchSequenceId, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); _currWrenchSequenceId = _nextWrenchSequenceId; _nextWrenchSequenceId = -1; - _vm->_plat->_sequenceId = 0x242; - _vm->_plat->_sequenceDatNum = 0; - gameSys.setAnimation(0x242, _vm->_plat->_id, 1); + plat._sequenceId = 0x242; + plat._sequenceDatNum = 0; + gameSys.setAnimation(0x242, plat._id, 1); break; case 0x231: if (_vm->getRandom(2) != 0) @@ -3013,17 +3023,17 @@ void Scene17::updateAnimations() { _currWrenchSequenceId = 0x22E; _canTryGetWrench = false; } - gameSys.setAnimation(0x23F, _vm->_plat->_id, 1); + gameSys.setAnimation(0x23F, plat._id, 1); gameSys.insertSequence(0x10875, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x23F, _vm->_plat->_id, - _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, + gameSys.insertSequence(0x23F, plat._id, + plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); gnap._sequenceDatNum = 1; - _vm->_plat->_sequenceDatNum = 0; + plat._sequenceDatNum = 0; gnap._sequenceId = 0x875; - _vm->_plat->_sequenceId = 0x23F; + plat._sequenceId = 0x23F; gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); - _vm->_plat->_actionStatus = kAS17GetWrench2; + plat._actionStatus = kAS17GetWrench2; } break; default: @@ -3061,15 +3071,15 @@ void Scene17::updateAnimations() { break; case 0x249: gameSys.setAnimation(0x230, 40, 2); - gameSys.setAnimation(0x240, _vm->_plat->_id, 1); + gameSys.setAnimation(0x240, plat._id, 1); gameSys.insertSequence(0x230, 40, _currWrenchSequenceId, 40, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(_nextCarWindowSequenceId, 40, _currCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(0x240, _vm->_plat->_id, _vm->_plat->_sequenceId, _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x240, plat._id, plat._sequenceId, plat._id, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(0x23E, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gnap._sequenceId = 0x23E; gnap._sequenceDatNum = 0; - _vm->_plat->_sequenceId = 0x240; - _vm->_plat->_sequenceDatNum = 0; + plat._sequenceId = 0x240; + plat._sequenceDatNum = 0; gameSys.setAnimation(0x24A, 40, 3); gameSys.insertSequence(0x24A, 40, _nextCarWindowSequenceId, 40, kSeqSyncWait, 0, 0, 0); while (gameSys.getAnimationStatus(2) != 2) { @@ -3088,7 +3098,7 @@ void Scene17::updateAnimations() { _nextWrenchSequenceId = -1; _vm->setFlag(kGFGrassTaken); gnap._actionStatus = -1; - _vm->_plat->_actionStatus = 2; + plat._actionStatus = 2; updateHotspots(); _vm->_timers[5] = _vm->getRandom(30) + 80; break; @@ -3207,12 +3217,13 @@ void Scene18::gnapCarryGarbageCanTo(int gridX) { else direction = -1; } else { - if (gnap._pos.y == _vm->_plat->_pos.y) { + PlayerPlat& plat = *_vm->_plat; + if (gnap._pos.y == plat._pos.y) { if (nextGridX >= gnap._pos.x) { - if (nextGridX >= _vm->_plat->_pos.x && gnap._pos.x <= _vm->_plat->_pos.x) - _vm->_plat->makeRoom(); - } else if (nextGridX <= _vm->_plat->_pos.x && gnap._pos.x >= _vm->_plat->_pos.x) { - _vm->_plat->makeRoom(); + if (nextGridX >= plat._pos.x && gnap._pos.x <= plat._pos.x) + plat.makeRoom(); + } else if (nextGridX <= plat._pos.x && gnap._pos.x >= plat._pos.x) { + plat.makeRoom(); } } gnapSeqId = gnap._sequenceId; @@ -3299,11 +3310,12 @@ void Scene18::putDownGarbageCan(int animationIndex) { void Scene18::platEndPhoning(bool platFl) { GameSys& gameSys = *_vm->_gameSys; + PlayerPlat& plat = *_vm->_plat; if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) { _platPhoneIter = 0; _platPhoneCtr = 0; - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; if (_currPhoneSequenceId != -1) { gameSys.setAnimation(0x21E, 254, 3); gameSys.insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); @@ -3314,7 +3326,7 @@ void Scene18::platEndPhoning(bool platFl) { gameSys.setAnimation(0, 0, 3); _vm->clearFlag(kGFPlatypusTalkingToAssistant); if (platFl) { - _vm->_plat->_actionStatus = kAS18PlatComesHere; + plat._actionStatus = kAS18PlatComesHere; _vm->_timers[6] = 50; _vm->_sceneWaiting = true; } @@ -3357,6 +3369,7 @@ void Scene18::waitForGnapAction() { void Scene18::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _cowboyHatSurface = nullptr; @@ -3424,22 +3437,22 @@ void Scene18::run() { } if (_vm->_prevSceneNum == 17) { gnap.initPos(4, 11, kDirBottomRight); - _vm->_plat->initPos(5, 11, kDirNone); + plat.initPos(5, 11, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { gnap.initPos(7, 7, kDirBottomRight); - _vm->_plat->initPos(8, 7, kDirNone); + plat.initPos(8, 7, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { gnap.initPos(-1, 10, kDirBottomRight); - _vm->_plat->initPos(-1, 10, kDirNone); + plat.initPos(-1, 10, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 7), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } } @@ -3469,18 +3482,18 @@ void Scene18::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowItem(_vm->_grabCursorSpriteIndex, _vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playShowItem(_vm->_grabCursorSpriteIndex, plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -3688,7 +3701,7 @@ void Scene18::run() { gnap.walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore], 0, 0x107C0, 1); gnap._actionStatus = kAS18LeaveScene; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS18ExitToyStore] + Common::Point(1, 0), -1, 0x107C2, 1); } } break; @@ -3707,7 +3720,7 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS18ExitPhoneBooth] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -3726,7 +3739,7 @@ void Scene18::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(false); else - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity] + Common::Point(0, -1), -1, 0x107CF, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS18ExitGrubCity] + Common::Point(0, -1), -1, 0x107CF, 1); _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -3770,18 +3783,18 @@ void Scene18::run() { if (!_vm->_isLeavingScene) { if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - if (_vm->_plat->_actionStatus == kAS18PlatComesHere) { + if (plat._actionStatus == kAS18PlatComesHere) { if (!_vm->_timers[6]) { - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; _vm->_sceneWaiting = false; - _vm->_plat->initPos(-1, 10, kDirNone); - _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); + plat.initPos(-1, 10, kDirNone); + plat.walkTo(Common::Point(3, 9), -1, 0x107C2, 1); _vm->clearFlag(kGFPlatypusTalkingToAssistant); } } else { _vm->_hotspots[kHS18WalkArea1]._y2 += 48; _vm->_hotspots[kHS18WalkArea2]._x1 += 75; - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); _vm->_hotspots[kHS18WalkArea2]._x1 -= 75; _vm->_hotspots[kHS18WalkArea1]._y2 -= 48; } @@ -4120,6 +4133,7 @@ void Scene19::updateHotspots() { void Scene19::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); _toyGrabCtr = 0; @@ -4149,10 +4163,10 @@ void Scene19::run() { gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(40) + 50; gnap.initPos(3, 6, kDirBottomRight); - _vm->_plat->initPos(4, 6, kDirNone); + plat.initPos(4, 6, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(4, 9), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(5, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -4177,18 +4191,18 @@ void Scene19::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -4208,7 +4222,7 @@ void Scene19::run() { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) _vm->setFlag(kGFUnk27); else - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(1, 0), -1, 0x107C5, 1); + plat.walkTo(_vm->_hotspotsWalkPos[1] + Common::Point(1, 0), -1, 0x107C5, 1); _vm->_hotspots[kHS19WalkArea1]._flags &= ~SF_WALKABLE; } break; @@ -4331,7 +4345,7 @@ void Scene19::run() { if (!_vm->_isLeavingScene) { gnap.updateIdleSequence(); if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); if (!_vm->_timers[6] && _nextShopAssistantSequenceId == -1) { _vm->_timers[6] = _vm->getRandom(40) + 50; if (_vm->getRandom(4) != 0) { diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index c4f578de93..f3a677ae14 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -160,6 +160,7 @@ void Scene20::stopSounds() { void Scene20::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x10940, true); _vm->startSoundTimerA(8); @@ -209,46 +210,46 @@ void Scene20::run() { _vm->gameUpdateTick(); } gnap.initPos(11, 8, kDirBottomLeft); - _vm->_plat->initPos(11, 9, kDirUnk4); + plat.initPos(11, 9, kDirUnk4); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 9), -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { case 17: gnap.initPos(5, 11, kDirBottomRight); - _vm->_plat->initPos(6, 11, kDirNone); + plat.initPos(6, 11, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 18: gnap.initPos(11, 8, kDirBottomLeft); - _vm->_plat->initPos(11, 9, kDirUnk4); + plat.initPos(11, 9, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(6, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 21: gnap.initPos(-1, 8, kDirBottomLeft); - _vm->_plat->initPos(-1, 9, kDirUnk4); + plat.initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 22: gnap.initPos(7, 6, kDirBottomRight); - _vm->_plat->initPos(8, 6, kDirNone); + plat.initPos(8, 6, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(9, 9), -1, 0x107C2, 1); break; default: gnap.initPos(8, 6, kDirBottomLeft); - _vm->_plat->initPos(9, 6, kDirUnk4); + plat.initPos(9, 6, kDirUnk4); _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(9, 9), -1, 0x107C2, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; break; } @@ -281,14 +282,14 @@ void Scene20::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(20); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -306,8 +307,8 @@ void Scene20::run() { _vm->_newSceneNum = 21; gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); gnap._actionStatus = kAS20LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); - _vm->_plat->_idleFacing = kDirUnk4; + plat.walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); + plat._idleFacing = kDirUnk4; } break; @@ -319,7 +320,7 @@ void Scene20::run() { _vm->_newSceneNum = 17; gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone], 0, 0x107AE, 1); gnap._actionStatus = kAS20LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS20ExitPhone] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -332,7 +333,7 @@ void Scene20::run() { _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore], 0, 0x107AB, 1); gnap._actionStatus = kAS20LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore] + Common::Point(0, 1), -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideToyStore] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_hotspots[kHS20WalkArea2]._flags &= ~SF_WALKABLE; } break; @@ -345,8 +346,8 @@ void Scene20::run() { _vm->_newSceneNum = 22; gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); gnap._actionStatus = kAS20LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); - _vm->_plat->_idleFacing = kDirUnk4; + plat.walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); + plat._idleFacing = kDirUnk4; } break; @@ -358,7 +359,7 @@ void Scene20::run() { _vm->_newSceneNum = 24; gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld], 0, 0x107BB, 1); gnap._actionStatus = kAS20LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS20ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -471,9 +472,9 @@ void Scene20::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) { + if (plat._actionStatus < 0) { _vm->_hotspots[kHS20WalkArea1]._y2 += 48; - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; } if (gnap._actionStatus < 0) @@ -487,7 +488,7 @@ void Scene20::run() { } if (!_vm->_timers[7]) { _vm->_timers[7] = _vm->getRandom(100) + 100; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0) { switch (_vm->getRandom(3)) { case 0: gameSys.insertSequence(0x183, 253, 0, 0, kSeqNone, 0, 0, 0); @@ -740,6 +741,7 @@ void Scene21::updateHotspots() { void Scene21::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x10940, true); _vm->startSoundTimerA(6); @@ -749,7 +751,7 @@ void Scene21::run() { if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { gnap.initPos(5, 8, kDirBottomRight); - _vm->_plat->initPos(6, 8, kDirNone); + plat.initPos(6, 8, kDirNone); gameSys.insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); @@ -757,16 +759,16 @@ void Scene21::run() { _vm->clearFlag(kGFKeysTaken); } else { gnap.initPos(5, 11, kDirBottomRight); - _vm->_plat->initPos(6, 11, kDirNone); + plat.initPos(6, 11, kDirNone); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } } else { gnap.initPos(5, 11, kDirBottomRight); - _vm->_plat->initPos(6, 11, kDirNone); + plat.initPos(6, 11, kDirNone); _currOldLadySequenceId = 0x89; gameSys.setAnimation(0x89, 79, 3); gameSys.insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); @@ -774,7 +776,7 @@ void Scene21::run() { _vm->_timers[4] = _vm->getRandom(30) + 50; _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -801,14 +803,14 @@ void Scene21::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -880,7 +882,7 @@ void Scene21::run() { _vm->_newSceneNum = 20; gnap.walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity], 0, 0x107B3, 1); gnap._actionStatus = kAS21LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS21ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -904,7 +906,7 @@ void Scene21::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->isFlag(kGFTwigTaken) && !_vm->_timers[4] && _nextOldLadySequenceId == -1 && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(30) + 50; @@ -1035,6 +1037,7 @@ void Scene22::updateHotspots() { void Scene22::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; gameSys.insertSequence(0x5D, 254, 0, 0, kSeqNone, 0, 0, 0); @@ -1050,14 +1053,14 @@ void Scene22::run() { if (_vm->_prevSceneNum == 20) { gnap.initPos(2, 8, kDirBottomRight); - _vm->_plat->initPos(1, 8, kDirNone); + plat.initPos(1, 8, kDirNone); _vm->endSceneInit(); } else { gnap.initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); - _vm->_plat->initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); + plat.initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107C2, 1); } if (_vm->isFlag(kGFSceneFlag1)) { @@ -1119,14 +1122,14 @@ void Scene22::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -1142,7 +1145,7 @@ void Scene22::run() { _vm->_newSceneNum = 20; gnap.walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity], 0, 0x107AF, 1); gnap._actionStatus = kAS22LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS22ExitOutsideGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; @@ -1152,7 +1155,7 @@ void Scene22::run() { _vm->_newSceneNum = 23; gnap.walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity], 0, 0x107AB, 1); gnap._actionStatus = kAS22LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS22ExitBackGrubCity] + Common::Point(0, 1), -1, 0x107C2, 1); } break; @@ -1197,7 +1200,7 @@ void Scene22::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[6] && _nextCashierSequenceId == -1) { _vm->_timers[6] = _vm->getRandom(30) + 20; @@ -1288,6 +1291,7 @@ void Scene23::updateHotspots() { void Scene23::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->_timers[4] = _vm->getRandom(100) + 200; _vm->_timers[5] = _vm->getRandom(100) + 200; @@ -1301,12 +1305,12 @@ void Scene23::run() { _vm->queueInsertDeviceIcon(); gnap.initPos(-1, 7, kDirBottomRight); - _vm->_plat->initPos(-2, 7, kDirNone); + plat.initPos(-2, 7, kDirNone); gameSys.insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 7), -1, 0x107C2, 1); if (_vm->isFlag(kGFUnk24)) { gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); @@ -1344,14 +1348,14 @@ void Scene23::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -1401,7 +1405,7 @@ void Scene23::run() { _vm->_newSceneNum = 22; gnap.walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity], 0, 0x107AF, 1); gnap._actionStatus = kAS23LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity] + Common::Point(0, -1), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS23ExitFrontGrubCity] + Common::Point(0, -1), -1, 0x107C2, 1); } break; @@ -1422,7 +1426,7 @@ void Scene23::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4] && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(100) + 200; @@ -1546,6 +1550,8 @@ void Scene24::updateHotspots() { void Scene24::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; + int counter = 0; _vm->playSound(0x10940, true); @@ -1574,16 +1580,16 @@ void Scene24::run() { if (_vm->_prevSceneNum == 20) { gnap.initPos(1, 8, kDirBottomRight); - _vm->_plat->initPos(2, 8, kDirNone); + plat.initPos(2, 8, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(1, 9), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(2, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(2, 9), -1, 0x107C2, 1); } else { gnap.initPos(8, 8, kDirBottomLeft); - _vm->_plat->initPos(8, 8, kDirUnk4); + plat.initPos(8, 8, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(3, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(3, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -1613,14 +1619,14 @@ void Scene24::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -1636,7 +1642,7 @@ void Scene24::run() { _vm->_newSceneNum = 25; gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld], 0, 0x107AB, 1); gnap._actionStatus = kAS24LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS24ExitCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1647,7 +1653,7 @@ void Scene24::run() { gnap._idleFacing = kDirUpRight; gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS24LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1672,7 +1678,7 @@ void Scene24::run() { _vm->playSound(0x10940, true); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 50; @@ -1810,6 +1816,7 @@ void Scene25::playAnims(int index) { void Scene25::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x10940, true); _vm->startSoundTimerA(5); @@ -1825,16 +1832,16 @@ void Scene25::run() { if (_vm->_prevSceneNum == 24) { gnap.initPos(5, 11, kDirUpLeft); - _vm->_plat->initPos(6, 11, kDirUnk4); + plat.initPos(6, 11, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 7), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(6, 7), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 7), -1, 0x107C2, 1); } else { gnap.initPos(5, 6, kDirBottomRight); - _vm->_plat->initPos(6, 6, kDirNone); + plat.initPos(6, 6, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -1861,14 +1868,14 @@ void Scene25::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -1914,7 +1921,7 @@ void Scene25::run() { _vm->_newSceneNum = 24; gnap.walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld], 0, 0x107B4, 1); gnap._actionStatus = kAS25LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS25ExitOutsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -1926,7 +1933,7 @@ void Scene25::run() { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; gnap.walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld], 0, 0x107B1, 1); gnap._actionStatus = kAS25LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS25ExitInsideCircusWorld] + Common::Point(1, 0), -1, 0x107C2, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; } else { _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; @@ -1984,7 +1991,7 @@ void Scene25::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4] && _nextTicketVendorSequenceId == -1 && gnap._actionStatus == -1) { _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -2123,6 +2130,7 @@ void Scene26::updateHotspots() { void Scene26::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->startSoundTimerB(7); _vm->playSound(0x1093B, true); @@ -2145,13 +2153,13 @@ void Scene26::run() { if (_vm->_prevSceneNum == 25) { gnap.initPos(-1, 8, kDirBottomRight); - _vm->_plat->initPos(-2, 8, kDirNone); + plat.initPos(-2, 8, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else { gnap.initPos(2, 8, kDirBottomRight); - _vm->_plat->initPos(3, 8, kDirNone); + plat.initPos(3, 8, kDirNone); _vm->endSceneInit(); } @@ -2179,14 +2187,14 @@ void Scene26::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -2261,7 +2269,7 @@ void Scene26::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[5] && _nextKidSequenceId == -1) { _vm->_timers[5] = _vm->getRandom(20) + 50; @@ -2341,6 +2349,7 @@ void Scene27::updateHotspots() { void Scene27::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(4); @@ -2364,28 +2373,28 @@ void Scene27::run() { switch (_vm->_prevSceneNum) { case 26: gnap.initPos(7, 12, kDirBottomRight); - _vm->_plat->initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; case 29: gnap.initPos(-1, 8, kDirBottomRight); - _vm->_plat->initPos(-1, 9, kDirNone); + plat.initPos(-1, 9, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 31: gnap.initPos(12, 8, kDirBottomLeft); - _vm->_plat->initPos(12, 9, kDirUnk4); + plat.initPos(12, 9, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(8, 9), -1, 0x107C2, 1); + plat.walkTo(Common::Point(8, 9), -1, 0x107C2, 1); break; default: gnap.initPos(6, 8, kDirBottomRight); - _vm->_plat->initPos(5, 9, kDirNone); + plat.initPos(5, 9, kDirNone); _vm->endSceneInit(); break; } @@ -2415,14 +2424,14 @@ void Scene27::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -2488,7 +2497,7 @@ void Scene27::run() { _vm->_newSceneNum = 26; gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitCircus].y), 0, 0x107AE, 1); gnap._actionStatus = kAS27LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus] + Common::Point(1, 0), -1, 0x107C7, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS27ExitCircus] + Common::Point(1, 0), -1, 0x107C7, 1); } break; @@ -2498,7 +2507,7 @@ void Scene27::run() { _vm->_newSceneNum = 29; gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitArcade].y), 0, 0x107AF, 1); gnap._actionStatus = kAS27LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade] + Common::Point(0, 1), -1, 0x107CF, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS27ExitArcade] + Common::Point(0, 1), -1, 0x107CF, 1); } break; @@ -2508,7 +2517,7 @@ void Scene27::run() { _vm->_newSceneNum = 31; gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS27ExitBeerStand].y), 0, 0x107AB, 1); gnap._actionStatus = kAS27LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand] + Common::Point(0, 1), -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS27ExitBeerStand] + Common::Point(0, 1), -1, 0x107CD, 1); } break; @@ -2519,7 +2528,7 @@ void Scene27::run() { _vm->_newSceneNum = 28; gnap.walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown], 0, 0x107AD, 1); gnap._actionStatus = kAS27LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown] + Common::Point(1, 0), -1, 0x107C4, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS27ExitClown] + Common::Point(1, 0), -1, 0x107C4, 1); } else { _vm->_hotspots[kHS27WalkArea1]._flags |= SF_WALKABLE; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS27ExitClown].x, 7), 0, 0x107BC, 1); @@ -2549,7 +2558,7 @@ void Scene27::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (_vm->_debugLevel == 4) @@ -2719,6 +2728,7 @@ void Scene28::updateHotspots() { void Scene28::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1093C, true); _nextClownSequenceId = -1; @@ -2742,12 +2752,12 @@ void Scene28::run() { _vm->_timers[4] = _vm->getRandom(20) + 80; } gnap.initPos(8, 8, kDirBottomLeft); - _vm->_plat->initPos(9, 8, kDirUnk4); + plat.initPos(9, 8, kDirUnk4); _vm->endSceneInit(); } else { gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); gnap.initPos(8, 8, kDirBottomLeft); - _vm->_plat->initPos(9, 8, kDirUnk4); + plat.initPos(9, 8, kDirUnk4); _vm->endSceneInit(); _vm->playSequences(0xF7, 0x121, 0x122, 0x123); _currClownSequenceId = 0x115; @@ -2788,14 +2798,14 @@ void Scene28::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -2886,7 +2896,7 @@ void Scene28::run() { gnap.walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown], 0, 0x107BF, 1); gnap._actionStatus = kAS28LeaveScene; _vm->_hotspots[kHS28WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown] + Common::Point(-1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS28ExitOutsideClown] + Common::Point(-1, 0), -1, 0x107C2, 1); } break; @@ -2934,7 +2944,7 @@ void Scene28::run() { _vm->playSound(0x1093C, true); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 80; @@ -3118,6 +3128,7 @@ void Scene29::updateHotspots() { void Scene29::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); @@ -3145,16 +3156,16 @@ void Scene29::run() { if (_vm->_prevSceneNum == 27) { gnap.initPos(12, 7, kDirBottomRight); - _vm->_plat->initPos(12, 8, kDirNone); + plat.initPos(12, 8, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 7), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(8, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { gnap.initPos(-1, 7, kDirBottomRight); - _vm->_plat->initPos(-2, 7, kDirNone); + plat.initPos(-2, 7, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 7), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 7), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -3181,14 +3192,14 @@ void Scene29::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -3232,7 +3243,7 @@ void Scene29::run() { _vm->_newSceneNum = 26; gnap.walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus], 0, 0x107AE, 1); gnap._actionStatus = kAS29LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus] + Common::Point(1, 0), -1, -1, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS29ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; @@ -3242,7 +3253,7 @@ void Scene29::run() { _vm->_newSceneNum = 27; gnap.walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown], 0, 0x107AB, 1); gnap._actionStatus = kAS29LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown] + Common::Point(0, -1), -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS29ExitOutsideClown] + Common::Point(0, -1), -1, 0x107CD, 1); } break; @@ -3293,7 +3304,7 @@ void Scene29::run() { if (!_vm->_isLeavingScene) { if (gnap._actionStatus < 0) { gnap.updateIdleSequence(); - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); } if (!_vm->_timers[4]) { if (_vm->invHas(kItemHorn)) { diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index c0050c1567..a740d21a7e 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -47,6 +47,7 @@ void Scene30::updateHotspots() { void Scene30::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; bool hasTakenPill = false; @@ -67,10 +68,10 @@ void Scene30::run() { _kidSequenceId = 0x101; gnap.initPos(7, 12, kDirBottomRight); - _vm->_plat->initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); while (!_vm->_sceneDone) { _vm->updateMouseCursor(); @@ -96,14 +97,14 @@ void Scene30::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -150,7 +151,7 @@ void Scene30::run() { _vm->_newSceneNum = 26; gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS30ExitCircus].y), 0, 0x107AE, 1); gnap._actionStatus = kAS30LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus] + Common::Point(1, 0), -1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS30ExitCircus] + Common::Point(1, 0), -1, 0x107C2, 1); } break; @@ -173,7 +174,7 @@ void Scene30::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { @@ -299,6 +300,7 @@ void Scene31::updateHotspots() { void Scene31::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1093B, true); _vm->startSoundTimerB(6); @@ -317,16 +319,16 @@ void Scene31::run() { if (_vm->_prevSceneNum == 27) { gnap.initPos(-1, 8, kDirBottomLeft); - _vm->_plat->initPos(-1, 9, kDirUnk4); + plat.initPos(-1, 9, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(3, 9), -1, 0x107D2, 1); + plat.walkTo(Common::Point(3, 9), -1, 0x107D2, 1); } else { gnap.initPos(7, 12, kDirBottomRight); - _vm->_plat->initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirNone); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107D2, 1); } while (!_vm->_sceneDone) { @@ -353,14 +355,14 @@ void Scene31::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: gnap.playImpossible(0, 0); @@ -398,11 +400,11 @@ void Scene31::run() { case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags |= SF_WALKABLE; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 1, 0x107C2, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown], 1, 0x107C2, 1); _vm->_hotspots[kHS31WalkArea1]._flags &= ~SF_WALKABLE; - _vm->_plat->_actionStatus = kAS31PlatMeasuringClown; + plat._actionStatus = kAS31PlatMeasuringClown; gnap._actionStatus = kAS31PlatMeasuringClown; _vm->_timers[4] = 300; } else @@ -456,7 +458,7 @@ void Scene31::run() { _vm->_newSceneNum = 26; gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitCircus].y), 0, 0x107AE, 1); gnap._actionStatus = kAS31LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus] + Common::Point(1, 0), -1, -1, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS31ExitCircus] + Common::Point(1, 0), -1, -1, 1); } break; @@ -466,7 +468,7 @@ void Scene31::run() { _vm->_newSceneNum = 27; gnap.walkTo(Common::Point(-1, _vm->_hotspotsWalkPos[kHS31ExitOutsideClown].y), 0, 0x107AF, 1); gnap._actionStatus = kAS31LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown] + Common::Point(0, 1), -1, 0x107CF, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS31ExitOutsideClown] + Common::Point(0, 1), -1, 0x107CF, 1); } break; @@ -489,8 +491,8 @@ void Scene31::run() { _vm->playSound(0x1093B, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { @@ -539,6 +541,7 @@ void Scene31::run() { void Scene31::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -578,7 +581,7 @@ void Scene31::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - if (_vm->_plat->_actionStatus == kAS31PlatMeasuringClown) { + if (plat._actionStatus == kAS31PlatMeasuringClown) { _vm->_sceneWaiting = true; _beerGuyDistracted = true; _nextClerkSequenceId = 0xFA; @@ -599,7 +602,7 @@ void Scene31::updateAnimations() { ++_clerkMeasureCtr; if (_clerkMeasureCtr >= _clerkMeasureMaxCtr) { if (gnap._actionStatus != 5) - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; _vm->_timers[0] = 40; gameSys.insertSequence(0xFD, 39, _currClerkSequenceId, 39, kSeqSyncWait, 0, 0, 0); _currClerkSequenceId = 0xFD; @@ -663,6 +666,7 @@ void Scene32::updateHotspots() { void Scene32::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(5); @@ -671,13 +675,13 @@ void Scene32::run() { if (_vm->_prevSceneNum == 33) { gnap.initPos(11, 6, kDirBottomLeft); - _vm->_plat->initPos(12, 6, kDirUnk4); + plat.initPos(12, 6, kDirUnk4); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(9, 6), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 6), -1, 0x107D2, 1); gnap.walkTo(Common::Point(8, 6), -1, 0x107BA, 1); } else { gnap.initPos(1, 6, kDirBottomRight); - _vm->_plat->initPos(1, 7, kDirNone); + plat.initPos(1, 7, kDirNone); _vm->endSceneInit(); } @@ -700,21 +704,21 @@ void Scene32::run() { case kHS32Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -727,7 +731,7 @@ void Scene32::run() { _vm->setGrabCursorSprite(-1); gnap.walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck], 0, 0x107AB, 1); gnap._actionStatus = kAS32LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck] + Common::Point(0, 1), -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS32ExitTruck] + Common::Point(0, 1), -1, 0x107CD, 1); _vm->_newSceneNum = 33; } break; @@ -757,8 +761,8 @@ void Scene32::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { @@ -819,6 +823,7 @@ void Scene33::updateHotspots() { void Scene33::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->playSound(0x1091C, true); _vm->startSoundTimerC(6); @@ -834,26 +839,26 @@ void Scene33::run() { switch (_vm->_prevSceneNum) { case 34: gnap.initPos(11, 7, kDirBottomLeft); - _vm->_plat->initPos(12, 7, kDirUnk4); + plat.initPos(12, 7, kDirUnk4); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 7), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 7), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 7), -1, 0x107D2, 1); break; case 37: gnap.initPos(7, 7, kDirBottomRight); - _vm->_plat->initPos(8, 7, kDirNone); + plat.initPos(8, 7, kDirNone); _vm->endSceneInit(); break; case 32: gnap.initPos(-1, 6, kDirBottomRight); - _vm->_plat->initPos(-1, 7, kDirNone); + plat.initPos(-1, 7, kDirNone); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(2, 7), -1, 0x107C2, 1); + plat.walkTo(Common::Point(2, 7), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; default: gnap.initPos(3, 7, kDirBottomRight); - _vm->_plat->initPos(2, 7, kDirNone); + plat.initPos(2, 7, kDirNone); _vm->endSceneInit(); break; } @@ -877,21 +882,21 @@ void Scene33::run() { case kHS33Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -954,7 +959,7 @@ void Scene33::run() { _vm->_isLeavingScene = true; gnap.walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], 0, 0x107AB, 1); gnap._actionStatus = kAS33LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS33ExitCreek], -1, 0x107CD, 1); _vm->_newSceneNum = 34; } break; @@ -964,7 +969,7 @@ void Scene33::run() { _vm->_isLeavingScene = true; gnap.walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], 0, 0x107AF, 1); gnap._actionStatus = kAS33LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], -1, 0x107CF, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS33ExitPigpen], -1, 0x107CF, 1); _vm->_newSceneNum = 32; } break; @@ -989,8 +994,8 @@ void Scene33::run() { _vm->playSound(0x1091C, true); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { @@ -1094,6 +1099,7 @@ int Scene38::init() { void Scene38::updateHotspots() { PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->setHotspot(kHS38Platypus, 0, 0, 0, 0, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR); _vm->setHotspot(kHS38ExitHouse, 150, 585, 650, 600, SF_EXIT_D_CURSOR, 0, 8); @@ -1108,37 +1114,38 @@ void Scene38::updateHotspots() { _vm->setHotspot(kHS38WalkArea5, 770, 0, 799, 445); _vm->setHotspot(kHS38WalkArea6, 393, 0, 698, 445, SF_WALKABLE | SF_DISABLED); _vm->setDeviceHotspot(kHS38Device, -1, -1, -1, -1); - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38Platypus]._flags = SF_WALKABLE | SF_DISABLED; - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38ExitCave]._flags = SF_EXIT_D_CURSOR; - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_DISABLED; else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid1]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_DISABLED; else if (gnap._actionStatus == kAS38HoldingHuntingTrophy) _vm->_hotspots[kHS38TrapDoorLid2]._flags = SF_PLAT_CURSOR | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_hotspots[kHS38WalkArea6]._flags = SF_NONE; _vm->_hotspotsCount = 13; } void Scene38::run() { PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); _vm->_gameSys->insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); if (_vm->_prevSceneNum == 39) { gnap.initPos(3, 7, kDirBottomLeft); - _vm->_plat->initPos(4, 7, kDirUnk4); + plat.initPos(4, 7, kDirUnk4); } else { gnap.initPos(3, 8, kDirBottomRight); - _vm->_plat->initPos(4, 8, kDirNone); + plat.initPos(4, 8, kDirNone); } _vm->endSceneInit(); @@ -1159,21 +1166,21 @@ void Scene38::run() { if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { gnap._actionStatus = kAS38ReleaseHuntingTrophy; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -1193,9 +1200,9 @@ void Scene38::run() { case kHS38ExitCave: if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { gnap._actionStatus = kAS38ReleaseHuntingTrophy; - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) _vm->_isLeavingScene = true; - } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { + } else if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) { _vm->_sceneWaiting = false; _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(5, 7), 0, 0x107BB, 1); @@ -1207,7 +1214,7 @@ void Scene38::run() { case kHS38TrapDoorLid1: case kHS38TrapDoorLid2: if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { - if (_vm->_verbCursor == PLAT_CURSOR && _vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) + if (_vm->_verbCursor == PLAT_CURSOR && plat._actionStatus != kAS38PlatypusHoldingTrapDoor) gnap._actionStatus = kAS38UsePlatypusWithTrapDoor; else gnap._actionStatus = kAS38ReleaseHuntingTrophy; @@ -1224,11 +1231,11 @@ void Scene38::run() { gnap.playScratchingHead(0, 0); break; case GRAB_CURSOR: - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) gnap.playImpossible(0, 0); else { gnap.walkTo(Common::Point(3, 6), 0, 0x107BB, 1); - _vm->_plat->walkTo(Common::Point(4, 8), -1, -1, 1); + plat.walkTo(Common::Point(4, 8), -1, -1, 1); gnap._actionStatus = kAS38UseHuntingTrophy; } break; @@ -1272,7 +1279,7 @@ void Scene38::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - _vm->_plat->updateIdleSequence(); + plat.updateIdleSequence(); gnap.updateIdleSequence(); } @@ -1291,6 +1298,7 @@ void Scene38::run() { void Scene38::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -1299,7 +1307,7 @@ void Scene38::updateAnimations() { _vm->_sceneDone = true; break; case kAS38ExitCave: - gameSys.removeSequence(_vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, true); + gameSys.removeSequence(plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, true); gameSys.insertSequence(0xA3, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gnap._sequenceId = 0xA3; gnap._sequenceDatNum = 0; @@ -1316,7 +1324,7 @@ void Scene38::updateAnimations() { updateHotspots(); break; case kAS38HoldingHuntingTrophy: - if (_vm->_plat->_actionStatus != kAS38PlatypusHoldingTrapDoor) + if (plat._actionStatus != kAS38PlatypusHoldingTrapDoor) _vm->_sceneWaiting = true; if (gnap._sequenceId == 0xA4) { gameSys.insertSequence(0x9D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); @@ -1332,7 +1340,7 @@ void Scene38::updateAnimations() { if (gnap._sequenceId == 0x9E) { gameSys.insertSequence(0x9B, 0, 0, 0, kSeqNone, 0, 0, 0); gnap._actionStatus = -1; - } else if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { + } else if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) { gameSys.insertSequence(0xA0, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); gnap._sequenceId = 0xA0; gnap._sequenceDatNum = 0; @@ -1364,17 +1372,17 @@ void Scene38::updateAnimations() { gnap._sequenceDatNum = 0; gameSys.setAnimation(0x9F, gnap._id, 0); gnap._actionStatus = kAS38HoldingHuntingTrophy; - if (_vm->_plat->_idleFacing != kDirNone) - _vm->_plat->playSequence(0x107D5); + if (plat._idleFacing != kDirNone) + plat.playSequence(0x107D5); else - _vm->_plat->playSequence(0x107D4); - _vm->_plat->walkTo(Common::Point(8, 7), -1, 0x107D2, 1); - gameSys.insertSequence(0xA1, gnap._id + 1, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceId = 0xA1; - _vm->_plat->_sequenceDatNum = 0; - _vm->_plat->_id = gnap._id + 1; + plat.playSequence(0x107D4); + plat.walkTo(Common::Point(8, 7), -1, 0x107D2, 1); + gameSys.insertSequence(0xA1, gnap._id + 1, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceId = 0xA1; + plat._sequenceDatNum = 0; + plat._id = gnap._id + 1; gameSys.setAnimation(0xA1, gnap._id + 1, 1); - _vm->_plat->_actionStatus = kAS38PlatypusHoldingTrapDoor; + plat._actionStatus = kAS38PlatypusHoldingTrapDoor; updateHotspots(); break; } @@ -1382,10 +1390,10 @@ void Scene38::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - if (_vm->_plat->_actionStatus == kAS38PlatypusHoldingTrapDoor) { - gameSys.insertSequence(0xA2, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceId = 0xA2; - _vm->_plat->_sequenceDatNum = 0; + if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) { + gameSys.insertSequence(0xA2, plat._id, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceId = 0xA2; + plat._sequenceDatNum = 0; updateHotspots(); _vm->_sceneWaiting = true; } @@ -1421,6 +1429,7 @@ void Scene39::updateHotspots() { void Scene39::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; // Bug in the original? Timer was never initialized. _vm->_timers[5] = 0; @@ -1435,11 +1444,11 @@ void Scene39::run() { _nextGuySequenceId = -1; if (_vm->_prevSceneNum == 38) { gnap.initPos(3, 7, kDirUpRight); - _vm->_plat->initPos(2, 7, kDirUpLeft); + plat.initPos(2, 7, kDirUpLeft); _vm->endSceneInit(); } else { gnap.initPos(4, 7, kDirBottomRight); - _vm->_plat->initPos(5, 7, kDirNone); + plat.initPos(5, 7, kDirNone); _vm->endSceneInit(); } @@ -1467,21 +1476,21 @@ void Scene39::run() { case kHS39Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -1544,8 +1553,8 @@ void Scene39::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0) + plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); if (!_vm->_timers[5]) { diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 154f837ea1..3cbfe4d967 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -53,6 +53,7 @@ void Scene40::updateHotspots() { void Scene40::run() { PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); _vm->endSceneInit(); @@ -78,21 +79,21 @@ void Scene40::run() { case kHS40Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -224,6 +225,7 @@ void Scene41::updateHotspots() { void Scene41::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); @@ -274,23 +276,23 @@ void Scene41::run() { gnap._id = 140; gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); - _vm->_plat->initPos(8, 10, kDirBottomLeft); + plat.initPos(8, 10, kDirBottomLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 45) { gnap.initPos(-1, 8, kDirUpRight); - _vm->_plat->initPos(-2, 8, kDirUpLeft); + plat.initPos(-2, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 42) { gnap.initPos(11, 8, kDirUpRight); - _vm->_plat->initPos(11, 9, kDirUpLeft); + plat.initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { gnap.initPos(5, 8, kDirBottomRight); - _vm->_plat->initPos(6, 8, kDirBottomLeft); + plat.initPos(6, 8, kDirBottomLeft); _vm->endSceneInit(); } @@ -355,21 +357,21 @@ void Scene41::run() { case kHS41Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -387,7 +389,7 @@ void Scene41::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), 0, 0x107AF, 1); gnap._actionStatus = kAS41LeaveScene; - _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), -1, 0x107CF, 1); + plat.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41Exit].x, -1), -1, 0x107CF, 1); _vm->_newSceneNum = 45; break; @@ -395,7 +397,7 @@ void Scene41::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), 0, 0x107AB, 1); gnap._actionStatus = kAS41LeaveScene; - _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), -1, 0x107CD, 1); + plat.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS41ExitBBQ].x, -1), -1, 0x107CD, 1); _vm->_newSceneNum = 42; break; @@ -514,13 +516,13 @@ void Scene41::run() { updateAnimations(); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0) + plat.updateIdleSequence(); if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { switch (_vm->getRandom(3)) { case 0: _nextToyVendorSequenceId = 0x113; @@ -538,7 +540,7 @@ void Scene41::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { if (_vm->isFlag(kGFGnapControlsToyUFO)) _nextKidSequenceId = 0x11B; else if (_vm->getRandom(3) != 0) @@ -756,6 +758,7 @@ void Scene42::updateHotspots() { void Scene42::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); @@ -792,22 +795,22 @@ void Scene42::run() { _vm->setGrabCursorSprite(-1); } else if (_vm->_prevSceneNum == 41) { gnap.initPos(-1, 8, kDirUpRight); - _vm->_plat->initPos(-1, 9, kDirUpLeft); + plat.initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 43) { gnap.initPos(11, 8, kDirUpRight); - _vm->_plat->initPos(11, 9, kDirUpLeft); + plat.initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { gnap.initPos(5, 11, kDirUpRight); - _vm->_plat->initPos(6, 11, kDirUpLeft); + plat.initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); } while (!_vm->_sceneDone) { @@ -869,21 +872,21 @@ void Scene42::run() { case kHS42Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -894,7 +897,7 @@ void Scene42::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(gnap._pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), 0, 0x107AE, 1); gnap._actionStatus = kAS42LeaveScene; - _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), -1, 0x107C7, 1); + plat.walkTo(Common::Point(plat._pos.x, _vm->_hotspotsWalkPos[kHS42ExitUfoParty].y), -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; @@ -902,7 +905,7 @@ void Scene42::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitToyStand].x, gnap._pos.y), 0, 0x107AF, 1); gnap._actionStatus = kAS42LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand], -1, 0x107CF, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS42ExitToyStand], -1, 0x107CF, 1); _vm->_newSceneNum = 41; break; @@ -910,7 +913,7 @@ void Scene42::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS42ExitUfo].x, gnap._pos.y), 0, 0x107AB, 1); gnap._actionStatus = kAS42LeaveScene; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo], -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS42ExitUfo], -1, 0x107CD, 1); _vm->_newSceneNum = 43; break; @@ -918,8 +921,8 @@ void Scene42::run() { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { gnap.walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, 0x107BB, 1); gnap._actionStatus = kAS42UseQuarterWithBBQVendor; - if (_vm->_plat->_pos.y < 9) - _vm->_plat->walkTo(Common::Point(_vm->_plat->_pos.x, 9), -1, -1, 1); + if (plat._pos.y < 9) + plat.walkTo(Common::Point(plat._pos.x, 9), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { @@ -984,13 +987,13 @@ void Scene42::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + plat.updateIdleSequence(); if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 30; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextBBQVendorSequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextBBQVendorSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: _nextBBQVendorSequenceId = 0x14C; @@ -1208,6 +1211,7 @@ void Scene43::updateHotspots() { void Scene43::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); @@ -1236,30 +1240,30 @@ void Scene43::run() { switch (_vm->_prevSceneNum) { case 42: gnap.initPos(-1, 8, kDirUpRight); - _vm->_plat->initPos(-1, 9, kDirUpLeft); + plat.initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 44: gnap.initPos(11, 8, kDirUpRight); - _vm->_plat->initPos(11, 9, kDirUpLeft); + plat.initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; case 54: gnap.initPos(4, 7, kDirBottomLeft); - _vm->_plat->initPos(11, 8, kDirUpLeft); + plat.initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107D2, 1); break; default: gnap.initPos(5, 11, kDirUpRight); - _vm->_plat->initPos(6, 11, kDirUpLeft); + plat.initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; } } @@ -1329,21 +1333,21 @@ void Scene43::run() { case kHS43Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -1354,7 +1358,7 @@ void Scene43::run() { _vm->_isLeavingScene = true; gnap.walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], 0, 0x107AE, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], -1, 0x107C7, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS43ExitUfoParty], -1, 0x107C7, 1); _vm->_newSceneNum = 40; break; @@ -1362,7 +1366,7 @@ void Scene43::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitBBQ].x, gnap._pos.y), 0, 0x107AF, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ], -1, 0x107CF, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS43ExitBBQ], -1, 0x107CF, 1); _vm->_newSceneNum = 42; break; @@ -1370,7 +1374,7 @@ void Scene43::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth].x, gnap._pos.y), 0, 0x107AB, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth], -1, 0x107CD, 1); + plat.walkTo(_vm->_hotspotsWalkPos[kHS43ExitKissinBooth], -1, 0x107CD, 1); _vm->_newSceneNum = 44; break; @@ -1440,13 +1444,13 @@ void Scene43::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + plat.updateIdleSequence(); if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) gnap.updateIdleSequence(); if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { switch (_vm->getRandom(5)) { case 0: _nextTwoHeadedGuySequenceId = 0x13C; @@ -1643,6 +1647,7 @@ void Scene44::updateHotspots() { void Scene44::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); @@ -1692,39 +1697,39 @@ void Scene44::run() { switch (_vm->_prevSceneNum) { case 43: gnap.initPos(-1, 8, kDirUpRight); - _vm->_plat->initPos(-1, 7, kDirUpLeft); + plat.initPos(-1, 7, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); break; case 46: gnap.initPos(11, 8, kDirUpRight); - _vm->_plat->initPos(11, 8, kDirUpLeft); + plat.initPos(11, 8, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(6, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(7, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(7, 8), -1, 0x107D2, 1); break; case 50: gnap.initPos(4, 8, kDirBottomRight); if (_vm->_sceneSavegameLoaded) { - _vm->_plat->initPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); + plat.initPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); } else if (!_vm->isFlag(kGFUnk13)) { _vm->_timers[0] = 50; _vm->_timers[1] = 20; - _vm->_plat->_pos = Common::Point(5, 8); - _vm->_plat->_sequenceId = 0xFD; - _vm->_plat->_idleFacing = kDirNone; - _vm->_plat->_id = 160; - _vm->_plat->_sequenceDatNum = 0; + plat._pos = Common::Point(5, 8); + plat._sequenceId = 0xFD; + plat._idleFacing = kDirNone; + plat._id = 160; + plat._sequenceDatNum = 0; gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); } _vm->endSceneInit(); break; default: gnap.initPos(5, 11, kDirUpRight); - _vm->_plat->initPos(6, 11, kDirUpLeft); + plat.initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(6, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); break; } @@ -1779,21 +1784,21 @@ void Scene44::run() { case kHS44Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -1811,7 +1816,7 @@ void Scene44::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, gnap._pos.y), 0, 0x107AF, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); + plat.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS44ExitUfo].x, plat._pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 43; break; @@ -1842,11 +1847,11 @@ void Scene44::run() { break; case PLAT_CURSOR: gnap.useDeviceOnPlatypus(); - _vm->_plat->walkTo(Common::Point(6, 7), 1, 0x107D2, 1); + plat.walkTo(Common::Point(6, 7), 1, 0x107D2, 1); if (gnap._pos == Common::Point(7, 7)) gnap.walkStep(); gnap.playIdle(5, 7); - _vm->_plat->_actionStatus = 4; + plat._actionStatus = 4; break; } } @@ -1924,13 +1929,13 @@ void Scene44::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) + plat.updateIdleSequence(); if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextKissingLadySequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextKissingLadySequenceId == -1) { switch (_vm->getRandom(20)) { case 0: _nextKissingLadySequenceId = 0xED; @@ -1957,7 +1962,7 @@ void Scene44::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 20; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSpringGuySequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextSpringGuySequenceId == -1) { if (_vm->getRandom(5) != 0) { if (!_vm->isFlag(kGFSpringTaken)) _nextSpringGuySequenceId = 0xF9; @@ -1987,6 +1992,7 @@ void Scene44::run() { void Scene44::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -2006,15 +2012,15 @@ void Scene44::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); - switch (_vm->_plat->_actionStatus) { + switch (plat._actionStatus) { case 4: if (gameSys.getAnimationStatus(2) == 2) { - gameSys.insertSequence(0xFE, _vm->_plat->_id, _vm->_plat->_sequenceId | (_vm->_plat->_sequenceDatNum << 16), _vm->_plat->_id, kSeqSyncWait, 0, 0, 0); - _vm->_plat->_sequenceId = 0xFE; - _vm->_plat->_sequenceDatNum = 0; - gameSys.setAnimation(0xFE, _vm->_plat->_id, 1); + gameSys.insertSequence(0xFE, plat._id, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); + plat._sequenceId = 0xFE; + plat._sequenceDatNum = 0; + gameSys.setAnimation(0xFE, plat._id, 1); gameSys.removeSequence(_currKissingLadySequenceId, 1, true); - _vm->_plat->_actionStatus = 5; + plat._actionStatus = 5; } break; case 5: @@ -2022,7 +2028,7 @@ void Scene44::updateAnimations() { _vm->_newSceneNum = 50; break; default: - _vm->_plat->_actionStatus = -1; + plat._actionStatus = -1; break; } } @@ -2030,7 +2036,7 @@ void Scene44::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextKissingLadySequenceId == 0xF6) { gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_plat->initPos(5, 8, kDirNone); + plat.initPos(5, 8, kDirNone); _currKissingLadySequenceId = _nextKissingLadySequenceId; _nextKissingLadySequenceId = -1; gameSys.setAnimation(0, 0, 2); @@ -2126,6 +2132,7 @@ void Scene45::updateHotspots() { void Scene45::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); @@ -2159,25 +2166,25 @@ void Scene45::run() { gameSys.setAnimation(0x9E, 1, 0); gnap._actionStatus = 1; gameSys.insertSequence(gnap._sequenceId, gnap._id, 0, 0, kSeqNone, 0, 0, 0); - _vm->_plat->initPos(4, 8, kDirNone); + plat.initPos(4, 8, kDirNone); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { gnap.initPos(-1, 8, kDirUpRight); - _vm->_plat->initPos(-1, 9, kDirUpLeft); + plat.initPos(-1, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(4, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 41) { gnap.initPos(11, 8, kDirUpRight); - _vm->_plat->initPos(11, 9, kDirUpLeft); + plat.initPos(11, 9, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(4, 8), -1, 0x107D2, 1); gnap.walkTo(Common::Point(10, 9), -1, 0x107BA, 1); } else { gnap.initPos(2, 11, kDirUpRight); - _vm->_plat->initPos(6, 11, kDirUpLeft); + plat.initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(4, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(4, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } @@ -2220,8 +2227,8 @@ void Scene45::run() { gnap._sequenceDatNum = 1; } - _vm->_plat->playSequence(0x9A); - gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); + plat.playSequence(0x9A); + gameSys.setAnimation(plat._sequenceId, plat._id, 1); while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094A)) @@ -2270,23 +2277,23 @@ void Scene45::run() { case kHS45Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); - _vm->_plat->playSequence(0x9A); - gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); + plat.playSequence(0x9A); + gameSys.setAnimation(plat._sequenceId, plat._id, 1); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -2307,7 +2314,7 @@ void Scene45::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, gnap._pos.y), 0, 0x107AF, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); + plat.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitShoe].x, plat._pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 46; } break; @@ -2317,7 +2324,7 @@ void Scene45::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, gnap._pos.y), 0, 0x107AB, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); + plat.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS45ExitRight].x, plat._pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 41; } break; @@ -2393,6 +2400,7 @@ void Scene45::run() { void Scene45::updateAnimations() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; if (gameSys.getAnimationStatus(0) == 2) { gameSys.setAnimation(0, 0, 0); @@ -2418,10 +2426,10 @@ void Scene45::updateAnimations() { if (gameSys.getAnimationStatus(1) == 2) { gameSys.setAnimation(0, 0, 1); if (_vm->getRandom(2) != 0) - _vm->_plat->playSequence(0x9B); + plat.playSequence(0x9B); else - _vm->_plat->playSequence(0x9C); - gameSys.setAnimation(_vm->_plat->_sequenceId, _vm->_plat->_id, 1); + plat.playSequence(0x9C); + gameSys.setAnimation(plat._sequenceId, plat._id, 1); } if (gameSys.getAnimationStatus(2) == 2) { @@ -2501,6 +2509,7 @@ void Scene46::updateHotspots() { void Scene46::run() { GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; + PlayerPlat& plat = *_vm->_plat; _vm->queueInsertDeviceIcon(); gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); @@ -2529,21 +2538,21 @@ void Scene46::run() { _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 44) { gnap.initPos(-1, 8, kDirUpRight); - _vm->_plat->initPos(-1, 8, kDirUpLeft); + plat.initPos(-1, 8, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(1, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); } else if (_vm->_prevSceneNum == 45) { gnap.initPos(11, 8, kDirUpRight); - _vm->_plat->initPos(12, 8, kDirUpLeft); + plat.initPos(12, 8, kDirUpLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); - _vm->_plat->walkTo(Common::Point(9, 8), -1, 0x107D2, 1); + plat.walkTo(Common::Point(9, 8), -1, 0x107D2, 1); } else { gnap.initPos(5, 11, kDirUpRight); - _vm->_plat->initPos(6, 11, kDirUpLeft); + plat.initPos(6, 11, kDirUpLeft); _vm->endSceneInit(); - _vm->_plat->walkTo(Common::Point(5, 8), -1, 0x107C2, 1); + plat.walkTo(Common::Point(5, 8), -1, 0x107C2, 1); gnap.walkTo(Common::Point(6, 8), -1, 0x107BA, 1); } @@ -2597,21 +2606,21 @@ void Scene46::run() { case kHS46Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playMoan1(plat._pos.x, plat._pos.y); break; case GRAB_CURSOR: gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_plat->_pos.x, _vm->_plat->_pos.y); - _vm->_plat->playSequence(_vm->_plat->getSequenceId()); + gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(_vm->_plat->_pos.x, _vm->_plat->_pos.y); + gnap.playImpossible(plat._pos.x, plat._pos.y); break; } } @@ -2671,7 +2680,7 @@ void Scene46::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, gnap._pos.y), 0, 0x107AF, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, _vm->_plat->_pos.y), -1, 0x107CF, 1); + plat.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitKissinBooth].x, plat._pos.y), -1, 0x107CF, 1); _vm->_newSceneNum = 44; break; @@ -2679,7 +2688,7 @@ void Scene46::run() { _vm->_isLeavingScene = true; gnap.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, gnap._pos.y), 0, 0x107AB, 1); gnap._actionStatus = 0; - _vm->_plat->walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, _vm->_plat->_pos.y), -1, 0x107CD, 1); + plat.walkTo(Common::Point(_vm->_hotspotsWalkPos[kHS46ExitDisco].x, plat._pos.y), -1, 0x107CD, 1); _vm->_newSceneNum = 45; break; @@ -2704,13 +2713,13 @@ void Scene46::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_plat->_actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) - _vm->_plat->updateIdleSequence(); + if (plat._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) + plat.updateIdleSequence(); if (gnap._actionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) gnap.updateIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 80; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextItchyGuySequenceId == -1) { + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextItchyGuySequenceId == -1) { if (_vm->getRandom(2) != 0) _nextItchyGuySequenceId = 0x49; else @@ -2719,7 +2728,7 @@ void Scene46::run() { } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 80; - if (gnap._actionStatus < 0 && _vm->_plat->_actionStatus < 0 && _nextSackGuySequenceId == -1) + if (gnap._actionStatus < 0 && plat._actionStatus < 0 && _nextSackGuySequenceId == -1) _nextSackGuySequenceId = 0x4C; } } -- cgit v1.2.3 From b605baef85cab9d562d541a4b14e8fbf564a8267 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 11:06:06 +0200 Subject: GNAP: Reorder functions in grid.cpp --- engines/gnap/grid.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index b817b65102..076705cd03 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -38,26 +38,6 @@ void GnapEngine::initSceneGrid(int gridMinX, int gridMinY, int gridMaxX, int gri _plat->_gridY = 347 - gridMinY; } -int PlayerGnap::getWalkStopSequenceId(int deltaX, int deltaY) { - static const int gnapWalkStopSequenceIds[9] = { - 0x7BC, 0x7BA, 0x7BA, - 0x7BC, 0x000, 0x7BA, - 0x7BB, 0x7B9, 0x7B9 - }; - // CHECKME This is a little weird - return gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY]; -} - -Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) { - static const Facing gnapWalkFacings[9] = { - kDirUpLeft, kDirBottomLeft, kDirBottomLeft, - kDirUpLeft, kDirNone, kDirBottomLeft, - kDirUpRight, kDirBottomRight, kDirBottomRight - }; - // CHECKME This is a little weird - return gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; -} - bool GnapEngine::isPointBlocked(Common::Point gridPos) { return isPointBlocked(gridPos.x, gridPos.y); } @@ -85,6 +65,26 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { /******************************************************************************/ +int PlayerGnap::getWalkStopSequenceId(int deltaX, int deltaY) { + static const int gnapWalkStopSequenceIds[9] = { + 0x7BC, 0x7BA, 0x7BA, + 0x7BC, 0x000, 0x7BA, + 0x7BB, 0x7B9, 0x7B9 + }; + // CHECKME This is a little weird + return gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY]; +} + +Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) { + static const Facing gnapWalkFacings[9] = { + kDirUpLeft, kDirBottomLeft, kDirBottomLeft, + kDirUpLeft, kDirNone, kDirBottomLeft, + kDirUpRight, kDirBottomRight, kDirBottomRight + }; + // CHECKME This is a little weird + return gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; +} + bool PlayerGnap::findPath1(int gridX, int gridY, int index) { _walkNodesCount = index; _walkDirXIncr = 0; -- cgit v1.2.3 From a67a9923a928965feb33e86b2c9cb0f18af25ae5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 19:44:22 +0200 Subject: GNAP: Refactoring of playBrainPulsating, playIdle and playImpossible --- engines/gnap/character.cpp | 12 ++-- engines/gnap/character.h | 6 +- engines/gnap/scenes/group0.cpp | 122 ++++++++++++++++++++--------------------- engines/gnap/scenes/group1.cpp | 118 +++++++++++++++++++-------------------- engines/gnap/scenes/group2.cpp | 114 +++++++++++++++++++------------------- engines/gnap/scenes/group2.h | 2 +- engines/gnap/scenes/group3.cpp | 60 ++++++++++---------- engines/gnap/scenes/group4.cpp | 72 ++++++++++++------------ 8 files changed, 253 insertions(+), 253 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 094691300f..32f3946668 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -1057,8 +1057,8 @@ void PlayerGnap::actionIdle(int sequenceId) { } } -void PlayerGnap::playImpossible(int gridX, int gridY) { - playSequence(getSequenceId(gskImpossible, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playImpossible(Common::Point gridPos) { + playSequence(getSequenceId(gskImpossible, gridPos) | 0x10000); } void PlayerGnap::playScratchingHead(int gridX, int gridY) { @@ -1073,8 +1073,8 @@ void PlayerGnap::playMoan2(int gridX, int gridY) { playSequence(getSequenceId(gskMoan2, Common::Point(gridX, gridY)) | 0x10000); } -void PlayerGnap::playBrainPulsating(int gridX, int gridY) { - playSequence(getSequenceId(gskBrainPulsating, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playBrainPulsating(Common::Point gridPos) { + playSequence(getSequenceId(gskBrainPulsating, gridPos) | 0x10000); } void PlayerGnap::playPullOutDevice(int gridX, int gridY) { @@ -1089,8 +1089,8 @@ void PlayerGnap::playUseDevice(int gridX, int gridY) { playSequence(getSequenceId(gskUseDevice, Common::Point(gridX, gridY)) | 0x10000); } -void PlayerGnap::playIdle(int gridX, int gridY) { - playSequence(getSequenceId(gskIdle, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playIdle(Common::Point gridPos) { + playSequence(getSequenceId(gskIdle, gridPos) | 0x10000); } void PlayerGnap::playShowItem(int itemIndex, int gridLookX, int gridLookY) { diff --git a/engines/gnap/character.h b/engines/gnap/character.h index f1fc0ec3db..a1fb6cfc24 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -96,9 +96,9 @@ public: void idle(); void initBrainPulseRndValue(); void kissPlatypus(int callback); - void playBrainPulsating(int gridX, int gridY); - void playIdle(int gridX, int gridY); - void playImpossible(int gridX, int gridY); + void playBrainPulsating(Common::Point gridPos = Common::Point(0, 0)); + void playIdle(Common::Point gridPos = Common::Point(0, 0)); + void playImpossible(Common::Point gridPos = Common::Point(0, 0)); void playMoan1(int gridX, int gridY); void playMoan2(int gridX, int gridY); void playPullOutDevice(int gridX, int gridY); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 972bbfa907..b282751b3d 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -128,7 +128,7 @@ void Scene01::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -141,11 +141,11 @@ void Scene01::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -166,7 +166,7 @@ void Scene01::run() { case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -188,7 +188,7 @@ void Scene01::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -217,7 +217,7 @@ void Scene01::run() { gnap._actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -481,7 +481,7 @@ void Scene02::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -494,11 +494,11 @@ void Scene02::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -532,7 +532,7 @@ void Scene02::run() { gnap._actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -579,7 +579,7 @@ void Scene02::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -602,7 +602,7 @@ void Scene02::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -949,7 +949,7 @@ void Scene03::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -962,11 +962,11 @@ void Scene03::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -993,7 +993,7 @@ void Scene03::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1019,7 +1019,7 @@ void Scene03::run() { case kHS03Creek: if (gnap._actionStatus == -1) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1035,7 +1035,7 @@ void Scene03::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1067,7 +1067,7 @@ void Scene03::run() { break; case TALK_CURSOR: if (_platypusHypnotized) { - gnap.playBrainPulsating(8, 4); + gnap.playBrainPulsating(Common::Point(8, 4)); } else { gnap._idleFacing = kDirBottomRight; gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); @@ -1078,7 +1078,7 @@ void Scene03::run() { } break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1206,7 +1206,7 @@ void Scene03::updateAnimations() { updateHotspots(); break; case kAS03HypnotizePlat: - gnap.playBrainPulsating(0, 0); + gnap.playBrainPulsating(); _vm->addFullScreenSprite(0x106, 255); gameSys.setAnimation(0x1C9, 256, 1); gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); @@ -1222,7 +1222,7 @@ void Scene03::updateAnimations() { updateHotspots(); break; case kAS03HypnotizeScaredPlat: - gnap.playBrainPulsating(0, 0); + gnap.playBrainPulsating(); gameSys.insertSequence(0x1BF, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); gameSys.setAnimation(0x1BF, 99, 1); while (gameSys.getAnimationStatus(1) != 2) @@ -1457,7 +1457,7 @@ void Scene04::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1473,11 +1473,11 @@ void Scene04::run() { gnap.playMoan1(plat._pos.x, plat._pos.y); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1501,7 +1501,7 @@ void Scene04::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1526,7 +1526,7 @@ void Scene04::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1553,12 +1553,12 @@ void Scene04::run() { case TALK_CURSOR: gnap._idleFacing = kDirBottomRight; if (gnap.walkTo(gnap._pos, 0, -1, 1)) { - gnap.playBrainPulsating(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + gnap.playBrainPulsating(_vm->_hotspotsWalkPos[2]); _nextDogSequenceId = 0x20E; } break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1589,7 +1589,7 @@ void Scene04::run() { } break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1615,7 +1615,7 @@ void Scene04::run() { if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); } else if (_vm->isFlag(kGFKeysTaken)) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1633,7 +1633,7 @@ void Scene04::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1935,7 +1935,7 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1948,11 +1948,11 @@ void Scene05::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1964,7 +1964,7 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); } else if (_vm->isFlag(kGFNeedleTaken)) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1972,7 +1972,7 @@ void Scene05::run() { break; case GRAB_CURSOR: case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: if (_vm->isFlag(kGFPlatypus)) { @@ -1983,7 +1983,7 @@ void Scene05::run() { } if (gnap._pos.x == 4 && (gnap._pos.y == 8 || gnap._pos.y == 7)) gnap.walkStep(); - gnap.playIdle(plat._pos.x, plat._pos.y); + gnap.playIdle(plat._pos); } break; } @@ -2016,7 +2016,7 @@ void Scene05::run() { gnap._actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2039,7 +2039,7 @@ void Scene05::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2075,7 +2075,7 @@ void Scene05::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2364,7 +2364,7 @@ void Scene06::run() { if (_vm->_grabCursorSpriteIndex == kItemDisguise) { gnap.useDisguiseOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2377,11 +2377,11 @@ void Scene06::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2399,7 +2399,7 @@ void Scene06::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk04)) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else if (triedDeviceOnGas) { _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, 0x107BC, 1); @@ -2413,7 +2413,7 @@ void Scene06::run() { case TALK_CURSOR: case PLAT_CURSOR: if (_vm->isFlag(kGFUnk04)) - gnap.playImpossible(0, 0); + gnap.playImpossible(); else gnap.playScratchingHead(5, 0); break; @@ -2433,7 +2433,7 @@ void Scene06::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFGasTaken)) - gnap.playImpossible(0, 0); + gnap.playImpossible(); else { gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, 0x107BB, 1); gnap._actionStatus = kAS06TryToClimbLadder; @@ -2442,7 +2442,7 @@ void Scene06::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2480,7 +2480,7 @@ void Scene06::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2752,7 +2752,7 @@ void Scene07::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: @@ -2791,7 +2791,7 @@ void Scene07::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3012,7 +3012,7 @@ void Scene08::run() { case kH08SPlatypus: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -3026,7 +3026,7 @@ void Scene08::run() { gnap.kissPlatypus(8); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: @@ -3065,7 +3065,7 @@ void Scene08::run() { gnap._idleFacing = kDirUpRight; break; case GRAB_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -3079,7 +3079,7 @@ void Scene08::run() { plat.walkTo(Common::Point(6, 6), 1, 0x107C2, 1); plat._actionStatus = kAS08PlatWithMan; plat._idleFacing = kDirNone; - gnap.playIdle(6, 6); + gnap.playIdle(Common::Point(6, 6)); break; } } @@ -3115,7 +3115,7 @@ void Scene08::run() { plat.walkTo(Common::Point(3, 7), 1, 0x107C2, 1); plat._actionStatus = kAS08PlatWithDog; plat._idleFacing = kDirNone; - gnap.playIdle(3, 7); + gnap.playIdle(Common::Point(3, 7)); break; } } @@ -3141,7 +3141,7 @@ void Scene08::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3167,7 +3167,7 @@ void Scene08::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3193,7 +3193,7 @@ void Scene08::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3459,7 +3459,7 @@ void Scene09::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: @@ -3499,7 +3499,7 @@ void Scene09::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index a4e4e9f49c..db244f2feb 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -109,7 +109,7 @@ void Scene10::run() { switch (_vm->_sceneClickedHotspot) { case kHS10Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -122,7 +122,7 @@ void Scene10::run() { gnap.kissPlatypus(10); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: @@ -160,7 +160,7 @@ void Scene10::run() { gnap.playScratchingHead(6, 0); break; case GRAB_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); gnap._idleFacing = kDirBottomRight; break; case TALK_CURSOR: @@ -201,7 +201,7 @@ void Scene10::run() { } break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) @@ -232,7 +232,7 @@ void Scene10::run() { gnap._actionStatus = kAS10AnnoyCook; break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) @@ -246,7 +246,7 @@ void Scene10::run() { plat._actionStatus = kAS10PlatWithBox; plat._idleFacing = kDirUnk4; _vm->_largeSprite = gameSys.createSurface(0xC3); - gnap.playIdle(7, 6); + gnap.playIdle(Common::Point(7, 6)); } break; } @@ -274,7 +274,7 @@ void Scene10::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -607,7 +607,7 @@ void Scene11::run() { switch (_vm->_sceneClickedHotspot) { case kHS11Platypus: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -617,7 +617,7 @@ void Scene11::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: @@ -665,7 +665,7 @@ void Scene11::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -699,7 +699,7 @@ void Scene11::run() { gnap._actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -709,7 +709,7 @@ void Scene11::run() { case kHS11Billard: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(9, 8); + gnap.playImpossible(Common::Point(9, 8)); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -721,7 +721,7 @@ void Scene11::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(9, 8); + gnap.playImpossible(Common::Point(9, 8)); break; } } @@ -1040,7 +1040,7 @@ void Scene12::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: @@ -1093,7 +1093,7 @@ void Scene12::run() { plat.walkTo(Common::Point(3, 7), 1, 0x107D2, 1); plat._actionStatus = kAS12PlatWithToothGuy; plat._idleFacing = kDirUnk4; - gnap.playIdle(2, 7); + gnap.playIdle(Common::Point(2, 7)); break; } } @@ -1118,7 +1118,7 @@ void Scene12::run() { gnap._actionStatus = kAS12LookBarkeeper; break; case GRAB_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -1163,7 +1163,7 @@ void Scene12::run() { plat.walkTo(Common::Point(7, 6), 1, 0x107C2, 1); plat._actionStatus = kAS12PlatWithBeardGuy; plat._idleFacing = kDirNone; - gnap.playIdle(7, 6); + gnap.playIdle(Common::Point(7, 6)); break; } } @@ -1421,7 +1421,7 @@ void Scene12::updateAnimations() { if (gameSys.getAnimationStatus(3) == 2) { if (gnap._actionStatus == kAS12PlatWithBarkeeper && _currBarkeeperSequenceId == 0x1F9) { gnap._actionStatus = -1; - gnap.playIdle(7, 6); + gnap.playIdle(Common::Point(7, 6)); _vm->_timers[5] = 0; } if (_nextBarkeeperSequenceId != -1) { @@ -1553,7 +1553,7 @@ void Scene13::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: @@ -1599,7 +1599,7 @@ void Scene13::run() { } break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1640,7 +1640,7 @@ void Scene13::run() { gnap.walkTo(Common::Point(7, 7), -1, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)), 1); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1662,7 +1662,7 @@ void Scene13::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1670,7 +1670,7 @@ void Scene13::run() { case kHS13Sink: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1684,7 +1684,7 @@ void Scene13::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2580,11 +2580,11 @@ void Scene17::run() { gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2594,7 +2594,7 @@ void Scene17::run() { case kHS17Wrench: if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFGrassTaken)) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); } else { @@ -2604,7 +2604,7 @@ void Scene17::run() { gnap.playScratchingHead(8, 7); break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: if (_canTryGetWrench) { @@ -2615,7 +2615,7 @@ void Scene17::run() { gnap._actionStatus = kAS17TryGetWrench; _vm->_timers[5] = _vm->getRandom(30) + 80; } else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2640,10 +2640,10 @@ void Scene17::run() { gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); gnap._actionStatus = kAS17GetCoinFromPhone; } else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2656,7 +2656,7 @@ void Scene17::run() { plat._actionStatus = kAS17PlatUsePhone; gnap._actionStatus = kAS17PlatUsePhone; } else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2684,10 +2684,10 @@ void Scene17::run() { gnap._actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2700,7 +2700,7 @@ void Scene17::run() { plat._actionStatus = kAS17PlatUsePhone; gnap._actionStatus = kAS17PlatUsePhone; } else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3492,11 +3492,11 @@ void Scene18::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3524,7 +3524,7 @@ void Scene18::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3537,7 +3537,7 @@ void Scene18::run() { if (_vm->_grabCursorSpriteIndex >= 0) gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); else - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(true); @@ -3568,7 +3568,7 @@ void Scene18::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3601,14 +3601,14 @@ void Scene18::run() { } else { gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - gnap.playImpossible(0, 0); + gnap.playImpossible(); } break; case TALK_CURSOR: case PLAT_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3630,11 +3630,11 @@ void Scene18::run() { _vm->_hotspots[kHS18WalkArea2]._flags &= ~SF_WALKABLE; gnap._actionStatus = kAS18CloseTopValve; } else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3646,7 +3646,7 @@ void Scene18::run() { if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex == -1) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); } @@ -3679,7 +3679,7 @@ void Scene18::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3694,7 +3694,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->isFlag(kGFPictureTaken)) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { _vm->_isLeavingScene = true; _vm->_newSceneNum = 19; @@ -4191,7 +4191,7 @@ void Scene19::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -4201,11 +4201,11 @@ void Scene19::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -4244,7 +4244,7 @@ void Scene19::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -4267,7 +4267,7 @@ void Scene19::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -4283,7 +4283,7 @@ void Scene19::run() { case kHS19Toy7: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap.playImpossible(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -4291,12 +4291,12 @@ void Scene19::run() { break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - gnap.playIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap.playIdle(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]); gnap._actionStatus = kAS19GrabToy; break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -4314,12 +4314,12 @@ void Scene19::run() { break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); - gnap.playIdle(8, 2); + gnap.playIdle(Common::Point(8, 2)); gnap._actionStatus = kAS19UsePhone; break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -4463,7 +4463,7 @@ void Scene19::updateAnimations() { while (_vm->_timers[5]) { _vm->gameUpdateTick(); } - gnap.playIdle(6, 2); + gnap.playIdle(Common::Point(6, 2)); gnap._actionStatus = -1; break; case 0x67: @@ -4474,7 +4474,7 @@ void Scene19::updateAnimations() { gnap._actionStatus = -1; break; case 0x65: - gnap.playIdle(6, 2); + gnap.playIdle(Common::Point(6, 2)); gameSys.setAnimation(_nextShopAssistantSequenceId, 20, 0); gameSys.insertSequence(_nextShopAssistantSequenceId, 20, _currShopAssistantSequenceId, 20, kSeqSyncWait, 0, 0, 0); _currShopAssistantSequenceId = _nextShopAssistantSequenceId; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index f3a677ae14..33322cc70b 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -278,7 +278,7 @@ void Scene20::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -288,11 +288,11 @@ void Scene20::run() { gnap.kissPlatypus(20); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -378,7 +378,7 @@ void Scene20::run() { if (_stonerGuyShowingJoint) gnap._actionStatus = kAS20GrabJoint; else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -389,7 +389,7 @@ void Scene20::run() { gnap._actionStatus = kAS20TalkStonerGuyHasJoint; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -417,7 +417,7 @@ void Scene20::run() { gnap._actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -445,7 +445,7 @@ void Scene20::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -799,7 +799,7 @@ void Scene21::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -809,11 +809,11 @@ void Scene21::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -869,7 +869,7 @@ void Scene21::run() { gnap._actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1118,7 +1118,7 @@ void Scene22::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1128,11 +1128,11 @@ void Scene22::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1169,7 +1169,7 @@ void Scene22::run() { gnap.playScratchingHead(8, 4); break; case GRAB_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -1344,7 +1344,7 @@ void Scene23::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1354,11 +1354,11 @@ void Scene23::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1381,7 +1381,7 @@ void Scene23::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - gnap.playImpossible(0, 0); + gnap.playImpossible(); else { gnap._idleFacing = kDirBottomRight; gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); @@ -1392,7 +1392,7 @@ void Scene23::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1615,7 +1615,7 @@ void Scene24::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1625,11 +1625,11 @@ void Scene24::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1864,7 +1864,7 @@ void Scene25::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1874,11 +1874,11 @@ void Scene25::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1908,7 +1908,7 @@ void Scene25::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1950,7 +1950,7 @@ void Scene25::run() { case kHS25Posters4: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1961,7 +1961,7 @@ void Scene25::run() { gnap._idleFacing = kDirBottomRight; else gnap._idleFacing = kDirUpRight; - gnap.playIdle(0, 0); + gnap.playIdle(); playAnims(8 - _vm->_sceneClickedHotspot + 1); break; case GRAB_CURSOR: @@ -2063,7 +2063,7 @@ void Scene25::updateAnimations() { _currTicketVendorSequenceId = _nextTicketVendorSequenceId; _nextTicketVendorSequenceId = -1; _vm->_hotspots[kHS25WalkArea1]._flags |= SF_WALKABLE; - gnap.playIdle(0, 0); + gnap.playIdle(); gnap.walkTo(_vm->_hotspotsWalkPos[3], -1, 0x107BB, 1); _vm->_hotspots[kHS25WalkArea1]._flags &= ~SF_WALKABLE; gnap._actionStatus = kAS25EnterCircusWihoutTicketDone; @@ -2183,7 +2183,7 @@ void Scene26::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2193,11 +2193,11 @@ void Scene26::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2420,7 +2420,7 @@ void Scene27::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2430,11 +2430,11 @@ void Scene27::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2461,7 +2461,7 @@ void Scene27::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2484,7 +2484,7 @@ void Scene27::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2794,7 +2794,7 @@ void Scene28::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2804,11 +2804,11 @@ void Scene28::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2841,7 +2841,7 @@ void Scene28::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2854,7 +2854,7 @@ void Scene28::run() { if (_vm->_verbCursor == LOOK_CURSOR) gnap.playScratchingHead(5, 2); else - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { gnap._idleFacing = kDirUpLeft; gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); @@ -2881,7 +2881,7 @@ void Scene28::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2905,7 +2905,7 @@ void Scene28::run() { if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowItem(_vm->_grabCursorSpriteIndex, 8, 6); } else if (_vm->isFlag(kGFUnk21)) { - gnap.playImpossible(8, 6); + gnap.playImpossible(Common::Point(8, 6)); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2917,7 +2917,7 @@ void Scene28::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3117,7 +3117,7 @@ void Scene29::updateHotspots() { _vm->setHotspot(kHS29Monkey, 410, 374, 518, 516, SF_WALKABLE | SF_DISABLED, 3, 7); _vm->setHotspot(kHS29ExitCircus, 150, 585, 650, 600, SF_EXIT_D_CURSOR | SF_WALKABLE, 5, 9); _vm->setHotspot(kHS29ExitOutsideClown, 785, 0, 800, 600, SF_EXIT_R_CURSOR | SF_WALKABLE, 11, 9); - _vm->setHotspot(kHS29Aracde, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); + _vm->setHotspot(kHS29Arcade, 88, 293, 155, 384, SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR, 3, 8); _vm->setHotspot(kHS29WalkArea1, 0, 0, 800, 478); _vm->setDeviceHotspot(kHS29Device, -1, -1, -1, -1); if (_vm->invHas(kItemHorn)) @@ -3188,7 +3188,7 @@ void Scene29::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -3198,11 +3198,11 @@ void Scene29::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3226,11 +3226,11 @@ void Scene29::run() { gnap.playScratchingHead(5, 6); break; case TALK_CURSOR: - gnap.playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y); + gnap.playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey]); break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -3257,17 +3257,17 @@ void Scene29::run() { } break; - case kHS29Aracde: + case kHS29Arcade: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { _vm->setGrabCursorSprite(-1); _vm->_isLeavingScene = true; _vm->_newSceneNum = 52; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Aracde], 0, -1, 1); - gnap.playIdle(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Arcade], 0, -1, 1); + gnap.playIdle(_vm->_hotspotsWalkPos[kHS29Arcade]); gnap._actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Aracde].x, _vm->_hotspotsWalkPos[kHS29Aracde].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Arcade].x, _vm->_hotspotsWalkPos[kHS29Arcade].y, 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -3276,7 +3276,7 @@ void Scene29::run() { case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } diff --git a/engines/gnap/scenes/group2.h b/engines/gnap/scenes/group2.h index 3b74d85bea..da4ff70407 100644 --- a/engines/gnap/scenes/group2.h +++ b/engines/gnap/scenes/group2.h @@ -136,7 +136,7 @@ enum { kHS29Device = 2, kHS29ExitCircus = 3, kHS29ExitOutsideClown = 4, - kHS29Aracde = 5, + kHS29Arcade = 5, kHS29WalkArea1 = 6 }; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index a740d21a7e..c650ec75ca 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -93,7 +93,7 @@ void Scene30::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -103,11 +103,11 @@ void Scene30::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -135,7 +135,7 @@ void Scene30::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(8, 5); + gnap.playImpossible(Common::Point(8, 5)); break; } } @@ -351,7 +351,7 @@ void Scene31::run() { if (_vm->_grabCursorSpriteIndex == kItemJoint) { gnap.useJointOnPlatypus(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -361,11 +361,11 @@ void Scene31::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -378,7 +378,7 @@ void Scene31::run() { if (_vm->_verbCursor == LOOK_CURSOR) gnap.playScratchingHead(2, 2); else - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); } else { @@ -395,7 +395,7 @@ void Scene31::run() { _vm->_timers[4] = 300; break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: if (!_vm->invHas(kItemBucketWithBeer)) { @@ -408,7 +408,7 @@ void Scene31::run() { gnap._actionStatus = kAS31PlatMeasuringClown; _vm->_timers[4] = 300; } else - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -445,7 +445,7 @@ void Scene31::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -704,7 +704,7 @@ void Scene32::run() { case kHS32Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -714,11 +714,11 @@ void Scene32::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -882,7 +882,7 @@ void Scene33::run() { case kHS33Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -892,11 +892,11 @@ void Scene33::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -923,7 +923,7 @@ void Scene33::run() { break; case LOOK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1166,7 +1166,7 @@ void Scene38::run() { if (gnap._actionStatus == kAS38HoldingHuntingTrophy) { gnap._actionStatus = kAS38ReleaseHuntingTrophy; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1176,11 +1176,11 @@ void Scene38::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -1232,7 +1232,7 @@ void Scene38::run() { break; case GRAB_CURSOR: if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) - gnap.playImpossible(0, 0); + gnap.playImpossible(); else { gnap.walkTo(Common::Point(3, 6), 0, 0x107BB, 1); plat.walkTo(Common::Point(4, 8), -1, -1, 1); @@ -1240,10 +1240,10 @@ void Scene38::run() { } break; case TALK_CURSOR: - gnap.playBrainPulsating(2, 0); + gnap.playBrainPulsating(Common::Point(2, 0)); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1476,7 +1476,7 @@ void Scene39::run() { case kHS39Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1486,11 +1486,11 @@ void Scene39::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -1510,18 +1510,18 @@ void Scene39::run() { case kHS39Sign: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(0, 0); + gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[kHS39Sign], 0, -1, 1); - gnap.playIdle(_vm->_hotspotsWalkPos[kHS39Sign].x, _vm->_hotspotsWalkPos[kHS39Sign].y); + gnap.playIdle(_vm->_hotspotsWalkPos[kHS39Sign]); _vm->showFullScreenSprite(0x1C); break; case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 3cbfe4d967..4f072793d4 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -79,7 +79,7 @@ void Scene40::run() { case kHS40Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -89,11 +89,11 @@ void Scene40::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -357,7 +357,7 @@ void Scene41::run() { case kHS41Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -367,11 +367,11 @@ void Scene41::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -414,7 +414,7 @@ void Scene41::run() { gnap.playMoan1(5, 0); break; case GRAB_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -422,7 +422,7 @@ void Scene41::run() { gnap._actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -450,7 +450,7 @@ void Scene41::run() { gnap.walkTo(Common::Point(7, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -872,7 +872,7 @@ void Scene42::run() { case kHS42Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -882,11 +882,11 @@ void Scene42::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -937,7 +937,7 @@ void Scene42::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -957,7 +957,7 @@ void Scene42::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1333,7 +1333,7 @@ void Scene43::run() { case kHS43Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1343,11 +1343,11 @@ void Scene43::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -1393,7 +1393,7 @@ void Scene43::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1415,7 +1415,7 @@ void Scene43::run() { break; case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1784,7 +1784,7 @@ void Scene44::run() { case kHS44Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1794,11 +1794,11 @@ void Scene44::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -1838,7 +1838,7 @@ void Scene44::run() { gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -1850,7 +1850,7 @@ void Scene44::run() { plat.walkTo(Common::Point(6, 7), 1, 0x107D2, 1); if (gnap._pos == Common::Point(7, 7)) gnap.walkStep(); - gnap.playIdle(5, 7); + gnap.playIdle(Common::Point(5, 7)); plat._actionStatus = 4; break; } @@ -1874,10 +1874,10 @@ void Scene44::run() { updateHotspots(); break; case TALK_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -1900,7 +1900,7 @@ void Scene44::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2277,7 +2277,7 @@ void Scene45::run() { case kHS45Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2289,11 +2289,11 @@ void Scene45::run() { gameSys.setAnimation(plat._sequenceId, plat._id, 1); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -2353,7 +2353,7 @@ void Scene45::run() { case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2606,7 +2606,7 @@ void Scene46::run() { case kHS46Platypus: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2616,11 +2616,11 @@ void Scene46::run() { gnap.kissPlatypus(0); break; case TALK_CURSOR: - gnap.playBrainPulsating(plat._pos.x, plat._pos.y); + gnap.playBrainPulsating(plat._pos); plat.playSequence(plat.getSequenceId()); break; case PLAT_CURSOR: - gnap.playImpossible(plat._pos.x, plat._pos.y); + gnap.playImpossible(plat._pos); break; } } @@ -2642,7 +2642,7 @@ void Scene46::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } @@ -2663,7 +2663,7 @@ void Scene46::run() { break; case GRAB_CURSOR: case PLAT_CURSOR: - gnap.playImpossible(0, 0); + gnap.playImpossible(); break; } } -- cgit v1.2.3 From cf32e654a712915ee9d40c6595e0f30911833479 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 20:44:35 +0200 Subject: GNAP: Refactoring of playMoan1&2, playPullOutDevice and playPullOutDeviceNonWorking --- engines/gnap/character.cpp | 16 ++++++------- engines/gnap/character.h | 8 +++---- engines/gnap/scenes/group0.cpp | 52 +++++++++++++++++++++--------------------- engines/gnap/scenes/group1.cpp | 32 +++++++++++++------------- engines/gnap/scenes/group2.cpp | 34 +++++++++++++-------------- engines/gnap/scenes/group3.cpp | 16 ++++++------- engines/gnap/scenes/group4.cpp | 26 ++++++++++----------- 7 files changed, 92 insertions(+), 92 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 32f3946668..c8ad1867cf 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -1065,24 +1065,24 @@ void PlayerGnap::playScratchingHead(int gridX, int gridY) { playSequence(getSequenceId(gskScratchingHead, Common::Point(gridX, gridY)) | 0x10000); } -void PlayerGnap::playMoan1(int gridX, int gridY) { - playSequence(getSequenceId(gskMoan1, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playMoan1(Common::Point gridPos) { + playSequence(getSequenceId(gskMoan1, gridPos) | 0x10000); } -void PlayerGnap::playMoan2(int gridX, int gridY) { - playSequence(getSequenceId(gskMoan2, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playMoan2(Common::Point gridPos) { + playSequence(getSequenceId(gskMoan2, gridPos) | 0x10000); } void PlayerGnap::playBrainPulsating(Common::Point gridPos) { playSequence(getSequenceId(gskBrainPulsating, gridPos) | 0x10000); } -void PlayerGnap::playPullOutDevice(int gridX, int gridY) { - playSequence(getSequenceId(gskPullOutDevice, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playPullOutDevice(Common::Point gridPos) { + playSequence(getSequenceId(gskPullOutDevice, gridPos) | 0x10000); } -void PlayerGnap::playPullOutDeviceNonWorking(int gridX, int gridY) { - playSequence(getSequenceId(gskPullOutDeviceNonWorking, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playPullOutDeviceNonWorking(Common::Point gridPos) { + playSequence(getSequenceId(gskPullOutDeviceNonWorking, gridPos) | 0x10000); } void PlayerGnap::playUseDevice(int gridX, int gridY) { diff --git a/engines/gnap/character.h b/engines/gnap/character.h index a1fb6cfc24..4494aa8461 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -99,10 +99,10 @@ public: void playBrainPulsating(Common::Point gridPos = Common::Point(0, 0)); void playIdle(Common::Point gridPos = Common::Point(0, 0)); void playImpossible(Common::Point gridPos = Common::Point(0, 0)); - void playMoan1(int gridX, int gridY); - void playMoan2(int gridX, int gridY); - void playPullOutDevice(int gridX, int gridY); - void playPullOutDeviceNonWorking(int gridX, int gridY); + void playMoan1(Common::Point gridPos = Common::Point(0, 0)); + void playMoan2(Common::Point gridPos = Common::Point(0, 0)); + void playPullOutDevice(Common::Point gridPos = Common::Point(0, 0)); + void playPullOutDeviceNonWorking(Common::Point gridPos = Common::Point(0, 0)); void playScratchingHead(int gridX, int gridY); void playShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); void playShowItem(int itemIndex, int gridLookX, int gridLookY); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index b282751b3d..a0bdba220c 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -133,7 +133,7 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -315,7 +315,7 @@ void Scene01::updateAnimations() { break; case kAS01TakeMud: - gnap.playPullOutDevice(2, 3); + gnap.playPullOutDevice(Common::Point(2, 3)); gnap.playUseDevice(0, 0); gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(128, 40, 3); @@ -330,7 +330,7 @@ void Scene01::updateAnimations() { break; case kAS01UsePigs: - gnap.playPullOutDevice(7, 2); + gnap.playPullOutDevice(Common::Point(7, 2)); gnap.playUseDevice(0, 0); gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); gnap._actionStatus = -1; @@ -486,7 +486,7 @@ void Scene02::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -517,7 +517,7 @@ void Scene02::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(9, 8); + gnap.playMoan2(Common::Point(9, 8)); break; case GRAB_CURSOR: gnap._idleFacing = kDirBottomRight; @@ -593,7 +593,7 @@ void Scene02::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(2, 4); + gnap.playMoan2(Common::Point(2, 4)); break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; @@ -954,7 +954,7 @@ void Scene03::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -985,7 +985,7 @@ void Scene03::run() { gnap.playScratchingHead(9, 6); break; case GRAB_CURSOR: - gnap.playPullOutDevice(9, 6); + gnap.playPullOutDevice(Common::Point(9, 6)); gnap.playUseDevice(0, 0); gameSys.insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1B3, 253, 5); @@ -1023,7 +1023,7 @@ void Scene03::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(2, 8); + gnap.playMoan2(Common::Point(2, 8)); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) @@ -1462,7 +1462,7 @@ void Scene04::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -1470,7 +1470,7 @@ void Scene04::run() { if (_vm->_cursorValue == 4) gnap.kissPlatypus(0); else - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case TALK_CURSOR: gnap.playBrainPulsating(plat._pos); @@ -1494,7 +1494,7 @@ void Scene04::run() { gnap.playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); break; case GRAB_CURSOR: - gnap.playPullOutDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playPullOutDevice(_vm->_hotspotsWalkPos[1]); gnap.playUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); gameSys.insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1FD, 100, 2); @@ -1515,7 +1515,7 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y); + gnap.playMoan2(_vm->_hotspotsWalkPos[3]); break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; @@ -1541,7 +1541,7 @@ void Scene04::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (gnap.walkTo(gnap._pos, 0, -1, 1)) { - gnap.playMoan2(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y); + gnap.playMoan2(_vm->_hotspotsWalkPos[2]); _nextDogSequenceId = 0x20F; } break; @@ -1940,7 +1940,7 @@ void Scene05::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -2003,7 +2003,7 @@ void Scene05::run() { else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(9, 7); + gnap.playMoan2(Common::Point(9, 7)); break; case GRAB_CURSOR: gnap._idleFacing = kDirBottomRight; @@ -2030,7 +2030,7 @@ void Scene05::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(2, 4); + gnap.playMoan2(Common::Point(2, 4)); break; case GRAB_CURSOR: gnap._idleFacing = kDirBottomLeft; @@ -2369,7 +2369,7 @@ void Scene06::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFKeysTaken)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -2407,7 +2407,7 @@ void Scene06::run() { gnap._actionStatus = kAS06TryToGetGas; } else { triedDeviceOnGas = true; - gnap.playPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playPullOutDeviceNonWorking(_vm->_hotspotsWalkPos[1]); } break; case TALK_CURSOR: @@ -2746,7 +2746,7 @@ void Scene07::run() { case kHS07Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2780,7 +2780,7 @@ void Scene07::run() { _vm->setFlag(kGFPlatypus); _vm->invAdd(kItemDice); updateHotspots(); - gnap.playPullOutDevice(3, 3); + gnap.playPullOutDevice(Common::Point(3, 3)); gameSys.setAnimation(0x8E, 1, 2); gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); gameSys.insertSequence(gnap.getSequenceId(gskUseDevice, Common::Point(0, 0)) | 0x10000, gnap._id, @@ -3017,7 +3017,7 @@ void Scene08::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -3134,7 +3134,7 @@ void Scene08::run() { gnap.playScratchingHead(6, 7); } else { gnap.actionIdle(0x14D); - gnap.playPullOutDevice(6, 7); + gnap.playPullOutDevice(Common::Point(6, 7)); gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x149; } @@ -3160,7 +3160,7 @@ void Scene08::run() { gnap.playScratchingHead(3, 6); } else { gnap.actionIdle(0x14D); - gnap.playPullOutDevice(3, 6); + gnap.playPullOutDevice(Common::Point(3, 6)); gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x14A; } @@ -3186,7 +3186,7 @@ void Scene08::run() { gnap.playScratchingHead(7, 6); } else { gnap.actionIdle(0x14D); - gnap.playPullOutDevice(7, 6); + gnap.playPullOutDevice(Common::Point(7, 6)); gnap.playUseDevice(0, 0); _nextDogSequenceId = 0x14B; } @@ -3453,7 +3453,7 @@ void Scene09::run() { case kHS09Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index db244f2feb..0560cfd666 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -114,7 +114,7 @@ void Scene10::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); else gnap.playScratchingHead(plat._pos.x, plat._pos.y); break; @@ -187,13 +187,13 @@ void Scene10::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) - gnap.playMoan2(-1, -1); + gnap.playMoan2(Common::Point(-1, -1)); else gnap.playScratchingHead(4, 3); break; case GRAB_CURSOR: if (_vm->isFlag(kGFMudTaken)) - gnap.playMoan2(-1, -1); + gnap.playMoan2(Common::Point(-1, -1)); else { gnap.actionIdle(0x10C); gnap.walkTo(Common::Point(4, 8), 0, 0x107BB, 1); @@ -205,7 +205,7 @@ void Scene10::run() { break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - gnap.playMoan2(-1, -1); + gnap.playMoan2(Common::Point(-1, -1)); else { gnap.actionIdle(0x10C); gnap.useDeviceOnPlatypus(); @@ -236,7 +236,7 @@ void Scene10::run() { break; case PLAT_CURSOR: if (_vm->isFlag(kGFMudTaken)) - gnap.playMoan2(-1, -1); + gnap.playMoan2(Common::Point(-1, -1)); else { _vm->invAdd(kItemTongs); _vm->setFlag(kGFMudTaken); @@ -611,7 +611,7 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1034,7 +1034,7 @@ void Scene12::run() { case kHS12Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1126,7 +1126,7 @@ void Scene12::run() { gnap._actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: - gnap.playPullOutDevice(plat._pos.x, plat._pos.y); + gnap.playPullOutDevice(plat._pos); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); gnap._actionStatus = kAS12PlatWithBarkeeper; break; @@ -1547,7 +1547,7 @@ void Scene13::run() { case kHS13Platypus: switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2862,7 +2862,7 @@ void Scene17::updateAnimations() { gnap._actionStatus = kAS17GetWrenchGnapReady; break; case kAS17GetCoinFromPhone: - gnap.playPullOutDevice(1, 3); + gnap.playPullOutDevice(Common::Point(1, 3)); gnap.playUseDevice(0, 0); gameSys.setAnimation(0x250, 100, 0); gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); @@ -3486,7 +3486,7 @@ void Scene18::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -3881,7 +3881,7 @@ void Scene18::updateAnimations() { case kAS18OpenTopValve: _vm->setFlag(kGFBarnPadlockOpen); updateHotspots(); - gnap.playPullOutDevice(2, 7); + gnap.playPullOutDevice(Common::Point(2, 7)); gnap.playUseDevice(0, 0); gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; @@ -3979,7 +3979,7 @@ void Scene18::updateAnimations() { case kAS18OpenRightValveWithGarbageCan: _vm->setFlag(kGFTruckFilledWithGas); updateHotspots(); - gnap.playPullOutDevice(2, 7); + gnap.playPullOutDevice(Common::Point(2, 7)); gnap.playUseDevice(0, 0); gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; @@ -4195,7 +4195,7 @@ void Scene19::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -4287,7 +4287,7 @@ void Scene19::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y); + gnap.playMoan2(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]); break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); @@ -4402,7 +4402,7 @@ void Scene19::updateAnimations() { } break; case kAS19GrabPicture: - gnap.playPullOutDevice(6, 2); + gnap.playPullOutDevice(Common::Point(6, 2)); gnap.playUseDevice(0, 0); gameSys.setAnimation(0x68, 19, 0); gameSys.insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 33322cc70b..e832f35173 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -69,7 +69,7 @@ void Scene20::updateAnimationsCb() { break; case 0x16A: // Grab joint - gnap.playPullOutDevice(4, 4); + gnap.playPullOutDevice(Common::Point(4, 4)); gnap.playUseDevice(0, 0); gameSys.setAnimation(0x16A, 21, 0); gameSys.insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); @@ -370,7 +370,7 @@ void Scene20::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(5, 4); + gnap.playMoan2(Common::Point(5, 4)); break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; @@ -831,7 +831,7 @@ void Scene21::run() { break; case GRAB_CURSOR: gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); - gnap.playPullOutDevice(2, 5); + gnap.playPullOutDevice(Common::Point(2, 5)); gnap.playUseDevice(0, 0); gnap._actionStatus = kAS21GrabBanana; break; @@ -1373,7 +1373,7 @@ void Scene23::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSceneFlag1)) - gnap.playMoan2(0, 0); + gnap.playMoan2(); else { gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS23LookCereals; @@ -1890,7 +1890,7 @@ void Scene25::run() { if (_vm->_grabCursorSpriteIndex == kItemTickets) { gnap._actionStatus = kAS25ShowTicketToVendor; gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); @@ -1967,7 +1967,7 @@ void Scene25::run() { case GRAB_CURSOR: case TALK_CURSOR: case PLAT_CURSOR: - gnap.playMoan2(0, 0); + gnap.playMoan2(); break; } } @@ -2187,7 +2187,7 @@ void Scene26::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2424,7 +2424,7 @@ void Scene27::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2613,7 +2613,7 @@ void Scene27::updateAnimations() { } break; case kAS27GrabBucket: - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; _vm->invAdd(kItemEmptyBucket); @@ -2675,7 +2675,7 @@ void Scene27::updateAnimations() { break; case 0xD0: // Show picture to janitor - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); @@ -2798,7 +2798,7 @@ void Scene28::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2858,13 +2858,13 @@ void Scene28::run() { } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { gnap._idleFacing = kDirUpLeft; gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); gnap._actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { gnap._idleFacing = kDirUpLeft; gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); gnap._actionStatus = kAS28UsePillBucketWithClown; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2989,7 +2989,7 @@ void Scene28::updateAnimations() { _nextClownSequenceId = 0x119; break; case kAS28GrabHornSuccess: - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); gameSys.setAnimation(0x117, 59, 0); gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); @@ -3011,7 +3011,7 @@ void Scene28::updateAnimations() { gnap._actionStatus = -1; break; case kAS28GrabEmptyBucket: - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); gameSys.setAnimation(0x111, 99, 0); gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); @@ -3192,7 +3192,7 @@ void Scene29::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -3271,7 +3271,7 @@ void Scene29::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan2(0, 0); + gnap.playMoan2(); break; case GRAB_CURSOR: case TALK_CURSOR: diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index c650ec75ca..c29e7c176d 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -97,7 +97,7 @@ void Scene30::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -355,7 +355,7 @@ void Scene31::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -422,7 +422,7 @@ void Scene31::run() { gnap.walkTo(gnap._pos, -1, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); - gnap.playPullOutDevice(6, 8); + gnap.playPullOutDevice(Common::Point(6, 8)); gnap.playUseDevice(0, 0); gnap.walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); gnap._actionStatus = kAS31FillEmptyBucketWithBeer; @@ -560,7 +560,7 @@ void Scene31::updateAnimations() { break; case kAS31FillEmptyBucketWithBeerDone: gnap._idleFacing = kDirBottomLeft; - gnap.playPullOutDevice(0, 0); + gnap.playPullOutDevice(); gnap.playUseDevice(0, 0); gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); gnap._actionStatus = -1; @@ -708,7 +708,7 @@ void Scene32::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -886,7 +886,7 @@ void Scene33::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1170,7 +1170,7 @@ void Scene38::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1480,7 +1480,7 @@ void Scene39::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 4f072793d4..b789b0e1f3 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -83,7 +83,7 @@ void Scene40::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -361,7 +361,7 @@ void Scene41::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -411,7 +411,7 @@ void Scene41::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(5, 0); + gnap.playMoan1(Common::Point(5, 0)); break; case GRAB_CURSOR: gnap.playImpossible(); @@ -458,7 +458,7 @@ void Scene41::run() { case kHS41ToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { - gnap.playPullOutDevice(9, 0); + gnap.playPullOutDevice(Common::Point(9, 0)); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); gnap._actionStatus = kAS41UseGumWithToyUfo; } @@ -876,7 +876,7 @@ void Scene42::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1337,7 +1337,7 @@ void Scene43::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1788,7 +1788,7 @@ void Scene44::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1866,7 +1866,7 @@ void Scene44::run() { gnap.playScratchingHead(8, 7); break; case GRAB_CURSOR: - gnap.playPullOutDevice(8, 0); + gnap.playPullOutDevice(Common::Point(8, 0)); gnap.playUseDevice(8, 0); _nextSpringGuySequenceId = 0xFB; _vm->invAdd(kItemSpring); @@ -1890,7 +1890,7 @@ void Scene44::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSpringTaken)) - gnap.playMoan1(8, 7); + gnap.playMoan1(Common::Point(8, 7)); else gnap.playScratchingHead(8, 7); break; @@ -2281,7 +2281,7 @@ void Scene45::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2610,7 +2610,7 @@ void Scene46::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(plat._pos.x, plat._pos.y); + gnap.playMoan1(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2633,7 +2633,7 @@ void Scene46::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0); + gnap.playMoan1(Common::Point(_vm->_hotspotsWalkPos[kHS46SackGuy].x + 1, 0)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -2654,7 +2654,7 @@ void Scene46::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playMoan1(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0); + gnap.playMoan1(Common::Point(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x - 1, 0)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; -- cgit v1.2.3 From d4053ee11b736255d8e22e8f668904a3c4462549 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 8 May 2016 23:15:09 +0200 Subject: GNAP: Refactoring of playScratchingHead, playShowCurrItem, playUseDevice --- engines/gnap/character.cpp | 14 ++--- engines/gnap/character.h | 6 +-- engines/gnap/scenes/group0.cpp | 118 ++++++++++++++++++++--------------------- engines/gnap/scenes/group1.cpp | 104 ++++++++++++++++++------------------ engines/gnap/scenes/group2.cpp | 80 ++++++++++++++-------------- engines/gnap/scenes/group3.cpp | 26 ++++----- engines/gnap/scenes/group4.cpp | 42 +++++++-------- 7 files changed, 196 insertions(+), 194 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index c8ad1867cf..5226c75210 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -1061,8 +1061,8 @@ void PlayerGnap::playImpossible(Common::Point gridPos) { playSequence(getSequenceId(gskImpossible, gridPos) | 0x10000); } -void PlayerGnap::playScratchingHead(int gridX, int gridY) { - playSequence(getSequenceId(gskScratchingHead, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playScratchingHead(Common::Point gridPos) { + playSequence(getSequenceId(gskScratchingHead, gridPos) | 0x10000); } void PlayerGnap::playMoan1(Common::Point gridPos) { @@ -1085,8 +1085,8 @@ void PlayerGnap::playPullOutDeviceNonWorking(Common::Point gridPos) { playSequence(getSequenceId(gskPullOutDeviceNonWorking, gridPos) | 0x10000); } -void PlayerGnap::playUseDevice(int gridX, int gridY) { - playSequence(getSequenceId(gskUseDevice, Common::Point(gridX, gridY)) | 0x10000); +void PlayerGnap::playUseDevice(Common::Point gridPos) { + playSequence(getSequenceId(gskUseDevice, gridPos) | 0x10000); } void PlayerGnap::playIdle(Common::Point gridPos) { @@ -1097,12 +1097,12 @@ void PlayerGnap::playShowItem(int itemIndex, int gridLookX, int gridLookY) { playSequence(getShowSequenceId(itemIndex, gridLookX, gridLookY) | 0x10000); } -void PlayerGnap::playShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY) { +void PlayerGnap::playShowCurrItem(Common::Point destPos, int gridLookX, int gridLookY) { PlayerPlat& plat = *_vm->_plat; - if (plat._pos.x == gridX && plat._pos.y == gridY) + if (plat._pos == destPos) plat.makeRoom(); - walkTo(Common::Point(gridX, gridY), -1, -1, 1); + walkTo(destPos, -1, -1, 1); playShowItem(_vm->_grabCursorSpriteIndex, gridLookX, gridLookY); } diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 4494aa8461..554e980dbb 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -103,10 +103,10 @@ public: void playMoan2(Common::Point gridPos = Common::Point(0, 0)); void playPullOutDevice(Common::Point gridPos = Common::Point(0, 0)); void playPullOutDeviceNonWorking(Common::Point gridPos = Common::Point(0, 0)); - void playScratchingHead(int gridX, int gridY); - void playShowCurrItem(int gridX, int gridY, int gridLookX, int gridLookY); + void playScratchingHead(Common::Point gridPos = Common::Point(0, 0)); + void playShowCurrItem(Common::Point destPos, int gridLookX, int gridLookY); void playShowItem(int itemIndex, int gridLookX, int gridLookY); - void playUseDevice(int gridX, int gridY); + void playUseDevice(Common::Point gridPos = Common::Point(0, 0)); void useDeviceOnPlatypus(); void useDisguiseOnPlatypus(); void useJointOnPlatypus(); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index a0bdba220c..b0acf8f5bb 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -135,7 +135,7 @@ void Scene01::run() { if (_vm->isFlag(kGFKeysTaken)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -155,7 +155,7 @@ void Scene01::run() { case kHS01Spaceship: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 0, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4], 0, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -176,11 +176,11 @@ void Scene01::run() { case kHS01Mud: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(3, 3); + gnap.playScratchingHead(Common::Point(3, 3)); break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 3)) | 0x10000, 1); @@ -198,7 +198,7 @@ void Scene01::run() { case kHS01Pigs: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 7, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3], 7, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -316,7 +316,7 @@ void Scene01::updateAnimations() { case kAS01TakeMud: gnap.playPullOutDevice(Common::Point(2, 3)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.insertSequence(128, 40, 129, 40, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(128, 40, 3); gnap._actionStatus = -1; @@ -331,7 +331,7 @@ void Scene01::updateAnimations() { case kAS01UsePigs: gnap.playPullOutDevice(Common::Point(7, 2)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.insertSequence(135, 39, 0, 0, kSeqNone, 25, _vm->getRandom(140) - 40, 0); gnap._actionStatus = -1; break; @@ -488,7 +488,7 @@ void Scene02::run() { if (_vm->isFlag(kGFKeysTaken)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -513,7 +513,7 @@ void Scene02::run() { gnap.walkTo(destPos, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y + 1, 9, 8); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), 9, 8); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -557,11 +557,11 @@ void Scene02::run() { gnap._actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 2, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(2, 2); + gnap.playScratchingHead(Common::Point(2, 2)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { @@ -589,7 +589,7 @@ void Scene02::run() { case kHS02TruckGrill: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[4], 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -956,7 +956,7 @@ void Scene03::run() { if (_vm->isFlag(kGFKeysTaken)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -982,11 +982,11 @@ void Scene03::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(9, 6); + gnap.playScratchingHead(Common::Point(9, 6)); break; case GRAB_CURSOR: gnap.playPullOutDevice(Common::Point(9, 6)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.insertSequence(0x1B3, 253, 0x1B2, 253, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1B3, 253, 5); _vm->_hotspots[kHS03Grass]._flags |= SF_WALKABLE | SF_DISABLED; @@ -1051,7 +1051,7 @@ void Scene03::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(8, 4); + gnap.playScratchingHead(Common::Point(8, 4)); break; case GRAB_CURSOR: if (_platypusHypnotized) { @@ -1464,7 +1464,7 @@ void Scene04::run() { if (_vm->isFlag(kGFKeysTaken)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: if (_vm->_cursorValue == 4) @@ -1491,11 +1491,11 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[1]); break; case GRAB_CURSOR: gnap.playPullOutDevice(_vm->_hotspotsWalkPos[1]); - gnap.playUseDevice(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y); + gnap.playUseDevice(_vm->_hotspotsWalkPos[1]); gameSys.insertSequence(0x1FD, 100, 510, 100, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(0x1FD, 100, 2); break; @@ -1511,7 +1511,7 @@ void Scene04::run() { case kHS04Axe: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3].x, _vm->_hotspotsWalkPos[3].y, 9, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[3], 9, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1536,7 +1536,7 @@ void Scene04::run() { case kHS04Dog: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 9, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 9, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1568,12 +1568,12 @@ void Scene04::run() { case kHS04Door: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 4, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 4, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case PLAT_CURSOR: - gnap.playScratchingHead(4, 3); + gnap.playScratchingHead(Common::Point(4, 3)); break; case GRAB_CURSOR: if (_vm->_cursorValue == 1) { @@ -1613,7 +1613,7 @@ void Scene04::run() { case kHS04Window: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 2, 3); } else if (_vm->isFlag(kGFKeysTaken)) { gnap.playImpossible(); } else { @@ -1629,7 +1629,7 @@ void Scene04::run() { } break; case GRAB_CURSOR: - gnap.playScratchingHead(_vm->_hotspotsWalkPos[7].x, _vm->_hotspotsWalkPos[7].y); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[7]); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -1942,7 +1942,7 @@ void Scene05::run() { if (_vm->isFlag(kGFKeysTaken)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1962,13 +1962,13 @@ void Scene05::run() { case kHS05Haystack: if (gnap._actionStatus < 0 && plat._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1].x - 2, _vm->_hotspotsWalkPos[1].y, 4, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1] + Common::Point(-2, 0), 4, 5); } else if (_vm->isFlag(kGFNeedleTaken)) { gnap.playImpossible(); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1); + gnap.playScratchingHead(Common::Point(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1)); break; case GRAB_CURSOR: case TALK_CURSOR: @@ -1999,7 +1999,7 @@ void Scene05::run() { gnap.walkTo(checkPt, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1, 9, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1), 9, 7); else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2026,7 +2026,7 @@ void Scene05::run() { case kHS05Ladder: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 2, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 2, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2062,11 +2062,11 @@ void Scene05::run() { gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) gnap._actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 7, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(7, 4); + gnap.playScratchingHead(Common::Point(7, 4)); break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; @@ -2371,7 +2371,7 @@ void Scene06::run() { if (_vm->isFlag(kGFKeysTaken)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -2391,11 +2391,11 @@ void Scene06::run() { case kHS06Gas: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 5, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(5, 0); + gnap.playScratchingHead(Common::Point(5, 0)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk04)) { @@ -2415,7 +2415,7 @@ void Scene06::run() { if (_vm->isFlag(kGFUnk04)) gnap.playImpossible(); else - gnap.playScratchingHead(5, 0); + gnap.playScratchingHead(Common::Point(5, 0)); break; } } @@ -2425,11 +2425,11 @@ void Scene06::run() { case kHS06Ladder: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(8, 4); + gnap.playScratchingHead(Common::Point(8, 4)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFGasTaken)) @@ -2461,11 +2461,11 @@ void Scene06::run() { gnap._actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 3, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(3, 2); + gnap.playScratchingHead(Common::Point(3, 2)); break; case TALK_CURSOR: if (_horseTurnedBack) { @@ -2771,7 +2771,7 @@ void Scene07::run() { case kHS07Dice: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(4, 8, 3, 3); + gnap.playShowCurrItem(Common::Point(4, 8), 3, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -3019,7 +3019,7 @@ void Scene08::run() { if (_vm->isFlag(kGFSceneFlag1)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.actionIdle(0x14D); @@ -3055,7 +3055,7 @@ void Scene08::run() { case kHS08Man: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(6, 6, 7, 0); + gnap.playShowCurrItem(Common::Point(6, 6), 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -3087,13 +3087,13 @@ void Scene08::run() { case kHS08Door: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(4, 7, 5, 0); + gnap.playShowCurrItem(Common::Point(4, 7), 5, 0); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); gnap._actionStatus = kAS08GrabDog; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 0); + gnap.playScratchingHead(Common::Point(6, 0)); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); gnap._actionStatus = kAS08LookDog; break; @@ -3123,19 +3123,19 @@ void Scene08::run() { case kHS08Meat: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(6, 8, 5, 6); + gnap.playShowCurrItem(Common::Point(6, 8), 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 7); + gnap.playScratchingHead(Common::Point(6, 7)); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - gnap.playScratchingHead(6, 7); + gnap.playScratchingHead(Common::Point(6, 7)); } else { gnap.actionIdle(0x14D); gnap.playPullOutDevice(Common::Point(6, 7)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); _nextDogSequenceId = 0x149; } break; @@ -3149,19 +3149,19 @@ void Scene08::run() { case kHS08Bone: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(2, 7, 3, 6); + gnap.playShowCurrItem(Common::Point(2, 7), 3, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(3, 6); + gnap.playScratchingHead(Common::Point(3, 6)); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - gnap.playScratchingHead(3, 6); + gnap.playScratchingHead(Common::Point(3, 6)); } else { gnap.actionIdle(0x14D); gnap.playPullOutDevice(Common::Point(3, 6)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); _nextDogSequenceId = 0x14A; } break; @@ -3175,19 +3175,19 @@ void Scene08::run() { case kHS08Toy: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(8, 7, 7, 6); + gnap.playShowCurrItem(Common::Point(8, 7), 7, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(7, 6); + gnap.playScratchingHead(Common::Point(7, 6)); break; case GRAB_CURSOR: if (_currDogSequenceId == 0x135) { - gnap.playScratchingHead(7, 6); + gnap.playScratchingHead(Common::Point(7, 6)); } else { gnap.actionIdle(0x14D); gnap.playPullOutDevice(Common::Point(7, 6)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); _nextDogSequenceId = 0x14B; } break; @@ -3487,11 +3487,11 @@ void Scene09::run() { case kHS09Trash: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(9, 6, 8, 0); + gnap.playShowCurrItem(Common::Point(9, 6), 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(8, 3); + gnap.playScratchingHead(Common::Point(8, 3)); break; case GRAB_CURSOR: gnap._actionStatus = kAS09SearchTrash; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 0560cfd666..9d6838ec81 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -116,7 +116,7 @@ void Scene10::run() { if (_vm->isFlag(kGFMudTaken)) gnap.playMoan1(plat._pos); else - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(10); @@ -151,13 +151,13 @@ void Scene10::run() { case kHS10Cook: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(4, 8, 6, 0); + gnap.playShowCurrItem(Common::Point(4, 8), 6, 0); gameSys.setAnimation(makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, 0); gnap._actionStatus = kAS10AnnoyCook; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 0); + gnap.playScratchingHead(Common::Point(6, 0)); break; case GRAB_CURSOR: gnap.playImpossible(); @@ -182,14 +182,14 @@ void Scene10::run() { case kHS10Tongs: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(3, 7, 4, 0); + gnap.playShowCurrItem(Common::Point(3, 7), 4, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFMudTaken)) gnap.playMoan2(Common::Point(-1, -1)); else - gnap.playScratchingHead(4, 3); + gnap.playScratchingHead(Common::Point(4, 3)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFMudTaken)) @@ -220,11 +220,11 @@ void Scene10::run() { case kHS10Box: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(7, 6, 6, 0); + gnap.playShowCurrItem(Common::Point(7, 6), 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(7, 3); + gnap.playScratchingHead(Common::Point(7, 3)); break; case GRAB_CURSOR: gnap.actionIdle(0x10C); @@ -255,7 +255,7 @@ void Scene10::run() { case kHS10Oven: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(9, 6, 10, 0); + gnap.playShowCurrItem(Common::Point(9, 6), 10, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -657,11 +657,11 @@ void Scene11::run() { gnap._actionStatus = kAS11ShowMagazineToGoggleGuy; gnap.playShowItem(_vm->_grabCursorSpriteIndex, 2, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(3, 7, 2, 0); + gnap.playShowCurrItem(Common::Point(3, 7), 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(1, 6); + gnap.playScratchingHead(Common::Point(1, 6)); break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -713,7 +713,7 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(9, 8); + gnap.playScratchingHead(Common::Point(9, 8)); break; case GRAB_CURSOR: gnap.walkTo(Common::Point(9, 8), 0, 0x107BA, 1); @@ -1077,7 +1077,7 @@ void Scene12::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(1, 2); + gnap.playScratchingHead(Common::Point(1, 2)); break; case GRAB_CURSOR: gnap.walkTo(Common::Point(3, 7), 0, 0x107BC, 1); @@ -1576,7 +1576,7 @@ void Scene13::run() { case kHS13BackToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(5, 5, 6, 0); + gnap.playShowCurrItem(Common::Point(5, 5), 6, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1607,7 +1607,7 @@ void Scene13::run() { case kHS13FrontToilet: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(6, 7, 7, 0); + gnap.playShowCurrItem(Common::Point(6, 7), 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1624,7 +1624,7 @@ void Scene13::run() { case kHS13Scribble: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(7, 7, 8, 0); + gnap.playShowCurrItem(Common::Point(7, 7), 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1633,7 +1633,7 @@ void Scene13::run() { gnap._idleFacing = kDirUpRight; break; case GRAB_CURSOR: - gnap.playScratchingHead(0, 0); + gnap.playScratchingHead(); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -1648,7 +1648,7 @@ void Scene13::run() { case kHS13Urinal: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(8, 7, 9, 0); + gnap.playShowCurrItem(Common::Point(8, 7), 9, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2572,12 +2572,12 @@ void Scene17::run() { _vm->invRemove(kItemJoint); } } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case TALK_CURSOR: gnap.playBrainPulsating(plat._pos); @@ -2596,12 +2596,12 @@ void Scene17::run() { if (_vm->isFlag(kGFGrassTaken)) { gnap.playImpossible(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 8, 7); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 8, 7); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: case GRAB_CURSOR: - gnap.playScratchingHead(8, 7); + gnap.playScratchingHead(Common::Point(8, 7)); break; case TALK_CURSOR: gnap.playImpossible(); @@ -2628,11 +2628,11 @@ void Scene17::run() { gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(1, 3); + gnap.playScratchingHead(Common::Point(1, 3)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2669,11 +2669,11 @@ void Scene17::run() { gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, 1, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 1, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(1, 3); + gnap.playScratchingHead(Common::Point(1, 3)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { @@ -2863,7 +2863,7 @@ void Scene17::updateAnimations() { break; case kAS17GetCoinFromPhone: gnap.playPullOutDevice(Common::Point(1, 3)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.setAnimation(0x250, 100, 0); gameSys.insertSequence(0x250, 100, 591, 100, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemDiceQuarterHole); @@ -3513,11 +3513,11 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat].x, _vm->_hotspotsWalkPos[kHS18CowboyHat].y, 3, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18CowboyHat], 3, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(3, 2); + gnap.playScratchingHead(Common::Point(3, 2)); break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, gnap.getSequenceId(gskPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); @@ -3535,25 +3535,27 @@ void Scene18::run() { if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk14)) { if (_vm->_grabCursorSpriteIndex >= 0) - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan], 1, 5); else gnap.playImpossible(); } else { if (_vm->isFlag(kGFPlatypusTalkingToAssistant)) platEndPhoning(true); if (_vm->_grabCursorSpriteIndex >= 0) { - if (!_vm->isFlag(kGFTruckKeysUsed)) - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), - _vm->_hotspotsWalkPos[kHS18GarbageCan].y, _vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y); - else - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y, 2, 4); + if (!_vm->isFlag(kGFTruckKeysUsed)) { + Common::Point destPos; + destPos.x = _vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1); + destPos.y = _vm->_hotspotsWalkPos[kHS18GarbageCan].y; + gnap.playShowCurrItem(destPos, _vm->_hotspotsWalkPos[kHS18GarbageCan].x, _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + } else + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18GarbageCan], 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) - gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y); + gnap.playScratchingHead(Common::Point(_vm->_hotspotsWalkPos[kHS18GarbageCan].x - (gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), _vm->_hotspotsWalkPos[kHS18GarbageCan].y)); else if (!_vm->isFlag(kGFTruckFilledWithGas)) - gnap.playScratchingHead(2, 4); + gnap.playScratchingHead(Common::Point(2, 4)); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFTruckKeysUsed)) { @@ -3589,7 +3591,7 @@ void Scene18::run() { case LOOK_CURSOR: gnapCarryGarbageCanTo(-1); putDownGarbageCan(0); - gnap.playScratchingHead(0, 0); + gnap.playScratchingHead(); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { @@ -3617,11 +3619,11 @@ void Scene18::run() { gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); gnap._actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve].x, _vm->_hotspotsWalkPos[kHS18HydrantTopValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(1, 5); + gnap.playScratchingHead(Common::Point(1, 5)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFBarnPadlockOpen)) { @@ -3648,7 +3650,7 @@ void Scene18::run() { if (_vm->_grabCursorSpriteIndex == -1) { gnap.playImpossible(); } else { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 1, 5); } } else { if (_vm->isFlag(kGFPlatypusDisguised)) { @@ -3662,11 +3664,11 @@ void Scene18::run() { else gnap._actionStatus = kAS18OpenRightValveNoGarbageCan; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve].x, _vm->_hotspotsWalkPos[kHS18HydrantRightValve].y, 1, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 1, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(1, 5); + gnap.playScratchingHead(Common::Point(1, 5)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckFilledWithGas)) { @@ -3882,7 +3884,7 @@ void Scene18::updateAnimations() { _vm->setFlag(kGFBarnPadlockOpen); updateHotspots(); gnap.playPullOutDevice(Common::Point(2, 7)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.insertSequence(0x20C, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 0, 0x107BB, 1); @@ -3980,7 +3982,7 @@ void Scene18::updateAnimations() { _vm->setFlag(kGFTruckFilledWithGas); updateHotspots(); gnap.playPullOutDevice(Common::Point(2, 7)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.insertSequence(0x20B, 19, 0, 0, kSeqNone, 0, 0, 0); _vm->_hotspots[kHS18WalkArea2]._flags |= SF_WALKABLE; gnap.walkTo(_vm->_hotspotsWalkPos[kHS18HydrantRightValve], 0, 0x107BA, 1); @@ -4230,11 +4232,11 @@ void Scene19::run() { case kHS19Picture: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 2); + gnap.playScratchingHead(Common::Point(6, 2)); break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { @@ -4254,11 +4256,11 @@ void Scene19::run() { case kHS19ShopAssistant: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 2); + gnap.playScratchingHead(Common::Point(6, 2)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -4306,11 +4308,11 @@ void Scene19::run() { case kHS19Phone: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y, 9, 1); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 9, 1); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(9, 1); + gnap.playScratchingHead(Common::Point(9, 1)); break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, -1, 1); @@ -4403,7 +4405,7 @@ void Scene19::updateAnimations() { break; case kAS19GrabPicture: gnap.playPullOutDevice(Common::Point(6, 2)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.setAnimation(0x68, 19, 0); gameSys.insertSequence(0x68, 19, 105, 19, kSeqSyncWait, 0, 0, 0); _vm->invAdd(kItemPicture); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index e832f35173..ff315c5df7 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -70,7 +70,7 @@ void Scene20::updateAnimationsCb() { case 0x16A: // Grab joint gnap.playPullOutDevice(Common::Point(4, 4)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.setAnimation(0x16A, 21, 0); gameSys.insertSequence(0x16A, 21, _currStonerGuySequenceId, 21, kSeqSyncWait, 0, 0, 0); _currStonerGuySequenceId = 0x16A; @@ -282,7 +282,7 @@ void Scene20::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(20); @@ -366,7 +366,7 @@ void Scene20::run() { case kHS20StonerGuy: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy].x, _vm->_hotspotsWalkPos[kHS20StonerGuy].y, 5, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20StonerGuy], 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -399,11 +399,11 @@ void Scene20::run() { case kHS20GroceryStoreGuy: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreGuy].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(2, 3); + gnap.playScratchingHead(Common::Point(2, 3)); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; @@ -431,11 +431,11 @@ void Scene20::run() { gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat].x, _vm->_hotspotsWalkPos[kHS20GroceryStoreHat].y, 1, 6); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 1, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(1, 6); + gnap.playScratchingHead(Common::Point(1, 6)); break; case GRAB_CURSOR: _stonerGuyShowingJoint = false; @@ -803,7 +803,7 @@ void Scene21::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -827,12 +827,12 @@ void Scene21::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(2, 5); + gnap.playScratchingHead(Common::Point(2, 5)); break; case GRAB_CURSOR: gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); gnap.playPullOutDevice(Common::Point(2, 5)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gnap._actionStatus = kAS21GrabBanana; break; case TALK_CURSOR: @@ -850,11 +850,11 @@ void Scene21::run() { gnap.walkTo(Common::Point(4, 6), 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(4, 6, 7, 4); + gnap.playShowCurrItem(Common::Point(4, 6), 7, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(7, 4); + gnap.playScratchingHead(Common::Point(7, 4)); break; case GRAB_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -1122,7 +1122,7 @@ void Scene22::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1162,11 +1162,11 @@ void Scene22::run() { case kHS22Cashier: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier].x, _vm->_hotspotsWalkPos[kHS22Cashier].y, 8, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS22Cashier], 8, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(8, 4); + gnap.playScratchingHead(Common::Point(8, 4)); break; case GRAB_CURSOR: gnap.playImpossible(); @@ -1348,7 +1348,7 @@ void Scene23::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1368,7 +1368,7 @@ void Scene23::run() { case kHS23Cereals: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals].x, _vm->_hotspotsWalkPos[kHS23Cereals].y, 5, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS23Cereals], 5, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -1619,7 +1619,7 @@ void Scene24::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1868,7 +1868,7 @@ void Scene25::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(plat._pos.x, plat._pos.y); + gnap.playScratchingHead(plat._pos); break; case GRAB_CURSOR: gnap.kissPlatypus(0); @@ -1891,14 +1891,14 @@ void Scene25::run() { gnap._actionStatus = kAS25ShowTicketToVendor; gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor].x, _vm->_hotspotsWalkPos[kHS25TicketVendor].y, 6, 1); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS25TicketVendor], 6, 1); _nextTicketVendorSequenceId = 0x5B; } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 1); + gnap.playScratchingHead(Common::Point(6, 1)); _nextTicketVendorSequenceId = (_vm->getRandom(2) == 1) ? 0x59 : 0x56; break; case TALK_CURSOR: @@ -2448,11 +2448,11 @@ void Scene27::run() { if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, 0x107BC, 1)) gnap._actionStatus = kAS27ShowPictureToJanitor; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor].x, _vm->_hotspotsWalkPos[kHS27Janitor].y, 7, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS27Janitor], 7, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 3); + gnap.playScratchingHead(Common::Point(6, 3)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -2475,7 +2475,7 @@ void Scene27::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(3, 3); + gnap.playScratchingHead(Common::Point(3, 3)); break; case GRAB_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -2614,7 +2614,7 @@ void Scene27::updateAnimations() { break; case kAS27GrabBucket: gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); _vm->_hotspots[kHS27Bucket]._flags = SF_DISABLED; _vm->invAdd(kItemEmptyBucket); _vm->setFlag(kGFUnk13); @@ -2676,7 +2676,7 @@ void Scene27::updateAnimations() { case 0xD0: // Show picture to janitor gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.insertSequence(_nextJanitorSequenceId, 39, _currJanitorSequenceId, 39, kSeqSyncWait, 0, 0, 0); gameSys.setAnimation(_nextJanitorSequenceId, 39, 0); gnap._actionStatus = kAS27EnterClownTent; @@ -2818,11 +2818,11 @@ void Scene28::run() { case kHS28Horn: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(2, 8, 3, 4); + gnap.playShowCurrItem(Common::Point(2, 8), 3, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(2, 4); + gnap.playScratchingHead(Common::Point(2, 4)); break; case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { @@ -2852,27 +2852,27 @@ void Scene28::run() { if (gnap._actionStatus < 0) { if (_vm->isFlag(kGFUnk21)) { if (_vm->_verbCursor == LOOK_CURSOR) - gnap.playScratchingHead(5, 2); + gnap.playScratchingHead(Common::Point(5, 2)); else gnap.playImpossible(); } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithBeer) { gnap._idleFacing = kDirUpLeft; gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gnap._actionStatus = kAS28UseBeerBucketWithClown; } else if (_vm->_grabCursorSpriteIndex == kItemBucketWithPill) { gnap._idleFacing = kDirUpLeft; gnap.walkTo(_vm->_hotspotsWalkPos[kHS28Clown], 0, 0x107BC, 1); gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gnap._actionStatus = kAS28UsePillBucketWithClown; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown].x, _vm->_hotspotsWalkPos[kHS28Clown].y, 2, 4); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS28Clown], 2, 4); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(5, 2); + gnap.playScratchingHead(Common::Point(5, 2)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; @@ -2909,7 +2909,7 @@ void Scene28::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(8, 6); + gnap.playScratchingHead(Common::Point(8, 6)); break; case GRAB_CURSOR: gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); @@ -2990,7 +2990,7 @@ void Scene28::updateAnimations() { break; case kAS28GrabHornSuccess: gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.setAnimation(0x117, 59, 0); gameSys.insertSequence(0x117, 59, 280, 59, kSeqSyncWait, 0, 0, 0); gnap._actionStatus = kAS28GrabHornSuccessDone; @@ -3012,7 +3012,7 @@ void Scene28::updateAnimations() { break; case kAS28GrabEmptyBucket: gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.setAnimation(0x111, 99, 0); gameSys.insertSequence(0x111, 99, 274, 99, kSeqSyncWait, 0, 0, 0); gnap._actionStatus = kAS28GrabEmptyBucketDone; @@ -3219,11 +3219,11 @@ void Scene29::run() { _vm->_isLeavingScene = true; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey].x, _vm->_hotspotsWalkPos[kHS29Monkey].y, 5, 6); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Monkey], 5, 6); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(5, 6); + gnap.playScratchingHead(Common::Point(5, 6)); break; case TALK_CURSOR: gnap.playBrainPulsating(_vm->_hotspotsWalkPos[kHS29Monkey]); @@ -3267,7 +3267,7 @@ void Scene29::run() { gnap.playIdle(_vm->_hotspotsWalkPos[kHS29Arcade]); gnap._actionStatus = kAS29LeaveScene; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Arcade].x, _vm->_hotspotsWalkPos[kHS29Arcade].y, 2, 3); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS29Arcade], 2, 3); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index c29e7c176d..4832ce1dcb 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -123,7 +123,7 @@ void Scene30::run() { gnap._actionStatus = kAS30UsePillMachine; hasTakenPill = true; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine].x, _vm->_hotspotsWalkPos[kHS30PillMachine].y, 8, 5); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS30PillMachine], 8, 5); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -131,7 +131,7 @@ void Scene30::run() { gnap._actionStatus = kAS30LookPillMachine; break; case GRAB_CURSOR: - gnap.playScratchingHead(8, 5); + gnap.playScratchingHead(Common::Point(8, 5)); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -376,15 +376,15 @@ void Scene31::run() { if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { if (gnap._actionStatus == kAS31PlatMeasuringClown) { if (_vm->_verbCursor == LOOK_CURSOR) - gnap.playScratchingHead(2, 2); + gnap.playScratchingHead(Common::Point(2, 2)); else gnap.playImpossible(); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown].x, _vm->_hotspotsWalkPos[kHS31MeasuringClown].y + 1, 2, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), 2, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(2, 2); + gnap.playScratchingHead(Common::Point(2, 2)); break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[kHS31MeasuringClown] + Common::Point(0, 1), -1, -1, 1); @@ -423,20 +423,20 @@ void Scene31::run() { _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); gnap.playPullOutDevice(Common::Point(6, 8)); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gnap.walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); gnap._actionStatus = kAS31FillEmptyBucketWithBeer; _vm->_timers[4] = 300; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel].x, _vm->_hotspotsWalkPos[kHS31BeerBarrel].y, 6, 2); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 6, 2); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(6, 2); + gnap.playScratchingHead(Common::Point(6, 2)); break; case GRAB_CURSOR: if (_beerGuyDistracted) { - gnap.playScratchingHead(6, 2); + gnap.playScratchingHead(Common::Point(6, 2)); } else { gnap.walkTo(_vm->_hotspotsWalkPos[kHS31BeerBarrel], 0, 0x107BC, 1); gnap._actionStatus = kAS31UseBeerBarrel; @@ -561,7 +561,7 @@ void Scene31::updateAnimations() { case kAS31FillEmptyBucketWithBeerDone: gnap._idleFacing = kDirBottomLeft; gnap.playPullOutDevice(); - gnap.playUseDevice(0, 0); + gnap.playUseDevice(); gameSys.insertSequence(0xF9, 59, 0xF8, 59, kSeqSyncWait, 0, 0, 0); gnap._actionStatus = -1; _vm->invAdd(kItemBucketWithBeer); @@ -906,7 +906,7 @@ void Scene33::run() { case kHS33Chicken: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(7, 9, 9, 8); + gnap.playShowCurrItem(Common::Point(7, 9), 9, 8); } else { switch (_vm->_verbCursor) { case GRAB_CURSOR: @@ -1224,11 +1224,11 @@ void Scene38::run() { case kHS38HuntingTrophy: if (gnap._actionStatus != kAS38HoldingHuntingTrophy) { if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(3, 6, 2, 0); + gnap.playShowCurrItem(Common::Point(3, 6), 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(0, 0); + gnap.playScratchingHead(); break; case GRAB_CURSOR: if (plat._actionStatus == kAS38PlatypusHoldingTrapDoor) diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index b789b0e1f3..f6cb57c750 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -407,7 +407,7 @@ void Scene41::run() { gnap.walkTo(Common::Point(4, 7), 0, 0x107BB, 9); gnap.playShowItem(_vm->_grabCursorSpriteIndex, 5, 0); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(4, 7, 5, 0); + gnap.playShowCurrItem(Common::Point(4, 7), 5, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -434,11 +434,11 @@ void Scene41::run() { gnap._idleFacing = kDirUpRight; gnap._actionStatus = kAS41UseChickenBucketWithKid; } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(7, 7, 8, 0); + gnap.playShowCurrItem(Common::Point(7, 7), 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(9, 0); + gnap.playScratchingHead(Common::Point(9, 0)); break; case GRAB_CURSOR: gnap.walkTo(Common::Point(7, 7), 0, 0x107BB, 1); @@ -587,7 +587,7 @@ void Scene41::updateAnimations() { break; case kAS41UseGumWithToyUfo: gameSys.setAnimation(0, 0, 0); - gnap.playUseDevice(9, 0); + gnap.playUseDevice(Common::Point(9, 0)); gnap._actionStatus = -1; _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemGum); @@ -924,11 +924,11 @@ void Scene42::run() { if (plat._pos.y < 9) plat.walkTo(Common::Point(plat._pos.x, 9), -1, -1, 1); } else if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor].x, _vm->_hotspotsWalkPos[kHS42BBQVendor].y, _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42BBQVendor], _vm->_hotspotsWalkPos[kHS42BBQVendor].x + 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0); + gnap.playScratchingHead(Common::Point(_vm->_hotspotsWalkPos[kHS42BBQVendor].x - 1, 0)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -945,11 +945,11 @@ void Scene42::run() { case kHS42ChickenLeg: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x, _vm->_hotspotsWalkPos[kHS42ChickenLeg].y, _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS42ChickenLeg], _vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0); + gnap.playScratchingHead(Common::Point(_vm->_hotspotsWalkPos[kHS42ChickenLeg].x - 1, 0)); break; case GRAB_CURSOR: gnap.walkTo(_vm->_hotspotsWalkPos[kHS42ChickenLeg], 0, 0x107BC, 1); @@ -1380,11 +1380,11 @@ void Scene43::run() { case kHS43TwoHeadedGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(6, 8, 7, 0); + gnap.playShowCurrItem(Common::Point(6, 8), 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(7, 0); + gnap.playScratchingHead(Common::Point(7, 0)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -1402,11 +1402,11 @@ void Scene43::run() { case kHS43Key: case kHS43Ufo: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(3, 7, 2, 0); + gnap.playShowCurrItem(Common::Point(3, 7), 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(0, 0); + gnap.playScratchingHead(); break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; @@ -1835,7 +1835,7 @@ void Scene44::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(4, 3); + gnap.playScratchingHead(Common::Point(4, 3)); break; case GRAB_CURSOR: gnap.playImpossible(); @@ -1859,15 +1859,15 @@ void Scene44::run() { case kHS44Spring: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring].x, _vm->_hotspotsWalkPos[kHS44Spring].y, 8, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44Spring], 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(8, 7); + gnap.playScratchingHead(Common::Point(8, 7)); break; case GRAB_CURSOR: gnap.playPullOutDevice(Common::Point(8, 0)); - gnap.playUseDevice(8, 0); + gnap.playUseDevice(Common::Point(8, 0)); _nextSpringGuySequenceId = 0xFB; _vm->invAdd(kItemSpring); _vm->setFlag(kGFSpringTaken); @@ -1885,14 +1885,14 @@ void Scene44::run() { case kHS44SpringGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy].x, _vm->_hotspotsWalkPos[kHS44SpringGuy].y, 8, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS44SpringGuy], 8, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: if (_vm->isFlag(kGFSpringTaken)) gnap.playMoan1(Common::Point(8, 7)); else - gnap.playScratchingHead(8, 7); + gnap.playScratchingHead(Common::Point(8, 7)); break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; @@ -2348,7 +2348,7 @@ void Scene45::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(5, 0); + gnap.playScratchingHead(Common::Point(5, 0)); break; case GRAB_CURSOR: case TALK_CURSOR: @@ -2629,7 +2629,7 @@ void Scene46::run() { case kHS46SackGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy].x, _vm->_hotspotsWalkPos[kHS46SackGuy].y, 2, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46SackGuy], 2, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: @@ -2650,7 +2650,7 @@ void Scene46::run() { case kHS46ItchyGuy: if (_vm->_grabCursorSpriteIndex >= 0) { - gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy].x, _vm->_hotspotsWalkPos[kHS46ItchyGuy].y, 7, 0); + gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 7, 0); } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: -- cgit v1.2.3 From 5981ef48daf09475c089334402316161bb617d81 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 10 May 2016 10:07:51 +0200 Subject: GNAP: Make all relevant destructors virtual --- engines/gnap/character.h | 3 ++- engines/gnap/scenes/group0.h | 18 +++++++++--------- engines/gnap/scenes/group1.h | 18 +++++++++--------- engines/gnap/scenes/group2.h | 20 ++++++++++---------- engines/gnap/scenes/group3.h | 12 ++++++------ engines/gnap/scenes/group4.h | 14 +++++++------- engines/gnap/scenes/group5.h | 2 +- engines/gnap/scenes/groupcs.h | 22 +++++++++++----------- engines/gnap/scenes/intro.h | 2 +- engines/gnap/scenes/scenecore.h | 4 ++-- 10 files changed, 58 insertions(+), 57 deletions(-) diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 554e980dbb..0a00fe0cad 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -48,7 +48,7 @@ const int kMaxGridStructs = 30; class Character { public: Character(GnapEngine *vm); - ~Character(); + virtual ~Character(); void walkStep(); @@ -124,6 +124,7 @@ private: class PlayerPlat : public Character { public: PlayerPlat(GnapEngine *vm); + virtual ~PlayerPlat() {} virtual int getSequenceId(int kind = 0, Common::Point gridPos = Common::Point(0, 0)); virtual void initPos(int gridX, int gridY, Facing facing); virtual void playSequence(int sequenceId); diff --git a/engines/gnap/scenes/group0.h b/engines/gnap/scenes/group0.h index 38ded681af..e06380926d 100644 --- a/engines/gnap/scenes/group0.h +++ b/engines/gnap/scenes/group0.h @@ -251,7 +251,7 @@ class CutScene; class Scene01: public Scene { public: Scene01(GnapEngine *vm); - ~Scene01(); + virtual ~Scene01(); virtual int init(); virtual void updateHotspots(); @@ -268,7 +268,7 @@ private: class Scene02: public Scene { public: Scene02(GnapEngine *vm); - ~Scene02() {} + virtual ~Scene02() {} virtual int init(); virtual void updateHotspots(); @@ -286,7 +286,7 @@ private: class Scene03: public Scene { public: Scene03(GnapEngine *vm); - ~Scene03() {} + virtual ~Scene03() {} virtual int init(); virtual void updateHotspots(); @@ -305,7 +305,7 @@ private: class Scene04: public Scene { public: Scene04(GnapEngine *vm); - ~Scene04() {} + virtual ~Scene04() {} virtual int init(); virtual void updateHotspots(); @@ -323,7 +323,7 @@ private: class Scene05: public Scene { public: Scene05(GnapEngine *vm); - ~Scene05() {} + virtual ~Scene05() {} virtual int init(); virtual void updateHotspots(); @@ -339,7 +339,7 @@ private: class Scene06: public Scene { public: Scene06(GnapEngine *vm); - ~Scene06() {} + virtual ~Scene06() {} virtual int init(); virtual void updateHotspots(); @@ -357,7 +357,7 @@ private: class Scene07: public Scene { public: Scene07(GnapEngine *vm); - ~Scene07() {} + virtual ~Scene07() {} virtual int init(); virtual void updateHotspots(); @@ -369,7 +369,7 @@ public: class Scene08: public Scene { public: Scene08(GnapEngine *vm); - ~Scene08() {} + virtual ~Scene08() {} virtual int init(); virtual void updateHotspots(); @@ -387,7 +387,7 @@ private: class Scene09: public Scene { public: Scene09(GnapEngine *vm); - ~Scene09() {} + virtual ~Scene09() {} virtual int init(); virtual void updateHotspots(); diff --git a/engines/gnap/scenes/group1.h b/engines/gnap/scenes/group1.h index 568099d535..30771d017a 100644 --- a/engines/gnap/scenes/group1.h +++ b/engines/gnap/scenes/group1.h @@ -273,7 +273,7 @@ class CutScene; class Scene10: public Scene { public: Scene10(GnapEngine *vm); - ~Scene10() {} + virtual ~Scene10() {} virtual int init(); virtual void updateHotspots(); @@ -289,7 +289,7 @@ private: class Scene11: public Scene { public: Scene11(GnapEngine *vm); - ~Scene11() {} + virtual ~Scene11() {} virtual int init(); virtual void updateHotspots(); @@ -308,7 +308,7 @@ private: class Scene12: public Scene { public: Scene12(GnapEngine *vm); - ~Scene12() {} + virtual ~Scene12() {} virtual int init(); virtual void updateHotspots(); @@ -328,7 +328,7 @@ private: class Scene13: public Scene { public: Scene13(GnapEngine *vm); - ~Scene13() {} + virtual ~Scene13() {} virtual int init(); virtual void updateHotspots(); @@ -345,7 +345,7 @@ private: class Scene14: public Scene { public: Scene14(GnapEngine *vm); - ~Scene14() {} + virtual ~Scene14() {} virtual int init(); virtual void updateHotspots(); @@ -357,7 +357,7 @@ public: class Scene15: public Scene { public: Scene15(GnapEngine *vm); - ~Scene15() {} + virtual ~Scene15() {} virtual int init(); virtual void updateHotspots(); @@ -379,7 +379,7 @@ private: class Scene17: public Scene { public: Scene17(GnapEngine *vm); - ~Scene17() {} + virtual ~Scene17() {} virtual int init(); virtual void updateHotspots(); @@ -406,7 +406,7 @@ private: class Scene18: public Scene { public: Scene18(GnapEngine *vm); - ~Scene18(); + virtual ~Scene18(); virtual int init(); virtual void updateHotspots(); @@ -432,7 +432,7 @@ private: class Scene19: public Scene { public: Scene19(GnapEngine *vm); - ~Scene19(); + virtual ~Scene19(); virtual int init(); virtual void updateHotspots(); diff --git a/engines/gnap/scenes/group2.h b/engines/gnap/scenes/group2.h index da4ff70407..8f56594f16 100644 --- a/engines/gnap/scenes/group2.h +++ b/engines/gnap/scenes/group2.h @@ -229,7 +229,7 @@ class CutScene; class Scene20: public Scene { public: Scene20(GnapEngine *vm); - ~Scene20() {} + virtual ~Scene20() {} virtual int init(); virtual void updateHotspots(); @@ -252,7 +252,7 @@ private: class Scene21: public Scene { public: Scene21(GnapEngine *vm); - ~Scene21() {} + virtual ~Scene21() {} virtual int init(); virtual void updateHotspots(); @@ -268,7 +268,7 @@ private: class Scene22: public Scene { public: Scene22(GnapEngine *vm); - ~Scene22() {} + virtual ~Scene22() {} virtual int init(); virtual void updateHotspots(); @@ -286,7 +286,7 @@ private: class Scene23: public Scene { public: Scene23(GnapEngine *vm); - ~Scene23() {} + virtual ~Scene23() {} virtual int init(); virtual void updateHotspots(); @@ -302,7 +302,7 @@ private: class Scene24: public Scene { public: Scene24(GnapEngine *vm); - ~Scene24() {} + virtual ~Scene24() {} virtual int init(); virtual void updateHotspots(); @@ -320,7 +320,7 @@ private: class Scene25: public Scene { public: Scene25(GnapEngine *vm); - ~Scene25() {} + virtual ~Scene25() {} virtual int init(); virtual void updateHotspots(); @@ -338,7 +338,7 @@ private: class Scene26: public Scene { public: Scene26(GnapEngine *vm); - ~Scene26() {} + virtual ~Scene26() {} virtual int init(); virtual void updateHotspots(); @@ -354,7 +354,7 @@ private: class Scene27: public Scene { public: Scene27(GnapEngine *vm); - ~Scene27() {} + virtual ~Scene27() {} virtual int init(); virtual void updateHotspots(); @@ -370,7 +370,7 @@ private: class Scene28: public Scene { public: Scene28(GnapEngine *vm); - ~Scene28() {} + virtual ~Scene28() {} virtual int init(); virtual void updateHotspots(); @@ -387,7 +387,7 @@ private: class Scene29: public Scene { public: Scene29(GnapEngine *vm); - ~Scene29() {} + virtual ~Scene29() {} virtual int init(); virtual void updateHotspots(); diff --git a/engines/gnap/scenes/group3.h b/engines/gnap/scenes/group3.h index e80debb149..6fbbdd79aa 100644 --- a/engines/gnap/scenes/group3.h +++ b/engines/gnap/scenes/group3.h @@ -148,7 +148,7 @@ class CutScene; class Scene30: public Scene { public: Scene30(GnapEngine *vm); - ~Scene30() {} + virtual ~Scene30() {} virtual int init(); virtual void updateHotspots(); @@ -163,7 +163,7 @@ private: class Scene31: public Scene { public: Scene31(GnapEngine *vm); - ~Scene31() {} + virtual ~Scene31() {} virtual int init(); virtual void updateHotspots(); @@ -182,7 +182,7 @@ private: class Scene32: public Scene { public: Scene32(GnapEngine *vm); - ~Scene32() {} + virtual ~Scene32() {} virtual int init(); virtual void updateHotspots(); @@ -194,7 +194,7 @@ public: class Scene33: public Scene { public: Scene33(GnapEngine *vm); - ~Scene33() {} + virtual ~Scene33() {} virtual int init(); virtual void updateHotspots(); @@ -210,7 +210,7 @@ private: class Scene38: public Scene { public: Scene38(GnapEngine *vm); - ~Scene38() {} + virtual ~Scene38() {} virtual int init(); virtual void updateHotspots(); @@ -222,7 +222,7 @@ public: class Scene39: public Scene { public: Scene39(GnapEngine *vm); - ~Scene39() {} + virtual ~Scene39() {} virtual int init(); virtual void updateHotspots(); diff --git a/engines/gnap/scenes/group4.h b/engines/gnap/scenes/group4.h index 542834de7d..afcd62e9e7 100644 --- a/engines/gnap/scenes/group4.h +++ b/engines/gnap/scenes/group4.h @@ -183,7 +183,7 @@ class CutScene; class Scene40: public Scene { public: Scene40(GnapEngine *vm); - ~Scene40() {} + virtual ~Scene40() {} virtual int init(); virtual void updateHotspots(); @@ -195,7 +195,7 @@ public: class Scene41: public Scene { public: Scene41(GnapEngine *vm); - ~Scene41() {} + virtual ~Scene41() {} virtual int init(); virtual void updateHotspots(); @@ -213,7 +213,7 @@ private: class Scene42: public Scene { public: Scene42(GnapEngine *vm); - ~Scene42() {} + virtual ~Scene42() {} virtual int init(); virtual void updateHotspots(); @@ -229,7 +229,7 @@ private: class Scene43: public Scene { public: Scene43(GnapEngine *vm); - ~Scene43() {} + virtual ~Scene43() {} virtual int init(); virtual void updateHotspots(); @@ -245,7 +245,7 @@ private: class Scene44: public Scene { public: Scene44(GnapEngine *vm); - ~Scene44() {} + virtual ~Scene44() {} virtual int init(); virtual void updateHotspots(); @@ -263,7 +263,7 @@ private: class Scene45: public Scene { public: Scene45(GnapEngine *vm); - ~Scene45() {} + virtual ~Scene45() {} virtual int init(); virtual void updateHotspots(); @@ -278,7 +278,7 @@ private: class Scene46: public Scene { public: Scene46(GnapEngine *vm); - ~Scene46() {} + virtual ~Scene46() {} virtual int init(); virtual void updateHotspots(); diff --git a/engines/gnap/scenes/group5.h b/engines/gnap/scenes/group5.h index c7d209b6b3..dd238ec65c 100644 --- a/engines/gnap/scenes/group5.h +++ b/engines/gnap/scenes/group5.h @@ -53,7 +53,7 @@ class GnapEngine; class Scene53: public Scene { public: Scene53(GnapEngine *vm); - ~Scene53() {} + virtual ~Scene53() {} virtual int init(); virtual void updateHotspots(); diff --git a/engines/gnap/scenes/groupcs.h b/engines/gnap/scenes/groupcs.h index 26f51abb0b..58033564ce 100644 --- a/engines/gnap/scenes/groupcs.h +++ b/engines/gnap/scenes/groupcs.h @@ -33,7 +33,7 @@ class CutScene; class Scene16: public CutScene { public: Scene16(GnapEngine *vm); - ~Scene16() {} + virtual ~Scene16() {} virtual int init(); }; @@ -41,7 +41,7 @@ public: class Scene471: public CutScene { public: Scene471(GnapEngine *vm); - ~Scene471() {} + virtual ~Scene471() {} virtual int init(); }; @@ -49,7 +49,7 @@ public: class Scene472: public CutScene { public: Scene472(GnapEngine *vm); - ~Scene472() {} + virtual ~Scene472() {} virtual int init(); }; @@ -57,7 +57,7 @@ public: class Scene473: public CutScene { public: Scene473(GnapEngine *vm); - ~Scene473() {} + virtual ~Scene473() {} virtual int init(); }; @@ -65,7 +65,7 @@ public: class Scene474: public CutScene { public: Scene474(GnapEngine *vm); - ~Scene474() {} + virtual ~Scene474() {} virtual int init(); }; @@ -73,7 +73,7 @@ public: class Scene475: public CutScene { public: Scene475(GnapEngine *vm); - ~Scene475() {} + virtual ~Scene475() {} virtual int init(); }; @@ -81,7 +81,7 @@ public: class Scene476: public CutScene { public: Scene476(GnapEngine *vm); - ~Scene476() {} + virtual ~Scene476() {} virtual int init(); }; @@ -89,7 +89,7 @@ public: class Scene477: public CutScene { public: Scene477(GnapEngine *vm); - ~Scene477() {} + virtual ~Scene477() {} virtual int init(); }; @@ -97,7 +97,7 @@ public: class Scene48: public CutScene { public: Scene48(GnapEngine *vm); - ~Scene48() {} + virtual ~Scene48() {} virtual int init(); }; @@ -105,7 +105,7 @@ public: class Scene541: public CutScene { public: Scene541(GnapEngine *vm); - ~Scene541() {} + virtual ~Scene541() {} virtual int init(); }; @@ -113,7 +113,7 @@ public: class Scene542: public CutScene { public: Scene542(GnapEngine *vm); - ~Scene542() {} + virtual ~Scene542() {} virtual int init(); }; diff --git a/engines/gnap/scenes/intro.h b/engines/gnap/scenes/intro.h index c744999a69..15aedfc4fc 100644 --- a/engines/gnap/scenes/intro.h +++ b/engines/gnap/scenes/intro.h @@ -33,7 +33,7 @@ class GnapEngine; class SceneIntro: public Scene { public: SceneIntro(GnapEngine *vm); - ~SceneIntro() {} + virtual ~SceneIntro() {} virtual int init(); virtual void updateHotspots() {} diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index 209f07a162..5bfc80d185 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -32,7 +32,7 @@ class GnapEngine; class Scene { public: Scene(GnapEngine *vm) : _vm(vm) {}; - ~Scene() {}; + virtual ~Scene() {}; void playRandomSound(int timerIndex); bool clearKeyStatus(); @@ -50,7 +50,7 @@ protected: class CutScene : public Scene { public: CutScene(GnapEngine *vm) : Scene(vm) {}; - ~CutScene() {}; + virtual ~CutScene() {}; virtual int init() = 0; void updateHotspots() {} -- cgit v1.2.3 From 7b1c738f0ffe17dff6ca0be36b893d2cda664426 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 10 May 2016 10:08:29 +0200 Subject: GNAP: Fix initialization and out-of-bounds write --- engines/gnap/scenes/arcade.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index a4bde9f1fe..22f661b1b0 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -1033,7 +1033,7 @@ Scene51::Scene51(GnapEngine *vm) : Scene(vm) { for (int i = 0; i < 4; i++) { _digits[i] = 0; - _digitSequenceIds[4] = -1; + _digitSequenceIds[i] = -1; } for (int i = 0; i < 6; i++) { -- cgit v1.2.3 From 3459437d7c41e675f0f496bc8bf997585365e98c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 10 May 2016 10:11:17 +0200 Subject: GNAP: Fix initialization --- engines/gnap/scenes/arcade.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 22f661b1b0..1547a50716 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -1038,10 +1038,10 @@ Scene51::Scene51(GnapEngine *vm) : Scene(vm) { for (int i = 0; i < 6; i++) { _items[i]._currSequenceId = -1; - _items[i]._droppedSequenceId; + _items[i]._droppedSequenceId = 0; _items[i]._x = 0; _items[i]._y = 0; - _items[i]._collisionX; + _items[i]._collisionX = 0; _items[i]._canCatch = false; _items[i]._isCollision = false; _items[i]._x2 = 0; -- cgit v1.2.3 From b21089f81c04c83c281cfffac0dbfee9da3cc990 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 10 May 2016 19:59:27 +0200 Subject: GNAP: Rename GetSequence enums --- engines/gnap/character.cpp | 56 +++++++++++++++++++------------------- engines/gnap/gnap.h | 62 +++++++----------------------------------- engines/gnap/scenes/group0.cpp | 62 +++++++++++++++++++++--------------------- engines/gnap/scenes/group1.cpp | 42 ++++++++++++++-------------- engines/gnap/scenes/group2.cpp | 46 +++++++++++++++---------------- engines/gnap/scenes/group3.cpp | 6 ++-- engines/gnap/scenes/group4.cpp | 16 +++++------ 7 files changed, 124 insertions(+), 166 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 5226c75210..7b55e2b887 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -116,7 +116,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { int sequenceId = 0; switch (kind) { - case gskPullOutDevice: + case kGSPullOutDevice: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -153,7 +153,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskPullOutDeviceNonWorking: + case kGSPullOutDeviceNonWorking: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -190,7 +190,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskScratchingHead: + case kGSScratchingHead: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -231,7 +231,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskIdle: + case kGSIdle: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -268,7 +268,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskBrainPulsating: + case kGSBrainPulsating: _brainPulseNum = (_brainPulseNum + 1) & 1; if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { @@ -306,7 +306,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskImpossible: + case kGSImpossible: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -340,7 +340,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskDeflect: + case kGSDeflect: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -380,7 +380,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskUseDevice: + case kGSUseDevice: switch (_idleFacing) { case kDirBottomRight: sequenceId = 0x83A; @@ -400,7 +400,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskMoan1: + case kGSMoan1: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -428,7 +428,7 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { } break; - case gskMoan2: + case kGSMoan2: if (gridPos.x > 0 && gridPos.y > 0) { if (_pos.y > gridPos.y) { if (_pos.x > gridPos.x) { @@ -488,7 +488,7 @@ void PlayerGnap::useJointOnPlatypus() { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - playSequence(getSequenceId(gskScratchingHead, plat._pos) | 0x10000); + playSequence(getSequenceId(kGSScratchingHead, plat._pos) | 0x10000); } } @@ -519,14 +519,14 @@ void PlayerGnap::kissPlatypus(int callback) { _vm->_gameSys->setAnimation(0, 0, 0); _actionStatus = -1; } else { - playSequence(getSequenceId(gskScratchingHead, plat._pos) | 0x10000); + playSequence(getSequenceId(kGSScratchingHead, plat._pos) | 0x10000); } } void PlayerGnap::useDeviceOnPlatypus() { PlayerPlat& plat = *_vm->_plat; - playSequence(makeRid(1, getSequenceId(gskPullOutDevice, plat._pos))); + playSequence(makeRid(1, getSequenceId(kGSPullOutDevice, plat._pos))); if (plat._idleFacing != kDirNone) { _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), plat._id, @@ -542,7 +542,7 @@ void PlayerGnap::useDeviceOnPlatypus() { plat._sequenceDatNum = 1; } - int newSequenceId = getSequenceId(gskUseDevice, Common::Point(0, 0)); + int newSequenceId = getSequenceId(kGSUseDevice, Common::Point(0, 0)); _vm->_gameSys->insertSequence(makeRid(1, newSequenceId), _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqSyncWait, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); @@ -1024,7 +1024,7 @@ int PlayerGnap::getShowSequenceId(int index, int gridX, int gridY) { //Skip 29 default: _idleFacing = facing; - sequenceId = getSequenceId(gskImpossible, Common::Point(0, 0)); + sequenceId = getSequenceId(kGSImpossible, Common::Point(0, 0)); break; } @@ -1039,58 +1039,58 @@ void PlayerGnap::idle() { _sequenceId == 0x833 || _sequenceId == 0x834 || _sequenceId == 0x885 || _sequenceId == 0x7A8 || _sequenceId == 0x831 || _sequenceId == 0x89A)) { - _vm->_gameSys->insertSequence(getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, _id, + _vm->_gameSys->insertSequence(getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); - _sequenceId = getSequenceId(gskIdle, Common::Point(0, 0)); + _sequenceId = getSequenceId(kGSIdle, Common::Point(0, 0)); _sequenceDatNum = 1; } } void PlayerGnap::actionIdle(int sequenceId) { if (_sequenceId != -1 && ridToDatIndex(sequenceId) == _sequenceDatNum && ridToEntryIndex(sequenceId) == _sequenceId) { - _vm->_gameSys->insertSequence(getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, _id, + _vm->_gameSys->insertSequence(getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, _id, makeRid(_sequenceDatNum, _sequenceId), _id, kSeqSyncExists, 0, 75 * _pos.x - _gridX, 48 * _pos.y - _gridY); - _sequenceId = getSequenceId(gskIdle, Common::Point(0, 0)); + _sequenceId = getSequenceId(kGSIdle, Common::Point(0, 0)); _sequenceDatNum = 1; } } void PlayerGnap::playImpossible(Common::Point gridPos) { - playSequence(getSequenceId(gskImpossible, gridPos) | 0x10000); + playSequence(getSequenceId(kGSImpossible, gridPos) | 0x10000); } void PlayerGnap::playScratchingHead(Common::Point gridPos) { - playSequence(getSequenceId(gskScratchingHead, gridPos) | 0x10000); + playSequence(getSequenceId(kGSScratchingHead, gridPos) | 0x10000); } void PlayerGnap::playMoan1(Common::Point gridPos) { - playSequence(getSequenceId(gskMoan1, gridPos) | 0x10000); + playSequence(getSequenceId(kGSMoan1, gridPos) | 0x10000); } void PlayerGnap::playMoan2(Common::Point gridPos) { - playSequence(getSequenceId(gskMoan2, gridPos) | 0x10000); + playSequence(getSequenceId(kGSMoan2, gridPos) | 0x10000); } void PlayerGnap::playBrainPulsating(Common::Point gridPos) { - playSequence(getSequenceId(gskBrainPulsating, gridPos) | 0x10000); + playSequence(getSequenceId(kGSBrainPulsating, gridPos) | 0x10000); } void PlayerGnap::playPullOutDevice(Common::Point gridPos) { - playSequence(getSequenceId(gskPullOutDevice, gridPos) | 0x10000); + playSequence(getSequenceId(kGSPullOutDevice, gridPos) | 0x10000); } void PlayerGnap::playPullOutDeviceNonWorking(Common::Point gridPos) { - playSequence(getSequenceId(gskPullOutDeviceNonWorking, gridPos) | 0x10000); + playSequence(getSequenceId(kGSPullOutDeviceNonWorking, gridPos) | 0x10000); } void PlayerGnap::playUseDevice(Common::Point gridPos) { - playSequence(getSequenceId(gskUseDevice, gridPos) | 0x10000); + playSequence(getSequenceId(kGSUseDevice, gridPos) | 0x10000); } void PlayerGnap::playIdle(Common::Point gridPos) { - playSequence(getSequenceId(gskIdle, gridPos) | 0x10000); + playSequence(getSequenceId(kGSIdle, gridPos) | 0x10000); } void PlayerGnap::playShowItem(int itemIndex, int gridLookX, int gridLookY) { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 0bda4b4706..c7273077a4 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -120,16 +120,16 @@ enum { }; enum { - gskPullOutDevice = 0, - gskPullOutDeviceNonWorking = 1, - gskIdle = 2, - gskBrainPulsating = 3, - gskImpossible = 4, - gskScratchingHead = 5, - gskDeflect = 6, - gskUseDevice = 7, - gskMoan1 = 8, - gskMoan2 = 9 + kGSPullOutDevice = 0, + kGSPullOutDeviceNonWorking = 1, + kGSIdle = 2, + kGSBrainPulsating = 3, + kGSImpossible = 4, + kGSScratchingHead = 5, + kGSDeflect = 6, + kGSUseDevice = 7, + kGSMoan1 = 8, + kGSMoan2 = 9 }; enum { @@ -200,47 +200,6 @@ enum { kGFUnk31 = 31 }; -/* - Game flags - 0 1 With Platypus - 1 2 Mud taken - 2 4 Needle taken - 3 8 Twig taken - 4 0x10 - 5 0x20 Keys taken - 6 0x40 Grass taken - 7 0x80 Barn padlock open - 8 0x100 Truck filled with gas - 9 0x200 Truck keys used - 10 0x400 Platypus disguised - 11 0x800 Scene flag 1 - 12 0x1000 Gnap controls toy ufo - 13 0x2000 - 14 0x4000 - 15 0x8000 Spring taken - 16 0x10000 - 17 0x20000 Joint taken - 18 0x40000 - 19 0x80000 Grocery store hat taken - 20 0x100000 Picture taken - 21 0x200000 - 22 0x400000 - 23 0x800000 - 24 0x1000000 - 25 0x2000000 - 26 0x4000000 Platypus talking with toy shop assistant - 27 0x8000000 - 28 0x10000000 - 29 0x20000000 Gas taken - 30 0x40000000 - 31 0x80000000 -*/ - - // 0x7AB Gnap walks to the right 1 - // 0x7AC Gnap walks to the right 2 - // 0x7AF Gnap walks to the left 1 - // 0x7B0 Gnap walks to the left 2 - struct GnapSavegameHeader { uint8 _version; Common::String _saveName; @@ -263,7 +222,6 @@ private: public: Common::RandomSource *_random; - Common::PEResources *_exe; DatManager *_dat; diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index b0acf8f5bb..f9bc45197a 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -160,7 +160,7 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: gnap._idleFacing = kDirUpLeft; - if (gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + if (gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1)) gnap._actionStatus = kAS01LookSpaceship; break; case GRAB_CURSOR: @@ -183,7 +183,7 @@ void Scene01::run() { gnap.playScratchingHead(Common::Point(3, 3)); break; case GRAB_CURSOR: - gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 3)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 3)) | 0x10000, 1); gnap._actionStatus = kAS01TakeMud; break; case TALK_CURSOR: @@ -203,17 +203,17 @@ void Scene01::run() { switch (_vm->_verbCursor) { case LOOK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(7, 2)) | 0x10000, 1); gnap._actionStatus = kAS01LookPigs; break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(7, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(7, 2)) | 0x10000, 1); gnap._actionStatus = kAS01UsePigs; break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(7, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(7, 2)) | 0x10000, 1); gnap._actionStatus = kAS01LookPigs; break; case PLAT_CURSOR: @@ -510,7 +510,7 @@ void Scene02::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { gnap._idleFacing = kDirUpRight; Common::Point destPos = Common::Point(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1); - gnap.walkTo(destPos, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(destPos, 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[1] + Common::Point(0, 1), 9, 8); @@ -521,14 +521,14 @@ void Scene02::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirBottomRight; - if (gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + if (gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1)) gnap._actionStatus = kAS02GrabChicken; else gnap._actionStatus = -1; break; case TALK_CURSOR: gnap._idleFacing = kDirBottomRight; - gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[1], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS02TalkChicken; break; case PLAT_CURSOR: @@ -543,7 +543,7 @@ void Scene02::run() { case kHS02Truck2: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemKeys) { - if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 2)) | 0x10000, 1)) { _vm->setGrabCursorSprite(-1); _vm->invRemove(kItemKeys); if (_vm->isFlag(kGFTruckFilledWithGas)) @@ -553,7 +553,7 @@ void Scene02::run() { } } else if (_vm->_grabCursorSpriteIndex == kItemGas) { _vm->_hotspots[kHS02WalkArea4]._flags |= SF_WALKABLE; - if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 2)) | 0x10000, 1)) gnap._actionStatus = kAS02UseGasWithTruck; _vm->_hotspots[kHS02WalkArea4]._flags &= ~SF_WALKABLE; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -565,7 +565,7 @@ void Scene02::run() { break; case GRAB_CURSOR: if (_vm->isFlag(kGFTruckKeysUsed)) { - if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 2)) | 0x10000, 1)) { if (_vm->isFlag(kGFTruckFilledWithGas)) gnap._actionStatus = kAS02UseTruckGas; else @@ -573,7 +573,7 @@ void Scene02::run() { } } else { gnap._idleFacing = kDirUnk4; - if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(2, 2)) | 0x10000, 1)) + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 2)) | 0x10000, 1)) gnap._actionStatus = kAS02UseTruckNoKeys; } break; @@ -597,7 +597,7 @@ void Scene02::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS02GrabTruckGrill; break; case TALK_CURSOR: @@ -1028,7 +1028,7 @@ void Scene03::run() { case GRAB_CURSOR: if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags |= SF_WALKABLE; - if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[3] + Common::Point(1, 1)) | 0x10000, 1)) + if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[3] + Common::Point(1, 1)) | 0x10000, 1)) gnap._actionStatus = kAS03GrabCreek; if (!_vm->isFlag(kGFPlatypus)) _vm->_hotspots[kHS03PlatypusWalkArea]._flags &= ~SF_WALKABLE; @@ -1058,7 +1058,7 @@ void Scene03::run() { gnap.walkTo(Common::Point(7, 6), 0, 0x107B5, 1); gnap._actionStatus = kAS03FreePlatypus; } else { - gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) gnap._actionStatus = kAS03GrabScaredPlatypus; else @@ -1070,7 +1070,7 @@ void Scene03::run() { gnap.playBrainPulsating(Common::Point(8, 4)); } else { gnap._idleFacing = kDirBottomRight; - gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[4], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); if (_platypusScared) gnap._actionStatus = kAS03HypnotizeScaredPlat; else @@ -1519,7 +1519,7 @@ void Scene04::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS04GrabAxe; _vm->setFlag(kGFPlatypusTalkingToAssistant); updateHotspots(); @@ -1547,7 +1547,7 @@ void Scene04::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirBottomRight; - if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1)) gnap._actionStatus = kAS04GrabDog; break; case TALK_CURSOR: @@ -1619,7 +1619,7 @@ void Scene04::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - if (gnap.walkTo(_vm->_hotspotsWalkPos[7], 0, gnap.getSequenceId(gskIdle, Common::Point(10, 2)) | 0x10000, 1)) { + if (gnap.walkTo(_vm->_hotspotsWalkPos[7], 0, gnap.getSequenceId(kGSIdle, Common::Point(10, 2)) | 0x10000, 1)) { if (_triedWindow) { gnap._actionStatus = kAS04GetKeyAnother; } else { @@ -1996,7 +1996,7 @@ void Scene05::run() { if (_vm->_grabCursorSpriteIndex == kItemTwig) { gnap._idleFacing = kDirUpRight; Common::Point checkPt = _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1); - gnap.walkTo(checkPt, 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(checkPt, 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS05UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) gnap.playShowCurrItem(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1), 9, 7); @@ -2007,12 +2007,12 @@ void Scene05::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirBottomRight; - gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS05GrabChicken; break; case TALK_CURSOR: gnap._idleFacing = kDirBottomRight; - gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[5], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS05TalkChicken; break; case PLAT_CURSOR: @@ -2034,7 +2034,7 @@ void Scene05::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirBottomLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS05GrabLadder; break; case TALK_CURSOR: @@ -2059,7 +2059,7 @@ void Scene05::run() { } else if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemNeedle) { if (gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, - gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) + gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1)) gnap._actionStatus = kAS05PickPadlock; } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 7, 4); @@ -2070,7 +2070,7 @@ void Scene05::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS05TryPickPadlock; break; case TALK_CURSOR: @@ -2469,11 +2469,11 @@ void Scene06::run() { break; case TALK_CURSOR: if (_horseTurnedBack) { - gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(3, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(3, 2)) | 0x10000, 1); } else { gnap._idleFacing = kDirBottomLeft; _vm->_hotspots[kHS06WalkArea5]._flags |= SF_WALKABLE; - gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; gnap._actionStatus = kAS06TalkToHorse; } @@ -2783,10 +2783,10 @@ void Scene07::run() { gnap.playPullOutDevice(Common::Point(3, 3)); gameSys.setAnimation(0x8E, 1, 2); gameSys.insertSequence(0x8E, 1, 141, 1, kSeqSyncWait, 0, 0, 0); - gameSys.insertSequence(gnap.getSequenceId(gskUseDevice, Common::Point(0, 0)) | 0x10000, gnap._id, + gameSys.insertSequence(gnap.getSequenceId(kGSUseDevice, Common::Point(0, 0)) | 0x10000, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); - gnap._sequenceId = gnap.getSequenceId(gskUseDevice, Common::Point(0, 0)); + gnap._sequenceId = gnap.getSequenceId(kGSUseDevice, Common::Point(0, 0)); gnap._sequenceDatNum = 1; break; case TALK_CURSOR: @@ -3070,7 +3070,7 @@ void Scene08::run() { case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; gnap.actionIdle(0x14D); - gnap.walkTo(Common::Point(8, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(8, 6), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS08TalkMan; break; case PLAT_CURSOR: @@ -3105,7 +3105,7 @@ void Scene08::run() { case TALK_CURSOR: gnap._idleFacing = kDirUpRight; gnap.actionIdle(0x14D); - gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS08TalkDog; break; case PLAT_CURSOR: diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 9d6838ec81..0993cf53c4 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -166,7 +166,7 @@ void Scene10::run() { case TALK_CURSOR: gnap._idleFacing = kDirUpRight; gnap.actionIdle(0x10C); - gnap.walkTo(Common::Point(4, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(4, 8), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS10AnnoyCook; break; case PLAT_CURSOR: @@ -259,7 +259,7 @@ void Scene10::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(10, 5)) | 0x10000); + gnap.playSequence(gnap.getSequenceId(kGSDeflect, Common::Point(10, 5)) | 0x10000); break; case GRAB_CURSOR: gnap.actionIdle(0x10C); @@ -669,7 +669,7 @@ void Scene11::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS11TalkGoggleGuy; break; } @@ -687,7 +687,7 @@ void Scene11::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(3, 6)) | 0x10000); + gnap.playSequence(gnap.getSequenceId(kGSDeflect, Common::Point(3, 6)) | 0x10000); break; case GRAB_CURSOR: gnap.walkTo(Common::Point(5, 6), 0, 0x107BC, 1); @@ -695,7 +695,7 @@ void Scene11::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirBottomLeft; - gnap.walkTo(Common::Point(5, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(5, 6), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS11TalkHookGuy; break; case PLAT_CURSOR: @@ -1085,7 +1085,7 @@ void Scene12::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(3, 7), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS12TalkToothGuy; break; case PLAT_CURSOR: @@ -1122,7 +1122,7 @@ void Scene12::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(Common::Point(6, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(6, 6), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS12TalkBarkeeper; break; case PLAT_CURSOR: @@ -1155,7 +1155,7 @@ void Scene12::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS12TalkBeardGuy; break; case PLAT_CURSOR: @@ -1637,7 +1637,7 @@ void Scene13::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(Common::Point(7, 7), -1, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)), 1); + gnap.walkTo(Common::Point(7, 7), -1, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)), 1); break; case PLAT_CURSOR: gnap.playImpossible(); @@ -1652,7 +1652,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(9, 6))); + gnap.playSequence(gnap.getSequenceId(kGSDeflect, Common::Point(9, 6))); gnap.walkTo(gnap._pos, 0, -1, 1); gnap._actionStatus = kAS13Wait; break; @@ -1674,7 +1674,7 @@ void Scene13::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playSequence(gnap.getSequenceId(gskDeflect, Common::Point(5, 9))); + gnap.playSequence(gnap.getSequenceId(kGSDeflect, Common::Point(5, 9))); gnap.walkTo(gnap._pos, 0, -1, 1); gnap._actionStatus = kAS13Wait; break; @@ -2625,7 +2625,7 @@ void Scene17::run() { case kHS17Phone1: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 1, 3); @@ -2637,7 +2637,7 @@ void Scene17::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk18)) { platHangUpPhone(); - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[2]) | 0x10000, 1); gnap._actionStatus = kAS17GetCoinFromPhone; } else gnap.playImpossible(); @@ -2666,7 +2666,7 @@ void Scene17::run() { case kHS17Phone2: if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemDiceQuarterHole) { - gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS17PutCoinIntoPhone; } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[2], 1, 3); @@ -2680,7 +2680,7 @@ void Scene17::run() { platHangUpPhone(); _vm->_isLeavingScene = true; gnap._idleFacing = kDirUpLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[2], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS17GnapUsePhone; _vm->setFlag(kGFSpringTaken); } else @@ -3520,7 +3520,7 @@ void Scene18::run() { gnap.playScratchingHead(Common::Point(3, 2)); break; case GRAB_CURSOR: - gnap.walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, gnap.getSequenceId(gskPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS18CowboyHat], 0, gnap.getSequenceId(kGSPullOutDeviceNonWorking, Common::Point(3, 2)) | 0x10000, 1); break; case TALK_CURSOR: case PLAT_CURSOR: @@ -3561,7 +3561,7 @@ void Scene18::run() { if (!_vm->isFlag(kGFTruckKeysUsed)) { gnap.walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan] + Common::Point((gnap._pos.x < _vm->_s18GarbageCanPos ? 1 : -1), 0), -1, -1, 1); - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(_vm->_s18GarbageCanPos, gnap._pos.y)) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, Common::Point(_vm->_s18GarbageCanPos, gnap._pos.y)) | 0x10000, 1); gnap._actionStatus = kAS18GrabGarbageCanFromStreet; } else if (!_vm->isFlag(kGFTruckFilledWithGas)) { if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS18GarbageCan], 0, -1, 1)) @@ -3616,7 +3616,7 @@ void Scene18::run() { } } else { if (_vm->_grabCursorSpriteIndex == kItemWrench) { - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 8)) | 0x10000, 1); gnap._actionStatus = kAS18OpenTopValve; } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS18HydrantTopValve], 1, 5); @@ -3658,7 +3658,7 @@ void Scene18::run() { putDownGarbageCan(0); } if (_vm->_grabCursorSpriteIndex == kItemWrench) { - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, Common::Point(2, 8)) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 8)) | 0x10000, 1); if (_vm->isFlag(kGFTruckKeysUsed)) gnap._actionStatus = kAS18OpenRightValveWithGarbageCan; else @@ -4240,7 +4240,7 @@ void Scene19::run() { break; case GRAB_CURSOR: if (!_vm->isFlag(kGFPictureTaken)) { - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot]) | 0x10000, 1); gnap._actionStatus = kAS19GrabPicture; } break; @@ -4264,7 +4264,7 @@ void Scene19::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS19TalkShopAssistant; break; case GRAB_CURSOR: diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index ff315c5df7..81bc8c5920 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -374,7 +374,7 @@ void Scene20::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); if (_stonerGuyShowingJoint) gnap._actionStatus = kAS20GrabJoint; else @@ -382,7 +382,7 @@ void Scene20::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20StonerGuy], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); if (_vm->isFlag(kGFJointTaken)) gnap._actionStatus = kAS20TalkStonerGuyNoJoint; else @@ -408,12 +408,12 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; gnap._idleFacing = kDirUpLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS20GrabGroceryStoreGuy; break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS20TalkGroceryStoreGuy; break; case PLAT_CURSOR: @@ -428,7 +428,7 @@ void Scene20::run() { if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemCowboyHat) { gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS20SwitchGroceryStoreHat; } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(_vm->_hotspotsWalkPos[kHS20GroceryStoreHat], 1, 6); @@ -440,7 +440,7 @@ void Scene20::run() { case GRAB_CURSOR: _stonerGuyShowingJoint = false; gnap._idleFacing = kDirUpLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS20GroceryStoreGuy], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS20GrabGroceryStoreHat; break; case TALK_CURSOR: @@ -629,7 +629,7 @@ void Scene20::updateAnimations() { _vm->showCursor(); _vm->setGrabCursorSprite(kItemGroceryStoreHat); gnap._idleFacing = kDirBottomRight; - gnap.walkTo(Common::Point(3, 8), -1, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(3, 8), -1, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = -1; break; case kAS20GrabJointDone: @@ -830,7 +830,7 @@ void Scene21::run() { gnap.playScratchingHead(Common::Point(2, 5)); break; case GRAB_CURSOR: - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[kHS21Banana]) | 0x10000, 1); gnap.playPullOutDevice(Common::Point(2, 5)); gnap.playUseDevice(); gnap._actionStatus = kAS21GrabBanana; @@ -847,7 +847,7 @@ void Scene21::run() { if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemGroceryStoreHat) { _vm->_newSceneNum = 47; - gnap.walkTo(Common::Point(4, 6), 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(4, 6), 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS21UseHatWithOldLady; } else if (_vm->_grabCursorSpriteIndex >= 0) { gnap.playShowCurrItem(Common::Point(4, 6), 7, 4); @@ -859,13 +859,13 @@ void Scene21::run() { case GRAB_CURSOR: gnap._idleFacing = kDirUpLeft; _vm->_hotspots[kHS21WalkArea1]._flags |= SF_WALKABLE; - gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(7, 6), 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS21GrabOldLady; _vm->_hotspots[kHS21WalkArea1]._flags &= ~SF_WALKABLE; break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS21OldLady], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS21TalkOldLady; break; case PLAT_CURSOR: @@ -1173,7 +1173,7 @@ void Scene22::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS22Cashier], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS22TalkCashier; break; case PLAT_CURSOR: @@ -1375,7 +1375,7 @@ void Scene23::run() { if (_vm->isFlag(kGFSceneFlag1)) gnap.playMoan2(); else { - gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS23LookCereals; } break; @@ -1384,7 +1384,7 @@ void Scene23::run() { gnap.playImpossible(); else { gnap._idleFacing = kDirBottomRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS23Cereals], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); _vm->setFlag(kGFSceneFlag1); gnap._actionStatus = kAS23GrabCereals; _vm->invAdd(kItemCereals); @@ -1651,7 +1651,7 @@ void Scene24::run() { _vm->_isLeavingScene = true; _vm->_newSceneNum = 20; gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS24LeaveScene; plat.walkTo(_vm->_hotspotsWalkPos[kHS24ExitOutsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); } @@ -1889,7 +1889,7 @@ void Scene25::run() { if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTickets) { gnap._actionStatus = kAS25ShowTicketToVendor; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskIdle, Common::Point(9, 4)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(kGSIdle, Common::Point(9, 4)) | 0x10000, 1); gnap.playPullOutDevice(); gnap.playUseDevice(); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1903,7 +1903,7 @@ void Scene25::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS25TicketVendor], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS25TalkTicketVendor; break; case GRAB_CURSOR: @@ -2456,7 +2456,7 @@ void Scene27::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS27Janitor], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS27TalkJanitor; break; case GRAB_CURSOR: @@ -2479,7 +2479,7 @@ void Scene27::run() { break; case GRAB_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS27Bucket]) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[kHS27Bucket]) | 0x10000, 1); gnap._actionStatus = kAS27GrabBucket; break; case TALK_CURSOR: @@ -2827,7 +2827,7 @@ void Scene28::run() { case GRAB_CURSOR: if (_vm->isFlag(kGFUnk21)) { if (!_vm->invHas(kItemHorn)) { - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28Horn]) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[kHS28Horn]) | 0x10000, 1); gnap._actionStatus = kAS28GrabHornSuccess; } } else { @@ -2876,7 +2876,7 @@ void Scene28::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS28TalkClown; break; case GRAB_CURSOR: @@ -2912,7 +2912,7 @@ void Scene28::run() { gnap.playScratchingHead(Common::Point(8, 6)); break; case GRAB_CURSOR: - gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); + gnap.walkTo(gnap._pos, 0, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[kHS28EmptyBucket]) | 0x10000, 1); gnap._actionStatus = kAS28GrabEmptyBucket; break; case TALK_CURSOR: @@ -3213,7 +3213,7 @@ void Scene29::run() { if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemBanana) { gnap._idleFacing = kDirBottomRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS29Monkey], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS29UseBananaWithMonkey; _vm->_newSceneNum = 51; _vm->_isLeavingScene = true; diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 4832ce1dcb..b700d6e2f4 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -419,7 +419,7 @@ void Scene31::run() { if (gnap._actionStatus < 0 || gnap._actionStatus == kAS31PlatMeasuringClown) { if (_vm->_grabCursorSpriteIndex == kItemEmptyBucket && _beerGuyDistracted) { _vm->setGrabCursorSprite(-1); - gnap.walkTo(gnap._pos, -1, gnap.getSequenceId(gskIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); + gnap.walkTo(gnap._pos, -1, gnap.getSequenceId(kGSIdle, _vm->_hotspotsWalkPos[kHS31BeerBarrel]) | 0x10000, 1); _clerkMeasureMaxCtr += 5; gameSys.insertSequence(0xF8, 59, 0, 0, kSeqNone, 0, 0, 0); gnap.playPullOutDevice(Common::Point(6, 8)); @@ -911,14 +911,14 @@ void Scene33::run() { switch (_vm->_verbCursor) { case GRAB_CURSOR: gnap._idleFacing = kDirBottomRight; - if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(gskIdle, Common::Point(0, 0)) | 0x10000, 1)) + if (gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1)) gnap._actionStatus = kAS33UseChicken; else gnap._actionStatus = -1; break; case TALK_CURSOR: gnap._idleFacing = kDirBottomRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS33Chicken], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS33TalkChicken; break; case LOOK_CURSOR: diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index f6cb57c750..3c67dd6f4b 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -418,7 +418,7 @@ void Scene41::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(4, 7), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS41TalkToyVendor; break; case PLAT_CURSOR: @@ -447,7 +447,7 @@ void Scene41::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(Common::Point(7, 7), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(7, 7), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case PLAT_CURSOR: gnap.playImpossible(); @@ -932,7 +932,7 @@ void Scene42::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS42BBQVendor], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS42TalkBBQVendor; break; case GRAB_CURSOR: @@ -1388,7 +1388,7 @@ void Scene43::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(Common::Point(5, 8), 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = 2; break; case GRAB_CURSOR: @@ -1842,7 +1842,7 @@ void Scene44::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44KissingLady], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = 1; break; case PLAT_CURSOR: @@ -1896,7 +1896,7 @@ void Scene44::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS44SpringGuy], -1, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); break; case GRAB_CURSOR: case PLAT_CURSOR: @@ -2637,7 +2637,7 @@ void Scene46::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpLeft; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS46SackGuy], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = 2; break; case GRAB_CURSOR: @@ -2658,7 +2658,7 @@ void Scene46::run() { break; case TALK_CURSOR: gnap._idleFacing = kDirUpRight; - gnap.walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, gnap.getSequenceId(gskBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); + gnap.walkTo(_vm->_hotspotsWalkPos[kHS46ItchyGuy], 0, gnap.getSequenceId(kGSBrainPulsating, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = 1; break; case GRAB_CURSOR: -- cgit v1.2.3 From 2aaebf0ae984db39a96b3fc399be952479c01d52 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 10 May 2016 21:23:15 +0200 Subject: GNAP: Use enum values for _sceneClickedHotspot in scene 53 --- engines/gnap/scenes/group0.cpp | 1 - engines/gnap/scenes/group5.cpp | 28 ++++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index f9bc45197a..1b82faccfb 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -115,7 +115,6 @@ void Scene01::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case kHS01Device: if (gnap._actionStatus < 0) { _vm->runMenu(); diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 3f21752e2a..2788a43ac1 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -292,22 +292,22 @@ void Scene53::run() { _vm->updateGrabCursorSprite(0, 0); switch (_vm->_sceneClickedHotspot) { - case 1: + case kHS53Device: if (gnap._actionStatus < 0) { _vm->runMenu(); updateHotspots(); } break; - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: + case kHS53PhoneKey1: + case kHS53PhoneKey2: + case kHS53PhoneKey3: + case kHS53PhoneKey4: + case kHS53PhoneKey5: + case kHS53PhoneKey6: + case kHS53PhoneKey7: + case kHS53PhoneKey8: + case kHS53PhoneKey9: + case kHS53PhoneKey0: _vm->stopSound(0xA0); ++phoneNumberLen; phoneNumber = pressPhoneNumberButton(phoneNumber, _vm->_sceneClickedHotspot - 1); @@ -349,11 +349,11 @@ void Scene53::run() { } } break; - case 12: - case 13: + case kHS53PhoneKeySharp: + case kHS53PhoneKeyStar: pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1); break; - case 14: + case kHS53PhoneExit: if (gnap._actionStatus < 0) { gnap._actionStatus = 1; if (_vm->isFlag(kGFSpringTaken)) { -- cgit v1.2.3 From f467db5ed23cdaa96fb0601ae1b05853f44e3356 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 May 2016 00:32:31 +0200 Subject: GNAP: Add music when game is paused --- engines/gnap/gnap.cpp | 21 +++++++++- engines/gnap/gnap.h | 9 ++++- engines/gnap/menu.cpp | 1 + engines/gnap/module.mk | 1 + engines/gnap/music.cpp | 108 +++++++++++++++++++++++++++++++++++++++++++++++++ engines/gnap/music.h | 50 +++++++++++++++++++++++ 6 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 engines/gnap/music.cpp create mode 100644 engines/gnap/music.h diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 518dda26d2..24de6ea40d 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -99,10 +99,12 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : Engine::syncSoundSettings(); _scene = nullptr; + _music = nullptr; } GnapEngine::~GnapEngine() { delete _random; + delete _music; } Common::Error GnapEngine::run() { @@ -263,7 +265,7 @@ void GnapEngine::pauseGame() { _gameSys->insertSpriteDrawItem(_pauseSprite, (800 - _pauseSprite->w) / 2, (600 - _pauseSprite->h) / 2, 356); _lastUpdateClock = 0; gameUpdateTick(); - // TODO playMidi("pause.mid"); + playMidi("pause.mid"); _isPaused = true; } } @@ -275,7 +277,7 @@ void GnapEngine::resumeGame() { _lastUpdateClock = 0; gameUpdateTick(); deleteSurface(&_pauseSprite); - // TODO stopMidi(); + stopMidi(); _isPaused = false; clearAllKeyStatus1(); _mouseClickState._left = false; @@ -1128,4 +1130,19 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, } } +void GnapEngine::playMidi(const char *name) { + if (_music) + return; + + _music = new MusicPlayer(name); + _music->playSMF(true); +} + +void GnapEngine::stopMidi() { + if (_music) { + _music->stop(); + delete _music; + _music = nullptr; + } +} } // End of namespace Gnap diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index c7273077a4..2119ad6cac 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -43,6 +43,7 @@ #include "gnap/resource.h" #include "gnap/scenes/scenecore.h" #include "gnap/character.h" +#include "gnap/music.h" struct ADGameDescription; @@ -53,6 +54,7 @@ class SequenceResource; class SpriteResource; class GameSys; class SoundMan; +class MusicPlayer; #define GNAP_SAVEGAME_VERSION 1 @@ -78,7 +80,8 @@ struct Hotspot { const int kMaxTimers = 10; enum GnapDebugChannels { - kDebugBasic = 1 << 0 + kDebugBasic = 1 << 0, + kDebugMusic = 1 << 1 }; enum { @@ -234,6 +237,7 @@ public: Scene *_scene; PlayerGnap *_gnap; PlayerPlat *_plat; + MusicPlayer *_music; int _lastUpdateClock; @@ -453,6 +457,9 @@ public: int toyUfoGetSequenceId(); bool toyUfoCheckTimer(); void toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, int maxY, int animationIndex); + + void playMidi(const char *name); + void stopMidi(); }; } // End of namespace Gnap diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 89d14eb4b1..1ce2751a27 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -496,6 +496,7 @@ void GnapEngine::updateMenuStatusMainMenu() { playMidi("pause.mid", 0); } */ + warning("TODO: playMidi"); } else if (i == 1) { _gameSys->drawSpriteToSurface(_largeSprite, 0, 0, 0x1078E); _gameSys->insertDirtyRect(dirtyRect); diff --git a/engines/gnap/module.mk b/engines/gnap/module.mk index 5305299cd2..ab507cbf94 100644 --- a/engines/gnap/module.mk +++ b/engines/gnap/module.mk @@ -9,6 +9,7 @@ MODULE_OBJS := \ gnap.o \ grid.o \ menu.o \ + music.o \ resource.o \ sound.o \ scenes/arcade.o \ diff --git a/engines/gnap/music.cpp b/engines/gnap/music.cpp new file mode 100644 index 0000000000..b42f6e9b91 --- /dev/null +++ b/engines/gnap/music.cpp @@ -0,0 +1,108 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// MIDI and digital music class + +#include "audio/mididrv.h" +#include "audio/midiparser.h" +#include "common/debug.h" +#include "common/file.h" + +#include "gnap/music.h" +#include "gnap/gnap.h" + +namespace Gnap { + +MusicPlayer::MusicPlayer(const char *filename) : _filename(filename) { + + MidiPlayer::createDriver(); + + int ret = _driver->open(); + if (ret == 0) { + if (_nativeMT32) + _driver->sendMT32Reset(); + else + _driver->sendGMReset(); + + // TODO: Load cmf.ins with the instrument table. It seems that an + // interface for such an operation is supported for AdLib. Maybe for + // this card, setting instruments is necessary. + + _driver->setTimerCallback(this, &timerCallback); + } +} + +void MusicPlayer::sendToChannel(byte channel, uint32 b) { + if (!_channelsTable[channel]) { + _channelsTable[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel(); + // If a new channel is allocated during the playback, make sure + // its volume is correctly initialized. + if (_channelsTable[channel]) + _channelsTable[channel]->volume(_channelsVolume[channel] * _masterVolume / 255); + } + + if (_channelsTable[channel]) + _channelsTable[channel]->send(b); +} + +void MusicPlayer::playSMF(bool loop) { + Common::StackLock lock(_mutex); + + stop(); + + // Load MIDI resource data + Common::File musicFile; + musicFile.open(_filename); + if (!musicFile.isOpen()) { + debugC(2, kDebugMusic, "Cannot open music file %s", _filename); + return; + } + int midiMusicSize = musicFile.size(); + free(_midiData); + _midiData = (byte *)malloc(midiMusicSize); + musicFile.read(_midiData, midiMusicSize); + musicFile.close(); + + MidiParser *parser = MidiParser::createParser_SMF(); + if (parser->loadMusic(_midiData, midiMusicSize)) { + parser->setTrack(0); + parser->setMidiDriver(this); + parser->setTimerRate(_driver->getBaseTempo()); + parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1); + + _parser = parser; + + syncVolume(); + + _isLooping = loop; + _isPlaying = true; + } else { + debugC(2, kDebugMusic, "Cannot play music file %s", _filename); + delete parser; + } +} + +void MusicPlayer::stop() { + Audio::MidiPlayer::stop(); +} + +} // End of namespace Gnap diff --git a/engines/gnap/music.h b/engines/gnap/music.h new file mode 100644 index 0000000000..c5938937eb --- /dev/null +++ b/engines/gnap/music.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// Music class + +#ifndef GNAP_MUSIC_H +#define GNAP_MUSIC_H + +#include "audio/midiplayer.h" + +namespace Gnap { + +// Taken from Draci, which took it from MADE, which took it from SAGA. + +class MusicPlayer : public Audio::MidiPlayer { +public: + MusicPlayer(const char *filename); + + void playSMF(bool loop); + void stop(); + + // Overload Audio::MidiPlayer method + virtual void sendToChannel(byte channel, uint32 b); + +protected: + Common::String _filename; +}; + +} // End of namespace Gnap + +#endif -- cgit v1.2.3 From af1cf151de9ffc9d040a4e52b57fe3dfd754969b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 May 2016 07:53:06 +0200 Subject: GNAP: Use Common::Rect for hotspots --- engines/gnap/gnap.cpp | 28 ++++---- engines/gnap/gnap.h | 14 ++-- engines/gnap/grid.cpp | 9 +-- engines/gnap/menu.cpp | 141 ++++++++++------------------------------- engines/gnap/scenes/group1.cpp | 28 ++++---- engines/gnap/scenes/group2.cpp | 4 +- engines/gnap/scenes/group4.cpp | 8 +-- 7 files changed, 73 insertions(+), 159 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 24de6ea40d..d9c0971d8c 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -324,26 +324,24 @@ void GnapEngine::delayTicksCursor(int a1) { void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags, int16 walkX, int16 walkY) { - _hotspots[index]._x1 = x1; - _hotspots[index]._y1 = y1; - _hotspots[index]._x2 = x2; - _hotspots[index]._y2 = y2; + _hotspots[index]._rect = Common::Rect(x1, y1, x2, y2); _hotspots[index]._flags = flags; _hotspots[index]._id = index; _hotspotsWalkPos[index].x = walkX; _hotspotsWalkPos[index].y = walkY; } -int GnapEngine::getHotspotIndexAtPos(int16 x, int16 y) { - for (int i = 0; i < _hotspotsCount; ++i) - if (!_hotspots[i].isFlag(SF_DISABLED) && _hotspots[i].isPointInside(x, y)) +int GnapEngine::getHotspotIndexAtPos(Common::Point pos) { + for (int i = 0; i < _hotspotsCount; ++i) { + if (!_hotspots[i].isFlag(SF_DISABLED) && _hotspots[i].isPointInside(pos)) return i; + } return -1; } void GnapEngine::updateCursorByHotspot() { if (!_isWaiting) { - int hotspotIndex = getHotspotIndexAtPos(_mouseX, _mouseY); + int hotspotIndex = getHotspotIndexAtPos(Common::Point(_mouseX, _mouseY)); if (_debugger->_showHotspotNumber) { // NOTE This causes some display glitches so don't worry @@ -377,10 +375,8 @@ void GnapEngine::updateCursorByHotspot() { setCursor(kDisabledCursors[_verbCursor]); } // Update platypus hotspot - _hotspots[0]._x1 = _gridMinX + 75 * _plat->_pos.x - 30; - _hotspots[0]._y1 = _gridMinY + 48 * _plat->_pos.y - 100; - _hotspots[0]._x2 = _gridMinX + 75 * _plat->_pos.x + 30; - _hotspots[0]._y2 = _gridMinY + 48 * _plat->_pos.y; + _hotspots[0]._rect = Common::Rect(_gridMinX + 75 * _plat->_pos.x - 30, _gridMinY + 48 * _plat->_pos.y - 100 + , _gridMinX + 75 * _plat->_pos.x + 30, _gridMinY + 48 * _plat->_pos.y); } int GnapEngine::getClickedHotspotId() { @@ -388,7 +384,7 @@ int GnapEngine::getClickedHotspotId() { if (_isWaiting) _mouseClickState._left = false; else if (_mouseClickState._left) { - int hotspotIndex = getHotspotIndexAtPos(_leftClickMouseX, _leftClickMouseY); + int hotspotIndex = getHotspotIndexAtPos(Common::Point(_leftClickMouseX, _leftClickMouseY)); if (hotspotIndex >= 0) { _mouseClickState._left = false; _timers[3] = 300; @@ -578,10 +574,8 @@ void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int _deviceY1 = 14; if (y2 == -1) _deviceY2 = 79; - _hotspots[hotspotIndex]._x1 = _deviceX1; - _hotspots[hotspotIndex]._y1 = _deviceY1; - _hotspots[hotspotIndex]._x2 = _deviceX2; - _hotspots[hotspotIndex]._y2 = _deviceY2; + + _hotspots[hotspotIndex]._rect = Common::Rect(_deviceX1, _deviceY1, _deviceX2, _deviceY2); _hotspots[hotspotIndex]._flags = SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _hotspots[hotspotIndex]._id = hotspotIndex; } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 2119ad6cac..45ac584a26 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -66,15 +66,21 @@ struct MouseButtonState { }; struct Hotspot { - int16 _x1, _y1, _x2, _y2; + Common::Rect _rect; uint16 _flags; int _id; - bool isPointInside(int16 x, int16 y) const { - return x >= _x1 && x <= _x2 && y >= _y1 && y <= _y2; + + bool isPointInside(Common::Point pos) const { + return _rect.contains(pos); } + bool isFlag(uint16 flag) const { return (_flags & flag) != 0; } + + void clearRect() { + _rect = Common::Rect(0, 0, 0, 0); + } }; const int kMaxTimers = 10; @@ -319,7 +325,7 @@ public: void setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags = 0, int16 walkX = -1, int16 walkY = -1); - int getHotspotIndexAtPos(int16 x, int16 y); + int getHotspotIndexAtPos(Common::Point pos); void updateCursorByHotspot(); int getClickedHotspotId(); diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 076705cd03..a89c87c61d 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -47,16 +47,13 @@ bool GnapEngine::isPointBlocked(int gridX, int gridY) { if (gridX < 0 || gridX >= _gridMaxX || gridY < 0 || gridY >= _gridMaxY) return true; - if ((_gnap->_pos == Common::Point(gridX, gridY)) || (gridX == _plat->_pos.x && gridY == _plat->_pos.y)) + if ((_gnap->_pos == Common::Point(gridX, gridY)) || (_plat->_pos == Common::Point(gridX, gridY))) return true; - const int x = _gridMinX + 75 * gridX; - const int y = _gridMinY + 48 * gridY; + Common::Point pos = Common::Point(_gridMinX + 75 * gridX, _gridMinY + 48 * gridY); for (int i = 0; i < _hotspotsCount; ++i) { - if (x >= _hotspots[i]._x1 && x <= _hotspots[i]._x2 && - y >= _hotspots[i]._y1 && y <= _hotspots[i]._y2 && - !(_hotspots[i]._flags & SF_WALKABLE)) + if (_hotspots[i].isPointInside(pos) && !(_hotspots[i]._flags & SF_WALKABLE)) return true; } diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 1ce2751a27..78bffefa1e 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -48,36 +48,24 @@ void GnapEngine::initMenuHotspots1() { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { - _hotspots[curId]._x1 = 87 * j + 262; - _hotspots[curId]._y1 = 74 * i + 69; - _hotspots[curId]._x2 = _hotspots[curId]._x1 + 79; - _hotspots[curId]._y2 = _hotspots[curId]._y1 + 66; + _hotspots[curId]._rect = Common::Rect(87 * j + 262, 74 * i + 69, _hotspots[curId]._rect.left + 79, _hotspots[curId]._rect.top + 66); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; } } - _hotspots[curId]._x1 = 330; - _hotspots[curId]._y1 = 350; - _hotspots[curId]._x2 = 430; - _hotspots[curId]._y2 = 460; + _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 180; - _hotspots[curId]._y1 = 15; - _hotspots[curId]._x2 = 620; - _hotspots[curId]._y2 = 580; + _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 0; - _hotspots[curId]._y1 = 0; - _hotspots[curId]._x2 = 799; - _hotspots[curId]._y2 = 599; + _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; @@ -88,43 +76,28 @@ void GnapEngine::initMenuHotspots2() { int curId = 0; for (int i = 0; i < 4; ++i) { - _hotspots[curId]._x1 = 312; - _hotspots[curId]._y1 = 48 * i + 85; - _hotspots[curId]._x2 = _hotspots[curId]._x1 + 153; - _hotspots[curId]._y2 = _hotspots[curId]._y1 + 37; + _hotspots[curId]._rect = Common::Rect(312, 48 * i + 85, _hotspots[curId]._rect.left + 153, _hotspots[curId]._rect.top + 37); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; } - _hotspots[curId]._x1 = 500; - _hotspots[curId]._y1 = 72; - _hotspots[curId]._x2 = 527; - _hotspots[curId]._y2 = 99; + _hotspots[curId]._rect = Common::Rect(500, 72, 527, 99); _hotspots[curId]._flags = SF_DISABLED; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 330; - _hotspots[curId]._y1 = 350; - _hotspots[curId]._x2 = 430; - _hotspots[curId]._y2 = 460; + _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 180; - _hotspots[curId]._y1 = 15; - _hotspots[curId]._x2 = 620; - _hotspots[curId]._y2 = 580; + _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 0; - _hotspots[curId]._y1 = 0; - _hotspots[curId]._x2 = 799; - _hotspots[curId]._y2 = 599; + _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; @@ -132,38 +105,23 @@ void GnapEngine::initMenuHotspots2() { } void GnapEngine::initMenuQuitQueryHotspots() { - _hotspots[0]._x1 = 311; - _hotspots[0]._y1 = 197; - _hotspots[0]._x2 = 377; - _hotspots[0]._y2 = 237; + _hotspots[0]._rect = Common::Rect(311, 197, 377, 237); _hotspots[0]._flags = SF_GRAB_CURSOR; _hotspots[0]._id = 0; - _hotspots[1]._x1 = 403; - _hotspots[1]._y1 = 197; - _hotspots[1]._x2 = 469; - _hotspots[1]._y2 = 237; + _hotspots[1]._rect = Common::Rect(403, 197, 469, 237); _hotspots[1]._flags = SF_GRAB_CURSOR; _hotspots[1]._id = 1; - _hotspots[2]._x1 = 330; - _hotspots[2]._y1 = 350; - _hotspots[2]._x2 = 430; - _hotspots[2]._y2 = 460; + _hotspots[2]._rect = Common::Rect(330, 350, 430, 460); _hotspots[2]._flags = SF_GRAB_CURSOR; _hotspots[2]._id = 2; - _hotspots[3]._x1 = 180; - _hotspots[3]._y1 = 15; - _hotspots[3]._x2 = 620; - _hotspots[3]._y2 = 580; + _hotspots[3]._rect = Common::Rect(180, 15, 620, 580); _hotspots[3]._flags = SF_NONE; _hotspots[3]._id = 3; - _hotspots[4]._x1 = 0; - _hotspots[4]._y1 = 0; - _hotspots[4]._x2 = 799; - _hotspots[4]._y2 = 599; + _hotspots[4]._rect = Common::Rect(0, 0, 799, 599); _hotspots[4]._flags = SF_NONE; _hotspots[4]._id = 4; @@ -174,53 +132,35 @@ void GnapEngine::initSaveLoadHotspots() { int curId = 0; for (int i = 0; i < 7; ++i ) { - _hotspots[curId]._x1 = 288; - _hotspots[curId]._y1 = 31 * i + 74; - _hotspots[curId]._x2 = _hotspots[curId]._x1 + 91; - _hotspots[curId]._y2 = _hotspots[curId]._y1 + 22; + _hotspots[curId]._rect = Common::Rect(288, 31 * i + 74, _hotspots[curId]._rect.left + 91, _hotspots[curId]._rect.top + 22); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; } if (_menuStatus == 2) { - _hotspots[curId]._x1 = 416; - _hotspots[curId]._y1 = 160; - _hotspots[curId]._x2 = 499; - _hotspots[curId]._y2 = 188; + _hotspots[curId]._rect = Common::Rect(416, 160, 499, 188); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; } - _hotspots[curId]._x1 = 416; - _hotspots[curId]._y1 = 213; - _hotspots[curId]._x2 = 499; - _hotspots[curId]._y2 = 241; + _hotspots[curId]._rect = Common::Rect(416, 213, 499, 241); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 330; - _hotspots[curId]._y1 = 350; - _hotspots[curId]._x2 = 430; - _hotspots[curId]._y2 = 460; + _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 180; - _hotspots[curId]._y1 = 15; - _hotspots[curId]._x2 = 620; - _hotspots[curId]._y2 = 580; + _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; ++curId; - _hotspots[curId]._x1 = 0; - _hotspots[curId]._y1 = 0; - _hotspots[curId]._x2 = 799; - _hotspots[curId]._y2 = 599; + _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; _hotspots[curId]._id = curId; @@ -229,7 +169,7 @@ void GnapEngine::initSaveLoadHotspots() { void GnapEngine::drawInventoryFrames() { for (int i = 0; i < 9; ++i) - _gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i]._x1 - 93, _hotspots[i]._y1, 0x10001); + _gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i]._rect.left - 93, _hotspots[i]._rect.top, 0x10001); } void GnapEngine::insertInventorySprites() { @@ -244,13 +184,13 @@ void GnapEngine::insertInventorySprites() { for (int index = 0; index < 30 && _menuSpritesIndex < 9; ++index) { if (invHas(index)) { _gameSys->drawSpriteToSurface(_menuBackgroundSurface, - _hotspots[_menuSpritesIndex]._x1 - 93, _hotspots[_menuSpritesIndex]._y1, 0x10000); + _hotspots[_menuSpritesIndex]._rect.left - 93, _hotspots[_menuSpritesIndex]._rect.top, 0x10000); _menuInventorySprites[_menuSpritesIndex] = _gameSys->createSurface(getInventoryItemSpriteNum(index) | 0x10000); if (index != _grabCursorSpriteIndex) { _menuInventoryIndices[_menuSpritesIndex] = index; _gameSys->insertSpriteDrawItem(_menuInventorySprites[_menuSpritesIndex], - _hotspots[_menuSpritesIndex]._x1 + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2), - _hotspots[_menuSpritesIndex]._y1 + ((66 - _menuInventorySprites[_menuSpritesIndex]->h) / 2), + _hotspots[_menuSpritesIndex]._rect.left + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2), + _hotspots[_menuSpritesIndex]._rect.top + ((66 - _menuInventorySprites[_menuSpritesIndex]->h) / 2), 261); } _hotspots[_menuSpritesIndex]._flags = SF_GRAB_CURSOR; @@ -390,10 +330,7 @@ void GnapEngine::updateMenuStatusInventory() { }; updateGrabCursorSprite(0, 0); - _hotspots[0]._x1 = 262; - _hotspots[0]._y1 = 69; - _hotspots[0]._x2 = 341; - _hotspots[0]._y2 = 135; + _hotspots[0]._rect = Common::Rect(262, 69, 341, 135); _sceneClickedHotspot = -1; if (_timers[2] == 0) _sceneClickedHotspot = getClickedHotspotId(); @@ -403,7 +340,7 @@ void GnapEngine::updateMenuStatusInventory() { _timers[2] = 10; playSound(0x108F4, false); _menuStatus = 1; - Common::Rect dirtyRect(_hotspots[0]._x1, _hotspots[0]._y1, _hotspots[2]._x2, _hotspots[_hotspotsCount - 4]._y2); + Common::Rect dirtyRect(_hotspots[0]._rect.left, _hotspots[0]._rect.top, _hotspots[2]._rect.right, _hotspots[_hotspotsCount - 4]._rect.bottom); drawInventoryFrames(); initMenuHotspots2(); removeInventorySprites(); @@ -426,8 +363,8 @@ void GnapEngine::updateMenuStatusInventory() { } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] == -1 && _grabCursorSpriteIndex != -1) { _menuInventoryIndices[_sceneClickedHotspot] = _grabCursorSpriteIndex; _gameSys->insertSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], - _hotspots[_sceneClickedHotspot]._x1 + ((79 - _menuInventorySprites[_sceneClickedHotspot]->w) / 2), - _hotspots[_sceneClickedHotspot]._y1 + (66 - _menuInventorySprites[_sceneClickedHotspot]->h) / 2, + _hotspots[_sceneClickedHotspot]._rect.left + ((79 - _menuInventorySprites[_sceneClickedHotspot]->w) / 2), + _hotspots[_sceneClickedHotspot]._rect.top + (66 - _menuInventorySprites[_sceneClickedHotspot]->h) / 2, 261); setGrabCursorSprite(-1); } else if (_sceneClickedHotspot != -1 && _menuInventoryIndices[_sceneClickedHotspot] != -1 && _grabCursorSpriteIndex != -1) { @@ -446,7 +383,7 @@ void GnapEngine::updateMenuStatusInventory() { playSound(0x108AE, false); deleteSurface(&_spriteHandle); // CHECKME _spriteHandle = _gameSys->createSurface(0x10001); - _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1]._x1, _hotspots[_menuSpritesIndex - 1]._y1, 261); + _gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1]._rect.left, _hotspots[_menuSpritesIndex - 1]._rect.top, 261); setGrabCursorSprite(kCombineItems[combineIndex].resultItem); removeInventorySprites(); insertInventorySprites(); @@ -458,10 +395,7 @@ void GnapEngine::updateMenuStatusInventory() { } void GnapEngine::updateMenuStatusMainMenu() { - _hotspots[0]._x1 = 312; - _hotspots[0]._y1 = 85; - _hotspots[0]._x2 = 465; - _hotspots[0]._y2 = 122; + _hotspots[0]._rect = Common::Rect(312, 85, 465, 122); _sceneClickedHotspot = -1; if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); @@ -533,7 +467,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (_menuSprite1) _gameSys->removeSpriteDrawItem(_menuSprite1, 262); insertInventorySprites(); - Common::Rect dirtyRect(_hotspots[0]._x1, _hotspots[0]._y1, _hotspots[2]._x2, _hotspots[_hotspotsCount - 4]._y2); + Common::Rect dirtyRect(_hotspots[0]._rect.left, _hotspots[0]._rect.top, _hotspots[2]._rect.right, _hotspots[_hotspotsCount - 4]._rect.bottom); _gameSys->insertDirtyRect(dirtyRect); } } else { @@ -601,7 +535,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (readSavegameDescription(i + 1, savegameDescription) == 0) strncpy(_savegameFilenames[i], savegameDescription.c_str(), 40); _gameSys->drawTextToSurface(_savegameSprites[i], 0, 0, 255, 0, 0, _savegameFilenames[i]); - _gameSys->insertSpriteDrawItem(_savegameSprites[i], 288, _hotspots[i]._y1, 263); + _gameSys->insertSpriteDrawItem(_savegameSprites[i], 288, _hotspots[i].top, 263); } _savegameIndex = -1; } @@ -890,10 +824,7 @@ void GnapEngine::updateMenuStatusSaveGame() { } void GnapEngine::updateMenuStatusLoadGame() { - _hotspots[0]._x1 = 288; - _hotspots[0]._y1 = 74; - _hotspots[0]._x2 = 379; - _hotspots[0]._y2 = 96; + _hotspots[0]._rect = Common::Rect(288, 74, 379, 96); _sceneClickedHotspot = -1; if (!_timers[2]) _sceneClickedHotspot = getClickedHotspotId(); @@ -922,11 +853,7 @@ void GnapEngine::updateMenuStatusLoadGame() { } void GnapEngine::updateMenuStatusQueryQuit() { - _hotspots[0]._x1 = 311; - _hotspots[0]._y1 = 197; - _hotspots[0]._x2 = 377; - _hotspots[0]._y2 = 237; - + _hotspots[0]._rect = Common::Rect(311, 197, 377, 237); _sceneClickedHotspot = -1; if (!_timers[2]) diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 0993cf53c4..7aa5d9efdd 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -2068,10 +2068,7 @@ void Scene15::run() { _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); - _vm->_hotspots[kHS15Platypus]._x1 = 0; - _vm->_hotspots[kHS15Platypus]._y1 = 0; - _vm->_hotspots[kHS15Platypus]._x2 = 0; - _vm->_hotspots[kHS15Platypus]._y2 = 0; + _vm->_hotspots[kHS15Platypus].clearRect(); _vm->_sceneClickedHotspot = _vm->getClickedHotspotId(); _vm->updateGrabCursorSprite(0, 0); @@ -3147,23 +3144,20 @@ void Scene18::updateHotspots() { if (_vm->isFlag(kGFTruckFilledWithGas)) { if (_vm->isFlag(kGFTruckKeysUsed)) { _vm->_hotspots[kHS18HydrantTopValve]._flags = SF_DISABLED; - _vm->_hotspots[kHS18HydrantRightValve]._x1 = 148; - _vm->_hotspots[kHS18HydrantRightValve]._y1 = 403; + _vm->_hotspots[kHS18HydrantRightValve]._rect.left = 148; + _vm->_hotspots[kHS18HydrantRightValve]._rect.top = 403; _vm->_hotspots[kHS18GarbageCan]._flags = SF_DISABLED; _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; } else { - _vm->_hotspots[kHS18HydrantTopValve]._y1 = 246; + _vm->_hotspots[kHS18HydrantTopValve]._rect.top = 246; } } else if (_vm->isFlag(kGFBarnPadlockOpen)) { _vm->_hotspots[kHS18HydrantRightValve]._flags = SF_DISABLED; - _vm->_hotspots[kHS18HydrantTopValve]._x1 = 105; - _vm->_hotspots[kHS18HydrantTopValve]._x2 = 192; + _vm->_hotspots[kHS18HydrantTopValve]._rect.left = 105; + _vm->_hotspots[kHS18HydrantTopValve]._rect.right = 192; } else if (_vm->isFlag(kGFTruckKeysUsed)) { - _vm->_hotspots[kHS18GarbageCan]._x1 = 115; - _vm->_hotspots[kHS18GarbageCan]._y1 = 365; - _vm->_hotspots[kHS18GarbageCan]._x2 = 168; - _vm->_hotspots[kHS18GarbageCan]._y2 = 470; + _vm->_hotspots[kHS18GarbageCan]._rect = Common::Rect(115, 365, 168, 470); _vm->_hotspots[kHS18GarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; @@ -3794,11 +3788,11 @@ void Scene18::run() { _vm->clearFlag(kGFPlatypusTalkingToAssistant); } } else { - _vm->_hotspots[kHS18WalkArea1]._y2 += 48; - _vm->_hotspots[kHS18WalkArea2]._x1 += 75; + _vm->_hotspots[kHS18WalkArea1]._rect.bottom += 48; + _vm->_hotspots[kHS18WalkArea2]._rect.left += 75; plat.updateIdleSequence(); - _vm->_hotspots[kHS18WalkArea2]._x1 -= 75; - _vm->_hotspots[kHS18WalkArea1]._y2 -= 48; + _vm->_hotspots[kHS18WalkArea2]._rect.left -= 75; + _vm->_hotspots[kHS18WalkArea1]._rect.bottom -= 48; } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(100) + 100; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 81bc8c5920..380bb0ba67 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -473,9 +473,9 @@ void Scene20::run() { if (!_vm->_isLeavingScene) { if (plat._actionStatus < 0) { - _vm->_hotspots[kHS20WalkArea1]._y2 += 48; + _vm->_hotspots[kHS20WalkArea1]._rect.bottom += 48; plat.updateIdleSequence(); - _vm->_hotspots[kHS20WalkArea1]._y2 -= 48; + _vm->_hotspots[kHS20WalkArea1]._rect.bottom -= 48; } if (gnap._actionStatus < 0) gnap.updateIdleSequence(); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 3c67dd6f4b..810e4bfdfc 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -303,12 +303,8 @@ void Scene41::run() { if (!_vm->isSoundPlaying(0x1094B)) _vm->playSound(0x1094B, true); - if (!_vm->isFlag(kGFGnapControlsToyUFO)) { - _vm->_hotspots[kHS41ToyUfo]._x1 = _vm->_toyUfoX - 25; - _vm->_hotspots[kHS41ToyUfo]._y1 = _vm->_toyUfoY - 20; - _vm->_hotspots[kHS41ToyUfo]._x2 = _vm->_toyUfoX + 25; - _vm->_hotspots[kHS41ToyUfo]._y2 = _vm->_toyUfoY + 20; - } + if (!_vm->isFlag(kGFGnapControlsToyUFO)) + _vm->_hotspots[kHS41ToyUfo]._rect = Common::Rect(_vm->_toyUfoX - 25, _vm->_toyUfoY - 20, _vm->_toyUfoX + 25, _vm->_toyUfoY + 20); _vm->updateMouseCursor(); _vm->updateCursorByHotspot(); -- cgit v1.2.3 From 9c0808237c3c4cb8a93a31cad8bf939396415fd1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 May 2016 07:59:20 +0200 Subject: GNAP: Remove _id from HotSpot structure --- engines/gnap/gnap.cpp | 4 +--- engines/gnap/gnap.h | 1 - engines/gnap/menu.cpp | 20 -------------------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index d9c0971d8c..3b5d1496e0 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -326,7 +326,6 @@ void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, u int16 walkX, int16 walkY) { _hotspots[index]._rect = Common::Rect(x1, y1, x2, y2); _hotspots[index]._flags = flags; - _hotspots[index]._id = index; _hotspotsWalkPos[index].x = walkX; _hotspotsWalkPos[index].y = walkY; } @@ -388,7 +387,7 @@ int GnapEngine::getClickedHotspotId() { if (hotspotIndex >= 0) { _mouseClickState._left = false; _timers[3] = 300; - result = _hotspots[hotspotIndex]._id; + result = hotspotIndex; } } return result; @@ -577,7 +576,6 @@ void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int _hotspots[hotspotIndex]._rect = Common::Rect(_deviceX1, _deviceY1, _deviceX2, _deviceY2); _hotspots[hotspotIndex]._flags = SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _hotspots[hotspotIndex]._id = hotspotIndex; } int GnapEngine::getSequenceTotalDuration(int resourceId) { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 45ac584a26..d379a263b9 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -68,7 +68,6 @@ struct MouseButtonState { struct Hotspot { Common::Rect _rect; uint16 _flags; - int _id; bool isPointInside(Common::Point pos) const { return _rect.contains(pos); diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 78bffefa1e..21ea8d4a67 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -50,24 +50,20 @@ void GnapEngine::initMenuHotspots1() { for (int j = 0; j < 3; ++j) { _hotspots[curId]._rect = Common::Rect(87 * j + 262, 74 * i + 69, _hotspots[curId]._rect.left + 79, _hotspots[curId]._rect.top + 66); _hotspots[curId]._flags = SF_NONE; - _hotspots[curId]._id = curId; ++curId; } } _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; - _hotspots[curId]._id = curId; _hotspotsCount = curId + 1; } @@ -78,28 +74,23 @@ void GnapEngine::initMenuHotspots2() { for (int i = 0; i < 4; ++i) { _hotspots[curId]._rect = Common::Rect(312, 48 * i + 85, _hotspots[curId]._rect.left + 153, _hotspots[curId]._rect.top + 37); _hotspots[curId]._flags = SF_GRAB_CURSOR; - _hotspots[curId]._id = curId; ++curId; } _hotspots[curId]._rect = Common::Rect(500, 72, 527, 99); _hotspots[curId]._flags = SF_DISABLED; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; - _hotspots[curId]._id = curId; _hotspotsCount = curId + 1; } @@ -107,23 +98,18 @@ void GnapEngine::initMenuHotspots2() { void GnapEngine::initMenuQuitQueryHotspots() { _hotspots[0]._rect = Common::Rect(311, 197, 377, 237); _hotspots[0]._flags = SF_GRAB_CURSOR; - _hotspots[0]._id = 0; _hotspots[1]._rect = Common::Rect(403, 197, 469, 237); _hotspots[1]._flags = SF_GRAB_CURSOR; - _hotspots[1]._id = 1; _hotspots[2]._rect = Common::Rect(330, 350, 430, 460); _hotspots[2]._flags = SF_GRAB_CURSOR; - _hotspots[2]._id = 2; _hotspots[3]._rect = Common::Rect(180, 15, 620, 580); _hotspots[3]._flags = SF_NONE; - _hotspots[3]._id = 3; _hotspots[4]._rect = Common::Rect(0, 0, 799, 599); _hotspots[4]._flags = SF_NONE; - _hotspots[4]._id = 4; _hotspotsCount = 5; } @@ -134,35 +120,29 @@ void GnapEngine::initSaveLoadHotspots() { for (int i = 0; i < 7; ++i ) { _hotspots[curId]._rect = Common::Rect(288, 31 * i + 74, _hotspots[curId]._rect.left + 91, _hotspots[curId]._rect.top + 22); _hotspots[curId]._flags = SF_GRAB_CURSOR; - _hotspots[curId]._id = curId; ++curId; } if (_menuStatus == 2) { _hotspots[curId]._rect = Common::Rect(416, 160, 499, 188); _hotspots[curId]._flags = SF_GRAB_CURSOR; - _hotspots[curId]._id = curId; ++curId; } _hotspots[curId]._rect = Common::Rect(416, 213, 499, 241); _hotspots[curId]._flags = SF_GRAB_CURSOR; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(330, 350, 430, 460); _hotspots[curId]._flags = SF_GRAB_CURSOR; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(180, 15, 620, 580); _hotspots[curId]._flags = SF_NONE; - _hotspots[curId]._id = curId; ++curId; _hotspots[curId]._rect = Common::Rect(0, 0, 799, 599); _hotspots[curId]._flags = SF_NONE; - _hotspots[curId]._id = curId; _hotspotsCount = curId + 1; } -- cgit v1.2.3 From 55162fb7ca2accfee74a6eb57cadfbf57962c161 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 May 2016 20:33:51 +0200 Subject: GNAP: Simplify some calls of _hotspotWalkPos --- engines/gnap/gnap.cpp | 3 +-- engines/gnap/scenes/group0.cpp | 4 ++-- engines/gnap/scenes/group1.cpp | 6 ++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 3b5d1496e0..dacf360eda 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -326,8 +326,7 @@ void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, u int16 walkX, int16 walkY) { _hotspots[index]._rect = Common::Rect(x1, y1, x2, y2); _hotspots[index]._flags = flags; - _hotspotsWalkPos[index].x = walkX; - _hotspotsWalkPos[index].y = walkY; + _hotspotsWalkPos[index] = Common::Point(walkX, walkY); } int GnapEngine::getHotspotIndexAtPos(Common::Point pos) { diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 1b82faccfb..c7792af531 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -508,7 +508,7 @@ void Scene02::run() { if (gnap._actionStatus < 0) { if (_vm->_grabCursorSpriteIndex == kItemTwig) { gnap._idleFacing = kDirUpRight; - Common::Point destPos = Common::Point(_vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].x, _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot].y + 1); + Common::Point destPos = _vm->_hotspotsWalkPos[_vm->_sceneClickedHotspot] + Common::Point(0, 1); gnap.walkTo(destPos, 0, gnap.getSequenceId(kGSIdle, Common::Point(0, 0)) | 0x10000, 1); gnap._actionStatus = kAS02UseTwigWithChicken; } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -1967,7 +1967,7 @@ void Scene05::run() { } else { switch (_vm->_verbCursor) { case LOOK_CURSOR: - gnap.playScratchingHead(Common::Point(_vm->_hotspotsWalkPos[1].x, _vm->_hotspotsWalkPos[1].y - 1)); + gnap.playScratchingHead(_vm->_hotspotsWalkPos[1] + Common::Point(0, -1)); break; case GRAB_CURSOR: case TALK_CURSOR: diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 7aa5d9efdd..f785c443f1 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -3147,8 +3147,7 @@ void Scene18::updateHotspots() { _vm->_hotspots[kHS18HydrantRightValve]._rect.left = 148; _vm->_hotspots[kHS18HydrantRightValve]._rect.top = 403; _vm->_hotspots[kHS18GarbageCan]._flags = SF_DISABLED; - _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; - _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; + _vm->_hotspotsWalkPos[kHS18GarbageCan] = Common::Point(3, 7); } else { _vm->_hotspots[kHS18HydrantTopValve]._rect.top = 246; } @@ -3159,8 +3158,7 @@ void Scene18::updateHotspots() { } else if (_vm->isFlag(kGFTruckKeysUsed)) { _vm->_hotspots[kHS18GarbageCan]._rect = Common::Rect(115, 365, 168, 470); _vm->_hotspots[kHS18GarbageCan]._flags = SF_WALKABLE | SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; - _vm->_hotspotsWalkPos[kHS18GarbageCan].x = 3; - _vm->_hotspotsWalkPos[kHS18GarbageCan].y = 7; + _vm->_hotspotsWalkPos[kHS18GarbageCan] = Common::Point(3, 7); } if (_vm->isFlag(kGFPlatypusDisguised)) _vm->_hotspots[kHS18GarbageCan]._flags = SF_DISABLED; -- cgit v1.2.3 From e5f60634a5c86a55f5b178b82879357bd6eb2321 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 May 2016 16:21:04 +0200 Subject: GNAP: Fix regression in hotspots --- engines/gnap/menu.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 21ea8d4a67..fd3c2b8d7c 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -47,8 +47,10 @@ void GnapEngine::initMenuHotspots1() { int curId = 0; for (int i = 0; i < 3; ++i) { + int top = 74 * i + 69; for (int j = 0; j < 3; ++j) { - _hotspots[curId]._rect = Common::Rect(87 * j + 262, 74 * i + 69, _hotspots[curId]._rect.left + 79, _hotspots[curId]._rect.top + 66); + int left = 87 * j + 262; + _hotspots[curId]._rect = Common::Rect(left, top, left + 79, top + 66); _hotspots[curId]._flags = SF_NONE; ++curId; } @@ -72,7 +74,8 @@ void GnapEngine::initMenuHotspots2() { int curId = 0; for (int i = 0; i < 4; ++i) { - _hotspots[curId]._rect = Common::Rect(312, 48 * i + 85, _hotspots[curId]._rect.left + 153, _hotspots[curId]._rect.top + 37); + int top = 48 * i + 85; + _hotspots[curId]._rect = Common::Rect(312, top, 465, top + 37); _hotspots[curId]._flags = SF_GRAB_CURSOR; ++curId; } @@ -118,7 +121,8 @@ void GnapEngine::initSaveLoadHotspots() { int curId = 0; for (int i = 0; i < 7; ++i ) { - _hotspots[curId]._rect = Common::Rect(288, 31 * i + 74, _hotspots[curId]._rect.left + 91, _hotspots[curId]._rect.top + 22); + int top = 31 * i + 74; + _hotspots[curId]._rect = Common::Rect(288, top, 379, top + 22); _hotspots[curId]._flags = SF_GRAB_CURSOR; ++curId; } -- cgit v1.2.3 From 52374bfe7b3110d4a4c2b0cf116ea7fe476f4f7d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 20:43:55 +0200 Subject: GNAP: Load TTF from the executable (optional) --- engines/gnap/gamesys.cpp | 42 ++++++++++++++++++++++-------------------- engines/gnap/gnap.cpp | 24 +++++++++++++++++------- engines/gnap/gnap.h | 4 ++++ engines/gnap/scenes/arcade.cpp | 6 ------ 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 6a9cc0f10d..ecfa3c54ba 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -261,8 +261,6 @@ void GameSys::drawSpriteToSurface(Graphics::Surface *surface, int x, int y, int } void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r, byte g, byte b, const char *text) { - // NOTE Not that nice but will have to do for now - bool doDirty = false; if (!surface) { @@ -271,29 +269,33 @@ void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r } uint32 color = surface->format.RGBToColor(r, g, b); + if (_vm->_font) { + _vm->_font->drawString(surface, text, x, y, _vm->_font->getStringWidth(text), color); - for (const char *cp = text; *cp != 0; ++cp) { - byte c = *cp; - if (c < 32 || c > 127) - c = (byte)'_'; - c -= 32; - int w = _dejaVuSans9ptCharDescriptors[c]._width; - const byte *data = _dejaVuSans9ptCharBitmaps + _dejaVuSans9ptCharDescriptors[c]._offset; - for (int xc = 0; xc < w; ++xc) { - for (int yc = 15; yc >= 0; --yc) { - byte *dst = (byte*)surface->getBasePtr(x + xc, y + yc); - if (data[1 - (yc >> 3)] & (1 << (yc & 7))) - WRITE_LE_UINT32(dst, color); + if (doDirty) + insertDirtyRect(Common::Rect(x, y, x + _vm->_font->getStringWidth(text), y + _vm->_font->getFontHeight())); + } else { + for (const char *cp = text; *cp != 0; ++cp) { + byte c = *cp; + if (c < 32 || c > 127) + c = (byte)'_'; + c -= 32; + int w = _dejaVuSans9ptCharDescriptors[c]._width; + const byte *data = _dejaVuSans9ptCharBitmaps + _dejaVuSans9ptCharDescriptors[c]._offset; + for (int xc = 0; xc < w; ++xc) { + for (int yc = 15; yc >= 0; --yc) { + byte *dst = (byte*)surface->getBasePtr(x + xc, y + yc); + if (data[1 - (yc >> 3)] & (1 << (yc & 7))) + WRITE_LE_UINT32(dst, color); + } + data += 2; } - data += 2; + x += w + 1; } - x += w + 1; - } - if (doDirty) { - insertDirtyRect(Common::Rect(x, y, x + getTextWidth(text), y + 16)); + if (doDirty) + insertDirtyRect(Common::Rect(x, y, x + getTextWidth(text), y + 16)); } - } int GameSys::getTextHeight(const char *text) { diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index dacf360eda..21329fefee 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -20,6 +20,7 @@ * */ +#include "graphics/cursorman.h" #include "gnap/gnap.h" #include "gnap/datarchive.h" #include "gnap/gamesys.h" @@ -28,14 +29,10 @@ #include "common/config-manager.h" #include "common/debug-channels.h" -#include "common/error.h" -#include "common/fs.h" #include "common/timer.h" #include "engines/util.h" -#include "graphics/cursorman.h" - namespace Gnap { static const int kCursors[] = { @@ -143,6 +140,15 @@ Common::Error GnapEngine::run() { if (!_exe->loadFromEXE("ufos.exe")) error("Could not load ufos.exe"); +#ifdef USE_FREETYPE2 + Common::SeekableReadStream *stream = _exe->getResource(Common::kPEFont, 2000); + _font = Graphics::loadTTFFont(*stream, 24); + if (!_font) + warning("Unable to load font"); +#else + _font = nullptr; +#endif + _dat = new DatManager(); _spriteCache = new SpriteCache(_dat); _soundCache = new SoundCache(_dat); @@ -167,6 +173,7 @@ Common::Error GnapEngine::run() { delete _spriteCache; delete _dat; delete _debugger; + delete _font; delete _exe; return Common::kNoError; @@ -342,10 +349,13 @@ void GnapEngine::updateCursorByHotspot() { int hotspotIndex = getHotspotIndexAtPos(Common::Point(_mouseX, _mouseY)); if (_debugger->_showHotspotNumber) { - // NOTE This causes some display glitches so don't worry + // NOTE This causes some display glitches char t[256]; - sprintf(t, "hotspot = %d", hotspotIndex); - _gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0); + sprintf(t, "hotspot = %2d", hotspotIndex); + if (!_font) + _gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0); + else + _gameSys->fillSurface(0, 8, 9, _font->getStringWidth(t) + 10, _font->getFontHeight() + 2, 0, 0, 0); _gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t); } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index d379a263b9..45f675c848 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -38,6 +38,9 @@ #include "engines/engine.h" #include "graphics/pixelformat.h" #include "graphics/wincursor.h" +#include "graphics/fontman.h" +#include "graphics/font.h" +#include "graphics/fonts/ttf.h" #include "gnap/debugger.h" #include "gnap/resource.h" @@ -243,6 +246,7 @@ public: PlayerGnap *_gnap; PlayerPlat *_plat; MusicPlayer *_music; + Graphics::Font *_font; int _lastUpdateClock; diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 1547a50716..d26e0fb931 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -2623,9 +2623,6 @@ void Scene52::run() { _vm->hideCursor(); - // TODO loadFont("maturasc", "Matura MT Script Capitals", 2000); - // TODO setFontSize(24); - _gameScore = 0; _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); @@ -2720,9 +2717,6 @@ void Scene52::run() { _vm->_sceneDone = true; } } - - // TODO freeFont(); - _vm->_gameSys->waitForUpdate(); } -- cgit v1.2.3 From 85b7da75deeaf57a30d58e924076eb72d7a3d98e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 21:57:20 +0200 Subject: GNAP: Explicitely set _scoreLevel to 1 when score greater than 556 --- engines/gnap/scenes/arcade.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index d26e0fb931..acc541a45d 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -250,7 +250,8 @@ void Scene49::increaseScore(int amount) { _scoreBarPos += amount; _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); } - _scoreLevel = _scoreBarPos + amount >= 556; + + _scoreLevel = (_scoreBarPos + amount >= 556) ? 1 : 0; } void Scene49::decreaseScore(int amount) { -- cgit v1.2.3 From 4371d2f4d9566c3f840284dbe86d3358de4db55f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 22:38:05 +0200 Subject: GNAP: Fix score display in Monkey arcade game. --- engines/gnap/scenes/arcade.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index acc541a45d..5631c62ba9 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -1620,8 +1620,8 @@ void Scene51::updateCash(int amount) { void Scene51::drawDigit(int digit, int position) { if (digit != _digits[position]) { - _vm->_gameSys->insertSequence(kDigitSequenceIds[digit], 253, - _digitSequenceIds[position], 253, + _vm->_gameSys->insertSequence(kDigitSequenceIds[digit], 253 + position, + _digitSequenceIds[position], 253 + position, kSeqSyncWait, 0, kDigitPositions[position] - 20, -20); _digitSequenceIds[position] = kDigitSequenceIds[digit]; _digits[position] = digit; @@ -1632,8 +1632,7 @@ void Scene51::initCashDisplay() { for (int position = 0; position < 4; ++position) { _digits[position] = 0; _digitSequenceIds[position] = kDigitSequenceIds[0]; - _vm->_gameSys->insertSequence(kDigitSequenceIds[0], 253, 0, 0, - kSeqNone, 0, kDigitPositions[position] - 20, -20); + _vm->_gameSys->insertSequence(kDigitSequenceIds[0], 253 + position, 0, 0, kSeqNone, 0, kDigitPositions[position] - 20, -20); } _cashAmount = 0; } -- cgit v1.2.3 From bb35d5063b9d76d940767e0a70fef443877ff8c1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 22:59:28 +0200 Subject: GNAP: Fix broken debug strings --- engines/gnap/music.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gnap/music.cpp b/engines/gnap/music.cpp index b42f6e9b91..57b2b27820 100644 --- a/engines/gnap/music.cpp +++ b/engines/gnap/music.cpp @@ -73,7 +73,7 @@ void MusicPlayer::playSMF(bool loop) { Common::File musicFile; musicFile.open(_filename); if (!musicFile.isOpen()) { - debugC(2, kDebugMusic, "Cannot open music file %s", _filename); + debugC(2, kDebugMusic, "Cannot open music file %s", _filename.c_str()); return; } int midiMusicSize = musicFile.size(); @@ -96,7 +96,7 @@ void MusicPlayer::playSMF(bool loop) { _isLooping = loop; _isPlaying = true; } else { - debugC(2, kDebugMusic, "Cannot play music file %s", _filename); + debugC(2, kDebugMusic, "Cannot play music file %s", _filename.c_str()); delete parser; } } -- cgit v1.2.3 From 06f3dc29731cdfc0521929fb4c20c61e1d2c159d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 23:24:02 +0200 Subject: GNAP: Fix a couple of unintialized variables --- engines/gnap/gnap.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 21329fefee..a061be068c 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -97,6 +97,11 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : Engine::syncSoundSettings(); _scene = nullptr; _music = nullptr; + + _wasSavegameLoaded = false; + for (int i = 0; i < kMaxTimers; ++i) + _savedTimers[i] = _timers[i] = 0; + } GnapEngine::~GnapEngine() { -- cgit v1.2.3 From e280c833c7cc65c263b05532533e5e010a0236c3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 23:34:58 +0200 Subject: GNAP: Enforce the use of nullptr in function calls --- engines/gnap/gamesys.cpp | 8 ++++---- engines/gnap/gnap.cpp | 14 +++++++------- engines/gnap/scenes/arcade.cpp | 38 +++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index ecfa3c54ba..76f7fa44b3 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -857,7 +857,7 @@ void GameSys::drawSprites() { } else { int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); - seqDrawSpriteFrame(spriteResource, gfxItem5->_currFrame, 0); + seqDrawSpriteFrame(spriteResource, gfxItem5->_currFrame, nullptr); _vm->_spriteCache->release(resourceId); } } @@ -1023,7 +1023,7 @@ void GameSys::fatUpdateFrame() { // NOTE Skipped avi code } } else { - Sequence *seqItem = seqFind(gfxItem->_sequenceId, gfxItem->_id, 0); + Sequence *seqItem = seqFind(gfxItem->_sequenceId, gfxItem->_id, nullptr); if (!animation) { gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; @@ -1178,7 +1178,7 @@ void GameSys::fatUpdateFrame() { Sequence *seqItem = &_fatSequenceItems[i]; if (((seqItem->_flags & 8) || (seqItem->_flags & 0x20)) && seqItem->_sequenceId2 != -1) { duration = 0; - if (((seqItem->_flags & 0x20) && seqLocateGfx(seqItem->_sequenceId2, seqItem->_id2, 0)) || + if (((seqItem->_flags & 0x20) && seqLocateGfx(seqItem->_sequenceId2, seqItem->_id2, nullptr)) || updateSequenceDuration(seqItem->_sequenceId2, seqItem->_id2, &duration)) { int index = -1; bool found = false; @@ -1229,7 +1229,7 @@ void GameSys::fatUpdateFrame() { for (uint i = 0; i < _seqItems.size(); ++i) { Sequence *seqItem = &_seqItems[i]; - if (seqLocateGfx(seqItem->_sequenceId, seqItem->_id, 0)) { + if (seqLocateGfx(seqItem->_sequenceId, seqItem->_id, nullptr)) { updateAnimationsStatus(seqItem->_sequenceId, seqItem->_id); if (seqItem->_flags & 2) { int gfxDuration; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index a061be068c..045ed4f9ef 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -358,10 +358,10 @@ void GnapEngine::updateCursorByHotspot() { char t[256]; sprintf(t, "hotspot = %2d", hotspotIndex); if (!_font) - _gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0); + _gameSys->fillSurface(nullptr, 10, 10, 80, 16, 0, 0, 0); else - _gameSys->fillSurface(0, 8, 9, _font->getStringWidth(t) + 10, _font->getFontHeight() + 2, 0, 0, 0); - _gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t); + _gameSys->fillSurface(nullptr, 8, 9, _font->getStringWidth(t) + 10, _font->getFontHeight() + 2, 0, 0, 0); + _gameSys->drawTextToSurface(nullptr, 10, 10, 255, 255, 255, t); } if (hotspotIndex < 0) @@ -906,15 +906,15 @@ void GnapEngine::updateIdleTimer() { void GnapEngine::screenEffect(int dir, byte r, byte g, byte b) { if (dir == 1) { for (int y = 300; y < 600; y += 50) { - _gameSys->fillSurface(0, 0, y, 800, 50, r, g, b); - _gameSys->fillSurface(0, 0, 549 - y + 1, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, y, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, 549 - y + 1, 800, 50, r, g, b); gameUpdateTick(); _system->delayMillis(50); } } else { for (int y = 0; y < 300; y += 50) { - _gameSys->fillSurface(0, 0, y, 800, 50, r, g, b); - _gameSys->fillSurface(0, 0, 549 - y + 1, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, y, 800, 50, r, g, b); + _gameSys->fillSurface(nullptr, 0, 549 - y + 1, 800, 50, r, g, b); gameUpdateTick(); _system->delayMillis(50); } diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 5631c62ba9..80c7c656c6 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -248,7 +248,7 @@ void Scene49::updateObstacle(int id) { void Scene49::increaseScore(int amount) { if (_scoreBarPos + amount <= 556) { _scoreBarPos += amount; - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _scoreBarPos, 508, amount, 22, 255, 0, 0); } _scoreLevel = (_scoreBarPos + amount >= 556) ? 1 : 0; @@ -258,7 +258,7 @@ void Scene49::decreaseScore(int amount) { if (_scoreBarPos >= 226 && _scoreLevel == 0) { if (_scoreBarFlash) refreshScoreBar(); - _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); + _vm->_gameSys->fillSurface(nullptr, _scoreBarPos, 508, amount, 22, 89, 0, 5); _scoreBarPos -= amount; _scoreLevel = 0; } @@ -266,9 +266,9 @@ void Scene49::decreaseScore(int amount) { void Scene49::refreshScoreBar() { if (_scoreBarFlash) - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 226, 508, 330, 22, 255, 0, 0); else - _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); + _vm->_gameSys->fillSurface(nullptr, 226, 508, 330, 22, 89, 0, 5); _scoreBarFlash = !_scoreBarFlash; } @@ -630,8 +630,8 @@ void Scene50::initRound() { _vm->_timers[3] = getRightTongueActionTicks(); _vm->_timers[4] = 0; _vm->_timers[6] = 0; - _vm->_gameSys->fillSurface(0, 91, 73, 260, 30, 212, 0, 0); - _vm->_gameSys->fillSurface(0, 450, 73, 260, 30, 212, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 91, 73, 260, 30, 212, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 450, 73, 260, 30, 212, 0, 0); _timeRemaining = 40; drawCountdown(40); } @@ -652,8 +652,8 @@ bool Scene50::updateCountdown() { void Scene50::drawCountdown(int value) { char str[8]; sprintf(str, "%02d", value); - _vm->_gameSys->fillSurface(0, 371, 505, 50, 27, 0, 0, 0); - _vm->_gameSys->drawTextToSurface(0, 381, 504, 255, 255, 255, str); + _vm->_gameSys->fillSurface(nullptr, 371, 505, 50, 27, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(nullptr, 381, 504, 255, 255, 255, str); } void Scene50::playTonguesIdle() { @@ -698,7 +698,7 @@ bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { if (newLeftBarPos < 0) newLeftBarPos = 0; _leftTongueEnergyBarPos = newLeftBarPos; - _vm->_gameSys->fillSurface(0, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 26 * newLeftBarPos + 91, 73, 260 - 26 * newLeftBarPos, 30, 0, 0, 0); } if (newRightBarPos != _rightTongueEnergyBarPos) { @@ -706,7 +706,7 @@ bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { newRightBarPos = 0; _rightTongueEnergyBarPos = newRightBarPos; if (newRightBarPos != 10) - _vm->_gameSys->fillSurface(0, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 26 * (9 - newRightBarPos) + 450, 73, 26, 30, 0, 0, 0); } if (newLeftBarPos * newRightBarPos > 0) @@ -2190,7 +2190,7 @@ void Scene52::updateAlienRow(int rowNum) { if (rowNum == 1) { for (int j = 0; j < 3; ++j) { if (_shieldSpriteIds[j] != -1) { - _vm->_gameSys->fillSurface(0, _shieldPosX[j], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _shieldPosX[j], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _shieldSpriteIds[j] = -1; } } @@ -2368,7 +2368,7 @@ int Scene52::alienCannonHitShield(int cannonNum) { if (_shieldSpriteIds[shieldNum] <= 21) { _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]); } else { - _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _shieldSpriteIds[shieldNum] = -1; } _vm->_gameSys->setAnimation(0, 0, cannonNum + 9); @@ -2412,7 +2412,7 @@ bool Scene52::shipCannonHitShield(int cannonNum) { if (_shieldSpriteIds[shieldNum] <= 21) { _vm->_gameSys->drawSpriteToBackground(_shieldPosX[shieldNum], _arcadeScreenBottom - 44, _shieldSpriteIds[shieldNum]); } else { - _vm->_gameSys->fillSurface(0, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, _shieldPosX[shieldNum], _arcadeScreenBottom - 44, 33, 44, 0, 0, 0); _shieldSpriteIds[shieldNum] = -1; } _vm->_gameSys->insertSequence(0x21, shieldNum + 257, 0, 0, kSeqNone, 0, _shipCannonPosX - 18, _arcadeScreenBottom - 44); @@ -2588,9 +2588,9 @@ void Scene52::updateAlien(int rowNum) { void Scene52::loseShip() { --_shipsLeft; if (_shipsLeft == 2) { - _vm->_gameSys->fillSurface(0, 120, 140, _shipMidX, _shipMidY, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 120, 140, _shipMidX, _shipMidY, 0, 0, 0); } else if (_shipsLeft == 1) { - _vm->_gameSys->fillSurface(0, 120, 185, _shipMidX, _shipMidY, 0, 0, 0); + _vm->_gameSys->fillSurface(nullptr, 120, 185, _shipMidX, _shipMidY, 0, 0, 0); } } @@ -2614,8 +2614,8 @@ void Scene52::initAnims() { void Scene52::drawScore(int score) { char str[4]; sprintf(str, "%03d", score); - _vm->_gameSys->fillSurface(0, 420, 80, 48, 30, 0, 0, 0); - _vm->_gameSys->drawTextToSurface(0, 420, 80, 255, 255, 255, str); + _vm->_gameSys->fillSurface(nullptr, 420, 80, 48, 30, 0, 0, 0); + _vm->_gameSys->drawTextToSurface(nullptr, 420, 80, 255, 255, 255, str); } void Scene52::run() { @@ -2624,8 +2624,8 @@ void Scene52::run() { _vm->hideCursor(); _gameScore = 0; - _vm->_gameSys->drawTextToSurface(0, 300, 80, 255, 255, 255, "SCORE"); - _vm->_gameSys->drawTextToSurface(0, 468, 80, 255, 255, 255, "0"); + _vm->_gameSys->drawTextToSurface(nullptr, 300, 80, 255, 255, 255, "SCORE"); + _vm->_gameSys->drawTextToSurface(nullptr, 468, 80, 255, 255, 255, "0"); drawScore(0); -- cgit v1.2.3 From 090c178214867009ded91ba7cab4b658da3e7b6d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 16 May 2016 23:38:49 +0200 Subject: GNAP: Fix another valgrind error --- engines/gnap/gnap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 045ed4f9ef..2a143ad141 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -101,7 +101,8 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : _wasSavegameLoaded = false; for (int i = 0; i < kMaxTimers; ++i) _savedTimers[i] = _timers[i] = 0; - + + _isWaiting = false; } GnapEngine::~GnapEngine() { -- cgit v1.2.3 From e024a26ccdd95893839a35325c17276a7a01107e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 17 May 2016 06:50:43 +0200 Subject: GNAP: Replace memcpy on overlapping memory area by memmove. Thanks to eriktorbjorn for suggesting it --- engines/gnap/gamesys.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 76f7fa44b3..4c603c53fb 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -443,7 +443,7 @@ void GameSys::seqInsertGfx(int index, int duration) { seqLocateGfx(seqItem->_sequenceId, seqItem->_id, &gfxIndex); if (gfxIndex != _gfxItemsCount) - memcpy(&_gfxItems[gfxIndex + sequenceResource->_animationsCount], &_gfxItems[gfxIndex], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); + memmove(&_gfxItems[gfxIndex + sequenceResource->_animationsCount], &_gfxItems[gfxIndex], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); _gfxItemsCount += sequenceResource->_animationsCount; for (int i = 0; i < sequenceResource->_animationsCount; ++i) { @@ -523,7 +523,7 @@ void GameSys::seqRemoveGfx(int sequenceId, int id) { if (gfxItem->_prevFrame._spriteId == -1) { --_gfxItemsCount; if (gfxIndex != _gfxItemsCount) - memcpy(&_gfxItems[gfxIndex], &_gfxItems[gfxIndex + 1], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); + memmove(&_gfxItems[gfxIndex], &_gfxItems[gfxIndex + 1], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex)); } else { gfxItem->_sequenceId = -1; gfxItem->_animation = nullptr; @@ -945,7 +945,7 @@ void GameSys::handleReqRemoveSequenceItem() { ++gfxIndex2a; _gfxItemsCount -= gfxIndex2a - gfxIndex2; if (_gfxItemsCount != gfxIndex2) - memcpy(&_gfxItems[gfxIndex2], &_gfxItems[gfxIndex2a], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex2)); + memmove(&_gfxItems[gfxIndex2], &_gfxItems[gfxIndex2a], sizeof(GfxItem) * (_gfxItemsCount - gfxIndex2)); } } } @@ -1095,7 +1095,7 @@ void GameSys::fatUpdateFrame() { } else if (v20 && gfxItem->_prevFrame._spriteId == -1) { --_gfxItemsCount; if (_gfxItemsCount != i) - memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); + memmove(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); --i; } else { gfxItem->_updFlag = false; @@ -1112,7 +1112,7 @@ void GameSys::fatUpdateFrame() { } else { --_gfxItemsCount; if (_gfxItemsCount != i) - memcpy(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); + memmove(&_gfxItems[i], &_gfxItems[i + 1], sizeof(GfxItem) * (_gfxItemsCount - i)); --i; } } @@ -1124,7 +1124,7 @@ void GameSys::fatUpdateFrame() { int insertIndex; seqLocateGfx(-1, _newSpriteDrawItems[k]._id, &insertIndex); if (_gfxItemsCount != insertIndex) - memcpy(&_gfxItems[insertIndex + 1], &_gfxItems[insertIndex], sizeof(GfxItem) * (_gfxItemsCount - insertIndex)); + memmove(&_gfxItems[insertIndex + 1], &_gfxItems[insertIndex], sizeof(GfxItem) * (_gfxItemsCount - insertIndex)); ++_gfxItemsCount; GfxItem *gfxItem = &_gfxItems[insertIndex]; gfxItem->_sequenceId = -1; -- cgit v1.2.3 From 63589812018eafc0c7ed4b7a8b77b7e048db10ad Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 17 May 2016 07:09:42 +0200 Subject: GNAP: USe Common::Point for mouse position, initialize some more variables --- engines/gnap/gnap.cpp | 17 ++++++++++------- engines/gnap/gnap.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 2a143ad141..21f44c3e59 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -103,6 +103,10 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : _savedTimers[i] = _timers[i] = 0; _isWaiting = false; + _sceneWaiting = false; + + _mousePos = Common::Point(0, 0); + _currGrabCursorX = _currGrabCursorY = 0; } GnapEngine::~GnapEngine() { @@ -205,8 +209,7 @@ void GnapEngine::updateEvents() { _keyDownState[event.kbd.keycode] = 0; break; case Common::EVENT_MOUSEMOVE: - _mouseX = event.mouse.x; - _mouseY = event.mouse.y; + _mousePos = event.mouse; break; case Common::EVENT_LBUTTONUP: _mouseButtonState._left = false; @@ -352,7 +355,7 @@ int GnapEngine::getHotspotIndexAtPos(Common::Point pos) { void GnapEngine::updateCursorByHotspot() { if (!_isWaiting) { - int hotspotIndex = getHotspotIndexAtPos(Common::Point(_mouseX, _mouseY)); + int hotspotIndex = getHotspotIndexAtPos(_mousePos); if (_debugger->_showHotspotNumber) { // NOTE This causes some display glitches @@ -474,8 +477,8 @@ void GnapEngine::setGrabCursorSprite(int index) { void GnapEngine::createGrabCursorSprite(int spriteId) { _grabCursorSprite = _gameSys->createSurface(spriteId); _gameSys->insertSpriteDrawItem(_grabCursorSprite, - _mouseX - (_grabCursorSprite->w / 2), - _mouseY - (_grabCursorSprite->h / 2), + _mousePos.x - (_grabCursorSprite->w / 2), + _mousePos.y - (_grabCursorSprite->h / 2), 300); delayTicks(5); } @@ -491,8 +494,8 @@ void GnapEngine::freeGrabCursorSprite() { void GnapEngine::updateGrabCursorSprite(int x, int y) { if (_grabCursorSprite) { - int newGrabCursorX = _mouseX - (_grabCursorSprite->w / 2) - x; - int newGrabCursorY = _mouseY - (_grabCursorSprite->h / 2) - y; + int newGrabCursorX = _mousePos.x - (_grabCursorSprite->w / 2) - x; + int newGrabCursorY = _mousePos.y - (_grabCursorSprite->h / 2) - y; if (_currGrabCursorX != newGrabCursorX || _currGrabCursorY != newGrabCursorY) { _currGrabCursorX = newGrabCursorX; _currGrabCursorY = newGrabCursorY; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 45f675c848..3cedf1b9fe 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -286,7 +286,7 @@ public: int _newCursorValue, _cursorValue; int _verbCursor, _cursorIndex; - int _mouseX, _mouseY; + Common::Point _mousePos; int _leftClickMouseX, _leftClickMouseY; Graphics::Surface *_grabCursorSprite; -- cgit v1.2.3 From 4c37381a8eb83012cf4d580548b62f8cce106d80 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 17 May 2016 22:05:35 +0200 Subject: GNAP: Add missing stars in header, change include guard name in gnap.h --- engines/gnap/character.cpp | 4 ++-- engines/gnap/character.h | 4 ++-- engines/gnap/datarchive.cpp | 4 ++-- engines/gnap/datarchive.h | 4 ++-- engines/gnap/detection.cpp | 4 ++-- engines/gnap/fontdata.h | 4 ++-- engines/gnap/gamesys.cpp | 4 ++-- engines/gnap/gamesys.h | 4 ++-- engines/gnap/gnap.cpp | 4 ++-- engines/gnap/gnap.h | 10 +++++----- engines/gnap/grid.cpp | 4 ++-- engines/gnap/menu.cpp | 4 ++-- engines/gnap/resource.cpp | 4 ++-- engines/gnap/resource.h | 4 ++-- engines/gnap/sound.cpp | 4 ++-- engines/gnap/sound.h | 4 ++-- 16 files changed, 35 insertions(+), 35 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 7b55e2b887..46b5dc712d 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/character.h b/engines/gnap/character.h index 0a00fe0cad..be6efbfdf4 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp index 0eb6601ccb..56fd04b87d 100644 --- a/engines/gnap/datarchive.cpp +++ b/engines/gnap/datarchive.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/datarchive.h b/engines/gnap/datarchive.h index 28664fea5c..10021a0e6d 100644 --- a/engines/gnap/datarchive.h +++ b/engines/gnap/datarchive.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 79fafd4e5f..616c26b04b 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/fontdata.h b/engines/gnap/fontdata.h index bb87638255..ef39df960e 100644 --- a/engines/gnap/fontdata.h +++ b/engines/gnap/fontdata.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 4c603c53fb..4c105d989f 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index a63b32d995..98014f1bac 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 21f44c3e59..4de50ee38f 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 3cedf1b9fe..e593c749f6 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -8,20 +8,20 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#ifndef GNAP_H -#define GNAP_H +#ifndef GNAP_GNAP_H +#define GNAP_GNAP_H #include "common/array.h" #include "common/events.h" @@ -473,4 +473,4 @@ public: } // End of namespace Gnap -#endif // GNAP_H +#endif // GNAP_GNAP_H diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index a89c87c61d..b3a8a4b305 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index fd3c2b8d7c..e2b28a6742 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index ee9f14b602..1ed45d8164 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 7235351f65..00b8740ac1 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/sound.cpp b/engines/gnap/sound.cpp index a3e0e1c2d3..103a649e59 100644 --- a/engines/gnap/sound.cpp +++ b/engines/gnap/sound.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/gnap/sound.h b/engines/gnap/sound.h index ced3deda62..de3981245d 100644 --- a/engines/gnap/sound.h +++ b/engines/gnap/sound.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -- cgit v1.2.3 From 4faedcdfcb5d34d4262cf3c6dfe96c68ce48848b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 17 May 2016 22:10:10 +0200 Subject: GNAP: Fix some spacing --- engines/gnap/datarchive.cpp | 6 +++--- engines/gnap/datarchive.h | 8 ++++---- engines/gnap/gnap.h | 2 +- engines/gnap/scenes/group0.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/gnap/datarchive.cpp b/engines/gnap/datarchive.cpp index 56fd04b87d..c74766bd03 100644 --- a/engines/gnap/datarchive.cpp +++ b/engines/gnap/datarchive.cpp @@ -47,9 +47,9 @@ DatArchive::DatArchive(const char *filename) { _entries = new DatEntry[_entriesCount]; for (int i = 0; i < _entriesCount; ++i) { _entries[i]._ofs = _fd->readUint32LE(); - _entries[i]._outSize1 = _fd->readUint32LE(); - _entries[i]._type = _fd->readUint32LE(); - _entries[i]._outSize2 = _fd->readUint32LE(); + _entries[i]._outSize1 = _fd->readUint32LE(); + _entries[i]._type = _fd->readUint32LE(); + _entries[i]._outSize2 = _fd->readUint32LE(); } } diff --git a/engines/gnap/datarchive.h b/engines/gnap/datarchive.h index 10021a0e6d..e9220f8e6f 100644 --- a/engines/gnap/datarchive.h +++ b/engines/gnap/datarchive.h @@ -36,10 +36,10 @@ namespace Gnap { struct DatEntry { - uint32 _ofs; - uint32 _outSize1; - uint32 _type; - uint32 _outSize2; + uint32 _ofs; + uint32 _outSize1; + uint32 _type; + uint32 _outSize2; }; class DatArchive { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index e593c749f6..7aa2221b1e 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -93,7 +93,7 @@ enum GnapDebugChannels { }; enum { - SF_NONE = 0x0000, + SF_NONE = 0x0000, SF_LOOK_CURSOR = 0x0001, SF_GRAB_CURSOR = 0x0002, SF_TALK_CURSOR = 0x0004, diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index c7792af531..25e0aaebe0 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -2297,8 +2297,8 @@ void Scene06::updateHotspots() { _vm->setHotspot(kHS06WalkArea4, 475, 469, 800, 505); _vm->setHotspot(kHS06WalkArea5, 0, 0, 800, 504); _vm->setDeviceHotspot(kHS06Device, -1, -1, -1, -1); - if (_vm->isFlag(kGFGasTaken)) - _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; + if (_vm->isFlag(kGFGasTaken)) + _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; if (_vm->_cursorValue == 4) { _vm->_hotspots[kHS06Ladder]._flags = SF_DISABLED; _vm->_hotspots[kHS06Gas]._flags = SF_DISABLED; -- cgit v1.2.3 From 0a8e552c6d761cb37a248c573c67d9fa468ca12f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 17 May 2016 22:21:27 +0200 Subject: GNAP: Fix the coding style of a couple of casts --- engines/gnap/gamesys.cpp | 22 +++++++++++----------- engines/gnap/resource.cpp | 2 +- engines/gnap/resource.h | 2 +- engines/gnap/scenes/intro.cpp | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 4c105d989f..61ea7c26ac 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -284,7 +284,7 @@ void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r const byte *data = _dejaVuSans9ptCharBitmaps + _dejaVuSans9ptCharDescriptors[c]._offset; for (int xc = 0; xc < w; ++xc) { for (int yc = 15; yc >= 0; --yc) { - byte *dst = (byte*)surface->getBasePtr(x + xc, y + yc); + byte *dst = (byte *)surface->getBasePtr(x + xc, y + yc); if (data[1 - (yc >> 3)] & (1 << (yc & 7))) WRITE_LE_UINT32(dst, color); } @@ -387,8 +387,8 @@ void GameSys::drawBitmap(int resourceId) { bmpSurface->w != _backgroundSurface->w || bmpSurface->h != _backgroundSurface->h) { debugC(kDebugBasic, "GameSys::drawBitmap() Different bitmap properties than current background"); } else { - byte *src = (byte*)bmpSurface->getPixels(); - byte *dst = (byte*)_backgroundSurface->getPixels(); + byte *src = (byte *)bmpSurface->getPixels(); + byte *dst = (byte *)_backgroundSurface->getPixels(); const int pitch = bmpSurface->pitch; int height = bmpSurface->h; while (height--) { @@ -606,8 +606,8 @@ void GameSys::restoreBackgroundRect(const Common::Rect &rect) { Common::Rect clipRect; if (!intersectRect(clipRect, rect, _screenRect)) return; - byte *src = (byte*)_backgroundSurface->getBasePtr(clipRect.left, clipRect.top); - byte *dst = (byte*)_frontSurface->getBasePtr(clipRect.left, clipRect.top); + byte *src = (byte *)_backgroundSurface->getBasePtr(clipRect.left, clipRect.top); + byte *dst = (byte *)_frontSurface->getBasePtr(clipRect.left, clipRect.top); const int bytes = _backgroundSurface->format.bytesPerPixel * clipRect.width(); int height = clipRect.height(); while (height--) { @@ -621,8 +621,8 @@ void GameSys::blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphi Common::Rect &sourceRect, bool transparent) { const int sourcePitch = sourceSurface->pitch; - byte *dst = (byte*)destSurface->getBasePtr(x, y); - byte *src = (byte*)sourceSurface->getBasePtr(sourceRect.left, sourceRect.top); + byte *dst = (byte *)destSurface->getBasePtr(x, y); + byte *src = (byte *)sourceSurface->getBasePtr(sourceRect.left, sourceRect.top); int width = sourceRect.width(); int height = sourceRect.height(); while (height--) { @@ -644,7 +644,7 @@ void GameSys::blitSprite32(Graphics::Surface *destSurface, int x, int y, byte *s int sourceWidth, Common::Rect &sourceRect, uint32 *sourcePalette, bool transparent) { const int sourcePitch = (sourceWidth + 3) & 0xFFFFFFFC; - byte *dst = (byte*)destSurface->getBasePtr(x, y); + byte *dst = (byte *)destSurface->getBasePtr(x, y); byte *src = sourcePixels + sourceRect.left + sourcePitch * sourceRect.top; int width = sourceRect.width(); int height = sourceRect.height(); @@ -677,7 +677,7 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f const int sourcePitch = (sourceWidth + 3) & 0xFFFFFFFC; if (!frameRect.equals(destRect)) { - byte *dst = (byte*)destSurface->getBasePtr(destRect.left, destRect.top); + byte *dst = (byte *)destSurface->getBasePtr(destRect.left, destRect.top); byte *src = sourcePixels + sourcePitch * sourceRect.top + sourceRect.left; const int height = destRect.bottom - destRect.top; const int width = destRect.right - destRect.left; @@ -704,7 +704,7 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f hsrc = src + sourcePitch * ((yi + 0x8000) >> 16); } } else { - byte *dst = (byte*)destSurface->getBasePtr(frameRect.left, frameRect.top); + byte *dst = (byte *)destSurface->getBasePtr(frameRect.left, frameRect.top); byte *src = sourcePixels + sourcePitch * sourceRect.top + sourceRect.left; const int height = frameRect.bottom - frameRect.top; const int width = frameRect.right - frameRect.left; @@ -887,7 +887,7 @@ void GameSys::drawSprites() { void GameSys::updateRect(const Common::Rect &r) { debugC(kDebugBasic, "GameSys::updateRect() %d, %d, %d, %d [%d, %d]", r.left, r.top, r.right, r.bottom, r.width(), r.height()); if (r.width() > 0 && r.height() > 0) { - byte *pixels = (byte*)_frontSurface->getBasePtr(r.left, r.top); + byte *pixels = (byte *)_frontSurface->getBasePtr(r.left, r.top); _vm->_system->copyRectToScreen(pixels, _frontSurface->pitch, r.left, r.top, r.width(), r.height()); } diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index 1ed45d8164..9936324c2b 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -96,7 +96,7 @@ SpriteResource::SpriteResource(int resourceId, byte *data, uint32 size) { _unknownVal2 = READ_LE_UINT16(_data + 6); _transparent = (READ_LE_UINT16(_data + 8) != 0); _colorsCount = READ_LE_UINT16(_data + 10); - _palette = (uint32*)(_data + 12); + _palette = (uint32 *)(_data + 12); _pixels = _data + 12 + _colorsCount * 4; debugC(kDebugBasic, "SpriteResource() width: %d; height: %d; colorsCount: %d", _width, _height, _colorsCount); } diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 00b8740ac1..35787fa48d 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -157,7 +157,7 @@ protected: ~Resource() { delete _obj; } }; - typedef Common::HashMap CacheMap; + typedef Common::HashMap CacheMap; typedef typename CacheMap::iterator CacheMapIterator; DatManager *_dat; diff --git a/engines/gnap/scenes/intro.cpp b/engines/gnap/scenes/intro.cpp index fa23d6a2b3..1679fe8306 100644 --- a/engines/gnap/scenes/intro.cpp +++ b/engines/gnap/scenes/intro.cpp @@ -90,8 +90,8 @@ void SceneIntro::run() { } else { // The intro AVI is played upside down, it's the only video played in the English version for (uint16 y = 0; y < frame->h / 2; y++) { - uint32 *ptrFrom = (uint32*)frame->getBasePtr(0, y); - uint32 *ptrTo = (uint32*)frame->getBasePtr(0, frame->h - y - 1); + uint32 *ptrFrom = (uint32 *)frame->getBasePtr(0, y); + uint32 *ptrTo = (uint32 *)frame->getBasePtr(0, frame->h - y - 1); for (uint16 x = 0; x < frame->w; x++) { uint32 t = *ptrFrom; *ptrFrom = *ptrTo; -- cgit v1.2.3 From 931846182baf040101886d8d1ea228f28345adf5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 18 May 2016 22:37:57 +0200 Subject: GNAP: Change pixel format - Courtesy of _sev --- engines/gnap/gamesys.cpp | 22 +++++++++++----------- engines/gnap/gnap.cpp | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 61ea7c26ac..3bb96f33b4 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -235,7 +235,7 @@ void GameSys::drawSpriteToBackground(int x, int y, int resourceId) { Graphics::Surface *GameSys::allocSurface(int width, int height) { Graphics::Surface *surface = new Graphics::Surface(); surface->create(width, height, _backgroundSurface->format); - surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), 0xFFFF00FF); + surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), 0xFFFFFF00); return surface; } @@ -630,7 +630,7 @@ void GameSys::blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphi byte *rdst = dst; for (int xc = 0; xc < width; ++xc) { uint32 pixel = READ_LE_UINT32(rsrc); - if (!transparent || pixel != 0xFFFF00FF) + if (!transparent || pixel != 0xFFFFFF00) WRITE_LE_UINT32(rdst, pixel); rsrc += 4; rdst += 4; @@ -654,9 +654,9 @@ void GameSys::blitSprite32(Graphics::Surface *destSurface, int x, int y, byte *s byte srcPixel = src[xc]; if (!transparent || srcPixel) { uint32 rgb = sourcePalette[srcPixel]; - rdst[0] = rgb & 0x000000FF; - rdst[1] = (rgb & 0x0000FF00) >> 8; - rdst[2] = (rgb & 0x00FF0000) >> 16; + rdst[1] = rgb & 0x000000FF; + rdst[2] = (rgb & 0x0000FF00) >> 8; + rdst[3] = (rgb & 0x00FF0000) >> 16; } rdst += 4; } @@ -691,9 +691,9 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f byte srcPixel = *wsrc; if (srcPixel) { uint32 rgb = sourcePalette[srcPixel]; - wdst[0] = rgb & 0x000000FF; - wdst[1] = (rgb & 0x0000FF00) >> 8; - wdst[2] = (rgb & 0x00FF0000) >> 16; + wdst[1] = rgb & 0x000000FF; + wdst[2] = (rgb & 0x0000FF00) >> 8; + wdst[3] = (rgb & 0x00FF0000) >> 16; } wdst += 4; xi += xs; @@ -718,9 +718,9 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f byte srcPixel = *wsrc; if (srcPixel) { uint32 rgb = sourcePalette[srcPixel]; - wdst[0] = rgb & 0x000000FF; - wdst[1] = (rgb & 0x0000FF00) >> 8; - wdst[2] = (rgb & 0x00FF0000) >> 16; + wdst[1] = rgb & 0x000000FF; + wdst[2] = (rgb & 0x0000FF00) >> 8; + wdst[3] = (rgb & 0x00FF0000) >> 16; } wdst += 4; xi += xs; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 4de50ee38f..d0d8d0adcd 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -115,8 +115,8 @@ GnapEngine::~GnapEngine() { } Common::Error GnapEngine::run() { - // Initialize the graphics mode to ARGB8888 - Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24); + // Initialize the graphics mode to RGBA8888 + Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); initGraphics(800, 600, true, &format); // We do not support color conversion yet -- cgit v1.2.3 From 3bf35331abd506805bbc64537d6fb9b7969d10e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 19 May 2016 00:13:01 +0200 Subject: GNAP: Add thumbnails, rewrite partially querySaveMetaInfos. Gnap's hand and device are in the middle of the screen, there's place for improvement --- engines/gnap/detection.cpp | 38 ++++++++++++++++++-------------------- engines/gnap/gnap.h | 2 +- engines/gnap/menu.cpp | 11 +++++++++-- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 616c26b04b..b68d64c4ed 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -88,10 +88,8 @@ bool GnapMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportCreationDate); -#if 0 (f == kSavesSupportThumbnail) || -#endif + (f == kSavesSupportCreationDate); } bool Gnap::GnapEngine::hasFeature(EngineFeature f) const { @@ -147,35 +145,35 @@ SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int s Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); if (file) { + char saveIdentBuffer[5]; + file->read(saveIdentBuffer, 5); - int32 version = file->readSint32BE(); - if (version != GNAP_SAVEGAME_VERSION) { + int32 version = file->readByte(); + if (version > GNAP_SAVEGAME_VERSION) { delete file; return SaveStateDescriptor(); } - uint32 saveNameLength = file->readUint16BE(); char saveName[256]; - file->read(saveName, saveNameLength); - saveName[saveNameLength] = 0; + char ch; + int i = 0; + while ((ch = (char)file->readByte()) != '\0') + saveName[i++] = ch; SaveStateDescriptor desc(slot, saveName); - Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); - desc.setThumbnail(thumbnail); - - uint32 saveDate = file->readUint32BE(); - uint16 saveTime = file->readUint16BE(); + if (version != 1) { + Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); + desc.setThumbnail(thumbnail); + } - int day = (saveDate >> 24) & 0xFF; - int month = (saveDate >> 16) & 0xFF; - int year = saveDate & 0xFFFF; + int year = file->readSint16LE(); + int month = file->readSint16LE(); + int day = file->readSint16LE(); + int hour = file->readSint16LE(); + int minutes = file->readSint16LE(); desc.setSaveDate(year, month, day); - - int hour = (saveTime >> 8) & 0xFF; - int minutes = saveTime & 0xFF; - desc.setSaveTime(hour, minutes); delete file; diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 7aa2221b1e..cb1c00d044 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -59,7 +59,7 @@ class GameSys; class SoundMan; class MusicPlayer; -#define GNAP_SAVEGAME_VERSION 1 +#define GNAP_SAVEGAME_VERSION 2 struct MouseButtonState { bool _left; diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index e2b28a6742..4381d2f1d3 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -25,6 +25,7 @@ #include "common/translation.h" #include "gui/saveload.h" +#include "graphics/thumbnail.h" #include "gnap/gnap.h" #include "gnap/datarchive.h" @@ -576,7 +577,7 @@ void GnapEngine::writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeade out->writeString(header._saveName); out->writeByte('\0'); - // TODO: Add thumbnail + Graphics::saveThumbnail(*out); // Write out the save date/time TimeDate td; @@ -608,7 +609,13 @@ bool GnapEngine::readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader & header._saveName += ch; // TODO: Get the thumbnail - header._thumbnail = nullptr; + if (header._version == 1) + header._thumbnail = nullptr; + else { + header._thumbnail = Graphics::loadThumbnail(*in); + if (!header._thumbnail) + return false; + } // Read in save date/time header._year = in->readSint16LE(); -- cgit v1.2.3 From 97ac77b5f1b41b77b5e9a79bac0f6a11a4063386 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 19 May 2016 07:06:48 +0200 Subject: GNAP: Compute the thumbnail when opening the device so that it doesn't show the large hand in savegames --- engines/gnap/gnap.cpp | 2 ++ engines/gnap/gnap.h | 2 ++ engines/gnap/menu.cpp | 11 ++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index d0d8d0adcd..435d0c7be6 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -97,6 +97,7 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : Engine::syncSoundSettings(); _scene = nullptr; _music = nullptr; + _tempThumbnail = nullptr; _wasSavegameLoaded = false; for (int i = 0; i < kMaxTimers; ++i) @@ -112,6 +113,7 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : GnapEngine::~GnapEngine() { delete _random; delete _music; + delete _tempThumbnail; } Common::Error GnapEngine::run() { diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index cb1c00d044..e6507ccb31 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -248,6 +248,8 @@ public: MusicPlayer *_music; Graphics::Font *_font; + Common::MemoryWriteStreamDynamic *_tempThumbnail; + int _lastUpdateClock; int _debugLevel; diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 4381d2f1d3..2196bb6409 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -210,8 +210,11 @@ void GnapEngine::runMenu() { _menuStatus = 0; _menuDone = false; - createMenuSprite();//??? CHECKME Crashes when done in loadStockDat() find out why + delete _tempThumbnail; + _tempThumbnail = new Common::MemoryWriteStreamDynamic; + Graphics::saveThumbnail(*_tempThumbnail); + createMenuSprite(); insertDeviceIconActive(); for (int i = 0; i < 7; ++i) { @@ -577,7 +580,9 @@ void GnapEngine::writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeade out->writeString(header._saveName); out->writeByte('\0'); - Graphics::saveThumbnail(*out); + // This implies the menu is used + // If we want to save/load at any time, then a check should be added + out->write(_tempThumbnail->getData(), _tempThumbnail->size()); // Write out the save date/time TimeDate td; @@ -608,7 +613,7 @@ bool GnapEngine::readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader & while ((ch = (char)in->readByte()) != '\0') header._saveName += ch; - // TODO: Get the thumbnail + // Get the thumbnail, saved in v2 or later if (header._version == 1) header._thumbnail = nullptr; else { -- cgit v1.2.3 From 9a2bc3c5720e807978fa8a302b5b3c532fb62d30 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 19 May 2016 07:59:07 +0200 Subject: GNAP: Add several checks on _gameDone in order to quit the game quickly --- engines/gnap/character.cpp | 11 ++++++----- engines/gnap/gnap.cpp | 17 ++++++----------- engines/gnap/menu.cpp | 3 +-- engines/gnap/scenes/arcade.cpp | 28 +++++++++++++--------------- engines/gnap/scenes/group0.cpp | 8 ++++---- engines/gnap/scenes/group1.cpp | 31 +++++++++++++++---------------- engines/gnap/scenes/group2.cpp | 27 +++++++++++++++------------ engines/gnap/scenes/group3.cpp | 2 +- engines/gnap/scenes/group4.cpp | 6 +++--- engines/gnap/scenes/group5.cpp | 24 ++++++++---------------- 10 files changed, 72 insertions(+), 85 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 46b5dc712d..706cb987fb 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -481,7 +481,7 @@ void PlayerGnap::useJointOnPlatypus() { plat._idleFacing = kDirNone; playSequence(0x107B5); walkStep(); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + while (_vm->_gameSys->getAnimationStatus(0) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); _vm->gameUpdateTick(); } @@ -511,7 +511,7 @@ void PlayerGnap::kissPlatypus(int callback) { plat._sequenceId = 0x7CB; plat._idleFacing = kDirNone; playSequence(0x107B5); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + while (_vm->_gameSys->getAnimationStatus(0) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); _vm->doCallback(callback); _vm->gameUpdateTick(); @@ -1120,7 +1120,7 @@ bool PlayerGnap::doPlatypusAction(int gridX, int gridY, int platSequenceId, int if (!_vm->isPointBlocked(checkPt) && (_pos != checkPt)) { walkTo(checkPt, 0, 0x107B9, 1); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + while (_vm->_gameSys->getAnimationStatus(0) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); _vm->doCallback(callback); _vm->gameUpdateTick(); @@ -1129,7 +1129,7 @@ bool PlayerGnap::doPlatypusAction(int gridX, int gridY, int platSequenceId, int if (_pos == plat._pos + Common::Point(gridX, gridY)) { _vm->_gameSys->setAnimation(platSequenceId, plat._id, 1); plat.playSequence(platSequenceId); - while (_vm->_gameSys->getAnimationStatus(1) != 2) { + while (_vm->_gameSys->getAnimationStatus(1) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); _vm->doCallback(callback); _vm->gameUpdateTick(); @@ -1145,8 +1145,9 @@ bool PlayerGnap::doPlatypusAction(int gridX, int gridY, int platSequenceId, int void PlayerGnap::useDisguiseOnPlatypus() { _vm->_gameSys->setAnimation(0x10846, _id, 0); playSequence(0x10846); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + while (_vm->_gameSys->getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); + _vm->_newSceneNum = 47; _vm->_isLeavingScene = true; _vm->_sceneDone = true; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 435d0c7be6..9af8128c06 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -241,7 +241,6 @@ void GnapEngine::updateEvents() { void GnapEngine::gameUpdateTick() { updateEvents(); - // TODO Check _gameDone in the various game loops if (shouldQuit()) { _gameDone = true; _sceneDone = true; @@ -307,13 +306,12 @@ void GnapEngine::resumeGame() { } void GnapEngine::updatePause() { - while (_isPaused) { + while (_isPaused && !_gameDone) { gameUpdateTick(); if (isKeyStatus1(Common::KEYCODE_p)) { clearKeyStatus1(Common::KEYCODE_p); resumeGame(); } - //_system->delayMillis(100); } } @@ -557,7 +555,7 @@ void GnapEngine::showFullScreenSprite(int resourceId) { setGrabCursorSprite(-1); addFullScreenSprite(resourceId, 256); while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && - !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29)) { + !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29) && !_gameDone) { gameUpdateTick(); } _mouseClickState._left = false; @@ -737,8 +735,6 @@ void GnapEngine::mainLoop() { deleteSurface(&_backgroundSurface); _dat->close(1); - // TODO freeMenuSprite(); - // TODO freeFont(); } void GnapEngine::initScene() { @@ -829,7 +825,6 @@ void GnapEngine::checkGameKeys() { pauseGame(); updatePause(); } - // TODO? Debug input } void GnapEngine::startSoundTimerA(int timerIndex) { @@ -911,14 +906,14 @@ void GnapEngine::updateIdleTimer() { void GnapEngine::screenEffect(int dir, byte r, byte g, byte b) { if (dir == 1) { - for (int y = 300; y < 600; y += 50) { + for (int y = 300; y < 600 && !_gameDone; y += 50) { _gameSys->fillSurface(nullptr, 0, y, 800, 50, r, g, b); _gameSys->fillSurface(nullptr, 0, 549 - y + 1, 800, 50, r, g, b); gameUpdateTick(); _system->delayMillis(50); } } else { - for (int y = 0; y < 300; y += 50) { + for (int y = 0; y < 300 && !_gameDone; y += 50) { _gameSys->fillSurface(nullptr, 0, y, 800, 50, r, g, b); _gameSys->fillSurface(nullptr, 0, 549 - y + 1, 800, 50, r, g, b); gameUpdateTick(); @@ -1000,13 +995,13 @@ void GnapEngine::playSequences(int fullScreenSpriteId, int sequenceId1, int sequ kSeqSyncWait, 0, 15 * (5 * _gnap->_pos.x - 25), 48 * (_gnap->_pos.y - 8)); _gnap->_sequenceId = sequenceId2; _gnap->_sequenceDatNum = 0; - while (_gameSys->getAnimationStatus(0) != 2) + while (_gameSys->getAnimationStatus(0) != 2 && !_gameDone) gameUpdateTick(); hideCursor(); addFullScreenSprite(fullScreenSpriteId, 255); _gameSys->setAnimation(sequenceId1, 256, 0); _gameSys->insertSequence(sequenceId1, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_gameSys->getAnimationStatus(0) != 2) + while (_gameSys->getAnimationStatus(0) != 2 && !_gameDone) gameUpdateTick(); _gameSys->setAnimation(sequenceId3, _gnap->_id, 0); _gameSys->insertSequence(sequenceId3, _gnap->_id, diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 2196bb6409..d7eaca02b4 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -427,9 +427,8 @@ void GnapEngine::updateMenuStatusMainMenu() { _gameSys->insertDirtyRect(dirtyRect); } - while (!_mouseClickState._left && !isKeyStatus1(28) && !isKeyStatus1(30) && !isKeyStatus1(29) && !_timers[2]) { + while (!_mouseClickState._left && !isKeyStatus1(28) && !isKeyStatus1(30) && !isKeyStatus1(29) && !_timers[2] && !_gameDone) gameUpdateTick(); - } playSound(0x108F5, false); _mouseClickState._left = false; diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 80c7c656c6..84662507f3 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -718,10 +718,12 @@ bool Scene50::updateEnergyBars(int newLeftBarPos, int newRightBarPos) { } void Scene50::waitForAnim(int animationIndex) { - while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { + GameSys& gameSys = *_vm->_gameSys; + + while (gameSys.getAnimationStatus(animationIndex) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); - } - _vm->_gameSys->setAnimation(0, 0, animationIndex); + + gameSys.setAnimation(0, 0, animationIndex); } int Scene50::checkInput() { @@ -945,7 +947,7 @@ void Scene50::run() { _vm->_timers[5] = 15; - while (!_fightDone) { + while (!_fightDone && !_vm->_gameDone) { /* TODO if (sceneXX_sub_4466B1()) _fightDone = true; @@ -1458,8 +1460,7 @@ bool Scene51::isJumping(int sequenceId) { } void Scene51::waitForAnim(int animationIndex) { - while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2) { - // pollMessages(); + while (_vm->_gameSys->getAnimationStatus(animationIndex) != 2 && _vm->_gameDone) { updateItemAnimations(); _vm->gameUpdateTick(); } @@ -1605,10 +1606,9 @@ void Scene51::winMinigame() { void Scene51::playCashAppearAnim() { _vm->_gameSys->setAnimation(0xC8, 252, 0); _vm->_gameSys->insertSequence(0xC8, 252, 0, 0, kSeqNone, 0, -20, -20); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + + while (_vm->_gameSys->getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); - // checkGameAppStatus(); - } } void Scene51::updateCash(int amount) { @@ -1726,8 +1726,7 @@ void Scene51::run() { isIdle = false; } - while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT) && _platypusNextSequenceId != 0x96) { - // pollMessages(); + while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT) && _platypusNextSequenceId != 0x96 && !_vm->_gameDone) { if (_platypusNextSequenceId == 0xB6) _platypusNextSequenceId = 0x76; updateItemAnimations(); @@ -1780,8 +1779,7 @@ void Scene51::run() { _vm->gameUpdateTick(); } - while (_vm->isKeyStatus2(Common::KEYCODE_LEFT) && _platypusNextSequenceId != 0xB6) { - // pollMessages(); + while (_vm->isKeyStatus2(Common::KEYCODE_LEFT) && _platypusNextSequenceId != 0xB6 && !_vm->_gameDone) { updateItemAnimations(); if (startWalk) { _platypusNextSequenceId = 0xA5; @@ -1879,7 +1877,7 @@ void Scene52::updateHotspots() { } void Scene52::update() { - for (int rowNum = 0; rowNum < 7; ++rowNum) { + for (int rowNum = 0; rowNum < 7 && !_vm->_gameDone; ++rowNum) { _vm->gameUpdateTick(); if (_vm->_gameSys->getAnimationStatus(_alienRowAnims[rowNum]) == 2) { updateAlienRow(rowNum); @@ -1936,7 +1934,7 @@ void Scene52::update() { loseShip(); if (_shipsLeft != 0) { _vm->_timers[3] = 40; - while (_vm->_timers[3]) { + while (_vm->_timers[3] && !_vm->_gameDone) { updateAlienCannons(); if (_shipCannonFiring) updateShipCannon(); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 25e0aaebe0..dfc6d7a739 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -1209,7 +1209,7 @@ void Scene03::updateAnimations() { _vm->addFullScreenSprite(0x106, 255); gameSys.setAnimation(0x1C9, 256, 1); gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); gameSys.setAnimation(0x1BA, 99, 1); @@ -1224,12 +1224,12 @@ void Scene03::updateAnimations() { gnap.playBrainPulsating(); gameSys.insertSequence(0x1BF, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); gameSys.setAnimation(0x1BF, 99, 1); - while (gameSys.getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->addFullScreenSprite(0x106, 255); gameSys.setAnimation(0x1C9, 256, 1); gameSys.insertSequence(0x1C9, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); gameSys.setAnimation(0x1BA, 99, 1); @@ -2191,7 +2191,7 @@ void Scene05::updateAnimations() { _nextChickenSequenceId = 0x14B; break; case kAS05GrabLadder: - while (gameSys.isSequenceActive(0x149, 39)) + while (gameSys.isSequenceActive(0x149, 39) && !_vm->_gameDone) _vm->gameUpdateTick(); gameSys.insertSequence(0x14E, gnap._id + 1, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0x14D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index f785c443f1..7b1e1e3625 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -1488,7 +1488,7 @@ void Scene13::showScribble() { _vm->_largeSprite = gameSys.createSurface(0x6F); gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && - !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29)) + !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29) && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->_mouseClickState._left = false; _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); @@ -2365,7 +2365,7 @@ void Scene17::platHangUpPhone() { plat._actionStatus = -1; gameSys.setAnimation(0x257, 254, 4); gameSys.insertSequence(0x257, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (gameSys.getAnimationStatus(4) != 2) + while (gameSys.getAnimationStatus(4) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); gameSys.setAnimation(0x25B, plat._id, 1); gameSys.insertSequence(0x25B, plat._id, plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, kSeqSyncWait, 0, 0, 0); @@ -2374,7 +2374,7 @@ void Scene17::platHangUpPhone() { _currPhoneSequenceId = -1; _nextPhoneSequenceId = -1; _vm->clearFlag(kGFPlatypusTalkingToAssistant); - while (gameSys.getAnimationStatus(1) != 2) + while (gameSys.getAnimationStatus(1) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); gnap._actionStatus = savedGnapActionStatus; _vm->updateMouseCursor(); @@ -3272,7 +3272,7 @@ void Scene18::putDownGarbageCan(int animationIndex) { PlayerGnap& gnap = *_vm->_gnap; if (animationIndex >= 0) { - while (gameSys.getAnimationStatus(animationIndex) != 2) + while (gameSys.getAnimationStatus(animationIndex) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); } if (gnap._idleFacing != kDirNone && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) @@ -3296,7 +3296,7 @@ void Scene18::putDownGarbageCan(int animationIndex) { gameSys.insertSequence(0x1FB, 19, 0, 0, kSeqNone, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); gameSys.setAnimation(0x1FA, 19, 4); gameSys.insertSequence(0x1FA, 19, 507, 19, kSeqSyncWait, 0, 15 * (5 * _vm->_s18GarbageCanPos - 40), 0); - while (gameSys.getAnimationStatus(4) != 2) + while (gameSys.getAnimationStatus(4) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); } @@ -3311,7 +3311,7 @@ void Scene18::platEndPhoning(bool platFl) { if (_currPhoneSequenceId != -1) { gameSys.setAnimation(0x21E, 254, 3); gameSys.insertSequence(0x21E, 254, _currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); - while (gameSys.getAnimationStatus(3) != 2) + while (gameSys.getAnimationStatus(3) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); } gameSys.removeSequence(0x21F, 254, true); @@ -3352,7 +3352,7 @@ void Scene18::closeHydrantValve() { void Scene18::waitForGnapAction() { PlayerGnap& gnap = *_vm->_gnap; - while (gnap._actionStatus >= 0) { + while (gnap._actionStatus >= 0 && !_vm->_gameDone) { updateAnimations(); _vm->gameUpdateTick(); } @@ -3890,7 +3890,7 @@ void Scene18::updateAnimations() { gameSys.removeSequence(0x20C, 19, true); gameSys.setAnimation(0x217, 39, 5); gameSys.insertSequence(0x217, 39, 0x216, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(5) != 2) + while (gameSys.getAnimationStatus(5) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20E, 39, 0, 0, kSeqNone, 0, 0, 0); @@ -3927,7 +3927,7 @@ void Scene18::updateAnimations() { _cowboyHatSurface = _vm->addFullScreenSprite(0x1D2, 255); gameSys.setAnimation(0x218, 256, 0); gameSys.insertSequence(0x218, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->_newSceneNum = 18; _vm->invAdd(kItemCowboyHat); @@ -3992,7 +3992,7 @@ void Scene18::updateAnimations() { gameSys.removeSequence(0x20B, 19, true); gameSys.setAnimation(0x213, 39, 5); gameSys.insertSequence(0x214, 39, 0x213, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(5) != 2) + while (gameSys.getAnimationStatus(5) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); @@ -4008,7 +4008,7 @@ void Scene18::updateAnimations() { gameSys.removeSequence(0x20B, 19, true); gameSys.setAnimation(0x211, 39, 5); gameSys.insertSequence(0x212, 39, 0x211, 39, kSeqLoop | kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(5) != 2) + while (gameSys.getAnimationStatus(5) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->playSound(0x22B, true); gameSys.insertSequence(0x20D, 39, 0, 0, kSeqNone, 0, 0, 0); @@ -4411,10 +4411,9 @@ void Scene19::updateAnimations() { _pictureSurface = _vm->addFullScreenSprite(0xF, 255); gameSys.setAnimation(0x61, 256, 0); gameSys.insertSequence(0x61, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) { - // checkGameAppStatus(); + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); - } + _vm->setFlag(kGFUnk27); _vm->showCursor(); _vm->_newSceneNum = 17; @@ -4454,9 +4453,9 @@ void Scene19::updateAnimations() { _currShopAssistantSequenceId = _nextShopAssistantSequenceId; _nextShopAssistantSequenceId = -1; _vm->_timers[5] = 10; - while (_vm->_timers[5]) { + while (_vm->_timers[5] && !_vm->_gameDone) _vm->gameUpdateTick(); - } + gnap.playIdle(Common::Point(6, 2)); gnap._actionStatus = -1; break; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 380bb0ba67..2bee320b72 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -205,10 +205,9 @@ void Scene20::run() { _vm->endSceneInit(); gameSys.setAnimation(0x182, 140, 0); gameSys.insertSequence(0x182, 140, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) { - // checkGameAppStatus(); + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); - } + gnap.initPos(11, 8, kDirBottomLeft); plat.initPos(11, 9, kDirUnk4); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); @@ -623,7 +622,7 @@ void Scene20::updateAnimations() { _vm->addFullScreenSprite(0x12C, 255); gameSys.setAnimation(0x181, 256, 0); gameSys.insertSequence(0x181, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); @@ -1088,9 +1087,9 @@ void Scene22::run() { gameSys.drawSpriteToBackground(0, 0, 0x44); gameSys.setAnimation(storeDetectiveSeqId, 256, 4); gameSys.insertSequence(storeDetectiveSeqId, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(4) != 2) { + while (gameSys.getAnimationStatus(4) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); - } + _vm->_sceneDone = true; _vm->_newSceneNum = 20; _caughtBefore = true; @@ -1316,8 +1315,9 @@ void Scene23::run() { gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); } else { gnap.walkTo(Common::Point(2, 7), 0, 0x107B9, 1); - while (gameSys.getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); + _vm->playSequences(0x48, 0xBA, 0xBB, 0xBC); _vm->setFlag(kGFUnk24); } @@ -1800,7 +1800,7 @@ void Scene25::playAnims(int index) { gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); _vm->delayTicksCursor(5); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && - !_vm->isKeyStatus1(29)) { + !_vm->isKeyStatus1(29) && !_vm->_gameDone) { _vm->gameUpdateTick(); } _vm->_mouseClickState._left = false; @@ -2767,7 +2767,7 @@ void Scene28::run() { _nextClownSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 80; gnap._actionStatus = kAS28GnapWaiting; - while (gameSys.getAnimationStatus(3) != 2) { + while (gameSys.getAnimationStatus(3) != 2 && !_vm->_gameDone) { _vm->gameUpdateTick(); _vm->updateMouseCursor(); } @@ -3001,8 +3001,9 @@ void Scene28::updateAnimations() { _vm->addFullScreenSprite(0xF6, 255); gameSys.setAnimation(0x120, 256, 0); gameSys.insertSequence(0x120, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); + _vm->removeFullScreenSprite(); _vm->showCursor(); _vm->setGrabCursorSprite(kItemHorn); @@ -3381,10 +3382,12 @@ void Scene29::updateAnimations() { _currMonkeySequenceId = 0xE6; _nextMonkeySequenceId = -1; _vm->_timers[5] = 30; - while (_vm->_timers[5]) + while (_vm->_timers[5] && !_vm->_gameDone) _vm->gameUpdateTick(); + _vm->_plat->walkTo(Common::Point(0, 8), 1, 0x107CF, 1); - while (gameSys.getAnimationStatus(1) != 2) + + while (gameSys.getAnimationStatus(1) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); } else if (_nextMonkeySequenceId == -1) { switch (_vm->getRandom(6)) { diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index b700d6e2f4..6c93057346 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -238,7 +238,7 @@ void Scene30::updateAnimations() { gameSys.removeSequence(0x105, gnap._id, true); gameSys.setAnimation(0x102, 256, 0); gameSys.insertSequence(0x102, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); gameSys.setAnimation(0x103, gnap._id, 0); gameSys.insertSequence(0x103, gnap._id, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 810e4bfdfc..7a5de8d37e 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -1139,7 +1139,7 @@ void Scene42::updateAnimations() { _vm->addFullScreenSprite(0x13E, 255); gameSys.setAnimation(0x151, 256, 0); gameSys.insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); @@ -2189,7 +2189,7 @@ void Scene45::run() { _vm->setGrabCursorSprite(-1); gameSys.setAnimation(0x9D, gnap._id, 0); gameSys.insertSequence(0x9D, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) { + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) { _vm->gameUpdateTick(); if (gameSys.getAnimationStatus(2) == 2) { gameSys.setAnimation(0, 0, 2); @@ -2211,7 +2211,7 @@ void Scene45::run() { _vm->addFullScreenSprite(0x8A, 255); gameSys.setAnimation(0xA0, 256, 0); gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); - while (gameSys.getAnimationStatus(0) != 2) + while (gameSys.getAnimationStatus(0) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); gameSys.setAnimation(0x107BD, gnap._id, 0); gameSys.insertSequence(0x107BD, gnap._id, diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index 2788a43ac1..a359da21db 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -89,8 +89,7 @@ int Scene53::pressPhoneNumberButton(int phoneNumber, int buttonNum) { } gnap._actionStatus = 6; - while (gameSys.getAnimationStatus(6) != 2) { - // checkGameAppStatus(); + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); _vm->gameUpdateTick(); } @@ -141,9 +140,8 @@ void Scene53::runRandomCall() { } gnap._actionStatus = 1; - while (gameSys.getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); - // checkGameAppStatus(); _vm->gameUpdateTick(); } gnap._actionStatus = -1; @@ -159,9 +157,8 @@ void Scene53::runChitChatLine() { gameSys.insertSequence(0x6E, 1, 0, 0, kSeqNone, 16, 0, 0); gnap._actionStatus = 1; - while (gameSys.getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); - // checkGameAppStatus(); _vm->gameUpdateTick(); } gnap._actionStatus = -1; @@ -225,18 +222,16 @@ void Scene53::runChitChatLine() { gameSys.setAnimation(sequenceId, 1, 6); gameSys.insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0); gnap._actionStatus = 1; - while (gameSys.getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); - // checkGameAppStatus(); _vm->gameUpdateTick(); } gnap._actionStatus = -1; gameSys.setAnimation(0x72, 1, 6); gameSys.insertSequence(0x72, 1, 0, 0, kSeqNone, 16, 0, 0); gnap._actionStatus = 1; - while (gameSys.getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); - // checkGameAppStatus(); _vm->gameUpdateTick(); } gnap._actionStatus = -1; @@ -250,9 +245,8 @@ void Scene53::runChitChatLine() { if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); - // checkGameAppStatus(); _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; @@ -317,9 +311,8 @@ void Scene53::run() { if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); - // checkGameAppStatus(); _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; @@ -359,9 +352,8 @@ void Scene53::run() { if (_vm->isFlag(kGFSpringTaken)) { gameSys.setAnimation(0x73, 40, 6); gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0); - while (gameSys.getAnimationStatus(6) != 2) { + while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); - // checkGameAppStatus(); _vm->gameUpdateTick(); } _currHandSequenceId = 0x73; -- cgit v1.2.3 From ba61f90eb6324ceb9f6759a78de06136d1c3be5b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 01:21:22 +0200 Subject: GNAP: Rework the code of Scene07::run, remove an obsolete todo --- engines/gnap/gnap.cpp | 1 - engines/gnap/scenes/group0.cpp | 29 ++++++++++------------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 9af8128c06..541d062efb 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -246,7 +246,6 @@ void GnapEngine::gameUpdateTick() { _sceneDone = true; } - // TODO Improve this (variable frame delay to keep ~15fps) int currClock = _system->getMillis(); if (currClock >= _lastUpdateClock + 66) { _gameSys->fatUpdate(); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index dfc6d7a739..729ef96f64 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -2830,28 +2830,19 @@ void Scene07::run() { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; int gnapRandomValue = _vm->getRandom(20); - // TODO Cleanup if (plat._idleFacing != kDirNone) { - if (gnapRandomValue != 0 || plat._sequenceId != 0x7CA) { - if (gnapRandomValue != 1 || plat._sequenceId != 0x7CA) { - if (plat._pos.y == 9) - plat.playSequence(0x107CA); - } else { - plat.playSequence(0x10845); - } - } else { + if (gnapRandomValue == 0 && plat._sequenceId == 0x7CA) plat.playSequence(0x107CC); - } - } else if (gnapRandomValue != 0 || plat._sequenceId != 0x7C9) { - if (gnapRandomValue != 1 || plat._sequenceId != 0x7C9) { - if (plat._pos.y == 9) - plat.playSequence(0x107C9); - } else { + else if (gnapRandomValue == 1 && plat._sequenceId == 0x7CA) + plat.playSequence(0x10845); + else if (plat._pos.y == 9) + plat.playSequence(0x107CA); + } else if (gnapRandomValue == 0 && plat._sequenceId == 0x7C9) + plat.playSequence(0x107CB); + else if (gnapRandomValue == 1 && plat._sequenceId == 0x7C9) plat.playSequence(0x10844); - } - } else { - plat.playSequence(0x107CB); - } + else if (plat._pos.y == 9) + plat.playSequence(0x107C9); gameSys.setAnimation(plat._sequenceId | (plat._sequenceDatNum << 16), plat._id, 1); } } else { -- cgit v1.2.3 From 8a112ec92d57f7c05739e7681930289d9f9da431 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 06:59:38 +0200 Subject: GNAP: Enable a clown sequence which wasn't used in the original due to a bug --- engines/gnap/scenes/group2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 2bee320b72..78f7c04774 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -3036,13 +3036,15 @@ void Scene28::updateAnimations() { gnap.walkTo(Common::Point(2, 8), -1, 0x107BB, 1); break; case kAS28TalkClown: - _clownTalkCtr = (_clownTalkCtr + 1) % 2; + // The original was only using the first two sequences, + // due to a bug. + _clownTalkCtr = (_clownTalkCtr + 1) % 3; if (_clownTalkCtr == 0) _nextClownSequenceId = 0x11D; else if (_clownTalkCtr == 1) _nextClownSequenceId = 0x11E; else if (_clownTalkCtr == 2) - _nextClownSequenceId = 0x11F; // NOTE CHECKME Never set, bug in the original? + _nextClownSequenceId = 0x11F; break; case kAS28GnapWaiting: gnap._actionStatus = -1; -- cgit v1.2.3 From 20b3d1814a54c5f82e29e141ebf61f572767840c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 07:00:50 +0200 Subject: GNAP: Remove some CHECKME's --- engines/gnap/character.cpp | 14 ++++++++++---- engines/gnap/gnap.cpp | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 706cb987fb..575e3f3dd9 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -676,8 +676,11 @@ int PlayerGnap::getWalkSequenceId(int deltaX, int deltaY) { 0x7AD, 0x000, 0x7AE, 0x7B1, 0x000, 0x7B3 }; - // CHECKME This is a little weird - return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; + + int id = 3 * (deltaX + 1) + deltaY + 1; + assert(id >= 0 && id < 9); + + return walkSequenceIds[id]; } bool PlayerGnap::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { @@ -1275,8 +1278,11 @@ int PlayerPlat::getWalkSequenceId(int deltaX, int deltaY) { 0x7C4, 0x000, 0x7C7, 0x7C3, 0x000, 0x7C6 }; - // CHECKME This is a little weird - return walkSequenceIds[3 * deltaX + 3 + 1 + deltaY]; + + int id = 3 * (deltaX + 1) + deltaY + 1; + assert(id >= 0 && id < 9); + + return walkSequenceIds[id]; } bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 541d062efb..d6ec44cfc5 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -1049,7 +1049,6 @@ void GnapEngine::toyUfoFlyTo(int destX, int destY, int minX, int maxX, int minY, if (destY == -1) destY = _leftClickMouseY; - //CHECKME int clippedDestX = CLIP(destX, minX, maxX); int clippedDestY = CLIP(destY, minY, maxY); int dirX = 0, dirY = 0; // 0, -1 or 1 -- cgit v1.2.3 From f734291abb883278c51e35122e4342d6bef8abfd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 07:47:16 +0200 Subject: GNAP: Implement delayTicks functions, refactor them to share code --- engines/gnap/gnap.cpp | 29 +++++++++++++++++++++++------ engines/gnap/gnap.h | 5 +++-- engines/gnap/scenes/arcade.cpp | 8 ++++---- engines/gnap/scenes/group1.cpp | 2 +- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index d6ec44cfc5..5175d0702b 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -327,14 +327,31 @@ int GnapEngine::loadSavegame(int savegameNum) { return 1; } -void GnapEngine::delayTicks(int a1) { - // TODO - gameUpdateTick(); +void GnapEngine::delayTicks(int val, int idx = 0, bool updateCursor = false) { + int startTick = _timers[idx]; + + _timers[idx] = val; + + while (_timers[idx] && !_gameDone) { + gameUpdateTick(); + + if (updateCursor) + updateGrabCursorSprite(0, 0); + } + + startTick -= _timers[idx]; + if (startTick < 0) + startTick = 0; + + _timers[idx] = startTick; +} + +void GnapEngine::delayTicksA(int val, int idx) { + delayTicks(val, idx); } -void GnapEngine::delayTicksCursor(int a1) { - // TODO - gameUpdateTick(); +void GnapEngine::delayTicksCursor(int val) { + delayTicks(val, 0, true); } void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags, diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index e6507ccb31..0f45dc2e7f 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -325,8 +325,9 @@ public: void writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeader &header); static bool readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &header); - void delayTicks(int a1); - void delayTicksCursor(int a1); + void delayTicks(int val, int idx, bool updateCursor); + void delayTicksA(int val, int idx); + void delayTicksCursor(int val); void setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags = 0, int16 walkX = -1, int16 walkY = -1); diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 84662507f3..eddb29d2ca 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -616,11 +616,11 @@ void Scene50::playWinAnim(int tongueNum, bool fightOver) { waitForAnim(6); waitForAnim(5); } - // TODO delayTicksA(1, 7); + _vm->delayTicksA(1, 7); } void Scene50::delayTicks() { - // TODO delayTicksA(3, 7); + _vm->delayTicksA(3, 7); } void Scene50::initRound() { @@ -941,7 +941,7 @@ void Scene50::run() { _vm->setGrabCursorSprite(-1); _vm->hideCursor(); - // TODO delayTicksA(1, 7); + _vm->delayTicksA(1, 7); playRoundAnim(_roundNum); @@ -1598,7 +1598,7 @@ int Scene51::incCashAmount(int sequenceId) { void Scene51::winMinigame() { updateCash(1995); _vm->playSound(0xDA, false); - // TODO delayTicksA(1, 5); + _vm->delayTicksA(1, 5); _vm->_newSceneNum = 48; _vm->invRemove(kItemBanana); } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 7b1e1e3625..52767e1a23 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -2530,7 +2530,7 @@ void Scene17::run() { gameSys.insertSequence(0x107C1, plat._id, 0x241, plat._id, kSeqScale | kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); - // TODO delayTicksA(2, 9); + _vm->delayTicksA(2, 9); _vm->endSceneInit(); plat._sequenceId = 0x7C1; plat._sequenceDatNum = 1; -- cgit v1.2.3 From 85417c15bb56593ccc062e42e29712968b6857e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 07:51:53 +0200 Subject: GNAP: Remove obsolete TODOs --- engines/gnap/scenes/arcade.cpp | 7 ------- engines/gnap/scenes/group0.cpp | 1 - 2 files changed, 8 deletions(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index eddb29d2ca..da66829a31 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -948,11 +948,6 @@ void Scene50::run() { _vm->_timers[5] = 15; while (!_fightDone && !_vm->_gameDone) { - /* TODO - if (sceneXX_sub_4466B1()) - _fightDone = true; - */ - int playerSequenceId = checkInput(); if (playerSequenceId != -1) _leftTongueNextSequenceId = playerSequenceId; @@ -985,8 +980,6 @@ void Scene50::run() { _vm->gameUpdateTick(); } - // freeFont(); - _vm->_gameSys->setAnimation(0, 0, 7); _vm->_gameSys->setAnimation(0, 0, 6); _vm->_gameSys->setAnimation(0, 0, 5); diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 729ef96f64..d958b296a8 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -1388,7 +1388,6 @@ void Scene04::run() { if (_vm->isFlag(kGFPlatypusDisguised)) { _vm->_timers[3] = 300; - // TODO setCursor((LPCSTR)IDC_WAIT); _vm->setGrabCursorSprite(kItemKeys); gnap._pos = Common::Point(4, 7); gnap._id = 140; -- cgit v1.2.3 From 72d46655ff5c657d776737aa3abc5b8f32c27ba9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 07:59:19 +0200 Subject: GNAP: Remove TODOs, add safeguard checks --- engines/gnap/gamesys.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 3bb96f33b4..c2c0e42a8a 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -786,8 +786,6 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & void GameSys::drawSprites() { debugC(kDebugBasic, "GameSys::drawSprites() _gfxItemsCount: %d", _gfxItemsCount); - // TODO Split into multiple functions for clarity - // Restore dirty background and collect rects to be redrawn for all sprites // which aren't marked to be redrawn yet Common::Rect intersectingRect; @@ -853,7 +851,7 @@ void GameSys::drawSprites() { if (gfxItem5->_flags & 1) { seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, nullptr); } else if (gfxItem5->_flags & 2) { - // TODO seqDrawAviFrame(gfxItem5->currFrame.spriteId, &gfxItem5->currFrame, 0, gfxItem5->flags & 8); + error("drawSprites - Unexpected AVI frame"); } else { int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); @@ -866,11 +864,7 @@ void GameSys::drawSprites() { for (int n = 0; n < gfxItem5->_updRectsCount; ++n) seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_prevFrame, &gfxItem5->_updRects[n]); } else if (gfxItem5->_flags & 2) { - /* TODO - spriteData4 = gfxItem5->prevFrame.spriteId; - for (int n = 0; n < gfxItem5->updRectsCount; ++n) - seqDrawAviFrame(spriteData4, &gfxItem5->prevFrame, &gfxItem5->updRects[n], gfxItem5->flags & 8); - */ + error("drawSprites - Unexpected AVI frame"); } else { int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_prevFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); -- cgit v1.2.3 From a2fb71928b9d1fa6e99768ea11c35303f9d98d81 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 08:04:56 +0200 Subject: GNAP: Remove some unused variables in resources --- engines/gnap/gamesys.cpp | 10 ---------- engines/gnap/resource.cpp | 13 +++++++++---- engines/gnap/resource.h | 4 ---- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index c2c0e42a8a..7cfa01610c 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -123,7 +123,6 @@ void GameSys::requestClear2(bool resetFl) { gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else { gfxItem->_updFlag = false; @@ -463,7 +462,6 @@ void GameSys::seqInsertGfx(int index, int duration) { gfxItem->_prevFrame._duration = 0; gfxItem->_prevFrame._spriteId = -1; gfxItem->_prevFrame._soundId = -1; - gfxItem->_prevFrame._unusedVal = -1; int totalDuration = duration; if ((seqItem->_flags & 4) && totalDuration > 0) { gfxItem->_prevFrame._duration = 1; @@ -530,7 +528,6 @@ void GameSys::seqRemoveGfx(int sequenceId, int id) { gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; ++gfxIndex; gfxItem = &_gfxItems[gfxIndex]; @@ -960,7 +957,6 @@ void GameSys::handleReqRemoveSequenceItems() { gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else { gfxItem->_updFlag = false; @@ -983,7 +979,6 @@ void GameSys::handleReqRemoveSpriteDrawItems() { gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } } @@ -1024,14 +1019,12 @@ void GameSys::fatUpdateFrame() { gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else if (!seqItem) { gfxItem->_animation = nullptr; gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; } else if ((seqItem->_flags & 4) && clockDelta > 1) { if (gfxItem->_delayTicks < clockDelta) { @@ -1133,13 +1126,11 @@ void GameSys::fatUpdateFrame() { gfxItem->_prevFrame._duration = 0; gfxItem->_prevFrame._spriteId = -1; gfxItem->_prevFrame._soundId = -1; - gfxItem->_prevFrame._unusedVal = -1; gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._isScaled = false; gfxItem->_currFrame._rect = _newSpriteDrawItems[k]._rect; gfxItem->_currFrame._spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; } } _newSpriteDrawItemsCount = 0; @@ -1155,7 +1146,6 @@ void GameSys::fatUpdateFrame() { gfxItem->_currFrame._rect = _grabSpriteRect; gfxItem->_currFrame._spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO gfxItem->_currFrame._soundId = -1; - gfxItem->_currFrame._unusedVal = -1; gfxItem->_updFlag = true; gfxItem->_surface = _grabSpriteSurface2; break; diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index 9936324c2b..bb5dba0382 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -36,7 +36,9 @@ void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) { _rect.bottom = stream.readUint32LE(); _spriteId = stream.readUint32LE(); _soundId = stream.readUint32LE(); - _unusedVal = stream.readUint32LE(); + + // Skip an unused value + stream.readUint32LE(); debugC(kDebugBasic, "SequenceFrame() spriteId: %d; soundId: %d", _spriteId, _soundId); } @@ -44,8 +46,9 @@ void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) { // SequenceAnimation void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) { - _unusedVal1 = stream.readUint16LE(); - _unusedVal2 = stream.readUint16LE(); + // Skip two unused values + stream.readUint32LE(); + _additionalDelay = stream.readUint32LE(); _framesCount = stream.readUint16LE(); _maxTotalDuration = stream.readUint16LE(); @@ -59,7 +62,9 @@ void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) { SequenceResource::SequenceResource(int resourceId, byte *data, uint32 size) { Common::MemoryReadStream stream(data, size, DisposeAfterUse::NO); - _unusedVal1 = stream.readUint32LE(); + // Skip an unused value + stream.readUint32LE(); + _sequenceId = stream.readUint32LE(); _defaultId = stream.readUint32LE(); _sequenceId2 = stream.readUint32LE(); diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 35787fa48d..1b228de81e 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -51,13 +51,10 @@ struct SequenceFrame { Common::Rect _rect; int32 _spriteId; int32 _soundId; - int32 _unusedVal; void loadFromStream(Common::MemoryReadStream &stream); }; struct SequenceAnimation { - int16 _unusedVal1; - int16 _unusedVal2; int32 _additionalDelay; int16 _framesCount; int16 _maxTotalDuration; @@ -72,7 +69,6 @@ public: SequenceResource(int resourceId, byte *data, uint32 size); ~SequenceResource(); public: - uint32 _unusedVal1; int32 _sequenceId; int32 _defaultId; int32 _sequenceId2; -- cgit v1.2.3 From 7da6d9937114d962ab4e8eea532e224b5e262128 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 20 May 2016 20:56:32 +0200 Subject: GNAP: Fix transparency --- engines/gnap/gamesys.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 7cfa01610c..c10806d918 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -651,6 +651,7 @@ void GameSys::blitSprite32(Graphics::Surface *destSurface, int x, int y, byte *s byte srcPixel = src[xc]; if (!transparent || srcPixel) { uint32 rgb = sourcePalette[srcPixel]; + rdst[0] = 0xFF; rdst[1] = rgb & 0x000000FF; rdst[2] = (rgb & 0x0000FF00) >> 8; rdst[3] = (rgb & 0x00FF0000) >> 16; @@ -688,6 +689,7 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f byte srcPixel = *wsrc; if (srcPixel) { uint32 rgb = sourcePalette[srcPixel]; + wdst[0] = 0xFF; wdst[1] = rgb & 0x000000FF; wdst[2] = (rgb & 0x0000FF00) >> 8; wdst[3] = (rgb & 0x00FF0000) >> 16; @@ -715,6 +717,7 @@ void GameSys::blitSpriteScaled32(Graphics::Surface *destSurface, Common::Rect &f byte srcPixel = *wsrc; if (srcPixel) { uint32 rgb = sourcePalette[srcPixel]; + wdst[0] = 0xFF; wdst[1] = rgb & 0x000000FF; wdst[2] = (rgb & 0x0000FF00) >> 8; wdst[3] = (rgb & 0x00FF0000) >> 16; -- cgit v1.2.3 From 3f2fcec10b84294bef258e9bad24e72eafbee9ee Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 20 May 2016 20:59:33 +0200 Subject: GNAP: Fix sprite transparency --- engines/gnap/gamesys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index c10806d918..36a7c4524c 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -224,7 +224,7 @@ void GameSys::drawSpriteToBackground(int x, int y, int resourceId) { int spriteWidth = spriteResource->_width; int spriteHeight = spriteResource->_height; Common::Rect dstRect(0, 0, spriteWidth, spriteHeight); - blitSprite32(_backgroundSurface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, true);//spriteResource->_transparent != 0); + blitSprite32(_backgroundSurface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, spriteResource->_transparent != 0); _vm->_spriteCache->release(resourceId); // Add dirty rect so the modified background is redrawn -- cgit v1.2.3 From 3981d8514e00b9094d7119e5c251e74006c03b84 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 21:46:19 +0200 Subject: GNAP: Remove erroneous comments, simplify a call to blitSprite32 --- engines/gnap/gamesys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 36a7c4524c..eedd7fa534 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -224,7 +224,7 @@ void GameSys::drawSpriteToBackground(int x, int y, int resourceId) { int spriteWidth = spriteResource->_width; int spriteHeight = spriteResource->_height; Common::Rect dstRect(0, 0, spriteWidth, spriteHeight); - blitSprite32(_backgroundSurface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, spriteResource->_transparent != 0); + blitSprite32(_backgroundSurface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, spriteResource->_transparent); _vm->_spriteCache->release(resourceId); // Add dirty rect so the modified background is redrawn @@ -255,7 +255,7 @@ void GameSys::drawSpriteToSurface(Graphics::Surface *surface, int x, int y, int uint32 *sourcePalette = spriteResource->_palette; byte *sourcePixels = spriteResource->_pixels; Common::Rect dstRect(0, 0, spriteResource->_width, spriteResource->_height); - blitSprite32(surface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, true);//spriteResource->_transparent != 0); + blitSprite32(surface, x, y, sourcePixels, spriteResource->_width, dstRect, sourcePalette, true); _vm->_spriteCache->release(resourceId); } @@ -779,7 +779,7 @@ void GameSys::seqDrawSpriteFrame(SpriteResource *spriteResource, SequenceFrame & blitSpriteScaled32(_frontSurface, frame._rect, clipRect, sourcePixels, spriteResource->_width, sourceRect, sourcePalette); } else { clipRect.translate(-frame._rect.left, -frame._rect.top); - blitSprite32(_frontSurface, x, y, sourcePixels, spriteResource->_width, clipRect, sourcePalette, true);//spriteResource->_transparent != 0); + blitSprite32(_frontSurface, x, y, sourcePixels, spriteResource->_width, clipRect, sourcePalette, true); } } -- cgit v1.2.3 From bd4ef7ffb4db991df8f3cbc6619f54cb599fb535 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 21:56:12 +0200 Subject: GNAP: Rework gfxItem, remove the code related to impossible flag values --- engines/gnap/gamesys.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index eedd7fa534..3285985474 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -803,7 +803,7 @@ void GameSys::drawSprites() { if (gfxItem2->_prevFrame._spriteId != -1) { bool transparent = false; - if (gfxItem2->_currFrame._spriteId != -1 && !(gfxItem2->_flags & 2)) { + if (gfxItem2->_currFrame._spriteId != -1) { if (gfxItem2->_flags & 1) { transparent = true; } else { @@ -813,8 +813,7 @@ void GameSys::drawSprites() { _vm->_spriteCache->release(resourceId); } } - if ((gfxItem2->_flags & 8) || gfxItem2->_currFrame._spriteId == -1 || - (!(gfxItem2->_flags & 2) && (!gfxItem2->_prevFrame._rect.equals(gfxItem2->_currFrame._rect) || !transparent))) { + if (gfxItem2->_currFrame._spriteId == -1 || !gfxItem2->_prevFrame._rect.equals(gfxItem2->_currFrame._rect) || !transparent) { restoreBackgroundRect(gfxItem2->_prevFrame._rect); for (int l = 0; l < _gfxItemsCount; ++l) _gfxItems[l].testUpdRect(gfxItem2->_prevFrame._rect); @@ -825,15 +824,13 @@ void GameSys::drawSprites() { bool transparent = false; if (gfxItem2->_flags & 1) { transparent = true; - } else if (!(gfxItem2->_flags & 2)) { + } else { int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); transparent = spriteResource->_transparent; _vm->_spriteCache->release(resourceId); } - if (((gfxItem2->_flags & 2) && !(gfxItem2->_flags & 8)) || - gfxItem2->_prevFrame._spriteId == -1 || - !gfxItem2->_prevFrame._rect.equals(gfxItem2->_currFrame._rect) || transparent) { + if (gfxItem2->_prevFrame._spriteId == -1 || !gfxItem2->_prevFrame._rect.equals(gfxItem2->_currFrame._rect) || transparent) { for (int l = k; l < _gfxItemsCount; ++l) _gfxItems[l].testUpdRect(gfxItem2->_currFrame._rect); } @@ -850,8 +847,6 @@ void GameSys::drawSprites() { if (gfxItem5->_currFrame._spriteId != -1) { if (gfxItem5->_flags & 1) { seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, nullptr); - } else if (gfxItem5->_flags & 2) { - error("drawSprites - Unexpected AVI frame"); } else { int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); @@ -863,8 +858,6 @@ void GameSys::drawSprites() { if (gfxItem5->_flags & 1) { for (int n = 0; n < gfxItem5->_updRectsCount; ++n) seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_prevFrame, &gfxItem5->_updRects[n]); - } else if (gfxItem5->_flags & 2) { - error("drawSprites - Unexpected AVI frame"); } else { int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_prevFrame._spriteId; SpriteResource *spriteResource = _vm->_spriteCache->get(resourceId); @@ -1008,13 +1001,8 @@ void GameSys::fatUpdateFrame() { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; SequenceAnimation *animation = gfxItem->_animation; - if ((gfxItem->_sequenceId != -1 && animation) || (gfxItem->_flags & 2) || - gfxItem->_prevFrame._spriteId != -1 || gfxItem->_prevFrame._duration > 0) { - if (gfxItem->_sequenceId == -1 || gfxItem->_updFlag) { - if ((gfxItem->_flags & 2) && !gfxItem->_updFlag) { - // NOTE Skipped avi code - } - } else { + if ((gfxItem->_sequenceId != -1 && animation) || gfxItem->_prevFrame._spriteId != -1 || gfxItem->_prevFrame._duration > 0) { + if (gfxItem->_sequenceId != -1 && !gfxItem->_updFlag) { Sequence *seqItem = seqFind(gfxItem->_sequenceId, gfxItem->_id, nullptr); if (!animation) { gfxItem->_sequenceId = -1; -- cgit v1.2.3 From bd2008f9859eea09fa835e24f7b56316f3d84360 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 May 2016 22:04:10 +0200 Subject: GNAP: Remove some obsolete comments, take better advantage of the possible values of gfxItem._flags (0 and 1) --- engines/gnap/gamesys.cpp | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 3285985474..26af3fb8ab 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -804,7 +804,7 @@ void GameSys::drawSprites() { if (gfxItem2->_prevFrame._spriteId != -1) { bool transparent = false; if (gfxItem2->_currFrame._spriteId != -1) { - if (gfxItem2->_flags & 1) { + if (gfxItem2->_flags) { transparent = true; } else { int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame._spriteId; @@ -822,7 +822,7 @@ void GameSys::drawSprites() { if (gfxItem2->_currFrame._spriteId != -1) { bool transparent = false; - if (gfxItem2->_flags & 1) { + if (gfxItem2->_flags) { transparent = true; } else { int resourceId = (gfxItem2->_sequenceId & 0xFFFF0000) | gfxItem2->_currFrame._spriteId; @@ -845,7 +845,7 @@ void GameSys::drawSprites() { if (gfxItem5->_updFlag) { if (gfxItem5->_currFrame._spriteId != -1) { - if (gfxItem5->_flags & 1) { + if (gfxItem5->_flags) { seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_currFrame, nullptr); } else { int resourceId = (gfxItem5->_sequenceId & 0xFFFF0000) | gfxItem5->_currFrame._spriteId; @@ -855,7 +855,7 @@ void GameSys::drawSprites() { } } } else if (gfxItem5->_updRectsCount > 0) { - if (gfxItem5->_flags & 1) { + if (gfxItem5->_flags) { for (int n = 0; n < gfxItem5->_updRectsCount; ++n) seqDrawStaticFrame(gfxItem5->_surface, gfxItem5->_prevFrame, &gfxItem5->_updRects[n]); } else { @@ -969,8 +969,8 @@ void GameSys::handleReqRemoveSpriteDrawItems() { for (int j = 0; j < _removeSpriteDrawItemsCount; ++j) { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && (gfxItem->_flags & 1) && - gfxItem->_id == _removeSpriteDrawItems[j]._id && _removeSpriteDrawItems[j]._surface == gfxItem->_surface) { + if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && gfxItem->_flags + && gfxItem->_id == _removeSpriteDrawItems[j]._id && _removeSpriteDrawItems[j]._surface == gfxItem->_surface) { gfxItem->_flags = 0; gfxItem->_currFrame._duration = 0; gfxItem->_currFrame._spriteId = -1; @@ -996,8 +996,6 @@ void GameSys::fatUpdateFrame() { int duration, currFrameNum; - // NOTE Skipped avi code (reqAviStart) - for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; SequenceAnimation *animation = gfxItem->_animation; @@ -1130,23 +1128,21 @@ void GameSys::fatUpdateFrame() { if (_grabSpriteChanged) { for (int i = 0; i < _gfxItemsCount; ++i) { GfxItem *gfxItem = &_gfxItems[i]; - if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && (gfxItem->_flags & 1) && - gfxItem->_id == _grabSpriteId && gfxItem->_surface == _grabSpriteSurface1) { - gfxItem->_currFrame._duration = 0; - gfxItem->_currFrame._isScaled = false; - gfxItem->_currFrame._rect = _grabSpriteRect; - gfxItem->_currFrame._spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO - gfxItem->_currFrame._soundId = -1; - gfxItem->_updFlag = true; - gfxItem->_surface = _grabSpriteSurface2; - break; - } + if (gfxItem->_sequenceId == -1 && !gfxItem->_animation && gfxItem->_flags + && gfxItem->_id == _grabSpriteId && gfxItem->_surface == _grabSpriteSurface1) { + gfxItem->_currFrame._duration = 0; + gfxItem->_currFrame._isScaled = false; + gfxItem->_currFrame._rect = _grabSpriteRect; + gfxItem->_currFrame._spriteId = _grabSpriteSurface2 ? 1 : -1;// TODO + gfxItem->_currFrame._soundId = -1; + gfxItem->_updFlag = true; + gfxItem->_surface = _grabSpriteSurface2; + break; + } } _grabSpriteChanged = false; } - // NOTE Skipped avi code (reqAviStart) - debugC(kDebugBasic, "GameSys::fatUpdateFrame() _fatSequenceItems.size(): %d", _fatSequenceItems.size()); for (uint i = 0; i < _fatSequenceItems.size(); ++i) { @@ -1231,7 +1227,6 @@ void GameSys::fatUpdate() { handleReqRemoveSequenceItem(); handleReqRemoveSequenceItems(); handleReqRemoveSpriteDrawItems(); - // NOTE Skipped avi stuff (reqAviStop) fatUpdateFrame(); } -- cgit v1.2.3 From 8a946705167a56d8046d13201498ed1bcea413a4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 May 2016 00:16:59 +0200 Subject: GNAP: Remove or rephrase a couple of notes --- engines/gnap/gnap.cpp | 3 +-- engines/gnap/scenes/group0.cpp | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index 5175d0702b..b43fc244ff 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -683,8 +683,7 @@ void GnapEngine::loadStockDat() { if (!_isStockDatLoaded) { _isStockDatLoaded = true; _dat->open(1, "stock_n.dat"); - //createMenuSprite(); - // NOTE Skipped preloading of data + // The pre-loading of data is skipped as it's no longer required on modern hardware } } diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index d958b296a8..b53037ee0e 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -69,8 +69,6 @@ void Scene01::updateHotspots() { } void Scene01::run() { - // NOTE Removed _s01_dword_474380 which was set when the mud was taken - // which is also set in the global game flags. GameSys& gameSys = *_vm->_gameSys; PlayerGnap& gnap = *_vm->_gnap; PlayerPlat& plat = *_vm->_plat; -- cgit v1.2.3 From 4c6ef29b49a92270553b57c9dcb78e4b2fa99c79 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 May 2016 01:05:53 +0200 Subject: GNAP: Implement setSoundVolume --- engines/gnap/sound.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/gnap/sound.cpp b/engines/gnap/sound.cpp index 103a649e59..a4a59d7390 100644 --- a/engines/gnap/sound.cpp +++ b/engines/gnap/sound.cpp @@ -57,7 +57,9 @@ void SoundMan::stopSound(int resourceId) { } void SoundMan::setSoundVolume(int resourceId, int volume) { - // TODO + const int index = find(resourceId); + int realVol = volume * 2.55; + _vm->_mixer->setChannelVolume(_items[index]._handle, realVol); } bool SoundMan::isSoundPlaying(int resourceId) { -- cgit v1.2.3 From 0873f92ceb7474faf320188b59158cb6b345998d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 May 2016 01:20:19 +0200 Subject: GNAP: Remove yet another TODO --- engines/gnap/menu.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index d7eaca02b4..ff3d94e88b 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -413,12 +413,7 @@ void GnapEngine::updateMenuStatusMainMenu() { if (i == 0) { _gameSys->drawSpriteToSurface(_largeSprite, 0, 0, 0x1078D); _gameSys->insertSpriteDrawItem(_largeSprite, 0, 0, 300); - /* TODO - if (_midiFlag) { - playMidi("pause.mid", 0); - } - */ - warning("TODO: playMidi"); + playMidi("pause.mid"); } else if (i == 1) { _gameSys->drawSpriteToSurface(_largeSprite, 0, 0, 0x1078E); _gameSys->insertDirtyRect(dirtyRect); -- cgit v1.2.3 From 13c363f4408ac517036a74fa220bf537848a80a5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 00:00:51 +0200 Subject: GNAP: Remove double smi-columns --- engines/gnap/gnap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index b43fc244ff..c951a5f44b 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -938,11 +938,11 @@ void GnapEngine::screenEffect(int dir, byte r, byte g, byte b) { } bool GnapEngine::isKeyStatus1(int key) { - return _keyPressState[key] != 0;; + return _keyPressState[key] != 0; } bool GnapEngine::isKeyStatus2(int key) { - return _keyDownState[key] != 0;; + return _keyDownState[key] != 0; } void GnapEngine::clearKeyStatus1(int key) { -- cgit v1.2.3 From 94e1e3a8fef3d9b7fee8fb50725bf5c7bf5325a6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 00:01:51 +0200 Subject: GNAP: Use KeyCode value instead of numeric value for Backspace --- engines/gnap/scenes/group0.cpp | 36 ++++++++++++++++++------------------ engines/gnap/scenes/group1.cpp | 36 ++++++++++++++++++------------------ engines/gnap/scenes/group2.cpp | 40 ++++++++++++++++++++-------------------- engines/gnap/scenes/group3.cpp | 24 ++++++++++++------------ engines/gnap/scenes/group4.cpp | 28 ++++++++++++++-------------- engines/gnap/scenes/group5.cpp | 4 ++-- 6 files changed, 84 insertions(+), 84 deletions(-) diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index b53037ee0e..0a31c66dc2 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -275,8 +275,8 @@ void Scene01::run() { } _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -700,8 +700,8 @@ void Scene02::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -1161,8 +1161,8 @@ void Scene03::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[5] = _vm->getRandom(100) + 200; @@ -1698,8 +1698,8 @@ void Scene04::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2139,8 +2139,8 @@ void Scene05::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[5] = _vm->getRandom(20) + 30; @@ -2547,8 +2547,8 @@ void Scene06::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2855,8 +2855,8 @@ void Scene07::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(40) + 50; @@ -3232,8 +3232,8 @@ void Scene08::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(50) + 75; @@ -3523,8 +3523,8 @@ void Scene09::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(150) + 50; diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 52767e1a23..6caff2e0d3 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -332,8 +332,8 @@ void Scene10::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -814,8 +814,8 @@ void Scene11::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[5] = _vm->getRandom(50) + 75; @@ -1253,8 +1253,8 @@ void Scene12::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = 30; @@ -1770,8 +1770,8 @@ void Scene13::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -1975,8 +1975,8 @@ void Scene14::run() { _vm->_timers[2] = _vm->getRandom(40) + 50; } - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2197,8 +2197,8 @@ void Scene15::run() { updateAnimations(); _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2833,8 +2833,8 @@ void Scene17::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -3809,8 +3809,8 @@ void Scene18::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -4355,8 +4355,8 @@ void Scene19::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 78f7c04774..66cf5e5bab 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -506,8 +506,8 @@ void Scene20::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -930,8 +930,8 @@ void Scene21::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -1227,8 +1227,8 @@ void Scene22::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[2] = _vm->getRandom(30) + 20; @@ -1461,8 +1461,8 @@ void Scene23::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -1728,8 +1728,8 @@ void Scene24::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2033,8 +2033,8 @@ void Scene25::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2291,8 +2291,8 @@ void Scene26::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2582,8 +2582,8 @@ void Scene27::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2955,8 +2955,8 @@ void Scene28::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -3338,8 +3338,8 @@ void Scene29::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index 6c93057346..b10e7975e5 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -203,8 +203,8 @@ void Scene30::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -528,8 +528,8 @@ void Scene31::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -777,8 +777,8 @@ void Scene32::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -1019,8 +1019,8 @@ void Scene33::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -1285,8 +1285,8 @@ void Scene38::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -1578,8 +1578,8 @@ void Scene39::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[5] = _vm->getRandom(20) + 50; diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index 7a5de8d37e..b12d2ad4a1 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -159,8 +159,8 @@ void Scene40::run() { updateAnimations(); _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -549,8 +549,8 @@ void Scene41::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(100) + 100; @@ -1016,8 +1016,8 @@ void Scene42::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 30; @@ -1472,8 +1472,8 @@ void Scene43::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(100) + 100; @@ -1974,8 +1974,8 @@ void Scene44::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); _vm->_timers[4] = _vm->getRandom(20) + 20; @@ -2381,8 +2381,8 @@ void Scene45::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } @@ -2731,8 +2731,8 @@ void Scene46::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } diff --git a/engines/gnap/scenes/group5.cpp b/engines/gnap/scenes/group5.cpp index a359da21db..46f4c51e5d 100644 --- a/engines/gnap/scenes/group5.cpp +++ b/engines/gnap/scenes/group5.cpp @@ -369,8 +369,8 @@ void Scene53::run() { _vm->checkGameKeys(); - if (_vm->isKeyStatus1(8)) { - _vm->clearKeyStatus1(8); + if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) { + _vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE); _vm->runMenu(); updateHotspots(); } -- cgit v1.2.3 From 58fb1563cab13f912496fe3dcd42caef5978fef6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 00:33:50 +0200 Subject: GNAP: Map remaining Key codes --- engines/gnap/gnap.cpp | 10 +++++----- engines/gnap/menu.cpp | 11 ++++++----- engines/gnap/scenes/arcade.cpp | 8 ++++---- engines/gnap/scenes/group1.cpp | 4 ++-- engines/gnap/scenes/group2.cpp | 4 ++-- engines/gnap/scenes/intro.cpp | 4 ++-- engines/gnap/scenes/scenecore.cpp | 6 +++--- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index c951a5f44b..afb77ebea9 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -570,13 +570,13 @@ void GnapEngine::showFullScreenSprite(int resourceId) { hideCursor(); setGrabCursorSprite(-1); addFullScreenSprite(resourceId, 256); - while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && - !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(29) && !_gameDone) { + while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) + && !isKeyStatus1(Common::KEYCODE_SPACE) && !isKeyStatus1(Common::KEYCODE_RETURN) && !_gameDone) { gameUpdateTick(); } _mouseClickState._left = false; clearKeyStatus1(Common::KEYCODE_ESCAPE); - clearKeyStatus1(29); + clearKeyStatus1(Common::KEYCODE_RETURN); clearKeyStatus1(Common::KEYCODE_SPACE); removeFullScreenSprite(); showCursor(); @@ -739,8 +739,8 @@ void GnapEngine::mainLoop() { _soundCache->purge(true); _spriteCache->purge(true); - if (isKeyStatus1(28)) { - clearKeyStatus1(28); + if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { + clearKeyStatus1(Common::KEYCODE_ESCAPE); if (_debugLevel == 4) _gameDone = true; } diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index ff3d94e88b..82191b053e 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -238,7 +238,7 @@ void GnapEngine::runMenu() { _timers[2] = 10; - while (!isKeyStatus1(8) && !isKeyStatus1(28) && !_sceneDone && !_menuDone) { + while (!isKeyStatus1(Common::KEYCODE_BACKSPACE) && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !_sceneDone && !_menuDone) { updateCursorByHotspot(); switch (_menuStatus) { @@ -422,14 +422,15 @@ void GnapEngine::updateMenuStatusMainMenu() { _gameSys->insertDirtyRect(dirtyRect); } - while (!_mouseClickState._left && !isKeyStatus1(28) && !isKeyStatus1(30) && !isKeyStatus1(29) && !_timers[2] && !_gameDone) + while (!_mouseClickState._left && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_RETURN) + && !isKeyStatus1(Common::KEYCODE_SPACE) && !_timers[2] && !_gameDone) gameUpdateTick(); playSound(0x108F5, false); _mouseClickState._left = false; - clearKeyStatus1(28); - clearKeyStatus1(29); - clearKeyStatus1(30); + clearKeyStatus1(Common::KEYCODE_ESCAPE); + clearKeyStatus1(Common::KEYCODE_RETURN); + clearKeyStatus1(Common::KEYCODE_SPACE); } _gameSys->removeSpriteDrawItem(_largeSprite, 300); diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index da66829a31..c4c5480b84 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -71,9 +71,9 @@ int Scene49::init() { _vm->_timers[2] = 0; _vm->_timers[0] = 0; _vm->_timers[1] = 0; - _vm->clearKeyStatus1(28); - _vm->clearKeyStatus1(54); - _vm->clearKeyStatus1(52); + _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); + _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); + _vm->clearKeyStatus1(Common::KEYCODE_LEFT); return 0xD5; } @@ -2704,7 +2704,7 @@ void Scene52::run() { _alienWave = false; _vm->_gameSys->waitForUpdate(); initAnims(); - _vm->clearKeyStatus1(30); + _vm->clearKeyStatus1(Common::KEYCODE_SPACE); _vm->_sceneDone = true; } } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 6caff2e0d3..1a414cb2f4 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -1488,11 +1488,11 @@ void Scene13::showScribble() { _vm->_largeSprite = gameSys.createSurface(0x6F); gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && - !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(29) && !_vm->_gameDone) + !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && !_vm->isKeyStatus1(Common::KEYCODE_RETURN) && !_vm->_gameDone) _vm->gameUpdateTick(); _vm->_mouseClickState._left = false; _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_RETURN); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->deleteSurface(&_vm->_largeSprite); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 66cf5e5bab..d0a2131207 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -1800,12 +1800,12 @@ void Scene25::playAnims(int index) { gameSys.insertSpriteDrawItem(_vm->_largeSprite, 0, 0, 300); _vm->delayTicksCursor(5); while (!_vm->_mouseClickState._left && !_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) && !_vm->isKeyStatus1(Common::KEYCODE_SPACE) && - !_vm->isKeyStatus1(29) && !_vm->_gameDone) { + !_vm->isKeyStatus1(Common::KEYCODE_RETURN) && !_vm->_gameDone) { _vm->gameUpdateTick(); } _vm->_mouseClickState._left = false; _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); - _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_RETURN); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); gameSys.removeSpriteDrawItem(_vm->_largeSprite, 300); _vm->delayTicksCursor(5); diff --git a/engines/gnap/scenes/intro.cpp b/engines/gnap/scenes/intro.cpp index 1679fe8306..b4ba2f5201 100644 --- a/engines/gnap/scenes/intro.cpp +++ b/engines/gnap/scenes/intro.cpp @@ -157,10 +157,10 @@ void SceneIntro::run() { } } - if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(29)) { + if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(Common::KEYCODE_RETURN)) { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_RETURN); if (index == 0) { skip = true; _vm->stopSound(0x3CF); diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c6e32e07c1..d34f46037f 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -677,7 +677,7 @@ void CutScene::run() { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_RETURN); _vm->_mouseClickState._left = false; @@ -701,10 +701,10 @@ void CutScene::run() { } } - if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(29)) { + if (_vm->isKeyStatus1(Common::KEYCODE_ESCAPE) || _vm->isKeyStatus1(Common::KEYCODE_SPACE) || _vm->isKeyStatus1(Common::KEYCODE_RETURN)) { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); - _vm->clearKeyStatus1(29); + _vm->clearKeyStatus1(Common::KEYCODE_RETURN); if (_canSkip[itemIndex]) skip = true; else -- cgit v1.2.3 From 58e77d693b2575b3a7680fb2bca6dc2f41449278 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 00:44:00 +0200 Subject: GNAP: Remove original debug code --- engines/gnap/gnap.cpp | 6 ------ engines/gnap/gnap.h | 2 -- engines/gnap/scenes/group2.cpp | 10 ---------- 3 files changed, 18 deletions(-) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index afb77ebea9..cc0ac2e8b3 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -738,12 +738,6 @@ void GnapEngine::mainLoop() { _sequenceCache->purge(true); _soundCache->purge(true); _spriteCache->purge(true); - - if (isKeyStatus1(Common::KEYCODE_ESCAPE)) { - clearKeyStatus1(Common::KEYCODE_ESCAPE); - if (_debugLevel == 4) - _gameDone = true; - } } if (_backgroundSurface) diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 0f45dc2e7f..f5b7797914 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -251,8 +251,6 @@ public: Common::MemoryWriteStreamDynamic *_tempThumbnail; int _lastUpdateClock; - - int _debugLevel; bool _gameDone; byte _keyPressState[512]; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index d0a2131207..db529c9a8a 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -1573,9 +1573,6 @@ void Scene24::run() { _girlSequenceId = 0x36; _boySequenceId = 0x30; - if (_vm->_debugLevel == 4) - _vm->startIdleTimer(8); - _vm->queueInsertDeviceIcon(); if (_vm->_prevSceneNum == 20) { @@ -1721,8 +1718,6 @@ void Scene24::run() { break; } } - if (_vm->_debugLevel == 4) - _vm->updateIdleTimer(); _vm->playSoundA(); } @@ -2359,9 +2354,6 @@ void Scene27::run() { if (!_vm->isFlag(kGFUnk13)) gameSys.insertSequence(0xD3, 39, 0, 0, kSeqNone, 0, 0, 0); - if (_vm->_debugLevel == 4) - _vm->startIdleTimer(6); - gameSys.insertSequence(0xCB, 39, 0, 0, kSeqNone, 0, 0, 0); _currJanitorSequenceId = 0xCB; @@ -2561,8 +2553,6 @@ void Scene27::run() { plat.updateIdleSequence(); if (gnap._actionStatus < 0) gnap.updateIdleSequence(); - if (_vm->_debugLevel == 4) - _vm->updateIdleTimer(); if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 60; if (gnap._actionStatus < 0) { -- cgit v1.2.3 From 2a2082c1f9dcb3a85801d6813273ef8362caf6be Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 01:33:13 +0200 Subject: GNAP: Remove a TODO This code is never called because it's triggered by clicking on the button --- engines/gnap/menu.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index 82191b053e..a459c3cf09 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -438,14 +438,10 @@ void GnapEngine::updateMenuStatusMainMenu() { deleteSurface(&_largeSprite); showCursor(); } else if (_hotspotsCount - 3 == _sceneClickedHotspot) { - // Button + // Button - Return to the inventory _timers[2] = 10; playSound(0x108F4, false); initMenuHotspots1(); - /* TODO - if (_mouseX < 93 || _mouseX > 638 || _mouseY < 0 || _mouseY > 600) - SetCursorPos(400, 300); - */ _menuStatus = 0; if (_menuSprite1) _gameSys->removeSpriteDrawItem(_menuSprite1, 262); -- cgit v1.2.3 From a586f7701d7e791668ed725d56a702dba64e8d65 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 01:49:50 +0200 Subject: GNAP: Remove useless in ResourceClass constructor --- engines/gnap/resource.cpp | 11 ++++------- engines/gnap/resource.h | 8 ++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index bb5dba0382..8244213a7f 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -59,9 +59,9 @@ void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) { } // SequenceResource - -SequenceResource::SequenceResource(int resourceId, byte *data, uint32 size) { +SequenceResource::SequenceResource(byte *data, uint32 size) { Common::MemoryReadStream stream(data, size, DisposeAfterUse::NO); + // Skip an unused value stream.readUint32LE(); @@ -84,7 +84,6 @@ SequenceResource::SequenceResource(int resourceId, byte *data, uint32 size) { _animations[i].loadFromStream(stream); stream.seek(oldOffs); } - // TODO Convert resourceIds } SequenceResource::~SequenceResource() { @@ -92,8 +91,7 @@ SequenceResource::~SequenceResource() { } // SpriteResource - -SpriteResource::SpriteResource(int resourceId, byte *data, uint32 size) { +SpriteResource::SpriteResource(byte *data, uint32 size) { _data = data; _width = READ_LE_UINT16(_data); _height = READ_LE_UINT16(_data + 2); @@ -111,8 +109,7 @@ SpriteResource::~SpriteResource() { } // SoundResource - -SoundResource::SoundResource(int resourceId, byte *data, uint32 size) { +SoundResource::SoundResource(byte *data, uint32 size) { _data = data; _size = size; } diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h index 1b228de81e..29bd31c88f 100644 --- a/engines/gnap/resource.h +++ b/engines/gnap/resource.h @@ -66,7 +66,7 @@ struct SequenceAnimation { class SequenceResource { public: - SequenceResource(int resourceId, byte *data, uint32 size); + SequenceResource(byte *data, uint32 size); ~SequenceResource(); public: int32 _sequenceId; @@ -83,7 +83,7 @@ public: class SpriteResource { public: - SpriteResource(int resourceId, byte *data, uint32 size); + SpriteResource(byte *data, uint32 size); ~SpriteResource(); public: byte *_data; @@ -98,7 +98,7 @@ public: class SoundResource { public: - SoundResource(int resourceId, byte *data, uint32 size); + SoundResource(byte *data, uint32 size); ~SoundResource(); public: byte *_data; @@ -172,7 +172,7 @@ protected: byte *resourceData = _dat->loadResource(resourceId); uint32 resourceSize = _dat->getResourceSize(resourceId); - ResourceClass *obj = new ResourceClass(resourceId, resourceData, resourceSize); + ResourceClass *obj = new ResourceClass(resourceData, resourceSize); if (FreeAfterLoad) delete[] resourceData; return obj; -- cgit v1.2.3 From c9fdd32ebc2e2d6d7d71b480af6257858ebf540c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 01:51:31 +0200 Subject: GNAP: Remove an irrelevant TODO copied from another engine --- engines/gnap/music.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engines/gnap/music.cpp b/engines/gnap/music.cpp index 57b2b27820..af33786a8f 100644 --- a/engines/gnap/music.cpp +++ b/engines/gnap/music.cpp @@ -43,10 +43,6 @@ MusicPlayer::MusicPlayer(const char *filename) : _filename(filename) { else _driver->sendGMReset(); - // TODO: Load cmf.ins with the instrument table. It seems that an - // interface for such an operation is supported for AdLib. Maybe for - // this card, setting instruments is necessary. - _driver->setTimerCallback(this, &timerCallback); } } -- cgit v1.2.3 From d2aa9c7ded4faa1cefffd705b0ce28fbaa399c31 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 01:59:14 +0200 Subject: GNAP: Add a note concerning the original save and load screens --- engines/gnap/menu.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engines/gnap/menu.cpp b/engines/gnap/menu.cpp index a459c3cf09..2bfe7300df 100644 --- a/engines/gnap/menu.cpp +++ b/engines/gnap/menu.cpp @@ -486,7 +486,11 @@ void GnapEngine::updateMenuStatusMainMenu() { } } #else - // Original Code + // NOTE: + // This is the code for the original behavior. + // It's currently not working prolery, but could be + // fixed to replace the ScummVM screens currently + // used. _timers[2] = 10; playSound(0x108F4, false); _gameSys->removeSpriteDrawItem(_menuSprite1, 262); @@ -653,7 +657,12 @@ Common::String GnapEngine::generateSaveName(int slot) { } void GnapEngine::updateMenuStatusSaveGame() { -#if 0 // TODO +#if 0 + // NOTE: + // This is the code for the original screen game. + // It could be eventually fixed and could replace + // the ScummVM screens currently used. + char v43[30]; int v46; v43[0] = '\0'; -- cgit v1.2.3 From 16bc0840530a816ef4d4e9f5d6d27cc0505c013a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 02:00:40 +0200 Subject: GNAP: Add 2 other double semi columns --- engines/gnap/scenes/group0.cpp | 2 +- engines/gnap/scenes/group2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index 0a31c66dc2..a3359bfb39 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -2263,7 +2263,7 @@ void Scene05::updateAnimations() { /*****************************************************************************/ Scene06::Scene06(GnapEngine *vm) : Scene(vm) { - _horseTurnedBack = false;; + _horseTurnedBack = false; _nextPlatSequenceId = -1; _nextHorseSequenceId = -1; _currHorseSequenceId = -1; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index db529c9a8a..3e61fafc8f 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -3010,7 +3010,7 @@ void Scene28::updateAnimations() { break; case kAS28GrabEmptyBucketDone: _vm->setGrabCursorSprite(kItemEmptyBucket); - _vm->clearFlag(kGFUnk22);; + _vm->clearFlag(kGFUnk22); updateHotspots(); _vm->invAdd(kItemEmptyBucket); gnap._actionStatus = -1; -- cgit v1.2.3 From 1a8093c92299aba2a5a27c0de6bd164b84ab9179 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 02:18:09 +0200 Subject: GNAP: After double-checking them, remove two CHECKMEs --- engines/gnap/scenes/arcade.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index c4c5480b84..571fdbf85f 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -813,7 +813,7 @@ void Scene50::updateAnimations() { _leftTongueNextSequenceId = -1; _rightTongueId = _rightTongueNextId; _leftTongueId = _leftTongueNextId; - _leftTongueEnergy -= _vm->getRandom(2) + 1;//CHECKME + _leftTongueEnergy -= _vm->getRandom(1) + 1; } else { _rightTongueNextId = getRightTongueNextId(); _vm->_gameSys->setAnimation(_rightTongueNextSequenceId, _rightTongueNextId, 5); @@ -831,8 +831,7 @@ void Scene50::updateAnimations() { _leftTongueNextSequenceId = 0xB8; } else { _vm->_timers[4] = 20; - //CHECKME - if (_rightTongueSequenceId != 0xBB && _rightTongueSequenceId != 0xC0 && _vm->getRandom(8) != _roundNum) + if (_rightTongueSequenceId != 0xBB && _rightTongueSequenceId != 0xC0 && _vm->getRandom(7) != _roundNum) _leftTongueNextSequenceId = 0xB7; else _leftTongueNextSequenceId = 0xB8; -- cgit v1.2.3 From f0f42b05ca0302fc018e5a094cead25096564c77 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 07:48:37 +0200 Subject: GNAP: Rename two Facing enums --- engines/gnap/character.cpp | 60 +++++++++++++++++++++--------------------- engines/gnap/character.h | 4 +-- engines/gnap/grid.cpp | 2 +- engines/gnap/scenes/group0.cpp | 60 +++++++++++++++++++++--------------------- engines/gnap/scenes/group1.cpp | 52 ++++++++++++++++++------------------ engines/gnap/scenes/group2.cpp | 56 +++++++++++++++++++-------------------- engines/gnap/scenes/group3.cpp | 26 +++++++++--------- engines/gnap/scenes/group4.cpp | 8 +++--- 8 files changed, 134 insertions(+), 134 deletions(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 575e3f3dd9..5eb35d1237 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -28,7 +28,7 @@ namespace Gnap { Character::Character(GnapEngine *vm) : _vm(vm) { _pos = Common::Point(0, 0); - _idleFacing = kDirNone; + _idleFacing = kDirIdleLeft; _actionStatus = 0; _sequenceId = 0; _sequenceDatNum = 0; @@ -373,8 +373,8 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { case kDirUpRight: sequenceId = 0x82F; break; - case kDirNone: - case kDirUnk4: + case kDirIdleLeft: + case kDirIdleRight: break; } } @@ -394,8 +394,8 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { case kDirUpRight: sequenceId = 0x83E; break; - case kDirNone: - case kDirUnk4: + case kDirIdleLeft: + case kDirIdleRight: break; } break; @@ -478,7 +478,7 @@ void PlayerGnap::useJointOnPlatypus() { kSeqSyncWait, 0, 15 * (5 * plat._pos.x - 25), 48 * (plat._pos.y - 7)); plat._sequenceDatNum = 1; plat._sequenceId = 0x876; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; playSequence(0x107B5); walkStep(); while (_vm->_gameSys->getAnimationStatus(0) != 2 && !_vm->_gameDone) { @@ -509,7 +509,7 @@ void PlayerGnap::kissPlatypus(int callback) { kSeqSyncWait, _vm->getSequenceTotalDuration(0x10847), 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); plat._sequenceDatNum = 1; plat._sequenceId = 0x7CB; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; playSequence(0x107B5); while (_vm->_gameSys->getAnimationStatus(0) != 2 && !_vm->_gameDone) { _vm->updateMouseCursor(); @@ -528,7 +528,7 @@ void PlayerGnap::useDeviceOnPlatypus() { playSequence(makeRid(1, getSequenceId(kGSPullOutDevice, plat._pos))); - if (plat._idleFacing != kDirNone) { + if (plat._idleFacing != kDirIdleLeft) { _vm->_gameSys->insertSequence(makeRid(1, 0x7D5), plat._id, makeRid(plat._sequenceDatNum, plat._sequenceId), plat._id, kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); @@ -653,10 +653,11 @@ void PlayerGnap::initPos(int gridX, int gridY, Facing facing) { _vm->_timers[2] = 30; _vm->_timers[3] = 300; _pos = Common::Point(gridX, gridY); - if (facing == kDirNone) + if (facing == kDirIdleLeft) _idleFacing = kDirBottomRight; else _idleFacing = facing; + if (_idleFacing == kDirBottomLeft) { _sequenceId = 0x7B8; } else { @@ -1167,9 +1168,9 @@ int PlayerPlat::getSequenceId(int kind, Common::Point gridPos) { int sequenceId = 0x7CB; - if (_idleFacing != kDirNone) { + if (_idleFacing != kDirIdleLeft) { sequenceId = 0x7CC; - _idleFacing = kDirUnk4; + _idleFacing = kDirIdleRight; } return sequenceId | 0x10000; @@ -1189,7 +1190,7 @@ void PlayerPlat::updateIdleSequence() { if (_vm->_timers[1] == 0) { _vm->_timers[1] = _vm->getRandom(20) + 30; int rnd = _vm->getRandom(10); - if (_idleFacing != kDirNone) { + if (_idleFacing != kDirIdleLeft) { if (rnd != 0 || _sequenceId != 0x7CA) { if (rnd != 1 || _sequenceId != 0x7CA) playSequence(0x107CA); @@ -1228,7 +1229,7 @@ void PlayerPlat::updateIdleSequence2() { if (_vm->_timers[0]) { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; - if (_idleFacing != kDirNone) { + if (_idleFacing != kDirIdleLeft) { if (_vm->getRandom(10) >= 2 || _sequenceId != 0x7CA) playSequence(0x107CA); else @@ -1255,15 +1256,15 @@ void PlayerPlat::initPos(int gridX, int gridY, Facing facing) { _vm->_timers[0] = 50; _vm->_timers[1] = 20; _pos = Common::Point(gridX, gridY); - if (facing == kDirNone) - _idleFacing = kDirNone; + if (facing == kDirIdleLeft) + _idleFacing = kDirIdleLeft; else _idleFacing = facing; - if (_idleFacing == kDirUnk4) { + if (_idleFacing == kDirIdleRight) { _sequenceId = 0x7D1; } else { _sequenceId = 0x7C1; - _idleFacing = kDirNone; + _idleFacing = kDirIdleLeft; } _id = 20 * _pos.y; _sequenceDatNum = 1; @@ -1371,15 +1372,14 @@ bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceI _sequenceId = platSequenceId; _id = platId; _sequenceDatNum = datNum; - // CHECKME Not sure if this is correct... if (_walkNodes[_walkNodesCount - 1]._deltaX > 0) - _idleFacing = kDirNone; + _idleFacing = kDirIdleLeft; else if (_walkNodes[_walkNodesCount - 1]._deltaX < 0) - _idleFacing = kDirUnk4; + _idleFacing = kDirIdleRight; else if (_walkNodes[_walkNodesCount - 1]._gridX1 % 2) - _idleFacing = kDirUnk4; + _idleFacing = kDirIdleRight; else - _idleFacing = kDirNone; + _idleFacing = kDirIdleLeft; if (animationIndex >= 0) _vm->_gameSys->setAnimation(makeRid(_sequenceDatNum, _sequenceId), _id, animationIndex); } else if (animationIndex >= 0) { @@ -1391,29 +1391,29 @@ bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceI _sequenceId = ridToEntryIndex(sequenceId); _sequenceDatNum = ridToDatIndex(sequenceId); if (_sequenceId == 0x7C2) { - _idleFacing = kDirNone; + _idleFacing = kDirIdleLeft; } else if (_sequenceId == 0x7D2) { - _idleFacing = kDirUnk4; + _idleFacing = kDirIdleRight; } } else { if (_walkNodesCount > 0) { if (_walkNodes[_walkNodesCount - 1]._deltaX > 0) { _sequenceId = 0x7C2; - _idleFacing = kDirNone; + _idleFacing = kDirIdleLeft; } else if (_walkNodes[_walkNodesCount - 1]._deltaX < 0) { _sequenceId = 0x7D2; - _idleFacing = kDirUnk4; + _idleFacing = kDirIdleRight; } else if (_walkNodes[0]._deltaX > 0) { _sequenceId = 0x7C2; - _idleFacing = kDirNone; + _idleFacing = kDirIdleLeft; } else if (_walkNodes[0]._deltaX < 0) { _sequenceId = 0x7D2; - _idleFacing = kDirUnk4; + _idleFacing = kDirIdleRight; } else { _sequenceId = 0x7D2; - _idleFacing = kDirUnk4; + _idleFacing = kDirIdleRight; } - } else if (_idleFacing != kDirNone) { + } else if (_idleFacing != kDirIdleLeft) { _sequenceId = 0x7D2; } else { _sequenceId = 0x7C2; diff --git a/engines/gnap/character.h b/engines/gnap/character.h index be6efbfdf4..27e98be15c 100644 --- a/engines/gnap/character.h +++ b/engines/gnap/character.h @@ -28,10 +28,10 @@ namespace Gnap { class GnapEngine; enum Facing { - kDirNone = 0, + kDirIdleLeft = 0, kDirBottomRight = 1, kDirBottomLeft = 3, - kDirUnk4 = 4, + kDirIdleRight = 4, kDirUpLeft = 5, kDirUpRight = 7 }; diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index b3a8a4b305..2197317227 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -75,7 +75,7 @@ int PlayerGnap::getWalkStopSequenceId(int deltaX, int deltaY) { Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) { static const Facing gnapWalkFacings[9] = { kDirUpLeft, kDirBottomLeft, kDirBottomLeft, - kDirUpLeft, kDirNone, kDirBottomLeft, + kDirUpLeft, kDirIdleLeft, kDirBottomLeft, kDirUpRight, kDirBottomRight, kDirBottomRight }; // CHECKME This is a little weird diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp index a3359bfb39..e55b08eac3 100644 --- a/engines/gnap/scenes/group0.cpp +++ b/engines/gnap/scenes/group0.cpp @@ -92,7 +92,7 @@ void Scene01::run() { if (_vm->_prevSceneNum == 2) { gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(12, 6, kDirUnk4); + plat.initPos(12, 6, kDirIdleRight); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) plat.walkTo(Common::Point(9, 6), -1, 0x107C2, 1); @@ -100,7 +100,7 @@ void Scene01::run() { } else { gnap.initPos(1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(1, 7, kDirNone); + plat.initPos(1, 7, kDirIdleLeft); _vm->endSceneInit(); } @@ -416,7 +416,7 @@ void Scene02::run() { case 3: gnap.initPos(11, 6, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(12, 6, kDirUnk4); + plat.initPos(12, 6, kDirIdleRight); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) plat.walkTo(Common::Point(9, 6), -1, 0x107C2, 1); @@ -425,7 +425,7 @@ void Scene02::run() { case 4: gnap.initPos(_vm->_hotspotsWalkPos[6].x, _vm->_hotspotsWalkPos[6].y, kDirBottomLeft); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirUnk4); + plat.initPos(_vm->_hotspotsWalkPos[6].x + 1, _vm->_hotspotsWalkPos[6].y, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 6), 0, 0x107B9, 1); if (_vm->isFlag(kGFPlatypus)) @@ -436,19 +436,19 @@ void Scene02::run() { case 47: _vm->clearFlag(kGFUnk25); gnap.initPos(5, 6, kDirBottomLeft); - plat.initPos(6, 7, kDirUnk4); + plat.initPos(6, 7, kDirIdleRight); _vm->endSceneInit(); break; case 49: gnap.initPos(5, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(6, 7, kDirNone); + plat.initPos(6, 7, kDirIdleLeft); _vm->endSceneInit(); break; default: gnap.initPos(-1, 6, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(-1, 7, kDirNone); + plat.initPos(-1, 7, kDirIdleLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) plat.walkTo(Common::Point(2, 7), -1, 0x107C2, 1); @@ -569,7 +569,7 @@ void Scene02::run() { gnap._actionStatus = kAS02UseTruckNoGas; } } else { - gnap._idleFacing = kDirUnk4; + gnap._idleFacing = kDirIdleRight; if (gnap.walkTo(_vm->_hotspotsWalkPos[3], 0, gnap.getSequenceId(kGSIdle, Common::Point(2, 2)) | 0x10000, 1)) gnap._actionStatus = kAS02UseTruckNoKeys; } @@ -911,7 +911,7 @@ void Scene03::run() { _vm->_timers[5] = _vm->getRandom(100) + 200; if (_vm->isFlag(kGFPlatypus)) { - plat.initPos(5, 4, kDirNone); + plat.initPos(5, 4, kDirIdleLeft); } else { _vm->_timers[1] = _vm->getRandom(40) + 20; gameSys.setAnimation(0x1C2, 99, 1); @@ -1191,7 +1191,7 @@ void Scene03::updateAnimations() { case kAS03FreePlatypusDone: gnap._actionStatus = -1; plat._pos = Common::Point(6, 6); - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; plat._id = 120; gameSys.insertSequence(0x107CA, plat._id, 0x1BC, 99, kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); @@ -1267,7 +1267,7 @@ void Scene03::updateAnimations() { gameSys.insertSequence(_nextPlatSequenceId, 99, plat._sequenceId | (plat._sequenceDatNum << 16), 99, kSeqSyncWait, 0, 0, 0); gnap._sequenceId = 0x1B5; gnap._sequenceDatNum = 0; - gnap._idleFacing = kDirNone; + gnap._idleFacing = kDirIdleLeft; plat._sequenceId = _nextPlatSequenceId; plat._sequenceDatNum = 0; gameSys.setAnimation(_nextPlatSequenceId, 99, 1); @@ -1281,7 +1281,7 @@ void Scene03::updateAnimations() { gnap._id = 20 * gnap._pos.y; gnap._sequenceId = 0x1B6; gnap._sequenceDatNum = 0; - gnap._idleFacing = kDirNone; + gnap._idleFacing = kDirIdleLeft; gnap._actionStatus = kAS03FreePlatypusDone; _nextPlatSequenceId = -1; } else if (_nextPlatSequenceId == 0x1C2 && !_platypusScared) { @@ -1418,12 +1418,12 @@ void Scene04::run() { gnap.walkTo(Common::Point(6, 9), -1, 0x107BA, 1); } else if (_vm->_prevSceneNum == 38) { gnap.initPos(5, 7, kDirBottomRight); - plat.initPos(4, 7, kDirNone); + plat.initPos(4, 7, kDirIdleLeft); _vm->endSceneInit(); } else { gnap.initPos(12, 9, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(12, 8, kDirNone); + plat.initPos(12, 8, kDirIdleLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) plat.walkTo(Common::Point(9, 8), -1, 0x107C2, 1); @@ -1897,7 +1897,7 @@ void Scene05::run() { if (_vm->_prevSceneNum != 6 && _vm->_prevSceneNum != 36) { gnap.initPos(-1, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(-1, 9, kDirNone); + plat.initPos(-1, 9, kDirIdleLeft); _vm->endSceneInit(); if (_vm->isFlag(kGFPlatypus)) plat.walkTo(Common::Point(2, 8), -1, 0x107C2, 1); @@ -1905,7 +1905,7 @@ void Scene05::run() { } else { gnap.initPos(6, 8, kDirBottomRight); if (_vm->isFlag(kGFPlatypus)) - plat.initPos(7, 9, kDirNone); + plat.initPos(7, 9, kDirIdleLeft); _vm->endSceneInit(); } @@ -1975,7 +1975,7 @@ void Scene05::run() { gnap.useDeviceOnPlatypus(); if (plat.walkTo(_vm->_hotspotsWalkPos[1], 1, 0x107C2, 1)) { plat._actionStatus = kAS05PlatSearchHaystack; - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; } if (gnap._pos.x == 4 && (gnap._pos.y == 8 || gnap._pos.y == 7)) gnap.walkStep(); @@ -2332,7 +2332,7 @@ void Scene06::run() { _vm->queueInsertDeviceIcon(); gnap.initPos(5, 12, kDirBottomRight); - plat.initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirIdleLeft); _vm->endSceneInit(); plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); @@ -2453,7 +2453,7 @@ void Scene06::run() { _vm->_hotspots[kHS06WalkArea5]._flags &= ~SF_WALKABLE; gnap._idleFacing = kDirUpLeft; plat.walkTo(Common::Point(6, 8), 1, 0x107C2, 1); - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; gnap._actionStatus = kAS06UseTwigOnHorse; _vm->setGrabCursorSprite(-1); } else if (_vm->_grabCursorSpriteIndex >= 0) { @@ -2702,7 +2702,7 @@ void Scene07::run() { if (_vm->_prevSceneNum == 8) { gnap.initPos(7, 7, kDirBottomLeft); - plat.initPos(9, 7, kDirUnk4); + plat.initPos(9, 7, kDirIdleRight); _vm->endSceneInit(); } else { gnap._pos = Common::Point(6, 7); @@ -2717,7 +2717,7 @@ void Scene07::run() { plat._id = 160; plat._sequenceId = 0x91; plat._sequenceDatNum = 0; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; gameSys.insertSequence(0x91, 160, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); } @@ -2827,7 +2827,7 @@ void Scene07::run() { if (!_vm->_timers[1]) { _vm->_timers[1] = _vm->getRandom(20) + 30; int gnapRandomValue = _vm->getRandom(20); - if (plat._idleFacing != kDirNone) { + if (plat._idleFacing != kDirIdleLeft) { if (gnapRandomValue == 0 && plat._sequenceId == 0x7CA) plat.playSequence(0x107CC); else if (gnapRandomValue == 1 && plat._sequenceId == 0x7CA) @@ -2966,7 +2966,7 @@ void Scene08::run() { gameSys.insertSequence(0x146, 1, 0, 0, kSeqNone, 0, 0, 0); gnap.initPos(-1, 8, kDirBottomRight); - plat.initPos(-1, 7, kDirNone); + plat.initPos(-1, 7, kDirIdleLeft); _vm->endSceneInit(); @@ -3065,7 +3065,7 @@ void Scene08::run() { gnap.useDeviceOnPlatypus(); plat.walkTo(Common::Point(6, 6), 1, 0x107C2, 1); plat._actionStatus = kAS08PlatWithMan; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; gnap.playIdle(Common::Point(6, 6)); break; } @@ -3101,7 +3101,7 @@ void Scene08::run() { gnap.useDeviceOnPlatypus(); plat.walkTo(Common::Point(3, 7), 1, 0x107C2, 1); plat._actionStatus = kAS08PlatWithDog; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; gnap.playIdle(Common::Point(3, 7)); break; } @@ -3346,7 +3346,7 @@ void Scene08::updateAnimations() { plat._pos = Common::Point(1, 8); plat._id = 160; plat._sequenceId = 0x148; - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; plat._sequenceDatNum = 0; if (gnap._pos == Common::Point(1, 8)) gnap.walkStep(); @@ -3402,13 +3402,13 @@ void Scene09::run() { if (_vm->_prevSceneNum == 8) { gnap.initPos(11, 8, kDirBottomLeft); - plat.initPos(12, 7, kDirUnk4); + plat.initPos(12, 7, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { gnap.initPos(4, 7, kDirBottomRight); - plat.initPos(5, 7, kDirNone); + plat.initPos(5, 7, kDirIdleLeft); _vm->endSceneInit(); } @@ -3460,7 +3460,7 @@ void Scene09::run() { gnap.walkTo(Common::Point(4, 7), 0, 0x107BF, 1); gnap._actionStatus = kAS09LeaveScene; plat.walkTo(Common::Point(4, 8), -1, 0x107D2, 1); - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; break; case kHS09ExitHouse: @@ -3469,7 +3469,7 @@ void Scene09::run() { gnap.walkTo(Common::Point(10, -1), 0, 0x107AB, 1); gnap._actionStatus = kAS09LeaveScene; plat.walkTo(Common::Point(10, -1), -1, 0x107CD, 1); - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; break; case kHS09Trash: diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 1a414cb2f4..f76d04c64d 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -75,13 +75,13 @@ void Scene10::run() { if (_vm->_prevSceneNum == 9) { gnap.initPos(11, 8, kDirBottomLeft); - plat.initPos(12, 7, kDirUnk4); + plat.initPos(12, 7, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(9, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(9, 7), -1, 0x107D2, 1); } else { gnap.initPos(-1, 7, kDirBottomRight); - plat.initPos(-2, 8, kDirNone); + plat.initPos(-2, 8, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(1, 7), -1, 0x107B9, 1); plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); @@ -244,7 +244,7 @@ void Scene10::run() { gnap.useDeviceOnPlatypus(); plat.walkTo(Common::Point(7, 6), 1, 0x107D2, 1); plat._actionStatus = kAS10PlatWithBox; - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; _vm->_largeSprite = gameSys.createSurface(0xC3); gnap.playIdle(Common::Point(7, 6)); } @@ -383,7 +383,7 @@ void Scene10::updateAnimations() { _nextCookSequenceId = 0x843; plat._sequenceId = 0x7C9; plat._id = 160; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; plat._sequenceDatNum = 1; break; case 0x843: @@ -551,22 +551,22 @@ void Scene11::run() { switch (_vm->_prevSceneNum) { case 13: gnap.initPos(8, 5, kDirBottomLeft); - plat.initPos(9, 6, kDirUnk4); + plat.initPos(9, 6, kDirIdleRight); break; case 47: gnap.initPos(8, 5, kDirBottomLeft); - plat.initPos(9, 5, kDirUnk4); + plat.initPos(9, 5, kDirIdleRight); _currGoggleGuySequenceId = 0x1FA; _currHookGuySequenceId = 0x1FF; _vm->_timers[7] = 180; break; case 12: gnap.initPos(-1, 9, kDirBottomRight); - plat.initPos(-2, 8, kDirNone); + plat.initPos(-2, 8, kDirIdleLeft); break; default: gnap.initPos(6, 6, kDirBottomLeft); - plat.initPos(6, 5, kDirUnk4); + plat.initPos(6, 5, kDirIdleRight); break; } @@ -1003,11 +1003,11 @@ void Scene12::run() { if (_vm->_prevSceneNum == 15) { gnap.initPos(5, 6, kDirBottomRight); - plat.initPos(3, 7, kDirNone); + plat.initPos(3, 7, kDirIdleLeft); _vm->endSceneInit(); } else { gnap.initPos(11, 8, kDirBottomLeft); - plat.initPos(12, 8, kDirUnk4); + plat.initPos(12, 8, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(9, 8), -1, 0x107D2, 1); @@ -1092,7 +1092,7 @@ void Scene12::run() { gnap.useDeviceOnPlatypus(); plat.walkTo(Common::Point(3, 7), 1, 0x107D2, 1); plat._actionStatus = kAS12PlatWithToothGuy; - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; gnap.playIdle(Common::Point(2, 7)); break; } @@ -1162,7 +1162,7 @@ void Scene12::run() { gnap.useDeviceOnPlatypus(); plat.walkTo(Common::Point(7, 6), 1, 0x107C2, 1); plat._actionStatus = kAS12PlatWithBeardGuy; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; gnap.playIdle(Common::Point(7, 6)); break; } @@ -1511,10 +1511,10 @@ void Scene13::run() { if (_vm->_prevSceneNum == 14) { gnap.initPos(6, 6, kDirBottomLeft); - plat.initPos(9, 8, kDirNone); + plat.initPos(9, 8, kDirIdleLeft); } else { gnap.initPos(3, 7, kDirBottomRight); - plat.initPos(2, 7, kDirNone); + plat.initPos(2, 7, kDirIdleLeft); } _vm->endSceneInit(); @@ -2445,7 +2445,7 @@ void Scene17::run() { if (_vm->_prevSceneNum == 53 || _vm->_prevSceneNum == 18 || _vm->_prevSceneNum == 20 || _vm->_prevSceneNum == 19) { if (_vm->_prevSceneNum == 20) { gnap.initPos(4, 6, kDirBottomRight); - plat.initPos(5, 6, kDirNone); + plat.initPos(5, 6, kDirIdleLeft); _vm->endSceneInit(); plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); @@ -2469,7 +2469,7 @@ void Scene17::run() { } else if (_vm->isFlag(kGFUnk25)) { _vm->clearFlag(kGFSpringTaken); _vm->clearFlag(kGFUnk16); - plat.initPos(7, 9, kDirNone); + plat.initPos(7, 9, kDirIdleLeft); gnap._pos = _vm->_hotspotsWalkPos[2]; gnap._id = 20 * _vm->_hotspotsWalkPos[2].y; gameSys.insertSequence(601, 20 * _vm->_hotspotsWalkPos[2].y, 0, 0, kSeqNone, 0, 0, 0); @@ -2499,18 +2499,18 @@ void Scene17::run() { updateHotspots(); } else if (_vm->_prevSceneNum == 18) { gnap.initPos(6, 6, kDirBottomRight); - plat.initPos(5, 6, kDirNone); + plat.initPos(5, 6, kDirIdleLeft); _vm->endSceneInit(); plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); } else { if (_vm->isFlag(kGFSpringTaken)) { gnap.initPos(_vm->_hotspotsWalkPos[2].x, _vm->_hotspotsWalkPos[2].y, kDirBottomRight); - plat.initPos(1, 9, kDirNone); + plat.initPos(1, 9, kDirIdleLeft); _vm->endSceneInit(); } else { gnap.initPos(3, 7, kDirBottomRight); - plat.initPos(1, 7, kDirNone); + plat.initPos(1, 7, kDirIdleLeft); _vm->endSceneInit(); } _vm->clearFlag(kGFSpringTaken); @@ -3275,13 +3275,13 @@ void Scene18::putDownGarbageCan(int animationIndex) { while (gameSys.getAnimationStatus(animationIndex) != 2 && !_vm->_gameDone) _vm->gameUpdateTick(); } - if (gnap._idleFacing != kDirNone && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) + if (gnap._idleFacing != kDirIdleLeft && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) _vm->_s18GarbageCanPos = gnap._pos.x - 1; else _vm->_s18GarbageCanPos = gnap._pos.x + 1; _vm->clearFlag(kGFPlatypusDisguised); updateHotspots(); - if (gnap._idleFacing != kDirNone && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) { + if (gnap._idleFacing != kDirIdleLeft && gnap._idleFacing != kDirBottomRight && gnap._idleFacing != kDirUpRight) { gameSys.insertSequence(0x107BA, gnap._id, makeRid(gnap._sequenceDatNum, gnap._sequenceId), gnap._id, kSeqSyncWait, 0, 75 * gnap._pos.x - gnap._gridX, 48 * gnap._pos.y - gnap._gridY); @@ -3429,19 +3429,19 @@ void Scene18::run() { } if (_vm->_prevSceneNum == 17) { gnap.initPos(4, 11, kDirBottomRight); - plat.initPos(5, 11, kDirNone); + plat.initPos(5, 11, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(4, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); } else if (_vm->_prevSceneNum == 19) { gnap.initPos(7, 7, kDirBottomRight); - plat.initPos(8, 7, kDirNone); + plat.initPos(8, 7, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { gnap.initPos(-1, 10, kDirBottomRight); - plat.initPos(-1, 10, kDirNone); + plat.initPos(-1, 10, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 7), -1, 0x107B9, 1); plat.walkTo(Common::Point(3, 8), -1, 0x107C2, 1); @@ -3781,7 +3781,7 @@ void Scene18::run() { if (!_vm->_timers[6]) { plat._actionStatus = -1; _vm->_sceneWaiting = false; - plat.initPos(-1, 10, kDirNone); + plat.initPos(-1, 10, kDirIdleLeft); plat.walkTo(Common::Point(3, 9), -1, 0x107C2, 1); _vm->clearFlag(kGFPlatypusTalkingToAssistant); } @@ -4157,7 +4157,7 @@ void Scene19::run() { gameSys.insertSequence(_currShopAssistantSequenceId, 20, 0, 0, kSeqNone, 0, 0, 0); _vm->_timers[6] = _vm->getRandom(40) + 50; gnap.initPos(3, 6, kDirBottomRight); - plat.initPos(4, 6, kDirNone); + plat.initPos(4, 6, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(4, 9), -1, 0x107B9, 1); plat.walkTo(Common::Point(5, 9), -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 3e61fafc8f..020b3d151c 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -209,42 +209,42 @@ void Scene20::run() { _vm->gameUpdateTick(); gnap.initPos(11, 8, kDirBottomLeft); - plat.initPos(11, 9, kDirUnk4); + plat.initPos(11, 9, kDirIdleRight); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(6, 9), -1, 0x107C2, 1); } else { switch (_vm->_prevSceneNum) { case 17: gnap.initPos(5, 11, kDirBottomRight); - plat.initPos(6, 11, kDirNone); + plat.initPos(6, 11, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 18: gnap.initPos(11, 8, kDirBottomLeft); - plat.initPos(11, 9, kDirUnk4); + plat.initPos(11, 9, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(6, 9), -1, 0x107C2, 1); break; case 21: gnap.initPos(-1, 8, kDirBottomLeft); - plat.initPos(-1, 9, kDirUnk4); + plat.initPos(-1, 9, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 22: gnap.initPos(7, 6, kDirBottomRight); - plat.initPos(8, 6, kDirNone); + plat.initPos(8, 6, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(9, 9), -1, 0x107C2, 1); break; default: gnap.initPos(8, 6, kDirBottomLeft); - plat.initPos(9, 6, kDirUnk4); + plat.initPos(9, 6, kDirIdleRight); _vm->endSceneInit(); _vm->_hotspots[kHS20WalkArea2]._flags |= SF_WALKABLE; gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); @@ -307,7 +307,7 @@ void Scene20::run() { gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot], 0, 0x107AF, 1); gnap._actionStatus = kAS20LeaveScene; plat.walkTo(_vm->_hotspotsWalkPos[kHS20ExitParkingLot] + Common::Point(0, 1), -1, 0x107CF, 1); - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; } break; @@ -346,7 +346,7 @@ void Scene20::run() { gnap.walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(0, - 1), 0, 0x107BB, 1); gnap._actionStatus = kAS20LeaveScene; plat.walkTo(_vm->_hotspotsWalkPos[kHS20ExitInsideGrubCity] + Common::Point(1, 0), -1, 0x107C2, 1); - plat._idleFacing = kDirUnk4; + plat._idleFacing = kDirIdleRight; } break; @@ -750,7 +750,7 @@ void Scene21::run() { if (_vm->isFlag(kGFTwigTaken)) { if (_vm->isFlag(kGFKeysTaken)) { gnap.initPos(5, 8, kDirBottomRight); - plat.initPos(6, 8, kDirNone); + plat.initPos(6, 8, kDirIdleLeft); gameSys.insertSequence(0x8E, 2, 0, 0, kSeqNone, 0, 0, 0); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); @@ -758,7 +758,7 @@ void Scene21::run() { _vm->clearFlag(kGFKeysTaken); } else { gnap.initPos(5, 11, kDirBottomRight); - plat.initPos(6, 11, kDirNone); + plat.initPos(6, 11, kDirIdleLeft); if (!_vm->isFlag(kGFUnk04)) gameSys.insertSequence(0x8D, 59, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -767,7 +767,7 @@ void Scene21::run() { } } else { gnap.initPos(5, 11, kDirBottomRight); - plat.initPos(6, 11, kDirNone); + plat.initPos(6, 11, kDirIdleLeft); _currOldLadySequenceId = 0x89; gameSys.setAnimation(0x89, 79, 3); gameSys.insertSequence(_currOldLadySequenceId, 79, 0, 0, kSeqNone, 0, 0, 0); @@ -1052,11 +1052,11 @@ void Scene22::run() { if (_vm->_prevSceneNum == 20) { gnap.initPos(2, 8, kDirBottomRight); - plat.initPos(1, 8, kDirNone); + plat.initPos(1, 8, kDirIdleLeft); _vm->endSceneInit(); } else { gnap.initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y, kDirBottomRight); - plat.initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirNone); + plat.initPos(11, _vm->_hotspotsWalkPos[kHS22ExitBackGrubCity].y + 1, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(9, 8), -1, 0x107C2, 1); @@ -1304,7 +1304,7 @@ void Scene23::run() { _vm->queueInsertDeviceIcon(); gnap.initPos(-1, 7, kDirBottomRight); - plat.initPos(-2, 7, kDirNone); + plat.initPos(-2, 7, kDirIdleLeft); gameSys.insertSequence(0xBD, 255, 0, 0, kSeqNone, 0, 0, 0); gameSys.insertSequence(0xBF, 2, 0, 0, kSeqNone, 0, 0, 0); _vm->endSceneInit(); @@ -1577,13 +1577,13 @@ void Scene24::run() { if (_vm->_prevSceneNum == 20) { gnap.initPos(1, 8, kDirBottomRight); - plat.initPos(2, 8, kDirNone); + plat.initPos(2, 8, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(1, 9), -1, 0x107B9, 1); plat.walkTo(Common::Point(2, 9), -1, 0x107C2, 1); } else { gnap.initPos(8, 8, kDirBottomLeft); - plat.initPos(8, 8, kDirUnk4); + plat.initPos(8, 8, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(3, 8), -1, 0x107C2, 1); @@ -1827,13 +1827,13 @@ void Scene25::run() { if (_vm->_prevSceneNum == 24) { gnap.initPos(5, 11, kDirUpLeft); - plat.initPos(6, 11, kDirUnk4); + plat.initPos(6, 11, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 7), -1, 0x107BA, 1); plat.walkTo(Common::Point(6, 7), -1, 0x107C2, 1); } else { gnap.initPos(5, 6, kDirBottomRight); - plat.initPos(6, 6, kDirNone); + plat.initPos(6, 6, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(5, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); @@ -2148,13 +2148,13 @@ void Scene26::run() { if (_vm->_prevSceneNum == 25) { gnap.initPos(-1, 8, kDirBottomRight); - plat.initPos(-2, 8, kDirNone); + plat.initPos(-2, 8, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(1, 8), -1, 0x107C2, 1); } else { gnap.initPos(2, 8, kDirBottomRight); - plat.initPos(3, 8, kDirNone); + plat.initPos(3, 8, kDirIdleLeft); _vm->endSceneInit(); } @@ -2365,28 +2365,28 @@ void Scene27::run() { switch (_vm->_prevSceneNum) { case 26: gnap.initPos(7, 12, kDirBottomRight); - plat.initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); break; case 29: gnap.initPos(-1, 8, kDirBottomRight); - plat.initPos(-1, 9, kDirNone); + plat.initPos(-1, 9, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(3, 9), -1, 0x107C2, 1); break; case 31: gnap.initPos(12, 8, kDirBottomLeft); - plat.initPos(12, 9, kDirUnk4); + plat.initPos(12, 9, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(8, 9), -1, 0x107C2, 1); break; default: gnap.initPos(6, 8, kDirBottomRight); - plat.initPos(5, 9, kDirNone); + plat.initPos(5, 9, kDirIdleLeft); _vm->endSceneInit(); break; } @@ -2742,12 +2742,12 @@ void Scene28::run() { _vm->_timers[4] = _vm->getRandom(20) + 80; } gnap.initPos(8, 8, kDirBottomLeft); - plat.initPos(9, 8, kDirUnk4); + plat.initPos(9, 8, kDirIdleRight); _vm->endSceneInit(); } else { gameSys.insertSequence(0x11B, 39, 0, 0, kSeqNone, 0, 0, 0); gnap.initPos(8, 8, kDirBottomLeft); - plat.initPos(9, 8, kDirUnk4); + plat.initPos(9, 8, kDirIdleRight); _vm->endSceneInit(); _vm->playSequences(0xF7, 0x121, 0x122, 0x123); _currClownSequenceId = 0x115; @@ -3149,13 +3149,13 @@ void Scene29::run() { if (_vm->_prevSceneNum == 27) { gnap.initPos(12, 7, kDirBottomRight); - plat.initPos(12, 8, kDirNone); + plat.initPos(12, 8, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 7), -1, 0x107B9, 1); plat.walkTo(Common::Point(8, 8), -1, 0x107C2, 1); } else { gnap.initPos(-1, 7, kDirBottomRight); - plat.initPos(-2, 7, kDirNone); + plat.initPos(-2, 7, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(2, 7), -1, 0x107B9, 1); plat.walkTo(Common::Point(1, 7), -1, 0x107C2, 1); diff --git a/engines/gnap/scenes/group3.cpp b/engines/gnap/scenes/group3.cpp index b10e7975e5..98a4f6c454 100644 --- a/engines/gnap/scenes/group3.cpp +++ b/engines/gnap/scenes/group3.cpp @@ -68,7 +68,7 @@ void Scene30::run() { _kidSequenceId = 0x101; gnap.initPos(7, 12, kDirBottomRight); - plat.initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107B9, 1); plat.walkTo(Common::Point(6, 8), -1, 0x107C2, 1); @@ -319,13 +319,13 @@ void Scene31::run() { if (_vm->_prevSceneNum == 27) { gnap.initPos(-1, 8, kDirBottomLeft); - plat.initPos(-1, 9, kDirUnk4); + plat.initPos(-1, 9, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(3, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(3, 9), -1, 0x107D2, 1); } else { gnap.initPos(7, 12, kDirBottomRight); - plat.initPos(6, 12, kDirNone); + plat.initPos(6, 12, kDirIdleLeft); _vm->endSceneInit(); gnap.walkTo(Common::Point(7, 8), -1, 0x107BA, 1); plat.walkTo(Common::Point(6, 8), -1, 0x107D2, 1); @@ -675,13 +675,13 @@ void Scene32::run() { if (_vm->_prevSceneNum == 33) { gnap.initPos(11, 6, kDirBottomLeft); - plat.initPos(12, 6, kDirUnk4); + plat.initPos(12, 6, kDirIdleRight); _vm->endSceneInit(); plat.walkTo(Common::Point(9, 6), -1, 0x107D2, 1); gnap.walkTo(Common::Point(8, 6), -1, 0x107BA, 1); } else { gnap.initPos(1, 6, kDirBottomRight); - plat.initPos(1, 7, kDirNone); + plat.initPos(1, 7, kDirIdleLeft); _vm->endSceneInit(); } @@ -839,26 +839,26 @@ void Scene33::run() { switch (_vm->_prevSceneNum) { case 34: gnap.initPos(11, 7, kDirBottomLeft); - plat.initPos(12, 7, kDirUnk4); + plat.initPos(12, 7, kDirIdleRight); _vm->endSceneInit(); gnap.walkTo(Common::Point(8, 7), -1, 0x107BA, 1); plat.walkTo(Common::Point(9, 7), -1, 0x107D2, 1); break; case 37: gnap.initPos(7, 7, kDirBottomRight); - plat.initPos(8, 7, kDirNone); + plat.initPos(8, 7, kDirIdleLeft); _vm->endSceneInit(); break; case 32: gnap.initPos(-1, 6, kDirBottomRight); - plat.initPos(-1, 7, kDirNone); + plat.initPos(-1, 7, kDirIdleLeft); _vm->endSceneInit(); plat.walkTo(Common::Point(2, 7), -1, 0x107C2, 1); gnap.walkTo(Common::Point(2, 8), -1, 0x107B9, 1); break; default: gnap.initPos(3, 7, kDirBottomRight); - plat.initPos(2, 7, kDirNone); + plat.initPos(2, 7, kDirIdleLeft); _vm->endSceneInit(); break; } @@ -1142,10 +1142,10 @@ void Scene38::run() { if (_vm->_prevSceneNum == 39) { gnap.initPos(3, 7, kDirBottomLeft); - plat.initPos(4, 7, kDirUnk4); + plat.initPos(4, 7, kDirIdleRight); } else { gnap.initPos(3, 8, kDirBottomRight); - plat.initPos(4, 8, kDirNone); + plat.initPos(4, 8, kDirIdleLeft); } _vm->endSceneInit(); @@ -1372,7 +1372,7 @@ void Scene38::updateAnimations() { gnap._sequenceDatNum = 0; gameSys.setAnimation(0x9F, gnap._id, 0); gnap._actionStatus = kAS38HoldingHuntingTrophy; - if (plat._idleFacing != kDirNone) + if (plat._idleFacing != kDirIdleLeft) plat.playSequence(0x107D5); else plat.playSequence(0x107D4); @@ -1448,7 +1448,7 @@ void Scene39::run() { _vm->endSceneInit(); } else { gnap.initPos(4, 7, kDirBottomRight); - plat.initPos(5, 7, kDirNone); + plat.initPos(5, 7, kDirIdleLeft); _vm->endSceneInit(); } diff --git a/engines/gnap/scenes/group4.cpp b/engines/gnap/scenes/group4.cpp index b12d2ad4a1..f37be2c25d 100644 --- a/engines/gnap/scenes/group4.cpp +++ b/engines/gnap/scenes/group4.cpp @@ -1708,13 +1708,13 @@ void Scene44::run() { case 50: gnap.initPos(4, 8, kDirBottomRight); if (_vm->_sceneSavegameLoaded) { - plat.initPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirUnk4); + plat.initPos(_vm->_hotspotsWalkPos[4].x, _vm->_hotspotsWalkPos[4].y, kDirIdleRight); } else if (!_vm->isFlag(kGFUnk13)) { _vm->_timers[0] = 50; _vm->_timers[1] = 20; plat._pos = Common::Point(5, 8); plat._sequenceId = 0xFD; - plat._idleFacing = kDirNone; + plat._idleFacing = kDirIdleLeft; plat._id = 160; plat._sequenceDatNum = 0; gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); @@ -2032,7 +2032,7 @@ void Scene44::updateAnimations() { if (gameSys.getAnimationStatus(2) == 2) { if (_nextKissingLadySequenceId == 0xF6) { gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - plat.initPos(5, 8, kDirNone); + plat.initPos(5, 8, kDirIdleLeft); _currKissingLadySequenceId = _nextKissingLadySequenceId; _nextKissingLadySequenceId = -1; gameSys.setAnimation(0, 0, 2); @@ -2162,7 +2162,7 @@ void Scene45::run() { gameSys.setAnimation(0x9E, 1, 0); gnap._actionStatus = 1; gameSys.insertSequence(gnap._sequenceId, gnap._id, 0, 0, kSeqNone, 0, 0, 0); - plat.initPos(4, 8, kDirNone); + plat.initPos(4, 8, kDirIdleLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { gnap.initPos(-1, 8, kDirUpRight); -- cgit v1.2.3 From aeb36d4afc0c6b5961adc411dc03b00a96a86f99 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 07:52:48 +0200 Subject: GNAP: Add safeguard checks in PlayerGnap's getWalkStopSequenceId and getWalkFacing --- engines/gnap/grid.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/engines/gnap/grid.cpp b/engines/gnap/grid.cpp index 2197317227..aa6da71395 100644 --- a/engines/gnap/grid.cpp +++ b/engines/gnap/grid.cpp @@ -68,8 +68,10 @@ int PlayerGnap::getWalkStopSequenceId(int deltaX, int deltaY) { 0x7BC, 0x000, 0x7BA, 0x7BB, 0x7B9, 0x7B9 }; - // CHECKME This is a little weird - return gnapWalkStopSequenceIds[3 * deltaX + 3 + 1 + deltaY]; + + int id = 3 * (deltaX + 1) + deltaY + 1; + assert (id >= 0 && id < 9 ); + return gnapWalkStopSequenceIds[id]; } Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) { @@ -78,8 +80,10 @@ Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) { kDirUpLeft, kDirIdleLeft, kDirBottomLeft, kDirUpRight, kDirBottomRight, kDirBottomRight }; - // CHECKME This is a little weird - return gnapWalkFacings[3 * deltaX + 3 + 1 + deltaY]; + + int id = 3 * (deltaX + 1) + deltaY + 1; + assert (id >= 0 && id < 9 ); + return gnapWalkFacings[id]; } bool PlayerGnap::findPath1(int gridX, int gridY, int index) { -- cgit v1.2.3 From ecdf982eba72f00c34aa73644c074f60e493887b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 07:57:21 +0200 Subject: GNAP: Add a note, remove a checkme --- engines/gnap/character.cpp | 2 ++ engines/gnap/scenes/scenecore.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 5eb35d1237..76e30d9dfa 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -1287,6 +1287,8 @@ int PlayerPlat::getWalkSequenceId(int deltaX, int deltaY) { } bool PlayerPlat::walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) { + // Note: flags is always 1. The code could be simplified. + int datNum = flags & 3; PlayerGnap& gnap = *_vm->_gnap; diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index d34f46037f..5e941f4975 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -660,7 +660,7 @@ void CutScene::run() { if (_vm->_prevSceneNum == 2) { soundId = 0x36B; - duration = MAX(1, 300 / _vm->getSequenceTotalDuration(_sequenceIdArr[_itemsCount - 1]));//CHECKME + duration = MAX(1, 300 / _vm->getSequenceTotalDuration(_sequenceIdArr[_itemsCount - 1])); _vm->_timers[0] = 0; } -- cgit v1.2.3 From 7eeb50e488ba4177d635e2396ab6b51ac9601b26 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 18:53:07 +0200 Subject: GNAP: As suggested by Tsoliman, tag the games as unstable --- engines/gnap/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index b68d64c4ed..a7e9eece4a 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -43,7 +43,7 @@ static const ADGameDescription gameDescriptions[] = { {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12515823}, AD_LISTEND }, - Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() + Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO0() }, { "gnap", "", @@ -51,7 +51,7 @@ static const ADGameDescription gameDescriptions[] = { {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12995485}, AD_LISTEND }, - Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() + Common::RU_RUS, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO0() }, AD_TABLE_END_MARKER -- cgit v1.2.3 From 94c58f9143a45bbbae74260633f6ca1be6b10597 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 19:22:09 +0200 Subject: GNAP: Add safeguard in setSoundVolume --- engines/gnap/sound.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/gnap/sound.cpp b/engines/gnap/sound.cpp index a4a59d7390..75cfb5555c 100644 --- a/engines/gnap/sound.cpp +++ b/engines/gnap/sound.cpp @@ -57,6 +57,9 @@ void SoundMan::stopSound(int resourceId) { } void SoundMan::setSoundVolume(int resourceId, int volume) { + if (resourceId == -1 || volume < 0 || volume > 100) + return; + const int index = find(resourceId); int realVol = volume * 2.55; _vm->_mixer->setChannelVolume(_items[index]._handle, realVol); -- cgit v1.2.3 From e14e7992cc95dce8c78d1fa7ccf6e7d0ab876095 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 23 May 2016 19:39:56 +0200 Subject: GNAP: Fix inventory content when loading from launcher --- engines/gnap/gnap.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index cc0ac2e8b3..8acc3eedae 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -705,6 +705,7 @@ void GnapEngine::mainLoop() { int slot = _loadGameSlot; _loadGameSlot = -1; loadGameState(slot); + _wasSavegameLoaded = true; showCursor(); } -- cgit v1.2.3